@seams/voice-capture 0.0.0-stage → 0.66.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.
Files changed (48) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +174 -2
  3. package/dist/assets/NOTICE.txt +3 -0
  4. package/dist/assets/SILERO_LICENSE.txt +21 -0
  5. package/dist/assets/ort-wasm-simd-threaded.mjs +59 -0
  6. package/dist/assets/ort-wasm-simd-threaded.wasm +0 -0
  7. package/dist/assets/silero-vad.onnx +0 -0
  8. package/dist/assets/voice-activity-worklet.js +21 -0
  9. package/dist/browser/card.js +800 -0
  10. package/dist/browser/chunks/microphone-CU5gQG6w.js +1 -0
  11. package/dist/browser/chunks/ort.wasm.bundle.min-CWqlff_l.js +3 -0
  12. package/dist/browser/index.js +1 -0
  13. package/dist/esm/card/index.js +6 -0
  14. package/dist/esm/card/phraseCard.js +459 -0
  15. package/dist/esm/card/prompt.js +1074 -0
  16. package/dist/esm/card/ribbon.js +489 -0
  17. package/dist/esm/card/surface.js +224 -0
  18. package/dist/esm/card/types.js +0 -0
  19. package/dist/esm/card/visual.js +2 -0
  20. package/dist/esm/chunks/visual-Di3ojTED.js +1520 -0
  21. package/dist/esm/config.js +42 -0
  22. package/dist/esm/index.js +8 -0
  23. package/dist/esm/inference.js +193 -0
  24. package/dist/esm/microphone.js +428 -0
  25. package/dist/esm/microphoneInput.js +117 -0
  26. package/dist/esm/speechPause.js +33 -0
  27. package/dist/esm/voiceActivity.js +69 -0
  28. package/dist/esm/wav.js +36 -0
  29. package/dist/example/example.js +71 -0
  30. package/dist/example/index.html +29 -0
  31. package/dist/hosting.d.mts +4 -0
  32. package/dist/hosting.mjs +26 -0
  33. package/dist/types/card/index.d.ts +6 -0
  34. package/dist/types/card/phraseCard.d.ts +72 -0
  35. package/dist/types/card/prompt.d.ts +122 -0
  36. package/dist/types/card/ribbon.d.ts +62 -0
  37. package/dist/types/card/surface.d.ts +28 -0
  38. package/dist/types/card/types.d.ts +65 -0
  39. package/dist/types/card/visual.d.ts +25 -0
  40. package/dist/types/config.d.ts +47 -0
  41. package/dist/types/index.d.ts +7 -0
  42. package/dist/types/inference.d.ts +47 -0
  43. package/dist/types/microphone.d.ts +81 -0
  44. package/dist/types/microphoneInput.d.ts +19 -0
  45. package/dist/types/speechPause.d.ts +8 -0
  46. package/dist/types/voiceActivity.d.ts +15 -0
  47. package/dist/types/wav.d.ts +9 -0
  48. package/package.json +57 -4
