@seams/voiceid 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,606 +0,0 @@
1
- import{WorkerDeferred as e,createCspStylesheetManager as t,getDefaultCspNonce as n}from"../voiceid-host.js";var r=class extends Error{constructor(e){super(e.noise===`high`?`Your voice did not match. Background noise is high. Move closer and try again.`:`Your voice did not match. Read the next sentence naturally and try again.`),this.name=`VoiceSpeakerMismatchError`}};async function i(){try{return await caches.open(`seams-voiceid-models-v1`)}catch{return null}}var a=class{pending=null;progress={kind:`checking_cache`};listeners=new Set;constructor(e){this.asset=e}get size(){return this.asset.bytes}async download(e){e&&(this.listeners.add(e),e(this.progress));try{this.pending||=this.bytes().catch(this.failed);let e=await this.pending;return this.publish({kind:`ready`}),e}finally{e&&this.listeners.delete(e)}}failed=e=>{throw this.pending=null,this.progress={kind:`checking_cache`},e};publish(e){this.progress=e;for(let t of this.listeners)t(e)}async valid(e){if(e.byteLength!==this.asset.bytes)return!1;let t=new Uint8Array(await crypto.subtle.digest(`SHA-256`,e)),n=``;for(let e of t)n+=e.toString(16).padStart(2,`0`);return n===this.asset.sha256}async bytes(){let{label:e,path:t,sha256:n}=this.asset;this.publish({kind:`checking_cache`});let r=await i(),a=new URL(`${t}?sha256=${n}`,location.origin).href;try{let e=await r?.match(a);if(e){let t=await e.arrayBuffer();if(await this.valid(t))return t;await r?.delete(a)}}catch{}this.publish({kind:`downloading`,received:0});let o=await fetch(t,{credentials:`omit`,cache:`force-cache`});if(!o.ok||!o.body)throw Error(`${e} is unavailable from this Wallet.`);let s=o.body.getReader(),c=new Uint8Array(this.asset.bytes),l=0;try{for(;;){let t=await s.read();if(t.done)break;if(l+t.value.length>c.length)throw Error(`${e} size is invalid.`);c.set(t.value,l),l+=t.value.length,this.publish({kind:`downloading`,received:l})}}finally{await s.cancel(),s.releaseLock()}if(!await this.valid(c.buffer))throw Error(`${e} integrity check failed.`);if(r)try{await r.put(a,new Response(c,{headers:{"Content-Type":`application/octet-stream`}}))}catch{}return c.buffer}};const o=new a({path:`/sdk/voiceid/ort-wasm-simd-threaded.wasm`,sha256:`3398c10d07d229bd91b364548e130e0e51a8e5704b88c7c083ebbeb78842dee2`,bytes:14239897,label:`VoiceID engine`});var s=class{asset;session=null;constructor(e){this.asset=new a(e)}prepare(){return this.session||=this.load().catch(this.failed),this.session}failed=e=>{throw this.session=null,e};async load(){let e=await import(`./ort.wasm.bundle.min-7y-hlRN8.js`);e.env.wasm.numThreads=1,e.env.wasm.wasmPaths=new URL(`/sdk/voiceid/`,location.origin).href,e.env.wasm.wasmBinary=await o.download();let t=await this.asset.download();return await e.InferenceSession.create(t,{executionProviders:[`wasm`]})}};const c=`please sign this trade now.confirm my order for today.i review every order carefully.dump on them slowly.send this order to market.i'm here for the tech.keep this trade on track.the order book looks busy.if you panic panic early.i check the latest quote.exit liquidity for all passengers.no crying in the casino.this trade fits my plan.approve this transfer at once.check the price before trading.let this trade go through.be retarded when others are fearful.be fearful when others are retarded.life is short go long to hedge.but they won't trap me.approve the swap before market close.approve the swap when prices settle.approve the swap after market opens.check my order before market close.check my order when prices settle.check my order after market opens.confirm the trade before market close.confirm the trade when prices settle.confirm the trade after market opens.review this transfer before market close.review this transfer when prices settle.review this transfer after market opens`.split(`.`),l={sale:[`approve this sale at once`,`let the sale go through`],purchase:[`this purchase has my approval`,`please confirm my purchase`],swap:[`confirm my swap today`,`the swap is ready to proceed`],transfer:[`confirm this transfer today`,`please send this transfer now`]},u=[...c,...l.sale,...l.purchase,...l.swap,...l.transfer],d=`.<unk>.▁t.he.▁a.▁the.in.▁s.▁w.▁o.re.nd.▁b.▁h.er.▁m.▁i.ou.▁c.▁f.at.ed.▁and.en.▁to.▁of.on.is.▁d.ing.▁th.▁p.▁he.or.▁l.es.▁in.ll.it.ar.as.an.▁n.▁g.om.▁be.▁ha.▁e.le.ot.▁y.ut.ow.ic.▁wh.▁it.ld.ve.▁that.ly.▁was.id.se.st.▁on.gh.ent.▁re.▁you.im.ce.▁u.ver.ion.▁as.et.▁for.ay.▁we.▁his.ith.al.ir.▁r.▁with.▁st.ad.ur.ght.▁an.▁her.▁not.▁had.▁is.ter.her.ac.am.▁at.oo.▁but.ould.▁she.▁k.▁se.▁sa.▁sh.▁fr.▁him.▁so.ill.▁me.ain.▁su.ight.ch.red.ct.all.ro.ke.ess.il.ore.▁de.▁they.▁my.▁whe.▁all.ich.▁ne.ri.▁by.▁have.ome.pp.▁this.▁li.▁do.▁con.us.▁which.▁ch.ul.qu.▁j.▁up.▁said.▁from.ard.ge.▁or.▁v.▁one.th.▁no.▁ex.▁were.▁there.pe.and.est.▁man.▁who.ble.ant.ie.▁al.res.ous.ust.very.ation.▁fe.▁them.lf.▁when.ind.nt.ame.ra.▁go.ers.ast.fe.ood.▁kn.▁int.ist.art.▁are.out.▁would.▁le.os.▁their.ong.▁what.our.▁if.ound.▁com.▁ab.▁out.▁wor.em.▁will.ak.▁mis.ate.ol.um.un.itt.ough.ked.ap.ig.one.▁been.own.ive.▁then.▁br.ven.if.▁ar.▁tr.self.▁.e.t.a.o.n.i.h.s.r.d.l.u.m.c.w.f.g.y.p.b.v.k.'.x.j.q.z`.split(`.`),f=new s({path:`/sdk/voiceid/aurora-int8.onnx`,sha256:`83ed6f3856458cd96d49a70d8c5175aeec18ba8c184e5367e089cd424eebefd6`,bytes:1342384,label:`Phrase recognition`});let p=null;function m(e){return _(c,e)}function h(e,t){switch(e.kind){case`random`:return m(t);case`action`:return _(l[e.action],t);default:return g(e)}}function g(e){throw Error(`Unexpected voice confirmation: ${String(e)}`)}function _(e,t){let n=e.filter(v.bind(null,t)),r=n.filter(v.bind(null,p)),i=r.length>0?r:n;if(i.length===0)throw Error(`No fresh VoiceID challenge is available.`);let a=new Uint32Array(1);crypto.getRandomValues(a);let o=i[a[0]%i.length];return p=o,o}function v(e,t){return t!==e}const y=new Map([[`sea`,`see`],[`here`,`hear`],[`meat`,`meet`],[`whether`,`weather`],[`son`,`sun`],[`wood`,`would`],[`two`,`to`],[`too`,`to`],[`eye`,`i`]]),b=new Set([`no`,`not`,`never`,`cannot`,`can't`,`don't`,`doesn't`,`isn't`,`aren't`,`wasn't`,`weren't`,`won't`,`wouldn't`,`shouldn't`,`without`]);function x(e){return e.toLowerCase().replace(/’/g,`'`).match(/[a-z0-9]+(?:'[a-z]+)?/g)??[]}function S(e){return e!==`a`&&e!==`an`&&e!==`the`}function C(e){return y.get(e)??e}function w(e){return e.filter(S).map(C).join(` `)}function T(e){return b.has(e)}function E(e,t){let n=Array.from({length:t.length+1},ee);for(let r=0;r<e.length;r+=1){let i=[r+1];for(let a=0;a<t.length;a+=1)i.push(Math.min(i[a]+1,n[a+1]+1,n[a]+(e[r]===t[a]?0:1)));n=i}return n[t.length]}function ee(e,t){return t}function te(e){let t=x(e),n=w(t);if(!n)return{kind:`empty`};let r=u[0],i=1/0,a=1/0;for(let e of u){let t=w(x(e)),o=E(n,t)/Math.max(n.length,t.length);o<i?(a=i,i=o,r=e):a=Math.min(a,o)}let o=a-i;if(t.filter(T).join(` `)!==x(r).filter(T).join(` `))return{kind:`uncertain`,candidate:r,difference:i,margin:o,decodedText:e,reason:`negated`};let s=x(r).length;return i>.3||Math.abs(t.length-s)>2?{kind:`uncertain`,candidate:r,difference:i,margin:o,decodedText:e,reason:`different`}:o<.1?{kind:`uncertain`,candidate:r,difference:i,margin:o,decodedText:e,reason:`ambiguous`}:{kind:`recognized`,phrase:r,difference:i,margin:o,decodedText:e}}var D=class extends Error{constructor(){super(`The phrase was not clear. Try the new phrase at your normal pace.`),this.name=`VoicePhraseMismatchError`}};function O(e,t){let n=[],r=-1;for(let i=0;i<t;i+=1){let t=i*257,a=-1/0,o=0;for(let n=0;n<257;n+=1){let r=e[t+n];if(!Number.isFinite(r))throw Error(`Phrase model returned invalid scores.`);r>a&&(a=r,o=n)}o!==0&&o!==r&&n.push(o),r=o}return n.length===0?{kind:`empty`}:te(n.map(k).join(``).replace(/▁/g,` `).trim().replace(/\s+/g,` `))}function k(e){return d[e]}async function ne(e,t){let n=await f.prepare(),r=new(await(import(`./ort.wasm.bundle.min-7y-hlRN8.js`))).Tensor(`float32`,e,[1,e.length]);try{let e=await n.run({samples:r});try{let n=e.logits;if(!n||!(n.data instanceof Float32Array)||n.dims.length!==3||n.dims[0]!==1||n.dims[2]!==257||n.data.length!==n.dims[1]*257)throw Error(`Phrase model returned an invalid result.`);let r=O(n.data,n.dims[1]);return r.kind===`recognized`&&r.phrase===t?{kind:`matched`,recognition:r}:{kind:`mismatch`,recognition:r}}finally{for(let t of Object.values(e))t.dispose()}}finally{r.dispose()}}const A=new s({path:`/sdk/voiceid/silero-vad.onnx`,sha256:`2623a2953f6ff3d2c1e61740c6cdb7168133479b267dfef114a4a3cc5bdd788f`,bytes:2327524,label:`Speech detection`});async function j(){return new re(await A.prepare(),await import(`./ort.wasm.bundle.min-7y-hlRN8.js`))}var re=class{state=new Float32Array(256);context=new Float32Array(64);constructor(e,t){this.session=e,this.ort=t}async probability(e){if(e.length!==512)throw Error(`Speech detection requires a 512-sample frame.`);let t=new Float32Array(576);t.set(this.context),t.set(e,64);let n=new this.ort.Tensor(`float32`,t,[1,576]),r=new this.ort.Tensor(`float32`,this.state,[2,1,128]),i=new this.ort.Tensor(`int64`,BigInt64Array.of(16000n),[]);try{let t=await this.session.run({input:n,state:r,sr:i});try{let n=t.output?.data,r=t.stateN?.data;if(!(n instanceof Float32Array)||n.length!==1||!Number.isFinite(n[0])||n[0]<0||n[0]>1||!(r instanceof Float32Array)||r.length!==256)throw Error(`Speech detection returned an invalid result.`);return this.state.set(r),this.context.set(e.subarray(448)),n[0]}finally{for(let e of Object.values(t))e.dispose()}}finally{n.dispose(),r.dispose(),i.dispose(),t.fill(0)}}clear(){this.state.fill(0),this.context.fill(0)}};function ie(e){return e.noise===`high`?`Background noise is high. Move closer to the microphone and try again.`:`Audio too brief or quiet: ${(e.voicedMs/1e3).toFixed(2)} of ${(e.requiredVoicedMs/1e3).toFixed(2)} seconds detected.`}var M=class extends Error{constructor(e){super(ie(e)),this.quality=e,this.name=`InsufficientVoiceAudioError`}};const N=16e3,P=.006,ae=8e3;function oe(){if(se(),!navigator.userActivation.isActive)throw Error(`Open the Wallet and select Record to use VoiceID.`)}function se(){if(document.visibilityState!==`visible`||!document.hasFocus())throw Error(`Keep the Wallet open and focused to use VoiceID.`)}async function ce(e,t){if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let n=crypto.randomUUID(),r=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1});try{if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let i=await new le(r,e,t).result.finally(t.bind(null,{kind:`processing`}));if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let a=await new OfflineAudioContext(1,N,N).decodeAudioData(i.bytes),o=new OfflineAudioContext(1,Math.ceil(a.duration*N),N),s=o.createBufferSource();s.buffer=a,s.connect(o.destination),s.start();try{let a=await o.startRendering();try{if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let o=a.getChannelData(0),s=await ue(o,e),c=r.getAudioTracks()[0]?.getSettings(),l={attemptId:n,capturedAtMs:Date.now(),durationMs:a.duration*1e3,recordingMs:i.recordingMs,endedBy:i.endedBy,voicedMs:s.voicedMs,peakFrameRms:s.peakFrameRms,levelThreshold:P,requiredVoicedMs:600,microphone:r.getAudioTracks()[0]?.label||`Default microphone`,processing:{noiseSuppression:c?.noiseSuppression??null,echoCancellation:c?.echoCancellation??null,autoGainControl:c?.autoGainControl??null,sampleRate:c?.sampleRate??null},backgroundRms:s.backgroundRms,speechToBackgroundDb:s.speechToBackgroundDb,noise:s.noise};return t({kind:`measured`,quality:l}),s.kind===`insufficient_audio`?{kind:`insufficient_audio`,quality:l}:{kind:`captured`,samples:o.slice(Math.max(0,s.first-3200),Math.min(o.length,s.last+3200)),quality:l}}finally{F(a)}}finally{F(a)}}finally{for(let e of r.getTracks())e.stop()}}var le=class{recorder;chunks=[];timer=null;completion=new e;startedAtMs=performance.now();ended=null;activity={kind:`waiting`,activeMs:0};audioContext=null;worklet=null;detector=null;pending=Promise.resolve();queuedFrames=0;closed=!1;result=this.completion.promise;constructor(e,t,n){this.stream=e,this.signal=t,this.onCapture=n,this.recorder=new MediaRecorder(e),this.recorder.addEventListener(`dataavailable`,this.data),this.recorder.addEventListener(`stop`,this.stopped),this.recorder.addEventListener(`error`,this.failed),t.addEventListener(`abort`,this.cancelled,{once:!0}),this.timer=setTimeout(this.startupFailed,ae),this.start()}async start(){try{if(await this.startPauseDetection(),this.signal.throwIfAborted(),this.startedAtMs=performance.now(),this.closed)return;this.recorder.start(),this.timer!==null&&clearTimeout(this.timer),this.timer=setTimeout(this.stop.bind(this,`limit`),ae),this.onCapture({kind:`listening`})}catch(e){this.cleanup(),this.completion.reject(e instanceof Error?e:Error(`Speech detection could not start.`))}}data=e=>{this.chunks.push(e.data)};stop=e=>{this.recorder.state!==`inactive`&&(this.ended={endedBy:e,recordingMs:performance.now()-this.startedAtMs},this.recorder.stop(),this.stopTracks())};cancelled=()=>{if(this.recorder.state===`inactive`){this.cleanup(),this.completion.reject(Error(`VoiceID recording was cancelled.`));return}this.stop(`stream_ended`)};startupFailed=()=>{this.cleanup(),this.completion.reject(Error(`Speech detection startup timed out. Please try again.`))};detectorFailed=e=>{this.cleanup(),this.completion.reject(e instanceof Error?e:Error(`Speech detection failed.`))};failed=()=>{this.cleanup(),this.completion.reject(Error(`VoiceID could not record this microphone.`))};stopped=()=>{if(this.cleanup(),this.signal.aborted){this.completion.reject(Error(`VoiceID recording was cancelled.`));return}new Blob(this.chunks,{type:this.recorder.mimeType}).arrayBuffer().then(this.complete,this.completion.reject.bind(this.completion))};complete=e=>{if(this.signal.aborted){this.completion.reject(Error(`VoiceID recording was cancelled.`));return}let t=this.ended??{endedBy:`stream_ended`,recordingMs:performance.now()-this.startedAtMs};this.completion.resolve({bytes:e,recordingMs:t.recordingMs,endedBy:t.endedBy})};async startPauseDetection(){let e=new AudioContext({sampleRate:N});this.audioContext=e;let t=e.resume();if(this.detector=await j(),this.signal.throwIfAborted(),e.sampleRate!==N)throw Error(`Speech detection requires 16 kHz audio.`);await e.audioWorklet.addModule(`/sdk/voiceid/voice-activity-worklet.js`),this.signal.throwIfAborted();let n=new AudioWorkletNode(e,`voice-activity-frames`);this.worklet=n,n.port.onmessage=this.receiveFrame,e.createMediaStreamSource(this.stream).connect(n),n.connect(e.destination),await t}receiveFrame=e=>{if(!(e.data instanceof Float32Array)||e.data.length!==512){this.failed();return}if(this.closed||this.recorder.state!==`recording`){e.data.fill(0);return}if(++this.queuedFrames>32){e.data.fill(0),this.failed();return}this.pending=this.pending.then(this.processFrame.bind(this,e.data)).catch(this.detectorFailed)};async processFrame(e){let t=this.detector;try{if(this.closed||!t)return;let n=await t.probability(e);if(this.closed){t.clear();return}let r=0;for(let t of e)r+=t*t;let i=Math.sqrt(r/e.length),a=n>=.5&&i>=P;this.updateActivity(a),this.onCapture({kind:`activity`,rms:i,speech:a})}finally{e.fill(0),--this.queuedFrames}}updateActivity(e){let t=performance.now();switch(this.activity.kind){case`waiting`:{let n=e?this.activity.activeMs+32:0;this.activity=n>=100?{kind:`speaking`,lastSoundAtMs:t}:{kind:`waiting`,activeMs:n};return}case`speaking`:e?this.activity={kind:`speaking`,lastSoundAtMs:t}:t-this.activity.lastSoundAtMs>=1500&&this.stop(`pause`);return;default:return fe(this.activity)}}stopPauseDetection=()=>{this.closed=!0,this.worklet&&(this.worklet.port.onmessage=null,this.worklet.port.close(),this.worklet.disconnect()),this.worklet=null,this.detector?.clear(),this.detector=null;let e=this.audioContext;this.audioContext=null,e&&e.close().catch(de)};stopTracks(){for(let e of this.stream.getTracks())e.stop()}cleanup(){this.stopPauseDetection(),this.stopTracks(),this.timer!==null&&clearTimeout(this.timer),this.signal.removeEventListener(`abort`,this.cancelled),this.recorder.removeEventListener(`dataavailable`,this.data),this.recorder.removeEventListener(`stop`,this.stopped),this.recorder.removeEventListener(`error`,this.failed)}};async function ue(e,t){let n=await j(),r=-1,i=0,a=0,o=0,s=0,c=0,l=0,u=new Float32Array(512);try{for(let d=0;d<e.length;d+=u.length){t.throwIfAborted(),u.fill(0);let f=Math.min(u.length,e.length-d);u.set(e.subarray(d,d+f));let p=0;for(let e of u)p+=e*e;let m=Math.sqrt(p/f);if(o=Math.max(o,m),!(await n.probability(u)>=.5&&m>=P)){s+=p,c+=f;continue}r<0&&(r=d),i=d+f,a+=f,l+=p}}finally{u.fill(0),n.clear()}let d=Math.sqrt(s/Math.max(1,c)),f=Math.sqrt(l/Math.max(1,a)),p=a&&c?20*Math.log10(Math.max(f,1e-8)/Math.max(d,1e-8)):null,m={backgroundRms:d,speechToBackgroundDb:p,noise:d>=P&&(p===null||p<10)?`high`:c?`normal`:`unknown`},h=a/N*1e3;return r<0||h<600?{kind:`insufficient_audio`,voicedMs:h,peakFrameRms:o,...m}:{kind:`captured`,first:r,last:i,voicedMs:h,peakFrameRms:o,...m}}function F(e){for(let t=0;t<e.numberOfChannels;t+=1)e.getChannelData(t).fill(0)}function de(){}function fe(e){throw Error(`Unexpected speech activity: ${String(e)}`)}var pe,I,me,L,he,ge,_e,ve,ye,be,xe,R,Se,Ce,we={},Te=[],Ee=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,De=Array.isArray;function z(e,t){for(var n in t)e[n]=t[n];return e}function Oe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ke(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?pe.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 Ae(e,o,r,i,null)}function Ae(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??++me,__i:-1,__u:0};return i==null&&I.vnode!=null&&I.vnode(a),a}function je(e){return e.children}function B(e,t){this.props=e,this.context=t}function V(e,t){if(t==null)return e.__?V(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`?V(e):null}function Me(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=z({},t);a.__v=t.__v+1,I.vnode&&I.vnode(a),Ve(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??V(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Ue(r,a,i),t.__e=t.__=null,a.__e!=n&&Ne(a)}}function Ne(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}),Ne(e)}function Pe(e){(!e.__d&&(e.__d=!0)&&L.push(e)&&!Fe.__r++||he!=I.debounceRendering)&&((he=I.debounceRendering)||ge)(Fe)}function Fe(){try{for(var e,t=1;L.length;)L.length>t&&L.sort(_e),e=L.shift(),t=L.length,Me(e)}finally{L.length=Fe.__r=0}}function Ie(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||Te,v=t.length;for(c=Le(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||we,p.__i=d,g=Ve(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Ke(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=H(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 Le(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]=Ae(null,o,null,null,null):De(o)?o=e.__k[a]=Ae(je,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=Ae(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=ze(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=V(s)),qe(s,s));return r}function H(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=H(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=V(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Re(e,t){return t||=[],e==null||typeof e==`boolean`||(De(e)?e.some(function(e){Re(e,t)}):t.push(e)),t}function ze(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 U(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||Ee.test(t)?n:n+`px`}function W(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||U(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||U(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(xe,`$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[be]=r[be]:(n[be]=R,e.addEventListener(t,a?Ce:Se,a)):e.removeEventListener(t,a?Ce:Se,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 Be(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ye]==null)t[ye]=R++;else if(t[ye]<n[be])return;return n(I.event?I.event(t):t)}}}function Ve(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=I.__b)&&u(t);n:if(typeof E==`function`){d=o.length;try{if(v=t.props,y=E.prototype&&E.prototype.render,b=(u=E.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new E(v,x):(t.__c=f=new B(v,x),f.constructor=E,f.render=Je),b&&b.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&E.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=z({},f.__s)),z(f.__s,E.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&E.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&E.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){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)}),Te.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=V(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=I.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),Te.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=z(z({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===je&&u.key==null?We(u.props.children):u,s=Ie(e,De(w)?w:[w],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(T=a.length;T--;)Oe(a[T])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||He(t),I.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Ge(n.__e,t,n,r,i,a,o,c,l);return(u=I.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 Ue(e,t,n){for(var r=0;r<n.length;r++)Ke(n[r],n[++r],n[++r]);I.__c&&I.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){I.__e(e,t.__v)}})}function We(e){return typeof e!=`object`||!e||e.__b>0?e:De(e)?e.map(We):e.constructor===void 0?z({},e):null}function Ge(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||we,_=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&&=(I.__m&&I.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&pe.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 _||W(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||W(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=``),Ie(t.type==`template`?e.content:e,De(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&V(n,0),s,c),a!=null)for(l=a.length;l--;)Oe(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])&&W(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&W(e,l,h,g[l],i))}return e}function Ke(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){I.__e(e,n)}}function qe(e,t,n){var r,i;if(I.unmount&&I.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ke(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){I.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&qe(r[i],t,n||typeof e.type!=`function`);n||Oe(e.__e),e.__c=e.__=e.__e=void 0}function Je(e,t,n){return this.constructor(e,n)}function Ye(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),I.__&&I.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],Ve(t,e=(!r&&n||t).__k=ke(je,null,[e]),i||we,we,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?pe.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),Ue(a,e,o),e.props.children=null}pe=Te.slice,I={__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}},me=0,B.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=z({},this.state);typeof e==`function`&&(e=e(z({},n),this.props)),e&&z(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Pe(this))},B.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Pe(this))},B.prototype.render=je,L=[],ge=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_e=function(e,t){return e.__v.__b-t.__v.__b},Fe.__r=0,ve=Math.random().toString(8),ye=`__d`+ve,be=`__a`+ve,xe=/(PointerCapture)$|Capture$/i,R=0,Se=Be(!1),Ce=Be(!0);var Xe,G,Ze,Qe,$e=0,et=[],K=I,tt=K.__b,nt=K.__r,rt=K.diffed,it=K.__c,at=K.unmount,ot=K.__;function st(e,t){K.__h&&K.__h(G,e,$e||t),$e=0;var n=G.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function ct(e){return $e=1,lt(xt,e)}function lt(e,t,n){var r=st(Xe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):xt(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=G,!G.__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};G.__f=!0;var a=G.shouldComponentUpdate,o=G.componentWillUpdate;G.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)},G.shouldComponentUpdate=i}return r.__N||r.__}function ut(e,t){var n=st(Xe++,3);!K.__s&&bt(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function dt(e){return $e=5,ft(function(){return{current:e}},[])}function ft(e,t){var n=st(Xe++,7);return bt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function pt(e,t){return $e=8,ft(function(){return e},t)}function mt(){var e=st(Xe++,11);if(!e.__){for(var t=G.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function ht(){for(var e;e=et.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(vt),t.__h.some(yt),t.__h=[]}catch(n){t.__h=[],K.__e(n,e.__v)}}}K.__b=function(e){G=null,tt&&tt(e)},K.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ot&&ot(e,t)},K.__r=function(e){nt&&nt(e),Xe=0;var t=(G=e.__c).__H;t&&(Ze===G?(t.__h=[],G.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(vt),t.__h.some(yt),t.__h=[],Xe=0)),Ze=G},K.diffed=function(e){rt&&rt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(et.push(t)!==1&&Qe===K.requestAnimationFrame||((Qe=K.requestAnimationFrame)||_t)(ht)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),Ze=G=null},K.__c=function(e,t){t.some(function(e){try{e.__h.some(vt),e.__h=e.__h.filter(function(e){return!e.__||yt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],K.__e(n,e.__v)}}),it&&it(e,t)},K.unmount=function(e){at&&at(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{vt(e)}catch(e){t=e}}),n.__H=void 0,t&&K.__e(t,n.__v))};var gt=typeof requestAnimationFrame==`function`;function _t(e){var t,n=function(){clearTimeout(r),gt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);gt&&(t=requestAnimationFrame(n))}function vt(e){var t=G,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),G=t}function yt(e){var t=G;e.__c=e.__(),G=t}function bt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function xt(e,t){return typeof t==`function`?t(e):t}function St(e,t){for(var n in t)e[n]=t[n];return e}function Ct(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 wt(e,t){this.props=e,this.context=t}(wt.prototype=new B).isPureReactComponent=!0,wt.prototype.shouldComponentUpdate=function(e,t){return Ct(this.props,e)||Ct(this.state,t)};var Tt=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Tt&&Tt(e)};var Et=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function Dt(e){function t(t){var n=St({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Et,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var Ot=I.__e;I.__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)}Ot(e,t,n,r)};var kt=I.unmount;function At(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=St({},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 At(e,t,n)})),e}function jt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return jt(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 Mt(){this.__u=0,this.o=null,this.__b=null}function Nt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Pt(){this.i=null,this.l=null}I.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),kt&&kt(e)},(Mt.prototype=new B).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Nt(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]=jt(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)},Mt.prototype.componentWillUnmount=function(){this.o=[]},Mt.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]=At(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ke(je,null,e.fallback);return i&&(i.__u&=-33),[ke(je,null,t.__a?null:e.children),i]};var Ft=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]}};(Pt.prototype=new B).__a=function(e){var t=this,n=Nt(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Ft(t,e,r)):i()};n?n(a):a()}},Pt.prototype.render=function(e){this.i=null,this.l=new Map;var t=Re(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},Pt.prototype.componentDidUpdate=Pt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ft(e,n,t)})};var It=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Lt=/^(?: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]/,Rt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,zt=/[A-Z0-9]/g,Bt=typeof document<`u`,Vt=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};B.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(B.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ht=I.event;I.event=function(e){return Ht&&(e=Ht(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ut={configurable:!0,get:function(){return this.class}},Wt=I.vnode;I.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||Bt&&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`||Vt(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Rt.test(a)&&(a=s):s=a=`oninput`:i&&Lt.test(a)?a=a.replace(zt,`-$&`).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=Re(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=Re(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`,Ut)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=It,Wt&&Wt(e)};var Gt=I.__r;I.__r=function(e){Gt&&Gt(e),e.__c};var Kt=I.diffed;I.diffed=function(e){Kt&&Kt(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 q=0;Array.isArray;function J(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:--q,__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 I.vnode&&I.vnode(l),l}function qt(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 Jt(e){let t=qt(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function Yt(e){let t=qt(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}},Zt=[{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}],Qt=36*Zt.length,$t={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 en(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 tn(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function nn(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function rn({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?Zt.slice(0,s):Zt).map((s,c)=>{let l=n>=1?t[c%t.length]:en(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 ${nn(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
2
- `)}function an(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:ee=1,softness:te=1,distortion:D=!1,scale:O=1}=e,k=Math.round(28*O*10)/10,ne=Math.round(9*O*10)/10,A=Math.max(0,n-r),j=Math.round(Math.max(40,Math.min(95,70*te))),re=e=>h*e,ie=e=>g*e,M=e=>Math.round(e*10)/10,N=`var(--vb-z-${t}, 1)`,P=e=>`calc(${M(e)}px * ${N})`,ae=f===`dark`,oe=$t[c][ae?`dark`:`light`].map((e,t)=>{let n=l?.[t];return n&&Jt(n)||e}),se=c===`mono`?.6:1,ce=(i*se).toFixed(2),le=(a*se).toFixed(2),ue=(o*se).toFixed(2),F=u.toFixed(2),de=d.toFixed(2),fe=`hue-rotate(calc(var(--voice-hue-base, ${p}deg) + var(--vb-hue-${t})))`,pe=D?` url(#vb-distort-${t})`:``,I=`filter: ${fe} brightness(${F}) saturate(${de});`,me=`filter: ${fe} brightness(${F}) saturate(${de})${pe};`,L=`filter: blur(${P(tn(10,m))}) ${fe} brightness(${F}) saturate(${de});`,he=`filter: blur(${P(tn(10,m))}) ${fe} brightness(${F}) saturate(${de})${pe};`,ge=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${N})`,_e=`calc(100% + (2px + var(--vb-cy-${t})) * ${N})`,ve=ae?`radial-gradient(ellipse calc(${M(30*S)}px * var(--vb-w-${t}) * ${N}) calc(${M(30*S)}px * var(--vb-h-${t}) * ${N}) at ${ge} ${_e}, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.14) 30%, transparent 65%)`:`radial-gradient(ellipse calc(${M(40*S)}px * var(--vb-w-${t}) * ${N}) calc(${M(30*S)}px * var(--vb-h-${t}) * ${N}) at ${ge} ${_e}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,ye=rn({id:t,colors:oe,alpha:1,sw:re(_),sh:ie(_),y:2,fade:j}),be=rn({id:t,colors:oe,alpha:.46,sw:re(.9*v),sh:ie(.9*v*y),y:0,fade:j}),xe=rn({id:t,colors:oe,alpha:ae?.9:.7,sw:re(1.15*b),sh:ie(1.5*b*x),y:0,fade:Math.min(95,j+2)}),R=(e,n,r,i=0)=>`radial-gradient(ellipse calc(${M(e*E)}px * var(--vb-w-${t}) * var(--vb-mw-${t}) * ${N}) calc((${M(n*ee)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${N}) at ${ge} calc(100% + var(--vb-cy-${t}) * ${N}), white 0%, rgba(255, 255, 255, 0.5) ${r}%${i>0?`, rgba(255, 255, 255, ${i}) 85%`:``}, transparent 100%)`,Se=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,Ce=(e,t,r,i)=>`${e} {
3
- ${t}
4
- position: absolute;
5
- inset: 0;
6
- border-radius: ${P(n)};
7
- background: ${be};
8
- box-shadow: inset 0 0 ${P(ne)} 1px ${s};
9
- -webkit-mask-image:
10
- ${R(170,64,45,.3)},
11
- linear-gradient(white, transparent ${P(k)}, transparent calc(100% - ${k}px * ${N}), white),
12
- linear-gradient(to right, white, transparent ${P(k)}, transparent calc(100% - ${k}px * ${N}), white);
13
- -webkit-mask-composite: source-in, source-over;
14
- mask-image:
15
- ${R(170,64,45,.3)},
16
- linear-gradient(white, transparent ${P(k)}, transparent calc(100% - ${k}px * ${N}), white),
17
- linear-gradient(to right, white, transparent ${P(k)}, transparent calc(100% - ${k}px * ${N}), white);
18
- mask-composite: intersect, add;
19
- pointer-events: none;
20
- /* Its own compositing layer: WebKit otherwise re-rasterizes the
21
- filtered layer into the parent every frame on the CPU (a phone-sized
22
- host runs at a sixth of the frame rate without this). */
23
- will-change: transform;
24
- z-index: 1;
25
- ${r}
26
- ${Se(`inner`,le)}
27
- ${i}
28
- }`;return`
29
- @property --vb-opacity-${t} {
30
- syntax: "<number>";
31
- initial-value: 0;
32
- inherits: true;
33
- }
34
-
35
- [data-voice-beam="${t}"] {
36
- position: relative;
37
- border-radius: ${n}px;
38
- overflow: hidden;
39
- --vb-h-${t}: 0.8;
40
- --vb-w-${t}: 1;
41
- ${Zt.map((e,n)=>` --vb-x${n}-${t}: ${e.x}px;
42
- --vb-l${n}-${t}: 1;
43
- --vb-y${n}-${t}: 0px;`).join(`
44
- `)}
45
- --vb-glow-${t}: 0.4;
46
- --vb-z-${t}: 1;
47
- --vb-cx-${t}: 0px;
48
- --vb-cy-${t}: 0px;
49
- --vb-bh-${t}: 0px;
50
- --vb-bendA-${t}: 0;
51
- --vb-mw-${t}: 1;
52
- --vb-hue-${t}: 0deg;
53
- --vb-level-${t}: 0;
54
- }
55
-
56
- [data-voice-beam="${t}"][data-active] {
57
- animation: vb-fade-in-${t} 0.6s ease forwards;
58
- }
59
-
60
- [data-voice-beam="${t}"][data-fading] {
61
- animation: vb-fade-out-${t} 0.5s ease forwards;
62
- }
63
-
64
- /* Stroke — the colours painted into the 1px edge ring, masked to the centred ellipse. */
65
- [data-voice-beam="${t}"][data-active]::after,
66
- [data-voice-beam="${t}"][data-fading]::after {
67
- content: "";
68
- position: absolute;
69
- inset: 0;
70
- border-radius: ${P(A)};
71
- padding: ${P(r)};
72
- clip-path: inset(0 round ${P(n)});
73
- background:
74
- ${ve},
75
- ${ye};
76
- -webkit-mask:
77
- ${R(170,64,45)},
78
- linear-gradient(#fff 0 0) content-box,
79
- linear-gradient(#fff 0 0);
80
- -webkit-mask-composite: source-in, xor;
81
- mask:
82
- ${R(170,64,45)},
83
- linear-gradient(#fff 0 0) content-box,
84
- linear-gradient(#fff 0 0);
85
- mask-composite: intersect, exclude;
86
- pointer-events: none;
87
- /* Its own compositing layer: WebKit otherwise re-rasterizes the
88
- filtered layer into the parent every frame on the CPU (a phone-sized
89
- host runs at a sixth of the frame rate without this). */
90
- will-change: transform;
91
- z-index: 2;
92
- ${Se(`stroke`,ce)}
93
- ${I}
94
- }
95
-
96
- /* Inner glow — soft light inside the element, faded off at the corners.
97
- With distortion on, this copy is clipped to ABOVE the band line (the
98
- polygon the driver writes each frame) and a mirror layer below carries
99
- the displacement filter, so only the glow under the line warps. */
100
- ${Ce(`[data-voice-beam="${t}"][data-active]::before,
101
- [data-voice-beam="${t}"][data-fading]::before`,`content: "";`,D?`clip-path: var(--vb-clip-above-${t}, inset(0 round ${n}px));`:`clip-path: inset(0 round ${n}px);`,I)}
102
- ${D?Ce(`[data-voice-beam="${t}"][data-active] [data-voice-beam-warp="inner"],
103
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="inner"]`,`display: block;`,`clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));`,me):``}
104
-
105
- /* Bloom — the blurred halo, tallest of the three, above the content. */
106
- [data-voice-beam="${t}"] [data-voice-beam-bloom],
107
- [data-voice-beam="${t}"] [data-voice-beam-warp] {
108
- display: none;
109
- position: absolute;
110
- inset: 0;
111
- border-radius: ${P(A)};
112
- pointer-events: none;
113
- /* Its own compositing layer: WebKit otherwise re-rasterizes the
114
- filtered layer into the parent every frame on the CPU (a phone-sized
115
- host runs at a sixth of the frame rate without this). */
116
- will-change: transform;
117
- opacity: 0;
118
- }
119
-
120
- [data-voice-beam="${t}"] [data-voice-beam-bloom],
121
- [data-voice-beam="${t}"] [data-voice-beam-warp="bloom"] {
122
- -webkit-mask: ${R(200,130,35)};
123
- mask: ${R(200,130,35)};
124
- background: ${xe};
125
- z-index: 3;
126
- }
127
-
128
- [data-voice-beam="${t}"][data-active] [data-voice-beam-bloom],
129
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-bloom] {
130
- display: block;
131
- clip-path: ${D?`var(--vb-clip-above-${t}, inset(0 round ${n}px))`:`inset(0 round ${n}px)`};
132
- ${Se(`bloom`,ue)}
133
- ${L}
134
- }
135
- ${D?`
136
- [data-voice-beam="${t}"][data-active] [data-voice-beam-warp="bloom"],
137
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-warp="bloom"] {
138
- display: block;
139
- clip-path: var(--vb-clip-below-${t}, inset(0 round ${n}px));
140
- ${Se(`bloom`,ue)}
141
- ${he}
142
- }
143
-
144
- /* Processing drops the distortion: the driver marks the wrapper once the
145
- warp has faded out, the warp layers leave the paint and the base layers
146
- give up their split at the band line. */
147
- [data-voice-beam="${t}"][data-voice-warp="off"]::before,
148
- [data-voice-beam="${t}"][data-voice-warp="off"] [data-voice-beam-bloom] {
149
- clip-path: inset(0 round ${n}px);
150
- }
151
-
152
- [data-voice-beam="${t}"][data-voice-warp="off"] [data-voice-beam-warp] {
153
- display: none;
154
- }`:``}
155
-
156
- /* Epicentre — a soft white wash at the source, under the band line (the
157
- driver's clip; unclipped when no line is drawn), sitting above every
158
- glow layer and the band's halo so the centre reads lighter than the
159
- band (same z as the band canvases, painted after them). Sized by the voice like the
160
- other layers; off unless \`coreLight\` is set (the light theme sets it).
161
- Up to 1 it is the wash's opacity; past 1 the solid white core widens
162
- too, for a centre that stays lighter than a strong band. It follows the
163
- glow's presence but not \`strength\`, which would only dim it. */
164
- ${C>0?(()=>{let e=Math.max(0,Math.min(2,C-1)),n=Math.min(1,e),r=Math.max(0,e-1),i=1+.3*e,a=M(45*n+27*r),o=M(40+25*n+15*r),s=Math.min(1,.55+.35*n+.1*r).toFixed(2),c=M(72+14*n+8*r);return`[data-voice-beam="${t}"] [data-voice-beam-core] {
165
- display: none;
166
- position: absolute;
167
- inset: 0;
168
- border-radius: ${P(A)};
169
- overflow: hidden;
170
- pointer-events: none;
171
- /* Its own compositing layer: WebKit otherwise re-rasterizes the
172
- filtered layer into the parent every frame on the CPU (a phone-sized
173
- host runs at a sixth of the frame rate without this). */
174
- will-change: transform;
175
- /* The blur sits on this wrapper and the band-line clip on the child,
176
- so the cut edge is blurred too rather than left hard. */
177
- filter: blur(${P(tn(8,m))});
178
- z-index: 4;
179
- }
180
-
181
- [data-voice-beam="${t}"] [data-voice-beam-core] > div {
182
- position: absolute;
183
- inset: 0;
184
- background: radial-gradient(ellipse calc(${M(120*w*i*O)}px * var(--vb-w-${t}) * ${N}) calc((${M(70*T*i*O)}px * var(--vb-h-${t}) + var(--vb-bh-${t})) * ${N}) at ${ge} calc(100% + var(--vb-cy-${t}) * ${N}), white 0%, white ${a}%, rgba(255, 255, 255, ${s}) ${o}%, transparent ${c}%);
185
- clip-path: var(--vb-clip-below-${t}, none);
186
- }
187
-
188
- [data-voice-beam="${t}"][data-active] [data-voice-beam-core],
189
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-core] {
190
- display: block;
191
- opacity: calc(var(--vb-opacity-${t}, 1) * min(1, var(--vb-glow-${t}) * ${Math.min(1,C).toFixed(2)} * ${(1.6+1.4*e).toFixed(2)}) * var(--voice-core-light-opacity, 1));
192
- }
193
- `})():``}
194
- /* Band — the canvas the driver draws the bend's contour on: an organic
195
- bell with chromatic fringes. Fades with the root, follows the strength
196
- and turns with the hue drift like the other layers. */
197
- [data-voice-beam="${t}"] [data-voice-beam-band],
198
- [data-voice-beam="${t}"] [data-voice-beam-band-halo] {
199
- display: none;
200
- position: absolute;
201
- inset: 0;
202
- width: 100%;
203
- height: 100%;
204
- pointer-events: none;
205
- /* Its own compositing layer: WebKit otherwise re-rasterizes the
206
- filtered layer into the parent every frame on the CPU (a phone-sized
207
- host runs at a sixth of the frame rate without this). */
208
- will-change: transform;
209
- z-index: 4;
210
- }
211
-
212
- [data-voice-beam="${t}"][data-active] [data-voice-beam-band],
213
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-band],
214
- [data-voice-beam="${t}"][data-active] [data-voice-beam-band-halo],
215
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-band-halo] {
216
- display: block;
217
- opacity: calc(var(--vb-opacity-${t}, 1) * var(--voice-band-opacity, 1) * var(--voice-strength, 1));
218
- /* The blur vars are 0 where the canvas blurs its own strokes; where the
219
- 2D context has no filter (WebKit) the driver sets them and the layers
220
- are blurred here instead — the ridge on the band canvas, its wider
221
- halo on the canvas beneath. */
222
- filter: blur(var(--vb-band-blur-${t}, 0px)) ${fe} brightness(${F}) saturate(${de});
223
- }
224
-
225
- [data-voice-beam="${t}"][data-active] [data-voice-beam-band-halo],
226
- [data-voice-beam="${t}"][data-fading] [data-voice-beam-band-halo] {
227
- filter: blur(var(--vb-band-halo-blur-${t}, 0px)) ${fe} brightness(${F}) saturate(${de});
228
- }
229
-
230
- /* Resolution. The soft layers — inner light and its warp mirror, bloom and
231
- its mirror, the epicentre — are rastered at half size and scaled back
232
- up by the compositor: the box is halved, every length inside rides the
233
- layer's factor \`--vb-z\` at 0.5 (the driver also writes the band-line
234
- clips at half scale), and the will-change transform is rastered
235
- pre-scale where the engine does that (Chromium, Safari 18). For blurred
236
- gradients that is the same picture at a quarter of the raster and
237
- filter work, which is what a phone at 3x runs out of. The 1px stroke
238
- stays full-res on every screen: at half size it is half a CSS pixel,
239
- which a 3x phone rasters into a faint smear instead of the hairline,
240
- and the layer is cheap (no blur). The component sets
241
- \`data-voice-halfres\`. */
242
- [data-voice-beam="${t}"][data-voice-halfres]::before,
243
- [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-warp],
244
- [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-bloom],
245
- [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-core] {
246
- --vb-z-${t}: 0.5;
247
- inset: auto;
248
- left: 0;
249
- top: 0;
250
- width: 50%;
251
- height: 50%;
252
- transform: translateZ(0) scale(2);
253
- transform-origin: 0 0;
254
- }
255
- ${D?`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
256
- [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
257
- [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
258
- [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
259
- clip-path: var(--vb-clip-above-z-${t}, inset(0 round ${P(n)}));
260
- }
261
- [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-warp],
262
- [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-warp] {
263
- clip-path: var(--vb-clip-below-z-${t}, inset(0 round ${P(n)}));
264
- }
265
- /* Processing (warp off): the mirrors are gone, so the base layers paint
266
- the whole box again — this must outweigh the split above. */
267
- [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"]::before,
268
- [data-voice-beam="${t}"][data-voice-halfres][data-voice-warp="off"] [data-voice-beam-bloom] {
269
- clip-path: inset(0 round ${P(n)});
270
- }`:`[data-voice-beam="${t}"][data-voice-halfres][data-active]::before,
271
- [data-voice-beam="${t}"][data-voice-halfres][data-fading]::before,
272
- [data-voice-beam="${t}"][data-voice-halfres][data-active] [data-voice-beam-bloom],
273
- [data-voice-beam="${t}"][data-voice-halfres][data-fading] [data-voice-beam-bloom] {
274
- clip-path: inset(0 round ${P(n)});
275
- }`}
276
- [data-voice-beam="${t}"][data-voice-halfres] [data-voice-beam-core] > div {
277
- clip-path: var(--vb-clip-below-z-${t}, none);
278
- }
279
- @keyframes vb-fade-in-${t} {
280
- to { --vb-opacity-${t}: 1; }
281
- }
282
-
283
- @keyframes vb-fade-out-${t} {
284
- from { --vb-opacity-${t}: 1; }
285
- to { --vb-opacity-${t}: 0; }
286
- }
287
-
288
- [data-voice-beam="${t}"][data-paused],
289
- [data-voice-beam="${t}"][data-paused]::after,
290
- [data-voice-beam="${t}"][data-paused]::before,
291
- [data-voice-beam="${t}"][data-paused] [data-voice-beam-bloom] {
292
- animation-play-state: paused !important;
293
- }
294
- `}let on=null;function sn(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function cn(){let e=sn();return e?(on||=new e,on.state===`suspended`&&on.resume().catch(()=>{}),on):null}const ln=new WeakMap;function un(e){let t=cn();if(!t||e.getAudioTracks().length===0)return null;let n=ln.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},ln.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{}ln.delete(e)}}}}}const dn=new WeakMap;function fn(e){let t=dn.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},dn.set(e,t)),t}const pn=new Set;let mn=null,hn=0,gn=0,_n=!1,vn=!1,yn=0,bn=0;const xn=Math.PI*2,Sn=[[80,300],[300,2e3],[2e3,6e3]];function Cn(e){return e<0?0:e>1?1:e}function wn(e,t){let n=t/2;return((e+n)%t+t)%t-n}function Tn(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function En(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return Cn((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Dn(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 On=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),kn=.05,An=.1;function jn(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 Mn(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 Nn(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function Pn(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 Fn(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,_=jn(d,e.bandCurve,e.bandSpread,e.bandSkew)+Mn(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?Pn(l,n,Nn(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function In(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 Ln(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/kn)*kn));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-An*100}%`),o.setAttribute(`width`,`${(1+2*An)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function Rn(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`,ee=E?`0px`:`${w.toFixed(2)}px`;e.cssBlur!==ee&&(a.style.setProperty(`--vb-band-blur-${o.id}`,ee),a.style.setProperty(`--vb-band-halo-blur-${o.id}`,E?`0px`:`${(w*3).toFixed(2)}px`),e.cssBlur=ee);let te=[[1,.16],[.72,.2],[.46,.26],[.22,.34]],D=[{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 O=n[0][0],k=n[n.length-1][0],ne=(e,t)=>{let n=i.createLinearGradient(O,0,k,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},A=!E&&p?p:i;E&&(i.filter=`blur(${(T*3).toFixed(1)}px)`),A.lineCap=`round`,A.lineJoin=`round`,A.strokeStyle=ne(x.c,S*.3),A.lineWidth=C*2.2,A.beginPath(),A.moveTo(n[0][0],n[0][1]);for(let e=1;e<n.length;e++)A.lineTo(n[e][0],n[e][1]);A.stroke(),E&&(i.filter=`blur(${T.toFixed(1)}px)`);for(let e of D)for(let[t,n]of te)i.strokeStyle=ne(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 zn(e){return(1-Math.cos(xn*e))/2}function Bn(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]=Sn[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 Vn={level:0,bands:[0,0,0]};function Hn(e){mn=requestAnimationFrame(Hn);let t=gn?e-gn:0;if(gn=e,_n){if(vn=!vn,vn)return;e>=bn&&(_n=!1,yn=0)}else t>22?yn?e-yn>500&&(_n=!0,vn=!1,bn=e+4e3):yn=e:yn=0;e-hn<14.666666666666668||(hn=e,pn.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)Bn(t,Vn);else{let e=a.getLevel?Cn(a.getLevel()):0;Vn.level=e,Vn.bands[0]=e,Vn.bands[1]=e*(.72+.28*Math.sin(l*9.1)),Vn.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=En(Vn.level,i.threshold);o.level=Dn(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=En(Vn.bands[e],i.threshold*.6);o.bands[e]=Dn(o.bands[e],t,c,i.attack,i.release*1.15)}let d=Qt*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=Dn(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),ee=i.reducedMotion?.5:.5+.5*Math.sin(xn*l/i.breatheDuration),te=o.level+(1-o.level)*i.idle*ee,D=Math.max(0,Math.min(1,(p-.25)/.75)),O=D*D*(3-2*D),k=Math.max(te,i.processingLevel*O),ne=.15+.85*k,A=.5+i.reach*k,j=(.85+i.spread*k)*E;i.flow!==0&&!i.reducedMotion&&(o.phase=((o.phase+i.flow*k*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 re=i.bend*k;r.style.setProperty(`--vb-bh-${i.id}`,`${Math.max(0,re).toFixed(1)}px`);let ie=i.bend>0?Math.min(1,re/i.bend):0;r.style.setProperty(`--vb-bendA-${i.id}`,ie.toFixed(3));let M={cx:C,w:j,h:A,mw:T,lift:re,strength:ie,level:o.level,corner:p},N=m/2+C*j,P=30*i.scale*j,ae=Nn(i.radius,m,h),oe=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-Pn(N,m,ae,P*1.4)*oe).toFixed(1)}px`),o.warp=Dn(o.warp,i.processing?0:1,c,.35,.06);let se=o.warp,ce=t.displace!=null&&se<.03;if(ce!==t.warpOff&&(t.warpOff=ce,ce?r.setAttribute(`data-voice-warp`,`off`):r.removeAttribute(`data-voice-warp`)),m&&h&&(t.ctx||t.displace)){let e=Fn(i,M,m,h);(t.displace&&!ce||i.coreLight>0)&&In(r,i.id,e,m,h),t.filter&&!ce&&On&&Ln(t,e,h),t.ctx&&Rn(t,M,e)}if(t.displace&&!ce){let e=i.reducedMotion?0:i.distortion*120*i.scale*(.15+.85*k)*se;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}`,ne.toFixed(3)),r.style.setProperty(`--vb-h-${i.id}`,A.toFixed(3)),r.style.setProperty(`--vb-w-${i.id}`,j.toFixed(3));for(let e=0;e<Zt.length;e++){let t=Zt[e],n=wn(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*Tn(n,d)).toFixed(3));let s=m/2+(C+n*w)*j;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-Pn(s,m,ae,P)*oe).toFixed(1)}px`)}let le=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*zn(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${le.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function Un(){mn??=(hn=0,gn=0,yn=0,requestAnimationFrame(Hn))}function Wn(){pn.size===0&&mn!=null&&(cancelAnimationFrame(mn),mn=null)}function Gn(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:fn(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=un(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 pn.add(i),Un(),()=>{var e;pn.delete(i),(e=i.releaseAnalyser)==null||e.call(i),Wn()}}const Kn={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},qn={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}},Jn={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},Yn={default:{},pill:{},mobile:{strength:1}};function Xn(e=`default`,t=`dark`){return(t===`light`?Yn[e]:void 0)??Jn[e]}const Zn={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function Qn(e=`default`,t=`dark`){let n=qn[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)),{...Kn,...r,...n,...t===`light`?Zn[e]:void 0}}const $n={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`}},er=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),tr=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function nr(){let[e,t]=ct(()=>typeof window>`u`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return ut(()=>{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 rr(){let[e,t]=ct(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return ut(()=>{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 ir(e,t){return e===`auto`?t:e}const ar=Dt(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:ee,hueDuration:te,active:D=!0,paused:O=!1,borderRadius:k,brightness:ne,saturation:A,glowSize:j,strokeOpacity:re,innerOpacity:ie,bloomOpacity:M,bend:N,bandStrength:P,bandWidth:ae,bandPosition:oe,bandCurve:se,bandSpread:ce,bandSkew:le,bandOffset:ue,bandTail:F,bandTailPosition:de,bandTailCurve:fe,bandTailOverflow:pe,bandAberration:I,distortion:me,distortionDetail:L,glowWidth:he,glowHeight:ge,lobeSpacing:_e,rangeWidth:ve,rangeHeight:ye,softness:be,coreSize:xe,coreLight:R,coreLightWidth:Se,coreLightHeight:Ce,strokeScale:we,innerScale:Te,innerHeight:Ee,bloomScale:De,bloomHeight:z,strength:Oe,className:ke,style:Ae,css:B,onLevel:V,onActivate:Me,onDeactivate:Ne,onAnimationEnd:Pe,...Fe},Ie){let Le=mt().replace(/:/g,`-`),H=ir(T,nr()),Re=C?C.join(`|`):``,ze=w?[w.core,w.above,w.mid,w.below].join(`|`):``,U=Qn(t,H),W=Math.max(.05,n??U.scale),Be=j??U.glowSize,Ve=re??U.strokeOpacity,He=ie??U.innerOpacity,Ue=M??U.bloomOpacity,We=g??U.processingDuration,Ge=_??U.processingLevel,Ke=v??U.processingTravel,qe=y??U.processingCurve,Je=b??U.cornerFollow,Ye=l??U.idle,Xe=d??U.reach,G=f??U.spread,Ze=(m??U.flow)*W,Qe=(N??U.bend)*W,$e=P??U.bandStrength,et=(ae??U.bandWidth)*W,K=oe??U.bandPosition,tt=se??U.bandCurve,nt=ce??U.bandSpread,rt=le??U.bandSkew,it=(ue??U.bandOffset)*W,at=F??U.bandTail,ot=de??U.bandTailPosition,st=fe??U.bandTailCurve,lt=(pe??U.bandTailOverflow)*W,ht=I??U.bandAberration,gt=me??U.distortion,_t=(L??U.distortionDetail)/W,vt=(he??U.glowWidth)*W,yt=(ge??U.glowHeight)*W,bt=(_e??U.lobeSpacing)*W,xt=(ve??U.rangeWidth)*W,St=(ye??U.rangeHeight)*W,Ct=be??U.softness,wt=(xe??U.coreSize)*W,Tt=Math.max(0,Math.min(3,R??U.coreLight)),Et=Se??U.coreLightWidth,Dt=Ce??U.coreLightHeight,Ot=we??U.strokeScale,kt=Te??U.innerScale,At=Ee??U.innerHeight,jt=De??U.bloomScale,Mt=z??U.bloomHeight,Nt=rr(),Pt=dt(null),[Ft,It]=ct(D),[Lt,Rt]=ct(!1),[zt,Bt]=ct(!0),[Vt,Ht]=ct(null),[Ut,Wt]=ct(0);ut(()=>{if(!er)return;let e=Pt.current;if(!e)return;let t=()=>Wt(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Gt=er&&Ut>6e4?0:gt;ut(()=>{if(k!=null)return;let e=Pt.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&&Ht(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[k,e]),ut(()=>{D&&!Ft&&!Lt?It(!0):!D&&Ft&&!Lt&&Rt(!0)},[D,Ft,Lt]),ut(()=>{let e=Pt.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)Bt(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let Kt=pt(e=>{let t=e.animationName;t.includes(`fade-out`)?(It(!1),Rt(!1),Ne?.()):t.includes(`fade-in`)&&Me?.(),Pe?.(e)},[Me,Ne,Pe]),q=Xt[H],qt=k??Vt??16,Jt=Xn(t,H),Zt=Oe??Jt.strength??q.strength??1,Qt=ee??q.hueRange??24,$t=te??q.hueDuration??12,en=ne??Jt.brightness??q.brightness,tn=A??Jt.saturation??q.saturation,nn=ft(()=>an({id:Le,borderRadius:qt,borderWidth:1,strokeOpacity:q.strokeOpacity*Ve,innerOpacity:q.innerOpacity*He,bloomOpacity:q.bloomOpacity*Ue,innerShadow:q.innerShadow,colorVariant:S,colors:C,brightness:en,saturation:tn,theme:H,hueBase:q.hueBase??0,glowSize:Be*W,glowWidth:vt,glowHeight:yt,strokeScale:Ot,innerScale:kt,innerHeight:At,bloomScale:jt,bloomHeight:Mt,coreSize:wt,coreLight:Tt,coreLightWidth:Et,coreLightHeight:Dt,rangeWidth:xt,rangeHeight:St,softness:Ct,distortion:Gt>0,scale:W}),[Le,qt,q,S,Re,en,tn,H,U,Be,Ve,He,Ue,W,vt,yt,Ot,kt,At,jt,Mt,wt,Tt,Et,Dt,xt,St,Ct,Gt>0]),rn=ft(()=>({id:Le,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,Ye)),breatheDuration:Math.max(.2,u),reach:Math.max(0,Xe),spread:Math.max(0,G),bands:p,flow:Ze,lobeSpacing:Math.max(.1,bt),bend:Math.max(0,Qe),bandStrength:Math.max(0,$e),bandWidth:Math.max(0,et),bandPosition:Math.max(0,K),bandCurve:Math.max(.3,tt),bandSpread:Math.max(.05,nt),bandSkew:Math.max(-.9,Math.min(.9,rt)),bandOffset:it,bandTail:Math.max(0,Math.min(1.5,at)),bandTailPosition:Math.max(0,Math.min(.98,ot)),bandTailCurve:Math.max(.5,st),bandTailOverflow:Math.max(0,lt),bandAberration:Math.max(0,Math.min(1,ht)),rangeWidth:xt,rangeHeight:St,theme:H,bandColors:{core:w?.core&&Yt(w.core)||$n[H].core,above:w?.above&&Yt(w.above)||$n[H].above,mid:w?.mid&&Yt(w.mid)||$n[H].mid,below:w?.below&&Yt(w.below)||$n[H].below},distortion:Math.max(0,Math.min(1,Gt)),coreLight:Tt,scale:W,radius:qt,processing:h,processingDuration:Math.max(.05,We),processingLevel:Math.max(0,Math.min(1,Ge)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,Ke),processingCurve:Math.max(1,qe),cornerFollow:Math.max(0,Math.min(1,Je)),hueRange:Math.max(0,Qt),hueDuration:Math.max(.5,$t),staticColors:S===`mono`?!0:E,reducedMotion:Nt,paused:O}),[Le,a,o,s,c,Ye,u,Xe,G,p,Ze,bt,Qe,$e,et,K,tt,nt,rt,it,at,ot,st,lt,ht,xt,St,H,ze,Gt,Tt,W,qt,h,We,Ge,x,Ke,qe,Je,Qt,$t,E,S,Nt,O]),on=dt(i);on.current=i;let sn=dt(V);sn.current=V,ut(()=>{if(!(Ft||Lt)||!zt)return;let e=Pt.current;return e?Gn(e,rn,{stream:r,getLevel:()=>{let e=on.current;return typeof e==`function`?e():e}},e=>sn.current?.call(sn,e)):void 0},[rn,r,Ft,Lt,zt]);let cn=pt(e=>{Pt.current=e,typeof Ie==`function`?Ie(e):Ie&&(Ie.current=e)},[Ie]),ln={...Ae??{},"--voice-strength":Math.max(0,Math.min(1,Zt))};return J(je,{children:[J(`style`,{children:B?`${nn}
295
- ${B.split(`{id}`).join(Le)}`:nn}),J(`div`,{...Fe,ref:cn,"data-voice-beam":Le,"data-voice-type":t,"data-voice-halfres":``,"data-active":Ft&&!Lt?``:void 0,"data-fading":Lt?``:void 0,"data-paused":Ft&&!Lt&&(!zt||O)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:ke,style:ln,onAnimationEnd:Kt,children:[e,J(`div`,{"data-voice-beam-bloom":!0}),Gt>0&&J(je,{children:[J(`div`,{"data-voice-beam-warp":`inner`}),J(`div`,{"data-voice-beam-warp":`bloom`})]}),!tr&&J(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),J(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),Tt>0&&J(`div`,{"data-voice-beam-core":!0,children:J(`div`,{})}),Gt>0&&J(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:J(`filter`,{id:`vb-distort-${Le}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[J(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*_t).toFixed(4)} ${(.05*_t).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),J(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),J(`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`}),J(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),or=`http://www.w3.org/2000/svg`,Y=Math.PI*2,X=21.5,sr=Math.sqrt(12)*X,cr=154-sr,Z=Sr(),lr=cr+Z.length,ur=.56*Y*X/2,dr=.75,fr=.35,pr=.55,mr=22.5,hr=Tr(.65,0,.35,1),gr=Tr(.4,0,.2,1),_r=Tr(.34,1.56,.64,1),vr=Tr(.2,0,0,1);var yr=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(or,`svg`),this.element.classList.add(`seams-voiceid-ribbon`),this.element.setAttribute(`viewBox`,`0 0 308 64`),this.element.setAttribute(`aria-hidden`,`true`),this.ripple=this.append(e,`circle`,`1.5`),this.track=this.append(e,`circle`,`2`),this.middle=this.append(e,`path`,`1`),this.top=this.append(e,`path`,`2`),this.bottom=this.append(e,`path`,`2`),this.seal=this.append(e,`circle`,`0`),this.seal.setAttribute(`fill`,`currentColor`),this.seal.setAttribute(`stroke`,`none`),this.check=this.append(e,`path`,`2.6`),this.check.classList.add(`seams-voiceid-ribbon-check`),this.check.setAttribute(`d`,`M161 26.8 151.4 36.3 147.1 32`),this.check.setAttribute(`stroke-linejoin`,`round`),this.check.setAttribute(`pathLength`,`1`),this.check.setAttribute(`stroke-dasharray`,`1`);for(let e of[this.ripple,this.track,this.seal])e.setAttribute(`cx`,`154`),e.setAttribute(`cy`,`32`);if(this.track.setAttribute(`r`,`21.5`),t===`segments`){this.element.dataset.seamsProgressLine=``;for(let[e,t]of[this.top,this.middle,this.bottom].entries())t.dataset.seamsProgressSegment=String(e)}for(let t=3;t>=0;--t)this.lines.push(this.append(e,`path`,t===0?`1`:`0.65`));this.paint(performance.now())}readLevel=()=>this.level;setPhase(e){if(e===`processing`&&this.stage.kind===`line`){let e=Math.max(this.level,this.idleAmplitude(performance.now()));this.stage={kind:this.checking===`segments`?`segments`:`capture`,startedAt:performance.now(),amplitude:e}}else e!==`processing`&&(this.stage={kind:`line`},this.settle());this.phase=e,this.target=0,this.element.dataset.phase=e,this.wake()}succeed(e){if(this.stopped||this.stage.kind===`sealed`)return Promise.resolve();this.stage.kind===`line`&&this.setPhase(`processing`);let t=new Promise(this.awaitSuccess);return this.successBegun=e,this.stage.kind===`spin`&&this.beginSuccess(performance.now()),this.wake(),t}add(e){if(this.phase!==`listening`||this.stopped)return;let t=Math.max(0,e.rms-.003);this.target=(t/(t+.055))**.65*(e.speech?1:.15),this.element.dataset.speech=String(e.speech),this.wake()}dispose(){this.stopped=!0,cancelAnimationFrame(this.frame),this.frame=0,this.level=0,this.target=0,this.settle()}awaitSuccess=e=>{this.settle(),this.settleSuccess=e};settle(){let e=this.settleSuccess;this.settleSuccess=null,this.successBegun=null,e?.()}append(e,t,n){let r=e.createElementNS(or,t);return r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,n),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`vector-effect`,`non-scaling-stroke`),r.setAttribute(`opacity`,`0`),this.element.append(r),r}wake(){!this.stopped&&this.frame===0&&(this.previousTime=performance.now(),this.frame=requestAnimationFrame(this.draw))}draw=e=>{if(this.frame=0,this.stopped)return;let t=Math.min(50,Math.max(0,e-this.previousTime));this.previousTime=e,this.level+=(this.target-this.level)*(1-Math.exp(-t/(this.target>this.level?55:200))),this.motion.matches||(this.position+=t*(.0012+this.level*.003)),this.paint(e),!this.element.isConnected||this.stage.kind===`sealed`||this.stage.kind===`line`&&this.phase===`idle`&&this.level<=.001||(this.frame=requestAnimationFrame(this.draw))};idleAmplitude(e){return this.phase!==`listening`||this.motion.matches?0:.085*(.72+.28*Math.sin(e/2600*Y))}paint(e){for(let e of[this.ripple,this.track,this.middle,this.top,this.bottom,this.seal,this.check])e.setAttribute(`opacity`,`0`);for(let e of this.lines)e.setAttribute(`opacity`,`0`);switch(this.stage.kind){case`line`:this.paintLine(Math.max(this.level,this.idleAmplitude(e)));return;case`capture`:this.paintCapture(e,this.stage);return;case`segments`:this.paintSegments(e,this.stage);return;case`spin`:this.paintArc(this.spinnerArc(e,this.stage),1);return;case`success`:this.paintSuccess(e,this.stage);return;case`sealed`:this.paintSeal({start:0,sweep:Y},1,1);return}}paintLine(e){for(let t=0;t<this.lines.length;t+=1){let n=3-t;this.lines[t].setAttribute(`d`,this.linePath(n,e,0,308,1)),this.lines[t].setAttribute(`opacity`,String(n===0?pr+e*.4:.1+e*.1))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-vr(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:vr(Q(r/200))),a=(308-2*i)/3;for(let[e,t]of[this.top,this.middle,this.bottom].entries()){let n=e*(a+i);t.setAttribute(`d`,`M${n.toFixed(2)} 32H${(n+a).toFixed(2)}`),t.setAttribute(`stroke-width`,`1`),t.setAttribute(`opacity`,this.segmentOpacity(r,e))}}segmentOpacity(e,t){if(this.motion.matches)return`0.8`;let n=.5+.5*Math.cos(Y*(e-t*150)/900);return $(pr,fr+(1-fr)*n,vr(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-vr(Q(n/150)),o=hr(Q(i/.6)),s=br(!1)*X*560,c=wr(i,lr,s),l=cr+wr(i,lr+ur-cr,s),u=pr+r*.4;for(let[e,t]of[[this.top,!1],[this.bottom,!0]])e.setAttribute(`d`,this.halfPath(c,l,t,r,a)),e.setAttribute(`stroke-width`,$(1,2,o).toFixed(2)),e.setAttribute(`opacity`,$(u,1,o).toFixed(3));this.middle.setAttribute(`d`,this.linePath(0,r,cr,308-cr,a)),this.middle.setAttribute(`opacity`,(u*(1-vr(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+br(!1)*t,i=ur/X,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+dr*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-Y*.14},this.settleSuccess&&this.beginSuccess(e),this.paint(e);return}this.track.setAttribute(`opacity`,`0.1`);for(let[e,t]of[[this.top,o],[this.bottom,r+Math.PI-(1-dr)*a*n]])e.setAttribute(`d`,Cr({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=gr(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+br(this.motion.matches)*n-Y*c/100,sweep:Y*s/100}}beginSuccess(e){if(this.stage.kind!==`spin`)return;this.stage={kind:`success`,startedAt:e,from:this.spinnerArc(e,this.stage)};let t=this.successBegun;this.successBegun=null,t?.()}paintSuccess(e,t){let n=e-t.startedAt;if(n>=1140){this.stage={kind:`sealed`},this.settle(),this.paint(e);return}let r=Q(n/650),i=this.motion.matches?0:br(!1)*650*(r-r*r/2),a=hr(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,Y,a)},_r(Q((n-600)/420)),hr(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=vr(o);this.ripple.setAttribute(`r`,$(mr,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`,(mr*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`,Cr(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=xr(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 br(e){return Y/(e?3200:1800)}function xr(e){if(e<=cr)return{x:e,y:32,onLine:!0};if(e<lr){let t=e-cr,n=0,r=Z.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Z.lengths[e]<t?n=e:r=e}let i=(t-Z.lengths[n])/(Z.lengths[r]-Z.lengths[n]||1);return{x:$(Z.points[n][0],Z.points[r][0],i),y:$(Z.points[n][1],Z.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-lr)/X;return{x:154+X*Math.cos(t),y:32+X*Math.sin(t),onLine:!1}}function Sr(){let e=[[cr,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[cr+sr*i,32-X*(4*i**3-3*i**4)],o=e[e.length-1];n+=Math.hypot(a[0]-o[0],a[1]-o[1]),e.push(a),t.push(n)}return{points:e,lengths:t,length:n}}function Cr(e){let t=Math.max(2,Math.ceil(80*e.sweep/Y)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+X*Math.cos(i),o=32+X*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function wr(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Tr(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 Er=ar;var Dr=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,r){this.prompt=t,this.ribbon=new yr(e,r),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 i=n();if(i)for(let e of this.glow.querySelectorAll(`style`))e.nonce=i;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`)}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(),Ye(null,this.glow))}setPhase(e){this.disposed||(this.phase=e,this.ribbon.setPhase(e),this.render())}render=()=>{this.disposed||Ye(ke(Er,{className:`seams-voiceid-beam`,theme:(this.prompt.closest(`[data-theme]`)?.getAttribute(`data-theme`)??this.prompt.ownerDocument.documentElement.getAttribute(`data-theme`))===`light`?`light`:`dark`,level:this.ribbon.readLevel,processing:this.phase===`processing`,active:this.phase!==`idle`,staticColors:!0,colorVariant:`ocean`,borderRadius:Number.parseFloat(getComputedStyle(this.prompt).borderRadius)||16,children:null}),this.glow)}};const Or=new WeakMap,kr=new Map([[`if you panic panic early`,`if you panic, panic early`],[`life is short go long to hedge`,`life is short, go long to hedge`]]);var Ar=class{element;title;phrase;status;record;cancel;progress;visual;disposed=!1;constructor(e,r,i,a=`ring`){let o=Or.get(e);o||(o=t({doc:e,baseCss:`
296
- .seams-voiceid-activation-surface { width: min(100%, 26.25rem); margin: 0 auto; background: transparent; }
297
-
298
- .seams-voiceid-prompt {
299
- box-sizing: border-box;
300
- position: relative;
301
- width: min(100%, 26.25rem);
302
- margin: 0 auto;
303
- padding: 3.5rem 1.5rem 1.5rem;
304
- display: grid;
305
- grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 5rem;
306
- border: 1px solid var(--seams-colors-borderPrimary, #303b41);
307
- border-radius: var(--seams-shape-card, 16px);
308
- background: var(--seams-colors-colorBackground, #192024);
309
- color: var(--seams-colors-textPrimary, #eff2f3);
310
- text-align: center;
311
- font-family: var(--seams-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
312
- -webkit-font-smoothing: antialiased;
313
- }
314
- .seams-voiceid-prompt {
315
- transition: opacity 180ms var(--seams-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 180ms var(--seams-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
316
- }
317
- @starting-style {
318
- .seams-voiceid-prompt { opacity: 0; transform: translateY(4px); }
319
- }
320
- .seams-voiceid-progress-slot { grid-row: 5; grid-column: 1; min-width: 0; align-self: center; }
321
- .seams-voiceid-progress-slot:empty { visibility: hidden; }
322
- .seams-voiceid-activation-surface[data-preparation="loading"] .seams-voiceid-record-slot { visibility: hidden; }
323
- @media (prefers-reduced-motion: reduce) {
324
- .seams-voiceid-prompt { transform: none; transition: opacity 150ms ease; }
325
- @starting-style { .seams-voiceid-prompt { transform: none; } }
326
- .seams-voiceid-ribbon { transition: none !important; }
327
- }
328
- .seams-voiceid-prompt h2 {
329
- font-size: 0.85rem;
330
- line-height: 1.4;
331
- font-weight: 500;
332
- color: var(--seams-colors-textSecondary, #9cabb3);
333
- margin: 0.5rem 0 1rem;
334
- }
335
- .seams-voiceid-prompt.seams-voiceid-management {
336
- display: flex;
337
- flex-direction: column;
338
- gap: 0.75rem;
339
- padding: 1.25rem 1.25rem 1.375rem;
340
- border-radius: var(--seams-shape-card, 1.5rem);
341
- text-align: start;
342
- font-size: 0.875rem;
343
- line-height: 1.5;
344
- }
345
- .seams-voiceid-management-header {
346
- display: flex;
347
- align-items: center;
348
- gap: 0.25rem;
349
- margin-inline-start: -0.5rem;
350
- }
351
- .seams-voiceid-management h2 {
352
- margin: 0;
353
- color: var(--seams-colors-textPrimary, #eff2f3);
354
- font-size: 1.375rem;
355
- font-weight: 600;
356
- letter-spacing: -0.02em;
357
- line-height: 1.25;
358
- }
359
- .seams-voiceid-management .seams-voiceid-management-intro {
360
- margin: -0.125rem 0 0.25rem;
361
- color: var(--seams-colors-textSecondary, #9cabb3);
362
- }
363
- .seams-voiceid-management button {
364
- appearance: none;
365
- margin: 0;
366
- color: var(--seams-colors-textPrimary, #eff2f3);
367
- font: inherit;
368
- transition: background-color 140ms ease;
369
- }
370
- .seams-voiceid-management button:disabled { opacity: 0.5; cursor: default; }
371
- .seams-voiceid-management .seams-voiceid-management-back {
372
- display: grid;
373
- place-items: center;
374
- width: 2.25rem;
375
- height: 2.25rem;
376
- padding: 0;
377
- border: 0;
378
- border-radius: var(--seams-shape-control, 10px);
379
- background: transparent;
380
- }
381
- .seams-voiceid-management-enrollment {
382
- display: grid;
383
- grid-template-columns: minmax(0, 1fr) auto;
384
- align-items: center;
385
- gap: 0.125rem 0.75rem;
386
- padding: 0.75rem 0.875rem;
387
- border-radius: 0.75rem;
388
- background: var(--seams-colors-surface, #202b31);
389
- color: var(--seams-colors-textSecondary, #9cabb3);
390
- }
391
- .seams-voiceid-management-summary { text-align: end; }
392
- .seams-voiceid-management-value { color: var(--seams-colors-textPrimary, #eff2f3); font-weight: 500; }
393
- .seams-voiceid-management-enrollment-detail:not(:empty)::before { content: ' · '; }
394
- .seams-voiceid-management-enrollment[data-enrollment="adapted"] > .seams-voiceid-management-summary {
395
- grid-area: 2 / 1;
396
- text-align: start;
397
- font-size: 0.8125rem;
398
- }
399
- .seams-voiceid-management-enrollment > .seams-voiceid-management-reset { grid-area: 1 / 2 / 3; }
400
- .seams-voiceid-management-enrollment[data-state] .seams-voiceid-management-value { display: none; }
401
- .seams-voiceid-management-enrollment[data-state] .seams-voiceid-management-enrollment-detail::before { content: none; }
402
- .seams-voiceid-management .seams-voiceid-management-reset {
403
- padding: 0.375rem 0.75rem;
404
- border: 1px solid var(--seams-colors-borderPrimary, #303b41);
405
- border-radius: var(--seams-shape-control, 10px);
406
- background: transparent;
407
- font-size: 0.8125rem;
408
- font-weight: 600;
409
- }
410
- .seams-voiceid-management .seams-voiceid-management-action {
411
- display: grid;
412
- grid-template-columns: minmax(0, 1fr) auto;
413
- align-items: center;
414
- gap: 0.75rem;
415
- width: 100%;
416
- min-height: 44px;
417
- padding: 0.75rem 0.875rem;
418
- border: 1px solid var(--seams-colors-borderPrimary, #303b41);
419
- border-radius: 0.75rem;
420
- background: transparent;
421
- text-align: start;
422
- }
423
- .seams-voiceid-management-action > svg { color: var(--seams-colors-textSecondary, #9cabb3); }
424
- .seams-voiceid-management-action-heading {
425
- display: flex;
426
- flex-wrap: wrap;
427
- align-items: center;
428
- gap: 0.25rem 0.5rem;
429
- font-weight: 600;
430
- }
431
- .seams-voiceid-management-chip {
432
- padding: 0.125rem 0.5rem;
433
- border-radius: 6px;
434
- background: color-mix(in srgb, var(--seams-colors-textPrimary, #eff2f3), transparent 93%);
435
- font-size: 0.75rem;
436
- font-weight: 500;
437
- }
438
- .seams-voiceid-management-action-detail {
439
- display: block;
440
- margin-top: 0.125rem;
441
- color: var(--seams-colors-textSecondary, #9cabb3);
442
- font-size: 0.8125rem;
443
- }
444
- .seams-voiceid-management .seams-voiceid-management-action[data-state="pending"] {
445
- opacity: 1;
446
- border-color: var(--seams-colors-borderHover, #46545b);
447
- background: var(--seams-colors-surface, #202b31);
448
- }
449
- .seams-voiceid-management-action[data-state="pending"] > svg { visibility: hidden; }
450
- .seams-voiceid-management [data-state="pending"] .seams-voiceid-management-action-detail,
451
- .seams-voiceid-management [data-state="pending"] .seams-voiceid-management-enrollment-detail {
452
- color: var(--seams-colors-textPrimary, #eff2f3);
453
- }
454
- .seams-voiceid-management [data-state="error"] .seams-voiceid-management-action-detail,
455
- .seams-voiceid-management [data-state="error"] .seams-voiceid-management-enrollment-detail {
456
- color: var(--seams-colors-error, oklch(0.74 0.166 19));
457
- }
458
- .seams-voiceid-management .seams-voiceid-management-section {
459
- margin: 0.5rem 0 -0.25rem;
460
- padding-inline-start: 0.125rem;
461
- color: var(--seams-colors-textSecondary, #9cabb3);
462
- font-size: 0.6875rem;
463
- font-weight: 600;
464
- letter-spacing: 0.08em;
465
- text-transform: uppercase;
466
- }
467
- /* The status line is read by assistive technology; a message for a hidden row is also shown. */
468
- .seams-voiceid-prompt.seams-voiceid-management > [role="status"] {
469
- position: absolute;
470
- width: 1px;
471
- height: 1px;
472
- margin: -1px;
473
- overflow: hidden;
474
- clip-path: inset(50%);
475
- white-space: nowrap;
476
- }
477
- .seams-voiceid-prompt.seams-voiceid-management > [role="status"][data-placement="dialog"] {
478
- position: relative;
479
- width: auto;
480
- height: auto;
481
- margin: 0;
482
- overflow: visible;
483
- clip-path: none;
484
- white-space: normal;
485
- color: var(--seams-colors-error, oklch(0.74 0.166 19));
486
- font-size: 0.8125rem;
487
- overflow-wrap: anywhere;
488
- }
489
- [dir='rtl'] .seams-voiceid-management svg { transform: scaleX(-1); }
490
- @media (hover: hover) {
491
- .seams-voiceid-management button:hover:not(:disabled) {
492
- background: var(--seams-colors-surface2, var(--seams-colors-surface, #202b31));
493
- }
494
- }
495
- .seams-voiceid-prompt .seams-voiceid-phrase {
496
- font-size: clamp(1.75rem, 6vw, 2.25rem);
497
- font-weight: 600;
498
- line-height: 1.17;
499
- letter-spacing: -0.035em;
500
- text-wrap: balance;
501
- max-width: 21rem;
502
- align-self: center;
503
- margin: 0 auto;
504
- }
505
- .seams-voiceid-ribbon {
506
- display: block;
507
- width: 308px;
508
- max-width: 100%;
509
- height: 64px;
510
- margin: auto;
511
- overflow: visible;
512
- }
513
- .seams-voiceid-ribbon .seams-voiceid-ribbon-check { stroke: var(--seams-colors-colorBackground, #192024); }
514
- .seams-voiceid-prompt .seams-voiceid-phrase.seams-voiceid-success-headline {
515
- display: grid;
516
- align-content: end;
517
- font-size: 18px;
518
- letter-spacing: normal;
519
- line-height: 1.4;
520
- }
521
- .seams-voiceid-prompt .seams-voiceid-status.seams-voiceid-success-message { font-size: 0.8125rem; }
522
- /* The glow is decorative and cannot intercept record, retry or cancel controls. */
523
- .seams-voiceid-glow { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 0; }
524
- .seams-voiceid-beam { width: 100%; height: 100%; border-radius: inherit; }
525
- .seams-voiceid-prompt > :not(.seams-voiceid-glow) { position: relative; z-index: 1; }
526
- .seams-voiceid-prompt > .seams-voiceid-close { position: absolute; }
527
- .seams-voiceid-prompt .seams-voiceid-status {
528
- font-size: 0.75rem;
529
- line-height: 1.5;
530
- min-height: 3.375rem;
531
- color: var(--seams-colors-textSecondary, #9cabb3);
532
- margin: 0;
533
- }
534
- .seams-voiceid-prompt button {
535
- font: inherit;
536
- cursor: pointer;
537
- touch-action: manipulation;
538
- }
539
- .seams-voiceid-prompt button:focus-visible {
540
- outline: 2px solid currentColor;
541
- outline-offset: 2px;
542
- }
543
- .seams-voiceid-prompt .seams-voiceid-close {
544
- position: absolute;
545
- right: 0.75rem;
546
- top: 0.75rem;
547
- width: 2.5rem;
548
- height: 2.5rem;
549
- background: transparent;
550
- border: 0;
551
- border-radius: var(--seams-shape-control, 10px);
552
- color: inherit;
553
- display: grid;
554
- place-items: center;
555
- color: var(--seams-colors-textSecondary, #9cabb3);
556
- }
557
- .seams-voiceid-prompt .seams-voiceid-record-slot {
558
- grid-row: 5;
559
- grid-column: 1;
560
- align-self: center;
561
- width: 100%;
562
- box-sizing: border-box;
563
- }
564
- .seams-voiceid-prompt .seams-voiceid-primary {
565
- width: 100%;
566
- min-height: var(--seams-shape-controlHeight, 44px);
567
- padding: 0.75rem 1rem;
568
- font-size: 0.875rem;
569
- font-weight: 500;
570
- border: 0;
571
- border-radius: var(--seams-shape-control, 10px);
572
- background: var(--seams-colors-textPrimary, #eff2f3);
573
- color: var(--seams-colors-colorBackground, #192024);
574
- }
575
- .seams-voiceid-prompt .seams-voiceid-primary:disabled {
576
- opacity: 0.5;
577
- cursor: wait;
578
- }
579
- .seams-voiceid-prompt button[hidden],
580
- .seams-voiceid-prompt [hidden] {
581
- display: none !important;
582
- }
583
- .seams-voiceid-prompt .seams-voiceid-model-download {
584
- font-size: 0.75rem;
585
- line-height: 1.5;
586
- }
587
- .seams-voiceid-prompt .seams-voiceid-model-download progress {
588
- appearance: none;
589
- display: block;
590
- width: 100%;
591
- height: 4px;
592
- border: 0;
593
- border-radius: 2px;
594
- overflow: hidden;
595
- background: var(--seams-colors-surface, #202b31);
596
- accent-color: var(--seams-colors-textPrimary, #eff2f3);
597
- }
598
- .seams-voiceid-model-download p { margin: 0 0 0.75rem; color: var(--seams-colors-textSecondary, #9cabb3); font-variant-numeric: tabular-nums; }
599
- .seams-voiceid-model-download progress::-webkit-progress-bar { background: var(--seams-colors-surface, #202b31); }
600
- .seams-voiceid-model-download progress::-webkit-progress-value { background: var(--seams-colors-textPrimary, #eff2f3); border-radius: 2px; }
601
- .seams-voiceid-model-download progress::-moz-progress-bar { background: var(--seams-colors-textPrimary, #eff2f3); }
602
- @media (hover: hover) and (pointer: fine) {
603
- .seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
604
- .seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
605
- }
606
- `,nonce:n}),Or.set(e,o)),o.ensureBase(),this.element=e.createElement(`section`),this.element.className=`seams-voiceid-prompt`,this.element.setAttribute(`aria-label`,r),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(i),this.visual=new Dr(e,this.element,a),this.status=e.createElement(`p`),this.status.className=`seams-voiceid-status`,this.status.setAttribute(`role`,`status`),this.record=e.createElement(`button`),this.record.type=`button`,this.record.className=`seams-voiceid-primary`,this.record.textContent=`Record`,this.cancel=e.createElement(`button`),this.cancel.type=`button`,this.cancel.className=`seams-voiceid-close`;let s=e.createElementNS(`http://www.w3.org/2000/svg`,`svg`);s.setAttribute(`viewBox`,`0 0 24 24`),s.setAttribute(`width`,`20`),s.setAttribute(`height`,`20`),s.setAttribute(`aria-hidden`,`true`);let c=e.createElementNS(`http://www.w3.org/2000/svg`,`path`);c.setAttribute(`d`,`M6 6l12 12M18 6L6 18`),c.setAttribute(`fill`,`none`),c.setAttribute(`stroke`,`currentColor`),c.setAttribute(`stroke-width`,`1.75`),c.setAttribute(`stroke-linecap`,`round`),s.append(c),this.cancel.append(s),this.cancel.setAttribute(`aria-label`,`Cancel`),this.progress=e.createElement(`div`),this.progress.className=`seams-voiceid-progress-slot`;let l=e.createElement(`div`);l.className=`seams-voiceid-record-slot`,l.append(this.record),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,l,this.progress)}setPhrase(e){let t=kr.get(e)??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`listening`:delete this.status.dataset.voiceCaptureQuality,this.element.dataset.capture=`listening`,this.record.hidden=!0,this.status.textContent=`Listening`,this.visual.listen();return;case`activity`:this.visual.add(e);return;case`measured`:{let t=e.quality;this.status.dataset.voiceCaptureQuality=JSON.stringify(t),t.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.status.textContent=`Checking your voice…`;return;default:return Ir(e)}};accepted(){this.visual.accept()}async succeed(e,t,n=this.element.getBoundingClientRect()){this.disposed||(this.element.dataset.capture=`succeeded`,this.record.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}dispose(){this.disposed=!0,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(Pr)),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`,Fr(t,a,Mr-jr+e*Nr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const jr=150,Mr=450,Nr=40;function Pr(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function Fr(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 Ir(e){throw Error(`Unexpected capture event: ${String(e)}`)}export{r as _,ce as a,ie as c,ne as d,h as f,o as g,s as h,M as i,A as l,f as m,Ye as n,se as o,m as p,ke as r,oe as s,Ar as t,D as u};