cubefarm 0.3.12 → 0.3.14
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/dist/assets/ToyWorld-pH_SiIaW.js +2 -0
- package/dist/assets/index-BjyRl7GR.js +4714 -0
- package/dist/assets/{index-qBB5_EtY.css → index-CqNx66hk.css} +1 -1
- package/dist/assets/rapier-DNlHxnYv.js +1 -0
- package/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/assets/voiceMessages-DuJL7za2.js +1 -0
- package/dist/index.html +3 -2
- package/dist-server/index.js +727 -528
- package/dist-server/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/assets/ToyWorld-CAwKknk0.js +0 -2
- package/dist/assets/index-BCeYUClc.js +0 -4710
- package/dist/assets/rapier-BRTeZJBn.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));export{s as n,l as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Jt as e,Qt as t,Xt as n,Yt as r,Zt as i,cn as a,dn as o,en as s,j as c,nn as l,qt as u,t as d,tn as f}from"./index-BjyRl7GR.js";var p=[];window.__swarmVoice=p;function m(t,n,i){setTimeout(()=>{e(t.id)&&(h=r(h,{message:t,arrived:n}),b())},Math.max(0,n+i-Date.now()))}var h=[],g=null,_=!1;function v(){g?.()}var y=()=>{let e=f();return e.muted?0:o(e.volume)*o(e.voice)};async function b(){if(!_){_=!0;try{for(;;){let{next:e,rest:t}=n(h,Date.now());if(h=t,!e)break;await S(e.message)}}finally{_=!1}}}var x=!1;async function S(e){let{settings:n,voiceKeySet:r}=u.getState(),{provider:i,voiceName:a}=n.voice;if(i===`off`)return;let o={rec:null},l=()=>{o.rec={id:e.id,provider:i,start:performance.now(),end:null,volume:y()},p.push(o.rec),p.length>50&&p.splice(0,p.length-50),u.setState({voiceSpeaking:e.id}),s(!0),o.unduckMusic=c()};try{if(i===`browser`)await T(d(e.text),a,l);else if(r)await C(e.id,l);else throw Error(`no ElevenLabs key is saved`)}catch(n){o.rec||t(),x||(x=!0,console.warn(`[voice] couldn't read message ${e.id} aloud: ${n.message}`))}finally{g=null,o.rec&&(o.rec.end=performance.now(),s(!1),o.unduckMusic?.(),u.setState({voiceSpeaking:null}))}}async function C(e,t){let n=!1;g=()=>void(n=!0);let r=await fetch(`/api/voice/messages/${e}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.arrayBuffer();if(n)return;let o=i(),s=l(`voice`);if(!o||!s)throw Error(`audio is unavailable`);let c=await o.ctx.decodeAudioData(a);if(n)return;let u=o.ctx.createBufferSource();u.buffer=c,u.connect(s),await new Promise(e=>{let n=setTimeout(()=>e(),(c.duration+2)*1e3);u.onended=()=>{clearTimeout(n),e()},g=()=>{try{u.stop()}catch{e()}},u.start(),t()}),u.disconnect()}async function w(e){return e.getVoices().length||await new Promise(t=>{let n=setTimeout(t,1e3);e.addEventListener(`voiceschanged`,()=>(clearTimeout(n),t()),{once:!0})}),e.getVoices()}async function T(e,t,n){let r=window.speechSynthesis;if(!r||typeof SpeechSynthesisUtterance>`u`)throw Error(`this browser can't speak`);if(!e)return;let i=new SpeechSynthesisUtterance(e),o=(await w(r)).find(e=>e.name===t);o&&(i.voice=o,i.lang=o.lang),i.volume=y(),await new Promise((t,o)=>{let s=a(()=>f().muted&&d()),c=setTimeout(()=>d(),2e4+e.length*150),l=!1,u=e=>{l||(l=!0,clearTimeout(c),s(),e?o(Error(e)):t())},d=()=>{u(),r.cancel()};g=d,i.onstart=n,i.onend=()=>u(),i.onerror=e=>u(e.error===`interrupted`||e.error===`canceled`?void 0:`speech failed: ${e.error}`),r.speak(i)})}export{m as speakMessage,v as stopSpeaking};
|
package/dist/index.html
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
-
<link rel="
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BjyRl7GR.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CqNx66hk.css">
|
|
13
14
|
</head>
|
|
14
15
|
<body>
|
|
15
16
|
<div id="root"></div>
|