@seams/voiceid 0.26.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.
- package/README.md +19 -1
- package/dist/esm/browser/microphoneInput.js +13 -0
- package/dist/esm/capture/prompt.js +41 -2
- package/dist/public/sdk/voiceid/{addVoiceId-Bz9BDPI4.js → addVoiceId-DOpYRrar.js} +1 -1
- package/dist/public/sdk/voiceid/approval-DNlI4I0d.js +1 -0
- package/dist/public/sdk/voiceid/{deviceBridge-DDviNxL6.js → deviceBridge-L6ZKqifG.js} +1 -1
- package/dist/public/sdk/voiceid/enrollment-Cs7Tzcho.js +1 -0
- package/dist/public/sdk/voiceid/host.js +2 -2
- package/dist/public/sdk/voiceid/prompt-g_wE9gYv.js +614 -0
- package/dist/public/sdk/voiceid/{unlock-CGnhhdt4.js → unlock-B9WYZcqy.js} +1 -1
- package/dist/types/browser/inference.d.ts +5 -0
- package/dist/types/browser/microphone.d.ts +6 -6
- package/dist/types/browser/microphoneInput.d.ts +27 -0
- package/dist/types/browser/progress.d.ts +1 -1
- package/dist/types/capture/approval.d.ts +1 -0
- package/dist/types/capture/prompt.d.ts +4 -0
- package/dist/types/host.d.ts +1 -1
- package/package.json +2 -2
- package/dist/public/sdk/voiceid/approval-CME3DxNc.js +0 -1
- package/dist/public/sdk/voiceid/enrollment-D8oQnM_e.js +0 -1
- package/dist/public/sdk/voiceid/prompt-DEkI70F2.js +0 -606
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import{IndexedDBManager as e,WorkerDeferred as t,createCspStylesheetManager as n,getDefaultCspNonce as r,isPlainObject as i}from"../voiceid-host.js";var a=class extends Error{constructor(e){super(o(e)),this.name=`VoiceSpeakerMismatchError`}};function o(e){return e.microphoneSelection===`replacement`?`Your microphone changed to ${e.microphone}. Reconnect your usual microphone or try again.`: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.`}const s=3e4;var c=class extends Error{constructor(e,t,n){super(t,n),this.kind=e,this.name=`VoiceIdLoadError`}};async function l(){try{return await caches.open(`seams-voiceid-models-v1`)}catch{return null}}var u=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{path:e,sha256:t}=this.asset;this.publish({kind:`checking_cache`});let n=await l(),r=new URL(`${e}?sha256=${t}`,location.origin).href;try{let e=await n?.match(r);if(e){let t=await e.arrayBuffer();if(await this.valid(t))return t;await n?.delete(r)}}catch{}let i;try{i=await this.fetchBytes()}catch(e){if(!(e instanceof c)||e.kind!==`connection`)throw e;i=await this.fetchBytes()}if(n)try{await n.put(r,new Response(i,{headers:{"Content-Type":`application/octet-stream`}}))}catch{}return i}async fetchBytes(){let{label:e,path:t}=this.asset,n=new AbortController,r=setTimeout(d.bind(null,n),s);this.publish({kind:`downloading`,received:0});try{let i=await fetch(t,{credentials:`omit`,cache:`reload`,signal:n.signal});if(!i.ok||!i.body){let t=[408,429,500,502,503,504].includes(i.status);throw new c(t?`connection`:`unavailable`,t?`${e} download was interrupted. Check your connection and retry.`:`${e} is unavailable from this Wallet. Reload the page or use a passkey.`)}let a=i.body.getReader(),o=new Uint8Array(this.asset.bytes),l=0;try{for(;;){let t=await a.read();if(t.done)break;if(clearTimeout(r),r=setTimeout(d.bind(null,n),s),l+t.value.length>o.length)throw new c(`integrity`,`${e} size is invalid. Retry loading.`);o.set(t.value,l),l+=t.value.length,this.publish({kind:`downloading`,received:l})}}finally{await a.cancel().catch(f),a.releaseLock()}if(l!==o.length||!await this.valid(o.buffer))throw new c(`integrity`,`${e} integrity check failed. Retry loading.`);return o.buffer}catch(t){throw t instanceof c?t:new c(`connection`,`${e} download was interrupted. Check your connection and retry.`,{cause:t})}finally{clearTimeout(r),n.abort()}}};function d(e){e.abort()}function f(){}const p=new u({path:`/sdk/voiceid/ort-wasm-simd-threaded.wasm`,sha256:`3398c10d07d229bd91b364548e130e0e51a8e5704b88c7c083ebbeb78842dee2`,bytes:14239897,label:`VoiceID engine`});var m=class{asset;session=null;constructor(e){this.asset=new u(e)}prepare(){return this.session||=this.load().catch(this.failed),this.session}failed=e=>{throw this.session=null,e};async load(){try{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 p.download();let t=await this.asset.download();return await e.InferenceSession.create(t,{executionProviders:[`wasm`]})}catch(e){throw e instanceof c?e:new c(`initialization`,`VoiceID could not start. Retry loading. If it still fails, reload the page or use a passkey.`,{cause:e})}}};const h=`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(`.`),g={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`]},_=[...h,...g.sale,...g.purchase,...g.swap,...g.transfer],v=`.<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(`.`),y=new m({path:`/sdk/voiceid/aurora-int8.onnx`,sha256:`83ed6f3856458cd96d49a70d8c5175aeec18ba8c184e5367e089cd424eebefd6`,bytes:1342384,label:`Phrase recognition`});let b=null;function x(e){return w(h,e)}function S(e,t){switch(e.kind){case`random`:return x(t);case`action`:return w(g[e.action],t);default:return C(e)}}function C(e){throw Error(`Unexpected voice confirmation: ${String(e)}`)}function w(e,t){let n=e.filter(T.bind(null,t)),r=n.filter(T.bind(null,b)),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 b=o,o}function T(e,t){return t!==e}const E=new Map([[`sea`,`see`],[`here`,`hear`],[`meat`,`meet`],[`whether`,`weather`],[`son`,`sun`],[`wood`,`would`],[`two`,`to`],[`too`,`to`],[`eye`,`i`]]),ee=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 te(e){return e.toLowerCase().replace(/’/g,`'`).match(/[a-z0-9]+(?:'[a-z]+)?/g)??[]}function D(e){return e!==`a`&&e!==`an`&&e!==`the`}function O(e){return E.get(e)??e}function k(e){return e.filter(D).map(O).join(` `)}function ne(e){return ee.has(e)}function A(e,t){let n=Array.from({length:t.length+1},j);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 j(e,t){return t}function re(e){let t=te(e),n=k(t);if(!n)return{kind:`empty`};let r=_[0],i=1/0,a=1/0;for(let e of _){let t=k(te(e)),o=A(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(ne).join(` `)!==te(r).filter(ne).join(` `))return{kind:`uncertain`,candidate:r,difference:i,margin:o,decodedText:e,reason:`negated`};let s=te(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 ie=class extends Error{constructor(){super(`The phrase was not clear. Try the new phrase at your normal pace.`),this.name=`VoicePhraseMismatchError`}};function M(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`}:re(n.map(N).join(``).replace(/▁/g,` `).trim().replace(/\s+/g,` `))}function N(e){return v[e]}async function P(e,t){let n=await y.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=M(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 ae=new m({path:`/sdk/voiceid/silero-vad.onnx`,sha256:`2623a2953f6ff3d2c1e61740c6cdb7168133479b267dfef114a4a3cc5bdd788f`,bytes:2327524,label:`Speech detection`});async function oe(){return new se(await ae.prepare(),await import(`./ort.wasm.bundle.min-7y-hlRN8.js`))}var se=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)}};const F=`voiceid-microphone-v1`;let ce={kind:`unread`};function le(e){return typeof e==`string`&&e.length>0&&e!==`default`&&e!==`communications`}async function ue(){if(ce.kind!==`unread`)return ce;let t={kind:`system_default`};try{let n=await e.getAppState(F);i(n)&&n.kind===`device`&&le(n.deviceId)&&(t={kind:`device`,deviceId:n.deviceId})}catch{}return ce.kind===`unread`&&(ce=t),ce}function de(e){let t={channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0};return e.kind===`device`&&(t.deviceId={exact:e.deviceId}),{audio:t,video:!1}}async function fe(e){if(le(e.deviceId))return{kind:`device`,deviceId:e.deviceId};if(e.groupId)try{let t=await navigator.mediaDevices.enumerateDevices();for(let n of t)if(n.kind===`audioinput`&&n.groupId===e.groupId&&le(n.deviceId))return{kind:`device`,deviceId:n.deviceId}}catch{}return{kind:`system_default`}}async function pe(e){e.throwIfAborted();let t=await ue();e.throwIfAborted();let n,r=t.kind===`device`?`preferred`:`default`;try{n=await navigator.mediaDevices.getUserMedia(de(t))}catch(i){if(e.throwIfAborted(),t.kind!==`device`||!(i instanceof DOMException)||i.name!==`OverconstrainedError`&&i.name!==`NotFoundError`)throw i;n=await navigator.mediaDevices.getUserMedia(de({kind:`system_default`})),r=`replacement`}let i=me.bind(null,n);e.addEventListener(`abort`,i,{once:!0});try{e.throwIfAborted();let t=n.getAudioTracks()[0];if(!t||t.readyState!==`live`)throw new I;let i=t.getSettings(),a=await fe(i);if(e.throwIfAborted(),t.readyState!==`live`)throw new I;return{stream:n,preference:a,selection:r,label:t.label||`Default microphone`,processing:{noiseSuppression:i.noiseSuppression??null,echoCancellation:i.echoCancellation??null,autoGainControl:i.autoGainControl??null,sampleRate:i.sampleRate??null}}}catch(e){throw i(),e}finally{e.removeEventListener(`abort`,i)}}function me(e){for(let t of e.getTracks())t.stop()}async function he(e){e.preference.kind!==`device`||e.selection===`replacement`||await _e(e.preference)}async function ge(){await _e({kind:`system_default`})}async function _e(t){ce=t;try{await e.setAppState(F,t)}catch{}}var I=class extends Error{constructor(){super(`The microphone disconnected or stopped. Check your microphone and try again.`),this.name=`VoiceMicrophoneInterruptedError`}};function ve(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 ye=class extends Error{constructor(e){super(ve(e)),this.quality=e,this.name=`InsufficientVoiceAudioError`}};const be=16e3,xe=.006,Se=8e3;function Ce(){if(we(),!navigator.userActivation.isActive)throw Error(`Open the Wallet and select Record to use VoiceID.`)}function we(){if(document.visibilityState!==`visible`||!document.hasFocus())throw Error(`Keep the Wallet open and focused to use VoiceID.`)}async function Te(e,t){if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let n=crypto.randomUUID();t({kind:`opening`});let r=await pe(e),{stream:i}=r;try{if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let a=await new Ee(i,e,t).result.finally(t.bind(null,{kind:`processing`}));if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let o=await new OfflineAudioContext(1,be,be).decodeAudioData(a.bytes),s=new OfflineAudioContext(1,Math.ceil(o.duration*be),be),c=s.createBufferSource();c.buffer=o,c.connect(s.destination),c.start();try{let i=await s.startRendering();try{if(e.aborted)throw Error(`VoiceID recording was cancelled.`);let o=i.getChannelData(0),s=await De(o,e),c={attemptId:n,capturedAtMs:Date.now(),durationMs:i.duration*1e3,recordingMs:a.recordingMs,endedBy:a.endedBy,voicedMs:s.voicedMs,peakFrameRms:s.peakFrameRms,levelThreshold:xe,requiredVoicedMs:600,microphone:r.label,microphoneSelection:r.selection,processing:r.processing,backgroundRms:s.backgroundRms,speechToBackgroundDb:s.speechToBackgroundDb,noise:s.noise};if(t({kind:`measured`,quality:c}),s.kind===`insufficient_audio`)return{kind:`insufficient_audio`,quality:c};let l=o.slice(Math.max(0,s.first-3200),Math.min(o.length,s.last+3200));return await he(r),e.aborted&&(l.fill(0),e.throwIfAborted()),{kind:`captured`,samples:l,quality:c}}finally{Oe(i)}}finally{Oe(o)}}finally{for(let e of i.getTracks())e.stop()}}var Ee=class{recorder;chunks=[];timer=null;completion=new t;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);for(let t of e.getAudioTracks())t.addEventListener(`ended`,this.interrupted),t.addEventListener(`mute`,this.interrupted);t.addEventListener(`abort`,this.cancelled,{once:!0}),this.timer=setTimeout(this.startupFailed,Se),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`),Se),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.`))};interrupted=()=>{this.cleanup(),this.completion.reject(new I)};stopped=()=>{let e=this.ended;if(this.cleanup(),this.signal.aborted){this.completion.reject(Error(`VoiceID recording was cancelled.`));return}if(e===null){this.completion.reject(new I);return}new Blob(this.chunks,{type:this.recorder.mimeType}).arrayBuffer().then(this.complete.bind(this,e),this.completion.reject.bind(this.completion))};complete=(e,t)=>{if(this.signal.aborted){this.completion.reject(Error(`VoiceID recording was cancelled.`));return}this.completion.resolve({bytes:t,recordingMs:e.recordingMs,endedBy:e.endedBy})};async startPauseDetection(){let e=new AudioContext({sampleRate:be});this.audioContext=e;let t=e.resume();if(this.detector=await oe(),this.signal.throwIfAborted(),e.sampleRate!==be)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>=xe;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 Ae(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(ke)};stopTracks(){for(let e of this.stream.getTracks())e.stop()}cleanup(){for(let e of this.stream.getAudioTracks())e.removeEventListener(`ended`,this.interrupted),e.removeEventListener(`mute`,this.interrupted);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 De(e,t){let n=await oe(),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>=xe)){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>=xe&&(p===null||p<10)?`high`:c?`normal`:`unknown`},h=a/be*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 Oe(e){for(let t=0;t<e.numberOfChannels;t+=1)e.getChannelData(t).fill(0)}function ke(){}function Ae(e){throw Error(`Unexpected speech activity: ${String(e)}`)}var je,L,Me,R,Ne,Pe,Fe,Ie,Le,z,Re,B,ze,Be,V={},H=[],Ve=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,He=Array.isArray;function U(e,t){for(var n in t)e[n]=t[n];return e}function Ue(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function We(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?je.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 Ge(e,o,r,i,null)}function Ge(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&&L.vnode!=null&&L.vnode(a),a}function Ke(e){return e.children}function W(e,t){this.props=e,this.context=t}function qe(e,t){if(t==null)return e.__?qe(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`?qe(e):null}function Je(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=U({},t);a.__v=t.__v+1,L.vnode&&L.vnode(a),ot(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??qe(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ct(r,a,i),t.__e=t.__=null,a.__e!=n&&Ye(a)}}function Ye(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}),Ye(e)}function Xe(e){(!e.__d&&(e.__d=!0)&&R.push(e)&&!Ze.__r++||Ne!=L.debounceRendering)&&((Ne=L.debounceRendering)||Pe)(Ze)}function Ze(){try{for(var e,t=1;R.length;)R.length>t&&R.sort(Fe),e=R.shift(),t=R.length,Je(e)}finally{R.length=Ze.__r=0}}function Qe(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||H,v=t.length;for(c=$e(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||V,p.__i=d,g=ot(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&dt(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=et(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 $e(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]=Ge(null,o,null,null,null):He(o)?o=e.__k[a]=Ge(Ke,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=Ge(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=nt(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=qe(s)),ft(s,s));return r}function et(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=et(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qe(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function tt(e,t){return t||=[],e==null||typeof e==`boolean`||(He(e)?e.some(function(e){tt(e,t)}):t.push(e)),t}function nt(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 rt(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||Ve.test(t)?n:n+`px`}function it(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||rt(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||rt(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Re,`$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[z]=r[z]:(n[z]=B,e.addEventListener(t,a?Be:ze,a)):e.removeEventListener(t,a?Be:ze,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 at(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Le]==null)t[Le]=B++;else if(t[Le]<n[z])return;return n(L.event?L.event(t):t)}}}function ot(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=L.__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 W(v,x),f.constructor=E,f.render=pt),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=U({},f.__s)),U(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)}),H.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=qe(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=L.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),H.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=U(U({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===Ke&&u.key==null?lt(u.props.children):u,s=Qe(e,He(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--;)Ue(a[T])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||st(t),L.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ut(n.__e,t,n,r,i,a,o,c,l);return(u=L.diffed)&&u(t),128&t.__u?void 0:s}function st(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(st))}function ct(e,t,n){for(var r=0;r<n.length;r++)dt(n[r],n[++r],n[++r]);L.__c&&L.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){L.__e(e,t.__v)}})}function lt(e){return typeof e!=`object`||!e||e.__b>0?e:He(e)?e.map(lt):e.constructor===void 0?U({},e):null}function ut(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||V,_=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&&=(L.__m&&L.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&je.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 _||it(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||it(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=``),Qe(t.type==`template`?e.content:e,He(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&qe(n,0),s,c),a!=null)for(l=a.length;l--;)Ue(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])&&it(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&it(e,l,h,g[l],i))}return e}function dt(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){L.__e(e,n)}}function ft(e,t,n){var r,i;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||dt(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){L.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ft(r[i],t,n||typeof e.type!=`function`);n||Ue(e.__e),e.__c=e.__=e.__e=void 0}function pt(e,t,n){return this.constructor(e,n)}function mt(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),L.__&&L.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],ot(t,e=(!r&&n||t).__k=We(Ke,null,[e]),i||V,V,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?je.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ct(a,e,o),e.props.children=null}je=H.slice,L={__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,W.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=U({},this.state);typeof e==`function`&&(e=e(U({},n),this.props)),e&&U(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xe(this))},W.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xe(this))},W.prototype.render=Ke,R=[],Pe=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fe=function(e,t){return e.__v.__b-t.__v.__b},Ze.__r=0,Ie=Math.random().toString(8),Le=`__d`+Ie,z=`__a`+Ie,Re=/(PointerCapture)$|Capture$/i,B=0,ze=at(!1),Be=at(!0);var ht,G,gt,_t,vt=0,yt=[],K=L,bt=K.__b,xt=K.__r,St=K.diffed,Ct=K.__c,wt=K.unmount,Tt=K.__;function Et(e,t){K.__h&&K.__h(G,e,vt||t),vt=0;var n=G.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Dt(e){return vt=1,Ot(zt,e)}function Ot(e,t,n){var r=Et(ht++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):zt(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 kt(e,t){var n=Et(ht++,3);!K.__s&&Rt(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function At(e){return vt=5,jt(function(){return{current:e}},[])}function jt(e,t){var n=Et(ht++,7);return Rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Mt(e,t){return vt=8,jt(function(){return e},t)}function Nt(){var e=Et(ht++,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 Pt(){for(var e;e=yt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(q),t.__h.some(Lt),t.__h=[]}catch(n){t.__h=[],K.__e(n,e.__v)}}}K.__b=function(e){G=null,bt&&bt(e)},K.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Tt&&Tt(e,t)},K.__r=function(e){xt&&xt(e),ht=0;var t=(G=e.__c).__H;t&&(gt===G?(t.__h=[],G.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(q),t.__h.some(Lt),t.__h=[],ht=0)),gt=G},K.diffed=function(e){St&&St(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yt.push(t)!==1&&_t===K.requestAnimationFrame||((_t=K.requestAnimationFrame)||It)(Pt)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),gt=G=null},K.__c=function(e,t){t.some(function(e){try{e.__h.some(q),e.__h=e.__h.filter(function(e){return!e.__||Lt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],K.__e(n,e.__v)}}),Ct&&Ct(e,t)},K.unmount=function(e){wt&&wt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{q(e)}catch(e){t=e}}),n.__H=void 0,t&&K.__e(t,n.__v))};var Ft=typeof requestAnimationFrame==`function`;function It(e){var t,n=function(){clearTimeout(r),Ft&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ft&&(t=requestAnimationFrame(n))}function q(e){var t=G,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),G=t}function Lt(e){var t=G;e.__c=e.__(),G=t}function Rt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function zt(e,t){return typeof t==`function`?t(e):t}function Bt(e,t){for(var n in t)e[n]=t[n];return e}function Vt(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 Ht(e,t){this.props=e,this.context=t}(Ht.prototype=new W).isPureReactComponent=!0,Ht.prototype.shouldComponentUpdate=function(e,t){return Vt(this.props,e)||Vt(this.state,t)};var Ut=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ut&&Ut(e)};var Wt=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function Gt(e){function t(t){var n=Bt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Wt,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var J=L.__e;L.__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)}J(e,t,n,r)};var Kt=L.unmount;function qt(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=Bt({},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 qt(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 Yt(){this.__u=0,this.o=null,this.__b=null}function Xt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Zt(){this.i=null,this.l=null}L.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)},(Yt.prototype=new W).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Xt(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)},Yt.prototype.componentWillUnmount=function(){this.o=[]},Yt.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]=qt(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&We(Ke,null,e.fallback);return i&&(i.__u&=-33),[We(Ke,null,t.__a?null:e.children),i]};var Qt=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]}};(Zt.prototype=new W).__a=function(e){var t=this,n=Xt(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Qt(t,e,r)):i()};n?n(a):a()}},Zt.prototype.render=function(e){this.i=null,this.l=new Map;var t=tt(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},Zt.prototype.componentDidUpdate=Zt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Qt(e,n,t)})};var $t=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,en=/^(?: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]/,tn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,nn=/[A-Z0-9]/g,rn=typeof document<`u`,an=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};W.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(W.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var on=L.event;L.event=function(e){return on&&(e=on(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var sn={configurable:!0,get:function(){return this.class}},cn=L.vnode;L.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||rn&&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`||an(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:tn.test(a)&&(a=s):s=a=`oninput`:i&&en.test(a)?a=a.replace(nn,`-$&`).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=tt(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=tt(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`,sn)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=$t,cn&&cn(e)};var ln=L.__r;L.__r=function(e){ln&&ln(e),e.__c};var un=L.diffed;L.diffed=function(e){un&&un(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 dn=0;Array.isArray;function Y(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:--dn,__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 L.vnode&&L.vnode(l),l}function fn(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 pn(e){let t=fn(e);return t?`rgb(${t[0]}, ${t[1]}, ${t[2]})`:null}function mn(e){let t=fn(e);return t?`${t[0]}, ${t[1]}, ${t[2]}`:null}const hn={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}},gn=[{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}],_n=36*gn.length,vn={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 yn(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 bn(e,t=1){return Math.max(.5,Math.round(e*t*100)/100)}function xn(e,t){return`calc(50% + (var(--vb-cx-${t}) + var(--vb-x${e}-${t})) * var(--vb-w-${t}) * var(--vb-z-${t}, 1))`}function Sn({id:e,colors:t,alpha:n,sw:r,sh:i,y:a,fade:o,count:s}){return(s?gn.slice(0,s):gn).map((s,c)=>{let l=n>=1?t[c%t.length]:yn(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 ${xn(c,e)} ${f}, ${l} 0%, transparent ${o}%)`}).join(`,
|
|
2
|
+
`)}function Cn(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=vn[c][ae?`dark`:`light`].map((e,t)=>{let n=l?.[t];return n&&pn(n)||e}),se=c===`mono`?.6:1,F=(i*se).toFixed(2),ce=(a*se).toFixed(2),le=(o*se).toFixed(2),ue=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})`:``,me=`filter: ${fe} brightness(${ue}) saturate(${de});`,he=`filter: ${fe} brightness(${ue}) saturate(${de})${pe};`,ge=`filter: blur(${P(bn(10,m))}) ${fe} brightness(${ue}) saturate(${de});`,_e=`filter: blur(${P(bn(10,m))}) ${fe} brightness(${ue}) saturate(${de})${pe};`,I=`calc(50% + var(--vb-cx-${t}) * var(--vb-w-${t}) * ${N})`,ve=`calc(100% + (2px + var(--vb-cy-${t})) * ${N})`,ye=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 ${I} ${ve}, 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 ${I} ${ve}, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.22) 35%, transparent 70%)`,be=Sn({id:t,colors:oe,alpha:1,sw:re(_),sh:ie(_),y:2,fade:j}),xe=Sn({id:t,colors:oe,alpha:.46,sw:re(.9*v),sh:ie(.9*v*y),y:0,fade:j}),Se=Sn({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)}),Ce=(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 ${I} 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%)`,we=(e,n)=>`opacity: calc(var(--vb-opacity-${t}, 1) * var(--vb-glow-${t}) * ${n} * var(--voice-${e}-opacity, 1) * var(--voice-strength, 1));`,Te=(e,t,r,i)=>`${e} {
|
|
3
|
+
${t}
|
|
4
|
+
position: absolute;
|
|
5
|
+
inset: 0;
|
|
6
|
+
border-radius: ${P(n)};
|
|
7
|
+
background: ${xe};
|
|
8
|
+
box-shadow: inset 0 0 ${P(ne)} 1px ${s};
|
|
9
|
+
-webkit-mask-image:
|
|
10
|
+
${Ce(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
|
+
${Ce(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
|
+
${we(`inner`,ce)}
|
|
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
|
+
${gn.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
|
+
${ye},
|
|
75
|
+
${be};
|
|
76
|
+
-webkit-mask:
|
|
77
|
+
${Ce(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
|
+
${Ce(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
|
+
${we(`stroke`,F)}
|
|
93
|
+
${me}
|
|
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
|
+
${Te(`[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);`,me)}
|
|
102
|
+
${D?Te(`[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));`,he):``}
|
|
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: ${Ce(200,130,35)};
|
|
123
|
+
mask: ${Ce(200,130,35)};
|
|
124
|
+
background: ${Se};
|
|
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
|
+
${we(`bloom`,le)}
|
|
133
|
+
${ge}
|
|
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
|
+
${we(`bloom`,le)}
|
|
141
|
+
${_e}
|
|
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(bn(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 ${I} 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(${ue}) 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(${ue}) 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 wn=null;function Tn(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function En(){let e=Tn();return e?(wn||=new e,wn.state===`suspended`&&wn.resume().catch(()=>{}),wn):null}const Dn=new WeakMap;function On(e){let t=En();if(!t||e.getAudioTracks().length===0)return null;let n=Dn.get(e);n||(n={node:t.createMediaStreamSource(e),refs:0},Dn.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{}Dn.delete(e)}}}}}const kn=new WeakMap;function An(e){let t=kn.get(e);return t||(t={level:0,bands:[0,0,0],phase:0,scanA:0,scanT:0,t:0,lastTs:0,warp:1},kn.set(e,t)),t}const jn=new Set;let Mn=null,Nn=0,Pn=0,Fn=!1,In=!1,Ln=0,Rn=0;const zn=Math.PI*2,Bn=[[80,300],[300,2e3],[2e3,6e3]];function Vn(e){return e<0?0:e>1?1:e}function Hn(e,t){let n=t/2;return((e+n)%t+t)%t-n}function Un(e,t){let n=e/(t/2+4);return Math.max(0,1-n*n)}function Wn(e,t){if(e<=t)return 0;let n=(e-t)/Math.max(.001,1-t);return Vn((1-Math.exp(-3*n))/(1-Math.exp(-3)))}function Gn(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 Kn=!(typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent)),qn=.05,Jn=.1;function Yn(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 Xn(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 Zn(e,t,n){return Math.max(0,Math.min(e,t/2,n/2))}function Qn(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 $n(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,_=Yn(d,e.bandCurve,e.bandSpread,e.bandSkew)+Xn(Math.abs(l-i),g,u,e.bandTailPosition,e.bandTailCurve),v=t.corner>0?Qn(l,n,Zn(e.radius,n,r))*t.corner:0;h.push([l,c-s*_-v])}return h}function er(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 tr(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/qn)*qn));if(i===e.filterTop)return;e.filterTop=i;let a=1+Math.max(.1,12/n),o=e.filter;o.setAttribute(`x`,`${-Jn*100}%`),o.setAttribute(`width`,`${(1+2*Jn)*100}%`),o.setAttribute(`y`,`${(i*100).toFixed(0)}%`),o.setAttribute(`height`,`${((a-i)*100).toFixed(1)}%`)}function nr(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 rr(e){return(1-Math.cos(zn*e))/2}function ir(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]=Bn[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 ar={level:0,bands:[0,0,0]};function or(e){Mn=requestAnimationFrame(or);let t=Pn?e-Pn:0;if(Pn=e,Fn){if(In=!In,In)return;e>=Rn&&(Fn=!1,Ln=0)}else t>22?Ln?e-Ln>500&&(Fn=!0,In=!1,Rn=e+4e3):Ln=e:Ln=0;e-Nn<14.666666666666668||(Nn=e,jn.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)ir(t,ar);else{let e=a.getLevel?Vn(a.getLevel()):0;ar.level=e,ar.bands[0]=e,ar.bands[1]=e*(.72+.28*Math.sin(l*9.1)),ar.bands[2]=e*(.6+.4*Math.sin(l*13.7+2))}let u=Wn(ar.level,i.threshold);o.level=Gn(o.level,u,c,i.attack,i.release);for(let e=0;e<3;e++){let t=Wn(ar.bands[e],i.threshold*.6);o.bands[e]=Gn(o.bands[e],t,c,i.attack,i.release*1.15)}let d=_n*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=Gn(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(zn*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=Zn(i.radius,m,h),oe=p*i.cornerFollow;r.style.setProperty(`--vb-cy-${i.id}`,`${(-Qn(N,m,ae,P*1.4)*oe).toFixed(1)}px`),o.warp=Gn(o.warp,i.processing?0:1,c,.35,.06);let se=o.warp,F=t.displace!=null&&se<.03;if(F!==t.warpOff&&(t.warpOff=F,F?r.setAttribute(`data-voice-warp`,`off`):r.removeAttribute(`data-voice-warp`)),m&&h&&(t.ctx||t.displace)){let e=$n(i,M,m,h);(t.displace&&!F||i.coreLight>0)&&er(r,i.id,e,m,h),t.filter&&!F&&Kn&&tr(t,e,h),t.ctx&&nr(t,M,e)}if(t.displace&&!F){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<gn.length;e++){let t=gn[e],n=Hn(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*Un(n,d)).toFixed(3));let s=m/2+(C+n*w)*j;r.style.setProperty(`--vb-y${e}-${i.id}`,`${(-Qn(s,m,ae,P)*oe).toFixed(1)}px`)}let ce=i.staticColors||i.reducedMotion||i.hueRange===0?0:-i.hueRange+2*i.hueRange*rr(l/i.hueDuration);r.style.setProperty(`--vb-hue-${i.id}`,`${ce.toFixed(2)}deg`),(n=t.onLevel)==null||n.call(t,o.level),t.paintedConfig=i}))}function sr(){Mn??=(Nn=0,Pn=0,Ln=0,requestAnimationFrame(or))}function cr(){jn.size===0&&Mn!=null&&(cancelAnimationFrame(Mn),Mn=null)}function lr(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:An(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=On(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 jn.add(i),sr(),()=>{var e;jn.delete(i),(e=i.releaseAnalyser)==null||e.call(i),cr()}}const ur={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},dr={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}},fr={default:{brightness:1.15},pill:{brightness:1.35,saturation:1.5},mobile:{strength:1,brightness:1.2,saturation:1.5}},pr={default:{},pill:{},mobile:{strength:1}};function mr(e=`default`,t=`dark`){return(t===`light`?pr[e]:void 0)??fr[e]}const hr={default:{bandStrength:1.7},pill:{bandStrength:2},mobile:{bandStrength:1.7}};function gr(e=`default`,t=`dark`){let n=dr[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)),{...ur,...r,...n,...t===`light`?hr[e]:void 0}}const _r={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`}},vr=typeof navigator<`u`&&/AppleWebKit/.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\/|OPR\//.test(navigator.userAgent),yr=(()=>{if(typeof document>`u`)return!0;let e=document.createElement(`canvas`).getContext(`2d`);return!!e&&typeof e.filter==`string`})();function br(){let[e,t]=Dt(()=>typeof window>`u`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return kt(()=>{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 xr(){let[e,t]=Dt(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return kt(()=>{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 Sr(e,t){return e===`auto`?t:e}const Cr=Gt(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:F,bandSkew:ce,bandOffset:le,bandTail:ue,bandTailPosition:de,bandTailCurve:fe,bandTailOverflow:pe,bandAberration:me,distortion:he,distortionDetail:ge,glowWidth:_e,glowHeight:I,lobeSpacing:ve,rangeWidth:ye,rangeHeight:be,softness:xe,coreSize:Se,coreLight:Ce,coreLightWidth:we,coreLightHeight:Te,strokeScale:Ee,innerScale:De,innerHeight:Oe,bloomScale:ke,bloomHeight:Ae,strength:je,className:L,style:Me,css:R,onLevel:Ne,onActivate:Pe,onDeactivate:Fe,onAnimationEnd:Ie,...Le},z){let Re=Nt().replace(/:/g,`-`),B=Sr(T,br()),ze=C?C.join(`|`):``,Be=w?[w.core,w.above,w.mid,w.below].join(`|`):``,V=gr(t,B),H=Math.max(.05,n??V.scale),Ve=j??V.glowSize,He=re??V.strokeOpacity,U=ie??V.innerOpacity,Ue=M??V.bloomOpacity,We=g??V.processingDuration,Ge=_??V.processingLevel,W=v??V.processingTravel,qe=y??V.processingCurve,Je=b??V.cornerFollow,Ye=l??V.idle,Xe=d??V.reach,Ze=f??V.spread,Qe=(m??V.flow)*H,$e=(N??V.bend)*H,et=P??V.bandStrength,tt=(ae??V.bandWidth)*H,nt=oe??V.bandPosition,rt=se??V.bandCurve,it=F??V.bandSpread,at=ce??V.bandSkew,ot=(le??V.bandOffset)*H,st=ue??V.bandTail,ct=de??V.bandTailPosition,lt=fe??V.bandTailCurve,ut=(pe??V.bandTailOverflow)*H,dt=me??V.bandAberration,ft=he??V.distortion,pt=(ge??V.distortionDetail)/H,mt=(_e??V.glowWidth)*H,ht=(I??V.glowHeight)*H,G=(ve??V.lobeSpacing)*H,gt=(ye??V.rangeWidth)*H,_t=(be??V.rangeHeight)*H,vt=xe??V.softness,yt=(Se??V.coreSize)*H,K=Math.max(0,Math.min(3,Ce??V.coreLight)),bt=we??V.coreLightWidth,xt=Te??V.coreLightHeight,St=Ee??V.strokeScale,Ct=De??V.innerScale,wt=Oe??V.innerHeight,Tt=ke??V.bloomScale,Et=Ae??V.bloomHeight,Ot=xr(),Pt=At(null),[Ft,It]=Dt(D),[q,Lt]=Dt(!1),[Rt,zt]=Dt(!0),[Bt,Vt]=Dt(null),[Ht,Ut]=Dt(0);kt(()=>{if(!vr)return;let e=Pt.current;if(!e)return;let t=()=>Ut(e.clientWidth*e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let Wt=vr&&Ht>6e4?0:ft;kt(()=>{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&&Vt(r)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!1}),()=>n.disconnect()},[k,e]),kt(()=>{D&&!Ft&&!q?It(!0):!D&&Ft&&!q&&Lt(!0)},[D,Ft,q]),kt(()=>{let e=Pt.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{for(let t of e)zt(t.isIntersecting)},{rootMargin:`256px`});return t.observe(e),()=>t.disconnect()},[]);let Gt=Mt(e=>{let t=e.animationName;t.includes(`fade-out`)?(It(!1),Lt(!1),Fe?.()):t.includes(`fade-in`)&&Pe?.(),Ie?.(e)},[Pe,Fe,Ie]),J=hn[B],Kt=k??Bt??16,qt=mr(t,B),Jt=je??qt.strength??J.strength??1,Yt=ee??J.hueRange??24,Xt=te??J.hueDuration??12,Zt=ne??qt.brightness??J.brightness,Qt=A??qt.saturation??J.saturation,$t=jt(()=>Cn({id:Re,borderRadius:Kt,borderWidth:1,strokeOpacity:J.strokeOpacity*He,innerOpacity:J.innerOpacity*U,bloomOpacity:J.bloomOpacity*Ue,innerShadow:J.innerShadow,colorVariant:S,colors:C,brightness:Zt,saturation:Qt,theme:B,hueBase:J.hueBase??0,glowSize:Ve*H,glowWidth:mt,glowHeight:ht,strokeScale:St,innerScale:Ct,innerHeight:wt,bloomScale:Tt,bloomHeight:Et,coreSize:yt,coreLight:K,coreLightWidth:bt,coreLightHeight:xt,rangeWidth:gt,rangeHeight:_t,softness:vt,distortion:Wt>0,scale:H}),[Re,Kt,J,S,ze,Zt,Qt,B,V,Ve,He,U,Ue,H,mt,ht,St,Ct,wt,Tt,Et,yt,K,bt,xt,gt,_t,vt,Wt>0]),en=jt(()=>({id:Re,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,Ze),bands:p,flow:Qe,lobeSpacing:Math.max(.1,G),bend:Math.max(0,$e),bandStrength:Math.max(0,et),bandWidth:Math.max(0,tt),bandPosition:Math.max(0,nt),bandCurve:Math.max(.3,rt),bandSpread:Math.max(.05,it),bandSkew:Math.max(-.9,Math.min(.9,at)),bandOffset:ot,bandTail:Math.max(0,Math.min(1.5,st)),bandTailPosition:Math.max(0,Math.min(.98,ct)),bandTailCurve:Math.max(.5,lt),bandTailOverflow:Math.max(0,ut),bandAberration:Math.max(0,Math.min(1,dt)),rangeWidth:gt,rangeHeight:_t,theme:B,bandColors:{core:w?.core&&mn(w.core)||_r[B].core,above:w?.above&&mn(w.above)||_r[B].above,mid:w?.mid&&mn(w.mid)||_r[B].mid,below:w?.below&&mn(w.below)||_r[B].below},distortion:Math.max(0,Math.min(1,Wt)),coreLight:K,scale:H,radius:Kt,processing:h,processingDuration:Math.max(.05,We),processingLevel:Math.max(0,Math.min(1,Ge)),processingEase:Math.max(.05,x),processingTravel:Math.max(0,W),processingCurve:Math.max(1,qe),cornerFollow:Math.max(0,Math.min(1,Je)),hueRange:Math.max(0,Yt),hueDuration:Math.max(.5,Xt),staticColors:S===`mono`?!0:E,reducedMotion:Ot,paused:O}),[Re,a,o,s,c,Ye,u,Xe,Ze,p,Qe,G,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,gt,_t,B,Be,Wt,K,H,Kt,h,We,Ge,x,W,qe,Je,Yt,Xt,E,S,Ot,O]),tn=At(i);tn.current=i;let nn=At(Ne);nn.current=Ne,kt(()=>{if(!(Ft||q)||!Rt)return;let e=Pt.current;return e?lr(e,en,{stream:r,getLevel:()=>{let e=tn.current;return typeof e==`function`?e():e}},e=>nn.current?.call(nn,e)):void 0},[en,r,Ft,q,Rt]);let rn=Mt(e=>{Pt.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]),an={...Me??{},"--voice-strength":Math.max(0,Math.min(1,Jt))};return Y(Ke,{children:[Y(`style`,{children:R?`${$t}
|
|
295
|
+
${R.split(`{id}`).join(Re)}`:$t}),Y(`div`,{...Le,ref:rn,"data-voice-beam":Re,"data-voice-type":t,"data-voice-halfres":``,"data-active":Ft&&!q?``:void 0,"data-fading":q?``:void 0,"data-paused":Ft&&!q&&(!Rt||O)?``:void 0,"data-listening":r?``:void 0,"data-processing":h?``:void 0,className:L,style:an,onAnimationEnd:Gt,children:[e,Y(`div`,{"data-voice-beam-bloom":!0}),Wt>0&&Y(Ke,{children:[Y(`div`,{"data-voice-beam-warp":`inner`}),Y(`div`,{"data-voice-beam-warp":`bloom`})]}),!yr&&Y(`canvas`,{"data-voice-beam-band-halo":!0,"aria-hidden":`true`}),Y(`canvas`,{"data-voice-beam-band":!0,"aria-hidden":`true`}),K>0&&Y(`div`,{"data-voice-beam-core":!0,children:Y(`div`,{})}),Wt>0&&Y(`svg`,{"aria-hidden":`true`,width:`0`,height:`0`,style:{position:`absolute`,pointerEvents:`none`},children:Y(`filter`,{id:`vb-distort-${Re}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,colorInterpolationFilters:`sRGB`,children:[Y(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`${(.012*pt).toFixed(4)} ${(.05*pt).toFixed(4)}`,numOctaves:2,seed:7,result:`noise`}),Y(`feOffset`,{in:`noise`,dx:`0`,dy:`0`,result:`moved`}),Y(`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`}),Y(`feDisplacementMap`,{in:`SourceGraphic`,in2:`map`,scale:0,xChannelSelector:`R`,yChannelSelector:`G`})]})})]})]})}),wr=`http://www.w3.org/2000/svg`,X=Math.PI*2,Z=21.5,Tr=Math.sqrt(12)*Z,Er=154-Tr,Dr=Vr(),Or=Er+Dr.length,kr=.56*X*Z/2,Ar=.75,jr=.35,Mr=.55,Nr=22.5,Pr=Wr(.65,0,.35,1),Fr=Wr(.4,0,.2,1),Ir=Wr(.34,1.56,.64,1),Lr=Wr(.2,0,0,1);var Rr=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(wr,`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(wr,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*X))}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:X},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?Mr+e*.4:.1+e*.1))}}paintSegments(e,t){let n=e-t.startedAt;if(!this.motion.matches&&n<200){this.paintLine(t.amplitude*(1-Lr(n/200)));return}let r=n-200,i=8*(this.motion.matches?1:Lr(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(X*(e-t*150)/900);return $(Mr,jr+(1-jr)*n,Lr(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-Lr(Q(n/150)),o=Pr(Q(i/.6)),s=zr(!1)*Z*560,c=Ur(i,Or,s),l=Er+Ur(i,Or+kr-Er,s),u=Mr+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,Er,308-Er,a)),this.middle.setAttribute(`opacity`,(u*(1-Lr(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+zr(!1)*t,i=kr/Z,a=Math.PI-i,o=this.motion.matches?-Math.PI/2:r+Ar*a*n;if(this.motion.matches||t>=360){this.stage={kind:`spin`,startedAt:e,base:o-X*.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-Ar)*a*n]])e.setAttribute(`d`,Hr({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=Fr(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+zr(this.motion.matches)*n-X*c/100,sweep:X*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:zr(!1)*650*(r-r*r/2),a=Pr(Q((n-150)/500));this.paintSeal({start:t.from.start+i,sweep:$(t.from.sweep,X,a)},Ir(Q((n-600)/420)),Pr(Q((n-820)/320)));let o=Q((n-700)/700);if(!this.motion.matches&&o>0&&o<1){let e=Lr(o);this.ripple.setAttribute(`r`,$(Nr,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`,(Nr*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`,Hr(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=Br(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 zr(e){return X/(e?3200:1800)}function Br(e){if(e<=Er)return{x:e,y:32,onLine:!0};if(e<Or){let t=e-Er,n=0,r=Dr.lengths.length-1;for(;r-n>1;){let e=n+r>>1;Dr.lengths[e]<t?n=e:r=e}let i=(t-Dr.lengths[n])/(Dr.lengths[r]-Dr.lengths[n]||1);return{x:$(Dr.points[n][0],Dr.points[r][0],i),y:$(Dr.points[n][1],Dr.points[r][1],i),onLine:!1}}let t=-Math.PI/2+(e-Or)/Z;return{x:154+Z*Math.cos(t),y:32+Z*Math.sin(t),onLine:!1}}function Vr(){let e=[[Er,32]],t=[0],n=0;for(let r=1;r<=240;r+=1){let i=r/240,a=[Er+Tr*i,32-Z*(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 Hr(e){let t=Math.max(2,Math.ceil(80*e.sweep/X)),n=``;for(let r=0;r<=t;r+=1){let i=e.start+e.sweep*r/t,a=154+Z*Math.cos(i),o=32+Z*Math.sin(i);n+=`${r===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)} `}return n}function Ur(e,t,n){let r=e*e;return t*(3*r-2*r*e)+n*(r*e-r)}function Wr(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 Gr=Cr;var Kr=class{element;glow;ribbon;prompt;themeObserver;phase=`idle`;disposed=!1;constructor(e,t,n){this.prompt=t,this.ribbon=new Rr(e,n),this.element=this.ribbon.element,this.glow=e.createElement(`div`),this.glow.className=`seams-voiceid-glow`,this.glow.setAttribute(`aria-hidden`,`true`),this.render();let i=r();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(),mt(null,this.glow))}setPhase(e){this.disposed||(this.phase=e,this.ribbon.setPhase(e),this.render())}render=()=>{this.disposed||mt(We(Gr,{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 qr=new WeakMap,Jr=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 Yr=class{element;title;phrase;status;record;cancel;progress;microphone;microphoneRequested=!1;visual;disposed=!1;constructor(e,t,i,a=`ring`){let o=qr.get(e);o||(o=n({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) minmax(5rem, auto);
|
|
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 .seams-voiceid-microphone {
|
|
580
|
+
margin-top: 0.5rem;
|
|
581
|
+
padding: 0.25rem;
|
|
582
|
+
border: 0;
|
|
583
|
+
background: transparent;
|
|
584
|
+
color: var(--seams-colors-textSecondary, #9cabb3);
|
|
585
|
+
font-size: 0.75rem;
|
|
586
|
+
}
|
|
587
|
+
.seams-voiceid-prompt button[hidden],
|
|
588
|
+
.seams-voiceid-prompt [hidden] {
|
|
589
|
+
display: none !important;
|
|
590
|
+
}
|
|
591
|
+
.seams-voiceid-prompt .seams-voiceid-model-download {
|
|
592
|
+
font-size: 0.75rem;
|
|
593
|
+
line-height: 1.5;
|
|
594
|
+
}
|
|
595
|
+
.seams-voiceid-prompt .seams-voiceid-model-download progress {
|
|
596
|
+
appearance: none;
|
|
597
|
+
display: block;
|
|
598
|
+
width: 100%;
|
|
599
|
+
height: 4px;
|
|
600
|
+
border: 0;
|
|
601
|
+
border-radius: 2px;
|
|
602
|
+
overflow: hidden;
|
|
603
|
+
background: var(--seams-colors-surface, #202b31);
|
|
604
|
+
accent-color: var(--seams-colors-textPrimary, #eff2f3);
|
|
605
|
+
}
|
|
606
|
+
.seams-voiceid-model-download p { margin: 0 0 0.75rem; color: var(--seams-colors-textSecondary, #9cabb3); font-variant-numeric: tabular-nums; }
|
|
607
|
+
.seams-voiceid-model-download progress::-webkit-progress-bar { background: var(--seams-colors-surface, #202b31); }
|
|
608
|
+
.seams-voiceid-model-download progress::-webkit-progress-value { background: var(--seams-colors-textPrimary, #eff2f3); border-radius: 2px; }
|
|
609
|
+
.seams-voiceid-model-download progress::-moz-progress-bar { background: var(--seams-colors-textPrimary, #eff2f3); }
|
|
610
|
+
@media (hover: hover) and (pointer: fine) {
|
|
611
|
+
.seams-voiceid-close:hover { background: var(--seams-colors-surface, #202b31); }
|
|
612
|
+
.seams-voiceid-primary:hover:not(:disabled) { opacity: 0.9; }
|
|
613
|
+
}
|
|
614
|
+
`,nonce:r}),qr.set(e,o)),o.ensureBase(),this.element=e.createElement(`section`),this.element.className=`seams-voiceid-prompt`,this.element.setAttribute(`aria-label`,t),this.title=e.createElement(`h2`),this.title.textContent=`Read aloud`,this.phrase=e.createElement(`p`),this.phrase.className=`seams-voiceid-phrase`,this.phrase.dataset.voiceidPhrase=``,this.phrase.setAttribute(`aria-live`,`polite`),this.setPhrase(i),this.visual=new Kr(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`,this.microphone=e.createElement(`button`),this.microphone.type=`button`,this.microphone.className=`seams-voiceid-microphone`,this.microphone.textContent=`Use system microphone`,this.microphone.hidden=!0,this.microphone.addEventListener(`click`,this.changeMicrophone),l.append(this.record,this.microphone),this.element.append(this.visual.glow,this.cancel,this.title,this.phrase,this.visual.element,this.status,l,this.progress)}setPhrase(e){let t=Jr.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`opening`:this.microphoneRequested=!0,this.microphone.hidden=!0;return;case`listening`:this.microphone.hidden=!0,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 ti(e)}};accepted(){this.visual.accept()}async succeed(e,t,n=this.element.getBoundingClientRect()){this.disposed||(this.element.dataset.capture=`succeeded`,this.record.hidden=!0,this.microphone.hidden=!0,await this.visual.succeed(this.beginSuccess.bind(this,e,t,n)))}ready(e){this.unlockLayout(),this.visual.ready(),this.element.dataset.capture=`ready`,this.status.textContent=e,this.record.hidden=!1,this.record.disabled=!1,this.microphone.hidden=!this.microphoneRequested}changeMicrophone=()=>{this.useSystemMicrophone()};async useSystemMicrophone(){this.record.disabled=!0,this.microphone.disabled=!0,await ge(),!this.disposed&&(this.status.textContent=`The next recording will use your system microphone.`,this.record.disabled=!1,this.microphone.disabled=!1,this.microphone.hidden=!0,this.record.focus())}dispose(){this.disposed=!0,this.microphone.removeEventListener(`click`,this.changeMicrophone),this.visual.stop()}lockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=`${e.getBoundingClientRect().height}px`;this.element.style.height=this.element.style.minHeight}async beginSuccess(e,t,n){if(this.disposed)return;let r=this.visual.element.getBoundingClientRect(),i=(n.top+n.bottom-r.top-r.bottom)/2;if(this.visual.element.animate([{translate:`0 0`},{translate:`0 ${i}px`}],{duration:600,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`forwards`}),await Promise.all([this.title,this.phrase,this.status].map($r)),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`,ei(t,a,Zr-Xr+e*Qr)}unlockLayout(){for(let e of[this.element,this.phrase,this.status])e.style.minHeight=``;this.element.style.height=``}};const Xr=150,Zr=450,Qr=40;function $r(e){return e.animate([{opacity:1},{opacity:0}],{duration:150,easing:`ease-in`,fill:`forwards`}).finished}function ei(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 ti(e){throw Error(`Unexpected capture event: ${String(e)}`)}export{c as _,Te as a,ve as c,ie as d,P as f,m as g,y as h,ye as i,I as l,x as m,mt as n,we as o,S as p,We as r,Ce as s,Yr as t,ae as u,p as v,a as y};
|