@seams/voice-capture 0.68.1 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/browser/card.js +253 -19
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/card/phraseCard.js +2 -2
- package/dist/esm/card/prompt.js +315 -20
- package/dist/esm/card/ribbon.js +92 -2
- package/dist/esm/card/rowMotion.js +3 -3
- package/dist/esm/card/surface.js +114 -5
- package/dist/esm/card/visual.js +1 -1
- package/dist/esm/chunks/{visual-CeEQ8QkM.js → visual-rOVJCP2w.js} +13 -2
- package/dist/types/card/index.d.ts +2 -2
- package/dist/types/card/prompt.d.ts +13 -1
- package/dist/types/card/ribbon.d.ts +17 -0
- package/dist/types/card/rowMotion.d.ts +3 -3
- package/dist/types/card/surface.d.ts +65 -0
- package/dist/types/card/visual.d.ts +4 -2
- package/package.json +1 -1
package/dist/browser/card.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/microphone-BQVF_tVV.js";const l=`cubic-bezier(0.2, 0, 0, 1)`,u=`http://www.w3.org/2000/svg`,d=`cubic-bezier(0.2, 0, 0, 1)`,f=`cubic-bezier(0.65, 0, 0.35, 1)`,p=[`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 m=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(u,`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(u,`rect`);e.setAttribute(`rx`,`1.5`),this.line.append(e),this.segments.push(e)}this.bar=r.createElementNS(u,`path`),this.bar.classList.add(`seams-voiceid-status-bar`),this.bar.setAttribute(`d`,`M1.5 32H306.5`),this.ring=r.createElementNS(u,`circle`),this.ring.classList.add(`seams-voiceid-status-ring`),this.ring.setAttribute(`r`,`21.5`),this.seal=r.createElementNS(u,`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(u,`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=>g(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())_(t,this.motion.matches,20+e*30)}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(h(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 g(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:d,fill:`both`})))}async openSegments(){await v(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 v(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 v(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 v(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,f)),await this.ring.animate([{strokeDashoffset:n},{strokeDashoffset:0}],r(440,f)).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 v(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,d)).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 h(e){let t=e.createElementNS(u,`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 p){let r=e.createElementNS(u,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function g(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 _(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:200,easing:l,fill:`both`})}function v(e){return new Promise(t=>window.setTimeout(t,e))}var y,b,x,S,C,w,T,E,D,ee,O,k,A,te,j={},M=[],ne=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,N=Array.isArray;function P(e,t){for(var n in t)e[n]=t[n];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function I(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?y.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 L(e,o,r,i,null)}function L(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??++x,__i:-1,__u:0};return i==null&&b.vnode!=null&&b.vnode(a),a}function R(e){return e.children}function z(e,t){this.props=e,this.context=t}function B(e,t){if(t==null)return e.__?B(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`?B(e):null}function re(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=P({},t);a.__v=t.__v+1,b.vnode&&b.vnode(a),me(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??B(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&&ie(a)}}function ie(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}),ie(e)}function ae(e){(!e.__d&&(e.__d=!0)&&S.push(e)&&!V.__r++||C!=b.debounceRendering)&&((C=b.debounceRendering)||w)(V)}function V(){try{for(var e,t=1;S.length;)S.length>t&&S.sort(T),e=S.shift(),t=S.length,re(e)}finally{S.length=V.__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||M,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]||j,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]=L(null,o,null,null,null):N(o)?o=e.__k[a]=L(R,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=L(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=B(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=B(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`||(N(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`||ne.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(O,`$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[ee]=r[ee]:(n[ee]=k,e.addEventListener(t,a?te:A,a)):e.removeEventListener(t,a?te:A,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[D]==null)t[D]=k++;else if(t[D]<n[ee])return;return n(b.event?b.event(t):t)}}}function me(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,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=b.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=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:(y?t.__c=f=new D(v,S):(t.__c=f=new z(v,S),f.constructor=D,f.render=xe),x&&x.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=P({},f.__s)),P(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,S)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),M.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=B(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,S),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=S,f.props=v,f.__P=e,f.__e=!1,C=b.__r,w=0,y)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),M.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=P(P({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===R&&u.key==null?_e(u.props.children):u,s=oe(e,N(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--;)F(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||he(t),b.__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=b.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]);b.__c&&b.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){b.__e(e,t.__v)}})}function _e(e){return typeof e!=`object`||!e||e.__b>0?e:N(e)?e.map(_e):e.constructor===void 0?P({},e):null}function ve(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||j,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`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==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(b.__m&&b.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&y.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 _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||fe(e,l,null,p,i);for(l in _)p=_[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,N(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&B(n,0),s,c),a!=null)for(l=a.length;l--;)F(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`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){b.__e(e,n)}}function be(e,t,n){var r,i;if(b.unmount&&b.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){b.__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||F(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),b.__&&b.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],me(t,e=(!r&&n||t).__k=I(R,null,[e]),i||j,j,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?y.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ge(a,e,o),e.props.children=null}y=M.slice,b={__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}},x=0,z.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=P({},this.state);typeof e==`function`&&(e=e(P({},n),this.props)),e&&P(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ae(this))},z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ae(this))},z.prototype.render=R,S=[],w=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,T=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,E=Math.random().toString(8),D=`__d`+E,ee=`__a`+E,O=/(PointerCapture)$|Capture$/i,k=0,A=pe(!1),te=pe(!0);var Ce,H,we,Te,Ee=0,De=[],U=b,Oe=U.__b,ke=U.__r,Ae=U.diffed,je=U.__c,Me=U.unmount,Ne=U.__;function Pe(e,t){U.__h&&U.__h(H,e,Ee||t),Ee=0;var n=H.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fe(e){return Ee=1,Ie(Ge,e)}function Ie(e,t,n){var r=Pe(Ce++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ge(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=H,!H.__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};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.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)},H.shouldComponentUpdate=i}return r.__N||r.__}function Le(e,t){var n=Pe(Ce++,3);!U.__s&&We(n.__H,t)&&(n.__=e,n.u=t,H.__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 We(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=H.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function W(){for(var e;e=De.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(G),t.__h.some(K),t.__h=[]}catch(n){t.__h=[],U.__e(n,e.__v)}}}U.__b=function(e){H=null,Oe&&Oe(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},U.__r=function(e){ke&&ke(e),Ce=0;var t=(H=e.__c).__H;t&&(we===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(G),t.__h.some(K),t.__h=[],Ce=0)),we=H},U.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(De.push(t)!==1&&Te===U.requestAnimationFrame||((Te=U.requestAnimationFrame)||Ue)(W)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),we=H=null},U.__c=function(e,t){t.some(function(e){try{e.__h.some(G),e.__h=e.__h.filter(function(e){return!e.__||K(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],U.__e(n,e.__v)}}),je&&je(e,t)},U.unmount=function(e){Me&&Me(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{G(e)}catch(e){t=e}}),n.__H=void 0,t&&U.__e(t,n.__v))};var He=typeof requestAnimationFrame==`function`;function Ue(e){var t,n=function(){clearTimeout(r),He&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);He&&(t=requestAnimationFrame(n))}function G(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function K(e){var t=H;e.__c=e.__(),H=t}function We(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ge(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 z).isPureReactComponent=!0,Je.prototype.shouldComponentUpdate=function(e,t){return qe(this.props,e)||qe(this.state,t)};var Ye=b.__b;b.__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=b.__e;b.__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=b.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}b.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 z).__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&&I(R,null,e.fallback);return i&&(i.__u&=-33),[I(R,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 z).__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)};z.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(z.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=b.event;b.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=b.vnode;b.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=b.__r;b.__r=function(e){ht&&ht(e),e.__c};var gt=b.diffed;b.diffed=function(e){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 q(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 b.vnode&&b.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(`,
|
|
1
|
+
import{S as e,h as t,n,o as r,r as i,s as a,u as o,v as s,w as c}from"./chunks/microphone-BQVF_tVV.js";const l=`cubic-bezier(0.2, 0, 0, 1)`,u=`http://www.w3.org/2000/svg`,d=`cubic-bezier(0.2, 0, 0, 1)`,f=`cubic-bezier(0.65, 0, 0.35, 1)`,p=[`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 m=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(u,`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(u,`rect`);e.setAttribute(`rx`,`1.5`),this.line.append(e),this.segments.push(e)}this.bar=r.createElementNS(u,`path`),this.bar.classList.add(`seams-voiceid-status-bar`),this.bar.setAttribute(`d`,`M1.5 32H306.5`),this.ring=r.createElementNS(u,`circle`),this.ring.classList.add(`seams-voiceid-status-ring`),this.ring.setAttribute(`r`,`21.5`),this.seal=r.createElementNS(u,`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(u,`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=>g(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())_(t,this.motion.matches,0+e*20)}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(h(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 g(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:d,fill:`both`})))}async openSegments(){await v(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 v(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 v(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 v(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,f)),await this.ring.animate([{strokeDashoffset:n},{strokeDashoffset:0}],r(440,f)).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 v(t?0:220),!this.stale(e)&&await this.check.animate([{strokeDashoffset:1},{strokeDashoffset:0}],r(260,d)).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 h(e){let t=e.createElementNS(u,`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 p){let r=e.createElementNS(u,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function g(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 _(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:140,easing:l,fill:`both`})}function v(e){return new Promise(t=>window.setTimeout(t,e))}var y,b,x,S,C,w,T,E,D,ee,O,k,A,te,j={},M=[],ne=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,N=Array.isArray;function P(e,t){for(var n in t)e[n]=t[n];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function I(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?y.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 L(e,o,r,i,null)}function L(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??++x,__i:-1,__u:0};return i==null&&b.vnode!=null&&b.vnode(a),a}function R(e){return e.children}function z(e,t){this.props=e,this.context=t}function B(e,t){if(t==null)return e.__?B(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`?B(e):null}function re(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=P({},t);a.__v=t.__v+1,b.vnode&&b.vnode(a),me(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??B(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&&ie(a)}}function ie(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}),ie(e)}function ae(e){(!e.__d&&(e.__d=!0)&&S.push(e)&&!V.__r++||C!=b.debounceRendering)&&((C=b.debounceRendering)||w)(V)}function V(){try{for(var e,t=1;S.length;)S.length>t&&S.sort(T),e=S.shift(),t=S.length,re(e)}finally{S.length=V.__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||M,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]||j,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]=L(null,o,null,null,null):N(o)?o=e.__k[a]=L(R,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=L(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=B(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=B(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`||(N(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`||ne.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(O,`$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[ee]=r[ee]:(n[ee]=k,e.addEventListener(t,a?te:A,a)):e.removeEventListener(t,a?te:A,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[D]==null)t[D]=k++;else if(t[D]<n[ee])return;return n(b.event?b.event(t):t)}}}function me(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,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=b.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=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:(y?t.__c=f=new D(v,S):(t.__c=f=new z(v,S),f.constructor=D,f.render=xe),x&&x.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=P({},f.__s)),P(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,S)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),M.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=B(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,S),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=S,f.props=v,f.__P=e,f.__e=!1,C=b.__r,w=0,y)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),M.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=P(P({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===R&&u.key==null?_e(u.props.children):u,s=oe(e,N(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--;)F(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||he(t),b.__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=b.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]);b.__c&&b.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){b.__e(e,t.__v)}})}function _e(e){return typeof e!=`object`||!e||e.__b>0?e:N(e)?e.map(_e):e.constructor===void 0?P({},e):null}function ve(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||j,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`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==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(b.__m&&b.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&y.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 _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||fe(e,l,null,p,i);for(l in _)p=_[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,N(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&B(n,0),s,c),a!=null)for(l=a.length;l--;)F(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`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){b.__e(e,n)}}function be(e,t,n){var r,i;if(b.unmount&&b.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){b.__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||F(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),b.__&&b.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],me(t,e=(!r&&n||t).__k=I(R,null,[e]),i||j,j,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?y.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ge(a,e,o),e.props.children=null}y=M.slice,b={__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}},x=0,z.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=P({},this.state);typeof e==`function`&&(e=e(P({},n),this.props)),e&&P(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ae(this))},z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ae(this))},z.prototype.render=R,S=[],w=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,T=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,E=Math.random().toString(8),D=`__d`+E,ee=`__a`+E,O=/(PointerCapture)$|Capture$/i,k=0,A=pe(!1),te=pe(!0);var Ce,H,we,Te,Ee=0,De=[],U=b,Oe=U.__b,ke=U.__r,Ae=U.diffed,je=U.__c,Me=U.unmount,Ne=U.__;function Pe(e,t){U.__h&&U.__h(H,e,Ee||t),Ee=0;var n=H.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fe(e){return Ee=1,Ie(Ge,e)}function Ie(e,t,n){var r=Pe(Ce++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ge(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=H,!H.__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};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.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)},H.shouldComponentUpdate=i}return r.__N||r.__}function Le(e,t){var n=Pe(Ce++,3);!U.__s&&We(n.__H,t)&&(n.__=e,n.u=t,H.__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 We(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=H.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function W(){for(var e;e=De.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(G),t.__h.some(K),t.__h=[]}catch(n){t.__h=[],U.__e(n,e.__v)}}}U.__b=function(e){H=null,Oe&&Oe(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},U.__r=function(e){ke&&ke(e),Ce=0;var t=(H=e.__c).__H;t&&(we===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(G),t.__h.some(K),t.__h=[],Ce=0)),we=H},U.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(De.push(t)!==1&&Te===U.requestAnimationFrame||((Te=U.requestAnimationFrame)||Ue)(W)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),we=H=null},U.__c=function(e,t){t.some(function(e){try{e.__h.some(G),e.__h=e.__h.filter(function(e){return!e.__||K(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],U.__e(n,e.__v)}}),je&&je(e,t)},U.unmount=function(e){Me&&Me(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{G(e)}catch(e){t=e}}),n.__H=void 0,t&&U.__e(t,n.__v))};var He=typeof requestAnimationFrame==`function`;function Ue(e){var t,n=function(){clearTimeout(r),He&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);He&&(t=requestAnimationFrame(n))}function G(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function K(e){var t=H;e.__c=e.__(),H=t}function We(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ge(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 z).isPureReactComponent=!0,Je.prototype.shouldComponentUpdate=function(e,t){return qe(this.props,e)||qe(this.state,t)};var Ye=b.__b;b.__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=b.__e;b.__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=b.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}b.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 z).__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&&I(R,null,e.fallback);return i&&(i.__u&=-33),[I(R,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 z).__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)};z.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(z.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=b.event;b.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=b.vnode;b.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=b.__r;b.__r=function(e){ht&&ht(e),e.__c};var gt=b.diffed;b.diffed=function(e){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 q(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 b.vnode&&b.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
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))),ne=e=>h*e,N=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}),z=c===`mono`?.6:1,B=(i*z).toFixed(2),re=(a*z).toFixed(2),ie=(o*z).toFixed(2),ae=u.toFixed(2),V=d.toFixed(2),oe=`hue-rotate(calc(var(--voice-hue-base, ${p}deg) + var(--vb-hue-${t})))`,se=O?` url(#vb-distort-${t})`:``,ce=`filter: ${oe} brightness(${ae}) saturate(${V});`,le=`filter: ${oe} brightness(${ae}) saturate(${V})${se};`,ue=`filter: blur(${I(Et(10,m))}) ${oe} brightness(${ae}) saturate(${V});`,de=`filter: blur(${I(Et(10,m))}) ${oe} brightness(${ae}) saturate(${V})${se};`,fe=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${F})`,pe=`calc(100% + (2px + var(--vb-cy-${t})) * ${F})`,me=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 ${fe} ${pe}, 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 ${fe} ${pe}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,he=Ot({id:t,colors:R,alpha:1,sw:ne(_),sh:N(_),y:2,fade:M}),ge=Ot({id:t,colors:R,alpha:.46,sw:ne(.9*v),sh:N(.9*v*y),y:0,fade:M}),_e=Ot({id:t,colors:R,alpha:L?.9:.7,sw:ne(1.15*b),sh:N(1.5*b*x),y:0,fade:Math.min(95,M+2)}),ve=(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 ${fe} 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%)`,ye=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,be=(e,t,r,i)=>`${e} {
|
|
3
3
|
${t}
|
|
4
4
|
position: absolute;
|
|
@@ -292,7 +292,7 @@ ${O?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
|
|
|
292
292
|
animation-play-state: paused !important;
|
|
293
293
|
}
|
|
294
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 J=null,Rt=0,Y=0,zt=!1,Bt=!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 X(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 Jt(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 Yt=!(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){J=requestAnimationFrame(un);let t=Y?e-Y:0;if(Y=e,zt){if(Bt=!Bt,Bt)return;e>=Ht&&(zt=!1,Vt=0)}else t>22?Vt?e-Vt>500&&(zt=!0,Bt=!1,Ht=e+4e3):Vt=e:Vt=0;e-Rt<14.666666666666668||(Rt=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=X(ln.level,i.threshold);o.level=Jt(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=X(ln.bands[e],i.threshold*.6);o.bands[e]=Jt(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=Jt(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 ne=i.bend*A;r.style.setProperty(`--vb-bh-${i.id}`,`${Math.max(0,ne).toFixed(1)}px`);let N=i.bend>0?Math.min(1,ne/i.bend):0;r.style.setProperty(`--vb-bendA-${i.id}`,N.toFixed(3));let P={cx:C,w:M,h:j,mw:T,lift:ne,strength:N,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=Jt(o.warp,i.processing?0:1,c,.35,.06);let z=o.warp,B=t.displace!=null&&z<.03;if(B!==t.warpOff&&(t.warpOff=B,B?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&&!B||i.coreLight>0)&&rn(r,i.id,e,m,h),t.filter&&!B&&Yt&&an(t,e,h),t.ctx&&on(t,P,e)}if(t.displace&&!B){let e=i.reducedMotion?0:i.distortion*120*i.scale*(.15+.85*A)*z;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 re=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*sn(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${re.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function dn(){J??=(Rt=0,Y=0,Vt=0,requestAnimationFrame(un))}function fn(){Lt.size===0&&J!=null&&(cancelAnimationFrame(J),J=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:ne,innerOpacity:N,bloomOpacity:P,bend:F,bandStrength:I,bandWidth:L,bandPosition:z,bandCurve:B,bandSpread:re,bandSkew:ie,bandOffset:ae,bandTail:V,bandTailPosition:oe,bandTailCurve:se,bandTailOverflow:ce,bandAberration:le,distortion:ue,distortionDetail:de,glowWidth:fe,glowHeight:pe,lobeSpacing:me,rangeWidth:he,rangeHeight:ge,softness:_e,coreSize:ve,coreLight:ye,coreLightWidth:be,coreLightHeight:xe,strokeScale:Se,innerScale:Ce,innerHeight:H,bloomScale:we,bloomHeight:Te,strength:Ee,className:De,style:U,css:Oe,onLevel:ke,onActivate:Ae,onDeactivate:je,onAnimationEnd:Me,...Ne},Pe){let Ie=Ve().replace(/:/g,`-`),W=En(T,wn()),He=C?C.join(`|`):``,Ue=w?[w.core,w.above,w.mid,w.below].join(`|`):``,G=bn(t,W),K=Math.max(.05,n??G.scale),We=M??G.glowSize,Ge=ne??G.strokeOpacity,Ke=N??G.innerOpacity,qe=P??G.bloomOpacity,Je=g??G.processingDuration,Ye=_??G.processingLevel,Xe=v??G.processingTravel,Ze=y??G.processingCurve,Qe=b??G.cornerFollow,$e=l??G.idle,et=d??G.reach,tt=f??G.spread,nt=(m??G.flow)*K,rt=(F??G.bend)*K,it=I??G.bandStrength,at=(L??G.bandWidth)*K,ot=z??G.bandPosition,st=B??G.bandCurve,ct=re??G.bandSpread,lt=ie??G.bandSkew,ut=(ae??G.bandOffset)*K,dt=V??G.bandTail,ft=oe??G.bandTailPosition,pt=se??G.bandTailCurve,mt=(ce??G.bandTailOverflow)*K,ht=le??G.bandAberration,gt=ue??G.distortion,_t=(de??G.distortionDetail)/K,vt=(fe??G.glowWidth)*K,yt=(pe??G.glowHeight)*K,St=(me??G.lobeSpacing)*K,Ct=(he??G.rangeWidth)*K,wt=(ge??G.rangeHeight)*K,Tt=_e??G.softness,Et=(ve??G.coreSize)*K,Dt=Math.max(0,Math.min(3,ye??G.coreLight)),Ot=be??G.coreLightWidth,At=xe??G.coreLightHeight,jt=Se??G.strokeScale,Mt=Ce??G.innerScale,Nt=H??G.innerHeight,Pt=we??G.bloomScale,Ft=Te??G.bloomHeight,It=Tn(),Lt=Re(null),[J,Rt]=Fe(O),[Y,zt]=Fe(!1),[Bt,Vt]=Fe(!0),[Ht,Ut]=Fe(null),[Wt,Gt]=Fe(0);Le(()=>{if(!Sn)return;let e=Lt.current;if(!e)return;let t=()=>Gt(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Kt=Sn&&Wt>6e4?0:gt;Le(()=>{if(A!=null)return;let e=Lt.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&&Ut(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[A,e]),Le(()=>{O&&!J&&!Y?Rt(!0):!O&&J&&!Y&&zt(!0)},[O,J,Y]),Le(()=>{let e=Lt.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)Vt(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let qt=Be(e=>{let t=e.animationName;t.includes(`fade-out`)?(Rt(!1),zt(!1),je?.()):t.includes(`fade-in`)&&Ae?.(),Me?.(e)},[Ae,je,Me]),X=xt[W],Jt=A??Ht??16,Yt=vn(t,W),Xt=Ee??Yt.strength??X.strength??1,Zt=D??X.hueRange??24,Qt=ee??X.hueDuration??12,$t=te??Yt.brightness??X.brightness,en=j??Yt.saturation??X.saturation,tn=ze(()=>kt({id:Ie,borderRadius:Jt,borderWidth:1,strokeOpacity:X.strokeOpacity*Ge,innerOpacity:X.innerOpacity*Ke,bloomOpacity:X.bloomOpacity*qe,innerShadow:X.innerShadow,colorVariant:S,colors:C,brightness:$t,saturation:en,theme:W,hueBase:X.hueBase??0,glowSize:We*K,glowWidth:vt,glowHeight:yt,strokeScale:jt,innerScale:Mt,innerHeight:Nt,bloomScale:Pt,bloomHeight:Ft,coreSize:Et,coreLight:Dt,coreLightWidth:Ot,coreLightHeight:At,rangeWidth:Ct,rangeHeight:wt,softness:Tt,distortion:Kt>0,scale:K}),[Ie,Jt,X,S,He,$t,en,W,G,We,Ge,Ke,qe,K,vt,yt,jt,Mt,Nt,Pt,Ft,Et,Dt,Ot,At,Ct,wt,Tt,Kt>0]),nn=ze(()=>({id:Ie,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,$e)),breatheDuration:Math.max(.2,u),reach:Math.max(0,et),spread:Math.max(0,tt),bands:p,flow:nt,lobeSpacing:Math.max(.1,St),bend:Math.max(0,rt),bandStrength:Math.max(0,it),bandWidth:Math.max(0,at),bandPosition:Math.max(0,ot),bandCurve:Math.max(.3,st),bandSpread:Math.max(.05,ct),bandSkew:Math.max(-.9,Math.min(.9,lt)),bandOffset:ut,bandTail:Math.max(0,Math.min(1.5,dt)),bandTailPosition:Math.max(0,Math.min(.98,ft)),bandTailCurve:Math.max(.5,pt),bandTailOverflow:Math.max(0,mt),bandAberration:Math.max(0,Math.min(1,ht)),rangeWidth:Ct,rangeHeight:wt,theme:W,bandColors:{core:w?.core&&bt(w.core)||xn[W].core,above:w?.above&&bt(w.above)||xn[W].above,mid:w?.mid&&bt(w.mid)||xn[W].mid,below:w?.below&&bt(w.below)||xn[W].below},distortion:Math.max(0,Math.min(1,Kt)),coreLight:Dt,scale:K,radius:Jt,processing:h,processingDuration:Math.max(.05,Je),processingLevel:Math.max(0,Math.min(1,Ye)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Xe),processingCurve:Math.max(1,Ze),cornerFollow:Math.max(0,Math.min(1,Qe)),hueRange:Math.max(0,Zt),hueDuration:Math.max(.5,Qt),staticColors:S===`mono`?!0:E,reducedMotion:It,paused:k}),[Ie,a,o,s,c,$e,u,et,tt,p,nt,St,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,Ct,wt,W,Ue,Kt,Dt,K,Jt,h,Je,Ye,x,Xe,Ze,Qe,Zt,Qt,E,S,It,k]),rn=Re(i);rn.current=i;let an=Re(ke);an.current=ke,Le(()=>{if(!(J||Y)||!Bt)return;let e=Lt.current;return e?pn(e,nn,{stream:r,getLevel:()=>{let e=rn.current;return typeof e==`function`?e():e}},e=>an.current?.call(an,e)):void 0},[nn,r,J,Y,Bt]);let on=Be(e=>{Lt.current=e,typeof Pe==`function`?Pe(e):Pe&&(Pe.current=e)},[Pe]),sn={...U??{},"--voice-strength":Math.max(0,Math.min(1,Xt))};return q(R,{children:[q(`style`,{children:Oe?`${tn}
|
|
295
|
-
${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"data-voice-type":t,"data-voice-halfres":``,"data-active":J&&!Y?``:void 0,"data-fading":Y?``:void 0,"data-paused":J&&!Y&&(!Bt||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:De,style:sn,onAnimationEnd:qt,children:[e,q(`div`,{"data-voice-beam-bloom":!0}),Kt>0&&q(R,{children:[q(`div`,{"data-voice-beam-warp":`inner`}),q(`div`,{"data-voice-beam-warp":`bloom`})]}),!Cn&&q(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),q(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Dt>0&&q(`div`,{"data-voice-beam-core":!0,children:q(`div`,{})}),Kt>0&&q(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:q(`filter`,{id:`vb-distort-${Ie}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*_t).toFixed(4)} ${(.05*_t).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),q(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),q(`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`}),q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),On=`http://www.w3.org/2000/svg`,Z=Math.PI*2,kn=21.5,An=Math.sqrt(12)*kn,jn=154-An,Mn=Kn(),Nn=jn+Mn.length,Pn=.56*Z*kn/2,Fn=.75,In=.35,Ln=.55,Rn=22.5,zn=Yn(.65,0,.35,1),Bn=Yn(.4,0,.2,1),Vn=Yn(.34,1.56,.64,1),Hn=Yn(.2,0,0,1);var Un=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){let n=this.append(e,`path`,t===0?`1`:`0.65`);n.classList.add(t===0?`seams-voiceid-ribbon-line`:`seams-voiceid-ribbon-echo`),t>0&&(n.dataset.layer=String(t)),this.lines.push(n)}this.paint(performance.now())}readLevel=()=>this.level;lineWidth(){let e=this.lines[this.lines.length-1],t=e?Number.parseFloat(getComputedStyle(e).strokeWidth):NaN;return Number.isFinite(t)&&t>0?t:1}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*Z))}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:Z},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?Ln+e*.4:.1+e*.1))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Hn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Hn(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`,String(this.lineWidth())),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Z*(e-t*150)/900);return $(Ln,In+(1-In)*n,Hn(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-Hn(Q(n/150)),o=zn(Q(i/.6)),s=Wn(!1)*kn*560,c=Jn(i,Nn,s),l=jn+Jn(i,Nn+Pn-jn,s),u=Ln+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`,$(this.lineWidth(),Math.max(2,this.lineWidth()),o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,jn,308-jn,a)),this.middle.setAttribute(`opacity`,(u*(1-Hn(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+Wn(!1)*t,i=Pn/kn,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Fn*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Z*.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-Fn)*a*n]])e.setAttribute(`d`,qn({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=Bn(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+Wn(this.motion.matches)*n-Z*c/100,sweep:Z*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:Wn(!1)*650*(r-r*r/2),a=zn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Vn(Q((n-600)/420)),zn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Hn(o);this.ripple.setAttribute(`r`,$(Rn,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`,(Rn*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`,qn(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=Gn(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 Wn(e){return Z/(e?3200:1800)}function Gn(e){if(e<=jn)return{x:e,y:32,onLine:!0};if(e<Nn){let t=e-jn,n=0,r=Mn.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Mn.lengths[e]<t?n=e:r=e}let i=(t-Mn.lengths[n])/(Mn.lengths[r]-Mn.lengths[n]||1);return{x:$(Mn.points[n][0],Mn.points[r][0],i),y:$(Mn.points[n][1],Mn.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-Nn)/kn;return{x:154+kn*Math.cos(t),y:32+kn*Math.sin(t),onLine:!1}}function Kn(){let e=[[jn,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[jn+An*i,32-kn*(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 qn(e){let t=Math.max(2,Math.ceil(80*e.sweep/Z)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+kn*Math.cos(i),o=32+kn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Jn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Yn(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 Xn=Dn,Zn={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function Qn(e){let t=e.trim();return Object.hasOwn(wt,t)?t:`ocean`}var $n=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Un(e,n),this.element=this.ribbon.element,this.glow=e.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render();let r=c();if(r)for(let e of this.glow.querySelectorAll(`style`))e.nonce=r;this.themeObserver=new MutationObserver(this.render),this.themeObserver.observe(e.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),this.themeObserver.observe(e.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=()=>{if(this.disposed)return;let e=(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,t=Qn(getComputedStyle(this.prompt).getPropertyValue(`--seams-colors-voiceBeam`));Se(I(Xn,{className:`seams-voiceid-beam`,theme:e,...t===`mono`?{bandColors:Zn[e]}:{},level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:t,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const er=`
|
|
295
|
+
${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"data-voice-type":t,"data-voice-halfres":``,"data-active":J&&!Y?``:void 0,"data-fading":Y?``:void 0,"data-paused":J&&!Y&&(!Bt||k)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:De,style:sn,onAnimationEnd:qt,children:[e,q(`div`,{"data-voice-beam-bloom":!0}),Kt>0&&q(R,{children:[q(`div`,{"data-voice-beam-warp":`inner`}),q(`div`,{"data-voice-beam-warp":`bloom`})]}),!Cn&&q(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),q(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Dt>0&&q(`div`,{"data-voice-beam-core":!0,children:q(`div`,{})}),Kt>0&&q(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:q(`filter`,{id:`vb-distort-${Ie}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[q(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*_t).toFixed(4)} ${(.05*_t).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),q(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),q(`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`}),q(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),On=`http://www.w3.org/2000/svg`,Z=Math.PI*2,kn=21.5,An=Math.sqrt(12)*kn,jn=154-An,Mn=Jn(),Nn=jn+Mn.length,Pn=.56*Z*kn/2,Fn=.75,In=.35,Ln=.55,Rn=22.5,zn=4.5,Bn=.3,Vn=Zn(.65,0,.35,1),Hn=Zn(.4,0,.2,1),Un=Zn(.34,1.56,.64,1),Wn=Zn(.2,0,0,1);var Gn=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;lineStyle=`wave`;pixels=null;pixelLevels=Array(44).fill(0);pixelHeights=Array(44).fill(-1);pixelClock=0;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){let n=this.append(e,`path`,t===0?`1`:`0.65`);n.classList.add(t===0?`seams-voiceid-ribbon-line`:`seams-voiceid-ribbon-echo`),t>0&&(n.dataset.layer=String(t)),this.lines.push(n)}this.paint(performance.now())}readLevel=()=>this.level;setLineStyle(e){this.lineStyle=e,this.element.dataset.lineStyle=e,e===`pixels`&&!this.pixels&&(this.pixels=this.makePixels()),this.pixelHeights.fill(-1),this.paint(performance.now()),this.wake()}makePixels(){let e=this.element.ownerDocument,t=e.createElementNS(On,`g`);t.classList.add(`seams-voiceid-ribbon-pixels`),t.setAttribute(`opacity`,`0`),(308-(301+zn))/2;let n=[];for(let r=0;r<44;r+=1){let i=[];for(let n=-4;n<=4;n+=1){let a=e.createElementNS(On,`rect`);a.classList.add(`seams-voiceid-ribbon-pixel`);let o=Math.abs(n);a.dataset.band=o===0?`0`:o<=2?`1`:`2`,a.setAttribute(`x`,(1.25+r*7).toFixed(2)),a.setAttribute(`y`,(32-zn/2+n*6).toFixed(2)),a.setAttribute(`width`,`4.5`),a.setAttribute(`height`,`4.5`),a.setAttribute(`rx`,`1`),a.setAttribute(`opacity`,`0`),t.append(a),i.push(a)}n.push(i)}return this.element.prepend(t),{group:t,columns:n}}lineWidth(){let e=this.lines[this.lines.length-1],t=e?Number.parseFloat(getComputedStyle(e).strokeWidth):NaN;return Number.isFinite(t)&&t>0?t:1}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.lineStyle===`pixels`&&this.stepPixels(t),this.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001&&this.pixelLevels.every(e=>e<=.001)||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Z))}stepPixels(e){for(this.pixelClock+=e;this.pixelClock>=70;)this.pixelClock-=70,this.pixelLevels.shift(),this.pixelLevels.push(this.level*(Bn+(1-Bn)*Math.random()))}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.pixels?.group.setAttribute(`opacity`,`0`),this.stage.kind){case`line`:this.lineStyle===`pixels`?this.paintPixels(e):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:Z},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?Ln+e*.4:.1+e*.1))}}paintPixels(e){if(!this.pixels)return;this.pixels.group.setAttribute(`opacity`,`1`);let t=this.phase===`listening`&&!this.motion.matches;for(let[n,r]of this.pixels.columns.entries()){let i=this.pixelLevels[n]??0;if(t){let t=Math.sin(e/2400*Z-n*.55);i=Math.max(i,.18+.12*t)}let a=Math.min(4,Math.round(i*4*1.3));if(a!==this.pixelHeights[n]){this.pixelHeights[n]=a;for(let[e,t]of r.entries())t.setAttribute(`opacity`,Math.abs(e-4)<=a?`1`:`0`)}}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Wn(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Wn(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`,String(this.lineWidth())),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Z*(e-t*150)/900);return $(Ln,In+(1-In)*n,Wn(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-Wn(Q(n/150)),o=Vn(Q(i/.6)),s=Kn(!1)*kn*560,c=Xn(i,Nn,s),l=jn+Xn(i,Nn+Pn-jn,s),u=Ln+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`,$(this.lineWidth(),Math.max(2,this.lineWidth()),o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,jn,308-jn,a)),this.middle.setAttribute(`opacity`,(u*(1-Wn(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+Kn(!1)*t,i=Pn/kn,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Fn*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Z*.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-Fn)*a*n]])e.setAttribute(`d`,Yn({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=Hn(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+Kn(this.motion.matches)*n-Z*c/100,sweep:Z*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:Kn(!1)*650*(r-r*r/2),a=Vn(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Z,a)},Un(Q((n-600)/420)),Vn(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Wn(o);this.ripple.setAttribute(`r`,$(Rn,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`,(Rn*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`,Yn(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=qn(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 Kn(e){return Z/(e?3200:1800)}function qn(e){if(e<=jn)return{x:e,y:32,onLine:!0};if(e<Nn){let t=e-jn,n=0,r=Mn.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Mn.lengths[e]<t?n=e:r=e}let i=(t-Mn.lengths[n])/(Mn.lengths[r]-Mn.lengths[n]||1);return{x:$(Mn.points[n][0],Mn.points[r][0],i),y:$(Mn.points[n][1],Mn.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-Nn)/kn;return{x:154+kn*Math.cos(t),y:32+kn*Math.sin(t),onLine:!1}}function Jn(){let e=[[jn,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[jn+An*i,32-kn*(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 Yn(e){let t=Math.max(2,Math.ceil(80*e.sweep/Z)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+kn*Math.cos(i),o=32+kn*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Xn(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Zn(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 Qn=Dn,$n={light:{core:`#8b98a5`,above:`#cfd9de`,mid:`#aab8c2`,below:`#657786`},dark:{core:`#ffffff`,above:`#8b98a5`,mid:`#cfd9de`,below:`#536471`}};function er(e){let t=e.trim();return Object.hasOwn(wt,t)?t:`ocean`}var tr=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Gn(e,n),this.element=this.ribbon.element,this.glow=e.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render(),queueMicrotask(this.render);let r=c();if(r)for(let e of this.glow.querySelectorAll(`style`))e.nonce=r;this.themeObserver=new MutationObserver(this.render),this.themeObserver.observe(e.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),this.themeObserver.observe(e.body,{attributes:!0,attributeFilter:[`data-theme`]})}setLineStyle(e){this.ribbon.setLineStyle(e)}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=()=>{if(this.disposed)return;let e=getComputedStyle(this.prompt).getPropertyValue(`--seams-colors-voiceBeam`).trim();if(this.glow.hidden=e===`none`,this.glow.hidden){Se(null,this.glow);return}let t=(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,n=er(e);Se(I(Qn,{className:`seams-voiceid-beam`,theme:t,...n===`mono`?{bandColors:$n[t]}:{},level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:n,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const nr=`
|
|
296
296
|
.seams-voiceid-activation-surface { width: min(100%, 26.25rem); margin: 0 auto; background: transparent; }
|
|
297
297
|
/* Inside an operation's card the card is the frame: the prompt fills it edge to edge. */
|
|
298
298
|
.seams-voiceid-activation-surface.seams-voiceid-in-card { width: 100%; }
|
|
@@ -311,7 +311,9 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
311
311
|
margin: 0 auto;
|
|
312
312
|
padding: 3.5rem 1.5rem 1.5rem;
|
|
313
313
|
display: grid;
|
|
314
|
-
|
|
314
|
+
/* Named rows. The context row is empty (0 high) unless the card shows the text that its sentence
|
|
315
|
+
speaks for. A host that sets its own rows keeps these names. */
|
|
316
|
+
grid-template-rows: [context] auto [title] auto [phrase] minmax(6rem, auto) [line] 5rem [status] minmax(3.375rem, auto) [action] minmax(5rem, auto);
|
|
315
317
|
border: 1px solid var(--seams-colors-borderPrimary, #303b41);
|
|
316
318
|
border-radius: var(--seams-shape-card, 16px);
|
|
317
319
|
background: var(--seams-colors-colorBackground, #192024);
|
|
@@ -343,12 +345,14 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
343
345
|
}
|
|
344
346
|
/* A card that holds focus itself (until its first control is ready, or after a confirm). */
|
|
345
347
|
.seams-voiceid-prompt[tabindex="-1"]:focus { outline: none; }
|
|
346
|
-
/* Each line owns its row. The download overlays rows
|
|
347
|
-
|
|
348
|
-
.seams-voiceid-prompt > .seams-voiceid-
|
|
349
|
-
.seams-voiceid-prompt >
|
|
350
|
-
.seams-voiceid-prompt > .seams-voiceid-
|
|
351
|
-
.seams-voiceid-
|
|
348
|
+
/* Each line owns its row. The download overlays the rows line, status and action; an auto-placed
|
|
349
|
+
line would move to new rows. */
|
|
350
|
+
.seams-voiceid-prompt > .seams-voiceid-context { grid-row: context; grid-column: 1; }
|
|
351
|
+
.seams-voiceid-prompt > h2 { grid-row: title; grid-column: 1; }
|
|
352
|
+
.seams-voiceid-prompt > .seams-voiceid-phrase { grid-row: phrase; grid-column: 1; }
|
|
353
|
+
.seams-voiceid-prompt > .seams-voiceid-ribbon { grid-row: line; grid-column: 1; }
|
|
354
|
+
.seams-voiceid-prompt > .seams-voiceid-status { grid-row: status; grid-column: 1; }
|
|
355
|
+
.seams-voiceid-progress-slot { grid-row: action; grid-column: 1; min-width: 0; align-self: center; }
|
|
352
356
|
.seams-voiceid-progress-slot:empty { visibility: hidden; }
|
|
353
357
|
.seams-voiceid-activation-surface .seams-voiceid-record-slot { transition: opacity 200ms cubic-bezier(0.2, 0, 0, 1) 80ms, visibility 0s linear 0s; }
|
|
354
358
|
.seams-voiceid-activation-surface[data-preparation="loading"] .seams-voiceid-record-slot { opacity: 0; visibility: hidden; transition: none; }
|
|
@@ -555,6 +559,12 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
555
559
|
.seams-voiceid-ribbon .seams-voiceid-ribbon-echo[data-layer="2"] {
|
|
556
560
|
color: var(--seams-colors-voiceEchoDeep, var(--seams-colors-voiceEcho, var(--seams-colors-voiceLine, currentColor)));
|
|
557
561
|
}
|
|
562
|
+
/* The pixel style (voiceLine: 'pixels'): dots in X blue tones by default, the lightest in the
|
|
563
|
+
middle row. The theme colours the three bands: voiceEcho (the middle row), voiceLine (rows
|
|
564
|
+
1 and 2 from it) and voiceEchoDeep (rows 3 and 4). */
|
|
565
|
+
.seams-voiceid-ribbon-pixel { fill: var(--seams-colors-voiceEchoDeep, #1a6fb0); }
|
|
566
|
+
.seams-voiceid-ribbon-pixel[data-band="1"] { fill: var(--seams-colors-voiceLine, #1d9bf0); }
|
|
567
|
+
.seams-voiceid-ribbon-pixel[data-band="0"] { fill: var(--seams-colors-voiceEcho, #8ecdf8); }
|
|
558
568
|
.seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-success-headline {
|
|
559
569
|
display: grid;
|
|
560
570
|
align-content: end;
|
|
@@ -565,6 +575,7 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
565
575
|
.seams-voiceid-prompt .seams-voiceid-status.seams-voiceid-success-message { font-size: 0.8125rem; }
|
|
566
576
|
/* The glow is decorative and cannot intercept record, retry or cancel controls. */
|
|
567
577
|
.seams-voiceid-glow { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 0; }
|
|
578
|
+
.seams-voiceid-glow[hidden] { display: none; }
|
|
568
579
|
.seams-voiceid-beam { width: 100%; height: 100%; border-radius: inherit; }
|
|
569
580
|
.seams-voiceid-prompt > :not(.seams-voiceid-glow) { position: relative; z-index: 1; }
|
|
570
581
|
.seams-voiceid-prompt > .seams-voiceid-close { position: absolute; }
|
|
@@ -602,8 +613,10 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
602
613
|
right: auto;
|
|
603
614
|
left: 0.75rem;
|
|
604
615
|
}
|
|
616
|
+
/* Minimize sits beside Close, in the trailing corner: one button width and a small gap in. */
|
|
617
|
+
.seams-voiceid-prompt .seams-voiceid-close.seams-voiceid-minimize { right: 3.375rem; }
|
|
605
618
|
.seams-voiceid-prompt .seams-voiceid-record-slot {
|
|
606
|
-
grid-row:
|
|
619
|
+
grid-row: action;
|
|
607
620
|
grid-column: 1;
|
|
608
621
|
align-self: center;
|
|
609
622
|
width: 100%;
|
|
@@ -685,7 +698,7 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
685
698
|
.seams-voiceid-prompt:has(.seams-voiceid-model-download:not([data-state="ready"])) > .seams-voiceid-phrase { opacity: 0.35; }
|
|
686
699
|
.seams-voiceid-prompt:has(.seams-voiceid-model-download[data-state="failed"]) > .seams-voiceid-record-slot { display: none; }
|
|
687
700
|
.seams-voiceid-model-download progress {
|
|
688
|
-
grid-row:
|
|
701
|
+
grid-row: line;
|
|
689
702
|
justify-self: center;
|
|
690
703
|
appearance: none;
|
|
691
704
|
display: block;
|
|
@@ -703,7 +716,7 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
703
716
|
a looping animation would compete with it on a software-rendered page. */
|
|
704
717
|
.seams-voiceid-model-download progress::-moz-progress-bar { background: var(--seams-colors-textPrimary, #eff2f3); border-radius: 999px; }
|
|
705
718
|
.seams-voiceid-model-download p {
|
|
706
|
-
grid-row:
|
|
719
|
+
grid-row: status;
|
|
707
720
|
align-self: start;
|
|
708
721
|
margin: 0;
|
|
709
722
|
font-size: 0.75rem;
|
|
@@ -711,9 +724,9 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
711
724
|
color: var(--seams-colors-textSecondary, #9cabb3);
|
|
712
725
|
font-variant-numeric: tabular-nums;
|
|
713
726
|
}
|
|
714
|
-
.seams-voiceid-model-download button { grid-row:
|
|
727
|
+
.seams-voiceid-model-download button { grid-row: action; }
|
|
715
728
|
/* A phrase card shows its check and its result in the same card. */
|
|
716
|
-
.seams-voiceid-prompt > .seams-voiceid-status-line { grid-
|
|
729
|
+
.seams-voiceid-prompt > .seams-voiceid-status-line { grid-row: line; grid-column: 1; }
|
|
717
730
|
.seams-voiceid-status-line {
|
|
718
731
|
transition: opacity 120ms ease;
|
|
719
732
|
display: block;
|
|
@@ -723,7 +736,9 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
723
736
|
margin: auto;
|
|
724
737
|
overflow: visible;
|
|
725
738
|
opacity: 0;
|
|
726
|
-
|
|
739
|
+
/* The theme can colour the check's line and the seal that it closes into (the disc behind the
|
|
740
|
+
tick): voiceSeal, else the voice line's colour, else the card's text colour. */
|
|
741
|
+
color: var(--seams-colors-voiceSeal, var(--seams-colors-voiceLine, var(--seams-colors-textPrimary, #eff2f3)));
|
|
727
742
|
}
|
|
728
743
|
.seams-voiceid-ribbon { transition: opacity 120ms ease; }
|
|
729
744
|
.seams-voiceid-prompt[data-phrase-line="status"] > .seams-voiceid-ribbon { opacity: 0; }
|
|
@@ -763,17 +778,29 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
763
778
|
.seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-phrase-dim { color: var(--seams-colors-textMuted, #6f7f87); }
|
|
764
779
|
.seams-voiceid-prompt[data-phrase-view] > h2 { min-height: 1.19rem; }
|
|
765
780
|
.seams-voiceid-prompt[data-phrase-view="check"] {
|
|
766
|
-
grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
|
|
781
|
+
grid-template-rows: [context] auto [title] auto [phrase] minmax(6rem, auto) [line] 5rem [status] minmax(3.375rem, auto) [action] 0;
|
|
767
782
|
}
|
|
768
783
|
.seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-record-slot { display: none; }
|
|
769
784
|
/* A card that records by itself (autoStart) has no Record row: its rows sit in the middle. */
|
|
770
785
|
.seams-voiceid-prompt[data-auto-start] {
|
|
771
|
-
grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 0;
|
|
786
|
+
grid-template-rows: [context] auto [title] auto [phrase] minmax(6rem, auto) [line] 5rem [status] minmax(3.375rem, auto) [action] 0;
|
|
772
787
|
}
|
|
773
788
|
.seams-voiceid-prompt[data-auto-start] > .seams-voiceid-record-slot { display: none; }
|
|
789
|
+
/* The result reads from the top as one group: the seal, the headline under it, the caption and
|
|
790
|
+
the detail, then the button. Every row has its content's height, so the card has no empty
|
|
791
|
+
band, and the line row glides to its new place (phraseCard.ts transition). An empty label
|
|
792
|
+
takes no room. */
|
|
793
|
+
.seams-voiceid-prompt[data-phrase-view="result"] {
|
|
794
|
+
grid-template-rows: [context] auto [title] auto [line] 4.5rem [phrase] auto [status] auto [action] auto;
|
|
795
|
+
}
|
|
796
|
+
.seams-voiceid-prompt[data-phrase-view="result"] > h2:empty { display: none; }
|
|
797
|
+
.seams-voiceid-prompt[data-phrase-view="result"] > .seams-voiceid-phrase { margin-top: 0.5rem; }
|
|
798
|
+
.seams-voiceid-prompt[data-phrase-view="result"] > .seams-voiceid-status { min-height: 0; margin-top: 0.375rem; }
|
|
799
|
+
.seams-voiceid-prompt[data-phrase-view="result"] > .seams-voiceid-record-slot { margin-top: 1.5rem; }
|
|
774
800
|
.seams-voiceid-prompt[data-phrase-view] .seams-voiceid-microphone { display: none; }
|
|
775
801
|
.seams-voiceid-prompt .seams-voiceid-close { transition: opacity 150ms ease, visibility 0s linear 0s; }
|
|
776
|
-
|
|
802
|
+
/* The check hides Back and Close, as the caller works; Minimize stays. */
|
|
803
|
+
.seams-voiceid-prompt[data-phrase-view="check"] .seams-voiceid-close:not(.seams-voiceid-minimize) {
|
|
777
804
|
opacity: 0;
|
|
778
805
|
visibility: hidden;
|
|
779
806
|
transition: opacity 150ms ease, visibility 0s linear 150ms;
|
|
@@ -810,8 +837,215 @@ ${Oe.split(`{id}`).join(Ie)}`:tn}),q(`div`,{...Ne,ref:on,"data-voice-beam":Ie,"d
|
|
|
810
837
|
@media (prefers-reduced-motion: reduce) {
|
|
811
838
|
.seams-voiceid-status-line rect { animation: none !important; transition: none; }
|
|
812
839
|
}
|
|
840
|
+
/* The note layout: a card with a context, in the shape of a form. The context (a note) sits
|
|
841
|
+
in a soft box under its label, the sentence to read sits centred in a blue box under its own
|
|
842
|
+
label, and one button right under it changes with the card: Record or the voice line while
|
|
843
|
+
it records, the check, then the result's action. The status sits at the foot, under the
|
|
844
|
+
button. */
|
|
845
|
+
.seams-voiceid-prompt[data-context] {
|
|
846
|
+
grid-template-rows: [context] auto [title] auto [phrase] auto [line] 4.5rem [action] 0 [status] auto;
|
|
847
|
+
text-align: start;
|
|
848
|
+
/* The height of the button: 4.5rem as the voice line, with either line style, and 3.5rem as
|
|
849
|
+
Record or a result's action. The microphone's circle follows it. */
|
|
850
|
+
--seams-voiceid-button-height: 4.5rem;
|
|
851
|
+
/* The fill of what the person says: a tint of the main button's colour (voiceFill). */
|
|
852
|
+
--seams-voiceid-tint: 16%;
|
|
853
|
+
--seams-voiceid-fill: var(--seams-colors-voiceFill, color-mix(in srgb, var(--seams-colors-buttonBackground, #1d9bf0) var(--seams-voiceid-tint), var(--seams-colors-colorBackground, #192024)));
|
|
854
|
+
}
|
|
855
|
+
/* A form is as wide as an app's dialog for a note: 560 px. */
|
|
856
|
+
.seams-voiceid-activation-surface:has(> .seams-voiceid-prompt[data-context]),
|
|
857
|
+
.seams-voiceid-prompt[data-context] {
|
|
858
|
+
width: min(100%, 35rem);
|
|
859
|
+
}
|
|
860
|
+
[data-theme="light"] .seams-voiceid-prompt[data-context] { --seams-voiceid-tint: 14%; }
|
|
861
|
+
[data-theme="dark"] .seams-voiceid-prompt[data-context] { --seams-voiceid-tint: 24%; }
|
|
862
|
+
/* A button (Record, Try again, a result's action) takes the place of the voice line. */
|
|
863
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="check"]):has(> .seams-voiceid-record-slot > .seams-voiceid-primary:not([hidden])) {
|
|
864
|
+
--seams-voiceid-button-height: 3.5rem;
|
|
865
|
+
grid-template-rows: [context] auto [title] auto [phrase] auto [line] 0 [action] auto [status] auto;
|
|
866
|
+
}
|
|
867
|
+
/* A result's caption and detail read before its button. */
|
|
868
|
+
.seams-voiceid-prompt[data-context][data-phrase-view="result"]:not([data-phrase-view="check"]):has(> .seams-voiceid-record-slot > .seams-voiceid-primary:not([hidden])) {
|
|
869
|
+
grid-template-rows: [context] auto [title] auto [phrase] auto [status] auto [line] 0 [action] auto;
|
|
870
|
+
}
|
|
871
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="check"]):has(> .seams-voiceid-record-slot > .seams-voiceid-primary:not([hidden])) > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
872
|
+
visibility: hidden;
|
|
873
|
+
}
|
|
874
|
+
.seams-voiceid-prompt[data-context] > .seams-voiceid-glow { display: none; }
|
|
875
|
+
/* A line across the card under the context: above it is what the person posts, below it is
|
|
876
|
+
the voice signature. */
|
|
877
|
+
.seams-voiceid-prompt .seams-voiceid-context {
|
|
878
|
+
margin: 0 -1.5rem 1.25rem;
|
|
879
|
+
padding: 0 1.5rem 1.25rem;
|
|
880
|
+
border: 0;
|
|
881
|
+
border-bottom: 1px solid var(--seams-colors-borderPrimary, #303b41);
|
|
882
|
+
}
|
|
883
|
+
.seams-voiceid-prompt .seams-voiceid-context-label {
|
|
884
|
+
display: block;
|
|
885
|
+
margin-bottom: 0.375rem;
|
|
886
|
+
color: var(--seams-colors-textSecondary, #9cabb3);
|
|
887
|
+
font-size: 0.9375rem;
|
|
888
|
+
line-height: 1.3;
|
|
889
|
+
}
|
|
890
|
+
.seams-voiceid-prompt .seams-voiceid-context > blockquote {
|
|
891
|
+
max-height: 8.5rem;
|
|
892
|
+
margin: 0;
|
|
893
|
+
padding: 0.75rem 1rem;
|
|
894
|
+
overflow-y: auto;
|
|
895
|
+
border-radius: 1rem;
|
|
896
|
+
background: var(--seams-colors-surface, #202b31);
|
|
897
|
+
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
898
|
+
font-size: 1rem;
|
|
899
|
+
line-height: 1.45;
|
|
900
|
+
white-space: pre-line;
|
|
901
|
+
overflow-wrap: anywhere;
|
|
902
|
+
}
|
|
903
|
+
/* A result has no label: its empty title takes no room. */
|
|
904
|
+
.seams-voiceid-prompt[data-context] > h2:empty { display: none; }
|
|
905
|
+
.seams-voiceid-prompt[data-context] > h2 {
|
|
906
|
+
margin: 0 0 0.625rem;
|
|
907
|
+
color: var(--seams-colors-textPrimary, #eff2f3);
|
|
908
|
+
font-size: 1rem;
|
|
909
|
+
font-weight: 700;
|
|
910
|
+
line-height: 1.3;
|
|
911
|
+
text-align: center;
|
|
912
|
+
}
|
|
913
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-phrase {
|
|
914
|
+
box-sizing: border-box;
|
|
915
|
+
width: 100%;
|
|
916
|
+
max-width: none;
|
|
917
|
+
/* A thin gap to the button: the sentence and the voice belong together. */
|
|
918
|
+
margin: 0 0 0.5rem;
|
|
919
|
+
padding: 0.875rem 1.25rem;
|
|
920
|
+
border-radius: 1rem;
|
|
921
|
+
/* Blue, apart from the grey box of the context: this is what the person says. */
|
|
922
|
+
background: var(--seams-voiceid-fill);
|
|
923
|
+
font-size: 1.25rem;
|
|
924
|
+
font-weight: 600;
|
|
925
|
+
letter-spacing: normal;
|
|
926
|
+
line-height: 1.35;
|
|
927
|
+
text-align: center;
|
|
928
|
+
}
|
|
929
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-phrase.seams-voiceid-success-headline {
|
|
930
|
+
display: block;
|
|
931
|
+
padding: 0;
|
|
932
|
+
background: none;
|
|
933
|
+
font-size: 1.25rem;
|
|
934
|
+
font-weight: 700;
|
|
935
|
+
}
|
|
936
|
+
/* The status sits at the foot of the card, under the button: "Listening", or the check. */
|
|
937
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status {
|
|
938
|
+
min-height: 1.125rem;
|
|
939
|
+
margin: 0;
|
|
940
|
+
padding: 0.625rem 0 0;
|
|
941
|
+
text-align: center;
|
|
942
|
+
}
|
|
943
|
+
.seams-voiceid-prompt[data-context][data-phrase-view="result"] .seams-voiceid-status { padding: 0.25rem 0 0.75rem; }
|
|
944
|
+
/* Under the button, the check's caption and detail share one line at the size of "Listening",
|
|
945
|
+
so the card keeps its height when the check starts. A long line ends with an ellipsis. */
|
|
946
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="result"]) .seams-voiceid-status.seams-voiceid-two-lines {
|
|
947
|
+
overflow: hidden;
|
|
948
|
+
white-space: nowrap;
|
|
949
|
+
text-overflow: ellipsis;
|
|
950
|
+
}
|
|
951
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="result"]) .seams-voiceid-status.seams-voiceid-two-lines > span {
|
|
952
|
+
display: inline;
|
|
953
|
+
}
|
|
954
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="result"]) .seams-voiceid-status .seams-voiceid-caption {
|
|
955
|
+
margin: 0;
|
|
956
|
+
font-size: inherit;
|
|
957
|
+
}
|
|
958
|
+
.seams-voiceid-prompt[data-context]:not([data-phrase-view="result"]) .seams-voiceid-status .seams-voiceid-caption-detail:not(:empty)::before {
|
|
959
|
+
content: ' · ';
|
|
960
|
+
}
|
|
961
|
+
/* A result's link, such as the transaction in a block explorer: short, in the main button's
|
|
962
|
+
colour, underlined only on hover. */
|
|
963
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status a {
|
|
964
|
+
color: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
965
|
+
font-weight: 500;
|
|
966
|
+
text-decoration: none;
|
|
967
|
+
}
|
|
968
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status a:hover,
|
|
969
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status a:focus-visible { text-decoration: underline; }
|
|
970
|
+
/* The voice line and the check, in the main button's colours, with either line style. The line
|
|
971
|
+
keeps its drawing size; the taller button gives it room above and below. */
|
|
972
|
+
.seams-voiceid-prompt[data-context] > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
973
|
+
box-sizing: border-box;
|
|
974
|
+
width: 100%;
|
|
975
|
+
height: 4.5rem;
|
|
976
|
+
padding-block: 0.5rem;
|
|
977
|
+
overflow: hidden;
|
|
978
|
+
border-radius: 9999px;
|
|
979
|
+
background: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
980
|
+
color: var(--seams-colors-textButton, var(--seams-colors-colorBackground, #192024));
|
|
981
|
+
}
|
|
982
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-ribbon .seams-voiceid-ribbon-echo { color: currentColor; }
|
|
983
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status-line rect {
|
|
984
|
+
fill: color-mix(in srgb, currentColor 35%, transparent);
|
|
985
|
+
}
|
|
986
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status-line rect[data-state="done"],
|
|
987
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status-line rect[data-state="run"] { fill: currentColor; }
|
|
988
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-status-check {
|
|
989
|
+
stroke: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
990
|
+
}
|
|
991
|
+
.seams-voiceid-prompt[data-context][data-voice-line="pixels"] {
|
|
992
|
+
--seams-voiceid-pixel-background: var(--seams-colors-voicePixelBackground, var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3)));
|
|
993
|
+
--seams-voiceid-pixel-ink: var(--seams-colors-textButton, var(--seams-colors-colorBackground, #192024));
|
|
994
|
+
}
|
|
995
|
+
.seams-voiceid-prompt[data-context][data-voice-line="pixels"] > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
996
|
+
background: var(--seams-voiceid-pixel-background);
|
|
997
|
+
color: var(--seams-voiceid-pixel-ink);
|
|
998
|
+
}
|
|
999
|
+
.seams-voiceid-prompt[data-context][data-voice-line="pixels"] .seams-voiceid-status-check {
|
|
1000
|
+
stroke: var(--seams-voiceid-pixel-background);
|
|
1001
|
+
}
|
|
1002
|
+
/* On the button, the dots are the button's text colour: full in the middle row, then mixed a
|
|
1003
|
+
little and more with the button's colour (white, light and light blue on X blue). */
|
|
1004
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-ribbon-pixel[data-band="0"] { fill: var(--seams-voiceid-pixel-ink); }
|
|
1005
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-ribbon-pixel[data-band="1"] {
|
|
1006
|
+
fill: color-mix(in srgb, var(--seams-voiceid-pixel-ink) 80%, var(--seams-voiceid-pixel-background));
|
|
1007
|
+
}
|
|
1008
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-ribbon-pixel[data-band="2"] {
|
|
1009
|
+
fill: color-mix(in srgb, var(--seams-voiceid-pixel-ink) 55%, var(--seams-voiceid-pixel-background));
|
|
1010
|
+
}
|
|
1011
|
+
/* The microphone at the left of the button, as on an app's own voice button: on Record, on the
|
|
1012
|
+
voice line while the card records, and on the check. A result's button has none. Its circle
|
|
1013
|
+
keeps the same gap to the button's top, left and bottom, so it follows the button's round end.
|
|
1014
|
+
The line leaves the icon its room. */
|
|
1015
|
+
.seams-voiceid-prompt[data-context] > .seams-voiceid-line-icon {
|
|
1016
|
+
--seams-voiceid-icon-gap: 0.375rem;
|
|
1017
|
+
grid-row: line / span 2;
|
|
1018
|
+
grid-column: 1;
|
|
1019
|
+
align-self: center;
|
|
1020
|
+
justify-self: start;
|
|
1021
|
+
z-index: 2;
|
|
1022
|
+
display: grid;
|
|
1023
|
+
place-items: center;
|
|
1024
|
+
width: calc(var(--seams-voiceid-button-height) - 2 * var(--seams-voiceid-icon-gap));
|
|
1025
|
+
height: calc(var(--seams-voiceid-button-height) - 2 * var(--seams-voiceid-icon-gap));
|
|
1026
|
+
margin-inline-start: var(--seams-voiceid-icon-gap);
|
|
1027
|
+
border-radius: 50%;
|
|
1028
|
+
transition: width 180ms ease, height 180ms ease;
|
|
1029
|
+
background: var(--seams-colors-textButton, var(--seams-colors-colorBackground, #192024));
|
|
1030
|
+
color: var(--seams-colors-buttonBackground, var(--seams-colors-textPrimary, #eff2f3));
|
|
1031
|
+
pointer-events: none;
|
|
1032
|
+
}
|
|
1033
|
+
.seams-voiceid-line-icon > svg { width: 46%; height: 46%; }
|
|
1034
|
+
.seams-voiceid-prompt[data-context][data-phrase-view="result"] > .seams-voiceid-line-icon { display: none; }
|
|
1035
|
+
.seams-voiceid-prompt[data-context] > :is(.seams-voiceid-ribbon, .seams-voiceid-status-line) {
|
|
1036
|
+
box-sizing: border-box;
|
|
1037
|
+
padding-inline: calc(var(--seams-voiceid-button-height) + 0.25rem) 1rem;
|
|
1038
|
+
}
|
|
1039
|
+
/* The status line's own space below it is the gap above the button, in every view. */
|
|
1040
|
+
.seams-voiceid-prompt[data-context] > .seams-voiceid-record-slot { margin-top: 0; }
|
|
1041
|
+
.seams-voiceid-prompt[data-context] .seams-voiceid-primary {
|
|
1042
|
+
min-height: 3.5rem;
|
|
1043
|
+
border-radius: 9999px;
|
|
1044
|
+
font-size: 1.0625rem;
|
|
1045
|
+
font-weight: 700;
|
|
1046
|
+
}
|
|
813
1047
|
@media (hover: hover) and (pointer: fine) {
|
|
814
1048
|
.seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
|
|
815
1049
|
.seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
|
|
816
1050
|
}
|
|
817
|
-
`,tr=new WeakSet;function nr(e){if(tr.has(e))return;tr.add(e);try{let t=new CSSStyleSheet;t.replaceSync(er),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=er,(e.head??e.documentElement).appendChild(t)}var rr=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,nr(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 $n(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=Cr(e,`Cancel`,xr),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let a=e.createElement(`div`);a.className=`seams-voiceid-record-slot`,this.actionRow=a,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),a.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,a,this.progress),this.sizes.observe(this.element)}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Cr(this.element.ownerDocument,`Back`,Sr);return e.classList.add(`seams-voiceid-back`),this.cancel.before(e),e}return this.cancel.classList.add(`seams-voiceid-back`),this.cancel.setAttribute(`aria-label`,`Back`),this.cancel.querySelector(`path`)?.setAttribute(`d`,Sr),this.cancel}change(e){return this.pendingChange=pr(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&&!fr()){if(await Promise.all(n.map(gr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=pr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),_r(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<dr){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,_r(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`)||_r(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 lr(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(yr))}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 o(),!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(sr)),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`,cr(t,a,ar-ir+e*or)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const ir=150,ar=450,or=40;function sr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function cr(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 lr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const ur=`seams-voiceid-row`,dr=800;function fr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function pr(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(mr)}}function mr(e){e()}function hr(e){for(let t of e.getAnimations())t.id===ur&&t.cancel()}function gr(e){let t=Number(getComputedStyle(e).opacity);return hr(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:ur}).finished.catch(vr)}function _r(e){let t=fr();for(let[n,r]of e.entries()){hr(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:20+n*30,duration:t?150:200,easing:l,fill:`backwards`,id:ur})}}function vr(){}function yr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:200*(1-t),easing:l,id:ur})}function br(e){if(!e.isConnected||fr()){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(vr).finally(()=>e.remove())}const xr=`M6 6l12 12M18 6L6 18`,Sr=`m15 18-6-6 6-6`;function Cr(e,t,n){let r=e.createElement(`button`);r.type=`button`,r.className=`seams-voiceid-close`,r.setAttribute(`aria-label`,t);let i=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);i.setAttribute(`viewBox`,`0 0 24 24`),i.setAttribute(`width`,`20`),i.setAttribute(`height`,`20`),i.setAttribute(`aria-hidden`,`true`);let a=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return a.setAttribute(`d`,n),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`stroke-width`,`1.75`),a.setAttribute(`stroke-linecap`,`round`),i.append(a),r.append(i),r}const wr=`Say this with your voice`,Tr=`Say this sentence`,Er=`Read it naturally, then pause.`;function Dr(e){return new Or(e)}var Or=class{element;prompt;card;unmounted;outer;detector;pressed;back;recorder=null;recording=null;choice=null;view=null;started=!1;closed=!1;autoStart;expectedSpeechMs;speechDetectorReady=!1;constructor(e){let{sentence:n,frame:r={}}=e,i=e.signal;this.outer=i,this.detector=e.detector,this.autoStart=e.autoStart===!0,this.expectedSpeechMs=t(n);let a=document.querySelector(`.seams-voiceid-activation-surface[data-seams-voiceid-handoff]`);e.detector===`level`?this.speechDetectorReady=!0:s.prepare().then(this.detectorStarted,kr);let o=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`,wr),this.prompt=new rr(document,wr,n),this.prompt.title.textContent=Tr;let c=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=c,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=Er,this.prompt.record.textContent=`Record`;let l=r.controls??`close`;this.pressed=r.pressed;let u=l===`close`?null:this.prompt.showBack(l===`back_and_close`);this.back=u===this.prompt.cancel?null:u;let d=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,f=d?Ar(d):null;d&&(this.prompt.continueFrom(d),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new m(this.prompt,{label:Tr,sentence:c,message:Er,action:`Record`},f),this.autoStart&&(this.prompt.record.hidden=!0,this.prompt.element.dataset.autoStart=``,this.prompt.element.tabIndex=-1),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press);let p=l===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,p),this.back?.addEventListener(`click`,this.pressBack),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),f||this.autoStart?this.prompt.element.focus({preventScroll:!0}):this.prompt.record.focus(),i.aborted&&this.cancel()}record(){if(this.closed)return Promise.resolve({kind:`cancelled`});this.settleChoice(`replaced`),this.recording?.resolve({kind:`cancelled`});let e=jr();return this.recording=e,this.view?(this.view=null,this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){return delete this.prompt.element.dataset.autoStart,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.pressBack),this.prompt.cancel.removeEventListener(`click`,this.pressClose),this.back?.removeEventListener(`click`,this.pressBack),this.card.dispose(),this.prompt.dispose(),br(this.element))}press=()=>{if(this.view){this.view.kind===`result`&&!this.view.action.busy&&this.settleChoice(`action`);return}!this.recording||this.started||this.begin(this.recording)};begin(t){this.started=!0,this.prompt.record.disabled=!0,this.prompt.status.textContent=this.speechDetectorReady?`Opening microphone…`:`Loading ${e().label}…`,this.attempt(t,this.autoStart)}async attempt(e,t=!1){let o=new AbortController;this.recorder=o;try{let t=await i(o.signal,this.capture,{expectedSpeechMs:this.expectedSpeechMs,detector:this.detector});if(this.recording!==e||this.closed){t.samples?.fill(0);return}if(t.kind===`insufficient_audio`){this.retry(r(t.quality));return}let n=t.lastSoundAtMs??performance.now();this.started=!1,this.recording=null,e.resolve({kind:`recorded`,samples:t.samples,endOfSpeechAt:n})}catch(r){if(this.recording!==e||this.closed)return;if(r instanceof a){this.retry(r.message);return}if(t&&r instanceof n){this.retry(Er,`Record`);return}this.started=!1,this.recording=null,e.reject(r instanceof Error?r:Error(String(r)))}}detectorStarted=()=>{this.speechDetectorReady=!0};capture=e=>{e.kind===`processing`?this.card.beginCheck():this.prompt.capture(e)};retry(e,t=`Try again`){this.started=!1,delete this.prompt.element.dataset.autoStart,this.prompt.record.textContent=t,this.prompt.ready(e),this.prompt.record.focus()}settleChoice(e){let t=this.choice;this.choice=null,t?.(e)}pressBack=()=>this.pressControl(`back`);pressClose=()=>this.pressControl(`close`);pressControl(e){this.view?.kind!==`check`&&(this.pressed?.(e),this.cancel())}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 kr(){}function Ar(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function jr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{m as PhraseCard,rr as VoicePrompt,Un as VoiceRibbon,$n as VoiceVisual,br as leaveSurface,Dr as openPhraseCard};
|
|
1051
|
+
`,rr=new WeakSet;function ir(e){if(rr.has(e))return;rr.add(e);try{let t=new CSSStyleSheet;t.replaceSync(nr),e.adoptedStyleSheets=[...e.adoptedStyleSheets,t];return}catch{}let t=e.createElement(`style`),n=c();n&&t.setAttribute(`nonce`,n),t.textContent=nr,(e.head??e.documentElement).appendChild(t)}var ar=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,ir(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 tr(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=Or(e,`Cancel`,Cr),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let a=e.createElement(`div`);a.className=`seams-voiceid-record-slot`,this.actionRow=a,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),a.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,a,this.progress),this.sizes.observe(this.element)}useVoiceLine(e){this.element.dataset.voiceLine=e,this.visual.setLineStyle(e)}showContext(e,t){let n=this.element.ownerDocument,r=n.createElement(`figure`);r.className=`seams-voiceid-context`;let i=n.createElement(`figcaption`);i.className=`seams-voiceid-context-label`,i.textContent=e;let a=n.createElement(`blockquote`);a.textContent=t,r.append(i,a),this.title.before(r),this.element.append(Dr(n)),this.element.dataset.context=``}showBack(e){if(e){this.cancel.setAttribute(`aria-label`,`Close`);let e=Or(this.element.ownerDocument,`Back`,wr);return e.classList.add(`seams-voiceid-back`),this.cancel.before(e),e}return this.cancel.classList.add(`seams-voiceid-back`),this.cancel.setAttribute(`aria-label`,`Back`),this.cancel.querySelector(`path`)?.setAttribute(`d`,wr),this.cancel}showMinimize(){let e=Or(this.element.ownerDocument,`Minimize`,Tr);return e.classList.add(`seams-voiceid-minimize`),this.cancel.before(e),e}change(e){return this.pendingChange=hr(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&&!mr()){if(await Promise.all(n.map(vr)),e=this.rowOrder([...e,...n]),this.pendingChange){this.pendingChange=hr(t,this.pendingChange);continue}}else e=this.rowOrder([...e,...n]);if(this.disposed)return;this.writeChange(t),yr(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<pr){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,yr(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`)||yr(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 dr(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(xr))}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 o(),!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(lr)),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`,ur(t,a,sr-or+e*cr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const or=150,sr=450,cr=40;function lr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function ur(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 dr(e){throw Error(`Unexpected capture event: ${String(e)}`)}const fr=`seams-voiceid-row`,pr=800;function mr(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}function hr(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(gr)}}function gr(e){e()}function _r(e){for(let t of e.getAnimations())t.id===fr&&t.cancel()}function vr(e){let t=Number(getComputedStyle(e).opacity);return _r(e),e.animate([{opacity:t},{opacity:0}],{duration:150*t,easing:`ease-in`,fill:`forwards`,id:fr}).finished.catch(br)}function yr(e){let t=mr();for(let[n,r]of e.entries()){_r(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:0+n*20,duration:t?150:140,easing:l,fill:`backwards`,id:fr})}}function br(){}function xr({row:e,opacity:t}){e.animate([{opacity:t},{opacity:1}],{duration:140*(1-t),easing:l,id:fr})}function Sr(e){if(!e.isConnected||mr()){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(br).finally(()=>e.remove())}const Cr=`M6 6l12 12M18 6L6 18`,wr=`m15 18-6-6 6-6`,Tr=`M6 12h12`,Er=[`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0z`,`M5 10a7 7 0 0 0 14 0`,`M8 21h8`,`M12 17v4`];function Dr(e){let t=e.createElement(`span`);t.className=`seams-voiceid-line-icon`,t.setAttribute(`aria-hidden`,`true`);let n=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`);for(let t of Er){let r=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);r.setAttribute(`d`,t),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`1.8`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),n.append(r)}return t.append(n),t}function Or(e,t,n){let r=e.createElement(`button`);r.type=`button`,r.className=`seams-voiceid-close`,r.setAttribute(`aria-label`,t);let i=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);i.setAttribute(`viewBox`,`0 0 24 24`),i.setAttribute(`width`,`20`),i.setAttribute(`height`,`20`),i.setAttribute(`aria-hidden`,`true`);let a=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);return a.setAttribute(`d`,n),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`stroke-width`,`1.75`),a.setAttribute(`stroke-linecap`,`round`),i.append(a),r.append(i),r}const kr=`Say this with your voice`,Ar=[`colorBackground`,`textPrimary`,`textSecondary`,`textMuted`,`borderPrimary`,`surface`,`surface3`,`buttonBackground`,`textButton`,`error`,`info`,`voiceLine`,`voiceEcho`,`voiceEchoDeep`,`voiceFill`,`voicePixelBackground`];function jr(e){return new Mr(e)}var Mr=class{element;prompt;card;unmounted;outer;detector;pressed;back;minimize;minimizedHook;progressedHook;minimized=!1;progress=``;recorder=null;recording=null;choice=null;view=null;started=!1;closed=!1;autoStart;expectedSpeechMs;speechDetectorReady=!1;constructor(e){let{sentence:n,frame:r={}}=e,i=e.signal;this.outer=i,this.detector=e.detector,this.autoStart=e.autoStart===!0,this.expectedSpeechMs=t(n);let a=document.querySelector(`.seams-voiceid-activation-surface[data-seams-voiceid-handoff]`);e.detector===`level`?this.speechDetectorReady=!0:s.prepare().then(this.detectorStarted,Fr);let o=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`,kr),Nr(this.element,e.colors),this.prompt=new ar(document,kr,n);let c=e.context?.sentenceLabel??`Say this sentence`;this.prompt.title.textContent=c;let l=/[.!?]$/.test(n)?n:`${n}.`;this.prompt.phrase.textContent=l,delete this.prompt.phrase.dataset.voiceidPhrase,this.prompt.status.textContent=``,this.prompt.record.textContent=`Record`;let u=r.controls??`close`;this.pressed=r.pressed;let d=u===`close`?null:this.prompt.showBack(u===`back_and_close`);e.context&&this.prompt.showContext(e.context.label,e.context.text),this.back=d===this.prompt.cancel?null:d,this.minimizedHook=r.minimized,this.progressedHook=r.progressed,this.minimize=r.minimized?this.prompt.showMinimize():null;let f=a?.querySelector(`:scope > .seams-voiceid-prompt`)??null,p=f?Ir(f):null;f&&(this.prompt.continueFrom(f),this.prompt.record.hidden=!0,this.autoStart=!1),this.card=new m(this.prompt,{label:c,sentence:l,message:``,action:`Record`},p),this.autoStart&&(this.prompt.record.hidden=!0,this.prompt.element.dataset.autoStart=``,this.prompt.element.tabIndex=-1),this.element.append(this.prompt.element),this.prompt.record.addEventListener(`click`,this.press);let h=u===`back`?this.pressBack:this.pressClose;this.prompt.cancel.addEventListener(`click`,h),this.back?.addEventListener(`click`,this.pressBack),this.minimize?.addEventListener(`click`,this.pressMinimize),this.element.addEventListener(`cancel`,this.cancel),i.addEventListener(`abort`,this.cancel),a?a.replaceWith(this.element):o.appendChild(this.element);let g=e.voiceLine??Pr(this.prompt.element);g===`pixels`&&this.prompt.useVoiceLine(g),r.hugged&&this.element.classList.add(`seams-voiceid-hugged`),this.unmounted=r.mounted?.(this.element),p||this.autoStart?this.prompt.element.focus({preventScroll:!0}):this.prompt.record.focus(),i.aborted&&this.cancel()}record(){if(this.closed)return Promise.resolve({kind:`cancelled`});this.settleChoice(`replaced`),this.recording?.resolve({kind:`cancelled`});let e=Lr();return this.recording=e,this.view?(this.view=null,this.report({stage:`recording`,done:0,total:0}),this.card.showPrompt()):this.autoStart&&this.begin(e),this.autoStart=!1,e.promise}show(e){if(delete this.prompt.element.dataset.autoStart,this.closed)return Promise.resolve(`closed`);if(this.settleChoice(`replaced`),this.view=e,e.kind===`check`){let t=e.segments.filter(e=>e===`done`||e===`skip`).length;this.report({stage:`checking`,done:t,total:e.segments.length})}else this.report({stage:`result`,done:0,total:0}),this.needPerson();return 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.pressBack),this.prompt.cancel.removeEventListener(`click`,this.pressClose),this.back?.removeEventListener(`click`,this.pressBack),this.minimize?.removeEventListener(`click`,this.pressMinimize),this.card.dispose(),this.prompt.dispose(),Sr(this.element))}press=()=>{if(this.view){this.view.kind===`result`&&!this.view.action.busy&&this.settleChoice(`action`);return}!this.recording||this.started||this.begin(this.recording)};begin(t){this.started=!0,this.report({stage:`recording`,done:0,total:0}),this.prompt.record.disabled=!0,this.prompt.status.textContent=this.speechDetectorReady?`Opening microphone…`:`Loading ${e().label}…`,this.attempt(t,this.autoStart)}async attempt(e,t=!1){let o=new AbortController;this.recorder=o;try{let t=await i(o.signal,this.capture,{expectedSpeechMs:this.expectedSpeechMs,detector:this.detector});if(this.recording!==e||this.closed){t.samples?.fill(0);return}if(t.kind===`insufficient_audio`){this.retry(r(t.quality));return}let n=t.lastSoundAtMs??performance.now();this.started=!1,this.recording=null,e.resolve({kind:`recorded`,samples:t.samples,endOfSpeechAt:n})}catch(r){if(this.recording!==e||this.closed)return;if(r instanceof a){this.retry(r.message);return}if(t&&r instanceof n){this.retry(``,`Record`);return}this.started=!1,this.recording=null,e.reject(r instanceof Error?r:Error(String(r)))}}detectorStarted=()=>{this.speechDetectorReady=!0};capture=e=>{e.kind===`processing`?(this.report({stage:`checking`,done:0,total:0}),this.card.beginCheck()):this.prompt.capture(e)};retry(e,t=`Try again`){this.started=!1,delete this.prompt.element.dataset.autoStart,this.prompt.record.textContent=t,this.prompt.ready(e),this.prompt.record.focus(),this.report({stage:`recording`,done:0,total:0}),this.needPerson()}report(e){let t=`${e.stage}:${e.done}:${e.total}`;t===this.progress||this.closed||(this.progress=t,this.progressedHook?.(e))}pressMinimize=()=>{this.closed||(this.minimized=!0,this.minimizedHook?.(!0))};needPerson(){this.minimized&&(this.minimized=!1,this.minimizedHook?.(!1))}settleChoice(e){let t=this.choice;this.choice=null,t?.(e)}pressBack=()=>this.pressControl(`back`);pressClose=()=>this.pressControl(`close`);pressControl(e){this.view?.kind!==`check`&&(this.pressed?.(e),this.cancel())}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 Nr(e,t){if(t)for(let n of Ar){let r=t[n];r&&e.style.setProperty(`--seams-colors-${n}`,r)}}function Pr(e){return getComputedStyle(e).getPropertyValue(`--seams-shape-voiceLine`).trim()===`pixels`?`pixels`:`wave`}function Fr(){}function Ir(e){let t=t=>e.querySelector(`:scope > ${t}`)?.textContent??``;return{label:t(`h2`),message:t(`.seams-voiceid-status`)}}function Lr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}export{m as PhraseCard,ar as VoicePrompt,Gn as VoiceRibbon,tr as VoiceVisual,Sr as leaveSurface,jr as openPhraseCard};
|