droidsembly 0.4.0-beta.1 → 0.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -21
  2. package/README.it.md +193 -184
  3. package/README.md +193 -184
  4. package/bin/distribution.d.ts +3 -3
  5. package/bin/distribution.js +48 -48
  6. package/dist/THIRD_PARTY_LICENSES.txt +240 -240
  7. package/dist/assets/AccessibilitySettings-BE7rmk0y.js +30 -0
  8. package/dist/assets/AppViewer-BINNxHVf.js +5 -0
  9. package/dist/assets/Balloon-jPkIBPvT.js +1 -0
  10. package/dist/assets/{Batched-BOgjreKO.js → Batched-DL3cFl-z.js} +1 -1
  11. package/dist/assets/Birds-9cXj_YEG.js +1 -0
  12. package/dist/assets/Blimp-Ci1lo_c7.js +1 -0
  13. package/dist/assets/{BufferGeometryUtils-BsmWvcA2.js → BufferGeometryUtils-Dk96On2P.js} +1 -1
  14. package/dist/assets/Duck-BMxCVlmW.js +1 -0
  15. package/dist/assets/{Effects-CNyhhFkE.js → Effects-Crrr3ggK.js} +2 -2
  16. package/dist/assets/{Fireworks-CJfDJOeb.js → Fireworks-ddjyPNX6.js} +2 -2
  17. package/dist/assets/Helicopter-CX-86eGa.js +1 -0
  18. package/dist/assets/{Hurricane-9WqZGyZg.js → Hurricane-CLANwn_b.js} +2 -2
  19. package/dist/assets/Kaiju-BCMy-uRo.js +1 -0
  20. package/dist/assets/Meteors-CiJzDtSj.js +1 -0
  21. package/dist/assets/MissionConsole-CJb-BlEJ.js +1 -0
  22. package/dist/assets/Office-bAhOa_1d.js +563 -0
  23. package/dist/assets/PhotoPanel-Bj8-zSMr.js +1 -0
  24. package/dist/assets/PhotoScene-Da13U_uP.js +115 -0
  25. package/dist/assets/Plane-DcyLXU5f.js +1 -0
  26. package/dist/assets/Pocket-C3fEmnP6.js +2 -0
  27. package/dist/assets/{Rainbow-CdcWsmW8.js → Rainbow-CiwNa4iX.js} +2 -2
  28. package/dist/assets/Roof-DDYcam5j.js +34 -0
  29. package/dist/assets/{Shell-BmnZn4UL.js → Shell-CjHm9J8I.js} +2 -2
  30. package/dist/assets/Skywriting-BD1rTdRn.js +1 -0
  31. package/dist/assets/TerminalView-nREejrGe.js +17 -0
  32. package/dist/assets/ToyWorld-NbwEfz8w.js +1 -0
  33. package/dist/assets/Ufo-DlOMBNSX.js +1 -0
  34. package/dist/assets/Whale-BpAZmX5F.js +1 -0
  35. package/dist/assets/all-D96CQm6h.js +11 -0
  36. package/dist/assets/bloomMarks-DO_1Aa_j.js +4231 -0
  37. package/dist/assets/cheerRules-DNkiE7MG.js +1 -0
  38. package/dist/assets/{cityLayout-7ckfe3wf.js → cityLayout-BwjgCIoW.js} +1 -1
  39. package/dist/assets/{dogState-DiOvoobI.js → dogState-_4V3U3Ki.js} +1 -1
  40. package/dist/assets/{doors-BHKj8tkO.js → doors-BLqiDSGY.js} +1 -1
  41. package/dist/assets/{gallery-ColCPQQE.js → gallery-CVQaqgJI.js} +1 -1
  42. package/dist/assets/gate-B1SWzR3V.js +2 -0
  43. package/dist/assets/index-BSf1g_FE.js +10 -0
  44. package/dist/assets/{instantReplay-DGiLgvkQ.js → instantReplay-Cuo_dJ0Q.js} +1 -1
  45. package/dist/assets/interact-2xHzPlZG.js +1 -0
  46. package/dist/assets/jsx-runtime-CXW0f58S.js +1 -0
  47. package/dist/assets/jukeboxSongs-CUwHJ1cS.js +1 -0
  48. package/dist/assets/{kit-C6ByUQ-Y.js → kit-Cx-l6IRN.js} +1 -1
  49. package/dist/assets/mic-ChYpSk7U.js +1 -0
  50. package/dist/assets/photoMode-7LqNRqz9.js +1 -0
  51. package/dist/assets/{pipeline-BOTOZ69L.js → pipeline-DWfp7bcu.js} +1 -1
  52. package/dist/assets/rapier-D3erQ37Q.js +1 -0
  53. package/dist/assets/rig-CXpaDXip.js +1 -0
  54. package/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  55. package/dist/assets/{speechLanguage-BtfdhZNI.js → speechLanguage-CsSMLLpg.js} +1 -1
  56. package/dist/assets/{store-FA83kfnc.js → store-CWHb7890.js} +4 -4
  57. package/dist/assets/useDayTime-DQo6X8vh.js +1 -0
  58. package/dist/assets/{useGraphics-Cif18p7Q.js → useGraphics-B19_wbNT.js} +1 -1
  59. package/dist/assets/voiceMessages-BNuAZiGC.js +1 -0
  60. package/dist/assets/weatherState-BmCM8XlW.js +1 -0
  61. package/dist/icons/Sora-OFL.txt +93 -93
  62. package/dist/icons/badge.svg +1 -1
  63. package/dist/icons/droid-antenna.svg +29 -29
  64. package/dist/icons/droid-eyes.svg +29 -29
  65. package/dist/icons/droid-shell.svg +29 -29
  66. package/dist/icons/droid-spark.svg +29 -29
  67. package/dist/icons/droid-wire.svg +29 -29
  68. package/dist/icons/favicon.svg +1 -1
  69. package/dist/icons/icon.svg +29 -29
  70. package/dist/icons/logo-dark.svg +29 -29
  71. package/dist/icons/logo-light.svg +29 -29
  72. package/dist/index.html +26 -25
  73. package/dist/manifest.webmanifest +19 -19
  74. package/dist/third-party-licenses.json +3 -3
  75. package/dist-server/browser-init.js +24 -24
  76. package/dist-server/index.js +98 -34
  77. package/dist-server/index.js.map +4 -4
  78. package/dist-server/ptyHost.js.map +1 -1
  79. package/package.json +98 -98
  80. package/dist/assets/AccessibilitySettings-DSmFk9JC.js +0 -30
  81. package/dist/assets/AppViewer-alNn4TBB.js +0 -5
  82. package/dist/assets/Balloon-UTs7npGo.js +0 -1
  83. package/dist/assets/Birds-BA2HM-AD.js +0 -1
  84. package/dist/assets/Blimp-CTykuz6B.js +0 -1
  85. package/dist/assets/Duck-DH63jUrP.js +0 -1
  86. package/dist/assets/Helicopter-CW_SP7xP.js +0 -1
  87. package/dist/assets/Kaiju-SpSi_jBg.js +0 -1
  88. package/dist/assets/Meteors-DvjhLfbF.js +0 -1
  89. package/dist/assets/MissionConsole-BEP5CdC8.js +0 -1
  90. package/dist/assets/Office-BBnd6tyn.js +0 -563
  91. package/dist/assets/PhotoPanel-DehErnsv.js +0 -1
  92. package/dist/assets/PhotoScene-Ce-dzToM.js +0 -115
  93. package/dist/assets/Plane-0nfvzL_c.js +0 -1
  94. package/dist/assets/Pocket-CBoyL0ra.js +0 -2
  95. package/dist/assets/Roof-mkMKniSZ.js +0 -34
  96. package/dist/assets/Skywriting-06dZPAfg.js +0 -1
  97. package/dist/assets/TerminalView-wlhSixSH.js +0 -17
  98. package/dist/assets/ToyWorld-Cuu9aW-K.js +0 -1
  99. package/dist/assets/Ufo-iHaoe5t1.js +0 -1
  100. package/dist/assets/Whale-DZg88zIX.js +0 -1
  101. package/dist/assets/all-CYErCTCA.js +0 -11
  102. package/dist/assets/bloomMarks-DariC6lY.js +0 -4231
  103. package/dist/assets/cheerRules-CZGSrxOB.js +0 -1
  104. package/dist/assets/gate-BplJKcLG.js +0 -2
  105. package/dist/assets/index-B6qvKFYN.js +0 -10
  106. package/dist/assets/interact-0qw7BGhL.js +0 -1
  107. package/dist/assets/jsx-runtime-BFUkm7bt.js +0 -1
  108. package/dist/assets/jukeboxSongs-CjbAzAeb.js +0 -1
  109. package/dist/assets/mic-B316hcCe.js +0 -1
  110. package/dist/assets/photoMode-CYxQfgUF.js +0 -1
  111. package/dist/assets/rapier-CXAOW8OC.js +0 -1
  112. package/dist/assets/rig-wAyl3G1G.js +0 -1
  113. package/dist/assets/useDayTime-0XsqM14Q.js +0 -1
  114. package/dist/assets/voiceMessages-DtNmUazr.js +0 -1
  115. package/dist/assets/weatherState-ExG1doW-.js +0 -1