@@ -0,0 +1,800 @@
1
+ import{C as e,_ as t,a as n,l as r,m as i,n as a,o,x as s}from"./chunks/microphone-CU5gQG6w.js";const c=`http://www.w3.org/2000/svg`,l=`cubic-bezier(0.2, 0, 0, 1)`,u=`cubic-bezier(0.65, 0, 0.35, 1)`,d=[`M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3`,`M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6`,`M12 11v2a14 14 0 0 0 2.5 8`,`M8 15a18 18 0 0 0 1.8 6`,`M4.9 19a22 22 0 0 1-.9-7v-1a8 8 0 0 1 12-6.95`];var f=class{line;segments=[];bar;ring;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);rows;states=[];rendering=Promise.resolve();morph=null;rotation=0;version=0;disposed=!1;constructor(e,t,n=null){this.prompt=e,this.copy=t;let r=e.element.ownerDocument;this.line=r.createElementNS(c,`svg`),this.line.classList.add(`seams-voiceid-status-line`),this.line.setAttribute(`viewBox`,`0 0 308 64`),this.line.setAttribute(`aria-hidden`,`true`);for(let e=0;e<6;e+=1){let e=r.createElementNS(c,`rect`);e.setAttribute(`rx`,`1.5`),this.line.append(e),this.segments.push(e)}this.bar=r.createElementNS(c,`path`),this.bar.classList.add(`seams-voiceid-status-bar`),this.bar.setAttribute(`d`,`M1.5 32H306.5`),this.ring=r.createElementNS(c,`circle`),this.ring.classList.add(`seams-voiceid-status-ring`),this.ring.setAttribute(`r`,`21.5`),this.seal=r.createElementNS(c,`circle`),this.seal.classList.add(`seams-voiceid-status-seal`),this.seal.setAttribute(`r`,`22.5`);for(let e of[this.ring,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);this.check=r.createElementNS(c,`path`),this.check.classList.add(`seams-voiceid-status-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`pathLength`,`1`),this.line.append(this.bar,this.ring,this.seal,this.check),e.ribbon.after(this.line),this.rows=n?{...this.promptRows(),label:n.label,caption:`handed-over:${n.message}`,action:``}:this.promptRows(),this.layoutSegments(0,3)}showPrompt(){let e=this.begin();return this.queue(async()=>{if(this.stale(e))return;let t=this.prompt.element;t.removeAttribute(`aria-busy`),await this.transition(this.promptRows(),e,()=>{delete t.dataset.phraseView,delete t.dataset.phraseLine,this.writeCaption(this.copy.message,[]),this.writeAction({label:this.copy.action}),this.resetLine(),this.prompt.ready(this.copy.message)}),this.stale(e)||this.prompt.record.focus()})}beginCheck(){this.disposed||this.morph||(this.prompt.flattenLine(),this.morph=this.openSegments())}show(e){let t=this.begin();return this.queue(async()=>{if(this.stale(t))return;let n=this.prompt.element;if(this.prompt.flattenLine(),this.morph??=this.openSegments(),e.kind===`check`){n.setAttribute(`aria-busy`,`true`);let r=e.details[0]??``,i={label:e.label,head:this.copy.sentence,headline:!1,dim:!0,caption:`check:${e.caption}:${r}`,action:``};if(await this.transition(i,t,()=>{n.dataset.phraseView=`check`,this.writeCaption(e.caption,[r])}),await this.morph,this.stale(t))return;await this.setSegments(e.segments),this.stale(t)||this.rotateDetails(e.details,t);return}if(n.removeAttribute(`aria-busy`),await this.morph,this.stale(t)||(e.line===`seal`?await this.sealLine(t):await this.setSegments(e.line),this.stale(t)))return;this.prompt.quietLine();let r={label:e.label,head:e.headline,headline:!0,dim:!1,caption:`result:${JSON.stringify([e.caption,e.detail,e.link??null])}`,action:`result:${e.action.icon??``}:${e.action.label}`};await this.transition(r,t,()=>{n.dataset.phraseView=`result`,this.writeCaption(this.markedText(e.caption),this.detailNodes(e)),this.writeAction(e.action),this.prompt.record.hidden=!1}),!this.stale(t)&&(this.prompt.record.disabled=e.action.busy===!0,e.action.busy||this.prompt.record.focus())})}dispose(){this.disposed=!0,this.version+=1,window.clearInterval(this.rotation)}begin(){return window.clearInterval(this.rotation),this.version+=1,this.version}stale(e){return this.disposed||e!==this.version}queue(e){return this.rendering=this.rendering.then(e,e),this.rendering}promptRows(){return{label:this.copy.label,head:this.copy.sentence,headline:!1,dim:!1,caption:`prompt:${this.copy.message}`,action:`prompt:${this.copy.action}`}}async transition(e,t,n){let r=this.prompt,i=[[`label`,r.title],[`head`,r.phrase],[`caption`,r.status],[`action`,r.actionRow]].filter(([t])=>this.rows[t]!==e[t]||t===`head`&&this.rows.headline!==e.headline).map(([,e])=>e);if(r.phrase.classList.toggle(`seams-voiceid-phrase-dim`,e.dim),i.length>0&&!this.motion.matches&&await Promise.all(i.map(e=>m(e,150))),this.stale(t))return;let a=r.ribbon.getBoundingClientRect().top,o=r.element.getBoundingClientRect().height;r.title.textContent=e.label,r.phrase.textContent=e.head,r.phrase.classList.toggle(`seams-voiceid-success-headline`,e.headline),n(),this.rows=e,r.fillFrame(o);let s=a-r.ribbon.getBoundingClientRect().top;if(Math.abs(s)>.5&&!this.motion.matches)for(let e of[r.ribbon,this.line])e.animate([{transform:`translateY(${s}px)`},{transform:`none`}],{duration:180,easing:`cubic-bezier(0.2, 0.7, 0.2, 1)`});for(let[e,t]of i.entries())h(t,this.motion.matches,60+e*40)}markedText(e){if(typeof e==`string`)return[e];let t=this.prompt.element.ownerDocument;return e.map(e=>{if(typeof e==`string`)return e;let n=t.createElement(`mark`);return n.className=`seams-voiceid-heard-mark`,n.textContent=e.mark,n})}detailNodes(e){if(!e.link)return[e.detail];let t=this.prompt.element.ownerDocument.createElement(`a`);return t.href=e.link.href,t.target=`_blank`,t.rel=`noopener noreferrer`,t.textContent=e.link.text,[e.detail,` `,t]}writeCaption(e,t){let n=this.prompt.status;if(typeof e==`string`&&t.length===0){n.classList.remove(`seams-voiceid-two-lines`),n.textContent=e;return}let r=n.ownerDocument,i=r.createElement(`span`);i.className=`seams-voiceid-caption`,i.append(...typeof e==`string`?[e]:e);let a=r.createElement(`span`);a.className=`seams-voiceid-caption-detail`,a.append(...t),n.replaceChildren(i,a),n.classList.add(`seams-voiceid-two-lines`)}writeAction(e){let t=this.prompt.record;t.replaceChildren(),e.icon===`passkey`&&t.append(p(t.ownerDocument)),t.append(e.label)}rotateDetails(e,t){if(e.length<2)return;let n=0;this.rotation=window.setInterval(()=>{n+=1,(n>=e.length-1||this.stale(t))&&window.clearInterval(this.rotation),n<e.length&&!this.stale(t)&&this.swapDetail(e[n],t)},1300)}async swapDetail(e,t){let n=this.prompt.status.querySelector(`.seams-voiceid-caption-detail`);n&&(this.motion.matches||await m(n,90),!this.stale(t)&&(n.textContent=e,n.getAnimations().forEach(e=>e.cancel()),n.animate([{opacity:0,transform:this.motion.matches?`none`:`translateY(2px)`},{opacity:1,transform:`none`}],{duration:160,easing:l,fill:`both`})))}async openSegments(){await g(this.motion.matches?0:200),!this.disposed&&(this.states=Array.from({length:6},()=>`done`),this.paintStates(),this.prompt.element.dataset.phraseLine=`status`,await this.tween(this.motion.matches?0:200,e=>this.layoutSegments(8*e,1+2*e)),!this.disposed&&(this.states=this.states.map((e,t)=>t===0?`done`:`idle`),this.paintStates(),await g(this.motion.matches?0:240)))}async setSegments(e){let t=e.map((e,t)=>e===`done`&&this.states[t]===`run`?t:-1).filter(e=>e>=0),n=[...e];this.states=n.map((e,n)=>t.includes(n)?`run`:e===`fail`||e===`wait`||e===`skip`?this.states[n]??`idle`:e),this.paintStates();for(let e of t){if(await g(this.motion.matches?0:70),this.disposed)return;this.states[e]=`done`,this.paintStates()}let r=n.some(e=>e===`fail`||e===`wait`);this.states=n,this.paintStates(),r&&await g(this.motion.matches?0:240)}async sealLine(e){if(await this.setSegments(Array.from({length:6},()=>`done`)),this.stale(e))return;let t=this.motion.matches;if(await this.tween(t?0:240,e=>this.layoutSegments(8*(1-e),3)),this.stale(e))return;this.line.dataset.seal=``;let n=2*Math.PI*21.5;this.ring.style.strokeDasharray=String(n);let r=(e,n)=>({duration:t?0:e,easing:n,fill:`forwards`});this.bar.animate([{transform:`scaleX(1)`},{transform:`scaleX(0)`}],r(440,u)),await this.ring.animate([{strokeDashoffset:n},{strokeDashoffset:0}],r(440,u)).finished,!this.stale(e)&&(this.seal.animate([{transform:`scale(0)`},{transform:`scale(1)`}],r(320,`cubic-bezier(0.34, 1.56, 0.64, 1)`)),await g(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,l)).finished)}resetLine(){this.morph=null,this.states=[],delete this.line.dataset.seal;for(let e of[this.bar,this.ring,this.seal,this.check])e.getAnimations().forEach(e=>e.cancel());this.layoutSegments(0,3),this.paintStates()}paintStates(){for(let[e,t]of this.segments.entries()){let n=this.states[e];n?t.dataset.state=n:delete t.dataset.state}}layoutSegments(e,t){let n=(308-5*e)/6;for(let[r,i]of this.segments.entries())i.setAttribute(`x`,(r*(n+e)).toFixed(2)),i.setAttribute(`width`,n.toFixed(2)),i.setAttribute(`y`,(32-t/2).toFixed(2)),i.setAttribute(`height`,t.toFixed(2))}tween(e,t){return e<=0?(t(1),Promise.resolve()):new Promise(n=>{let r=performance.now(),i=a=>{if(this.disposed)return n();let o=Math.min(1,(a-r)/e);t(1-(1-o)**3),o<1?requestAnimationFrame(i):n()};requestAnimationFrame(i)})}};function p(e){let t=e.createElementNS(c,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`width`,`18`),t.setAttribute(`height`,`18`),t.setAttribute(`aria-hidden`,`true`),t.classList.add(`seams-voiceid-action-icon`);for(let n of d){let r=e.createElementNS(c,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function m(e,t){let n=Number(getComputedStyle(e).opacity);return e.animate([{opacity:n},{opacity:0}],{duration:t*n,easing:`ease-in`,fill:`forwards`}).finished}function h(e,t,n){e.getAnimations().forEach(e=>e.cancel()),e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:t?0:n,duration:t?150:300,easing:l,fill:`both`})}function g(e){return new Promise(t=>window.setTimeout(t,e))}var _,v,y,b,x,S,C,w,T,E,D,ee,O,k,A={},te=[],j=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,M=Array.isArray;function N(e,t){for(var n in t)e[n]=t[n];return e}function ne(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?_.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return F(e,o,r,i,null)}function F(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++y,__i:-1,__u:0};return i==null&&v.vnode!=null&&v.vnode(a),a}function I(e){return e.children}function L(e,t){this.props=e,this.context=t}function R(e,t){if(t==null)return e.__?R(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?R(e):null}function re(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=N({},t);a.__v=t.__v+1,v.vnode&&v.vnode(a),me(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??R(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ge(r,a,i),t.__e=t.__=null,a.__e!=n&&z(a)}}function z(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),z(e)}function ie(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!ae.__r++||x!=v.debounceRendering)&&((x=v.debounceRendering)||S)(ae)}function ae(){try{for(var e,t=1;b.length;)b.length>t&&b.sort(C),e=b.shift(),t=b.length,re(e)}finally{b.length=ae.__r=0}}function oe(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||te,v=t.length;for(c=se(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||A,p.__i=d,g=me(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&ye(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=ce(p,c,e),f.__e&&=null):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function se(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=F(null,o,null,null,null):M(o)?o=e.__k[a]=F(I,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=F(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=ue(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=R(s)),be(s,s));return r}function ce(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=ce(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=R(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function le(e,t){return t||=[],e==null||typeof e==`boolean`||(M(e)?e.some(function(e){le(e,t)}):t.push(e)),t}function ue(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function de(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||j.test(t)?n:n+`px`}function fe(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||de(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||de(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(D,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[E]=r[E]:(n[E]=ee,e.addEventListener(t,a?k:O,a)):e.removeEventListener(t,a?k:O,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function pe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[T]==null)t[T]=ee++;else if(t[T]<n[E])return;return n(v.event?v.event(t):t)}}}function me(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,y,b,x,S,C,w,T,E,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=v.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(y=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new D(y,S):(t.__c=f=new L(y,S),f.constructor=D,f.render=xe),x&&x.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=N({},f.__s)),N(f.__s,D.getDerivedStateFromProps(y,f.__s))),m=f.props,h=f.state,f.__v=t,p)b&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&y!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(y,f.__s,S)){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),te.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=R(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,S),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=S,f.props=y,f.__P=e,f.__e=!1,C=v.__r,w=0,b)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),te.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=N(N({},r),f.getChildContext())),b&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===I&&u.key==null?_e(u.props.children):u,s=oe(e,M(T)?T:[T],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(E=a.length;E--;)ne(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||he(t),v.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ve(n.__e,t,n,r,i,a,o,c,l);return(u=v.diffed)&&u(t),128&t.__u?void 0:s}function he(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(he))}function ge(e,t,n){for(var r=0;r<n.length;r++)ye(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){v.__e(e,t.__v)}})}function _e(e){return typeof e!=`object`||!e||e.__b>0?e:M(e)?e.map(_e):e.constructor===void 0?N({},e):null}function ve(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||A,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(y);e=document.createElementNS(i,b,y.is&&y),s&&=(v.__m&&v.__m(t,a),!1),a=null}if(b==null)g===y||s&&e.data==y||(e.data=y);else{if(a=b==`textarea`&&y.defaultValue!=null?null:a&&_.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in y||l==`value`&&`defaultValue`in y||l==`checked`&&`defaultChecked`in y||fe(e,l,null,p,i);for(l in y)p=y[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||fe(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),oe(t.type==`template`?e.content:e,M(f)?f:[f],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&R(n,0),s,c),a!=null)for(l=a.length;l--;)ne(a[l]);s&&b!=`textarea`||(l=`value`,b==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||b==`progress`&&!m||b==`option`&&m!=g[l])&&fe(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&fe(e,l,h,g[l],i))}return e}function ye(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){v.__e(e,n)}}function be(e,t,n){var r,i;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ye(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){v.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&be(r[i],t,n||typeof e.type!=`function`);n||ne(e.__e),e.__c=e.__=e.__e=void 0}function xe(e,t,n){return this.constructor(e,n)}function Se(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),v.__&&v.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],me(t,e=(!r&&n||t).__k=P(I,null,[e]),i||A,A,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?_.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ge(a,e,o),e.props.children=null}_=te.slice,v={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},y=0,L.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=N({},this.state);typeof e==`function`&&(e=e(N({},n),this.props)),e&&N(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ie(this))},L.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ie(this))},L.prototype.render=I,b=[],S=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,C=function(e,t){return e.__v.__b-t.__v.__b},ae.__r=0,w=Math.random().toString(8),T=`__d`+w,E=`__a`+w,D=/(PointerCapture)$|Capture$/i,ee=0,O=pe(!1),k=pe(!0);var Ce,B,we,Te,Ee=0,De=[],V=v,Oe=V.__b,ke=V.__r,Ae=V.diffed,je=V.__c,Me=V.unmount,Ne=V.__;function Pe(e,t){V.__h&&V.__h(B,e,Ee||t),Ee=0;var n=B.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fe(e){return Ee=1,Ie(W,e)}function Ie(e,t,n){var r=Pe(Ce++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):W(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};B.__f=!0;var a=B.shouldComponentUpdate,o=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},B.shouldComponentUpdate=i}return r.__N||r.__}function Le(e,t){var n=Pe(Ce++,3);!V.__s&&U(n.__H,t)&&(n.__=e,n.u=t,B.__H.__h.push(n))}function Re(e){return Ee=5,ze(function(){return{current:e}},[])}function ze(e,t){var n=Pe(Ce++,7);return U(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Be(e,t){return Ee=8,ze(function(){return e},t)}function Ve(){var e=Pe(Ce++,11);if(!e.__){for(var t=B.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function He(){for(var e;e=De.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(We),t.__h.some(Ge),t.__h=[]}catch(n){t.__h=[],V.__e(n,e.__v)}}}V.__b=function(e){B=null,Oe&&Oe(e)},V.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},V.__r=function(e){ke&&ke(e),Ce=0;var t=(B=e.__c).__H;t&&(we===B?(t.__h=[],B.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(We),t.__h.some(Ge),t.__h=[],Ce=0)),we=B},V.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(De.push(t)!==1&&Te===V.requestAnimationFrame||((Te=V.requestAnimationFrame)||H)(He)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),we=B=null},V.__c=function(e,t){t.some(function(e){try{e.__h.some(We),e.__h=e.__h.filter(function(e){return!e.__||Ge(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],V.__e(n,e.__v)}}),je&&je(e,t)},V.unmount=function(e){Me&&Me(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{We(e)}catch(e){t=e}}),n.__H=void 0,t&&V.__e(t,n.__v))};var Ue=typeof requestAnimationFrame==`function`;function H(e){var t,n=function(){clearTimeout(r),Ue&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ue&&(t=requestAnimationFrame(n))}function We(e){var t=B,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),B=t}function Ge(e){var t=B;e.__c=e.__(),B=t}function U(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function W(e,t){return typeof t==`function`?t(e):t}function Ke(e,t){for(var n in t)e[n]=t[n];return e}function qe(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Je(e,t){this.props=e,this.context=t}(Je.prototype=new L).isPureReactComponent=!0,Je.prototype.shouldComponentUpdate=function(e,t){return qe(this.props,e)||qe(this.state,t)};var Ye=v.__b;v.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ye&&Ye(e)};var Xe=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function Ze(e){function t(t){var n=Ke({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Xe,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var Qe=v.__e;v.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Qe(e,t,n,r)};var $e=v.unmount;function et(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Ke({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return et(e,t,n)})),e}function tt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return tt(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function nt(){this.__u=0,this.o=null,this.__b=null}function rt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function it(){this.i=null,this.l=null}v.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),$e&&$e(e)},(nt.prototype=new L).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=rt(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=tt(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},nt.prototype.componentWillUnmount=function(){this.o=[]},nt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=et(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&P(I,null,e.fallback);return i&&(i.__u&=-33),[P(I,null,t.__a?null:e.children),i]};var at=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(it.prototype=new L).__a=function(e){var t=this,n=rt(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),at(t,e,r)):i()};n?n(a):a()}},it.prototype.render=function(e){this.i=null,this.l=new Map;var t=le(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},it.prototype.componentDidUpdate=it.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){at(e,n,t)})};var ot=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,st=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ct=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,lt=/[A-Z0-9]/g,ut=typeof document<`u`,dt=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};L.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(L.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ft=v.event;v.event=function(e){return ft&&(e=ft(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var pt={configurable:!0,get:function(){return this.class}},mt=v.vnode;v.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||ut&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||dt(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:ct.test(a)&&(a=s):s=a=`oninput`:i&&st.test(a)?a=a.replace(lt,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=le(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=le(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,`className`,pt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=ot,mt&&mt(e)};var ht=v.__r;v.__r=function(e){ht&&ht(e),e.__c};var gt=v.diffed;v.diffed=function(e){gt&&gt(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var _t=0;Array.isArray;function G(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_t,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return v.vnode&&v.vnode(l),l}function vt(e){let t=e.trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){let e=n[1].length===3?n[1].split(``).map(e=>e+e).join(``):n[1];return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}let r=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return r?[Math.round(+r[1]),Math.round(+r[2]),Math.round(+r[3])]:null}function yt(e){let t=vt(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function bt(e){let t=vt(e);return t?`${t[0]}, ${t[1]}, ${t[2]}`:null}const xt={dark:{strokeOpacity:1.16,innerOpacity:.47,bloomOpacity:.89,innerShadow:`rgba(255, 255, 255, 0.1)`,saturation:1.2,brightness:1.1},light:{strokeOpacity:1.2,innerOpacity:.85,bloomOpacity:.5,innerShadow:`rgba(0, 0, 0, 0.08)`,saturation:1.6,brightness:.95,hueRange:40,hueDuration:8.5,hueBase:5,strength:.8,bandStrength:1.7}},St=[{x:0,w:74,h:46,band:0},{x:-36,w:54,h:40,band:1},{x:36,w:54,h:40,band:1},{x:-72,w:48,h:32,band:2},{x:72,w:48,h:32,band:2},{x:-108,w:42,h:26,band:1},{x:108,w:42,h:26,band:1}],Ct=36*St.length,wt={colorful:{dark:[`rgb(255, 70, 120)`,`rgb(60, 190, 255)`,`rgb(175, 70, 255)`,`rgb(60, 220, 130)`,`rgb(255, 150, 40)`,`rgb(90, 100, 255)`,`rgb(40, 200, 190)`],light:[`rgb(255, 201, 21)`,`rgb(126, 196, 255)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(255, 176, 122)`,`rgb(154, 160, 255)`,`rgb(127, 217, 238)`]},mono:{dark:[`rgb(215, 215, 215)`,`rgb(180, 180, 180)`,`rgb(190, 190, 190)`,`rgb(160, 160, 160)`,`rgb(170, 170, 170)`,`rgb(150, 150, 150)`,`rgb(155, 155, 155)`],light:[`rgb(60, 60, 60)`,`rgb(90, 90, 90)`,`rgb(85, 85, 85)`,`rgb(110, 110, 110)`,`rgb(105, 105, 105)`,`rgb(125, 125, 125)`,`rgb(120, 120, 120)`]},ocean:{dark:[`rgb(80, 140, 255)`,`rgb(40, 200, 230)`,`rgb(120, 90, 255)`,`rgb(30, 170, 210)`,`rgb(160, 80, 240)`,`rgb(60, 110, 255)`,`rgb(40, 190, 180)`],light:[`rgb(40, 100, 240)`,`rgb(20, 160, 200)`,`rgb(90, 60, 230)`,`rgb(20, 130, 180)`,`rgb(130, 50, 220)`,`rgb(40, 80, 230)`,`rgb(20, 150, 150)`]},sunset:{dark:[`rgb(255, 110, 60)`,`rgb(255, 180, 40)`,`rgb(255, 60, 90)`,`rgb(255, 210, 80)`,`rgb(240, 70, 140)`,`rgb(255, 140, 50)`,`rgb(230, 50, 110)`],light:[`rgb(235, 80, 30)`,`rgb(230, 150, 10)`,`rgb(230, 30, 70)`,`rgb(225, 175, 30)`,`rgb(215, 40, 110)`,`rgb(235, 110, 20)`,`rgb(205, 30, 90)`]},forest:{dark:[`rgb(70, 220, 120)`,`rgb(40, 200, 180)`,`rgb(140, 230, 80)`,`rgb(30, 170, 140)`,`rgb(190, 235, 70)`,`rgb(50, 190, 110)`,`rgb(30, 150, 120)`],light:[`rgb(30, 170, 80)`,`rgb(20, 150, 130)`,`rgb(90, 180, 30)`,`rgb(20, 130, 100)`,`rgb(130, 180, 20)`,`rgb(30, 150, 80)`,`rgb(20, 120, 90)`]},candy:{dark:[`rgb(255, 90, 170)`,`rgb(255, 120, 220)`,`rgb(210, 80, 255)`,`rgb(255, 150, 190)`,`rgb(180, 110, 255)`,`rgb(255, 70, 140)`,`rgb(230, 100, 240)`],light:[`rgb(235, 40, 140)`,`rgb(230, 70, 190)`,`rgb(180, 40, 230)`,`rgb(235, 100, 160)`,`rgb(150, 70, 230)`,`rgb(230, 30, 110)`,`rgb(200, 60, 210)`]},ice:{dark:[`rgb(150, 230, 255)`,`rgb(90, 200, 255)`,`rgb(190, 240, 255)`,`rgb(120, 190, 255)`,`rgb(160, 220, 250)`,`rgb(80, 170, 255)`,`rgb(200, 235, 255)`],light:[`rgb(30, 160, 220)`,`rgb(20, 130, 210)`,`rgb(60, 180, 230)`,`rgb(40, 120, 220)`,`rgb(50, 160, 220)`,`rgb(20, 110, 220)`,`rgb(70, 170, 230)`]},gold:{dark:[`rgb(255, 200, 70)`,`rgb(255, 170, 40)`,`rgb(255, 220, 110)`,`rgb(240, 150, 30)`,`rgb(255, 235, 140)`,`rgb(230, 160, 40)`,`rgb(250, 210, 90)`],light:[`rgb(200, 140, 10)`,`rgb(190, 120, 0)`,`rgb(210, 160, 30)`,`rgb(180, 110, 0)`,`rgb(205, 170, 40)`,`rgb(175, 115, 5)`,`rgb(195, 150, 20)`]}};function Tt(e,t){let n=e.match(/^rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);return n?`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${t.toFixed(2)})`:e}function Et(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function Dt(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function Ot({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?St.slice(0,s):St).map((s,c)=>{let l=n>=1?t[c%t.length]:Tt(t[c%t.length],n),u=`calc(${Math.round(s.w*r)}px * var(--vb-w-${e}) * var(--vb-z-${e}, 1))`,d=`calc(${Math.round(s.h*i)}px * var(--vb-h-${e}) * var(--vb-l${c}-${e}) * var(--vb-z-${e}, 1))`,f=`calc(100% + (${a}px + var(--vb-y${c}-${e})) * var(--vb-z-${e}, 1))`;return`radial-gradient(ellipse ${u} ${d} at ${Dt(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
2
+ `)}function kt(e){let{id:t,borderRadius:n,borderWidth:r,strokeOpacity:i,innerOpacity:a,bloomOpacity:o,innerShadow:s,colorVariant:c,colors:l,brightness:u,saturation:d,theme:f,hueBase:p=0,glowSize:m=1,glowWidth:h=1,glowHeight:g=1,strokeScale:_=1,innerScale:v=1,innerHeight:y=1,bloomScale:b=1,bloomHeight:x=1,coreSize:S=1,coreLight:C=0,coreLightWidth:w=1,coreLightHeight:T=1,rangeWidth:E=1,rangeHeight:D=1,softness:ee=1,distortion:O=!1,scale:k=1}=e,A=Math.round(28*k*10)/10,te=Math.round(9*k*10)/10,j=Math.max(0,n-r),M=Math.round(Math.max(40,Math.min(95,70*ee))),N=e=>h*e,ne=e=>g*e,P=e=>Math.round(e*10)/10,F=`var(--vb-z-${t}, 1)`,I=e=>`calc(${P(e)}px * ${F})`,L=f===`dark`,R=wt[c][L?`dark`:`light`].map((e,t)=>{let n=l?.[t];return n&&yt(n)||e}),re=c===`mono`?.6:1,z=(i*re).toFixed(2),ie=(a*re).toFixed(2),ae=(o*re).toFixed(2),oe=u.toFixed(2),se=d.toFixed(2),ce=`hue-rotate(calc(var(--voice-hue-base, ${p}deg) + var(--vb-hue-${t})))`,le=O?` url(#vb-distort-${t})`:``,ue=`filter: ${ce} brightness(${oe}) saturate(${se});`,de=`filter: ${ce} brightness(${oe}) saturate(${se})${le};`,fe=`filter: blur(${I(Et(10,m))}) ${ce} brightness(${oe}) saturate(${se});`,pe=`filter: blur(${I(Et(10,m))}) ${ce} brightness(${oe}) saturate(${se})${le};`,me=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${F})`,he=`calc(100% + (2px + var(--vb-cy-${t})) * ${F})`,ge=L?`radial-gradient(ellipse calc(${P(30*S)}px * var(--vb-w-${t}) * ${F}) calc(${P(30*S)}px * var(--vb-h-${t}) * ${F}) at ${me} ${he}, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.14) 30%, transparent 65%)`:`radial-gradient(ellipse calc(${P(40*S)}px * var(--vb-w-${t}) * ${F}) calc(${P(30*S)}px * var(--vb-h-${t}) * ${F}) at ${me} ${he}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,_e=Ot({id:t,colors:R,alpha:1,sw:N(_),sh:ne(_),y:2,fade:M}),ve=Ot({id:t,colors:R,alpha:.46,sw:N(.9*v),sh:ne(.9*v*y),y:0,fade:M}),ye=Ot({id:t,colors:R,alpha:L?.9:.7,sw:N(1.15*b),sh:ne(1.5*b*x),y:0,fade:Math.min(95,M+2)}),be=(e,n,r,i=0)=>`radial-gradient(ellipse calc(${P(e*E)}px * var(--vb-w-${t}) * var(--vb-mw-${t}) * ${F}) calc((${P(n*D)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${F}) at ${me} calc(100% + var(--vb-cy-${t}) * ${F}), white 0%, rgba(255, 255, 255, 0.5) ${r}%${i>0?`, rgba(255, 255, 255, ${i}) 85%`:``}, transparent 100%)`,xe=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,Se=(e,t,r,i)=>`${e} {
3
+ ${t}
4
+ position: absolute;
5
+ inset: 0;
6
+ border-radius: ${I(n)};
7
+ background: ${ve};
8
+ box-shadow: inset 0 0 ${I(te)} 1px ${s};
9
+ -webkit-mask-image:
10
+ ${be(170,64,45,.3)},
11
+ linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
12
+ linear-gradient(to right, white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white);
13
+ -webkit-mask-composite: source-in, source-over;
14
+ mask-image:
15
+ ${be(170,64,45,.3)},
16
+ linear-gradient(white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white),
17
+ linear-gradient(to right, white, transparent ${I(A)}, transparent calc(100% - ${A}px * ${F}), white);
18
+ mask-composite: intersect, add;
19
+ pointer-events: none;
20
+ /* Its own compositing layer: WebKit otherwise re-rasterizes the
21
+ filtered layer into the parent every frame on the CPU (a phone-sized
22
+ host runs at a sixth of the frame rate without this). */
23
+ will-change: transform;
24
+ z-index: 1;
25
+ ${r}
26
+ ${xe(`inner`,ie)}
27
+ ${i}
28
+ }`;return`
29
+ @property --vb-opacity-${t} {
30
+ syntax: "<number>";
31
+ initial-value: 0;
32
+ inherits: true;
33
+ }
34
+
35
+ [data-voice-beam="${t}"] {
36
+ position: relative;
37
+ border-radius: ${n}px;
38
+ overflow: hidden;
39
+ --vb-h-${t}: 0.8;
40
+ --vb-w-${t}: 1;
41
+ ${St.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
42
+ --vb-l${n}-${t}: 1;
43
+ --vb-y${n}-${t}: 0px;`).join(`
44
+ `)}
45
+ --vb-glow-${t}: 0.4;
46
+ --vb-z-${t}: 1;
47
+ --vb-cx-${t}: 0px;
48
+ --vb-cy-${t}: 0px;
49
+ --vb-bh-${t}: 0px;
50
+ --vb-bendA-${t}: 0;
51
+ --vb-mw-${t}: 1;
52
+ --vb-hue-${t}: 0deg;
53
+ --vb-level-${t}: 0;
54
+ }
55
+
56
+ [data-voice-beam="${t}"][data-active] {
57
+ animation: vb-fade-in-${t} 0.6s ease forwards;
58
+ }
59
+
60
+ [data-voice-beam="${t}"][data-fading] {
61
+ animation: vb-fade-out-${t} 0.5s ease forwards;
62
+ }
63
+
64
+ /* Stroke — the colours painted into the 1px edge ring, masked to the centred ellipse. */
65
+ [data-voice-beam="${t}"][data-active]::after,
66
+ [data-voice-beam="${t}"][data-fading]::after {
67
+ content: "";
68
+ position: absolute;
69
+ inset: 0;
70
+ border-radius: ${I(j)};
71
+ padding: ${I(r)};
72
+ clip-path: inset(0 round ${I(n)});
73
+ background:
74
+ ${ge},
75
+ ${_e};
76
+ -webkit-mask:
77
+ ${be(170,64,45)},
78
+ linear-gradient(#fff 0 0) content-box,
79
+ linear-gradient(#fff 0 0);
80
+ -webkit-mask-composite: source-in, xor;
81
+ mask:
82
+ ${be(170,64,45)},
83
+ linear-gradient(#fff 0 0) content-box,
84
+ linear-gradient(#fff 0 0);
85
+ mask-composite: intersect, exclude;
86
+ pointer-events: none;
87
+ /* Its own compositing layer: WebKit otherwise re-rasterizes the
88
+ filtered layer into the parent every frame on the CPU (a phone-sized
89
+ host runs at a sixth of the frame rate without this). */
90
+ will-change: transform;
91
+ z-index: 2;
92
+ ${xe(`stroke`,z)}
93
+ ${ue}
94
+ }
95
+
96
+ /* Inner glow — soft light inside the element, faded off at the corners.
97
+ With distortion on, this copy is clipped to ABOVE the band line (the
98
+ polygon the driver writes each frame) and a mirror layer below carries
99
+ the displacement filter, so only the glow under the line warps. */
100
+ ${Se(`[data-voice-beam="${t}"][data-active]::before,
101
+ [data-voice-beam="${t}"][data-fading]::before`,`content: "";`,O?`clip-path: var(--vb-clip-above-${t}, inset(0 round ${n}px));`:`clip-path: inset(0 round ${n}px);`,ue)}
102
+ ${O?Se(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
103
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="inner"]`,`display: block;`,`clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));`,de):``}
104
+
105
+ /* Bloom — the blurred halo, tallest of the three, above the content. */
106
+ [data-voice-beam="${t}"] [data-voice-beam-bloom],
107
+ [data-voice-beam="${t}"] [data-voice-beam-warp] {
108
+ display: none;
109
+ position: absolute;
110
+ inset: 0;
111
+ border-radius: ${I(j)};
112
+ pointer-events: none;
113
+ /* Its own compositing layer: WebKit otherwise re-rasterizes the
114
+ filtered layer into the parent every frame on the CPU (a phone-sized
115
+ host runs at a sixth of the frame rate without this). */
116
+ will-change: transform;
117
+ opacity: 0;
118
+ }
119
+
120
+ [data-voice-beam="${t}"] [data-voice-beam-bloom],
121
+ [data-voice-beam="${t}"] [data-voice-beam-warp="bloom"] {
122
+ -webkit-mask: ${be(200,130,35)};
123
+ mask: ${be(200,130,35)};
124
+ background: ${ye};
125
+ z-index: 3;
126
+ }
127
+
128
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-bloom],
129
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-bloom] {
130
+ display: block;
131
+ clip-path: ${O?`var(--vb-clip-above-${t}, inset(0 round ${n}px))`:`inset(0 round ${n}px)`};
132
+ ${xe(`bloom`,ae)}
133
+ ${fe}
134
+ }
135
+ ${O?`
136
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-warp="bloom"],
137
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="bloom"] {
138
+ display: block;
139
+ clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));
140
+ ${xe(`bloom`,ae)}
141
+ ${pe}
142
+ }
143
+
144
+ /* Processing drops the distortion: the driver marks the wrapper once the
145
+ warp has faded out, the warp layers leave the paint and the base layers
146
+ give up their split at the band line. */
147
+ [data-voice-beam="${t}"][data-voice-warp="off"]::before,
148
+ [data-voice-beam="${t}"][data-voice-warp="off"] [data-voice-beam-bloom] {
149
+ clip-path: inset(0 round ${n}px);
150
+ }
151
+
152
+ [data-voice-beam="${t}"][data-voice-warp="off"] [data-voice-beam-warp] {
153
+ display: none;
154
+ }`:``}
155
+
156
+ /* Epicentre — a soft white wash at the source, under the band line (the
157
+ driver's clip; unclipped when no line is drawn), sitting above every
158
+ glow layer and the band's halo so the centre reads lighter than the
159
+ band (same z as the band canvases, painted after them). Sized by the voice like the
160
+ other layers; off unless \`coreLight\` is set (the light theme sets it).
161
+ Up to 1 it is the wash's opacity; past 1 the solid white core widens
162
+ too, for a centre that stays lighter than a strong band. It follows the
163
+ glow's presence but not \`strength\`, which would only dim it. */
164
+ ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),i=1+.3*e,a=P(45*n+27*r),o=P(40+25*n+15*r),s=Math.min(1,.55+.35*n+.1*r).toFixed(2),c=P(72+14*n+8*r);return`[data-voice-beam="${t}"] [data-voice-beam-core] {
165
+ display: none;
166
+ position: absolute;
167
+ inset: 0;
168
+ border-radius: ${I(j)};
169
+ overflow: hidden;
170
+ pointer-events: none;
171
+ /* Its own compositing layer: WebKit otherwise re-rasterizes the
172
+ filtered layer into the parent every frame on the CPU (a phone-sized
173
+ host runs at a sixth of the frame rate without this). */
174
+ will-change: transform;
175
+ /* The blur sits on this wrapper and the band-line clip on the child,
176
+ so the cut edge is blurred too rather than left hard. */
177
+ filter: blur(${I(Et(8,m))});
178
+ z-index: 4;
179
+ }
180
+
181
+ [data-voice-beam="${t}"] [data-voice-beam-core] > div {
182
+ position: absolute;
183
+ inset: 0;
184
+ background: radial-gradient(ellipse calc(${P(120*w*i*k)}px * var(--vb-w-${t}) * ${F}) calc((${P(70*T*i*k)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${F}) at ${me} calc(100% + var(--vb-cy-${t}) * ${F}), white 0%, white ${a}%, rgba(255, 255, 255, ${s}) ${o}%, transparent ${c}%);
185
+ clip-path: var(--vb-clip-below-${t}, none);
186
+ }
187
+
188
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-core],
189
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-core] {
190
+ display: block;
191
+ opacity: calc(var(--vb-opacity-${t}, 1) * min(1, var(--vb-glow-${t}) * ${Math.min(1,C).toFixed(2)} * ${(1.6+1.4*e).toFixed(2)}) * var(--voice-core-light-opacity, 1));
192
+ }
193
+ `})():``}
194
+ /* Band — the canvas the driver draws the bend's contour on: an organic
195
+ bell with chromatic fringes. Fades with the root, follows the strength
196
+ and turns with the hue drift like the other layers. */
197
+ [data-voice-beam="${t}"] [data-voice-beam-band],
198
+ [data-voice-beam="${t}"] [data-voice-beam-band-halo] {
199
+ display: none;
200
+ position: absolute;
201
+ inset: 0;
202
+ width: 100%;
203
+ height: 100%;
204
+ pointer-events: none;
205
+ /* Its own compositing layer: WebKit otherwise re-rasterizes the
206
+ filtered layer into the parent every frame on the CPU (a phone-sized
207
+ host runs at a sixth of the frame rate without this). */
208
+ will-change: transform;
209
+ z-index: 4;
210
+ }
211
+
212
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-band],
213
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-band],
214
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-band-halo],
215
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-band-halo] {
216
+ display: block;
217
+ opacity: calc(var(--vb-opacity-${t}, 1) * var(--voice-band-opacity, 1) * var(--voice-strength, 1));
218
+ /* The blur vars are 0 where the canvas blurs its own strokes; where the
219
+ 2D context has no filter (WebKit) the driver sets them and the layers
220
+ are blurred here instead — the ridge on the band canvas, its wider
221
+ halo on the canvas beneath. */
222
+ filter: blur(var(--vb-band-blur-${t}, 0px)) ${ce} brightness(${oe}) saturate(${se});
223
+ }
224
+
225
+ [data-voice-beam="${t}"][data-active] [data-voice-beam-band-halo],
226
+ [data-voice-beam="${t}"][data-fading] [data-voice-beam-band-halo] {
227
+ filter: blur(var(--vb-band-halo-blur-${t}, 0px)) ${ce} brightness(${oe}) saturate(${se});
228
+ }
229
+
230
+ /* Resolution. The soft layers — inner light and its warp mirror, bloom and
231
+ its mirror, the epicentre — are rastered at half size and scaled back
232
+ up by the compositor: the box is halved, every length inside rides the
233
+ layer's factor \`--vb-z\` at 0.5 (the driver also writes the band-line
234
+ clips at half scale), and the will-change transform is rastered
235
+ pre-scale where the engine does that (Chromium, Safari 18). For blurred
236
+ gradients that is the same picture at a quarter of the raster and
237
+ filter work, which is what a phone at 3x runs out of. The 1px stroke
238
+ stays full-res on every screen: at half size it is half a CSS pixel,
239
+ which a 3x phone rasters into a faint smear instead of the hairline,
240
+ and the layer is cheap (no blur). The component sets
241
+ \`data-voice-halfres\`. */
242
+ [data-voice-beam="${t}"][data-voice-halfres]::before,
243
+ [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-warp],
244
+ [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-bloom],
245
+ [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-core] {
246
+ --vb-z-${t}: 0.5;
247
+ inset: auto;
248
+ left: 0;
249
+ top: 0;
250
+ width: 50%;
251
+ height: 50%;
252
+ transform: translateZ(0) scale(2);
253
+ transform-origin: 0 0;
254
+ }
255
+ ${O?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
256
+ [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
257
+ [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
258
+ [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
259
+ clip-path: var(--vb-clip-above-z-${t}, inset(0 round ${I(n)}));
260
+ }
261
+ [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-warp],
262
+ [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-warp] {
263
+ clip-path: var(--vb-clip-below-z-${t}, inset(0 round ${I(n)}));
264
+ }
265
+ /* Processing (warp off): the mirrors are gone, so the base layers paint
266
+ the whole box again — this must outweigh the split above. */
267
+ [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"]::before,
268
+ [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"] [data-voice-beam-bloom] {
269
+ clip-path: inset(0 round ${I(n)});
270
+ }`:`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
271
+ [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
272
+ [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
273
+ [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
274
+ clip-path: inset(0 round ${I(n)});
275
+ }`}
276
+ [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-core] > div {
277
+ clip-path: var(--vb-clip-below-z-${t}, none);
278
+ }
279
+ @keyframes vb-fade-in-${t} {
280
+ to { --vb-opacity-${t}: 1; }
281
+ }
282
+
283
+ @keyframes vb-fade-out-${t} {
284
+ from { --vb-opacity-${t}: 1; }
285
+ to { --vb-opacity-${t}: 0; }
286
+ }
287
+
288
+ [data-voice-beam="${t}"][data-paused],
289
+ [data-voice-beam="${t}"][data-paused]::after,
290
+ [data-voice-beam="${t}"][data-paused]::before,
291
+ [data-voice-beam="${t}"][data-paused] [data-voice-beam-bloom] {
292
+ animation-play-state: paused !important;
293
+ }
294
+ `}let At=null;function jt(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Mt(){let e=jt();return e?(At||=new e,At.state===`suspended`&&At.resume().catch(()=>{}),At):null}const Nt=new WeakMap;function Pt(e){let t=Mt();if(!t||e.getAudioTracks().length===0)return null;let n=Nt.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},Nt.set(e,n)),n.refs+=1;let r=t.createAnalyser();r.fftSize=1024,r.smoothingTimeConstant=.5,n.node.connect(r);let i=!1;return{analyser:r,release:()=>{if(!i){i=!0;try{n.node.disconnect(r)}catch{}if(--n.refs,n.refs<=0){try{n.node.disconnect()}catch{}Nt.delete(e)}}}}}const Ft=new WeakMap;function It(e){let t=Ft.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},Ft.set(e,t)),t}const Lt=new Set;let Rt=null,zt=0,K=0,Bt=!1,q=!1,Vt=0,Ht=0;const Ut=Math.PI*2,Wt=[[80,300],[300,2e3],[2e3,6e3]];function Gt(e){return e<0?0:e>1?1:e}function Kt(e,t){let n=t/2;return((e+n)%t+t)%t-n}function qt(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function Jt(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return Gt((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Yt(e,t,n,r,i){let a=t>e?r:i,o=1-Math.exp(-n/Math.max(.001,a));return e+(t-e)*o}const J=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),Xt=.05,Zt=.1;function Qt(e,t,n,r){let i=e<0?1-r:1+r,a=Math.max(.05,n*i),o=Math.exp(-((Math.abs(e)/a)**+t)),s=Math.exp(-((1/a)**t));return Math.max(0,(o-s)/(1-s))}function $t(e,t,n,r,i){if(n<=0||t<=0)return 0;let a=t*Math.max(0,Math.min(.98,r));return e<=a?0:n*Math.min(1,(e-a)/Math.max(1,t-a))**+Math.max(.5,i)}function en(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function tn(e,t,n,r=0){if(n<=0)return 0;let i=Math.min(e,t-e)-r;if(i>=n)return 0;if(i<=0)return n;let a=n-i;return n-Math.sqrt(Math.max(0,n*n-a*a))}function nn(e,t,n,r){let i=n/2+t.cx*t.w,a=170*e.rangeWidth*t.w*t.mw,o=r*.82*Math.min(1,e.scale),s=Math.min(o,(64*e.rangeHeight*t.h+t.lift)*e.bandPosition),c=r-e.bandOffset,l=Math.min(1,t.corner*4),u=e.bandTail*(1-l*l*(3-2*l)),d=u>.001,f=d?e.bandTailOverflow:0,p=d?-f:i-a,m=d?n+f:i+a,h=[];for(let o=0;o<=56;o++){let l=p+(m-p)*o/56,d=Math.max(-1,Math.min(1,(l-i)/Math.max(1,a))),g=(l<i?i:n-i)+f,_=Qt(d,e.bandCurve,e.bandSpread,e.bandSkew)+$t(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?tn(l,n,en(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function rn(e,t,n,r,i){for(let[a,o]of[[``,1],[`-z`,.5]]){let s=e=>(e*o).toFixed(1)+`px`,c=n.map(([e,t])=>`${s(e)} ${s(t)}`),l=`polygon(0 ${s(i)}, ${c.join(`, `)}, ${s(r)} ${s(i)})`,u=`polygon(0 0, ${s(r)} 0, ${s(r)} ${s(i)}, ${c.slice().reverse().join(`, `)}, 0 ${s(i)})`;e.style.setProperty(`--vb-clip-below${a}-${t}`,l),e.style.setProperty(`--vb-clip-above${a}-${t}`,u)}}function an(e,t,n){let r=n;for(let e=0;e<t.length;e++)t[e][1]<r&&(r=t[e][1]);let i=Math.max(0,Math.min(.9,Math.floor((r-6)/n/Xt)*Xt));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-Zt*100}%`),o.setAttribute(`width`,`${(1+2*Zt)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function on(e,t,n){let{canvas:r,ctx:i,el:a,config:o}=e;if(!r||!i)return;let s=a.clientWidth,c=a.clientHeight;if(!s||!c)return;let l=Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),u=Math.round(s*l),d=Math.round(c*l);(r.width!==u||r.height!==d)&&(r.width=u,r.height=d),i.setTransform(l,0,0,l,0,0),i.clearRect(0,0,s,c);let f=e.haloCanvas,p=e.haloCtx;f&&p&&((f.width!==u||f.height!==d)&&(f.width=u,f.height=d),p.setTransform(l,0,0,l,0,0),p.clearRect(0,0,s,c));let m=Math.min(1,.6*o.bandStrength*t.strength);if(m<.005||o.bandWidth<=0)return;let h=o.theme===`dark`,g=o.bandWidth*(1+.35*t.level),_=o.bandAberration*(.35+.65*t.level),v=(4+12*_)*o.scale,y=4*_*o.scale,b=(e,t)=>{i.beginPath(),i.moveTo(n[0][0]+e,n[0][1]+t);for(let r=1;r<n.length;r++)i.lineTo(n[r][0]+e,n[r][1]+t)},x={r:o.bandColors.above,g:o.bandColors.mid,c:o.bandColors.core,b:o.bandColors.below},S=(h?.42:.4)*m,C=14*g,w=3.5*o.bandWidth/2,T=w*l,E=typeof i.filter==`string`,D=E?`0px`:`${w.toFixed(2)}px`;e.cssBlur!==D&&(a.style.setProperty(`--vb-band-blur-${o.id}`,D),a.style.setProperty(`--vb-band-halo-blur-${o.id}`,E?`0px`:`${(w*3).toFixed(2)}px`),e.cssBlur=D);let ee=[[1,.16],[.72,.2],[.46,.26],[.22,.34]],O=[{rgb:x.r,a:1,ox:y,oy:-v},{rgb:x.g,a:.55,ox:y*.35,oy:-v*.35},{rgb:x.b,a:1,ox:-y,oy:v},{rgb:x.c,a:.9,ox:0,oy:0}];i.lineCap=`round`,i.lineJoin=`round`,i.globalCompositeOperation=`source-over`;let k=n[0][0],A=n[n.length-1][0],te=(e,t)=>{let n=i.createLinearGradient(k,0,A,0),r=o.bandTail>0?.015:.18;return n.addColorStop(0,`rgba(${e}, 0)`),n.addColorStop(r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1-r,`rgba(${e}, ${t.toFixed(3)})`),n.addColorStop(1,`rgba(${e}, 0)`),n},j=!E&&p?p:i;E&&(i.filter=`blur(${(T*3).toFixed(1)}px)`),j.lineCap=`round`,j.lineJoin=`round`,j.strokeStyle=te(x.c,S*.3),j.lineWidth=C*2.2,j.beginPath(),j.moveTo(n[0][0],n[0][1]);for(let e=1;e<n.length;e++)j.lineTo(n[e][0],n[e][1]);j.stroke(),E&&(i.filter=`blur(${T.toFixed(1)}px)`);for(let e of O)for(let[t,n]of ee)i.strokeStyle=te(e.rgb,S*e.a*n),i.lineWidth=Math.max(.6,C*t),b(e.ox,e.oy),i.stroke();E&&(i.filter=`none`),i.globalCompositeOperation=`source-over`}function sn(e){return(1-Math.cos(Ut*e))/2}function cn(e,t){let n=e.analyser,r=e.time,i=e.freq;n.getFloatTimeDomainData(r);let a=0;for(let e=0;e<r.length;e++)a+=r[e]*r[e];t.level=Math.sqrt(a/r.length)*5*e.config.sensitivity,n.getByteFrequencyData(i);let o=n.context.sampleRate/n.fftSize;for(let n=0;n<3;n++){let[r,a]=Wt[n],s=Math.max(0,Math.floor(r/o)),c=Math.min(i.length-1,Math.ceil(a/o)),l=0;for(let e=s;e<=c;e++)l+=i[e];let u=c>=s?l/(c-s+1)/255:0;t.bands[n]=u*1.7*e.config.sensitivity}}const ln={level:0,bands:[0,0,0]};function un(e){Rt=requestAnimationFrame(un);let t=K?e-K:0;if(K=e,Bt){if(q=!q,q)return;e>=Ht&&(Bt=!1,Vt=0)}else t>22?Vt?e-Vt>500&&(Bt=!0,q=!1,Ht=e+4e3):Vt=e:Vt=0;e-zt<14.666666666666668||(zt=e,Lt.forEach(t=>{var n;let{el:r,config:i,source:a,s:o}=t,s=i.paused;if(s&&t.paintedConfig===i)return;let c=s?0:o.lastTs?Math.min(.05,(e-o.lastTs)/1e3):1/60;o.lastTs=e,o.t+=c;let l=o.t;if(!s)if(t.analyser)cn(t,ln);else{let e=a.getLevel?Gt(a.getLevel()):0;ln.level=e,ln.bands[0]=e,ln.bands[1]=e*(.72+.28*Math.sin(l*9.1)),ln.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=Jt(ln.level,i.threshold);o.level=Yt(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=Jt(ln.bands[e],i.threshold*.6);o.bands[e]=Yt(o.bands[e],t,c,i.attack,i.release*1.15)}let d=Ct*i.lobeSpacing;i.processing&&o.scanA<.001&&o.scanT===0&&(o.scanT=Math.max(.05,i.processingDuration)/2);let f=Math.max(.05,i.processingEase);o.scanA=Yt(o.scanA,i.processing?1:0,c,f*.9,f*.8),i.processing?o.scanT+=c:o.scanA<.001&&(o.scanT=0);let p=o.scanA*o.scanA*(3-2*o.scanA),m=r.clientWidth,h=r.clientHeight,g=d/2*i.processingTravel,_=o.scanT/Math.max(.05,i.processingDuration),v=Math.floor(_),y=_-v,b=Math.max(1,i.processingCurve),x=y<.5?.5*(2*y)**b:1-.5*(2-2*y)**b,S=i.reducedMotion?0:v%2==0?2*x-1:1-2*x,C=p*g*S,w=1-p*.6,T=1-p*.45,E=1+p*.3*(1-S*S),D=i.reducedMotion?.5:.5+.5*Math.sin(Ut*l/i.breatheDuration),ee=o.level+(1-o.level)*i.idle*D,O=Math.max(0,Math.min(1,(p-.25)/.75)),k=O*O*(3-2*O),A=Math.max(ee,i.processingLevel*k),te=.15+.85*A,j=.5+i.reach*A,M=(.85+i.spread*A)*E;i.flow!==0&&!i.reducedMotion&&(o.phase=((o.phase+i.flow*A*c)%d+d)%d),r.style.setProperty(`--vb-level-${i.id}`,o.level.toFixed(3)),r.style.setProperty(`--vb-cx-${i.id}`,`${C.toFixed(1)}px`),r.style.setProperty(`--vb-mw-${i.id}`,T.toFixed(3));let N=i.bend*A;r.style.setProperty(`--vb-bh-${i.id}`,`${Math.max(0,N).toFixed(1)}px`);let ne=i.bend>0?Math.min(1,N/i.bend):0;r.style.setProperty(`--vb-bendA-${i.id}`,ne.toFixed(3));let P={cx:C,w:M,h:j,mw:T,lift:N,strength:ne,level:o.level,corner:p},F=m/2+C*M,I=30*i.scale*M,L=en(i.radius,m,h),R=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-tn(F,m,L,I*1.4)*R).toFixed(1)}px`),o.warp=Yt(o.warp,i.processing?0:1,c,.35,.06);let re=o.warp,z=t.displace!=null&&re<.03;if(z!==t.warpOff&&(t.warpOff=z,z?r.setAttribute(`data-voice-warp`,`off`):r.removeAttribute(`data-voice-warp`)),m&&h&&(t.ctx||t.displace)){let e=nn(i,P,m,h);(t.displace&&!z||i.coreLight>0)&&rn(r,i.id,e,m,h),t.filter&&!z&&J&&an(t,e,h),t.ctx&&on(t,P,e)}if(t.displace&&!z){let e=i.reducedMotion?0:i.distortion*120*i.scale*(.15+.85*A)*re;t.displace.scale.baseVal=e,t.noiseShift&&(t.noiseShift.dx.baseVal=8*i.scale*Math.sin(l*.9),t.noiseShift.dy.baseVal=4*i.scale*Math.sin(l*.6+1.3))}r.style.setProperty(`--vb-glow-${i.id}`,te.toFixed(3)),r.style.setProperty(`--vb-h-${i.id}`,j.toFixed(3)),r.style.setProperty(`--vb-w-${i.id}`,M.toFixed(3));for(let e=0;e<St.length;e++){let t=St[e],n=Kt(t.x*i.lobeSpacing+o.phase,d),a=i.bands?.6+.7*o.bands[t.band]:1;r.style.setProperty(`--vb-x${e}-${i.id}`,`${(n*w).toFixed(1)}px`),r.style.setProperty(`--vb-l${e}-${i.id}`,(a*qt(n,d)).toFixed(3));let s=m/2+(C+n*w)*M;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-tn(s,m,L,I)*R).toFixed(1)}px`)}let ie=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*sn(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${ie.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function dn(){Rt??=(zt=0,K=0,Vt=0,requestAnimationFrame(un))}function fn(){Lt.size===0&&Rt!=null&&(cancelAnimationFrame(Rt),Rt=null)}function pn(e,t,n,r){let i={el:e,config:t,source:n,onLevel:r,analyser:null,releaseAnalyser:null,time:null,freq:null,canvas:null,ctx:null,haloCanvas:null,haloCtx:null,displace:null,noiseShift:null,filter:null,filterTop:-1,s:It(e),paintedConfig:null,cssBlur:null,warpOff:e.hasAttribute(`data-voice-warp`)};t.distortion>0&&(i.displace=e.querySelector(`:scope > svg feDisplacementMap`),i.noiseShift=e.querySelector(`:scope > svg feOffset`),i.filter=e.querySelector(`:scope > svg filter`));let a=e.querySelector(`:scope > [data-voice-beam-band]`);if(a){i.canvas=a,i.ctx=a.getContext(`2d`);let t=e.querySelector(`:scope > [data-voice-beam-band-halo]`);t&&(i.haloCanvas=t,i.haloCtx=t.getContext(`2d`))}if(i.s.lastTs=0,n.stream){let e=Pt(n.stream);e&&(i.analyser=e.analyser,i.releaseAnalyser=e.release,i.time=new Float32Array(e.analyser.fftSize),i.freq=new Uint8Array(e.analyser.frequencyBinCount))}return Lt.add(i),dn(),()=>{var e;Lt.delete(i),(e=i.releaseAnalyser)==null||e.call(i),fn()}}const mn={scale:1,glowSize:1,processingDuration:1.1,processingLevel:.55,processingTravel:1.55,processingCurve:2.1,cornerFollow:.45,strokeOpacity:1,innerOpacity:1,bloomOpacity:1,idle:.18,reach:1.2,spread:1.05,flow:48,bend:60,bandStrength:1.55,bandWidth:2.15,bandPosition:.35,bandCurve:1.75,bandSpread:.87,bandSkew:.12,bandOffset:-27,bandTail:.59,bandTailPosition:.67,bandTailCurve:2.4,bandTailOverflow:15,bandAberration:.89,distortion:.62,distortionDetail:2.3,glowWidth:.65,glowHeight:1.25,lobeSpacing:.85,rangeWidth:.75,rangeHeight:1,softness:1.07,coreSize:1,coreLight:0,coreLightWidth:1,coreLightHeight:1,strokeScale:1,innerScale:1,innerHeight:1,bloomScale:1,bloomHeight:1},hn={default:{},pill:{scale:.45,glowSize:.95,strokeOpacity:1.2,innerOpacity:.85,reach:1.35,spread:1.1,flow:0,bend:23,bandStrength:1.55,bandWidth:1.85,bandCurve:1.95,bandSpread:.38,bandOffset:-16,bandTail:0,processingTravel:2,cornerFollow:0,distortion:.45,distortionDetail:3,glowWidth:.65,glowHeight:.95,lobeSpacing:.45,rangeWidth:.8,rangeHeight:.7,softness:.88,coreSize:.25,strokeScale:1.25,innerScale:.95,bloomScale:1.05,bloomHeight:2.25},mobile:{scale:1.25,spread:.45,reach:3,flow:60,bend:70,bandWidth:2.4,bandCurve:1.55,bandSpread:.9,bandOffset:-50,bandTail:.62,bandTailPosition:.42,bandTailCurve:2.7,bandTailOverflow:22,processingDuration:1.05,processingLevel:.35,processingTravel:1,cornerFollow:.4,bandStrength:1.8,distortionDetail:2,glowWidth:1.15,glowHeight:2.1,lobeSpacing:1.35,rangeWidth:1.25,rangeHeight:1.2,softness:1.1}},gn={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},_n={default:{},pill:{},mobile:{strength:1}};function vn(e=`default`,t=`dark`){return(t===`light`?_n[e]:void 0)??gn[e]}const yn={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function bn(e=`default`,t=`dark`){let n=hn[e],r={};return t===`light`&&(n.reach===void 0&&(r.reach=1.8),n.spread===void 0&&(r.spread=.8),n.coreLight===void 0&&(r.coreLight=1.8)),{...mn,...r,...n,...t===`light`?yn[e]:void 0}}const xn={dark:{core:`255, 255, 255`,above:`255, 70, 80`,mid:`90, 255, 150`,below:`80, 140, 255`},light:{core:`197, 139, 255`,above:`255, 122, 182`,mid:`126, 196, 255`,below:`45, 255, 171`}},Sn=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),Cn=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function wn(){let[e,t]=Fe(()=>typeof window>`u`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return Le(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=e=>t(e.matches?`dark`:`light`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Tn(){let[e,t]=Fe(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return Le(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function En(e,t){return e===`auto`?t:e}const Dn=Ze(function({children:e,type:t=`default`,scale:n,stream:r=null,level:i=0,sensitivity:a=3.1,threshold:o=.015,attack:s=.325,release:c=.86,idle:l,breatheDuration:u=5.2,reach:d,spread:f,bands:p=!0,flow:m,processing:h=!1,processingDuration:g,processingLevel:_,processingTravel:v,processingCurve:y,cornerFollow:b,processingEase:x=.6,colorVariant:S=`colorful`,colors:C,bandColors:w,theme:T=`dark`,staticColors:E=!1,hueRange:D,hueDuration:ee,active:O=!0,paused:k=!1,borderRadius:A,brightness:te,saturation:j,glowSize:M,strokeOpacity:N,innerOpacity:ne,bloomOpacity:P,bend:F,bandStrength:L,bandWidth:R,bandPosition:re,bandCurve:z,bandSpread:ie,bandSkew:ae,bandOffset:oe,bandTail:se,bandTailPosition:ce,bandTailCurve:le,bandTailOverflow:ue,bandAberration:de,distortion:fe,distortionDetail:pe,glowWidth:me,glowHeight:he,lobeSpacing:ge,rangeWidth:_e,rangeHeight:ve,softness:ye,coreSize:be,coreLight:xe,coreLightWidth:Se,coreLightHeight:Ce,strokeScale:B,innerScale:we,innerHeight:Te,bloomScale:Ee,bloomHeight:De,strength:V,className:Oe,style:ke,css:Ae,onLevel:je,onActivate:Me,onDeactivate:Ne,onAnimationEnd:Pe,...Ie},He){let Ue=Ve().replace(/:/g,`-`),H=En(T,wn()),We=C?C.join(`|`):``,Ge=w?[w.core,w.above,w.mid,w.below].join(`|`):``,U=bn(t,H),W=Math.max(.05,n??U.scale),Ke=M??U.glowSize,qe=N??U.strokeOpacity,Je=ne??U.innerOpacity,Ye=P??U.bloomOpacity,Xe=g??U.processingDuration,Ze=_??U.processingLevel,Qe=v??U.processingTravel,$e=y??U.processingCurve,et=b??U.cornerFollow,tt=l??U.idle,nt=d??U.reach,rt=f??U.spread,it=(m??U.flow)*W,at=(F??U.bend)*W,ot=L??U.bandStrength,st=(R??U.bandWidth)*W,ct=re??U.bandPosition,lt=z??U.bandCurve,ut=ie??U.bandSpread,dt=ae??U.bandSkew,ft=(oe??U.bandOffset)*W,pt=se??U.bandTail,mt=ce??U.bandTailPosition,ht=le??U.bandTailCurve,gt=(ue??U.bandTailOverflow)*W,_t=de??U.bandAberration,vt=fe??U.distortion,yt=(pe??U.distortionDetail)/W,St=(me??U.glowWidth)*W,Ct=(he??U.glowHeight)*W,wt=(ge??U.lobeSpacing)*W,Tt=(_e??U.rangeWidth)*W,Et=(ve??U.rangeHeight)*W,Dt=ye??U.softness,Ot=(be??U.coreSize)*W,At=Math.max(0,Math.min(3,xe??U.coreLight)),jt=Se??U.coreLightWidth,Mt=Ce??U.coreLightHeight,Nt=B??U.strokeScale,Pt=we??U.innerScale,Ft=Te??U.innerHeight,It=Ee??U.bloomScale,Lt=De??U.bloomHeight,Rt=Tn(),zt=Re(null),[K,Bt]=Fe(O),[q,Vt]=Fe(!1),[Ht,Ut]=Fe(!0),[Wt,Gt]=Fe(null),[Kt,qt]=Fe(0);Le(()=>{if(!Sn)return;let e=zt.current;if(!e)return;let t=()=>qt(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Jt=Sn&&Kt>6e4?0:vt;Le(()=>{if(A!=null)return;let e=zt.current;if(!e)return;let t=()=>{let t=e.firstElementChild;if(!t)return;let n=getComputedStyle(t),r=parseFloat(n.borderTopLeftRadius);!isNaN(r)&&r>0&&Gt(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[A,e]),Le(()=>{O&&!K&&!q?Bt(!0):!O&&K&&!q&&Vt(!0)},[O,K,q]),Le(()=>{let e=zt.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)Ut(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let Yt=Be(e=>{let t=e.animationName;t.includes(`fade-out`)?(Bt(!1),Vt(!1),Ne?.()):t.includes(`fade-in`)&&Me?.(),Pe?.(e)},[Me,Ne,Pe]),J=xt[H],Xt=A??Wt??16,Zt=vn(t,H),Qt=V??Zt.strength??J.strength??1,$t=D??J.hueRange??24,en=ee??J.hueDuration??12,tn=te??Zt.brightness??J.brightness,nn=j??Zt.saturation??J.saturation,rn=ze(()=>kt({id:Ue,borderRadius:Xt,borderWidth:1,strokeOpacity:J.strokeOpacity*qe,innerOpacity:J.innerOpacity*Je,bloomOpacity:J.bloomOpacity*Ye,innerShadow:J.innerShadow,colorVariant:S,colors:C,brightness:tn,saturation:nn,theme:H,hueBase:J.hueBase??0,glowSize:Ke*W,glowWidth:St,glowHeight:Ct,strokeScale:Nt,innerScale:Pt,innerHeight:Ft,bloomScale:It,bloomHeight:Lt,coreSize:Ot,coreLight:At,coreLightWidth:jt,coreLightHeight:Mt,rangeWidth:Tt,rangeHeight:Et,softness:Dt,distortion:Jt>0,scale:W}),[Ue,Xt,J,S,We,tn,nn,H,U,Ke,qe,Je,Ye,W,St,Ct,Nt,Pt,Ft,It,Lt,Ot,At,jt,Mt,Tt,Et,Dt,Jt>0]),an=ze(()=>({id:Ue,sensitivity:Math.max(0,a),threshold:Math.max(0,Math.min(.95,o)),attack:Math.max(0,s),release:Math.max(0,c),idle:Math.max(0,Math.min(1,tt)),breatheDuration:Math.max(.2,u),reach:Math.max(0,nt),spread:Math.max(0,rt),bands:p,flow:it,lobeSpacing:Math.max(.1,wt),bend:Math.max(0,at),bandStrength:Math.max(0,ot),bandWidth:Math.max(0,st),bandPosition:Math.max(0,ct),bandCurve:Math.max(.3,lt),bandSpread:Math.max(.05,ut),bandSkew:Math.max(-.9,Math.min(.9,dt)),bandOffset:ft,bandTail:Math.max(0,Math.min(1.5,pt)),bandTailPosition:Math.max(0,Math.min(.98,mt)),bandTailCurve:Math.max(.5,ht),bandTailOverflow:Math.max(0,gt),bandAberration:Math.max(0,Math.min(1,_t)),rangeWidth:Tt,rangeHeight:Et,theme:H,bandColors:{core:w?.core&&bt(w.core)||xn[H].core,above:w?.above&&bt(w.above)||xn[H].above,mid:w?.mid&&bt(w.mid)||xn[H].mid,below:w?.below&&bt(w.below)||xn[H].below},distortion:Math.max(0,Math.min(1,Jt)),coreLight:At,scale:W,radius:Xt,processing:h,processingDuration:Math.max(.05,Xe),processingLevel:Math.max(0,Math.min(1,Ze)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Qe),processingCurve:Math.max(1,$e),cornerFollow:Math.max(0,Math.min(1,et)),hueRange:Math.max(0,$t),hueDuration:Math.max(.5,en),staticColors:S===`mono`?!0:E,reducedMotion:Rt,paused:k}),[Ue,a,o,s,c,tt,u,nt,rt,p,it,wt,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,Tt,Et,H,Ge,Jt,At,W,Xt,h,Xe,Ze,x,Qe,$e,et,$t,en,E,S,Rt,k]),on=Re(i);on.current=i;let sn=Re(je);sn.current=je,Le(()=>{if(!(K||q)||!Ht)return;let e=zt.current;return e?pn(e,an,{stream:r,getLevel:()=>{let e=on.current;return typeof e==`function`?e():e}},e=>sn.current?.call(sn,e)):void 0},[an,r,K,q,Ht]);let cn=Be(e=>{zt.current=e,typeof He==`function`?He(e):He&&(He.current=e)},[He]),ln={...ke??{},"--voice-strength":Math.max(0,Math.min(1,Qt))};return G(I,{children:[G(`style`,{children:Ae?`${rn}
295
+ ${Ae.split(`{id}`).join(Ue)}`:rn}),G(`div`,{...Ie,ref:cn,"data-voice-beam":Ue,"data-voice-type":t,"data-voice-halfres":``,"data-active":K&&!q?``:void 0,"data-fading":q?``:void 0,"data-paused":K&&!q&&(!Ht||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:Oe,style:ln,onAnimationEnd:Yt,children:[e,G(`div`,{"data-voice-beam-bloom":!0}),Jt>0&&G(I,{children:[G(`div`,{"data-voice-beam-warp":`inner`}),G(`div`,{"data-voice-beam-warp":`bloom`})]}),!Cn&&G(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),G(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),At>0&&G(`div`,{"data-voice-beam-core":!0,children:G(`div`,{})}),Jt>0&&G(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:G(`filter`,{id:`vb-distort-${Ue}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[G(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*yt).toFixed(4)} ${(.05*yt).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),G(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),G(`feColorMatrix`,{in:`moved`,type:`matrix`,values:`1 0 0 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0 1`,result:`map`}),G(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),On=`http://www.w3.org/2000/svg`,Y=Math.PI*2,X=21.5,kn=Math.sqrt(12)*X,An=154-kn,Z=Wn(),jn=An+Z.length,Mn=.56*Y*X/2,Nn=.75,Pn=.35,Fn=.55,In=22.5,Ln=qn(.65,0,.35,1),Rn=qn(.4,0,.2,1),zn=qn(.34,1.56,.64,1),Bn=qn(.2,0,0,1);var Vn=class{element;lines=[];ripple;track;middle;top;bottom;seal;check;motion=matchMedia(`(prefers-reduced-motion: reduce)`);phase=`idle`;stage={kind:`line`};settleSuccess=null;successBegun=null;frame=0;previousTime=0;position=0;target=0;level=0;stopped=!1;constructor(e,t=`ring`){this.checking=t,this.element=e.createElementNS(On,`svg`),this.element.classList.add(`seams-voiceid-ribbon`),this.element.setAttribute(`viewBox`,`0 0 308 64`),this.element.setAttribute(`aria-hidden`,`true`),this.ripple=this.append(e,`circle`,`1.5`),this.track=this.append(e,`circle`,`2`),this.middle=this.append(e,`path`,`1`),this.top=this.append(e,`path`,`2`),this.bottom=this.append(e,`path`,`2`),this.seal=this.append(e,`circle`,`0`),this.seal.setAttribute(`fill`,`currentColor`),this.seal.setAttribute(`stroke`,`none`),this.check=this.append(e,`path`,`2.6`),this.check.classList.add(`seams-voiceid-ribbon-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`stroke-linejoin`,`round`),this.check.setAttribute(`pathLength`,`1`),this.check.setAttribute(`stroke-dasharray`,`1`);for(let e of[this.ripple,this.track,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);if(this.track.setAttribute(`r`,`21.5`),t===`segments`){this.element.dataset.seamsProgressLine=``;for(let[e,t]of[this.top,this.middle,this.bottom].entries())t.dataset.seamsProgressSegment=String(e)}for(let t=3;t>=0;--t)this.lines.push(this.append(e,`path`,t===0?`1`:`0.65`));this.paint(performance.now())}readLevel=()=>this.level;setPhase(e){if(e===`processing`&&this.stage.kind===`line`){let e=Math.max(this.level,this.idleAmplitude(performance.now()));this.stage={kind:this.checking===`segments`?`segments`:`capture`,startedAt:performance.now(),amplitude:e}}else e!==`processing`&&(this.stage={kind:`line`},this.settle());this.phase=e,this.target=0,this.element.dataset.phase=e,this.wake()}succeed(e){if(this.stopped||this.stage.kind===`sealed`)return Promise.resolve();this.stage.kind===`line`&&this.setPhase(`processing`);let t=new Promise(this.awaitSuccess);return this.successBegun=e,this.stage.kind===`spin`&&this.beginSuccess(performance.now()),this.wake(),t}add(e){if(this.phase!==`listening`||this.stopped)return;let t=Math.max(0,e.rms-.003);this.target=(t/(t+.055))**.65*(e.speech?1:.15),this.element.dataset.speech=String(e.speech),this.wake()}dispose(){this.stopped=!0,cancelAnimationFrame(this.frame),this.frame=0,this.level=0,this.target=0,this.settle()}awaitSuccess=e=>{this.settle(),this.settleSuccess=e};settle(){let e=this.settleSuccess;this.settleSuccess=null,this.successBegun=null,e?.()}append(e,t,n){let r=e.createElementNS(On,t);return r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`vector-effect`,`non-scaling-stroke`),r.setAttribute(`opacity`,`0`),this.element.append(r),r}wake(){!this.stopped&&this.frame===0&&(this.previousTime=performance.now(),this.frame=requestAnimationFrame(this.draw))}draw=e=>{if(this.frame=0,this.stopped)return;let t=Math.min(50,Math.max(0,e-this.previousTime));this.previousTime=e,this.level+=(this.target-this.level)*(1-Math.exp(-t/(this.target>this.level?55:200))),this.motion.matches||(this.position+=t*(.0012+this.level*.003)),this.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Y))}paint(e){for(let e of[this.ripple,this.track,this.middle,this.top,this.bottom,this.seal,this.check])e.setAttribute(`opacity`,`0`);for(let e of this.lines)e.setAttribute(`opacity`,`0`);switch(this.stage.kind){case`line`:this.paintLine(Math.max(this.level,this.idleAmplitude(e)));return;case`capture`:this.paintCapture(e,this.stage);return;case`segments`:this.paintSegments(e,this.stage);return;case`spin`:this.paintArc(this.spinnerArc(e,this.stage),1);return;case`success`:this.paintSuccess(e,this.stage);return;case`sealed`:this.paintSeal({start:0,sweep:Y},1,1);return}}paintLine(e){for(let t=0;t<this.lines.length;t+=1){let n=3-t;this.lines[t].setAttribute(`d`,this.linePath(n,e,0,308,1)),this.lines[t].setAttribute(`opacity`,String(n===0?Fn+e*.4:.1+e*.1))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Bn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Bn(Q(r/200))),a=(308-2*i)/3;for(let[e,t]of[this.top,this.middle,this.bottom].entries()){let n=e*(a+i);t.setAttribute(`d`,`M${n.toFixed(2)} 32H${(n+a).toFixed(2)}`),t.setAttribute(`stroke-width`,`1`),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Y*(e-t*150)/900);return $(Fn,Pn+(1-Pn)*n,Bn(Q(e/200))).toFixed(3)}paintCapture(e,t){let n=this.motion.matches?920:e-t.startedAt;if(n>=560){this.paintJoin(e,Math.min(n-560,360));return}let r=t.amplitude,i=n/560,a=1-Bn(Q(n/150)),o=Ln(Q(i/.6)),s=Hn(!1)*X*560,c=Kn(i,jn,s),l=An+Kn(i,jn+Mn-An,s),u=Fn+r*.4;for(let[e,t]of[[this.top,!1],[this.bottom,!0]])e.setAttribute(`d`,this.halfPath(c,l,t,r,a)),e.setAttribute(`stroke-width`,$(1,2,o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,An,308-An,a)),this.middle.setAttribute(`opacity`,(u*(1-Bn(Q(n/180)))).toFixed(3));for(let e=0;e<3;e+=1){let t=3-e;this.lines[e].setAttribute(`d`,this.linePath(t,r,0,308,a)),this.lines[e].setAttribute(`opacity`,((.1+r*.1)*(1-Q(n/200))).toFixed(3))}this.track.setAttribute(`opacity`,(.1*Q((i-.4)/.6)).toFixed(3))}paintJoin(e,t){let n=(1-Math.cos(Math.PI*t/360))/2,r=-Math.PI/2+Hn(!1)*t,i=Mn/X,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Nn*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Y*.14},this.settleSuccess&&this.beginSuccess(e),this.paint(e);return}this.track.setAttribute(`opacity`,`0.1`);for(let[e,t]of[[this.top,o],[this.bottom,r+Math.PI-(1-Nn)*a*n]])e.setAttribute(`d`,Gn({start:t,sweep:i})),e.setAttribute(`stroke-width`,`2`),e.setAttribute(`opacity`,`1`)}spinnerArc(e,t){let n=e-t.startedAt,r=this.motion.matches?2600:1500,i=(n+r/2)%r/r,a=i<.5,o=Rn(a?i/.5:(i-.5)/.5),s=a?$(1,56,o):$(56,1,o),c=a?$(0,-14,o):$(-14,-99,o);return{start:t.base+Hn(this.motion.matches)*n-Y*c/100,sweep:Y*s/100}}beginSuccess(e){if(this.stage.kind!==`spin`)return;this.stage={kind:`success`,startedAt:e,from:this.spinnerArc(e,this.stage)};let t=this.successBegun;this.successBegun=null,t?.()}paintSuccess(e,t){let n=e-t.startedAt;if(n>=1140){this.stage={kind:`sealed`},this.settle(),this.paint(e);return}let r=Q(n/650),i=this.motion.matches?0:Hn(!1)*650*(r-r*r/2),a=Ln(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Y,a)},zn(Q((n-600)/420)),Ln(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Bn(o);this.ripple.setAttribute(`r`,$(In,34,e).toFixed(2)),this.ripple.setAttribute(`opacity`,((1-e)*.45).toFixed(3))}}paintSeal(e,t,n){this.paintArc(e,1),this.seal.setAttribute(`r`,(In*Math.max(0,t)).toFixed(2)),this.seal.setAttribute(`opacity`,t>0?`1`:`0`),this.check.setAttribute(`stroke-dashoffset`,(1-n).toFixed(3)),this.check.setAttribute(`opacity`,n>0?`1`:`0`)}paintArc(e,t){this.track.setAttribute(`opacity`,String(.1*t)),this.top.setAttribute(`d`,Gn(e)),this.top.setAttribute(`stroke-width`,`2`),this.top.setAttribute(`opacity`,`1`)}displacement(e,t,n){let r=n/308,i=Math.sin(Math.PI*r)**1.7;if(this.motion.matches)return t*5*i;let a=Math.sin(r*Math.PI*4-this.position+e*.5)*.7+Math.sin(r*Math.PI*7+this.position*.7+e)*.3;return t*(26-e*4)*i*a}linePath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((r-n)/2));for(let s=0;s<=o;s+=1){let c=n+(r-n)*s/o,l=32+this.displacement(e,t,c)*i;a+=`${s===0?`M`:`L`}${c.toFixed(2)},${l.toFixed(2)} `}return a}halfPath(e,t,n,r,i){let a=``,o=Math.max(2,Math.ceil((t-e)/1.5));for(let s=0;s<=o;s+=1){let c=Un(e+(t-e)*s/o),l=n?308-c.x:c.x,u=n?64-c.y:c.y;c.onLine&&(u+=this.displacement(0,r,l)*i),a+=`${s===0?`M`:`L`}${l.toFixed(2)},${u.toFixed(2)} `}return a}};function Hn(e){return Y/(e?3200:1800)}function Un(e){if(e<=An)return{x:e,y:32,onLine:!0};if(e<jn){let t=e-An,n=0,r=Z.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Z.lengths[e]<t?n=e:r=e}let i=(t-Z.lengths[n])/(Z.lengths[r]-Z.lengths[n]||1);return{x:$(Z.points[n][0],Z.points[r][0],i),y:$(Z.points[n][1],Z.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-jn)/X;return{x:154+X*Math.cos(t),y:32+X*Math.sin(t),onLine:!1}}function Wn(){let e=[[An,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[An+kn*i,32-X*(4*i**3-3*i**4)],o=e[e.length-1];n+=Math.hypot(a[0]-o[0],a[1]-o[1]),e.push(a),t.push(n)}return{points:e,lengths:t,length:n}}function Gn(e){let t=Math.max(2,Math.ceil(80*e.sweep/Y)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+X*Math.cos(i),o=32+X*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Kn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function qn(e,t,n,r){let i=(e,t,n)=>((1-3*n+3*t)*e+(3*n-6*t))*e*e+3*t*e,a=(e,t,n)=>3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t;return o=>{if(o<=0)return 0;if(o>=1)return 1;let s=o;for(let t=0;t<6;t+=1){let t=a(s,e,n);if(t===0)break;s-=(i(s,e,n)-o)/t}return i(Q(s),t,r)}}function Q(e){return e<0?0:e>1?1:e}function $(e,t,n){return e+(t-e)*n}const Jn=Dn;var Yn=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(t,n,r){this.prompt=n,this.ribbon=new Vn(t,r),this.element=this.ribbon.element,this.glow=t.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render();let i=e();if(i)for(let e of this.glow.querySelectorAll(`style`))e.nonce=i;this.themeObserver=new MutationObserver(this.render),this.themeObserver.observe(t.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),this.themeObserver.observe(t.body,{attributes:!0,attributeFilter:[`data-theme`]})}listen(){this.setPhase(`listening`)}add(e){this.ribbon.add(e)}checking(){this.setPhase(`processing`)}accept(){this.setPhase(`idle`)}flatten(){this.disposed||(this.phase=`processing`,this.ribbon.setPhase(`idle`),this.render())}ready(){this.setPhase(`idle`)}succeed(e){return this.disposed?Promise.resolve():(this.phase=`idle`,this.render(),this.ribbon.succeed(e))}stop(){this.disposed||(this.disposed=!0,this.themeObserver.disconnect(),this.ribbon.dispose(),Se(null,this.glow))}setPhase(e){this.disposed||(this.phase=e,this.ribbon.setPhase(e),this.render())}render=()=>{this.disposed||Se(P(Jn,{className:`seams-voiceid-beam`,theme:(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:`ocean`,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const Xn=`
296
+ .seams-voiceid-activation-surface { width: min(100%, 26.25rem); margin: 0 auto; background: transparent; }
297
+ /* Inside an operation's card the card is the frame: the prompt fills it edge to edge. */
298
+ .seams-voiceid-activation-surface.seams-voiceid-in-card { width: 100%; }
299
+ .seams-voiceid-in-card .seams-voiceid-prompt {
300
+ width: 100%;
301
+ padding-top: 0.75rem;
302
+ border: 0;
303
+ border-radius: 0;
304
+ background: transparent;
305
+ }
306
+
307
+ .seams-voiceid-prompt {
308
+ box-sizing: border-box;
309
+ position: relative;
310
+ width: min(100%, 26.25rem);
311
+ margin: 0 auto;
312
+ padding: 3.5rem 1.5rem 1.5rem;
313
+ display: grid;
314
+ grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) minmax(5rem, auto);
315
+ border: 1px solid var(--seams-colors-borderPrimary, #303b41);
316
+ border-radius: var(--seams-shape-card, 16px);
317
+ background: var(--seams-colors-colorBackground, #192024);
318
+ color: var(--seams-colors-textPrimary, #eff2f3);
319
+ /* While the card fills a taller frame (fillFrame), the spare height stays below the rows. */
320
+ align-content: start;
321
+ text-align: center;
322
+ font-family: var(--seams-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
323
+ -webkit-font-smoothing: antialiased;
324
+ }
325
+ /* A card that comes back after a Wallet confirm shows its rows only when the frame has eased to
326
+ its size (prompt.ts observeSize); until then they stay in the middle of the frame. */
327
+ .seams-voiceid-prompt[data-rows-held] > :not(.seams-voiceid-glow, .seams-voiceid-close, .seams-voiceid-progress-slot) {
328
+ opacity: 0 !important;
329
+ transition: none !important;
330
+ }
331
+ .seams-voiceid-prompt[data-frame-fill="center"] {
332
+ align-content: center;
333
+ }
334
+ .seams-voiceid-prompt {
335
+ transition: opacity 180ms var(--seams-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 180ms var(--seams-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
336
+ }
337
+ @starting-style {
338
+ .seams-voiceid-prompt { opacity: 0; transform: translateY(4px); }
339
+ /* A card that continues another, or shows again after a Wallet confirm, has no entrance. */
340
+ .seams-voiceid-prompt.seams-voiceid-entered { opacity: 1; transform: none; }
341
+ /* The button it replaces was enabled a moment ago; this one dims from there. */
342
+ .seams-voiceid-prompt.seams-voiceid-entered .seams-voiceid-primary:disabled { opacity: 1; }
343
+ }
344
+ /* A card that holds focus itself (until its first control is ready, or after a confirm). */
345
+ .seams-voiceid-prompt[tabindex="-1"]:focus { outline: none; }
346
+ /* Each line owns its row. The download overlays rows 3-5; an auto-placed line would move to new rows. */
347
+ .seams-voiceid-prompt > h2 { grid-area: 1 / 1; }
348
+ .seams-voiceid-prompt > .seams-voiceid-phrase { grid-area: 2 / 1; }
349
+ .seams-voiceid-prompt > .seams-voiceid-ribbon { grid-area: 3 / 1; }
350
+ .seams-voiceid-prompt > .seams-voiceid-status { grid-area: 4 / 1; }
351
+ .seams-voiceid-progress-slot { grid-row: 5; grid-column: 1; min-width: 0; align-self: center; }
352
+ .seams-voiceid-progress-slot:empty { visibility: hidden; }
353
+ .seams-voiceid-activation-surface .seams-voiceid-record-slot { transition: opacity 300ms cubic-bezier(0.2, 0, 0, 1) 140ms, visibility 0s linear 0s; }
354
+ .seams-voiceid-activation-surface[data-preparation="loading"] .seams-voiceid-record-slot { opacity: 0; visibility: hidden; transition: none; }
355
+ @media (prefers-reduced-motion: reduce) {
356
+ .seams-voiceid-prompt { transform: none; transition: opacity 150ms ease; }
357
+ @starting-style { .seams-voiceid-prompt { transform: none; } }
358
+ .seams-voiceid-ribbon { transition: none !important; }
359
+ }
360
+ .seams-voiceid-prompt h2 {
361
+ font-size: 0.85rem;
362
+ line-height: 1.4;
363
+ font-weight: 500;
364
+ color: var(--seams-colors-textSecondary, #9cabb3);
365
+ margin: 0.5rem 0 1rem;
366
+ }
367
+ .seams-voiceid-prompt.seams-voiceid-management {
368
+ display: flex;
369
+ flex-direction: column;
370
+ gap: 0.75rem;
371
+ padding: 1.25rem 1.25rem 1.375rem;
372
+ border-radius: var(--seams-shape-card, 1.5rem);
373
+ text-align: start;
374
+ font-size: 0.875rem;
375
+ line-height: 1.5;
376
+ }
377
+ .seams-voiceid-management-header {
378
+ display: flex;
379
+ align-items: center;
380
+ gap: 0.25rem;
381
+ margin-inline-start: -0.5rem;
382
+ }
383
+ .seams-voiceid-management h2 {
384
+ margin: 0;
385
+ color: var(--seams-colors-textPrimary, #eff2f3);
386
+ font-size: 1.375rem;
387
+ font-weight: 600;
388
+ letter-spacing: -0.02em;
389
+ line-height: 1.25;
390
+ }
391
+ .seams-voiceid-management .seams-voiceid-management-intro {
392
+ margin: -0.125rem 0 0.25rem;
393
+ color: var(--seams-colors-textSecondary, #9cabb3);
394
+ }
395
+ .seams-voiceid-management button {
396
+ appearance: none;
397
+ margin: 0;
398
+ color: var(--seams-colors-textPrimary, #eff2f3);
399
+ font: inherit;
400
+ transition: background-color 140ms ease;
401
+ }
402
+ .seams-voiceid-management button:disabled { opacity: 0.5; cursor: default; }
403
+ .seams-voiceid-management .seams-voiceid-management-back {
404
+ display: grid;
405
+ place-items: center;
406
+ width: 2.25rem;
407
+ height: 2.25rem;
408
+ padding: 0;
409
+ border: 0;
410
+ border-radius: var(--seams-shape-control, 10px);
411
+ background: transparent;
412
+ }
413
+ .seams-voiceid-management-enrollment {
414
+ display: grid;
415
+ grid-template-columns: minmax(0, 1fr) auto;
416
+ align-items: center;
417
+ gap: 0.125rem 0.75rem;
418
+ padding: 0.75rem 0.875rem;
419
+ border-radius: 0.75rem;
420
+ background: var(--seams-colors-surface, #202b31);
421
+ color: var(--seams-colors-textSecondary, #9cabb3);
422
+ }
423
+ .seams-voiceid-management-summary { text-align: end; }
424
+ .seams-voiceid-management-value { color: var(--seams-colors-textPrimary, #eff2f3); font-weight: 500; }
425
+ .seams-voiceid-management-enrollment-detail:not(:empty)::before { content: ' · '; }
426
+ .seams-voiceid-management-enrollment[data-enrollment="adapted"] > .seams-voiceid-management-summary {
427
+ grid-area: 2 / 1;
428
+ text-align: start;
429
+ font-size: 0.8125rem;
430
+ }
431
+ .seams-voiceid-management-enrollment > .seams-voiceid-management-reset { grid-area: 1 / 2 / 3; }
432
+ .seams-voiceid-management-enrollment[data-state] .seams-voiceid-management-value { display: none; }
433
+ .seams-voiceid-management-enrollment[data-state] .seams-voiceid-management-enrollment-detail::before { content: none; }
434
+ .seams-voiceid-management .seams-voiceid-management-reset {
435
+ padding: 0.375rem 0.75rem;
436
+ border: 1px solid var(--seams-colors-borderPrimary, #303b41);
437
+ border-radius: var(--seams-shape-control, 10px);
438
+ background: transparent;
439
+ font-size: 0.8125rem;
440
+ font-weight: 600;
441
+ }
442
+ .seams-voiceid-management .seams-voiceid-management-action {
443
+ display: grid;
444
+ grid-template-columns: minmax(0, 1fr) auto;
445
+ align-items: center;
446
+ gap: 0.75rem;
447
+ width: 100%;
448
+ min-height: 44px;
449
+ padding: 0.75rem 0.875rem;
450
+ border: 1px solid var(--seams-colors-borderPrimary, #303b41);
451
+ border-radius: 0.75rem;
452
+ background: transparent;
453
+ text-align: start;
454
+ }
455
+ .seams-voiceid-management-action > svg { color: var(--seams-colors-textSecondary, #9cabb3); }
456
+ .seams-voiceid-management-action-heading {
457
+ display: flex;
458
+ flex-wrap: wrap;
459
+ align-items: center;
460
+ gap: 0.25rem 0.5rem;
461
+ font-weight: 600;
462
+ }
463
+ .seams-voiceid-management-chip {
464
+ padding: 0.125rem 0.5rem;
465
+ border-radius: 6px;
466
+ background: color-mix(in srgb, var(--seams-colors-textPrimary, #eff2f3), transparent 93%);
467
+ font-size: 0.75rem;
468
+ font-weight: 500;
469
+ }
470
+ .seams-voiceid-management-action-detail {
471
+ display: block;
472
+ margin-top: 0.125rem;
473
+ color: var(--seams-colors-textSecondary, #9cabb3);
474
+ font-size: 0.8125rem;
475
+ }
476
+ .seams-voiceid-management .seams-voiceid-management-action[data-state="pending"] {
477
+ opacity: 1;
478
+ border-color: var(--seams-colors-borderHover, #46545b);
479
+ background: var(--seams-colors-surface, #202b31);
480
+ }
481
+ .seams-voiceid-management-action[data-state="pending"] > svg { visibility: hidden; }
482
+ .seams-voiceid-management [data-state="pending"] .seams-voiceid-management-action-detail,
483
+ .seams-voiceid-management [data-state="pending"] .seams-voiceid-management-enrollment-detail {
484
+ color: var(--seams-colors-textPrimary, #eff2f3);
485
+ }
486
+ .seams-voiceid-management [data-state="error"] .seams-voiceid-management-action-detail,
487
+ .seams-voiceid-management [data-state="error"] .seams-voiceid-management-enrollment-detail {
488
+ color: var(--seams-colors-error, oklch(0.74 0.166 19));
489
+ }
490
+ .seams-voiceid-management .seams-voiceid-management-section {
491
+ margin: 0.5rem 0 -0.25rem;
492
+ padding-inline-start: 0.125rem;
493
+ color: var(--seams-colors-textSecondary, #9cabb3);
494
+ font-size: 0.6875rem;
495
+ font-weight: 600;
496
+ letter-spacing: 0.08em;
497
+ text-transform: uppercase;
498
+ }
499
+ /* The status line is read by assistive technology; a message for a hidden row is also shown. */
500
+ .seams-voiceid-prompt.seams-voiceid-management > [role="status"] {
501
+ position: absolute;
502
+ width: 1px;
503
+ height: 1px;
504
+ margin: -1px;
505
+ overflow: hidden;
506
+ clip-path: inset(50%);
507
+ white-space: nowrap;
508
+ }
509
+ .seams-voiceid-prompt.seams-voiceid-management > [role="status"][data-placement="dialog"] {
510
+ position: relative;
511
+ width: auto;
512
+ height: auto;
513
+ margin: 0;
514
+ overflow: visible;
515
+ clip-path: none;
516
+ white-space: normal;
517
+ color: var(--seams-colors-error, oklch(0.74 0.166 19));
518
+ font-size: 0.8125rem;
519
+ overflow-wrap: anywhere;
520
+ }
521
+ [dir='rtl'] .seams-voiceid-management svg { transform: scaleX(-1); }
522
+ @media (hover: hover) {
523
+ .seams-voiceid-management button:hover:not(:disabled) {
524
+ background: var(--seams-colors-surface2, var(--seams-colors-surface, #202b31));
525
+ }
526
+ }
527
+ .seams-voiceid-prompt .seams-voiceid-phrase {
528
+ font-size: clamp(1.75rem, 6vw, 2.25rem);
529
+ font-weight: 600;
530
+ line-height: 1.17;
531
+ letter-spacing: -0.035em;
532
+ text-wrap: balance;
533
+ max-width: 21rem;
534
+ align-self: center;
535
+ margin: 0 auto;
536
+ transition: opacity 180ms var(--seams-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), color 300ms ease;
537
+ }
538
+ .seams-voiceid-ribbon {
539
+ display: block;
540
+ width: 308px;
541
+ max-width: 100%;
542
+ height: 64px;
543
+ margin: auto;
544
+ overflow: visible;
545
+ }
546
+ .seams-voiceid-ribbon .seams-voiceid-ribbon-check { stroke: var(--seams-colors-colorBackground, #192024); }
547
+ .seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-success-headline {
548
+ display: grid;
549
+ align-content: end;
550
+ font-size: 18px;
551
+ letter-spacing: normal;
552
+ line-height: 1.4;
553
+ }
554
+ .seams-voiceid-prompt .seams-voiceid-status.seams-voiceid-success-message { font-size: 0.8125rem; }
555
+ /* The glow is decorative and cannot intercept record, retry or cancel controls. */
556
+ .seams-voiceid-glow { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 0; }
557
+ .seams-voiceid-beam { width: 100%; height: 100%; border-radius: inherit; }
558
+ .seams-voiceid-prompt > :not(.seams-voiceid-glow) { position: relative; z-index: 1; }
559
+ .seams-voiceid-prompt > .seams-voiceid-close { position: absolute; }
560
+ .seams-voiceid-prompt .seams-voiceid-status {
561
+ font-size: 0.75rem;
562
+ line-height: 1.5;
563
+ min-height: 3.375rem;
564
+ color: var(--seams-colors-textSecondary, #9cabb3);
565
+ margin: 0;
566
+ }
567
+ .seams-voiceid-prompt button {
568
+ font: inherit;
569
+ cursor: pointer;
570
+ touch-action: manipulation;
571
+ }
572
+ .seams-voiceid-prompt button:focus-visible {
573
+ outline: 2px solid currentColor;
574
+ outline-offset: 2px;
575
+ }
576
+ .seams-voiceid-prompt .seams-voiceid-close {
577
+ position: absolute;
578
+ right: 0.75rem;
579
+ top: 0.75rem;
580
+ width: 2.5rem;
581
+ height: 2.5rem;
582
+ background: transparent;
583
+ border: 0;
584
+ border-radius: var(--seams-shape-control, 10px);
585
+ color: inherit;
586
+ display: grid;
587
+ place-items: center;
588
+ color: var(--seams-colors-textSecondary, #9cabb3);
589
+ }
590
+ .seams-voiceid-prompt .seams-voiceid-close.seams-voiceid-back {
591
+ right: auto;
592
+ left: 0.75rem;
593
+ }
594
+ .seams-voiceid-prompt .seams-voiceid-record-slot {
595
+ grid-row: 5;
596
+ grid-column: 1;
597
+ align-self: center;
598
+ width: 100%;
599
+ box-sizing: border-box;
600
+ }
601
+ .seams-voiceid-prompt .seams-voiceid-primary {
602
+ width: 100%;
603
+ min-height: var(--seams-shape-controlHeight, 44px);
604
+ padding: 0.75rem 1rem;
605
+ font-size: 0.875rem;
606
+ font-weight: 500;
607
+ border: 0;
608
+ border-radius: var(--seams-shape-control, 10px);
609
+ background: var(--seams-colors-textPrimary, #eff2f3);
610
+ color: var(--seams-colors-colorBackground, #192024);
611
+ }
612
+ .seams-voiceid-prompt .seams-voiceid-primary {
613
+ transition: opacity 180ms ease, visibility 0s linear 0s;
614
+ }
615
+ .seams-voiceid-prompt .seams-voiceid-primary:disabled {
616
+ opacity: 0.5;
617
+ cursor: wait;
618
+ }
619
+ .seams-voiceid-prompt .seams-voiceid-record-slot { position: relative; }
620
+ /* The link sits under the button and never moves it. */
621
+ .seams-voiceid-prompt .seams-voiceid-microphone {
622
+ position: absolute;
623
+ top: 100%;
624
+ left: 50%;
625
+ translate: -50% 0;
626
+ white-space: nowrap;
627
+ transition: opacity 150ms ease, visibility 0s linear 0s;
628
+ margin-top: 0.5rem;
629
+ padding: 0.25rem;
630
+ border: 0;
631
+ background: transparent;
632
+ color: var(--seams-colors-textSecondary, #9cabb3);
633
+ font-size: 0.75rem;
634
+ }
635
+ .seams-voiceid-prompt button[hidden],
636
+ .seams-voiceid-prompt [hidden] {
637
+ display: none !important;
638
+ }
639
+ /* The record button and the microphone link fade out in place and keep the row's layout. */
640
+ .seams-voiceid-activation-surface:not(.seams-voiceid-in-card) .seams-voiceid-record-slot > button[hidden] {
641
+ display: block !important;
642
+ opacity: 0;
643
+ visibility: hidden;
644
+ pointer-events: none;
645
+ transition: opacity 150ms ease, visibility 0s linear 150ms;
646
+ }
647
+ .seams-voiceid-activation-surface:not(.seams-voiceid-in-card) .seams-voiceid-record-slot > .seams-voiceid-primary[hidden] {
648
+ margin-inline: auto;
649
+ }
650
+ /* While VoiceID loads, its bar takes the answer line's place, its message the status line's,
651
+ and its retry the record button's. */
652
+ .seams-voiceid-progress-slot:has(> .seams-voiceid-model-download),
653
+ .seams-voiceid-progress-slot > .seams-voiceid-model-download { display: contents; }
654
+ .seams-voiceid-model-download > * { position: relative; z-index: 1; grid-column: 1; align-self: center; }
655
+ .seams-voiceid-prompt > .seams-voiceid-status { transition: opacity 180ms ease; }
656
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download:not([data-state="ready"])) > .seams-voiceid-ribbon,
657
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download:not([data-state="ready"])) > .seams-voiceid-status {
658
+ opacity: 0;
659
+ visibility: hidden;
660
+ transition: opacity 180ms ease, visibility 0s linear 180ms;
661
+ }
662
+ /* The download's rows fade in over the rows they replace, and fade out when VoiceID is ready. */
663
+ .seams-voiceid-model-download > * { transition: opacity 180ms ease 150ms; }
664
+ @starting-style { .seams-voiceid-model-download > * { opacity: 0; } }
665
+ /* Two texts in one place must not cross: the download's rows leave first, then the card's return. */
666
+ .seams-voiceid-model-download[data-state="ready"] > * { opacity: 0; transition-duration: 120ms; transition-delay: 0s; }
667
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download[data-state="ready"]) > .seams-voiceid-ribbon {
668
+ transition: opacity 180ms ease 120ms;
669
+ }
670
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download[data-state="ready"]) > .seams-voiceid-status {
671
+ transition: opacity 180ms ease 160ms;
672
+ }
673
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download:not([data-state="ready"])) > .seams-voiceid-phrase { opacity: 0.35; }
674
+ .seams-voiceid-prompt:has(.seams-voiceid-model-download[data-state="failed"]) > .seams-voiceid-record-slot { display: none; }
675
+ .seams-voiceid-model-download progress {
676
+ grid-row: 3;
677
+ justify-self: center;
678
+ appearance: none;
679
+ display: block;
680
+ width: min(100%, 308px);
681
+ height: 6px;
682
+ border: 0;
683
+ border-radius: 999px;
684
+ overflow: hidden;
685
+ background: var(--seams-colors-surface, #202b31);
686
+ color: var(--seams-colors-textPrimary, #eff2f3);
687
+ }
688
+ .seams-voiceid-model-download progress::-webkit-progress-bar { background: var(--seams-colors-surface, #202b31); }
689
+ .seams-voiceid-model-download progress::-webkit-progress-value { background: var(--seams-colors-textPrimary, #eff2f3); border-radius: 999px; }
690
+ /* The bar stays full and still while the models start: the start blocks the main thread, and
691
+ a looping animation would compete with it on a software-rendered page. */
692
+ .seams-voiceid-model-download progress::-moz-progress-bar { background: var(--seams-colors-textPrimary, #eff2f3); border-radius: 999px; }
693
+ .seams-voiceid-model-download p {
694
+ grid-row: 4;
695
+ align-self: start;
696
+ margin: 0;
697
+ font-size: 0.75rem;
698
+ line-height: 1.5;
699
+ color: var(--seams-colors-textSecondary, #9cabb3);
700
+ font-variant-numeric: tabular-nums;
701
+ }
702
+ .seams-voiceid-model-download button { grid-row: 5; }
703
+ /* A phrase card shows its check and its result in the same card. */
704
+ .seams-voiceid-prompt > .seams-voiceid-status-line { grid-area: 3 / 1; }
705
+ .seams-voiceid-status-line {
706
+ transition: opacity 120ms ease;
707
+ display: block;
708
+ width: 308px;
709
+ max-width: 100%;
710
+ height: 64px;
711
+ margin: auto;
712
+ overflow: visible;
713
+ opacity: 0;
714
+ color: var(--seams-colors-textPrimary, #eff2f3);
715
+ }
716
+ .seams-voiceid-ribbon { transition: opacity 120ms ease; }
717
+ .seams-voiceid-prompt[data-phrase-line="status"] > .seams-voiceid-ribbon { opacity: 0; }
718
+ .seams-voiceid-prompt[data-phrase-line="status"] > .seams-voiceid-status-line { opacity: 1; }
719
+ .seams-voiceid-status-line rect {
720
+ fill: var(--seams-colors-surface3, #2b363c);
721
+ transition: fill 240ms ease, opacity 240ms ease;
722
+ }
723
+ .seams-voiceid-status-line rect[data-state="done"],
724
+ .seams-voiceid-status-line rect[data-state="run"] { fill: currentColor; }
725
+ .seams-voiceid-status-line rect[data-state="run"] { animation: seams-voiceid-segment-pulse 900ms ease-in-out infinite alternate; }
726
+ .seams-voiceid-status-line rect[data-state="fail"] { fill: var(--seams-colors-error, oklch(0.74 0.166 19)); }
727
+ .seams-voiceid-status-line rect[data-state="wait"] {
728
+ fill: var(--seams-colors-info, oklch(0.7 0.13 255));
729
+ animation: seams-voiceid-segment-pulse 1600ms ease-in-out infinite alternate;
730
+ }
731
+ .seams-voiceid-status-line rect[data-state="skip"] { opacity: 0.5; }
732
+ @keyframes seams-voiceid-segment-pulse { from { opacity: 0.35; } to { opacity: 1; } }
733
+ .seams-voiceid-status-bar,
734
+ .seams-voiceid-status-ring,
735
+ .seams-voiceid-status-seal,
736
+ .seams-voiceid-status-check { opacity: 0; transform-box: fill-box; transform-origin: center; }
737
+ .seams-voiceid-status-bar { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
738
+ .seams-voiceid-status-ring { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
739
+ .seams-voiceid-status-seal { fill: currentColor; transform: scale(0); }
740
+ .seams-voiceid-status-check {
741
+ fill: none;
742
+ stroke: var(--seams-colors-colorBackground, #192024);
743
+ stroke-width: 2.6;
744
+ stroke-linecap: round;
745
+ stroke-linejoin: round;
746
+ stroke-dasharray: 1;
747
+ stroke-dashoffset: 1;
748
+ }
749
+ .seams-voiceid-status-line[data-seal] rect { opacity: 0; }
750
+ .seams-voiceid-status-line[data-seal] > :not(rect) { opacity: 1; }
751
+ .seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-phrase-dim { color: var(--seams-colors-textMuted, #6f7f87); }
752
+ .seams-voiceid-prompt[data-phrase-view] > h2 { min-height: 1.19rem; }
753
+ .seams-voiceid-prompt[data-phrase-view="check"] {
754
+ grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
755
+ }
756
+ .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-record-slot { display: none; }
757
+ .seams-voiceid-prompt[data-phrase-view] .seams-voiceid-microphone { display: none; }
758
+ .seams-voiceid-prompt .seams-voiceid-close { transition: opacity 150ms ease, visibility 0s linear 0s; }
759
+ .seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-close {
760
+ opacity: 0;
761
+ visibility: hidden;
762
+ transition: opacity 150ms ease, visibility 0s linear 150ms;
763
+ }
764
+ .seams-voiceid-status.seams-voiceid-two-lines > span { display: block; }
765
+ .seams-voiceid-status .seams-voiceid-caption {
766
+ margin-bottom: 0.125rem;
767
+ font-size: 0.8125rem;
768
+ font-weight: 500;
769
+ color: var(--seams-colors-textPrimary, #eff2f3);
770
+ }
771
+ .seams-voiceid-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
772
+ .seams-voiceid-heard-mark {
773
+ background: none;
774
+ color: var(--seams-colors-error, oklch(0.74 0.166 19));
775
+ text-decoration: underline;
776
+ text-decoration-thickness: 1.5px;
777
+ text-underline-offset: 3px;
778
+ }
779
+ .seams-voiceid-prompt .seams-voiceid-primary:has(> .seams-voiceid-action-icon) {
780
+ display: flex;
781
+ align-items: center;
782
+ justify-content: center;
783
+ gap: 0.5rem;
784
+ }
785
+ .seams-voiceid-action-icon {
786
+ fill: none;
787
+ stroke: currentColor;
788
+ stroke-width: 1.75;
789
+ stroke-linecap: round;
790
+ stroke-linejoin: round;
791
+ }
792
+ .seams-voiceid-prompt[data-phrase-view] .seams-voiceid-primary:disabled { cursor: default; }
793
+ @media (prefers-reduced-motion: reduce) {
794
+ .seams-voiceid-status-line rect { animation: none !important; transition: none; }
795
+ }
796
+ @media (hover: hover) and (pointer: fine) {
797
+ .seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
798
+ .seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
799
+ }
800
+ `,Zn=new WeakSet;function Qn(t){if(Zn.has(t))return;Zn.add(t);try{let e=new CSSStyleSheet;e.replaceSync(Xn),t.adoptedStyleSheets=[...t.adoptedStyleSheets,e];return}catch{}let n=t.createElement(`style`),r=e();r&&n.setAttribute(`nonce`,r),n.textContent=Xn,(t.head??t.documentElement).appendChild(n)}var $n=class{element;title;phrase;status;record;cancel;progress;ribbon;actionRow;microphone;microphoneRequested=!1;visual;disposed=!1;pendingChange=null;changing=null;laidOut=!1;hidden=!1;sizes=new ResizeObserver(this.observeSize.bind(this));frameFill=0;onFrameFitted=[];constructor(e,t,n,r=`ring`,i=e=>e){this.display=i,Qn(e),this.element=e.createElement(`section`),this.element.className=`seams-voiceid-prompt`,this.element.setAttribute(`aria-label`,t),this.title=e.createElement(`h2`),this.title.textContent=`Read aloud`,this.phrase=e.createElement(`p`),this.phrase.className=`seams-voiceid-phrase`,this.phrase.dataset.voiceidPhrase=``,this.phrase.setAttribute(`aria-live`,`polite`),this.setPhrase(n),this.visual=new Yn(e,this.element,r),this.status=e.createElement(`p`),this.status.className=`seams-voiceid-status`,this.status.setAttribute(`role`,`status`),this.record=e.createElement(`button`),this.record.type=`button`,this.record.className=`seams-voiceid-primary`,this.record.textContent=`Record`,this.cancel=e.createElement(`button`),this.cancel.type=`button`,this.cancel.className=`seams-voiceid-close`;let a=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.setAttribute(`viewBox`,`0 0 24 24`),a.setAttribute(`width`,`20`),a.setAttribute(`height`,`20`),a.setAttribute(`aria-hidden`,`true`);let o=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.setAttribute(`d`,`M6 6l12 12M18 6L6 18`),o.setAttribute(`fill`,`none`),o.setAttribute(`stroke`,`currentColor`),o.setAttribute(`stroke-width`,`1.75`),o.setAttribute(`stroke-linecap`,`round`),a.append(o),this.cancel.append(a),this.cancel.setAttribute(`aria-label`,`Cancel`),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let s=e.createElement(`div`);s.className=`seams-voiceid-record-slot`,this.actionRow=s,this.ribbon=this.visual.element,this.microphone=e.createElement(`button`),this.microphone.type=`button`,this.microphone.className=`seams-voiceid-microphone`,this.microphone.textContent=`Use system microphone`,this.microphone.hidden=!0,this.microphone.addEventListener(`click`,this.changeMicrophone),s.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,s,this.progress),this.sizes.observe(this.element)}showBack(){this.cancel.classList.add(`seams-voiceid-back`),this.cancel.setAttribute(`aria-label`,`Back`),this.cancel.querySelector(`path`)?.setAttribute(`d`,`m15 18-6-6 6-6`)}change(e){return this.pendingChange=ur(this.pendingChange,e),this.changing??=this.drainChanges().finally(this.changesDrained),this.changing}changesDrained=()=>{this.changing=null};async drainChanges(){let e=[];for(;this.pendingChange&&!this.disposed;){let t=this.pendingChange;this.pendingChange=null;let n=this.changingRows(t).filter(t=>!e.includes(t));if(n.length>0&&!lr()){if(await Promise.all(n.map(pr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=ur(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),mr(e),e=[]}}changingRows(e){let t=[];e.title!==void 0&&e.title!==this.title.textContent&&t.push(this.title),e.phrase!==void 0&&e.phrase!==this.phrase.dataset.voiceidPhrase&&t.push(this.phrase),e.status!==void 0&&e.status!==this.status.textContent&&t.push(this.status);let n=e.action;return n&&(n.label!==void 0&&n.label!==this.record.textContent||n.hidden!==void 0&&n.hidden!==this.record.hidden)&&t.push(this.actionRow),t}rowOrder(e){return[this.title,this.phrase,this.status,this.actionRow].filter(t=>e.includes(t))}writeChange(e){e.title!==void 0&&(this.title.textContent=e.title),e.phrase!==void 0&&this.setPhrase(e.phrase),e.status!==void 0&&(this.status.textContent=e.status),e.action?.label!==void 0&&(this.record.textContent=e.action.label),e.action?.hidden!==void 0&&(this.record.hidden=e.action.hidden),e.apply?.()}readyChange(e,t={}){return this.change({...t,status:e,action:{...t.action,hidden:!1},apply:()=>{t.apply?.(),this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}})}skipEntrance(){this.element.classList.add(`seams-voiceid-entered`)}fillFrame(e=window.innerHeight,t=`top`,n){n&&this.onFrameFitted.push(n);let r=this.element.closest(`.seams-voiceid-hugged`);if(!r||this.disposed){this.frameFitted();return}let i=++this.frameFill,a=t===`center`||this.element.dataset.frameFill===`center`;this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill;let o=this.element.getBoundingClientRect().height;if(e<=o+1){this.frameFitted();return}r.style.height=`${o}px`,a&&(this.element.dataset.frameFill=`center`);let s=e;this.element.style.minHeight=`${s}px`;let c=0,l=performance.now(),u=()=>{if(!(i!==this.frameFill||this.disposed)){if(s=Math.min(s,Math.max(window.innerHeight,o)),this.element.style.minHeight=`${s}px`,c=window.innerHeight<=o+1?c+1:0,c<2&&performance.now()-l<cr){requestAnimationFrame(u);return}this.element.style.minHeight=``,r.style.height=``,delete this.element.dataset.frameFill,this.frameFitted()}};requestAnimationFrame(u)}releaseRows=()=>{delete this.element.dataset.rowsHeld,mr(this.rows())};frameFitted(){for(let e of this.onFrameFitted.splice(0))e()}rows(){return[...this.element.children].filter(e=>!e.matches(`.seams-voiceid-glow, .seams-voiceid-close, .seams-voiceid-progress-slot`))}observeSize(e){let t=e.at(-1)?.contentRect;if(!t||this.disposed)return;if(t.height===0){if(!this.laidOut)return;this.hidden=!0,this.skipEntrance();return}if(!this.laidOut){this.laidOut=!0,this.element.classList.contains(`seams-voiceid-entered`)||mr(this.rows());return}if(!this.hidden)return;this.hidden=!1,this.element.dataset.rowsHeld=``,this.fillFrame(window.innerHeight,`center`,this.releaseRows);let n=this.element.ownerDocument.activeElement;(!n||n===this.element.ownerDocument.body)&&(this.element.tabIndex=-1,this.element.focus({preventScroll:!0}))}setPhrase(e){let t=this.display(e);this.phrase.textContent=t.charAt(0).toUpperCase()+t.slice(1)+`.`,this.phrase.dataset.voiceidPhrase=e}capture=e=>{if(!this.disposed)switch(e.kind){case`opening`:this.microphoneRequested=!0,this.microphone.hidden=!0;return;case`listening`:this.microphone.hidden=!0,this.element.dataset.capture=`listening`,this.change({status:`Listening`,action:{hidden:!0}}),this.visual.listen();return;case`activity`:this.visual.add(e);return;case`measured`:e.quality.noise===`high`&&(this.status.textContent=`Background noise is high. Move closer to the microphone.`);return;case`processing`:this.element.dataset.capture=`processing`,this.lockLayout(),this.visual.checking(),this.change({status:`Checking your voice…`});return;default:return ar(e)}};continueFrom(e){this.skipEntrance(),this.element.tabIndex=-1;let t=e.querySelector(`:scope > h2`)?.textContent,n=e.querySelector(`:scope > .seams-voiceid-status`)?.textContent,r=e.querySelector(`:scope > .seams-voiceid-record-slot > .seams-voiceid-primary`);t!=null&&(this.title.textContent=t),n!=null&&(this.status.textContent=n),r&&(this.record.textContent=r.textContent,this.record.hidden=r.hidden);let i=[[e.querySelector(`:scope > h2`),this.title],[e.querySelector(`:scope > .seams-voiceid-phrase`),this.phrase],[e.querySelector(`:scope > .seams-voiceid-status`),this.status],[e.querySelector(`:scope > .seams-voiceid-record-slot`),this.actionRow]].flatMap(([e,t])=>{let n=e?Number(getComputedStyle(e).opacity):1;return n<.99?[{row:t,opacity:n}]:[]});i.length>0&&queueMicrotask(()=>i.forEach(gr))}accepted(){this.visual.accept()}flattenLine(){this.visual.flatten()}quietLine(){this.visual.ready()}async succeed(e,t,n=this.element.getBoundingClientRect()){this.disposed||(this.element.dataset.capture=`succeeded`,this.record.hidden=!0,this.microphone.hidden=!0,await this.visual.succeed(this.beginSuccess.bind(this,e,t,n)))}ready(e){this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.status.textContent=e,this.record.hidden=!1,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}changeMicrophone=()=>{this.useSystemMicrophone()};async useSystemMicrophone(){this.record.disabled=!0,this.microphone.disabled=!0,await r(),!this.disposed&&(this.status.textContent=`The next recording will use your system microphone.`,this.record.disabled=!1,this.microphone.disabled=!1,this.microphone.hidden=!0,this.record.focus())}dispose(){this.disposed=!0,this.sizes.disconnect(),this.microphone.removeEventListener(`click`,this.changeMicrophone),this.visual.stop()}lockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=`${e.getBoundingClientRect().height}px`;this.element.style.height=this.element.style.minHeight}async beginSuccess(e,t,n){if(this.disposed)return;let r=this.visual.element.getBoundingClientRect(),i=(n.top+n.bottom-r.top-r.bottom)/2;if(this.visual.element.animate([{translate:`0 0`},{translate:`0 ${i}px`}],{duration:600,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`forwards`}),await Promise.all([this.title,this.phrase,this.status].map(rr)),this.disposed)return;this.phrase.textContent=e,this.phrase.classList.add(`seams-voiceid-success-headline`),this.status.textContent=t,this.status.classList.add(`seams-voiceid-success-message`);let a=matchMedia(`(prefers-reduced-motion: reduce)`).matches;for(let[e,t]of[this.phrase,this.status].entries())t.style.translate=`0 ${i}px`,ir(t,a,tr-er+e*nr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const er=150,tr=450,nr=40;function rr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function ir(e,t,n){e.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:1,transform:`none`}],{delay:n,duration:300,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`})}function ar(e){throw Error(`Unexpected capture event: ${String(e)}`)}const or=`cubic-bezier(0.2, 0, 0, 1)`,sr=`seams-voiceid-row`,cr=800;function lr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ur(e,t){if(!e)return t;let n=[e.apply,t.apply].filter(e=>e!==void 0);return{...e,...t,action:e.action||t.action?{...e.action,...t.action}:void 0,apply:n.length===0?void 0:()=>n.forEach(dr)}}function dr(e){e()}function fr(e){for(let t of e.getAnimations())t.id===sr&&t.cancel()}function pr(e){let t=Number(getComputedStyle(e).opacity);return fr(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:sr}).finished.catch(hr)}function mr(e){let t=lr();for(let[n,r]of e.entries()){fr(r);let e=Number(getComputedStyle(r).opacity);e!==0&&r.animate([{opacity:0,transform:t?`none`:`translateY(4px)`},{opacity:e,transform:`none`}],{delay:t?0:60+n*40,duration:t?150:300,easing:or,fill:`backwards`,id:sr})}}function hr(){}function gr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:300*(1-t),easing:or,id:sr})}function _r(e){if(!e.isConnected||lr()){e.remove();return}e.inert=!0,e.classList.remove(`seams-auth-method-activation-surface`),delete e.dataset.seamsVoiceidHandoff;let t=e.getBoundingClientRect();e.style.position=`fixed`,e.style.top=`${t.top}px`,e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,e.style.margin=`0`,e.style.pointerEvents=`none`;let n=Number(getComputedStyle(e).opacity);e.animate([{opacity:n},{opacity:0}],{duration:150*n,easing:`ease-in`,fill:`forwards`}).finished.catch(hr).finally(()=>e.remove())}const vr=`Say this with your voice`,yr=`Say this sentence`,br=`Read it naturally, then pause.`;function xr(e){return new Sr(e)}var Sr=class{element;prompt;card;unmounted;outer;detector;recorder=null;recording=null;choice=null;view=null;started=!1;closed=!1;expectedSpeechMs;speechDetectorReady=!1;constructor(e){let{sentence:n,frame:r={}}=e,a=e.signal;this.outer=a,this.detector=e.detector,this.expectedSpeechMs=i(n);let o=document.querySelector(`.seams-voiceid-activation-surface[data-seams-voiceid-handoff]`);e.detector===`level`?this.speechDetectorReady=!0:t.prepare().then(this.detectorStarted,Cr);let s=r.parent??document.body;this.element=document.createElement(`section`),this.element.className=[`seams-voiceid-activation-surface`,r.className].filter(Boolean).join(` `),this.element.setAttribute(`role`,`dialog`),this.element.setAttribute(`aria-modal`,`true`),this.element.setAttribute(`aria-label`,vr),this.prompt=new $n(document,vr,n),this.prompt.title.textContent=yr;let c=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=c,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=br,this.prompt.record.textContent=`Record`,r.back&&this.prompt.showBack();let l=o?.querySelector(`:scope > .seams-voiceid-prompt`)??null,u=l?wr(l):null;l&&(this.prompt.continueFrom(l),this.prompt.record.hidden=!0),this.card=new f(this.prompt,{label:yr,sentence:c,message:br,action:`Record`},u),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press),this.prompt.cancel.addEventListener(`click`,this.cancel),this.element.addEventListener(`cancel`,this.cancel),a.addEventListener(`abort`,this.cancel),o?o.replaceWith(this.element):s.appendChild(this.element),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),u?this.prompt.element.focus({preventScroll:!0}):this.prompt.record.focus(),a.aborted&&this.cancel()}record(){if(this.closed)return Promise.resolve({kind:`cancelled`});this.settleChoice(`replaced`),this.recording?.resolve({kind:`cancelled`});let e=Tr();return this.recording=e,this.view&&(this.view=null,this.card.showPrompt()),e.promise}show(e){return this.closed?Promise.resolve(`closed`):(this.settleChoice(`replaced`),this.view=e,this.card.show(e),new Promise(e=>{this.choice=e}))}close(){this.closed||(this.closed=!0,this.recorder?.abort(),this.recording?.resolve({kind:`cancelled`}),this.settleChoice(`closed`),this.unmounted?.(),this.outer.removeEventListener(`abort`,this.cancel),this.element.removeEventListener(`cancel`,this.cancel),this.prompt.record.removeEventListener(`click`,this.press),this.prompt.cancel.removeEventListener(`click`,this.cancel),this.card.dispose(),this.prompt.dispose(),_r(this.element))}press=()=>{if(this.view){this.view.kind===`result`&&!this.view.action.busy&&this.settleChoice(`action`);return}!this.recording||this.started||(this.started=!0,this.prompt.record.disabled=!0,this.prompt.status.textContent=this.speechDetectorReady?`Opening microphone…`:`Loading ${s().label}…`,this.attempt(this.recording))};async attempt(e){let t=new AbortController;this.recorder=t;try{let r=await a(t.signal,this.capture,{expectedSpeechMs:this.expectedSpeechMs,detector:this.detector});if(this.recording!==e||this.closed){r.samples?.fill(0);return}if(r.kind===`insufficient_audio`){this.retry(n(r.quality));return}let i=r.lastSoundAtMs??performance.now();this.started=!1,this.recording=null,e.resolve({kind:`recorded`,samples:r.samples,endOfSpeechAt:i})}catch(t){if(this.recording!==e||this.closed)return;if(t instanceof o){this.retry(t.message);return}this.started=!1,this.recording=null,e.reject(t instanceof Error?t:Error(String(t)))}}detectorStarted=()=>{this.speechDetectorReady=!0};capture=e=>{e.kind===`processing`?this.card.beginCheck():this.prompt.capture(e)};retry(e){this.started=!1,this.prompt.record.textContent=`Try again`,this.prompt.ready(e),this.prompt.record.focus()}settleChoice(e){let t=this.choice;this.choice=null,t?.(e)}cancel=()=>{this.view?.kind===`check`&&!this.outer.aborted||(this.recording&&(this.recorder?.abort(),this.recording.resolve({kind:`cancelled`}),this.recording=null,this.started=!1),this.settleChoice(`closed`),this.outer.aborted&&this.close())}};function Cr(){}function wr(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function Tr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{f as PhraseCard,$n as VoicePrompt,Vn as VoiceRibbon,Yn as VoiceVisual,_r as leaveSurface,xr as openPhraseCard};