@@ -1 +0,0 @@
1
- import{s as e,u as t}from"./jsx-runtime-BFUkm7bt.js";import{Bt as n,Ct as r,f as i,jt as a}from"./bloomMarks-DariC6lY.js";var o=t(e(),1),s={fillStyle:`#000000`,strokeStyle:`#000000`,font:`10px sans-serif`,textAlign:`start`,textBaseline:`alphabetic`,direction:`inherit`,lineWidth:1,lineCap:`butt`,lineJoin:`miter`,miterLimit:10,lineDashOffset:0,globalAlpha:1,globalCompositeOperation:`source-over`,shadowBlur:0,shadowColor:`rgba(0, 0, 0, 0)`,shadowOffsetX:0,shadowOffsetY:0,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`,letterSpacing:`0px`,wordSpacing:`0px`,fontKerning:`auto`,textRendering:`auto`,filter:`none`},c=new Set(`fillRect.clearRect.strokeRect.fillText.strokeText.beginPath.closePath.moveTo.lineTo.arc.arcTo.ellipse.rect.roundRect.quadraticCurveTo.bezierCurveTo.fill.stroke.clip.save.restore.translate.rotate.scale.transform.setTransform.resetTransform.setLineDash.drawImage.reset`.split(`.`)),l=class extends Error{};function u(e,t,n,r){let i=[],a=[],o={...s},u=[],d=[],f=0,p={width:e,height:t},m=e=>{if(e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)&&e.every(e=>typeof e==`number`))return[...e];if(e&&typeof e==`object`&&`g`in e&&typeof e.g==`number`)return{g:e.g};throw new l},h=e=>{if(e&&typeof e==`object`&&(typeof ImageBitmap>`u`||!(e instanceof ImageBitmap))&&!(`width`in e))throw new l;let t=a.indexOf(e);return t<0&&(t=a.push(e)-1),{img:t}},g=(e,t)=>{let n=f++;return i.push([`g`,n,e,t]),{g:n,addColorStop:(e,t)=>void i.push([`gs`,n,e,t])}},_={measureText:e=>(r.font=o.font,r.letterSpacing=o.letterSpacing,r.measureText(String(e))),createLinearGradient:(...e)=>g(`linear`,e),createRadialGradient:(...e)=>g(`radial`,e),getLineDash:()=>[...d],save:()=>{u.push({...o,lineDash:d}),i.push([`m`,`save`,[]])},restore:()=>{let e=u.pop();e&&(d=e.lineDash,o=e),i.push([`m`,`restore`,[]])},setLineDash:e=>{d=[...e],i.push([`m`,`setLineDash`,[m(e)]])},reset:()=>{o={...s},u.length=0,d=[],i.push([`m`,`reset`,[]])}},v=new Proxy({},{get(e,t){if(typeof t==`string`){if(t===`canvas`)return p;if(t in _)return _[t];if(c.has(t))return(...e)=>{if(t===`drawImage`)i.push([`m`,t,[h(e[0]),...e.slice(1).map(m)]]);else if((t===`fill`||t===`stroke`||t===`clip`)&&e[0]!==void 0&&typeof e[0]!=`string`)throw new l;else i.push([`m`,t,e.map(m)])};if(t in s)return o[t];throw new l}},set(e,t,n){if(typeof t!=`string`||!(t in s))throw new l;let r=m(n);return o[t]=n,i.push([`s`,t,r]),!0}});try{n(v)}catch(e){if(e instanceof l)return null;throw e}return{ops:i,images:a}}var d={mode:`main`,sent:0,painted:0,onMain:0,failed:0,workerMs:0,recordMs:0},f=new Map;typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmPaint`)&&Object.defineProperty(window,"__swarmPaint",{get:()=>({...d,textures:f.size,workerMs:Math.round(d.workerMs),recordMs:Math.round(d.recordMs)})});var p,m=!1,h=null,g=1;function _(){try{return typeof Worker>`u`||typeof OffscreenCanvas>`u`||typeof createImageBitmap>`u`||/[?&]paint=main\b/.test(location.search)?!1:!!new OffscreenCanvas(1,1).getContext(`2d`)}catch{return!1}}function v(){if(p===void 0&&(p=null,_()))try{let e=new Worker(new URL(`/assets/paint.worker-D95XJ3xX.js`,``+import.meta.url),{type:`module`});e.onmessage=e=>b(e.data),e.onerror=()=>{p=null,m=!1,d.mode=`main`;for(let e of[...f.values()])e.toMain()},p=e,d.mode=`starting`;let t=document.querySelector(`link[href*="fonts.googleapis.com/css"]`)?.href;y({type:`fonts`,css:t??``})}catch{p=null}}function y(e,t=[]){p?.postMessage(e,t)}function b(e){if(e.type===`fontsReady`){m=!0,d.mode=`worker`;return}let t=f.get(e.id);if(e.type===`failed`){d.failed++,t?.toMain();return}d.painted++,d.workerMs+=e.ms,t?t.show(e.bitmap):e.bitmap.close()}var x=class{w;h;texture;id=g++;canvas;mainOnly=!1;busy=!1;waiting=null;sentImages=[];last=null;constructor(e,t){this.w=e,this.h=t,this.canvas=document.createElement(`canvas`),this.canvas.width=e,this.canvas.height=t,this.texture=new a(this.canvas),this.texture.colorSpace=r,this.texture.anisotropy=8,v(),p?f.set(this.id,this):this.mainOnly=!0}paint(e){if(this.last=e,!this.mainOnly&&p&&m){let t=performance.now();h??=document.createElement(`canvas`).getContext(`2d`);let n=h?u(this.w,this.h,e,h):null;if(d.recordMs+=performance.now()-t,n){this.busy?this.waiting=n:this.send(n);return}this.mainOnly=!0,f.delete(this.id)}let t=this.canvas.getContext(`2d`);t.clearRect(0,0,this.w,this.h),e(t),this.showCanvas(),d.onMain++}async send(e){this.busy=!0,d.sent++;let t=e.images.length===this.sentImages.length&&e.images.every((e,t)=>e===this.sentImages[t]),n;if(!t){try{n=await Promise.all(e.images.map(e=>createImageBitmap(e)))}catch{return this.toMain()}this.sentImages=e.images}if(this.mainOnly||!p)return void n?.forEach(e=>e.close());y({type:`paint`,id:this.id,w:this.w,h:this.h,ops:e.ops,images:n},n??[])}show(e){if(this.busy=!1,this.mainOnly)return void e.close();let t=this.texture.image;this.texture.image=e,this.texture.flipY=!1,this.texture.needsUpdate=!0,t instanceof ImageBitmap&&t.close();let n=this.waiting;this.waiting=null,n&&this.send(n)}showCanvas(){let e=this.texture.image;this.texture.image=this.canvas,this.texture.flipY=!0,this.texture.needsUpdate=!0,e instanceof ImageBitmap&&e.close()}toMain(){this.mainOnly=!0,this.busy=!1,this.waiting=null,f.delete(this.id)&&y({type:`drop`,id:this.id}),this.last&&this.paint(this.last)}dispose(){f.delete(this.id)&&y({type:`drop`,id:this.id});let e=this.texture.image;e instanceof ImageBitmap&&e.close(),this.texture.dispose()}},S=new Map;function C(e,t=3.2,n){let r=(0,o.useRef)(null),i=e?`${e.id}|${e.label}`:``;return(0,o.useEffect)(()=>{let i=r.current;if(i&&e)return S.set(i,{...e,range:t,pick:n}),()=>{S.delete(i)}},[i,t,n]),r}function w(e,t,r,a,s){let c=(0,o.useMemo)(()=>new x(e,t),[e,t]),l=(0,o.useRef)(null),u=(0,o.useMemo)(()=>new n,[]),d=()=>{let e=s?.anchor.current;return!!e&&e.getWorldPosition(u).distanceTo(T)>s.range};return(0,o.useEffect)(()=>{c.texture.version>0&&d()?l.current=r:(l.current=null,c.paint(r));let e=!0;return document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(()=>{e&&c.paint(r)}),()=>{e=!1}},[c,...a]),i(({camera:e})=>{T.copy(e.position),l.current&&!d()&&(c.paint(l.current),l.current=null)}),(0,o.useEffect)(()=>()=>c.dispose(),[c]),c.texture}var T=new n;export{x as i,w as n,C as r,S as t};
@@ -1 +0,0 @@
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)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function I(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var L=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function R(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,L)}catch(e){L(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function z(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else R(z.bind(null,e))}var B={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=B,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=z,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=R,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=l(d(),1),p=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},m=(e=>e?p(e):p),h=e=>e;function g(e,t=h){let n=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>t(e.getState()),[e,t]),f.useCallback(()=>t(e.getInitialState()),[e,t]));return f.useDebugValue(n),n}var _=e=>{let t=m(e),n=e=>g(t,e);return Object.assign(n,t),n},v=(e=>e?_(e):_),y=null,b=()=>y??Date.now(),x=()=>y;function S(e){y=e}var C=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),w=o(((e,t)=>{t.exports=C()}));export{v as a,o as c,S as i,s as l,b as n,m as o,x as r,d as s,w as t,l as u};
@@ -1 +0,0 @@
1
- import{l as e}from"./jsx-runtime-BFUkm7bt.js";var t=e({HOLD:()=>i,HOLIDAY_SONGS:()=>b,REST:()=>r,SCALES:()=>n,SONGS:()=>y,STEPS_PER_BAR:()=>8,beatAt:()=>h,beatPulse:()=>_,chordTones:()=>u,compileSong:()=>f,degreeMidi:()=>o,firstSongFor:()=>j,formOf:()=>l,holidayTrack:()=>C,isFocusSong:()=>T,midiHz:()=>s,moodOf:()=>w,nextSong:()=>A,noteAge:()=>v,parseLine:()=>a,parseStation:()=>E,passMix:()=>g,stationOrder:()=>D,stationSongs:()=>k,stepAt:()=>m,stepTime:()=>p,trackFor:()=>S}),n={major:[0,2,4,5,7,9,11],minor:[0,2,3,5,7,8,10],dorian:[0,2,3,5,7,9,10],mixolydian:[0,2,4,5,7,9,10]},r=-1e3,i=-1001;function a(e){let t=[];for(let n of e.split(/\s+/))if(n&&n!==`|`){if(n===`.`)t.push(r);else if(n===`-`)t.push(i);else if(n===`x`)t.push(0);else{let e=/^([1-9])([',]*)$/.exec(n);if(!e)throw Error(`bad note "${n}"`);let r=Number(e[1])-1;for(let t of e[2])r+=t===`'`?7:-7;t.push(r)}}return t}function o(e,t,r){let i=n[t],a=Math.floor(r/i.length);return e+a*12+i[r-a*i.length]}var s=e=>440*2**((e-69)/12);function c(e,t){let n=1;for(;e[t+n]===i;)n++;return n}function l(e){let t=e.form??`A`;if(!/^[A-Z]+$/.test(t))throw Error(`${e.id}: bad form "${t}"`);return[...t]}var u=e=>e.ninths?[2,4,6,8]:e.sevenths?[0,2,4,6]:[0,2,4];function d(e,t){let n=t===`A`?e:e.sections?.[t];if(!n)throw Error(`${e.id}: no section ${t}`);let r=t===`A`?``:` in section ${t}`,i=n.chords.length*8,o=a(n.lead);if(o.length!==i)throw Error(`${e.id}: lead${r} has ${o.length} steps, not ${i}`);let s=n.drums??e.drums,c={bass:a(n.bass??e.bass),comp:a(n.comp??e.comp),kick:a(s.kick),snare:a(s.snare),hat:a(s.hat)};for(let[t,n]of Object.entries(c))if(n.length!==8)throw Error(`${e.id}: ${t}${r} has ${n.length} steps, not 8`);return{chords:n.chords,lead:o,...c}}function f(e){let t=l(e),n=new Map(t.map(t=>[t,d(e,t)])),r=u(e),i=[];for(let a of t){let{chords:t,lead:s,bass:l,comp:u,kick:d,snare:f,hat:p}=n.get(a),m={kick:d,snare:f,hat:p};for(let n=0;n<s.length;n++){let a=Math.floor(n/8),d=n%8,f=t[a]-1,p=[];if(s[n]>-1e3&&p.push({voice:`lead`,midi:o(e.root,e.scale,s[n]),steps:c(s,n)}),l[d]>-1e3&&p.push({voice:`bass`,midi:o(e.root-24,e.scale,f+l[d]),steps:c(l,d)}),u[d]>-1e3){let t=c(u,d);for(let n of r)p.push({voice:`chord`,midi:o(e.root-12,e.scale,f+n),steps:t})}for(let e of[`kick`,`snare`,`hat`])m[e][d]===0&&p.push({voice:e,midi:0,steps:1});i.push(p)}}let a=i.length,s=60/e.bpm/2,f=a*e.passes,p=Array.from({length:e.passes},(t,n)=>g(n,e.passes,e.arrangement));return{song:e,stepsPerPass:a,totalSteps:f,stepSec:s,duration:f*s,events:i,mixes:p}}function p(e,t){return(t+(t%2==1?e.song.swing:0))*e.stepSec}function m(e,t){let n=Math.max(0,Math.floor(t/e.stepSec));for(;p(e,n)<t;)n++;return n}var h=(e,t)=>Math.max(0,t)/(e.stepSec*2);function g(e,t,n=`breakdown`){if(n===`build`)return{lead:!0,kick:e>=1,hat:e>=1,snare:e>=2,lift:t>=3&&e===t-1};if(n===`sparse`)return{lead:e>=1,kick:!0,snare:!0,hat:!0,lift:!1};let r=t>=3&&e===Math.floor(t/2);return{lead:!r,kick:!0,snare:!r,hat:!0,lift:!1}}function _(e){let t=e-Math.floor(e),n=Math.max(0,1-t*3);return n*n}function v(e,t,n,r){let i=Math.floor(e),a=i-((i-t)%n+n)%n;if(a<0)return-1;let o=(e-a)/r;return o<1?o:-1}var y=[{id:`coffee-break-bossa`,title:`Coffee Break Bossa`,artist:`The Decaf Trio`,bpm:118,swing:0,root:65,scale:`major`,chords:[1,6,2,5,1,6,2,5],sevenths:!0,lead:`5 - 3 - . 5 3 - | 6 - 1' - . 6 5 - | 4 - 6 - . 4 2 - | 2 - 7, - 5, - . . | 5 - 3 - . 5 1' - | 1' - 6 - . 1' 3' - | 2' - 1' 6 - 4 6 - | 5 - - - . . . .`,bass:`1 - - 5, 1 - - 5,`,comp:`x . . x . . x .`,drums:{kick:`x . . x x . . x`,snare:`. . x . . x . .`,hat:`x x x x x x x x`},sound:{lead:`triangle`,bass:`triangle`,chord:`sine`},passes:5,color:`#ff9f68`},{id:`green-checks-groove`,title:`Green Checks Groove`,artist:`CI & the Pipelines`,bpm:104,swing:.12,root:64,scale:`dorian`,chords:[1,1,4,4,1,1,5,4],lead:`1 . 3 4 . 5 . 3 | . 7 . 5 3 . 1 . | 4 . 6 1' . 6 . 4 | . 3' . 1' 6 . 4 . | 1 . 3 4 . 5 . 3 | 7 . 5 . 3 4 3 1 | 5 . 7 2' . 7 . 5 | 4 . 6 . 3' - 1' .`,bass:`1 . 1' . 1 5 . 7,`,comp:`. x . . . x . x`,drums:{kick:`x . . x . . x .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:5,color:`#06d6a0`},{id:`merge-conflict-mambo`,title:`Merge Conflict Mambo`,artist:`Los Rebasers`,bpm:124,swing:0,root:69,scale:`minor`,chords:[1,4,5,1,1,4,5,1],lead:`5 . 5 . 1' - 7 6 | 4 - 6 . 4 . 3 2 | 5 . 7 . 2' - 7 5 | 1' - - . 5 . 3 . | 3' . 3' . 2' 1' 7 1' | 6 - 4 . 6 . 1' - | 7 - 5 . 7 2' - 7 | 1' - - - . . 5 .`,bass:`1 . . 5 . . 1' .`,comp:`x . x x . x . x`,drums:{kick:`x . . x . . . .`,snare:`x . . x . . x .`,hat:`x . x . x . x .`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:5,color:`#ef476f`},{id:`stand-up-shuffle`,title:`Stand-up Shuffle`,artist:`Blocker & the Blockers`,bpm:112,swing:.3,root:67,scale:`mixolydian`,chords:[1,1,1,1,4,4,1,1,5,4,1,5],lead:`5 . 5 . 6 5 3 . | 1 - - . . . . . | 5 . 5 . 6 5 7 6 | 5 - - . . 3 4 . | 4 . 4 . 6 4 3 . | 1 - - . . . . . | 5 . 5 . 6 5 3 . | 1 - - . . 3 5 . | 6 . 6 . 5 4 2 . | 5 . 5 . 4 3 1 . | 3 - 2 1 - . . . | 2 - - . 5, - . .`,bass:`1 . 3 . 5 . 6 .`,comp:`. . x . . . x .`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x . x . x . x .`},sound:{lead:`triangle`,bass:`triangle`,chord:`square`},passes:4,color:`#4cc9f0`},{id:`lo-fi-linting`,title:`Lo-fi Linting`,artist:`Semicolon Sleep`,bpm:78,swing:.2,root:72,scale:`major`,chords:[2,5,1,6,2,5,1,6],sevenths:!0,lead:`. . 4 - 3 - 2 - | 7, - - . . . 2 4 | 3 - - - . . 5 - | 1' - 7 - 6 - . . | . . 6 - 4 - 3 - | 2 - - . 4 - 5 - | 7 - - - 5 - 3 - | 1 - - - . . . .`,bass:`1 - - - . . 5, -`,comp:`x - - - - - - -`,drums:{kick:`x . . . . x x .`,snare:`. . x . . . x .`,hat:`. x . x . x . x`},sound:{lead:`sine`,bass:`triangle`,chord:`triangle`},passes:3,color:`#b8a1ff`,mood:`lofi`},{id:`deploy-on-a-friday`,title:`Deploy on a Friday`,artist:`The Hotfixes`,bpm:124,swing:0,root:69,scale:`minor`,chords:[1,6,7,5,1,6,7,5],lead:`1' . 1' . 7 1' . 3' | 1' - 6 - 1' - 3' - | 2' . 2' . 1' 2' . 4' | 5' - - . 2' - 7 - | 3' . 3' . 2' 1' . 5 | 6 - 1' - 3' - 1' - | 7 - 2' - 4' - 2' - | 5' - - - . . . .`,bass:`1 1' 1 1' 1 1' 1 1'`,comp:`. x . x . x . x`,drums:{kick:`x . x . x . x .`,snare:`. . x . . . x .`,hat:`. x . x . x . x`},sound:{lead:`square`,bass:`sawtooth`,chord:`triangle`},passes:5,color:`#ffd166`},{id:`going-up`,title:`Going Up (Elevator Mix)`,artist:`Floor Seven Strings`,bpm:92,swing:0,root:67,scale:`major`,chords:[1,6,4,5,1,6,2,5],sevenths:!0,lead:`3 - - 2 1 - 5, - | 6, - 1 - 3 - 5 - | 4 - 3 - 4 - 6 - | 5 - - - . . 4 3 | 3 - - 2 1 - 3 - | 5 - - 3 6 - 5 - | 4 - 3 - 2 - 1 - | 2 - - - . . . .`,bass:`1 - - - 5, - - -`,comp:`x - - - x - - -`,drums:{kick:`x . . . x . . .`,snare:`. . . . . . . .`,hat:`x . x . x . x .`},sound:{lead:`sine`,bass:`triangle`,chord:`sine`},passes:4,color:`#8ecae6`},{id:`rubber-duck-polka`,title:`Rubber Duck Polka`,artist:`Quack Overflow`,bpm:138,swing:0,root:70,scale:`major`,chords:[1,1,5,5,5,5,1,1],lead:`1 3 5 3 1' - 5 - | 3 - 5 - 1 - . . | 7, 2 5 2 7 - 5 - | 4 - 2 - 7, - . . | 5 4 2 4 5 - 7 - | 6 - 5 - 4 - 2 - | 1 3 5 1' 3' - 1' - | 1' - . 5 1' - . .`,bass:`1 . 5, . 1 . 5, .`,comp:`. x . x . x . x`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`. . . . . . . .`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:6,color:`#ffbe0b`},{id:`ship-it`,title:`Ship It (Arena Version)`,artist:`Small PRs`,bpm:132,swing:0,root:64,scale:`major`,chords:[1,5,6,4,1,5,6,4],lead:`5 - 5 - 6 - 5 - | 2' - 1' - 7 - 5 - | 6 - 1' - 3' - 1' - | 1' - - - 6 - 4 - | 5 - 5 - 3' - 2' - | 2' - 1' - 7 - 2' - | 3' - 1' - 6 - 1' - | 1' - - - - - . .`,bass:`1 1 1 1 1 1 1 1`,comp:`x - - - x - - -`,drums:{kick:`x . . . x x . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`square`,bass:`triangle`,chord:`sawtooth`},passes:5,color:`#3a86ff`},{id:`refactor-rain`,title:`Refactor Rain`,artist:`Null & Void`,bpm:80,swing:.18,root:65,scale:`dorian`,chords:[1,4,1,4],ninths:!0,lead:`. . 5 - - 4 3 - | 4 - - - . . . . | . . 3 - 5 - 7 - | 6 - - 5 4 - . .`,bass:`1 - - . . 1 5, -`,comp:`x - - . . x - .`,drums:{kick:`x . . . . x x .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#7aa2c9`,mood:`lofi`,texture:{crackle:!0,warmth:2600,wobble:!0,softDrums:!0},sections:{B:{chords:[3,7,5,4],lead:`. 3 - 5 - 7 - . | 2' - - 1' 7 - . . | . . 5 - 7 - 2' - | 1' - - 7 6 - 4 -`}},form:`AABA`},{id:`hello-world-sunrise`,title:`Hello, World (Sunrise)`,artist:`The First Commit`,bpm:98,swing:0,root:67,scale:`major`,chords:[1,4,6,5],lead:`1 - 3 - 5 - 1' - | 6 - - - 4 - . . | 5 - 3 - 1 - 3 - | 2 - - - - - . .`,bass:`1 - 1 - 5, - 1 -`,comp:`x - x - x - x -`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`triangle`,bass:`triangle`,chord:`keys`},passes:4,color:`#ffb703`,mood:`uplifting`,sections:{B:{chords:[4,5,6,5],lead:`4 - 6 - 1' - 6 - | 5 - 7 - 2' - 7 - | 1' - - 7 6 - 5 - | 5 - - - - - . .`}},form:`AABB`,arrangement:`build`},{id:`stack-trace-study-session`,title:`Stack Trace Study Session`,artist:`The Breakpoints`,bpm:72,swing:.22,root:69,scale:`minor`,chords:[1,6,4,7],ninths:!0,lead:`5 - - - 3 - 1 - | . . 3 - 5 - 6 - | 4 - - - . . 2 3 | 5 - - - . . . .`,bass:`1 - . 5, 1 - . .`,comp:`x - - - . x - -`,drums:{kick:`x . . x . . x .`,snare:`. . x . . . x .`,hat:`. x . x . x . x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#c9a27a`,mood:`lofi`,texture:{crackle:!0,warmth:2400,wobble:!0,softDrums:!0},sections:{B:{chords:[4,7,3,6],lead:`. 6 - 5 4 - 3 - | 2 - - - 7, - . . | . . 3 - 5 - 1' - | 7 - - 6 5 - - .`}},form:`AABA`},{id:`deep-work`,title:`Deep Work (Do Not Disturb)`,artist:`Focus Mode`,bpm:64,swing:0,root:64,scale:`major`,chords:[1,4,6,4],sevenths:!0,lead:`. . 5 - - - - - | 6 - - - . . . . | . . 3 - - - 1 - | 2 - - - - - . .`,bass:`1 - - - - - - -`,comp:`x - - - - - - -`,drums:{kick:`. . . . . . . .`,snare:`. . . . . . . .`,hat:`. . . . . . . .`},sound:{lead:`keys`,bass:`sine`,chord:`pad`},passes:3,color:`#94d2bd`,mood:`ambient`,texture:{warmth:2200,wobble:!0},sections:{B:{chords:[2,5,1,1],lead:`. . 4 - - - 6 - | 5 - - - - - . . | . . 3 - - 2 1 - | 1 - - - - - - -`}},form:`AABA`,arrangement:`sparse`},{id:`async-afternoon`,title:`Async Afternoon`,artist:`The Promises`,bpm:84,swing:.15,root:70,scale:`major`,chords:[2,5,1,1],sevenths:!0,lead:`. . 4 - 6 - 1' - | 7 - - 6 - - 4 - | 3 - - - . . . . | . . 5 - 3 - 2 -`,bass:`1 - - 5, . 1 - .`,comp:`. . x - . . x -`,drums:{kick:`x . . . x x . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#e5989b`,mood:`lofi`,texture:{crackle:!0,warmth:2900,wobble:!0,softDrums:!0},sections:{B:{chords:[4,3,2,5],lead:`1' - - - 6 - 4 - | 5 - - - . 3 5 - | 6 - - 5 4 - . . | 2 - - - 5, - . .`}},form:`AABA`},{id:`it-compiles`,title:`It Compiles!`,artist:`Zero Warnings`,bpm:104,swing:0,root:65,scale:`major`,chords:[1,6,2,5],lead:`3 - 5 - 1' - - 7 | 6 - - - . . 5 6 | 4 - - 2 - 4 6 - | 5 - - - . . . .`,bass:`1 . 1 1 5, . 1 .`,comp:`x - . x - . x -`,drums:{kick:`x . . x x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`triangle`,bass:`triangle`,chord:`keys`},passes:4,color:`#90be6d`,mood:`uplifting`,sections:{B:{chords:[4,4,1,1,4,4,5,5],lead:`4 . 6 . 1' . 6 . | 1' - - - 2' - 1' - | 3' - - - 2' - 1' - | 5 - - - . . . . | 4 . 6 . 1' . 2' . | 3' - - 2' - - 1' - | 2' - - - 7 - 5 - | 2' - - - - - . .`}},form:`AAB`,arrangement:`build`},{id:`tabs-and-spaces`,title:`Tabs & Spaces`,artist:`Whitespace Club`,bpm:86,swing:.25,root:62,scale:`dorian`,chords:[1,4,1,4],ninths:!0,lead:`1' . 7 . 5 - . . | . . 4 - 5 - 6 - | 5 - - - 3 - 1 - | 2 - - - . . . .`,bass:`1 - . 5, - . 1 .`,comp:`x - . . x - . .`,drums:{kick:`x . . x . . x .`,snare:`. . x . . . x .`,hat:`x . x x x . x x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#83c5be`,mood:`lofi`,texture:{crackle:!0,warmth:2800,wobble:!0,softDrums:!0},sections:{B:{chords:[3,4,5,4],lead:`. . 3 - 5 - 7 - | 6 - - - 4 - 2 - | 5 - - 7 - 1' - . | 4 - - - . . 7, -`}},form:`AABA`},{id:`background-process`,title:`Background Process`,artist:`Daemon & the Threads`,bpm:70,swing:0,root:62,scale:`dorian`,chords:[1,4,1,4],sevenths:!0,lead:`5 - - - - - . . | . . . . 6 - 5 - | 3 - - - - - . . | . . 1 - 2 - - -`,bass:`1 - - - - - 5, -`,comp:`x - - - - - - -`,drums:{kick:`x . . . . . . .`,snare:`. . . . . . . .`,hat:`. . . . . . . .`},sound:{lead:`keys`,bass:`sine`,chord:`pad`},passes:3,color:`#a2d2ff`,mood:`ambient`,texture:{warmth:2e3,wobble:!0,softDrums:!0},sections:{B:{chords:[3,7,5,4],lead:`. . 3 - 5 - - - | 7 - - - - - . . | . . 1' - 7 - 5 - | 4 - - - - - - -`}},form:`AABA`,arrangement:`sparse`},{id:`pair-programming-by-the-window`,title:`Pair Programming by the Window`,artist:`Two Keyboards`,bpm:76,swing:.2,root:65,scale:`major`,chords:[4,3,2,1],sevenths:!0,lead:`. . 6 - 5 - 4 - | 3 - - - . . 5 - | 4 - - 3 2 - . . | 1 - - - . . . .`,bass:`1 - - - 5, - - .`,comp:`x - - - x - . .`,drums:{kick:`x . . . . . x .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#b5838d`,mood:`lofi`,texture:{crackle:!0,warmth:2500,wobble:!0,softDrums:!0},sections:{B:{chords:[6,2,5,1],lead:`. 1' - 7 6 - 5 - | 4 - - - 6 - 1' - | 7 - - - 5 - 2 - | 3 - - - . . . .`}},form:`AABA`},{id:`full-coverage`,title:`100% Coverage`,artist:`The Test Suite`,bpm:108,swing:0,root:64,scale:`major`,chords:[4,5,3,6],lead:`4 - 6 - 1' - 6 - | 5 - 7 - 2' - - . | 3 - 5 - 7 - 5 - | 6 - - - 1' - 3' -`,bass:`1 . 1 . 1 . 5, .`,comp:`x - - x - - x -`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`. x . x . x . x`},sound:{lead:`triangle`,bass:`triangle`,chord:`keys`},passes:4,color:`#f9c74f`,mood:`uplifting`,sections:{B:{chords:[2,5,1,1],lead:`2' - - 1' 6 - 4 - | 5 - - - 7 - 2' - | 3' - - - 2' - 1' - | 1' - - - - - . .`}},form:`AABA`,arrangement:`build`},{id:`late-night-code-review`,title:`Late Night Code Review`,artist:`LGTM`,bpm:70,swing:.2,root:67,scale:`minor`,chords:[1,4,7,3],ninths:!0,lead:`5 - - - . 4 3 - | 4 - - - . . . . | . . 2 - 4 - 6 - | 5 - - - 3 - . .`,bass:`1 - - - 1 . 5, .`,comp:`x - - - - - x -`,drums:{kick:`x . . . . x . .`,snare:`. . x . . . x .`,hat:`x . x . x . x x`},sound:{lead:`keys`,bass:`triangle`,chord:`keys`},passes:3,color:`#8d86c9`,mood:`lofi`,texture:{crackle:!0,warmth:2400,wobble:!0,softDrums:!0},sections:{B:{chords:[6,4,2,7],lead:`. . 3 - 5 - 7 - | 1' - - 7 6 - . . | . . 4 - 6 - 1' - | 6 - - - 4 - 2 -`}},form:`AABA`}],b=[{id:`haunted-hotfix`,title:`Haunted Hotfix`,artist:`The Flaky Phantoms`,bpm:108,swing:.18,root:62,scale:`minor`,chords:[1,1,6,5,1,1,4,5],lead:`1 . 3 . 5 . 6 5 | 4 - 3 - 2 . 1 . | 6, . 1 . 3 . 4 3 | 2 - 7, - 5, - . . | 1 . 3 . 5 . 1' 7 | 6 - 5 - 4 . 3 . | 4 . 6 . 1' . 6 4 | 5 - - - 5, - . .`,bass:`1 . 5, . 1 . 5, .`,comp:`. x . x . x . x`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x . x . x . x .`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:4,color:`#ff7b00`},{id:`monster-merge`,title:`Monster Merge`,artist:`Boo-lean Logic`,bpm:128,swing:0,root:69,scale:`minor`,chords:[1,7,6,5,1,7,6,5],lead:`1 1' 7 5 . 3 . 5 | 7 - 5 - 3 - 2 . | 6, 6 5 3 . 1 . 3 | 5 - 7, - 5, - . . | 1 1' 7 5 . 3 . 5 | 7 - 2' - 1' - 7 . | 6 . 5 . 4 . 3 . | 1 - - - . . 5, .`,bass:`1 . 1' . 1 . 1' .`,comp:`x . . x . . x .`,drums:{kick:`x . . x x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`square`,bass:`sawtooth`,chord:`triangle`},passes:4,color:`#9d4edd`},{id:`snowed-in-standup`,title:`Snowed-in Standup`,artist:`The Merry Mergers`,bpm:120,swing:.25,root:67,scale:`major`,chords:[1,4,1,5,1,4,5,1],lead:`3 . 3 . 5 - 3 . | 4 . 6 . 1' - 6 . | 5 . 3 . 1 . 3 5 | 2 - - . 5, - . . | 3 . 3 . 5 - 1' . | 6 . 4 . 6 - 1' 6 | 5 . 7, . 2 . 4 . | 3 - 1 - - . . .`,bass:`1 . 5, . 1 . 5, .`,comp:`. x . x . x . x`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`triangle`,bass:`triangle`,chord:`sine`},passes:4,color:`#e63946`},{id:`cocoa-and-code`,title:`Cocoa & Code`,artist:`Marshmallow Pipeline`,bpm:84,swing:.2,root:72,scale:`major`,chords:[4,3,2,1,4,3,2,5],sevenths:!0,lead:`. . 3 - 5 - 6 - | 5 - - . . 3 2 - | 1 - 2 - 3 - 5 - | 3 - - - . . . . | . . 3 - 5 - 1' - | 7 - 6 - 5 - . . | 4 - 3 - 2 - 6, - | 7, - - - . . . .`,bass:`1 - - - . . 5, -`,comp:`x - - - - - - -`,drums:{kick:`x . . . . x . .`,snare:`. . x . . . x .`,hat:`. x . x . x . x`},sound:{lead:`sine`,bass:`triangle`,chord:`keys`},passes:3,color:`#a47148`,mood:`lofi`,texture:{crackle:!0,warmth:2600,wobble:!0,softDrums:!0}},{id:`countdown-commit`,title:`Countdown Commit`,artist:`The Midnight Deploys`,bpm:128,swing:0,root:64,scale:`major`,chords:[1,5,6,4,1,5,4,5],lead:`1 . 1 . 3 . 5 . | 5 - 4 - 3 - 2 - | 1 . 1 . 3 . 6 . | 6 - 5 - 4 - . . | 5 . 5 . 1' . 7 6 | 5 - 7 - 2' - . . | 1' . 6 . 4 . 6 . | 5 - - - 1' - . .`,bass:`1 1 1 1 1 1 1 1`,comp:`x . x . x . x .`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`square`,bass:`triangle`,chord:`sawtooth`},passes:4,color:`#ffd23f`},{id:`pair-programming`,title:`Pair Programming (Love Song)`,artist:`The Rubber Ducks`,bpm:96,swing:.12,root:65,scale:`major`,chords:[1,6,2,5,1,6,4,5],sevenths:!0,lead:`5 - 3 - 1 - 3 - | 6 - - 5 3 - . . | 4 - 2 - 6, - 2 - | 5 - - - . . . . | 5 - 3 - 1' - 7 - | 6 - - 5 3 - 1 - | 4 - 6 - 1' - 6 - | 5 - - - . . 4 3`,bass:`1 - - 5, 1 - - 5,`,comp:`x . . x . . x .`,drums:{kick:`x . . x x . . .`,snare:`. . x . . . x .`,hat:`x . x . x . x .`},sound:{lead:`triangle`,bass:`triangle`,chord:`sine`},passes:4,color:`#ff4d6d`},{id:`egg-hunt-hop`,title:`Egg Hunt Hop`,artist:`Bunny & the Breakpoints`,bpm:132,swing:0,root:72,scale:`major`,chords:[1,1,4,1,5,4,1,5],lead:`1 3 5 3 1 . 5, . | 1 3 5 1' 5 - . . | 4 6 1' 6 4 . 2 . | 3 - 5 - 1 - . . | 2 4 5 7 5 . 4 . | 4 6 1' 6 4 . 3 . | 5 3 1 3 5 - 1' - | 7 - 5 - 2 - . .`,bass:`1 . 5, . 1 . 5, .`,comp:`. x . x . x . x`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`. . x . . . x .`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:5,color:`#a0c4ff`},{id:`another-year-of-uptime`,title:`Another Year of Uptime`,artist:`The 99.9s`,bpm:116,swing:0,root:67,scale:`major`,chords:[1,4,5,1,6,4,5,1],lead:`5 . 5 . 6 . 5 . | 1' - 6 - 4 . . . | 5 . 7 . 2' . 7 . | 1' - - - . . 5 . | 6 . 1' . 3' . 1' . | 6 - 4 - 1' - 6 . | 5 . 7 . 2' - 7 5 | 1' - - - - . . .`,bass:`1 . 5, . 1 . 5, .`,comp:`x . . x . . x .`,drums:{kick:`x . . . x . . .`,snare:`. . x . . . x .`,hat:`x x x x x x x x`},sound:{lead:`square`,bass:`triangle`,chord:`triangle`},passes:4,color:`#ff5d8f`}],x=new Map;function S(e){let t=y[(e%y.length+y.length)%y.length],n=x.get(t.id);return n||(n=f(t),x.set(t.id,n)),n}function C(e,t){let n=e.map(e=>b.find(t=>t.id===e)).filter(e=>!!e);if(!n.length)return null;let r=n[(t%n.length+n.length)%n.length],i=x.get(r.id);return i||(i=f(r),x.set(r.id,i)),i}var w=e=>e.mood??`lively`,T=e=>w(e)===`lofi`||w(e)===`ambient`,E=e=>e===`focus`?`focus`:`all`;function D(e,t){let n=[],r=[];if(e.forEach((e,t)=>(T(e)?n:r).push(t)),t===`focus`)return n;let i=[],a=0,o=0;for(;a<n.length||o<r.length;)(a<n.length?(a+.5)/n.length:1/0)<(o<r.length?(o+.5)/r.length:1/0)?i.push(n[a++]):i.push(r[o++]);let s=Math.max(0,i.indexOf(0));return[...i.slice(s),...i.slice(0,s)]}var O={all:D(y,`all`),focus:D(y,`focus`)},k=e=>O[e];function A(e,t){let n=O[t];if(n.length===0)return e;let r=n.indexOf(e);if(r>=0)return n[(r+1)%n.length];let i=O.all,a=Math.max(0,i.indexOf(e));for(let e=1;e<=i.length;e++){let t=i[(a+e)%i.length];if(n.includes(t))return t}return n[0]}function j(e,t=`all`){if(t===`all`)return(e%y.length+y.length)%y.length;let n=O.focus;return n[(e%n.length+n.length)%n.length]}export{C as a,s as c,v as d,E as f,S as g,p as h,j as i,w as l,m,h as n,T as o,k as p,_ as r,t as s,y as t,A as u};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-BFUkm7bt.js";import{Fi as t,Ki as n,Mi as r,Ni as i,Pi as a,Ri as o,Vi as s,Zi as c,ha as l,hs as u,ms as d,p as f,wi as p,zi as ee}from"./store-FA83kfnc.js";import{c as te,u as ne}from"./index-B6qvKFYN.js";import{c as re,g as ie,h as ae,m as oe,t as se}from"./jukeboxSongs-CjbAzAeb.js";var m=[{id:`forward`,label:`Walk forward`,group:`Moving`,scope:`move`,keys:[`KeyW`,`ArrowUp`]},{id:`back`,label:`Walk back`,group:`Moving`,scope:`move`,keys:[`KeyS`,`ArrowDown`]},{id:`left`,label:`Step left`,group:`Moving`,scope:`move`,keys:[`KeyA`,`ArrowLeft`]},{id:`right`,label:`Step right`,group:`Moving`,scope:`move`,keys:[`KeyD`,`ArrowRight`]},{id:`run`,label:`Run (hold)`,group:`Moving`,scope:`move`,keys:[`ShiftLeft`,`ShiftRight`]},{id:`interact`,label:`Use, pick up, sip`,group:`Hands`,scope:`walk`,keys:[`KeyE`]},{id:`throw`,label:`Throw or fire (hold to charge)`,group:`Hands`,scope:`walk`,keys:[`KeyF`]},{id:`drop`,label:`Drop`,group:`Hands`,scope:`walk`,keys:[`KeyG`]},{id:`reload`,label:`Reload a blaster`,group:`Hands`,scope:`walk`,keys:[`KeyR`]},{id:`volumeDown`,label:`Jukebox softer`,group:`Hands`,scope:`walk`,keys:[`Minus`,`NumpadSubtract`]},{id:`volumeUp`,label:`Jukebox louder`,group:`Hands`,scope:`walk`,keys:[`Equal`,`NumpadAdd`]},{id:`phone`,label:`Phone`,group:`Office`,scope:`global`,keys:[`KeyP`]},{id:`help`,label:`Help`,group:`Office`,scope:`global`,keys:[`KeyH`]},{id:`mute`,label:`Mute`,group:`Office`,scope:`global`,keys:[`KeyM`]},{id:`workers`,label:`Who's working list`,group:`Office`,scope:`global`,keys:[`KeyL`]},{id:`overview`,label:`Overview (twice: the building)`,group:`Overview`,scope:`global`,keys:[`Tab`]},{id:`rotateLeft`,label:`Turn the overview left`,group:`Overview`,scope:`overview`,keys:[`KeyQ`]},{id:`rotateRight`,label:`Turn the overview right`,group:`Overview`,scope:`overview`,keys:[`KeyE`]},{id:`talk`,label:`Hold to talk (in a message box)`,group:`Office`,scope:`panel`,keys:[`KeyV`]},{id:`emote`,label:`Emote wheel (hold, point, let go)`,group:`Office`,scope:`walk`,keys:[`KeyT`]},{id:`ping`,label:`Ping where you aim (or middle-click)`,group:`Office`,scope:`walk`,keys:[`KeyX`]},{id:`photo`,label:`Photo mode`,group:`Office`,scope:`global`,keys:[`KeyK`]},{id:`saveReplay`,label:`Save the last 15 s (instant replay)`,group:`Office`,scope:`global`,keys:[`KeyI`]}],ce=m.map(e=>e.id),le=new Map(m.map(e=>[e.id,e])),ue=e=>le.get(e),de=()=>Object.fromEntries(m.map(e=>[e.id,[...e.keys]])),fe=new Set([`Escape`,`MetaLeft`,`MetaRight`,`OSLeft`,`OSRight`,`ContextMenu`,`F5`,`F11`,`F12`,`PrintScreen`]),pe=e=>typeof e==`string`&&/^[A-Za-z][A-Za-z0-9]{0,31}$/.test(e)&&!fe.has(e);function me(e,t){return e===t||e===`global`||t===`global`?!0:e===`panel`||t===`panel`?!1:e===`move`||t===`move`}function he(e,t,n){return m.filter(r=>n.includes(r.scope)&&e[r.id].includes(t)).map(e=>e.id)}var ge=(e,t,n)=>e[t].includes(n);function _e(e,t,n){let r=e[t];for(let e=0;e<r.length;e++)if(n.has(r[e]))return!0;return!1}var ve={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,ShiftLeft:`Shift`,ShiftRight:`Shift`,ControlLeft:`Ctrl`,ControlRight:`Ctrl`,AltLeft:`Alt`,AltRight:`Alt`,Space:`Space`,Tab:`Tab`,Enter:`Enter`,NumpadEnter:`Num Enter`,Backspace:`Backspace`,CapsLock:`Caps Lock`,Minus:`−`,Equal:`+`,NumpadSubtract:`Num −`,NumpadAdd:`Num +`,NumpadMultiply:`Num *`,NumpadDivide:`Num /`,NumpadDecimal:`Num .`,BracketLeft:`[`,BracketRight:`]`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,Backslash:`\\`,Backquote:"`",IntlBackslash:`\\`,Insert:`Ins`,Delete:`Del`,Home:`Home`,End:`End`,PageUp:`PgUp`,PageDown:`PgDn`};function ye(e){let t=/^Key([A-Z])$/.exec(e);if(t)return t[1];let n=/^Digit(\d)$/.exec(e);if(n)return n[1];let r=/^Numpad(\d)$/.exec(e);return r?`Num ${r[1]}`:ve[e]??e}function be(e){let t=/^(Shift|Control|Alt)(Left|Right)$/.exec(e);return t?`${t[2]} ${ye(e)}`:ye(e)}function xe(e){let t=[];for(let n=0;n<m.length;n++)for(let r=n+1;r<m.length;r++){let i=m[n],a=m[r];if(me(i.scope,a.scope))for(let n of e[i.id])e[a.id].includes(n)&&t.push({code:n,actions:[i.id,a.id]})}return t}function Se(e,t,n,r){if(!pe(r)||n<0||n>=2)return null;let i=Object.fromEntries(ce.map(t=>[t,[...e[t]]])),a=i[t],o=a[n]??null;if(o===r)return{bindings:i,displaced:null};a.includes(r)&&a.splice(a.indexOf(r),1),n>=a.length?a.push(r):a[n]=r;let s=null,c=ue(t).scope;for(let e of m){if(e.id===t||!me(c,e.scope))continue;let n=i[e.id],a=n.indexOf(r);if(a<0)continue;let l=o&&!n.includes(o)&&!Ce(i,e.id,o)?o:null;l?n[a]=l:n.splice(a,1),s??={action:e.id,key:l}}return{bindings:i,displaced:s}}function Ce(e,t,n){let r=ue(t).scope;return m.some(i=>i.id!==t&&me(r,i.scope)&&e[i.id].includes(n))}function we(e,t,n){let r=Object.fromEntries(ce.map(t=>[t,[...e[t]]]));return r[t].splice(n,1),r}var Te=.25,Ee=()=>({bindings:de(),padSensitivity:1});function De(e){let t=Ee();if(!e||typeof e!=`object`)return t;let n=e;if(n.bindings&&typeof n.bindings==`object`){let e=n.bindings;for(let n of ce){let r=e[n];Array.isArray(r)&&r.every(pe)&&(t.bindings[n]=[...new Set(r)].slice(0,2))}}let r=n.padSensitivity;return typeof r==`number`&&Number.isFinite(r)&&(t.padSensitivity=Math.min(3,Math.max(Te,r))),t}var Oe=`cubefarm:controls`;function ke(){try{return De(JSON.parse(localStorage.getItem(Oe)??`null`))}catch{return Ee()}}var h=e(()=>ke());function Ae(e){h.setState(e);let{bindings:t,padSensitivity:n}=h.getState();try{localStorage.setItem(Oe,JSON.stringify({bindings:t,padSensitivity:n}))}catch{}}var g=()=>h.getState().bindings,je=(e,t)=>h.getState().bindings[e].includes(t);function Me(e,t,n){let r=Se(g(),e,t,n);return r&&Ae({bindings:r.bindings}),r}var Ne=(e,t)=>Ae({bindings:we(g(),e,t)}),Pe=e=>Ae({padSensitivity:Math.min(3,Math.max(Te,e))}),Fe=()=>Ae(Ee()),Ie=e=>e[0]?ye(e[0]):`—`,Le=e=>Ie(g()[e]),Re=e=>h(t=>Ie(t.bindings[e])),ze=5.3,Be=.5,Ve=.05,He=(e,t)=>-Math.log(1-Math.min(Math.max(t,0),.999))/e;function Ue(e,t){let n=[];for(let r=He(7,t());r<e;r+=He(7,t()))n.push({at:r,size:.12+.3*t(),len:6e-4+.0012*t()});for(let r=He(Be,t());r<e;r+=He(Be,t()))n.push({at:r,size:.6+.4*t(),len:.0018+.0025*t()});n.sort((e,t)=>e.at-t.at);let r=[];for(let e of n){let t=r[r.length-1];!t||e.at-t.at>=.015?r.push(e):e.size>t.size&&(r[r.length-1]=e)}return r.filter(t=>t.at+t.len<e)}function We(e,t,n){let r=0,i=0;for(let t=0;t<e.length;t++){let a=n()*2-1;i=.97*(i+a-r),r=a,e[t]=Ve*i}let a=Ue(e.length/t,n);for(let r of a){let i=Math.floor(r.at*t),a=Math.max(2,Math.round(r.len*t)),o=n()<.5?-1:1;for(let t=0;t<a&&i+t<e.length;t++)e[i+t]+=o*r.size*Math.exp(-4*t/a)*(t%2==0?1:-.6)}for(let t=0;t<e.length;t++)e[t]=Math.max(-1,Math.min(1,e[t]));return a}var Ge={hz:.45,depth:.0016,delay:.006},Ke=[{gain:.7,ref:1.5,rolloff:2,reach:14},{gain:1.2,ref:1.5,rolloff:1.6,reach:16},{gain:1.8,ref:2,rolloff:1.1,reach:20},{gain:2.4,ref:2.5,rolloff:.7,reach:26},{gain:3,ref:3,rolloff:.45,reach:34},{gain:3.6,ref:4,rolloff:.25,reach:46}],qe=Ke.length;function Je(e){let t=typeof e==`number`?e:typeof e==`string`&&e.trim()!==``?Number(e):NaN;return Number.isFinite(t)?Math.max(1,Math.min(qe,Math.round(t))):3}var _=e=>Ke[Je(e)-1];function Ye(e,t){let{ref:n,rolloff:r,reach:i}=_(e);return n/(n+r*(Math.min(Math.max(t,n),i)-n))}function Xe(e,t){return Math.max(0,Math.min(1,(_(e).reach-t)/3))}var Ze=10**(-10/20),Qe=.03,$e=.4,et=2.5,tt=e=>Math.min(Math.max(0,e),et),nt=50,rt=.2,it=.1,at=1.2,ot=.16,st=.075,ct={sine:1,triangle:.9,square:.4,sawtooth:.45,custom:.5},lt=5200,ut=.06,v=null,dt=0,ft=null,y={x:0,y:0,z:0},b=0,x=null,S=null,pt=null,C=null,w=null,T={nodes:0},mt=!1,E=null,D=3,ht={level:0,ducked:!1},O=null,k=0,A=0,gt=new Set;function _t(e,t,n){Tt(),v=e,dt=performance.now()+it*1e3,ft=n,y.x=t.x,y.y=t.y,y.z=t.z,b=0,E=null,pt=setInterval(At,nt),At()}function vt(e){e!==mt&&(mt=e,At())}function yt(e){let t=Je(e);t!==D&&(D=t,S&&(Lt(S.bus,ot*_(t).gain),Mt(S.panner)),At())}var bt=()=>A>0||O!==null&&O.currentTime<k;function xt(){A++,Ct(0);let e=!0;return()=>{e&&(e=!1,A--,O&&(k=Math.max(k,O.currentTime)),Ct(0))}}ee((e,t,n)=>{O=e,k=Math.max(k,t+tt(n-t)),Ct(t)});function St(e){return gt.add(e),wt(e,0),()=>void gt.delete(e)}function Ct(e){S&&wt(S.duck,e);for(let t of gt)wt(t,e)}function wt(e,t){let n=e.gain,r=e.context;try{let e=Math.max(r.currentTime,t);n.cancelScheduledValues(e),(A>0||O===r&&k>e)&&n.setTargetAtTime(Ze,e,Qe),A===0&&n.setTargetAtTime(1,O===r?Math.max(e,k):e,$e)}catch{}}function Tt(){pt&&clearInterval(pt),pt=null,v=null,ft=null,x=null,It(S),S=null}function Et(){return v?(performance.now()-dt)/1e3:null}var Dt=()=>v,Ot=()=>({chain:S?.nodes??0,notes:T.nodes,crackle:S?.crackle??!1});function kt(){return!v||mt||document.hidden?0:Xe(D,l(t(),y))}function At(){let e=v;if(!e)return;let n=(performance.now()-dt)/1e3;if(n>=e.duration+at){let e=ft;Tt(),e?.();return}let r=l(t(),y),a=!mt&&!document.hidden&&Xe(D,r)>0?i(`music`):null;if(!a){b=Math.max(b,oe(e,n)),It(S),S=null,(E!==!1||ht.level!==D)&&jt(e,!1);return}try{let t=a.context;(!S||S.bus.context!==t)&&(S=Nt(t,a),Ct(0));let i=o(y,r);Lt(S.edge,Xe(D,r)*(i?.gain??1));let s=Math.min(S.toneHz,i?.cutoff??1/0);s!==S.sentHz&&Rt(t,S.tone.frequency,S.sentHz=s,.15),(x===null||Math.abs(t.currentTime-n-x)>.1)&&(x=t.currentTime-n,b=Math.max(b,oe(e,n)));let c=b;for(;b<e.totalSteps&&ae(e,b)<=n+rt;b++)zt(t,S,e,b,ae(e,b)+x);(b>c&&E!==!0||E&&(ht.level!==D||ht.ducked!==bt()))&&jt(e,!0)}catch{}}function jt(e,t){E=t;let n=bt();ht={level:D,ducked:n};let r=D,i=s(`jukebox:${e.song.id}`,{group:`music`,pos:y,peak:st*_(r).gain*(n?Ze:1),played:t,falloff:e=>Ye(r,e)*Xe(r,e)});i.level=r,i.ducked=n,i.crackle=t&&S?.crackle===!0,o(y)&&(i.occluded=!0)}function Mt(e){let{ref:t,rolloff:n,reach:r}=_(D);e.refDistance=t,e.rolloffFactor=n,e.maxDistance=r}function Nt(e,t){It(S);let n=Pt(e,v.song,ot*_(D).gain),r=e.createGain(),i=e.createGain();i.gain.value=0;let a=p(e,y);Mt(a),n.tone.connect(r).connect(i).connect(a).connect(t);let o=n.tone.frequency.value;return{...n,nodes:n.nodes+3,toneHz:o,sentHz:o,duck:r,edge:i,panner:a}}function Pt(e,t,n){let r=t.texture,i=e.createGain();i.gain.value=n;let a=e.createBiquadFilter();a.type=`lowpass`,a.frequency.value=Math.min(lt,r?.warmth??lt),a.Q.value=.5,i.connect(a);let o={bus:i,keys:i,tone:a,sources:[],nodes:2,crackle:!1};if(r?.wobble){let t=e.createDelay(.05);t.delayTime.value=Ge.delay;let n=e.createOscillator();n.frequency.value=Ge.hz;let r=e.createGain();r.gain.value=Ge.depth,n.connect(r).connect(t.delayTime),t.connect(i),n.start(),o.keys=t,o.sources.push(n),o.nodes+=3}if(r?.crackle){let t=e.createBufferSource();t.buffer=Ft(e),t.loop=!0;let n=e.createGain();n.gain.value=ut,t.connect(n).connect(i),t.start(e.currentTime,Math.random()*ze),o.sources.push(t),o.nodes+=2,o.crackle=!0}return o}function Ft(e){return(!w||w.sampleRate!==e.sampleRate)&&(w=e.createBuffer(1,Math.round(e.sampleRate*ze),e.sampleRate),We(w.getChannelData(0),e.sampleRate,Math.random)),w}function It(e){e&&(Lt(e.bus,0),setTimeout(()=>{for(let t of e.sources)try{t.stop()}catch{}try{e.panner.disconnect()}catch{}},600))}function Lt(e,t){Rt(e.context,e.gain,Math.max(0,t),.05)}function Rt(e,t,n,r){try{let i=e.currentTime;t.cancelScheduledValues(i),t.setTargetAtTime(n,i,r)}catch{}}function zt(e,t,n,r,i){if(i<e.currentTime)return;let a=n.mixes[Math.floor(r/n.stepsPerPass)],{sound:o,texture:s}=n.song,c=t.bus,l=s?.softDrums===!0;for(let s of n.events[r%n.stepsPerPass]){let r=s.steps*n.stepSec;switch(s.voice){case`lead`:a.lead&&Bt(e,t,o.lead,s.midi,i,r,`lead`,1),a.lead&&a.lift&&Bt(e,t,o.lead,s.midi+12,i,r,`lead`,.2);break;case`bass`:Vt(e,c,o.bass,s.midi,i,r,.16,.008,.7);break;case`chord`:Bt(e,t,o.chord,s.midi,i,r,s.steps>=4?`long chord`:`chord`,1);break;case`kick`:a.kick&&(l?Gt:Wt)(e,c,i);break;case`snare`:a.snare&&(l?qt:Kt)(e,c,i);break;case`hat`:a.hat&&Jt(e,c,i,l?.03:.035,l?.022:.035,l?`bandpass`:`highpass`,l?5200:7500)}}}function Bt(e,t,n,r,i,a,o,s){let c=o===`lead`;n===`keys`?Ht(e,t.keys,r,i,a,(c?.09:.022)*s):n===`pad`?Ut(e,t.keys,r,i,a,(c?.08:.04)*s):c?Vt(e,t.bus,n,r,i,a,.13*s,.012,.55):Vt(e,t.bus,n,r,i,a,.045*s,o===`long chord`?.12:.015,.5)}function j(e,t,n){e.context instanceof AudioContext&&(n.nodes+=t,e.onended=()=>{n.nodes-=t})}function Vt(e,t,n,r,i,a,o,s,c,l=T){let u=e.createOscillator(),d=e.createGain();u.type=n,u.frequency.value=re(r);let f=o*ct[n],p=i+Math.max(s+.03,a*.92);d.gain.setValueAtTime(0,i),d.gain.linearRampToValueAtTime(f,i+s),d.gain.setTargetAtTime(f*c,i+s,.12),d.gain.setTargetAtTime(0,p,.03),u.connect(d).connect(t),u.start(i),u.stop(p+.2),j(u,2,l)}function Ht(e,t,n,r,i,a,o=T){let s=re(n),c=e.createOscillator(),l=e.createOscillator(),u=e.createGain(),d=e.createGain();c.frequency.value=s,l.frequency.value=s,u.gain.setValueAtTime(s*1.6,r),u.gain.setTargetAtTime(s*.2,r,.15);let f=r+Math.max(.1,i*.95);d.gain.setValueAtTime(0,r),d.gain.linearRampToValueAtTime(a,r+.005),d.gain.setTargetAtTime(a*.3,r+.005,.45),d.gain.setTargetAtTime(0,f,.09),l.connect(u).connect(c.frequency),c.connect(d).connect(t),c.start(r),l.start(r),c.stop(f+.5),l.stop(f+.5),j(c,4,o)}function Ut(e,t,n,r,i,a,o=T){let s=re(n),c=a/2,l=e.createGain(),u=e.createOscillator(),d=e.createOscillator();u.type=d.type=`triangle`,u.frequency.value=d.frequency.value=s,u.detune.value=-6,d.detune.value=6;let f=Math.min(1.4,i*.4),p=r+i,ee=Math.min(.7,i*.25);l.gain.setValueAtTime(0,r),l.gain.linearRampToValueAtTime(c,r+f),l.gain.setTargetAtTime(0,p,ee),u.connect(l),d.connect(l),l.connect(t),u.start(r),d.start(r),u.stop(p+ee*6),d.stop(p+ee*6),j(u,3,o)}function Wt(e,t,n){let r=e.createOscillator(),i=e.createGain();r.frequency.setValueAtTime(140,n),r.frequency.exponentialRampToValueAtTime(45,n+.12),i.gain.setValueAtTime(.3,n),i.gain.exponentialRampToValueAtTime(1e-4,n+.2),r.connect(i).connect(t),r.start(n),r.stop(n+.22),j(r,2,T)}function Gt(e,t,n){let r=e.createOscillator(),i=e.createGain();r.frequency.setValueAtTime(105,n),r.frequency.exponentialRampToValueAtTime(42,n+.16),i.gain.setValueAtTime(1e-4,n),i.gain.exponentialRampToValueAtTime(.16,n+.008),i.gain.exponentialRampToValueAtTime(1e-4,n+.3),r.connect(i).connect(t),r.start(n),r.stop(n+.32),j(r,2,T)}function Kt(e,t,n){Jt(e,t,n,.13,.13,`bandpass`,1800);let r=e.createOscillator(),i=e.createGain();r.type=`triangle`,r.frequency.setValueAtTime(190,n),r.frequency.exponentialRampToValueAtTime(130,n+.07),i.gain.setValueAtTime(.06,n),i.gain.exponentialRampToValueAtTime(1e-4,n+.08),r.connect(i).connect(t),r.start(n),r.stop(n+.1),j(r,2,T)}function qt(e,t,n){Jt(e,t,n,.16,.045,`bandpass`,2400);let r=e.createOscillator(),i=e.createGain();r.type=`triangle`,r.frequency.setValueAtTime(520,n),r.frequency.exponentialRampToValueAtTime(410,n+.03),i.gain.setValueAtTime(.05,n),i.gain.exponentialRampToValueAtTime(1e-4,n+.045),r.connect(i).connect(t),r.start(n),r.stop(n+.06),j(r,2,T)}function Jt(e,t,n,r,i,a,o){if(!C||C.sampleRate!==e.sampleRate){C=e.createBuffer(1,e.sampleRate,e.sampleRate);let t=C.getChannelData(0);for(let e=0;e<t.length;e++)t[e]=Math.random()*2-1}let s=e.createBufferSource();s.buffer=C;let c=e.createBiquadFilter();c.type=a,c.frequency.value=o,c.Q.value=.8;let l=e.createGain();l.gain.setValueAtTime(i,n),l.gain.exponentialRampToValueAtTime(1e-4,n+r),s.connect(c).connect(l).connect(t),s.start(n,Math.random()*.5),s.stop(n+r+.02),j(s,3,T)}typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmJukeboxPeak`)&&Object.defineProperty(window,"__swarmJukeboxPeak",{value:async(e,t=60)=>{let n=se.findIndex(t=>t.id===e);if(n<0||typeof OfflineAudioContext>`u`)return null;let r=ie(n),i=44100,a=Math.min(t,r.duration+at),o=new OfflineAudioContext(1,Math.ceil(i*a),i),s=Pt(o,r.song,ot);s.tone.connect(o.destination);for(let e=0;e<r.totalSteps&&ae(r,e)<a;e++)zt(o,s,r,e,ae(r,e));let c=(await o.startRendering()).getChannelData(0),l=0,u=0;for(let e of c)l=Math.max(l,Math.abs(e)),u+=e*e;return{id:e,seconds:a,peak:l,rms:Math.sqrt(u/c.length),limit:st}},enumerable:!1,configurable:!1});var Yt=6e4,Xt={"audio/webm":`webm`,"audio/ogg":`ogg`,"audio/mp4":`mp4`,"audio/mpeg":`mp3`,"audio/wav":`wav`,"audio/x-wav":`wav`},Zt=`That recording is too long to transcribe: keep it under 60 seconds.`;function Qt(e){let t=(e??``).split(`;`)[0].trim().toLowerCase();return t in Xt?t:``}function $t(e){return Qt(e.type)?e.bytes>0?e.bytes>5242880||Number.isFinite(e.ms)&&e.ms>63e3?{status:413,message:Zt}:null:{status:400,message:`The recording was empty.`}:{status:415,message:`The office can't transcribe ${e.type?`"${e.type.split(`;`)[0]}"`:`that`} audio: send WebM, Ogg, MP4, MP3 or WAV.`}}var en=e=>e.enabled&&e.phoneChat&&e.micFree&&!e.draft&&!e.muted,tn={kind:`waiting`};function nn(e,t){let n={state:e,effect:null};switch(t.type){case`reply-ended`:return e.kind===`waiting`&&en(t.room)?{state:{kind:`chime`,until:t.now+450},effect:`chime`}:n;case`tick`:return e.kind===`chime`?en(t.room)?t.now>=e.until?{state:{kind:`listening`},effect:`open`}:n:{state:tn,effect:null}:n;case`closed`:return{state:tn,effect:null}}}var rn=e=>!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&!e.isComposing,an=(e,t,n=[`KeyV`])=>n.includes(e.code)&&rn(e)&&t!==`field`;function on(e,t,n,r=[`KeyM`]){return e.key===`Escape`||r.includes(e.code)&&rn(e)&&(t||n===`none`)}var sn=1200,cn=8e3,ln=e=>({start:e,lastSpeech:null,levels:[],heard:0}),un=e=>e.levels.length?Math.min(...e.levels):0,dn=(e,t)=>({...e,lastSpeech:t});function fn(e,t,n){if(!Number.isFinite(t)||t<0)return e;let r=[...e.levels,t].slice(-60),i=e.heard>=6&&t>=Math.max(.02,un({...e,levels:r})*3);return{...e,levels:r,heard:e.heard+1,lastSpeech:i?n:e.lastSpeech}}function pn(e,t){return{silenceMs:e===`hold`&&!t?null:sn,noSpeechMs:e===`hold`?null:cn,maxMs:Yt}}var mn=(e,t)=>e===`handsfree`||t;function hn(e,t,n){return t-e.start>=n.maxMs?`too-long`:e.lastSpeech===null?n.noSpeechMs!==null&&t-e.start>=n.noSpeechMs?`no-speech`:`listening`:n.silenceMs!==null&&t-e.lastSpeech>=n.silenceMs?`done`:`listening`}function gn(e,t=!0){let n=e.replace(/[([](?:laughter|laughs|music|applause|noise|silence|inaudible|cough(?:ing)?|background noise|sound)[)\]]/gi,` `).replace(/\s+/g,` `).trim();return t?n.charAt(0).toUpperCase()+n.slice(1):n}function _n(e,t){let n=e.replace(/\s+$/,``),r=gn(t,!n||/[.!?]$/.test(n));return r?n?`${n} ${r}`:r:e}function vn(e){return{text:e.map(e=>e.transcript.trim()).filter(Boolean).join(` `),speaking:e.some(e=>!e.final&&e.transcript.trim())}}function yn(e,t){let n=bn(e);return n===null?null:u(t,n,{code:e})}function bn(e){switch(e){case`aborted`:case`no-speech`:case`AbortError`:return null;case`not-allowed`:case`service-not-allowed`:case`NotAllowedError`:case`SecurityError`:return`🎙️ The microphone is blocked for the office. Allow it from the icon at the left of the address bar to talk instead of type.`;case`audio-capture`:case`NotFoundError`:case`NotReadableError`:case`OverconstrainedError`:return`🎙️ No microphone is working here. Plug one in (or close what's using it), or keep typing.`;case`network`:return`🎙️ The browser's speech service couldn't be reached. Try again, or pick ElevenLabs in Settings → Voice.`;case`language-not-supported`:return`🎙️ The browser can't recognise your language. Pick ElevenLabs in Settings → Voice.`;case`startup-timeout`:return`🎙️ Speech recognition did not start. Check microphone permissions and try Chrome (verified). Some browsers, including Brave, may expose speech recognition without a working service. You can also type or use Windows + H on Windows.`;case`recording-startup-timeout`:return`🎙️ The microphone did not start. Check microphone permissions and the selected input device, then try again.`;default:return`🎙️ Listening stopped ({code}).`}}function xn(e,t,n,r){return u(r,Sn(e,t,n))}function Sn(e,t,n){return e===`browser`&&!t.recognition?`🎙️ This browser can't turn speech into text. Use Chrome, Edge or Safari, or pick ElevenLabs in Settings → Voice.`:e===`elevenlabs`&&!t.recorder?`🎙️ This browser can't record from a microphone, so ElevenLabs can't hear you. Use a current Chrome, Edge, Firefox or Safari.`:e===`elevenlabs`&&!n?`🎙️ Add your ElevenLabs API key in Settings → Voice to talk instead of type.`:``}var M=e(()=>({state:`idle`,mode:null,target:null,live:!1,chiming:!1})),N=new Map;function Cn(e){return N.delete(e.id),N.set(e.id,e),()=>{N.get(e.id)===e&&(N.delete(e.id),L?.target.id===e.id&&G(`gone`))}}var wn=!1,Tn=()=>{let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null},En=()=>wn?ir:Tn();function Dn(){return{recognition:!!En(),recorder:typeof MediaRecorder<`u`&&!!navigator.mediaDevices?.getUserMedia}}var P=()=>f.getState().settings.listen??{provider:`off`,autoSend:!1,handsFree:!1},F=e=>yn(e,f.getState().settings.language);function I(){let{provider:e}=P();return e===`off`?``:xn(e,Dn(),f.getState().voiceKeySet,f.getState().settings.language)}var L=null,On=0,R=[],z=null,kn=``,An=``,B=!1,jn=!1,Mn=1e4,V=e=>M.setState(e);function Nn(e,t){let n=N.get(e);if(!n||L||n.disabled())return;let{provider:r}=P();if(r===`off`)return;let i=I();if(i)return void Bn(i,e);let a=++On,o={n:a,target:n,mode:t,provider:r,base:n.text(),transcript:``,ears:null,hearing:null,began:performance.now(),finishing:!1,release:Vn(),tick:setInterval(()=>Ln(a),100)};L=o,z={provider:r,mode:t,start:o.began,end:null,transcript:``,outcome:null},R.push(z),R.length>30&&R.splice(0,R.length-30),An=``,V({state:`listening`,mode:t,target:e,live:!1,chiming:!1}),r===`browser`?o.hearing=Hn(a):Wn(a)}function Pn(e){L?.target.id===e&&L.mode===`hold`&&(L.mode=`tap`,z&&(z.mode=`tap`),V({mode:`tap`}))}function Fn(e){L&&(!e||L.target.id===e)&&U()}function In(e,t=`stopped`){L&&(!e||L.target.id===e)&&G(t)}var H=e=>L?.n===e?L:null;function Ln(e){let t=H(e);if(!t||t.finishing)return;let n=performance.now();if(!t.ears){n-t.began>Mn&&K(e,F(t.provider===`browser`?`startup-timeout`:`recording-startup-timeout`));return}let r=hn(t.ears,n,pn(t.mode,P().autoSend));r===`no-speech`?G(`nothing`):r!==`listening`&&U()}function Rn(e){let t=H(e);!t||t.ears||t.finishing||(t.ears=ln(performance.now()),B=!0,V({live:!0}))}function zn(e,t,n){let r=H(e);r&&(r.ears||Rn(e),n&&r.ears&&(r.ears=dn(r.ears,performance.now())),r.transcript=t,z&&(z.transcript=t),kn=t,r.target.setText(_n(r.base,t)))}function U(){let e=L;if(!e||e.finishing)return;if(e.finishing=!0,!e.hearing)return W(e);e.hearing.stop();let t=e.n;setTimeout(()=>{H(t)&&e.provider===`browser`&&W(e)},2500)}function W(e){if(L!==e)return;let t=e.transcript.trim(),n=_n(e.base,t);t&&e.target.setText(n);let r=!!t&&mn(e.mode,P().autoSend)&&!e.target.disabled();q(t?r?`sent`:`filled`:`nothing`),r&&(e.target.setText(``),e.target.send(n))}function G(e){let t=L;t&&(t.hearing?.abort(),q(e===`nothing`?`nothing`:`stopped`))}function K(e,t){let n=H(e);if(n){if(!t){n.transcript?W(n):q(`nothing`);return}n.hearing?.abort(),An=t,q(`error`),f.getState().pushToast(`error`,t),V({state:`error`,target:n.target.id}),setTimeout(()=>M.getState().state===`error`&&!L&&V({state:`idle`,target:null}),3e3)}}function q(e){let t=L;t&&(L=null,clearInterval(t.tick),t.release?.(),t.release=null,z&&=(z.end=performance.now(),z.outcome=e,null),V({state:`idle`,mode:null,target:null,live:!1}),t.mode===`handsfree`&&(e!==`sent`&&a(!1),X({type:`closed`})))}function Bn(e,t){An=e,f.getState().pushToast(`info`,e),V({state:`error`,target:t}),setTimeout(()=>M.getState().state===`error`&&!L&&V({state:`idle`,target:null}),3e3)}function Vn(){let e=xt();n(!0);let t=typeof speechSynthesis<`u`?speechSynthesis:null,r=!!t?.speaking&&!t.paused;return r&&t.pause(),()=>{e(),n(!1),r&&t.resume()}}function Hn(e){let t=En();if(!t)return queueMicrotask(()=>K(e,I()||F(`audio-capture`))),null;let n=new t;n.lang=d(f.getState().settings.language),n.continuous=!0,n.interimResults=!0,n.onstart=()=>Rn(e),n.onresult=t=>{let{text:n,speaking:r}=vn(Array.from(t.results,e=>({transcript:e[0]?.transcript??``,final:e.isFinal})));zn(e,n,r)},n.onerror=t=>{K(e,F(t.error))},n.onend=()=>{let t=H(e);t&&W(t)};try{n.start()}catch{return queueMicrotask(()=>K(e,F(`audio-capture`))),null}return{stop:()=>n.stop(),abort:()=>{n.onstart=n.onresult=n.onerror=n.onend=null;try{n.abort()}catch{}}}}var Un=[`audio/webm;codecs=opus`,`audio/ogg;codecs=opus`,`audio/mp4`,`audio/webm`];async function Wn(e){let t;try{t=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(t){return K(e,F(t?.name||`audio-capture`))}let n=()=>t.getTracks().forEach(e=>e.stop()),r=H(e);if(!r||r.finishing)return n();let i=Un.find(e=>MediaRecorder.isTypeSupported?.(e)),a;try{a=new MediaRecorder(t,i?{mimeType:i}:void 0)}catch{return n(),K(e,F(`audio-capture`))}let o=[],s=0,c=!1,l=Gn(t,t=>{let n=H(e);n?.ears&&(n.ears=fn(n.ears,t,performance.now()))});a.ondataavailable=e=>{o.push(e.data),s+=e.data.size,s>4980736&&U()},a.onstop=()=>{n(),l();let t=H(e);t&&!c&&Kn(t,new Blob(o,{type:a.mimeType||i||`audio/webm`}),performance.now()-(t.ears?.start??t.began))},r.hearing={stop:()=>a.state!==`inactive`&&a.stop(),abort:()=>{c=!0,a.state===`inactive`?n():a.stop()}},a.start(1e3),Rn(e)}function Gn(e,t){let n=null,r=null;try{n=new AudioContext,n.resume().catch(()=>void 0);let i=n.createAnalyser();i.fftSize=1024,n.createMediaStreamSource(e).connect(i);let a=new Float32Array(i.fftSize);r=setInterval(()=>{i.getFloatTimeDomainData(a);let e=0;for(let t of a)e+=t*t;t(Math.sqrt(e/a.length))},50)}catch{}return()=>{r&&clearInterval(r),n?.close().catch(()=>void 0)}}async function Kn(e,t,n){if(e.mode===`handsfree`&&e.ears?.lastSpeech==null)return q(`nothing`);let r=$t({bytes:t.size,ms:n,type:t.type});if(r)return K(e.n,`🎙️ ${r.message}`);V({state:`transcribing`,live:!1}),e.release?.(),e.release=null;try{let r=await fetch(`/api/voice/transcribe`,{method:`POST`,headers:{"Content-Type":t.type,"X-Clip-Ms":String(Math.round(n))},body:t}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(typeof i.error==`string`?i.error:`HTTP ${r.status}`);if(L!==e)return;e.transcript=typeof i.text==`string`?i.text:``,kn=e.transcript,z&&(z.transcript=e.transcript),W(e)}catch(t){L===e&&K(e.n,`🎙️ ${t.message}`)}}var J=tn,Y=null,qn=()=>[...N.values()].reverse().find(e=>e.kind===`phone`)??null;function Jn(){let e=f.getState(),t=P(),n=e.overlay,i=qn();return{enabled:t.handsFree&&t.provider!==`off`&&e.settings.voice.provider!==`off`&&!I()&&B,phoneChat:n?.kind===`phone`&&(n.tab??`chat`)===`chat`&&!!i&&!i.disabled()&&document.visibilityState===`visible`&&!ne(),micFree:!L,draft:!!i?.text().trim(),muted:r().muted}}function X(e){let t=nn(J,e);if(J=t.state,V({chiming:J.kind===`chime`}),Y&&J.kind!==`chime`&&(clearTimeout(Y),Y=null),t.effect===`chime`&&(a(!0),Y=setTimeout(()=>{Y=null,X({type:`tick`,now:performance.now(),room:Jn()})},Math.max(0,(J.kind===`chime`?J.until:0)-performance.now()))),t.effect===`open`){let e=qn();e&&Nn(e.id,`handsfree`),L||X({type:`closed`})}}function Yn(){let e=Jn();P().handsFree&&!B&&e.phoneChat&&!jn&&(jn=!0,f.getState().pushToast(`info`,`🎧 Hold 🎙️ once to let the office use your microphone, then hands-free can listen.`)),X({type:`reply-ended`,now:performance.now(),room:e})}function Xn(e){return I()||(f.getState().settings.voice.provider===`off`?`Hands-free needs ${e}'s voice: turn on Speak messages in Settings → Voice.`:``)}async function Zn(e,t){let n=e?Xn(t):``;if(n)return f.getState().pushToast(`info`,n);(!e||await Qn())&&await te.updateSettings({listen:{...P(),handsFree:e}}).catch(()=>void 0)}async function Qn(){if(B)return!0;try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),B=!0,!0}catch(e){let t=F(e?.name||`audio-capture`);return t&&f.getState().pushToast(`error`,t),!1}}var Z=null,Q=!1;function $n(e){let t=e;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)){let e=t,n=t.tagName!==`SELECT`&&e.form?[...N.values()].find(t=>t.form()===e.form)??null:null;return n&&!e.disabled&&!e.readOnly?{place:`mic-box`,target:n,box:e}:{place:`field`,target:null,box:null}}return{place:`none`,target:[...N.values()].reverse().find(e=>!e.disabled())??null,box:null}}function er(){let e=Z;if(!e)return;Z=null,clearTimeout(e.timer);let t=e.box;t&&document.activeElement===t&&(document.execCommand(`insertText`,!1,e.key)||(t.setRangeText(e.key,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,`end`),t.dispatchEvent(new Event(`input`,{bubbles:!0}))))}function tr(e){let{talk:t,mute:n}=g(),r=t.includes(e.code);if(r&&e.repeat&&(Z||Q))return void e.preventDefault();Z&&!r&&er();let{place:i,target:a,box:o}=$n(e.target),s=L;if(s){on(e,s.mode===`handsfree`,i,n)&&(e.preventDefault(),e.stopImmediatePropagation(),G(`stopped`));return}if(J.kind===`chime`&&on(e,!0,i,n)){e.preventDefault(),e.stopImmediatePropagation(),X({type:`closed`});return}!e.repeat&&a&&an(e,i,t)&&!ne()&&P().provider!==`off`&&(e.preventDefault(),Z={target:a,key:e.key,box:o,timer:setTimeout(()=>{Z=null,Q=!0,Nn(a.id,`hold`)},300)})}function nr(e){g().talk.includes(e.code)&&(Z?er():Q&&(Q=!1,L?.mode===`hold`&&U()))}function rr(e){let t=L,n=e.target;t&&n?.form&&n.form===t.target.form()&&G(`stopped`)}if(typeof window<`u`){window.addEventListener(`keydown`,tr,!0),window.addEventListener(`keyup`,nr,!0),window.addEventListener(`input`,rr,!0),window.addEventListener(`blur`,()=>{Z&&=(clearTimeout(Z.timer),null),Q&&L?.mode===`hold`&&U(),Q=!1}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&(In(),J.kind===`chime`&&X({type:`closed`}))});let e=r().muted;c(()=>{let t=r().muted;t&&!e&&L&&L.mode!==`hold`&&G(`stopped`),e=t}),navigator.permissions?.query({name:`microphone`}).then(e=>{B||=e.state===`granted`,e.addEventListener(`change`,()=>B=e.state===`granted`)}).catch(()=>void 0)}var $=null,ir=class{lang=``;continuous=!1;interimResults=!1;onstart=null;onresult=null;onerror=null;onend=null;phrases=[];start(){$=this,setTimeout(()=>this.onstart?.(),30)}stop(){this.end()}abort(){this.end()}end(){$===this&&($=null,setTimeout(()=>this.onend?.(),30))}say(e,t){this.phrases=[...this.phrases.filter(e=>e.isFinal),{isFinal:t,0:{transcript:e}}],this.onresult?.({results:this.phrases})}};window.__swarmMic={get state(){return M.getState().state},get mode(){return M.getState().mode},get live(){return M.getState().live},get provider(){return P().provider},get transcript(){return kn},get error(){return An},get supported(){return Dn()},get handsFree(){return J.kind},history:R,fake(e=!0){wn=e,e&&(B=!0)},say(e,t=!0){let n=L;return n?n.provider===`elevenlabs`?(n.ears&&=dn(n.ears,performance.now()),!0):$?($.say(e,!1),t&&$.say(e,!0),!0):!1:!1}};export{Ne as A,ue as B,vt as C,qe as D,Ze as E,Pe as F,ge as G,_e as H,h as I,ye as K,Re as L,Le as M,Fe as N,Je as O,Me as P,m as R,yt as S,Vt as T,be as U,he as V,xe as W,Ot as _,Dn as a,Ut as b,Yn as c,M as d,xn as f,bt as g,kt as h,Nn as i,je as j,g as k,Zn as l,xt as m,Xn as n,I as o,St as p,Pn as r,Cn as s,Fn as t,In as u,Et as v,Tt as w,_t as x,Dt as y,Te as z};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-BFUkm7bt.js";import{Mt as t,Xi as n,g as r,p as i}from"./store-FA83kfnc.js";import{a,i as o,r as s,t as c,u as l}from"./gate-BplJKcLG.js";import{i as u,n as d}from"./useDayTime-0XsqM14Q.js";import{$n as f}from"./Office-BBnd6tyn.js";import{a as p,g as m,h,l as g,m as ee,n as _,o as v,s as te,t as y}from"./gallery-ColCPQQE.js";var b=[`none`,`warm`,`night`,`mono`,`polaroid`,`comic`],ne={none:`None`,warm:`Warm film`,night:`Cool night`,mono:`Black & white`,polaroid:`Polaroid`,comic:`Comic book`},x={saturation:1,contrast:1,gain:[1,1,1],lift:[0,0,0],vignette:0,grain:0,posterize:0,ink:0,frame:!1},S={none:x,warm:{...x,saturation:1.08,contrast:1.06,gain:[1.07,1,.84],lift:[.045,.025,0],vignette:.32,grain:.045},night:{...x,saturation:.82,contrast:1.12,gain:[.78,.9,1.12],lift:[0,.012,.045],vignette:.45,grain:.03},mono:{...x,saturation:0,contrast:1.18,vignette:.3,grain:.055},polaroid:{...x,saturation:.88,contrast:.94,gain:[1.04,1,.9],lift:[.07,.06,.05],vignette:.22,grain:.03,frame:!0},comic:{...x,saturation:1.4,contrast:1.12,posterize:6,ink:1}},C=e=>e.saturation!==1||e.contrast!==1||e.gain[0]!==1||e.gain[1]!==1||e.gain[2]!==1||e.lift[0]!==0||e.lift[1]!==0||e.lift[2]!==0||e.vignette>0||e.grain>0||e.posterize>0||e.ink>0,re=e=>b.includes(e),w=Math.PI/4,T=1.5,ie=2.4,ae=3.5,oe=.9,E={x:120,z:120,yMin:-6,yMax:60},D=(e,t,n,r,i,a)=>({x:e,y:t,z:n,yaw:r,pitch:i,roll:0,fov:a,vx:0,vy:0,vz:0}),O=(e,t,n)=>Math.min(n,Math.max(t,e));function se(e,t,n){let r=ie*(t.fast?ae:1),i=Math.cos(e.pitch),a=Math.sin(e.yaw),o=Math.cos(e.yaw),s=(-a*i*t.forward+o*t.right)*r,c=(Math.sin(e.pitch)*t.forward+t.up)*r,l=(-o*i*t.forward-a*t.right)*r,u=1-Math.exp(-7*n);e.vx+=(s-e.vx)*u,e.vy+=(c-e.vy)*u,e.vz+=(l-e.vz)*u,e.x=O(e.x+e.vx*n,-E.x,E.x),e.y=O(e.y+e.vy*n,E.yMin,E.yMax),e.z=O(e.z+e.vz*n,-E.z,E.z),k(e,t.roll,n)}function k(e,t,n){t&&(e.roll=O(e.roll+t*oe*n,-w,w))}function ce(e,t,n){e.yaw-=t,e.pitch=O(e.pitch-n,-1.5,T)}function le(e,t){return O(e*Math.exp(t*.0012),15,110)}function ue(e){e.vx=0,e.vy=0,e.vz=0}var de=2*Math.PI/45;function fe(e,t,n,r){let i=e.x-t,a=e.z-r;return{cx:t,cy:n,cz:r,radius:O(Math.hypot(i,a),1.2,12),height:O(e.y-n,-.5,4),angle:Math.atan2(i,a),speed:de}}function pe(e,t,n){e.angle+=e.speed*n,t.x=e.cx+Math.sin(e.angle)*e.radius,t.z=e.cz+Math.cos(e.angle)*e.radius,t.y=e.cy+e.height,me(t,e.cx,e.cy,e.cz),ue(t)}function me(e,t,n,r){let i=t-e.x,a=n-e.y,o=r-e.z;e.yaw=Math.atan2(-i,-o),e.pitch=O(Math.atan2(a,Math.hypot(i,o)),-1.5,T)}function A(e,t){let n=Math.min(e,t);return{side:Math.round(n*.045),top:Math.round(n*.045),bottom:Math.round(n*.16)}}var j=`Fredoka, 'Segoe UI', system-ui, sans-serif`;function M(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()}function N(e,n,r,i){let a=Math.min(n,r)/100,o={x:0,y:0,w:n,h:r};if(e.save(),i.frame){let t=A(n,r);o={x:t.side,y:t.top,w:n-2*t.side,h:r-t.top-t.bottom},e.fillStyle=`#f7f3ea`,e.beginPath(),e.rect(0,0,n,r),e.rect(o.x,o.y,o.w,o.h),e.fill(`evenodd`),e.strokeStyle=`rgba(60, 50, 30, 0.18)`,e.lineWidth=Math.max(1,a*.25),e.strokeRect(o.x,o.y,o.w,o.h)}if(i.guides){e.strokeStyle=`rgba(255, 255, 255, 0.55)`,e.lineWidth=Math.max(1,a*.12),e.beginPath();for(let t of[1/3,2/3])e.moveTo(o.x+o.w*t,o.y),e.lineTo(o.x+o.w*t,o.y+o.h),e.moveTo(o.x,o.y+o.h*t),e.lineTo(o.x+o.w,o.y+o.h*t);e.stroke()}if(i.caption){if(i.frame){let t=A(n,r);e.fillStyle=`#3a3226`,e.font=`600 ${Math.round(t.bottom*.3)}px ${j}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(i.caption,n/2,r-t.bottom/2,n-2*t.side)}else{let t=Math.round(a*3.2);e.font=`600 ${t}px ${j}`;let n=Math.min(e.measureText(i.caption).width,o.w*.7),r=t*.55,s=o.x+a*3,c=o.y+o.h-a*3-t-r;e.fillStyle=`rgba(20, 20, 30, 0.55)`,M(e,s,c,n+r*2,t+r*1.4,t*.45),e.fill(),e.fillStyle=`#fff`,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(i.caption,s+r,c+(t+r*1.4)/2,n)}}if(i.stamp){let n=Math.round(a*3.4);e.font=`700 ${n}px ${j}`;let r=n*1.5,s=Math.min(e.measureText(i.stamp).width+r,o.w*.5),c=n*.5,l=s+c*2,u=n+c*1.3,d=o.x+o.w-a*3-l,f=i.frame?o.y+a*3:o.y+o.h-a*3-u;e.fillStyle=`rgba(255, 250, 240, 0.92)`,e.strokeStyle=`#1f1d2b`,e.lineWidth=Math.max(1,n*.12),M(e,d,f,l,u,u*.35),e.fill(),e.stroke(),e.fillStyle=`#ff8a5b`,e.textAlign=`left`,e.textBaseline=`middle`,t(e,d+c,f+(u-n*1.3)/2,n*1.3),e.fillStyle=`#1f1d2b`,e.fillText(i.stamp,d+c+r,f+u/2,Math.max(1,s-r))}e.restore()}var he=e=>e.frame||!!e.stamp||!!e.caption,ge=1920;function _e(e){let t=Math.min(1,ge/Math.max(1,e.source.width)),n=Math.max(2,Math.round(e.source.width*t/2)*2),r=Math.max(2,Math.round(e.source.height*t/2)*2),i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`,{alpha:!1}),o=null;he(e.overlay)&&(o=document.createElement(`canvas`),o.width=n,o.height=r,N(o.getContext(`2d`),n,r,{...e.overlay,guides:!1}));let s=i.captureStream(e.fps),c=e.audio?.getAudioTracks().map(e=>e.clone())??[];for(let e of c)s.addTrack(e);let l=n*r*e.fps,u=new MediaRecorder(s,{mimeType:e.type,videoBitsPerSecond:Math.round(Math.min(16e6,Math.max(25e5,l*.09))),audioBitsPerSecond:128e3}),d=[];u.ondataavailable=e=>{e.data.size&&d.push(e.data)};let f=new Promise((t,n)=>{u.onstop=()=>t(new Blob(d,{type:e.type.split(`;`)[0]})),u.onerror=()=>n(Error(`the recording failed`))});u.start(1e3);let p=performance.now(),m=setTimeout(e.onLimit,e.seconds*1e3),h=!1;return{width:n,height:r,draw(){h||(a.drawImage(e.source,0,0,n,r),o&&a.drawImage(o,0,0))},elapsed:()=>(performance.now()-p)/1e3,stop(){if(!h){h=!0,clearTimeout(m),u.state!==`inactive`&&u.stop();let e=()=>{for(let e of s.getTracks())e.stop()};f.then(e,e)}return f}}}var ve=[10,30,60],P=.735,F=e(()=>({filter:`none`,stamp:!0,caption:!1,guides:!0,dof:!1,focus:4,blur:.5,daytime:null,scale:2,fps:30,clipSeconds:10,orbit:`free`,panel:!0,recording:null,busy:null,note:null})),I=D(0,1.65,0,0,0,72),L=null,ye=e=>void(L=e),R=!0,be=()=>void(R=!0);function xe(){let e=R;return R=!1,e}var z=null,B=null,V=[],Se=()=>B;function H(e,t=`info`,n){F.setState({note:{text:e,level:t,message:n}})}function Ce(e=!!document.pointerLockElement){return a()||!c()?!1:(z={locked:e,daytime:d.frozen},i.getState().setFocus(null),F.setState({daytime:null,orbit:`free`,panel:!0,note:null,busy:null}),r(!0),l.setState({active:!0,frozen:!0}),R=!0,!0)}function U(){if(!a())return;B&&X();let e=z;z=null,d.frozen=e?.daytime??null,u(),r(!1),s(),l.setState({active:!1,frozen:!1}),e?.locked&&!document.pointerLockElement?f():!e?.locked&&document.pointerLockElement&&document.exitPointerLock()}function W(e){a()&&(r(e),l.setState({frozen:e}),R=!0)}function G(e){let t=e===null?null:(e%1+1)%1;d.frozen=t??z?.daytime??null,u(),F.setState({daytime:t}),R=!0}function K(e){F.setState(e),R=!0}function q(e){let t=F.getState(),n=_();return{frame:S[t.filter].frame,stamp:t.stamp?i.getState().settings.companyName||`Droidsembly`:null,caption:t.caption?te(n.label,n.floor,new Date):null,guides:e&&t.guides}}function we(){let e=L?.focusCenter()??null;return e===null?(H(`Nothing in the middle of the view to focus on.`,`info`,[{key:`Nothing in the middle of the view to focus on.`}]),null):(K({dof:!0,focus:Math.round(e*10)/10}),e)}async function J(e=F.getState().scale){if(!L||F.getState().busy)return null;F.setState({busy:`Developing…`});try{let t=await L.shot(e),n=g(_().label,new Date,`png`),r=y(t.png,{kind:`shot`,name:n,width:t.width,height:t.height,seconds:null},t.thumb);m(r.url,n);let i=await h(t.png),a=t.scale<e?` (${e}× was too big for the browser, so ${Math.round(t.scale*10)/10}×)`:``;return H(`📸 Saved ${n}, ${t.width}×${t.height}${a}${i?`, and copied it`:``}`,`info`,[{key:`📸 Saved {name}, {width}×{height}`,values:{name:n,width:t.width,height:t.height}},...a?[{key:` ({requested}× was too big for the browser, so {actual}×)`,values:{requested:e,actual:Math.round(t.scale*10)/10}}]:[],...i?[{key:`, and copied it`}]:[]]),{name:n,width:t.width,height:t.height,bytes:t.png.size,copied:i}}catch(e){let t=e instanceof Error?e.message:String(e);return H(`The shot failed: ${t}`,`error`,[{key:`The shot failed: {error}`,values:{error:t}}]),null}finally{F.setState({busy:null})}}function Y(){if(B)return new Promise(e=>V.push(e));let e=o(),t=ee(e);if(!t.ok||!e){let e=t.ok?`The 3D view is not ready.`:t.why;return H(e,`error`,[{key:e}]),Promise.resolve(null)}let r=F.getState();try{B=_e({source:e,fps:r.fps,seconds:r.clipSeconds,overlay:q(!1),audio:n(),type:t.type,onLimit:()=>void X()})}catch(e){let t=e instanceof Error?e.message:String(e);return H(`Recording could not start: ${t}`,`error`,[{key:`Recording could not start: {error}`,values:{error:t}}]),Promise.resolve(null)}return F.setState({recording:{started:performance.now(),limit:r.clipSeconds,fps:r.fps},note:null}),R=!0,new Promise(e=>V.push(e))}async function X(){let e=B;if(!e)return null;B=null;let t=e.elapsed(),n=V;V=[],F.setState({recording:null,busy:`Saving the clip…`});let r=null;try{let n=await e.stop(),i=g(_().label,new Date,`webm`),a=y(n,{kind:`clip`,name:i,width:e.width,height:e.height,seconds:t});m(a.url,i),r={name:i,bytes:n.size,seconds:t,type:n.type,width:e.width,height:e.height},H(`🎬 Saved ${i}, ${Math.round(t)} s at ${e.width}×${e.height}`,`info`,[{key:`🎬 Saved {name}, {seconds} s at {width}×{height}`,values:{name:i,seconds:Math.round(t),width:e.width,height:e.height}}])}catch(e){let t=e instanceof Error?e.message:String(e);H(`The clip failed: ${t}`,`error`,[{key:`The clip failed: {error}`,values:{error:t}}])}finally{F.setState({busy:null})}for(let e of n)e(r);return r}var Te=()=>B?X():Y(),Z=(e,t=100)=>Math.round(e*t)/t,Q=e=>Z(e*180/Math.PI,10),$={state(){let e=F.getState();return{frozen:l.getState().frozen,camera:{x:Z(I.x),y:Z(I.y),z:Z(I.z),yaw:Q(I.yaw),pitch:Q(I.pitch),roll:Q(I.roll),fov:Z(I.fov,10)},filter:e.filter,overlays:{stamp:e.stamp,caption:e.caption,guides:e.guides},dof:e.dof?{focus:e.focus,blur:e.blur}:null,daytime:e.daytime,orbit:e.orbit,recording:e.recording?{seconds:Z((performance.now()-e.recording.started)/1e3,10),limit:e.recording.limit,fps:e.recording.fps}:null,busy:e.busy,note:e.note?.text??null,frames:L?.frames()??0,gallery:p.getState().items.map(e=>({kind:e.kind,name:e.name,bytes:e.bytes,width:e.width,height:e.height,seconds:e.seconds&&Z(e.seconds,10)}))}},set(e){let t={};re(e.filter)&&(t.filter=e.filter);for(let n of[`stamp`,`caption`,`guides`,`dof`,`panel`])typeof e[n]==`boolean`&&(t[n]=e[n]);return typeof e.focus==`number`&&(t.focus=Math.max(.3,e.focus)),typeof e.blur==`number`&&(t.blur=Math.min(1,Math.max(0,e.blur))),v.includes(e.scale)&&(t.scale=e.scale),(e.fps===30||e.fps===60)&&(t.fps=e.fps),typeof e.clipSeconds==`number`&&(t.clipSeconds=Math.min(60,Math.max(1,e.clipSeconds))),typeof e.orbit==`string`&&(t.orbit=e.orbit),K(t),e.daytime===`golden`?G(P):(typeof e.daytime==`number`||e.daytime===null)&&G(e.daytime),typeof e.frozen==`boolean`&&W(e.frozen),typeof e.fov==`number`&&(I.fov=Math.min(110,Math.max(15,e.fov))),typeof e.roll==`number`&&(I.roll=Math.min(w,Math.max(-w,e.roll*Math.PI/180))),$.state()},fly(e,t,n,r=0,i=0){return Object.assign(I,{x:e,y:t,z:n,yaw:r*Math.PI/180,pitch:i*Math.PI/180,vx:0,vy:0,vz:0}),K({orbit:`free`}),$.state().camera},shot:e=>J(v.includes(e)?e:void 0),record(e,t){return $.set({clipSeconds:e,fps:t?.fps,orbit:t?.orbit}),Y()}};export{ve as CLIP_SECONDS,P as GOLDEN_HOUR,D as a,Se as activeClip,k as c,I as cam,ne as d,Ce as enter,S as f,we as focusCenter,ce as i,le as l,U as leave,w as n,fe as o,q as overlayOptions,C as p,$ as probe,se as r,be as requestFrame,pe as s,ye as setBridge,G as setDaytime,W as setFrozen,Y as startRecording,X as stopRecording,N as t,xe as takeRedraw,J as takeShot,Te as toggleRecording,b as u,K as update,F as usePhoto};
@@ -1 +0,0 @@
1
- import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Ct as s,D as c,Dt as l,E as u,Et as d,F as f,Ft as p,G as m,Gt as h,H as g,Ht as _,I as v,It as y,J as b,Jt as x,K as S,Kt as C,L as w,Lt as T,M as E,Mt as D,N as O,Nt as k,O as A,Ot as j,P as M,Pt as N,Q as P,Qt as F,R as I,Rt as L,S as R,St as z,T as B,Tt as V,U as H,Ut as U,V as W,Vt as G,W as K,Wt as q,X as J,Xt as Y,Y as X,Yt as Z,Z as Q,Zt as $,_t as ee,an as te,at as ne,bt as re,cn as ie,ct as ae,dt as oe,en as se,et as ce,ft as le,gt as ue,ht as de,in as fe,it as pe,j as me,jt as he,k as ge,kt as _e,lt as ve,mt as ye,nn as be,nt as xe,on as Se,ot as Ce,pt as we,q as Te,qt as Ee,rn as De,rt as Oe,sn as ke,st as Ae,tn as je,tt as Me,ut as Ne,vt as Pe,w as Fe,wt as Ie,xt as Le,yt as Re,z as ze,zt as Be}from"./Office-BBnd6tyn.js";export{be as ActiveCollisionTypes,E as ActiveEvents,k as ActiveHooks,ie as Ball,G as BroadPhase,_ as CCDSolver,B as Capsule,Se as CharacterCollision,Fe as CoefficientCombineRule,we as Collider,s as ColliderDesc,Ee as ColliderSet,j as ColliderShapeCastHit,w as Cone,N as ConvexPolyhedron,je as Cuboid,De as Cylinder,Ce as DebugRenderBuffers,g as DebugRenderPipeline,f as DynamicRayCastVehicleController,Me as EventQueue,ze as FeatureType,m as FixedImpulseJoint,I as FixedMultibodyJoint,ce as GenericImpulseJoint,ee as HalfSpace,A as HeightFieldFlags,q as Heightfield,W as ImpulseJoint,C as ImpulseJointSet,ne as IntegrationParameters,pe as IslandManager,R as JointAxesMask,z as JointData,ue as JointType,S as KinematicCharacterController,xe as MassPropsMode,se as MotorModel,K as MultibodyJoint,d as MultibodyJointSet,oe as NarrowPhase,H as PhysicsPipeline,P as PidAxesMask,b as PidController,ve as PointColliderProjection,p as PointProjection,c as Polyline,Pe as PrismaticImpulseJoint,$ as PrismaticMultibodyJoint,Ne as Quaternion,U as QueryFilterFlags,X as Ray,re as RayColliderHit,ye as RayColliderIntersection,Ie as RayIntersection,Z as RevoluteImpulseJoint,h as RevoluteMultibodyJoint,v as RigidBody,T as RigidBodyDesc,he as RigidBodySet,ke as RigidBodyType,Te as RopeImpulseJoint,Ae as RotationOps,L as RoundCone,me as RoundConvexPolyhedron,o as RoundCuboid,Oe as RoundCylinder,ge as RoundTriangle,J as SdpMatrix3,F as SdpMatrix3Ops,i as Segment,D as SerializationPipeline,t as Shape,fe as ShapeCastHit,Q as ShapeContact,_e as ShapeType,n as SolverFlags,le as SphericalImpulseJoint,x as SphericalMultibodyJoint,M as SpringImpulseJoint,Y as TempContactForceEvent,ae as TempContactManifold,O as TriMesh,u as TriMeshFlags,r as Triangle,te as UnitImpulseJoint,Be as UnitMultibodyJoint,l as Vector3,a as VectorOps,e as Voxels,Re as World,y as default,V as init,Le as reserveMemory,de as version};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-BFUkm7bt.js";import{Fa as t,Ko as n,Vo as r,_o as i,ba as a,en as o,ir as s,l as c,p as l,vo as u}from"./store-FA83kfnc.js";import{v as d,y as f}from"./index-B6qvKFYN.js";import{Bt as p,O as m,bt as h,ct as ee,ft as g,i as _,j as te,ot as ne,rt as re,st as ie}from"./bloomMarks-DariC6lY.js";var v=new te(new Uint8Array([110,190,255]),3,1,h);v.minFilter=ee,v.magFilter=ee,v.generateMipmaps=!1,v.needsUpdate=!0;var y=new Map;function ae(e,t={}){let n=`${e}|${t.emissive??``}|${t.emissiveIntensity??``}|${t.opacity??``}`,r=y.get(n);return r||(r=new ie({color:e,gradientMap:v,emissive:t.emissive??`#000000`,emissiveIntensity:t.emissiveIntensity??1,transparent:t.transparent??(t.opacity!==void 0&&t.opacity<1),opacity:t.opacity??1}),y.set(n,r)),r}var oe=new ie({color:`#ffffff`,gradientMap:v}),se=_(new re({color:`#ffffff`,toneMapped:!1})),ce=_(new re({color:`#ffffff`,toneMapped:!1}),`night`);function le(e,t){let n=`map|${e}`,r=y.get(n);return r||(r=new ie({map:t,gradientMap:v}),y.set(n,r)),r}function ue(e,t=`always`){let n=`glow|${e}|${t}`,r=y.get(n);return r||(r=_(new re({color:e,toneMapped:!1}),t),y.set(n,r)),r}var de=new ne({color:`#bfe8ff`,transparent:!0,opacity:.22,roughness:.05,metalness:0,depthWrite:!1,side:2});function fe(e,t){let n=new m(e),r={h:0,s:0,l:0};return n.getHSL(r),n.setHSL(r.h,r.s,Math.max(0,Math.min(1,r.l+t))),`#${n.getHexString()}`}function pe(e,t,n){return`#${new m(e).lerp(new m(t),n).getHexString()}`}var b=()=>({x:0,y:0,z:0,yaw:0,pitch:0,fov:72,near:.05});function me(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.yaw=e.yaw,t.pitch=e.pitch,t.fov=e.fov,t.near=e.near,t}var he=()=>({fx:0,fy:0,fz:0,yaw:0,el:0,dist:10,fov:60});function x(e,t){return t.fx=e.fx,t.fy=e.fy,t.fz=e.fz,t.yaw=e.yaw,t.el=e.el,t.dist=e.dist,t.fov=e.fov,t}var ge=e=>Math.min(1.5,Math.max(.05,e*.02));function S(e,t){let n=Math.cos(e.el);return t.x=e.fx+Math.sin(e.yaw)*n*e.dist,t.y=e.fy+Math.sin(e.el)*e.dist,t.z=e.fz+Math.cos(e.yaw)*n*e.dist,t.yaw=e.yaw,t.pitch=-e.el,t.fov=e.fov,t.near=ge(e.dist),t}function _e(e,t,n,r){let i=e.x-t,a=e.z-r;return e.yaw=Math.atan2(i,a),e.pitch=Math.atan2(n-e.y,Math.hypot(i,a)),e}var ve=e=>{let t=Math.min(1,Math.max(0,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2};function ye(e,t,n,r){return r.x=e.x+(t.x-e.x)*n,r.y=e.y+(t.y-e.y)*n,r.z=e.z+(t.z-e.z)*n,r.yaw=e.yaw+s(e.yaw,t.yaw)*n,r.pitch=e.pitch+(t.pitch-e.pitch)*n,r.fov=e.fov+(t.fov-e.fov)*n,r.near=t.near>e.near?e.near+(t.near-e.near)*n**4:e.near+(t.near-e.near)*n,r}function C(e,t,n,r,i=r){let a=1-Math.exp(-n*r);return e.fx+=(t.fx-e.fx)*a,e.fy+=(t.fy-e.fy)*a,e.fz+=(t.fz-e.fz)*a,e.yaw+=s(e.yaw,t.yaw)*(1-Math.exp(-n*i)),e.el+=(t.el-e.el)*a,e.dist+=(t.dist-e.dist)*a,e.fov+=(t.fov-e.fov)*a,e}function w(e,t,n,r){let i=Math.tan(e.fov*Math.PI/360),a=i*t,o=Math.cos(e.yaw),s=Math.sin(e.yaw),c=Math.cos(e.pitch),l=Math.sin(e.pitch),u=1-r;for(let t=0;t<n.length;t+=3){let r=n[t]-e.x,d=n[t+1]-e.y,f=n[t+2]-e.z,p=-s*c*r+l*d-o*c*f;if(p<=0)return!1;let m=o*r-s*f,h=s*l*r+c*d+o*l*f;if(Math.abs(m/(p*a))>u||Math.abs(h/(p*i))>u)return!1}return!0}var T=[-1,1].flatMap(e=>[-1,1].flatMap(t=>[0,i].flatMap(n=>[e*16,n,t*12]))),E={el:.85,fov:40,fy:.8,minDist:9,maxZoom:1.5,margin:.06,lift:.07},be=e=>Math.PI/4+Math.PI/2*e,D=e=>Math.round(s(Math.PI/4,e)/(Math.PI/2));function O(e,t,n=T,r=E.margin,i=b()){let a={...e},o=1,s=600;for(let e=0;e<40;e++)a.dist=(o+s)/2,w(S(a,i),t,n,r)?s=a.dist:o=a.dist;return s}function xe(e,t,n,r={minX:0,maxX:0,minY:0,maxY:0}){let i=Math.tan(e.fov*Math.PI/360),a=i*t,o=Math.cos(e.yaw),s=Math.sin(e.yaw),c=Math.cos(e.pitch),l=Math.sin(e.pitch);r.minX=r.minY=1/0,r.maxX=r.maxY=-1/0;for(let t=0;t<n.length;t+=3){let u=n[t]-e.x,d=n[t+1]-e.y,f=n[t+2]-e.z,p=Math.max(1e-6,-s*c*u+l*d-o*c*f),m=(o*u-s*f)/(p*a),h=(s*l*u+c*d+o*l*f)/(p*i);r.minX=Math.min(r.minX,m),r.maxX=Math.max(r.maxX,m),r.minY=Math.min(r.minY,h),r.maxY=Math.max(r.maxY,h)}return r}function Se(e,t,n){n.fx=0,n.fy=E.fy,n.fz=0,n.yaw=be(D(e)),n.el=E.el,n.fov=E.fov;let r=b(),i=Math.tan(n.fov*Math.PI/360);for(let e=0;e<4;e++){n.dist=O(n,t,T,E.margin,r);let e=xe(S(n,r),t,T),a=(e.minY+e.maxY)/2-E.lift;we(n,(e.minX+e.maxX)/2*n.dist*i*t,a*n.dist*(i/Math.sin(n.el)))}return n.dist=O(n,t,T,E.margin,r),n}function Ce(e){return e.fx=Math.min(16,Math.max(-16,e.fx)),e.fz=Math.min(12,Math.max(-12,e.fz)),e}function we(e,t,n){let r=Math.sin(e.yaw),i=Math.cos(e.yaw);return e.fx+=i*t-r*n,e.fz+=-r*t-i*n,Ce(e)}var Te=(e,t)=>2*e.dist*Math.tan(e.fov*Math.PI/360)/Math.max(1,t);function Ee(e,t){let n=Math.sin(e),r=Math.cos(e);return t.x=n>.05?1:n<-.05?-1:0,t.z=r>.05?1:r<-.05?-1:0,t}var k=12+u+.03,A=16+u,j={yaw:.32,el:.16,dist:34,minFov:30,maxFov:100,margin:.12};function De(e,t){let i=-n(e,Math.max(t,e));return{bottom:i,top:i+r(Math.max(t,e))}}function Oe(e,t,n,r,a=b()){let o=De(e,t);r.fx=0,r.fz=0,r.fy=(o.bottom+o.top)/2,r.yaw=j.yaw,r.el=j.el,r.dist=j.dist;let s=[-A,o.bottom,k,A,o.bottom,k,-A,o.top,k,A,o.top,k],c=j.minFov,l=j.maxFov;if(r.fov=l,!w(S(r,a),n,s,j.margin))return r.fy=i/2,r;for(let e=0;e<30;e++)r.fov=(c+l)/2,w(S(r,a),n,s,j.margin)?l=r.fov:c=r.fov;return r.fov=l,r}function ke(e,t,n){let r=De(t,n);return e.fy=Math.min(r.top,Math.max(r.bottom,e.fy)),e}var M={dist:3.4,el:.36,fov:62,height:1.25,minDist:1.8,maxDist:9};function Ae(e,t){let n=Math.abs(t)>16+u,r=n?a-.25:15.7,o=n?16+u+.25:-r;if(n){let n=Math.min(r,Math.max(o,Math.abs(e.x)));e.x=Math.sign(t)*n}else e.x=Math.min(r,Math.max(o,e.x));return e.z=Math.min(11.7,Math.max(-11.7,e.z)),e.y=Math.min(i-.35,Math.max(.6,e.y)),e}function je(e,t,n,r){return t-n<500&&r!==`building`?`building`:e===`first`||e===`follow`?`overview`:`first`}function N(e,t){return{id:e,label:t,read(t){let n=o(e);return n?(t.x=n.x,t.y=0,t.z=n.z,t.heading=n.heading,!0):!1}}}var P={x:0,z:0,yaw:0},F=()=>d().fov,I=.05,L=.9,Me=.65,Ne=1.5,R={mode:`first`,owns:!1,flight:1,flightTime:L,from:b(),pose:b(),goalPose:b(),orbit:he(),goal:he(),quad:0,fit:40,home:{x:0,z:0,yaw:0,pitch:0},target:null,seen:{x:0,y:0,z:0,heading:0},lost:0,waitUntil:0,snap:!1,arrival:null,lastTap:-1/0,lastWent:null,aspect:16/9,height:900,sides:{x:0,z:0},cut:`none`},z=null,B=()=>R.home;function Pe(e){z=e}function Fe(e,t){let n=e/Math.max(1,t);R.height=t,!(Math.abs(n-R.aspect)<.001)&&(R.aspect=n,R.mode===`overview`&&et(),R.mode===`building`&&Oe(l.getState().floor,q(),n,R.goal))}function Ie(e){B=e}var Le=()=>R.mode,Re=()=>R.cut,ze={x:0,z:0},Be=()=>R.cut===`dollhouse`?R.sides:ze,Ve=()=>R.home,He=()=>R.owns&&R.mode!==`follow`?R.home:null,Ue=()=>R.mode===`first`&&!R.arrival,We=()=>R.owns,Ge=()=>R.flight<1;function Ke(){let e=z;if(!R.owns||!e)return 0;let n=e.position;return Math.hypot(n.x-R.home.x,n.y-t,n.z-R.home.z)}var V=e(()=>({mode:`first`,following:null,hover:null}));function H(){V.setState({mode:R.mode,following:R.mode===`follow`?R.target?.label??null:null})}function qe(e){V.getState().hover!==e&&V.setState({hover:e})}var U=1e6,W=[new g(new p(0,-1,0),U),new g(new p(-1,0,0),U),new g(new p(0,0,-1),U),new g(new p(0,1,0),U)],[Je,G,K,Ye]=W,Xe=.05,Ze=(e,t,n)=>{for(let r of W)if(r.normal.x*e+r.normal.y*t+r.normal.z*n+r.constant<0)return!0;return!1};function Qe(e){R.cut=e,Je.constant=U,G.constant=U,K.constant=U,Ye.constant=U,e===`dollhouse`?(Ee(R.orbit.yaw,R.sides),Je.constant=i-.08,Ye.constant=.35,R.sides.x&&(G.normal.set(-R.sides.x,0,0),G.constant=16-Xe),R.sides.z&&(K.normal.set(0,0,-R.sides.z),K.constant=12-Xe)):e===`face`&&(K.normal.set(0,0,-1),K.constant=k+.02)}function $e(){return R.mode===`overview`?`dollhouse`:R.mode===`building`?`face`:R.mode===`first`&&R.owns&&R.flight<.8?R.cut:`none`}var q=()=>l.getState().repos.reduce((e,t)=>Math.max(e,t.floor),0);function et(){let e=R.goal.dist/R.fit;R.fit=O(R.goal,R.aspect),R.goal.dist=Math.max(E.minDist,Math.min(R.fit*E.maxZoom,R.fit*e))}function tt(e){return R.owns||!z?me(R.pose,e):(e.x=z.position.x,e.y=z.position.y,e.z=z.position.z,e.yaw=z.rotation.y,e.pitch=z.rotation.x,e.fov=z.fov,e.near=z.near,e)}function nt(){if(R.owns||!z)return;let e=B();R.home={x:z.position.x,z:z.position.z,yaw:e.yaw,pitch:e.pitch},P.x=R.home.x,P.z=R.home.z,P.yaw=R.home.yaw;let t=l.getState();t.held&&t.setHeld(null),t.focus&&t.setFocus(null),document.pointerLockElement&&document.exitPointerLock()}function J(e){tt(R.from),me(R.from,R.pose),R.flight=+!!f(),R.flightTime=e}function Y(){if(R.mode===`overview`||!z)return;let e=R.mode;nt(),J(L);let t=e===`first`?R.home.yaw:R.pose.yaw;Se(t,R.aspect,R.goal),R.quad=D(t),R.fit=R.goal.dist,x(R.goal,R.orbit),R.mode=`overview`,R.owns=!0,R.target=null,H()}function rt(){R.mode!==`building`&&z&&(nt(),J(L),Oe(l.getState().floor,q(),R.aspect,R.goal),x(R.goal,R.orbit),R.mode=`building`,R.owns=!0,R.target=null,H())}function it(e){if(z){if(!e.read(R.seen))return void l.getState().pushToast(`info`,`${e.label} isn't on this floor right now`);nt(),J(L),R.target=e,R.lost=0,R.waitUntil=0,R.snap=!1,ht(R.goal),R.goal.dist=M.dist,x(R.goal,R.orbit),R.mode=`follow`,R.owns=!0,H()}}function at(e){let t=l.getState(),n=t.agents[e];return n?n.role===`ceo`||e===`ceo`?0:t.repos.find(e=>e.id===n.repoId)?.floor??null:null}function ot(e){let t=l.getState().agents[e],n=at(e);t&&n!==null&&st(n,N(e,t.name))}function st(e,t){let n=l.getState();if(e===n.floor){it(t),n.overlay&&n.openOverlay(null);return}R.arrival={mode:`follow`,target:t,until:performance.now()+8e3},R.waitUntil=R.arrival.until,n.goToFloor(e)}var ct=()=>R.arrival?.mode===`follow`?R.arrival.target.id:R.mode===`follow`?R.target?.id??null:null;function X(){R.mode!==`first`&&(J(Me),R.mode=`first`,R.target=null,R.arrival=null,H())}function lt(e=performance.now()){if(l.getState().travel)return;let t=je(R.mode,e,R.lastTap,R.lastWent);R.lastTap=e,R.lastWent=t,t===`overview`?Y():t===`building`?rt():X()}function ut(e){R.mode===`overview`&&(R.quad+=e,R.goal.yaw=be(R.quad))}function Z(e){let t=R.goal,n=Math.exp(e*.0012);R.mode===`overview`?t.dist=Math.max(E.minDist,Math.min(R.fit*E.maxZoom,t.dist*n)):R.mode===`follow`?t.dist=Math.max(M.minDist,Math.min(M.maxDist,t.dist*n)):R.mode===`building`&&(t.fov=Math.max(j.minFov,Math.min(j.maxFov,t.fov*n)))}function dt(e,t){let n=R.goal,r=Te(n,R.height);R.mode===`overview`?we(n,-e*r,t*r/Math.max(.3,Math.sin(n.el))):R.mode===`building`&&(n.fy+=t*r,ke(n,l.getState().floor,q()))}function ft(e){R.home={...e},P.x=e.x,P.z=e.z,P.yaw=e.yaw;let t=R.arrival;if(R.arrival=null,t?.mode===`follow`){Se(e.yaw,R.aspect,R.orbit),S(R.orbit,R.pose),R.target=t.target,R.lost=0,R.waitUntil=t.until,R.snap=!0,R.mode=`follow`,R.owns=!0,R.flight=1,R.goal.dist=M.dist,H();return}if(t?.mode===`overview`||R.mode===`overview`||R.mode===`building`){Se(e.yaw,R.aspect,R.goal),R.quad=D(e.yaw),R.fit=R.goal.dist,x(R.goal,R.orbit),S(R.orbit,R.pose),R.mode=`overview`,R.owns=!0,R.flight=1,H();return}(R.mode===`follow`||R.owns)&&(R.mode=`first`,R.target=null,R.owns=!1,R.flight=1,Qe(`none`),z&&gt(z),H())}function pt(e){let t=l.getState();if(e===t.floor)return Y();(e===0||c(t.repos,e))&&(R.arrival={mode:`overview`},t.goToFloor(e))}var mt={right:0,forward:0,fast:!1,zoom:0};function ht(e){let t=R.seen;return e.fx=t.x,e.fy=t.y+M.height,e.fz=t.z,e.yaw=t.heading,e.el=M.el,e.fov=M.fov,e}function gt(e){(e.fov!==F()||e.near!==I)&&(e.fov=F(),e.near=I,e.updateProjectionMatrix())}function _t(e,t){e.position.set(t.x,t.y,t.z),e.rotation.set(t.pitch,t.yaw,0,`YXZ`),(Math.abs(e.fov-t.fov)>1e-4||Math.abs(e.near-t.near)>1e-5)&&(e.fov=t.fov,e.near=t.near,e.updateProjectionMatrix())}function vt(e){let n=z;if(!R.owns||!n)return;let r=R.goal,i=mt;if(R.mode===`overview`){let t=r.dist*(i.fast?1.6:.8)*e;(i.right||i.forward)&&we(r,i.right*t,i.forward*t),i.zoom&&Z(i.zoom*e*900),Ce(r),C(R.orbit,r,e,7),S(R.orbit,R.goalPose)}else if(R.mode===`building`)i.forward&&(r.fy+=i.forward*e*10,ke(r,l.getState().floor,q())),i.zoom&&Z(i.zoom*e*900),C(R.orbit,r,e,6),S(R.orbit,R.goalPose);else if(R.mode===`follow`){let t=R.target;if(t&&t.read(R.seen)){R.lost=0;let t=r.dist;ht(r),r.dist=t,R.snap&&x(r,R.orbit),R.snap=!1,i.zoom&&Z(i.zoom*e*900)}else if((R.lost+=e)>Ne&&performance.now()>R.waitUntil)return l.getState().pushToast(`info`,`🎥 Lost sight of ${t?.label??`them`}: back to you`),X(),vt(e);C(R.orbit,r,e,6,2.4),S(R.orbit,R.goalPose),Ae(R.goalPose,R.orbit.fx),_e(R.goalPose,R.orbit.fx,R.orbit.fy,R.orbit.fz)}else{let e=B(),n=R.goalPose;n.x=R.home.x,n.y=t,n.z=R.home.z,n.yaw=e.yaw,n.pitch=e.pitch,n.fov=F(),n.near=I}R.flight<1?(R.flight=Math.min(1,R.flight+e/R.flightTime),ye(R.from,R.goalPose,ve(R.flight),R.pose)):me(R.goalPose,R.pose),_t(n,R.pose);let a=$e();(a!==R.cut||a===`dollhouse`)&&Qe(a),R.mode===`first`&&R.flight>=1&&(R.owns=!1,Qe(`none`),gt(n),H())}var Q=e=>Math.round(e*100)/100,$=new p,yt=null;function bt(e){yt=e}function xt(e,t,n){if(!z||!yt||(z.updateMatrixWorld(),$.set(e,t,n).project(z),$.z>1||Math.abs($.x)>1||Math.abs($.y)>1))return null;let r=yt.getBoundingClientRect();return{x:Math.round(r.left+($.x+1)/2*r.width),y:Math.round(r.top+(1-$.y)/2*r.height)}}typeof window<`u`&&(window.__swarmCamera={state:()=>({mode:R.mode,owns:R.owns,flying:R.flight<1,target:R.target?{id:R.target.id,label:R.target.label}:null,home:{x:Q(R.home.x),z:Q(R.home.z),yaw:Q(R.home.yaw),pitch:Q(R.home.pitch)},pose:{x:Q(R.pose.x),y:Q(R.pose.y),z:Q(R.pose.z),yaw:Q(R.pose.yaw),pitch:Q(R.pose.pitch),fov:Q(R.pose.fov)},orbit:{fx:Q(R.goal.fx),fy:Q(R.goal.fy),fz:Q(R.goal.fz),yaw:Q(R.goal.yaw),dist:Q(R.goal.dist),fov:Q(R.goal.fov)},quad:R.quad,cut:R.cut,sides:{...R.sides}}),overview:Y,building:rt,first:X,tab:()=>lt(),follow:e=>{let t=l.getState().agents[e];it(N(e,t?.name??e))},followAgent:ot,rotate:ut,zoom:Z,drag:dt,screenOf:xt,person(e){let t=o(e);return t?xt(t.x,1,t.z):null}});export{Ke as A,ue as B,ut as C,vt as D,Fe as E,k as F,fe as H,se as I,ce as L,Be as M,Z as N,lt as O,A as P,oe as R,We as S,qe as T,ae as U,pe as V,le as W,Ze as _,Le as a,Ge as b,He as c,X as d,ot as f,Ve as g,ct as h,bt as i,pt as j,V as k,rt as l,st as m,ft as n,Re as o,N as p,Pe as r,dt as s,W as t,Y as u,Ue as v,Ie as w,mt as x,P as y,de as z};
@@ -1 +0,0 @@
1
- import{a as e,i as t,r as n,s as r,u as i}from"./jsx-runtime-BFUkm7bt.js";import{f as a}from"./bloomMarks-DariC6lY.js";var o=i(r(),1),s=[`cycle`,`clock`,`day`],c=`cycle`,l=18e5,u=.6,d=.25,f=.75,p=[[0,0],[2.75,.2],[4.75,.28],[23.75,.7],[25.75,.76],[27.25,.8],[30,1]],m=e=>e-Math.floor(e),h=e=>Math.min(1,Math.max(0,e)),g=(e,t,n)=>{let r=h((n-e)/(t-e));return r*r*(3-2*r)};function _(e){let t=e/6e4;for(let e=1;e<p.length;e++){let[n,r]=p[e];if(t<=n){let[i,a]=p[e-1];return a+(t-i)/(n-i)*(r-a)}}return 0}function v(e,t){if(t===`day`)return u;if(t===`clock`){let t=new Date(e);return m((t.getHours()*3600+t.getMinutes()*60+t.getSeconds()+t.getMilliseconds()/1e3)/86400)}return m(_((e%l+l)%l))}var y=.45;function b(e,t=[0,0,0]){let n=2*Math.PI*(e-d);return t[0]=Math.cos(n),t[1]=Math.sin(n)*Math.cos(y),t[2]=Math.sin(n)*Math.sin(y),t}function x(e){return g(.24,.3,Math.abs(m(e)-.5))}var S={zenith:857656,horizon:2503787,fog:1910864,sunColor:9414399,sunIntensity:.25,hemiSky:4872858,hemiGround:2761792,ambient:.22,exposure:.9,starsOpacity:1,cityLights:1},C={zenith:9226997,horizon:12575743,fog:15985890,sunColor:16777215,sunIntensity:1.55,hemiSky:16775920,hemiGround:10783338,ambient:.18,exposure:1,starsOpacity:0,cityLights:0},w=[[0,S],[.2,{...S,horizon:2898548}],[.235,{zenith:2372462,horizon:6976176,fog:5133712,sunColor:16751226,sunIntensity:.35,hemiSky:7305400,hemiGround:3813448,ambient:.2,exposure:.92,starsOpacity:.5,cityLights:.7}],[.27,{zenith:7311312,horizon:16757920,fog:15778996,sunColor:16757898,sunIntensity:.8,hemiSky:16769232,hemiGround:8021344,ambient:.18,exposure:.96,starsOpacity:0,cityLights:.15}],[.33,{zenith:8831216,horizon:13625087,fog:15789030,sunColor:16773600,sunIntensity:1.35,hemiSky:16774894,hemiGround:10258032,ambient:.18,exposure:1,starsOpacity:0,cityLights:0}],[.5,{zenith:8176375,horizon:12904191,fog:15920870,sunColor:16777215,sunIntensity:1.65,hemiSky:16776436,hemiGround:10783338,ambient:.18,exposure:1,starsOpacity:0,cityLights:0}],[u,C],[.71,{zenith:8366304,horizon:16763016,fog:16176816,sunColor:16760944,sunIntensity:1.35,hemiSky:16770752,hemiGround:10122328,ambient:.18,exposure:1.02,starsOpacity:0,cityLights:0}],[f,{zenith:6254520,horizon:16751210,fog:15902858,sunColor:16747088,sunIntensity:.9,hemiSky:16758944,hemiGround:7229536,ambient:.19,exposure:1,starsOpacity:0,cityLights:.25}],[.775,{zenith:2767488,horizon:8022712,fog:5921430,sunColor:11575551,sunIntensity:.35,hemiSky:8026816,hemiGround:3813456,ambient:.21,exposure:.94,starsOpacity:.35,cityLights:.8}],[.81,S],[1,S]],T=(e,t,n)=>e+(t-e)*n;function E(e,t,n){let r=r=>Math.round(T(e>>r&255,t>>r&255,n));return r(16)<<16|r(8)<<8|r(0)}var D=[`zenith`,`horizon`,`fog`,`sunColor`,`hemiSky`,`hemiGround`],O=[`sunIntensity`,`ambient`,`exposure`,`starsOpacity`,`cityLights`];function k(e,t={}){let n=m(e),r=1;for(;r<w.length-1&&w[r][0]<=n;)r++;let[i,a]=w[r-1],[o,s]=w[r],c=g(i,o,n);for(let e of D)t[e]=E(a[e],s[e],c);for(let e of O)t[e]=T(a[e],s[e],c);return t}function A(e){let t=new URLSearchParams(e).get(`daytime`);if(t===null||t.trim()===``)return null;let n=Number(t);return!Number.isFinite(n)||n<0||n>1?null:m(n)}function j(e){return s.includes(e)?e:c}var M=`cubefarm:daytime`,N=6e4;function P(){try{return j(localStorage.getItem(M))}catch{return c}}function F(){try{return A(window.location.search)}catch{return null}}var I={t:0,mode:P(),frozen:F()};function L(e=Date.now()){let t=n();return I.t=I.frozen??(t===null?v(e,I.mode):v(t,`clock`)),I.t}L();var R=e(()=>({t:I.t,mode:I.mode}));function z(){R.setState({t:L(),mode:I.mode})}typeof window<`u`&&setInterval(z,N);function B(){let{t:e,mode:t}=R();return{clock:I,t:e,mode:t}}function V(e){I.mode=e;try{localStorage.setItem(M,e)}catch{}z()}var H=0;function U(e){t(e);let n=performance.now();(e===null||n-H>=1e3)&&(H=n,z())}var W=new Set;function G(e){let t=(0,o.useRef)(e);t.current=e,a((e,n)=>t.current(e,n)),(0,o.useEffect)(()=>(W.add(t),()=>void W.delete(t)),[])}function K(e){L();for(let t of W)t.current(e,0)}function q(){return a(()=>{L()}),null}typeof window<`u`&&(window.__swarmSky={get t(){return L()},get mode(){return I.mode},set mode(e){s.includes(e)&&V(e)},set(e){Number.isFinite(e)&&(I.frozen=e-Math.floor(e),z())},freeze(e){I.frozen=e?L():null,z()}});export{V as a,G as c,k as d,b as f,L as i,l,I as n,U as o,K as r,B as s,q as t,x as u};
@@ -1 +0,0 @@
1
- import{Ci as e,Di as t,Mi as n,Ni as r,Zi as i,_i as a,aa as o,ms as s,p as c,vi as l,xi as u,yi as d,ys as f}from"./store-FA83kfnc.js";import{_ as p,g as m,h,m as g}from"./index-B6qvKFYN.js";import{c as _,m as v}from"./mic-B316hcCe.js";import{t as y}from"./speechLanguage-BtfdhZNI.js";var b=[];window.__swarmVoice=b;function x(e,t,n){setTimeout(()=>{a(e.id)&&(S=l(S,{message:e,arrived:t}),E&&C?.(),j())},Math.max(0,t+n-Date.now()))}var S=[],C=null,w=!1,T=null,E=!1,D=!1;function O(e,t){T={message:e,kind:t},D=!0,C?.(),j()}function k(){D=!0,C?.()}var A=()=>{let e=n();return e.muted?0:o(e.volume)*o(e.voice)};async function j(){if(!w){w=!0;try{for(;;){if(T){let e=T;T=null,E=!0,await N(e.message,e.kind).finally(()=>E=!1);continue}let{next:e,rest:t}=d(S,Date.now());if(S=t,!e)break;await N(e.message)}}finally{w=!1,E=!1}}}var M=!1;async function N(n,r){let{settings:i,voiceKeySet:a}=c.getState(),{voiceName:o}=i.voice,s=r?r===`clip`?`elevenlabs`:`browser`:i.voice.provider;if(s===`off`)return;let l={rec:null};D=!1;let u=f(n.text),d=(e,i=1)=>{m(n.id,u,e,i),l.rec={id:n.id,provider:s,start:performance.now(),end:null,volume:A(),...r?{replay:!0}:{}},b.push(l.rec),b.length>50&&b.splice(0,b.length-50),c.setState({voiceSpeaking:n.id}),t(!0),l.unduckMusic=v()};try{if(s===`browser`)await I(u,o,()=>d(null),e=>p(n.id,e));else if(r)await P(n.id,d,!0);else if(a)await P(n.id,d);else throw Error(`no ElevenLabs key is saved`)}catch(t){if(r){l.rec||c.getState().pushToast(`info`,r===`clip`?`🔇 Audio no longer saved`:`🔇 The browser couldn't speak this message`);return}l.rec||e(),M||(M=!0,console.warn(`[voice] couldn't read message ${n.id} aloud: ${t.message}`))}finally{C=null,l.rec&&(h(n.id),l.rec.end=performance.now(),t(!1),l.unduckMusic?.(),c.setState({voiceSpeaking:null}),!r&&!D&&n.from===`ceo`&&!S.length&&!T&&_())}}async function P(e,t,n=!1){let i=!1,a=null;C=()=>{i=!0,a?.()};for(let o=0,s=1;o<s;o++){let c=await fetch(n?`/api/voice/messages/${e}?cached=1&part=${o}`:`/api/voice/messages/${e}`);if(!c.ok)throw Error(`HTTP ${c.status}`);s=Math.max(1,Number(c.headers.get(`X-Voice-Parts`))||1);let l=await c.arrayBuffer();if(i)return;let d=u(),f=r(`voice`);if(!d||!f)throw Error(`audio is unavailable`);let p=await d.ctx.decodeAudioData(l);if(i)return;let m=d.ctx.createBufferSource();if(m.buffer=p,m.connect(f),await new Promise(n=>{let r=setTimeout(()=>n(),(p.duration+2)*1e3);m.onended=()=>{clearTimeout(r),n()},a=()=>{clearTimeout(r);try{m.stop()}catch{}n()},m.start(),o===0?t(p.duration*1e3,s):g(e,o,s,p.duration*1e3)}),a=null,m.disconnect(),i)return}}async function F(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 I(e,t,r,a){let o=window.speechSynthesis;if(!o||typeof SpeechSynthesisUtterance>`u`)throw Error(`this browser can't speak`);if(!e)return;let l=new SpeechSynthesisUtterance(e),u=c.getState().settings.language;l.lang=s(u);let d=y(await F(o),t,u);d&&(l.voice=d,l.lang=d.lang),l.volume=A(),await new Promise((t,s)=>{let c=i(()=>n().muted&&p()),u=setTimeout(()=>p(),2e4+e.length*150),d=!1,f=e=>{d||(d=!0,clearTimeout(u),c(),e?s(Error(e)):t())},p=()=>{f(),o.cancel()};C=p,l.onstart=r,l.onboundary=e=>e.name!==`sentence`&&a(e.charIndex),l.onend=()=>f(),l.onerror=e=>f(e.error===`interrupted`||e.error===`canceled`?void 0:`speech failed: ${e.error}`),o.speak(l)})}export{O as replayMessage,x as speakMessage,k as stopSpeaking};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-BFUkm7bt.js";import{Fi as t,Ni as n,Uo as r,Vi as i,co as a,oo as o,os as s,p as c,ss as l,va as u,vo as d}from"./store-FA83kfnc.js";import{f}from"./bloomMarks-DariC6lY.js";import{n as p}from"./doors-BHKj8tkO.js";import{u as m}from"./useDayTime-0XsqM14Q.js";var h=e=>Math.min(1,Math.max(0,e)),g=(e,t,n)=>{let r=h((n-e)/(t-e));return r*r*(3-2*r)},_=(e,t,n)=>e+(t-e)*n,v=.03,y=.3,b=.4,x=14e3,S=.08,C=1.6,w=16+d;function ee(e,t,n,i){if(e===`roof`)return n>12?{level:y,clarity:b,from:{x:0,z:12}}:{level:1,clarity:1,from:null};let s=v,c=0,l=null,f=0;for(let p of o){let o=r(p),m=n>=u.minZ&&n<=u.maxZ?g(16,w+.6,o*t):0,_=o*(16+d/2),v=a[e][p].door,x=h(1-Math.hypot(Math.max(0,o*(_-t)),n-v)/8)**2,S=h(i[p])*x;s=Math.max(s,m,y*S),c=Math.max(c,m,b*S);let C=Math.max(m,S);C>f&&(f=C,l=m<1?{x:_,z:v}:null)}return{level:s,clarity:c,from:l}}var T=e=>320*(x/320)**h(e);function te(e,t=`office`){let n=m(e),r=e-Math.floor(e),i=1-g(.015,.06,Math.abs(r-.765)),a=1-g(.01,.05,Math.abs(r-.27));return{wind:_(1,.8,n)*(t===`roof`?C:1),city:h(_(.75,.45,n)+.25*i),birds:h((1-n)*(1-.6*i)+.3*a),crickets:g(.35,1,n),cityHz:_(240,120,n),carsPerMin:_(2.5,.6,n)+1.5*i}}var E={bird:2.5,car:8,cricket:1.2};function ne(e,t){return e<.05?1/0:E.bird+(1.5+8*h(t))/e}function re(e,t){return e<=0?1/0:Math.max(E.car,-Math.log(1-Math.min(h(t),.999))*60/e)}function ie(e,t){return e<.05?1/0:E.cricket+(.5+4*h(t))/e}function ae(e,t){return e+(Number.isFinite(t)?t:5)}var oe=1.6;function se(e){let t=[],n=.85+e()*.35,r=Math.floor(e()*4);if(r===0){let r=2+Math.floor(e()*3),i=.12+e()*.08;for(let a=0;a<r;a++)t.push({at:a*i,dur:.06+e()*.03,from:2600*n,to:3900*n,peak:.8+e()*.2})}else if(r===1)t.push({at:0,dur:.18,from:3100*n,to:3500*n,peak:.8}),t.push({at:.24+e()*.06,dur:.3,from:3400*n,to:2300*n,peak:1});else if(r===2){let r=6+Math.floor(e()*6);for(let e=0;e<r;e++){let i=(4200+e%2*300)*n;t.push({at:e*.06,dur:.035,from:i,to:i*.92,peak:.55+.45*(1-e/r)})}}else{let r=3+Math.floor(e()*3);for(let i=0,a=0;i<r;i++){let r=(2800+e()*1600)*n,i=.07+e()*.06;t.push({at:a,dur:i,from:r,to:r*(.85+e()*.35),peak:.7+e()*.3}),a+=i+.03+e()*.06}}return t}function ce(e){let t=[],n=.45+e()*.3,r=3+Math.floor(e()*2),i=Math.floor((2.5+e()*3)/n);for(let a=0;a<i;a++){let i=.6+e()*.4;for(let e=0;e<r;e++)t.push({at:a*n+e*.04,dur:.022,from:0,to:0,peak:i})}return t.filter(e=>e.at+e.dur<=6)}var D=e=>Math.min(1,Math.max(0,e)),O={level:.32,clarity:.42},le={level:.6,clarity:.2};function k(e){return{level:Math.max(e.level,O.level),cutoff:T(Math.max(e.clarity,O.clarity))}}function A(e){return{level:Math.max(e.level,le.level),cutoff:T(Math.max(e.clarity,le.clarity))}}function j(e){return{rain:D(e.rain),patter:D(e.rain*1.6)*(1-.35*D(e.rain)),gust:D(e.wind*(.4+.6*e.storm)*e.cloud*1.2),hush:D(e.snow)}}function M(e,t,n,r){e.fill(0);let i=Math.round(e.length/t*n);for(let n=0;n<i;n++){let n=Math.floor(r()*e.length),i=t*(.002+r()*.006),a=.25+r()*.75,o=Math.min(Math.floor(i*5),e.length),s=0;for(let t=0;t<o;t++){let o=r()*2-1;s=s*.35+o*.65,e[(n+t)%e.length]+=s*a*Math.exp(-t/i)}}let a=0;for(let t=0;t<e.length;t++)a=Math.max(a,Math.abs(e[t]));if(a>1)for(let t=0;t<e.length;t++)e[t]/=a;return e}var ue=100,N={rain:.05,patter:.035,gust:.06,hush:.012,thunder:.32},de=1.5,P=null,F=null,fe=`office`,I=null,L=!1,R=0,z={level:0,clarity:0,from:null},B=!1,V={rain:-1,patter:-1,rainLevel:-1,rainCut:-1,gust:-1,hush:-1,airLevel:-1,airCut:-1,thunderLevel:-1,thunderCut:-1},pe={west:0,east:0};function me(e,t){fe=e,I=t,F||=setInterval(H,ue),H()}function he(){if(F&&clearInterval(F),F=null,I=null,P)for(let e of[P.rainLevel,P.airLevel])be(e.gain,0,.3);for(let e of Object.keys(V))V[e]=-1;B&&i(`weather:rain`,{group:`outside`,peak:0,played:!1}),B=!1,setTimeout(()=>{!F&&P&&W(P,!1)},1500)}function ge(e){e!==L&&(L=e,F&&H())}function _e(e,t,r){let a=L||typeof document<`u`&&document.hidden||!F,o=A(z),s=a?null:n(`outside`),c=s?ve(s):null;if(i(`weather:thunder`,{group:`outside`,peak:N.thunder*t*o.level,pan:r*.4,played:!!c}),c)try{W(c,!0),R=0;let n=c.ctx,i=n.currentTime+Math.max(0,e),a=n.createBufferSource();a.buffer=c.noise,a.loop=!0;let o=n.createBiquadFilter();o.type=`lowpass`,o.Q.value=.8;let s=n.createGain(),l=typeof n.createStereoPanner==`function`?n.createStereoPanner():null,u=4+3*(1-t)+Math.random()*2;o.frequency.setValueAtTime(t>.6?2600:900,i),o.frequency.exponentialRampToValueAtTime(320,i+.35),o.frequency.exponentialRampToValueAtTime(110,i+u);let d=N.thunder*t;s.gain.setValueAtTime(1e-4,i),s.gain.exponentialRampToValueAtTime(d*(t>.6?1:.55),i+(t>.6?.03:.25));let f=i+.4;for(let e=0;e<4;e++)f+=.3+u/5*Math.random(),s.gain.exponentialRampToValueAtTime(d*(.25+Math.random()*.5)*(1-e*.18),Math.min(f,i+u-.3));s.gain.exponentialRampToValueAtTime(1e-4,i+u),l&&l.pan.setValueAtTime(r*.4,i),a.connect(o).connect(s),(l?s.connect(l):s).connect(c.thunderMuffle),a.start(i,Math.random()),a.stop(i+u+.1)}catch{}}function H(){let e=t();for(let e of o)pe[e]=p(e);z=ee(fe,e.x,e.z,pe);let r=L||document.hidden||!I,a=I?.(),s=a?j(a):{rain:0,patter:0,gust:0,hush:0},c=!r&&(s.rain>.005||s.gust>.005||s.hush>.005),l=c||(P?.hooked??!1)?n(`outside`):null,u=l?ve(l):null;if(u){R=c?0:R+ue/1e3,W(u,R<de);let e=k(z),t=A(z);U(u.rain.gain,`rain`,N.rain*s.rain,1.5),U(u.patter.gain,`patter`,N.patter*s.patter,1.5),U(u.rainLevel.gain,`rainLevel`,r?0:e.level,.35),U(u.rainMuffle.frequency,`rainCut`,e.cutoff,.3,!0),U(u.gust.gain,`gust`,N.gust*s.gust,2),u.gustDepth.gain.value=N.gust*s.gust*.6,U(u.hush.gain,`hush`,N.hush*s.hush,2),U(u.airLevel.gain,`airLevel`,r?0:z.level,.35),U(u.airMuffle.frequency,`airCut`,e.cutoff*.5+200,.3,!0),U(u.thunderLevel.gain,`thunderLevel`,r?0:t.level,.35),U(u.thunderMuffle.frequency,`thunderCut`,t.cutoff,.3,!0)}let d=c&&s.rain>.05&&!!u;d!==B&&(B=d,i(`weather:rain`,{group:`outside`,peak:N.rain*s.rain*k(z).level,played:B}))}function U(e,t,n,r,i=!1){let a=V[t];a>=0&&(i?Math.abs(n/Math.max(a,1e-6)-1)<.03:Math.abs(n-a)<5e-4)||(V[t]=n,be(e,n,r))}function ve(e){if(P?.ctx===e.context&&P.out===e)return P;try{P=ye(e.context,e);for(let e of Object.keys(V))V[e]=-1;return P}catch{return null}}function ye(e,t){let n=0,r=e=>(n++,e),i=t=>{let n=r(e.createGain());return n.gain.value=t,n},a=(t,n,i)=>{let a=r(e.createBiquadFilter());return a.type=t,a.frequency.value=n,a.Q.value=i,a},o=(t,n)=>{let i=r(e.createBufferSource());return i.buffer=t,i.loop=!0,i.start(0,n),i},s=t=>{let n=r(e.createOscillator());return n.frequency.value=t,n.start(),n},c=e.createBuffer(1,e.sampleRate*2,e.sampleRate),l=c.getChannelData(0);for(let e=0;e<l.length;e++)l[e]=Math.random()*2-1;let u=e.createBuffer(1,e.sampleRate*3,e.sampleRate);M(u.getChannelData(0),e.sampleRate,38,Math.random);let d=i(1),f=a(`lowpass`,2e3,.5),p=i(0);f.connect(p).connect(d);let m=i(0);o(c,.3).connect(a(`highpass`,450,.5)).connect(a(`lowpass`,6500,.4)).connect(m).connect(f);let h=i(0);o(u,0).connect(a(`bandpass`,3200,.6)).connect(h).connect(f);let g=a(`lowpass`,1200,.5),_=i(0);g.connect(_).connect(d);let v=a(`bandpass`,520,1.4),y=i(0);o(c,1.1).connect(v).connect(y).connect(g);let b=i(0);s(.13).connect(b).connect(y.gain);let x=i(240);s(.07).connect(x).connect(v.frequency);let S=i(0);o(c,.7).connect(a(`bandpass`,2600,.35)).connect(S).connect(g);let C=a(`lowpass`,900,.5),w=i(0);return C.connect(w).connect(d),{ctx:e,out:t,hooked:!1,tail:d,rain:m,patter:h,rainMuffle:f,rainLevel:p,gust:y,gustDepth:b,hush:S,airMuffle:g,airLevel:_,thunderMuffle:C,thunderLevel:w,noise:c,nodes:n}}function W(e,t){if(t!==e.hooked)try{t?e.tail.connect(e.out):e.tail.disconnect(),e.hooked=t}catch{}}function be(e,t,n){try{let r=P?.ctx.currentTime??0;e.cancelScheduledValues(r),e.setTargetAtTime(t,r,n)}catch{}}typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmWeatherSfx`)&&Object.defineProperty(window,"__swarmWeatherSfx",{get:()=>{let e=I?.();return{running:F!==null,quiet:L||document.hidden,layers:e?j(e):null,rain:k(z),thunder:A(z),nodes:P?.nodes??0,hooked:P?.hooked??!1}},enumerable:!1,configurable:!1});var G=[`cloud`,`rain`,`snow`,`fog`,`storm`,`wind`],K=()=>({cloud:0,rain:0,snow:0,fog:0,storm:0,wind:0}),xe={clear:K(),cloudy:{cloud:.7,rain:0,snow:0,fog:.05,storm:0,wind:.35},"light-rain":{cloud:.8,rain:.35,snow:0,fog:.15,storm:0,wind:.35},"heavy-rain":{cloud:.95,rain:1,snow:0,fog:.3,storm:0,wind:.6},storm:{cloud:1,rain:.9,snow:0,fog:.25,storm:1,wind:1},fog:{cloud:.45,rain:0,snow:0,fog:1,storm:0,wind:.05},snow:{cloud:.85,rain:0,snow:1,fog:.35,storm:0,wind:.25}},q=e=>Math.min(1,Math.max(0,e)),J=(e,t,n)=>e+(t-e)*n,Se=(e,t,n)=>{let r=q((n-e)/(t-e));return r*r*(3-2*r)};function Ce(e,t=1,n=0,r=K()){let i=xe[e],a=.35+.65*q(t);return r.cloud=i.cloud*(.75+.25*a),r.fog=i.fog*(e===`fog`?.6+.4*a:1),r.rain=i.rain*a,r.snow=i.snow*a,r.storm=i.storm*a,r.wind=Math.max(i.wind,q(n)),r}function we(e,t,n,r=20){let i=n/r,a=!1;for(let n of G){let r=t[n]-e[n];r!==0&&(e[n]=Math.abs(r)<=i?t[n]:e[n]+Math.sign(r)*i,a=!0)}return a}var Te=e=>G.every(t=>e[t]<.002),Ee=e=>q(e.cloud*.55+e.rain*.25+e.storm*.35+e.snow*.15+e.fog*.2),De=e=>q(e.cloud*.9+e.storm*.1+e.fog*.4),Oe={clear:[[`clear`,5],[`cloudy`,3],[`fog`,.5]],cloudy:[[`clear`,4],[`cloudy`,1.5],[`light-rain`,2],[`fog`,.5],[`snow`,1]],"light-rain":[[`cloudy`,3],[`light-rain`,1],[`heavy-rain`,1.2]],"heavy-rain":[[`light-rain`,3],[`storm`,1.3],[`cloudy`,.7]],storm:[[`heavy-rain`,2],[`light-rain`,2]],fog:[[`clear`,2],[`cloudy`,3]],snow:[[`cloudy`,3],[`snow`,1.5]]},ke={clear:[15,40],cloudy:[10,25],"light-rain":[6,15],"heavy-rain":[4,10],storm:[3,7],fog:[8,18],snow:[10,25]},Ae=e=>e===11||e===0||e===1;function je(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function Me(e,t){let n=t*e.reduce((e,[,t])=>e+t,0);for(let[t,r]of e)if(n-=r,n<0)return t;return e[e.length-1][0]}function Ne(e,t,n,r,i=864e5){let a=je(e*1e4+(t+1)*100+n),o=[],s=a()<.7?`clear`:`cloudy`,c=r;for(;c<r+i;){let[e,n]=ke[s],r=e+a()*(n-e),i=s===`clear`||s===`cloudy`?1:.45+a()*.55;o.push({kind:s,intensity:i,from:c,until:c+r*6e4}),c+=r*6e4,s=Me(Oe[s].filter(([e])=>e!==`snow`||Ae(t)),a())}return o}function Pe(e){let t=new Date(e),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1).getTime(),i=Ne(t.getFullYear(),t.getMonth(),t.getDate(),n,r-n);return i.find(t=>e<t.until)??i[i.length-1]}var Fe={rain:`heavy-rain`,rainy:`heavy-rain`,heavy:`heavy-rain`,drizzle:`light-rain`,light:`light-rain`,showers:`light-rain`,cloud:`cloudy`,clouds:`cloudy`,overcast:`cloudy`,thunder:`storm`,thunderstorm:`storm`,lightning:`storm`,foggy:`fog`,mist:`fog`,snowy:`snow`,sun:`clear`,sunny:`clear`};function Ie(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase().replace(/_/g,`-`);return s.includes(t)?t:Fe[t]??null}var Le=e=>Ie(new URLSearchParams(e).get(`weather`)),Re=e=>((e>>16&255)*.299+(e>>8&255)*.587+(e&255)*.114)/255;function Y(e,t,n){let r=Re(e),i=(i,a)=>{let o=(e>>i&255)/255;return Math.round(q(J(o,r*a,t)*n)*255)};return i(16,.96)<<16|i(8,.99)<<8|i(0,1.05)}function ze(e,t,n){let r=r=>Math.round(J(e>>r&255,t>>r&255,n));return r(16)<<16|r(8)<<8|r(0)}function Be(e,t){let n=q(t.cloud*.8+t.rain*.15+t.storm*.2),r=1-.18*t.cloud-.12*t.rain-.25*t.storm;return e.zenith=Y(e.zenith,n*.85,r*(1-.1*t.cloud)),e.horizon=Y(e.horizon,n*.8,r),e.fog=Y(e.fog,Math.max(n,t.fog)*.85,r*(1+.04*t.fog)),e.horizon=ze(e.horizon,e.fog,t.fog*.85),e.zenith=ze(e.zenith,e.fog,t.fog*.55),e.sunColor=Y(e.sunColor,n*.6,1),e.sunIntensity*=Math.max(.05,1-.85*n-.15*t.fog),e.hemiSky=Y(e.hemiSky,n*.6,1-.12*n),e.hemiGround=Y(e.hemiGround,n*.4,1-.1*n),e.starsOpacity*=1-De(t),e.exposure*=1-.06*n,e.cityLights=Math.max(e.cityLights,.45*Ee(t)*(1-e.cityLights)),e}function Ve(e,t=[0,0]){let n=q(e.fog+e.rain*.35+e.snow*.4+e.storm*.2);return t[0]=J(40,6,n),t[1]=J(500,120,n),t}function He(e,t){return e.birds*=(1-Se(.03,.3,t.rain+t.storm))*(1-.8*t.snow)*(1-.6*t.fog),e.crickets*=1-Se(.05,.4,t.rain+t.snow+t.storm),e.wind*=1+1.6*t.wind*t.cloud,e.city*=1-.6*t.snow-.25*t.fog,e.carsPerMin*=1-.5*t.snow,e}function Ue(e,t,n){return t>.05?Math.min(1,e+n*t*.03):Math.max(0,e-n/240)}function We(e,t,n,r){return t>.05?Math.min(1,e+r*t*.012):Math.max(0,e-r*(1+n*4)/300)}function Ge(e,t){return e<.3?1/0:4+(6+16*q(t))/e}function Ke(e){if(e<0||e>.9)return 0;let t=(t,n,r)=>r*Math.max(0,1-Math.abs(e-t)/n);return q((e<.03?e/.03:Math.exp(-(e-.03)*14))+t(.18,.07,.75)+t(.42,.09,.45))}var qe=e=>1+3*q(e);function Je(){try{return Le(window.location.search)}catch{return null}}var X={mix:K(),target:K(),kind:`clear`,intensity:0,source:`cycle`,active:!1,version:0,clock:0,flash:0,flashAt:-10,nextFlash:1/0,boltSide:1,boltSeed:0,flashHold:null,wet:0,snow:0,url:Je(),probe:null,event:null,spell:null},Z=e(()=>({active:!1,kind:`clear`,source:`cycle`})),Ye=()=>Z();function Xe(e){X.event=e}var Q={kind:`clear`,intensity:0,wind:0,source:`cycle`};function $(e,t,n,r){return Q.kind=e,Q.intensity=t,Q.wind=n,Q.source=r,Q}function Ze(e){if(X.probe)return $(X.probe,1,0,`probe`);if(X.event)return $(X.event.kind,1,X.event.wind,`event`);if(X.url)return $(X.url,1,0,`url`);let t=c.getState(),n=t.settings.weather?.mode??`cycle`;if(n===`off`)return $(`clear`,0,0,`off`);if(n===`real`){let n=l(t.weather,e);if(n)return $(n.kind,n.intensity,Math.min(1,n.wind/60),`real`)}return(!X.spell||e>=X.spell.until||e<X.spell.from)&&(X.spell=Pe(e)),$(X.spell.kind,X.spell.intensity,0,`cycle`)}function Qe(){let e=Z.getState();(e.active!==X.active||e.kind!==X.kind||e.source!==X.source)&&Z.setState({active:X.active,kind:X.kind,source:X.source})}function $e(e,t=Date.now()){let n=Ze(t);X.kind=n.kind,X.intensity=n.intensity,X.source=n.source,Ce(n.kind,n.intensity,n.wind,X.target),X.clock+=e;let r=we(X.mix,X.target,e),i=X.mix;i.storm>=.3?(Number.isFinite(X.nextFlash)||(X.nextFlash=X.clock+Ge(i.storm,Math.random())*.5),X.clock>=X.nextFlash&&et()):X.nextFlash=1/0;let a=X.flashHold??Ke(X.clock-X.flashAt);a!==X.flash&&(X.flash=a,r=!0);let o=Ue(X.wet,i.rain,e),s=We(X.snow,i.snow,i.rain,e);(Math.abs(o-X.wet)>1e-5||Math.abs(s-X.snow)>1e-5)&&(r=!0),X.wet=o,X.snow=s,r&&X.version++,X.active=!Te(i)||X.wet>.002||X.snow>.002||a>0||!Te(X.target),Qe()}function et(e=null){X.flashHold=e,X.flashAt=X.clock,X.boltSide=Math.random()<.5?-1:1,X.boltSeed=Math.random(),X.nextFlash=X.clock+Ge(Math.max(.3,X.mix.storm),Math.random());let t=Math.random();_e(qe(t),1-.5*t,X.boltSide)}function tt(){return f((e,t)=>$e(Math.min(t,.1))),null}if(typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmWeather`)){let e=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Math.round(t*1e3)/1e3]));Object.defineProperty(window,"__swarmWeather",{value:{get state(){return X.kind},get source(){return X.source},get intensity(){return X.intensity},get mix(){return e(X.mix)},get target(){return e(X.target)},get active(){return X.active},get wet(){return Math.round(X.wet*1e3)/1e3},get snow(){return Math.round(X.snow*1e3)/1e3},get flash(){return X.flash},get nextFlashIn(){return Number.isFinite(X.nextFlash)?Math.max(0,X.nextFlash-X.clock):null},get real(){return c.getState().weather},set(e){if(e===null)return X.probe=null,X.url=null,!0;let t=Ie(e);return t?(X.probe=t,!0):!1},strike:e=>et(typeof e==`number`?Math.min(1,Math.max(0,e)):null),skip(){$e(0),Object.assign(X.mix,X.target),X.wet=+(X.mix.rain>.3),X.snow=+(X.mix.snow>.3),X.version++}},enumerable:!1,configurable:!1})}export{ae as C,ie as S,te as T,se as _,De as a,ne as b,je as c,ge as d,me as f,S as g,oe as h,X as i,He as l,M as m,Xe as n,Ee as o,he as p,Ye as r,Ve as s,tt as t,Be as u,ce as v,ee as w,re as x,T as y};