From 3d98d7caf25d6fbcf8b53b16035485ca2e2be13a Mon Sep 17 00:00:00 2001 From: goldbuick Date: Wed, 25 Dec 2024 04:01:52 +0000 Subject: [PATCH] Build: (ae41512) fixes music mode (#52) --- assets/{index-BNfzFvSl.js => index-PbOQy6UM.js} | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename assets/{index-BNfzFvSl.js => index-PbOQy6UM.js} (99%) diff --git a/assets/index-BNfzFvSl.js b/assets/index-PbOQy6UM.js similarity index 99% rename from assets/index-BNfzFvSl.js rename to assets/index-PbOQy6UM.js index 7d691ddb..97038a0a 100644 --- a/assets/index-BNfzFvSl.js +++ b/assets/index-PbOQy6UM.js @@ -4104,7 +4104,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return val; } } -`;xD(cne,lne);class Ty extends ft{constructor(){const e=ct(Ty.getDefaults(),arguments,["channels"]);super(e),this.name="Split",this._splitter=this.input=this.output=this.context.createChannelSplitter(e.channels),this._internalChannels=[this._splitter]}static getDefaults(){return Object.assign(ft.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._splitter.disconnect(),this}}class wm extends ft{constructor(){const e=ct(wm.getDefaults(),arguments,["channels"]);super(e),this.name="Merge",this._merger=this.output=this.input=this.context.createChannelMerger(e.channels)}static getDefaults(){return Object.assign(ft.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}class rv extends ft{constructor(e){super(e),this.name="StereoEffect",this.input=new jt({context:this.context}),this.input.channelCount=2,this.input.channelCountMode="explicit",this._dryWet=this.output=new by({context:this.context,fade:e.wet}),this.wet=this._dryWet.fade,this._split=new Ty({context:this.context,channels:2}),this._merge=new wm({context:this.context,channels:2}),this.input.connect(this._split),this.input.connect(this._dryWet.a),this._merge.connect(this._dryWet.b),Zt(this,["wet"])}connectEffectLeft(...e){this._split.connect(e[0],0,0),Ku(...e),Do(e[e.length-1],this._merge,0,0)}connectEffectRight(...e){this._split.connect(e[0],1,0),Ku(...e),Do(e[e.length-1],this._merge,0,1)}static getDefaults(){return Object.assign(ft.getDefaults(),{wet:1})}dispose(){return super.dispose(),this._dryWet.dispose(),this._split.dispose(),this._merge.dispose(),this}}class yN extends rv{constructor(e){super(e),this.feedback=new yn({context:this.context,value:e.feedback,units:"normalRange"}),this._feedbackL=new jt({context:this.context}),this._feedbackR=new jt({context:this.context}),this._feedbackSplit=new Ty({context:this.context,channels:2}),this._feedbackMerge=new wm({context:this.context,channels:2}),this._merge.connect(this._feedbackSplit),this._feedbackMerge.connect(this._split),this._feedbackSplit.connect(this._feedbackL,0,0),this._feedbackL.connect(this._feedbackMerge,0,0),this._feedbackSplit.connect(this._feedbackR,1,0),this._feedbackR.connect(this._feedbackMerge,0,1),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),Zt(this,["feedback"])}static getDefaults(){return Object.assign(rv.getDefaults(),{feedback:.5})}dispose(){return super.dispose(),this.feedback.dispose(),this._feedbackL.dispose(),this._feedbackR.dispose(),this._feedbackSplit.dispose(),this._feedbackMerge.dispose(),this}}class FT extends yN{constructor(){const e=ct(FT.getDefaults(),arguments,["frequency","delayTime","depth"]);super(e),this.name="Chorus",this._depth=e.depth,this._delayTime=e.delayTime/1e3,this._lfoL=new Zu({context:this.context,frequency:e.frequency,min:0,max:1}),this._lfoR=new Zu({context:this.context,frequency:e.frequency,min:0,max:1,phase:180}),this._delayNodeL=new Xf({context:this.context}),this._delayNodeR=new Xf({context:this.context}),this.frequency=this._lfoL.frequency,Zt(this,["frequency"]),this._lfoL.frequency.connect(this._lfoR.frequency),this.connectEffectLeft(this._delayNodeL),this.connectEffectRight(this._delayNodeR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this.depth=this._depth,this.type=e.type,this.spread=e.spread}static getDefaults(){return Object.assign(yN.getDefaults(),{frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180,feedback:0,wet:.5})}get depth(){return this._depth}set depth(e){this._depth=e;const n=this._delayTime*e;this._lfoL.min=Math.max(this._delayTime-n,0),this._lfoL.max=this._delayTime+n,this._lfoR.min=Math.max(this._delayTime-n,0),this._lfoR.max=this._delayTime+n}get delayTime(){return this._delayTime*1e3}set delayTime(e){this._delayTime=e/1e3,this.depth=this._depth}get type(){return this._lfoL.type}set type(e){this._lfoL.type=e,this._lfoR.type=e}get spread(){return this._lfoR.phase-this._lfoL.phase}set spread(e){this._lfoL.phase=90-e/2,this._lfoR.phase=e/2+90}start(e){return this._lfoL.start(e),this._lfoR.start(e),this}stop(e){return this._lfoL.stop(e),this._lfoR.stop(e),this}sync(){return this._lfoL.sync(),this._lfoR.sync(),this}unsync(){return this._lfoL.unsync(),this._lfoR.unsync(),this}dispose(){return super.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._delayNodeL.dispose(),this._delayNodeR.dispose(),this.frequency.dispose(),this}}class Lp extends Dl{constructor(){const e=ct(Lp.getDefaults(),arguments,["distortion"]);super(e),this.name="Distortion",this._shaper=new dh({context:this.context,length:4096}),this._distortion=e.distortion,this.connectEffect(this._shaper),this.distortion=e.distortion,this.oversample=e.oversample}static getDefaults(){return Object.assign(Dl.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(e){this._distortion=e;const n=e*100,r=Math.PI/180;this._shaper.setMap(i=>Math.abs(i)<.001?0:(3+n)*i*20*r/(Math.PI+n*Math.abs(i)))}get oversample(){return this._shaper.oversample}set oversample(e){this._shaper.oversample=e}dispose(){return super.dispose(),this._shaper.dispose(),this}}class xN extends Dl{constructor(e){super(e),this.name="FeedbackEffect",this._feedbackGain=new jt({context:this.context,gain:e.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Zt(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(Dl.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Ay extends xN{constructor(){const e=ct(Ay.getDefaults(),arguments,["delayTime","feedback"]);super(e),this.name="FeedbackDelay",this._delayNode=new Xf({context:this.context,delayTime:e.delayTime,maxDelay:e.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Zt(this,"delayTime")}static getDefaults(){return Object.assign(xN.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}class BT extends rv{constructor(){const e=ct(BT.getDefaults(),arguments,["frequency","octaves","baseFrequency"]);super(e),this.name="Phaser",this._lfoL=new Zu({context:this.context,frequency:e.frequency,min:0,max:1}),this._lfoR=new Zu({context:this.context,frequency:e.frequency,min:0,max:1,phase:180}),this._baseFrequency=this.toFrequency(e.baseFrequency),this._octaves=e.octaves,this.Q=new yn({context:this.context,value:e.Q,units:"positive"}),this._filtersL=this._makeFilters(e.stages,this._lfoL),this._filtersR=this._makeFilters(e.stages,this._lfoR),this.frequency=this._lfoL.frequency,this.frequency.value=e.frequency,this.connectEffectLeft(...this._filtersL),this.connectEffectRight(...this._filtersR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=e.baseFrequency,this.octaves=e.octaves,this._lfoL.start(),this._lfoR.start(),Zt(this,["frequency","Q"])}static getDefaults(){return Object.assign(rv.getDefaults(),{frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350})}_makeFilters(e,n){const r=[];for(let i=0;ie.disconnect()),this._filtersR.forEach(e=>e.disconnect()),this.frequency.dispose(),this}}class zT extends Dl{constructor(){const e=ct(zT.getDefaults(),arguments,["decay"]);super(e),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve(),this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(Dl.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(e){e=this.toSeconds(e),Aa(e,.001),this._decay=e,this.generate()}get preDelay(){return this._preDelay}set preDelay(e){e=this.toSeconds(e),Aa(e,0),this._preDelay=e,this.generate()}generate(){return _r(this,void 0,void 0,function*(){const e=this.ready,n=new dy(2,this._decay+this._preDelay,this.context.sampleRate),r=new Kf({context:n}),i=new Kf({context:n}),s=new wm({context:n});r.connect(s,0,0),i.connect(s,0,1);const o=new jt({context:n}).toDestination();s.connect(o),r.start(0),i.start(0),o.gain.setValueAtTime(0,0),o.gain.setValueAtTime(1,this._preDelay),o.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const a=n.render();return this.ready=a.then(En),yield e,this._convolver.buffer=(yield a).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}}class VT extends Dl{constructor(){const e=ct(VT.getDefaults(),arguments,["frequency","depth"]);super(e),this.name="Vibrato",this._delayNode=new Xf({context:this.context,delayTime:0,maxDelay:e.maxDelay}),this._lfo=new Zu({context:this.context,type:e.type,min:0,max:e.maxDelay,frequency:e.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=e.depth,Zt(this,["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)}static getDefaults(){return Object.assign(Dl.getDefaults(),{maxDelay:.005,frequency:5,depth:.1,type:"sine"})}get type(){return this._lfo.type}set type(e){this._lfo.type=e}dispose(){return super.dispose(),this._delayNode.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}}class Ar extends ft{constructor(){const e=ct(Ar.getDefaults(),arguments,["solo"]);super(e),this.name="Solo",this.input=this.output=new jt({context:this.context}),Ar._allSolos.has(this.context)||Ar._allSolos.set(this.context,new Set),Ar._allSolos.get(this.context).add(this),this.solo=e.solo}static getDefaults(){return Object.assign(ft.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(e){e?this._addSolo():this._removeSolo(),Ar._allSolos.get(this.context).forEach(n=>n._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){Ar._soloed.has(this.context)||Ar._soloed.set(this.context,new Set),Ar._soloed.get(this.context).add(this)}_removeSolo(){Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).delete(this)}_isSoloed(){return Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).has(this)}_noSolos(){return!Ar._soloed.has(this.context)||Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Ar._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Ar._allSolos=new Map;Ar._soloed=new Map;class HT extends ft{constructor(){const e=ct(HT.getDefaults(),arguments,["pan","volume"]);super(e),this.name="PanVol",this._panner=this.input=new UT({context:this.context,pan:e.pan,channelCount:e.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new Ll({context:this.context,volume:e.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=e.mute,Zt(this,["pan","volume"])}static getDefaults(){return Object.assign(ft.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class _f extends ft{constructor(){const e=ct(_f.getDefaults(),arguments,["volume","pan"]);super(e),this.name="Channel",this._solo=this.input=new Ar({solo:e.solo,context:this.context}),this._panVol=this.output=new HT({context:this.context,pan:e.pan,volume:e.volume,mute:e.mute,channelCount:e.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),Zt(this,["pan","volume"])}static getDefaults(){return Object.assign(ft.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(e){this._solo.solo=e}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(e){this._panVol.mute=e}_getBus(e){return _f.buses.has(e)||_f.buses.set(e,new jt({context:this.context})),_f.buses.get(e)}send(e,n=0){const r=this._getBus(e),i=new jt({context:this.context,units:"decibels",gain:n});return this.connect(i),i.connect(r),i}receive(e){return this._getBus(e).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}_f.buses=new Map;class GT extends ft{constructor(){const e=ct(GT.getDefaults(),arguments,["lowFrequency","highFrequency"]);super(e),this.name="MultibandSplit",this.input=new jt({context:this.context}),this.output=void 0,this.low=new Zs({context:this.context,frequency:0,type:"lowpass"}),this._lowMidFilter=new Zs({context:this.context,frequency:0,type:"highpass"}),this.mid=new Zs({context:this.context,frequency:0,type:"lowpass"}),this.high=new Zs({context:this.context,frequency:0,type:"highpass"}),this._internalChannels=[this.low,this.mid,this.high],this.lowFrequency=new yn({context:this.context,units:"frequency",value:e.lowFrequency}),this.highFrequency=new yn({context:this.context,units:"frequency",value:e.highFrequency}),this.Q=new yn({context:this.context,units:"positive",value:e.Q}),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.fan(this.low.frequency,this._lowMidFilter.frequency),this.highFrequency.fan(this.mid.frequency,this.high.frequency),this.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),Zt(this,["high","mid","low","highFrequency","lowFrequency"])}static getDefaults(){return Object.assign(ft.getDefaults(),{Q:1,highFrequency:2500,lowFrequency:400})}dispose(){return super.dispose(),_m(this,["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this._lowMidFilter.dispose(),this.mid.dispose(),this.high.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this.Q.dispose(),this}}class WT extends ft{constructor(){const e=ct(WT.getDefaults(),arguments,["threshold","ratio"]);super(e),this.name="Compressor",this._compressor=this.context.createDynamicsCompressor(),this.input=this._compressor,this.output=this._compressor,this.threshold=new Xt({minValue:this._compressor.threshold.minValue,maxValue:this._compressor.threshold.maxValue,context:this.context,convert:!1,param:this._compressor.threshold,units:"decibels",value:e.threshold}),this.attack=new Xt({minValue:this._compressor.attack.minValue,maxValue:this._compressor.attack.maxValue,context:this.context,param:this._compressor.attack,units:"time",value:e.attack}),this.release=new Xt({minValue:this._compressor.release.minValue,maxValue:this._compressor.release.maxValue,context:this.context,param:this._compressor.release,units:"time",value:e.release}),this.knee=new Xt({minValue:this._compressor.knee.minValue,maxValue:this._compressor.knee.maxValue,context:this.context,convert:!1,param:this._compressor.knee,units:"decibels",value:e.knee}),this.ratio=new Xt({minValue:this._compressor.ratio.minValue,maxValue:this._compressor.ratio.maxValue,context:this.context,convert:!1,param:this._compressor.ratio,units:"positive",value:e.ratio}),Zt(this,["knee","release","attack","ratio","threshold"])}static getDefaults(){return Object.assign(ft.getDefaults(),{attack:.003,knee:30,ratio:12,release:.25,threshold:-24})}get reduction(){return this._compressor.reduction}dispose(){return super.dispose(),this._compressor.disconnect(),this.attack.dispose(),this.release.dispose(),this.threshold.dispose(),this.ratio.dispose(),this.knee.dispose(),this}}class jT extends ft{constructor(){const e=ct(jT.getDefaults(),arguments,["low","mid","high"]);super(e),this.name="EQ3",this.output=new jt({context:this.context}),this._internalChannels=[],this.input=this._multibandSplit=new GT({context:this.context,highFrequency:e.highFrequency,lowFrequency:e.lowFrequency}),this._lowGain=new jt({context:this.context,gain:e.low,units:"decibels"}),this._midGain=new jt({context:this.context,gain:e.mid,units:"decibels"}),this._highGain=new jt({context:this.context,gain:e.high,units:"decibels"}),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),Zt(this,["low","mid","high","lowFrequency","highFrequency"]),this._internalChannels=[this._multibandSplit]}static getDefaults(){return Object.assign(ft.getDefaults(),{high:0,highFrequency:2500,low:0,lowFrequency:400,mid:0})}dispose(){return super.dispose(),_m(this,["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this._lowGain.dispose(),this._midGain.dispose(),this._highGain.dispose(),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this.Q.dispose(),this}}Vi().transport;function $T(){return Vi().transport}Vi().destination;Vi().destination;function une(){return Vi().destination}Vi().listener;Vi().draw;Vi();const ow=Ir("256n").toSeconds(),hne=Ir("8n").toSeconds();function fne(){const t=new zT;t.set({wet:0});const e=new Ay;e.set({wet:0,delayTime:ow,maxDelay:"1n",feedback:.666});const n=new FT;n.set({wet:0,depth:.999,frequency:7,feedback:.666});const r=new BT;r.set({wet:0,Q:10});const i=new Lp;i.set({wet:0,distortion:.9});const s=new VT;return s.set({wet:0,depth:.2}),{reverb:t,echo:e,chorus:n,phaser:r,distortion:i,vibrato:s}}const dne={a:1,b:2,c:3,d:4,e:5,f:6,g:7,x:8,"#":9,"!":10,y:13,t:14,s:15,i:16,q:17,h:18,w:19,3:20,".":21,"+":11,"-":12,0:22,1:23,2:24,p:25,4:26,5:27,6:29,7:28,8:30,9:31};let pne=0;function mne(t,e,n){let r=e,i=3,s="32n",o="",a="";const c=[];function l(){a="",o="",r+=Ir(s).toSeconds()}function u(){a===null?(c.push([r,[t,s,a]]),l()):mt(a)?(c.push([r,[t,s,a]]),l()):a!==""&&(c.push([r,[t,s,`${a}${o}${i}`]]),l())}for(let h=0;h{if(!f_){const t=$T();t.bpm.value=107,t.start(),ro("synth","audio is enabled!"),f_=!0}}).catch(()=>{})}function _ne(){const t=une(),e=new Ll(8);e.connect(t);const n=new WT({threshold:-24,ratio:4,attack:.003,release:.25,knee:30});n.connect(e);const r=new jt;r.connect(n);const i=new Ll(2);i.connect(n);const s=[sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r)],o=new tv().connect(i);o.maxPolyphony=8,o.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"square"}});function a(De){o.triggerAttackRelease("C6","1i",De)}const c=new Li().connect(i);o.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"square"}});function l(De){const A=Ir("64n").toSeconds();c.triggerAttackRelease("C6","8n",De),c.frequency.exponentialRampToValueAtTime("C11",A+De)}const u=new Zs(350,"bandpass").connect(i),h=new jt().connect(u);h.gain.value=0;const p=new tv().connect(h);p.maxPolyphony=8,p.set({envelope:{attack:.001,decay:.01,sustain:.1,release:.1},oscillator:{type:"square"}});function m(De,A){const ie=Ir("64n").toSeconds()+Ir(De).toSeconds();h.gain.setValueAtTime(.5,A),h.gain.exponentialRampToValueAtTime(.01,ie+A),p.triggerAttackRelease([800,540],De,A)}const g=new jT(-10,10,-1).connect(i),v=new Zs(800,"highpass",-12);v.connect(g);const y=new mf;y.set({envelope:{attack:.01,decay:.1,sustain:.1,release:.1}}),y.connect(v);function _(De,A){y.triggerAttackRelease(De,A)}const S=new Lp().connect(i);S.set({distortion:.666});const E=new Li;E.set({envelope:{attack:0,decay:.1,sustain:0,release:1},oscillator:{type:"triangle"}}),E.connect(S);const b=new Zs;b.set({type:"highpass",frequency:1e4}),b.connect(S);const N=new mf;N.set({envelope:{attack:.01,decay:.1,sustain:0,release:.1}}),N.connect(b);function R(De,A){const ie=Ir("512n").toSeconds(),te=Ir("32n").toSeconds();E.triggerAttackRelease(1e4,De,A,1),E.frequency.exponentialRampToValueAtTime(300,A+ie),E.frequency.exponentialRampToValueAtTime(100,A+te),N.triggerAttackRelease("8n",A,.333),N.volume.setValueAtTime(1,A),N.volume.exponentialRampToValueAtTime(0,A+Ir("32n").toSeconds())}const M=new Zs;M.set({type:"bandpass",frequency:256,Q:.17}),M.connect(i);const O=new Li;O.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"sawtooth"}}),O.connect(M);const C=new Li;C.set({envelope:{attack:.001,decay:.1,sustain:.001,release:.1},oscillator:{type:"sine"}}),C.connect(M);function I(De,A){O.triggerAttackRelease(2e3,De,A),O.frequency.exponentialRampToValueAtTime(1e3,A+Ir("32n").toSeconds()),C.triggerAttackRelease(999,De,A),C.frequency.exponentialRampToValueAtTime(888,A+Ir("256n").toSeconds())}const U=new Lp().connect(i);U.set({distortion:.876});const L=new Li;L.set({envelope:{attack:0,decay:.1,sustain:0,release:1},oscillator:{type:"triangle"}}),L.connect(U);const P=new Zs;P.set({type:"highpass",frequency:1e4}),P.connect(U);const T=new mf;T.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1}}),T.connect(P);function H(De,A){const ie=Ir("512n").toSeconds(),te=Ir("32n").toSeconds();L.triggerAttackRelease(1e4,De,A,1),L.frequency.exponentialRampToValueAtTime(150,A+ie),L.frequency.exponentialRampToValueAtTime(100,A+te),T.triggerAttackRelease("8n",A,.25),T.volume.setValueAtTime(1,A),T.volume.exponentialRampToValueAtTime(0,A+Ir("32n").toSeconds())}const V=new Li().connect(i);V.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1},oscillator:{type:"sawtooth"}});const B=new Li().connect(i);V.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1},oscillator:{type:"triangle"}});const z=new mf().connect(i);z.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1}});function W(De,A){const ie=Ir("256n").toSeconds(),te=Ir(De).toSeconds()-ie;V.triggerAttackRelease("C4",te,A,1),V.frequency.exponentialRampToValueAtTime(gN("C0").toFrequency(),A+te),B.triggerAttackRelease("C5",te,A,.5),B.frequency.exponentialRampToValueAtTime(gN("C0").toFrequency(),A+te);const X=Ir("4n").toSeconds();z.triggerAttackRelease("8n",A),z.volume.setValueAtTime(1,A),z.volume.exponentialRampToValueAtTime(0,A+X)}const K=new Zs;K.set({type:"bandpass",frequency:256,Q:.17}),K.connect(i);const j=new Li;j.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"sawtooth"}}),j.connect(K);const Y=new Li;Y.set({envelope:{attack:.001,decay:.1,sustain:.001,release:.1},oscillator:{type:"sine"}}),Y.connect(K);function ge(De,A){j.triggerAttackRelease(2e3,De,A),j.frequency.exponentialRampToValueAtTime(100,A+Ir("32n").toSeconds()),Y.triggerAttackRelease(699,De,A),Y.frequency.exponentialRampToValueAtTime(399,A+Ir("256n").toSeconds())}const Q=new Em().connect(i);Q.set({octaves:8});function re(De){Q.triggerAttackRelease("C1","8n",De)}const we=new nv(Ae);function Ae(De,A){if(A===null)return;const[ie,te,X]=A;if(Kt(X)&&Z(s[ie])&&s[ie].source.triggerAttackRelease(X,te,De),mt(X))switch(X){case 0:a(De);break;case 1:l(De);break;case 2:m(te,De);break;case 3:_(te,De);break;case 4:R(te,De);break;case 5:I(te,De);break;case 6:H(te,De);break;case 7:W(te,De);break;case 8:ge(te,De);break;case 9:re(De);break;case-1:--Ve,Ve===0&&(Le=-1);break}}function Ee(De,A,ie){let te=A;const X=mne(De,A,ie),$=X[X.length-1];Z($)&&(te=Math.max(te,$[0]));for(let ne=0;ne{if(f_&&!Z(mu)&&(mu=_ne()),!!Z(mu))switch(t.target){case"tts":sp("tts",async()=>{if(cn(t.data)){const[e,n]=t.data;await Sne(e||"en-US-GuyNeural",n)}});break;case"play":if(cn(t.data)){const[e,n]=t.data;n===""?mu.stopplay():mu.addplay(e,n)}break;case"voice":if(cn(t.data)){const[e,n,r]=t.data,i=mu.SOURCE[e];if(!Z(i)){Pn(oc.name(),t.target,`unknown voice ${e}`);return}switch(n){case"bpm":if(mt(r)){$T().bpm.value=r;return}break;case"vol":case"volume":if(mt(r)){i.source.volume.value=r;return}break;case"port":case"portamento":if(mt(r)){i.source.portamento=r;return}break;case"env":case"envelope":if(cn(r)){const[s,o,a,c]=r;i.source.set({envelope:{attack:s,decay:o,sustain:a,release:c}});return}break;default:if(Kt(n)){if(vne(n,r)){i.source.set({oscillator:{type:n}}),cn(r)&&i.source.set({oscillator:{partials:r}}),mt(r)&&i.source.set({oscillator:{partials:[r]}});return}const s=i.source.get().oscillator.type;switch(s){case"pwm":switch(n){case"modfreq":case"modulationfrequency":if(mt(r)){i.source.set({oscillator:{modulationFrequency:r}});return}break}break;case"pulse":switch(n){case"width":if(mt(r)){i.source.set({oscillator:{width:r}});return}break}break;case"custom":case"sine":case"square":case"triangle":case"sawtooth":switch(n){case"phase":if(mt(r)){i.source.set({oscillator:{phase:r}});return}break}break;case"amcustom":case"amsine":case"amsquare":case"amtriangle":case"amsawtooth":switch(n){case"harmonicity":if(mt(r)){i.source.set({oscillator:{harmonicity:r}});return}break;case"modtype":case"modulationtype":if(Kt(r)){i.source.set({oscillator:{modulationType:r}});return}break;case"modenv":case"modulationenvelope":if(cn(r)){const[o,a,c,l]=r;i.source.set({oscillator:{modulationEnvelope:{attack:o,decay:a,sustain:c,release:l}}});return}break}break;case"fmcustom":case"fmsine":case"fmsquare":case"fmtriangle":case"fmsawtooth":switch(n){case"harmonicity":if(mt(r)){i.source.set({oscillator:{harmonicity:r}});return}break;case"modindex":if(mt(r)){i.source.set({oscillator:{modulationIndex:r}});return}break;case"modtype":if(Kt(r)){i.source.set({oscillator:{modulationType:r}});return}break;case"modenv":if(cn(r)){const[o,a,c,l]=r;i.source.set({oscillator:{modulationEnvelope:{attack:o,decay:a,sustain:c,release:l}}});return}break}break;case"fatcustom":case"fatsine":case"fatsquare":case"fattriangle":case"fatsawtooth":switch(n){case"count":if(mt(r)){i.source.set({oscillator:{count:r}});return}break;case"phase":if(mt(r)){i.source.set({oscillator:{phase:r}});return}break;case"spread":if(mt(r)){i.source.set({oscillator:{spread:r}});return}break}break}Pn(oc.name(),t.target,`unknown ${s} config ${n}`)}break}}break;case"voicefx":if(cn(t.data)){const[e,n,r,i]=t.data,s=mu.SOURCE[e],o=s==null?void 0:s.fx[n];if(Z(o)){switch(r){case"on":o.wet.value=.2;break;case"off":o.wet.value=0;break;default:if(mt(r))o.wet.value=Cn(.01*r,0,1);else switch(n){case"vibrato":{switch(r){default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"chorus":{switch(r){default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"phaser":{const a=o;switch(r){case"q":mt(i)&&(a.Q.value=i);break;case"octaves":mt(i)&&(a.octaves=i);break;case"basefrequency":mt(i)&&(a.baseFrequency=i);break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"distortion":{const a=o;switch(r){case"distortion":mt(i)&&(a.distortion=i);break;case"oversample":switch(i){case"2x":case"4x":case"none":a.oversample=i;break}break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"echo":{const a=o;switch(r){case"delaytime":a.delayTime.value=i;break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"reverb":{const a=o;switch(r){case"decay":a.decay=i;break;case"predelay":a.preDelay=i;break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}}break}o instanceof Ay&&(o.wet.value===0?o.set({delayTime:ow}):o.get().delayTime===ow&&o.set({delayTime:hne}));return}Pn(oc.name(),t.target,`unknown fx ${n}`)}break}}),SN=t=>{let e;const n=new Set,r=(l,u)=>{const h=typeof l=="function"?l(e):l;if(!Object.is(h,e)){const p=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(m=>m(e,p))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=e=t(r,i,a);return a},qT=t=>t?SN(t):SN,Ene=t=>t;function XT(t,e=Ene){const n=Co.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return Co.useDebugValue(n),n}const EN=t=>{const e=qT(t),n=r=>XT(e,r);return Object.assign(n,e),n},bm=t=>t?EN(t):EN;function wne(t){const e=Ne.useRef();return n=>{const r=t(n);return(e.current===void 0||r===void 0?e.current===r:oL(e.current,r))?e.current:e.current=r}}const os=bm(()=>({desync:!1,gadget:{player:"",layers:[],panels:[],reset:!1,focus:""}}));function KT(){return os(t=>t.gadget.player)}function iv(){return os.getState().gadget.player}var d_=(t=>(t[t.OFF=0]="OFF",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t))(d_||{});const wN=128;var Pi=(t=>(t[t.TOP=0]="TOP",t[t.BOTTOM=1]="BOTTOM",t[t.FULL=2]="FULL",t[t.SPLIT_Y=3]="SPLIT_Y",t[t.SPLIT_Y_ALT=4]="SPLIT_Y_ALT",t[t.MAX=5]="MAX",t))(Pi||{});const ts=bm(()=>({layout:1,terminal:{open:!1,level:1,logs:[]},editor:{open:!1,player:"",book:"",page:"",type:"",title:""}})),br=bm(()=>({scroll:0,xcursor:0,ycursor:0,xselect:void 0,yselect:void 0,bufferindex:0,buffer:[""]})),hr=bm(()=>({id:"",xscroll:0,yscroll:0,cursor:0,select:void 0}));/** +`;xD(cne,lne);class Ty extends ft{constructor(){const e=ct(Ty.getDefaults(),arguments,["channels"]);super(e),this.name="Split",this._splitter=this.input=this.output=this.context.createChannelSplitter(e.channels),this._internalChannels=[this._splitter]}static getDefaults(){return Object.assign(ft.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._splitter.disconnect(),this}}class wm extends ft{constructor(){const e=ct(wm.getDefaults(),arguments,["channels"]);super(e),this.name="Merge",this._merger=this.output=this.input=this.context.createChannelMerger(e.channels)}static getDefaults(){return Object.assign(ft.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}class rv extends ft{constructor(e){super(e),this.name="StereoEffect",this.input=new jt({context:this.context}),this.input.channelCount=2,this.input.channelCountMode="explicit",this._dryWet=this.output=new by({context:this.context,fade:e.wet}),this.wet=this._dryWet.fade,this._split=new Ty({context:this.context,channels:2}),this._merge=new wm({context:this.context,channels:2}),this.input.connect(this._split),this.input.connect(this._dryWet.a),this._merge.connect(this._dryWet.b),Zt(this,["wet"])}connectEffectLeft(...e){this._split.connect(e[0],0,0),Ku(...e),Do(e[e.length-1],this._merge,0,0)}connectEffectRight(...e){this._split.connect(e[0],1,0),Ku(...e),Do(e[e.length-1],this._merge,0,1)}static getDefaults(){return Object.assign(ft.getDefaults(),{wet:1})}dispose(){return super.dispose(),this._dryWet.dispose(),this._split.dispose(),this._merge.dispose(),this}}class yN extends rv{constructor(e){super(e),this.feedback=new yn({context:this.context,value:e.feedback,units:"normalRange"}),this._feedbackL=new jt({context:this.context}),this._feedbackR=new jt({context:this.context}),this._feedbackSplit=new Ty({context:this.context,channels:2}),this._feedbackMerge=new wm({context:this.context,channels:2}),this._merge.connect(this._feedbackSplit),this._feedbackMerge.connect(this._split),this._feedbackSplit.connect(this._feedbackL,0,0),this._feedbackL.connect(this._feedbackMerge,0,0),this._feedbackSplit.connect(this._feedbackR,1,0),this._feedbackR.connect(this._feedbackMerge,0,1),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),Zt(this,["feedback"])}static getDefaults(){return Object.assign(rv.getDefaults(),{feedback:.5})}dispose(){return super.dispose(),this.feedback.dispose(),this._feedbackL.dispose(),this._feedbackR.dispose(),this._feedbackSplit.dispose(),this._feedbackMerge.dispose(),this}}class FT extends yN{constructor(){const e=ct(FT.getDefaults(),arguments,["frequency","delayTime","depth"]);super(e),this.name="Chorus",this._depth=e.depth,this._delayTime=e.delayTime/1e3,this._lfoL=new Zu({context:this.context,frequency:e.frequency,min:0,max:1}),this._lfoR=new Zu({context:this.context,frequency:e.frequency,min:0,max:1,phase:180}),this._delayNodeL=new Xf({context:this.context}),this._delayNodeR=new Xf({context:this.context}),this.frequency=this._lfoL.frequency,Zt(this,["frequency"]),this._lfoL.frequency.connect(this._lfoR.frequency),this.connectEffectLeft(this._delayNodeL),this.connectEffectRight(this._delayNodeR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this.depth=this._depth,this.type=e.type,this.spread=e.spread}static getDefaults(){return Object.assign(yN.getDefaults(),{frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180,feedback:0,wet:.5})}get depth(){return this._depth}set depth(e){this._depth=e;const n=this._delayTime*e;this._lfoL.min=Math.max(this._delayTime-n,0),this._lfoL.max=this._delayTime+n,this._lfoR.min=Math.max(this._delayTime-n,0),this._lfoR.max=this._delayTime+n}get delayTime(){return this._delayTime*1e3}set delayTime(e){this._delayTime=e/1e3,this.depth=this._depth}get type(){return this._lfoL.type}set type(e){this._lfoL.type=e,this._lfoR.type=e}get spread(){return this._lfoR.phase-this._lfoL.phase}set spread(e){this._lfoL.phase=90-e/2,this._lfoR.phase=e/2+90}start(e){return this._lfoL.start(e),this._lfoR.start(e),this}stop(e){return this._lfoL.stop(e),this._lfoR.stop(e),this}sync(){return this._lfoL.sync(),this._lfoR.sync(),this}unsync(){return this._lfoL.unsync(),this._lfoR.unsync(),this}dispose(){return super.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._delayNodeL.dispose(),this._delayNodeR.dispose(),this.frequency.dispose(),this}}class Lp extends Dl{constructor(){const e=ct(Lp.getDefaults(),arguments,["distortion"]);super(e),this.name="Distortion",this._shaper=new dh({context:this.context,length:4096}),this._distortion=e.distortion,this.connectEffect(this._shaper),this.distortion=e.distortion,this.oversample=e.oversample}static getDefaults(){return Object.assign(Dl.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(e){this._distortion=e;const n=e*100,r=Math.PI/180;this._shaper.setMap(i=>Math.abs(i)<.001?0:(3+n)*i*20*r/(Math.PI+n*Math.abs(i)))}get oversample(){return this._shaper.oversample}set oversample(e){this._shaper.oversample=e}dispose(){return super.dispose(),this._shaper.dispose(),this}}class xN extends Dl{constructor(e){super(e),this.name="FeedbackEffect",this._feedbackGain=new jt({context:this.context,gain:e.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Zt(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(Dl.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Ay extends xN{constructor(){const e=ct(Ay.getDefaults(),arguments,["delayTime","feedback"]);super(e),this.name="FeedbackDelay",this._delayNode=new Xf({context:this.context,delayTime:e.delayTime,maxDelay:e.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Zt(this,"delayTime")}static getDefaults(){return Object.assign(xN.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}class BT extends rv{constructor(){const e=ct(BT.getDefaults(),arguments,["frequency","octaves","baseFrequency"]);super(e),this.name="Phaser",this._lfoL=new Zu({context:this.context,frequency:e.frequency,min:0,max:1}),this._lfoR=new Zu({context:this.context,frequency:e.frequency,min:0,max:1,phase:180}),this._baseFrequency=this.toFrequency(e.baseFrequency),this._octaves=e.octaves,this.Q=new yn({context:this.context,value:e.Q,units:"positive"}),this._filtersL=this._makeFilters(e.stages,this._lfoL),this._filtersR=this._makeFilters(e.stages,this._lfoR),this.frequency=this._lfoL.frequency,this.frequency.value=e.frequency,this.connectEffectLeft(...this._filtersL),this.connectEffectRight(...this._filtersR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=e.baseFrequency,this.octaves=e.octaves,this._lfoL.start(),this._lfoR.start(),Zt(this,["frequency","Q"])}static getDefaults(){return Object.assign(rv.getDefaults(),{frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350})}_makeFilters(e,n){const r=[];for(let i=0;ie.disconnect()),this._filtersR.forEach(e=>e.disconnect()),this.frequency.dispose(),this}}class zT extends Dl{constructor(){const e=ct(zT.getDefaults(),arguments,["decay"]);super(e),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve(),this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(Dl.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(e){e=this.toSeconds(e),Aa(e,.001),this._decay=e,this.generate()}get preDelay(){return this._preDelay}set preDelay(e){e=this.toSeconds(e),Aa(e,0),this._preDelay=e,this.generate()}generate(){return _r(this,void 0,void 0,function*(){const e=this.ready,n=new dy(2,this._decay+this._preDelay,this.context.sampleRate),r=new Kf({context:n}),i=new Kf({context:n}),s=new wm({context:n});r.connect(s,0,0),i.connect(s,0,1);const o=new jt({context:n}).toDestination();s.connect(o),r.start(0),i.start(0),o.gain.setValueAtTime(0,0),o.gain.setValueAtTime(1,this._preDelay),o.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const a=n.render();return this.ready=a.then(En),yield e,this._convolver.buffer=(yield a).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}}class VT extends Dl{constructor(){const e=ct(VT.getDefaults(),arguments,["frequency","depth"]);super(e),this.name="Vibrato",this._delayNode=new Xf({context:this.context,delayTime:0,maxDelay:e.maxDelay}),this._lfo=new Zu({context:this.context,type:e.type,min:0,max:e.maxDelay,frequency:e.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=e.depth,Zt(this,["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)}static getDefaults(){return Object.assign(Dl.getDefaults(),{maxDelay:.005,frequency:5,depth:.1,type:"sine"})}get type(){return this._lfo.type}set type(e){this._lfo.type=e}dispose(){return super.dispose(),this._delayNode.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}}class Ar extends ft{constructor(){const e=ct(Ar.getDefaults(),arguments,["solo"]);super(e),this.name="Solo",this.input=this.output=new jt({context:this.context}),Ar._allSolos.has(this.context)||Ar._allSolos.set(this.context,new Set),Ar._allSolos.get(this.context).add(this),this.solo=e.solo}static getDefaults(){return Object.assign(ft.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(e){e?this._addSolo():this._removeSolo(),Ar._allSolos.get(this.context).forEach(n=>n._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){Ar._soloed.has(this.context)||Ar._soloed.set(this.context,new Set),Ar._soloed.get(this.context).add(this)}_removeSolo(){Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).delete(this)}_isSoloed(){return Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).has(this)}_noSolos(){return!Ar._soloed.has(this.context)||Ar._soloed.has(this.context)&&Ar._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Ar._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Ar._allSolos=new Map;Ar._soloed=new Map;class HT extends ft{constructor(){const e=ct(HT.getDefaults(),arguments,["pan","volume"]);super(e),this.name="PanVol",this._panner=this.input=new UT({context:this.context,pan:e.pan,channelCount:e.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new Ll({context:this.context,volume:e.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=e.mute,Zt(this,["pan","volume"])}static getDefaults(){return Object.assign(ft.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class _f extends ft{constructor(){const e=ct(_f.getDefaults(),arguments,["volume","pan"]);super(e),this.name="Channel",this._solo=this.input=new Ar({solo:e.solo,context:this.context}),this._panVol=this.output=new HT({context:this.context,pan:e.pan,volume:e.volume,mute:e.mute,channelCount:e.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),Zt(this,["pan","volume"])}static getDefaults(){return Object.assign(ft.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(e){this._solo.solo=e}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(e){this._panVol.mute=e}_getBus(e){return _f.buses.has(e)||_f.buses.set(e,new jt({context:this.context})),_f.buses.get(e)}send(e,n=0){const r=this._getBus(e),i=new jt({context:this.context,units:"decibels",gain:n});return this.connect(i),i.connect(r),i}receive(e){return this._getBus(e).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}_f.buses=new Map;class GT extends ft{constructor(){const e=ct(GT.getDefaults(),arguments,["lowFrequency","highFrequency"]);super(e),this.name="MultibandSplit",this.input=new jt({context:this.context}),this.output=void 0,this.low=new Zs({context:this.context,frequency:0,type:"lowpass"}),this._lowMidFilter=new Zs({context:this.context,frequency:0,type:"highpass"}),this.mid=new Zs({context:this.context,frequency:0,type:"lowpass"}),this.high=new Zs({context:this.context,frequency:0,type:"highpass"}),this._internalChannels=[this.low,this.mid,this.high],this.lowFrequency=new yn({context:this.context,units:"frequency",value:e.lowFrequency}),this.highFrequency=new yn({context:this.context,units:"frequency",value:e.highFrequency}),this.Q=new yn({context:this.context,units:"positive",value:e.Q}),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.fan(this.low.frequency,this._lowMidFilter.frequency),this.highFrequency.fan(this.mid.frequency,this.high.frequency),this.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),Zt(this,["high","mid","low","highFrequency","lowFrequency"])}static getDefaults(){return Object.assign(ft.getDefaults(),{Q:1,highFrequency:2500,lowFrequency:400})}dispose(){return super.dispose(),_m(this,["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this._lowMidFilter.dispose(),this.mid.dispose(),this.high.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this.Q.dispose(),this}}class WT extends ft{constructor(){const e=ct(WT.getDefaults(),arguments,["threshold","ratio"]);super(e),this.name="Compressor",this._compressor=this.context.createDynamicsCompressor(),this.input=this._compressor,this.output=this._compressor,this.threshold=new Xt({minValue:this._compressor.threshold.minValue,maxValue:this._compressor.threshold.maxValue,context:this.context,convert:!1,param:this._compressor.threshold,units:"decibels",value:e.threshold}),this.attack=new Xt({minValue:this._compressor.attack.minValue,maxValue:this._compressor.attack.maxValue,context:this.context,param:this._compressor.attack,units:"time",value:e.attack}),this.release=new Xt({minValue:this._compressor.release.minValue,maxValue:this._compressor.release.maxValue,context:this.context,param:this._compressor.release,units:"time",value:e.release}),this.knee=new Xt({minValue:this._compressor.knee.minValue,maxValue:this._compressor.knee.maxValue,context:this.context,convert:!1,param:this._compressor.knee,units:"decibels",value:e.knee}),this.ratio=new Xt({minValue:this._compressor.ratio.minValue,maxValue:this._compressor.ratio.maxValue,context:this.context,convert:!1,param:this._compressor.ratio,units:"positive",value:e.ratio}),Zt(this,["knee","release","attack","ratio","threshold"])}static getDefaults(){return Object.assign(ft.getDefaults(),{attack:.003,knee:30,ratio:12,release:.25,threshold:-24})}get reduction(){return this._compressor.reduction}dispose(){return super.dispose(),this._compressor.disconnect(),this.attack.dispose(),this.release.dispose(),this.threshold.dispose(),this.ratio.dispose(),this.knee.dispose(),this}}class jT extends ft{constructor(){const e=ct(jT.getDefaults(),arguments,["low","mid","high"]);super(e),this.name="EQ3",this.output=new jt({context:this.context}),this._internalChannels=[],this.input=this._multibandSplit=new GT({context:this.context,highFrequency:e.highFrequency,lowFrequency:e.lowFrequency}),this._lowGain=new jt({context:this.context,gain:e.low,units:"decibels"}),this._midGain=new jt({context:this.context,gain:e.mid,units:"decibels"}),this._highGain=new jt({context:this.context,gain:e.high,units:"decibels"}),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),Zt(this,["low","mid","high","lowFrequency","highFrequency"]),this._internalChannels=[this._multibandSplit]}static getDefaults(){return Object.assign(ft.getDefaults(),{high:0,highFrequency:2500,low:0,lowFrequency:400,mid:0})}dispose(){return super.dispose(),_m(this,["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this._lowGain.dispose(),this._midGain.dispose(),this._highGain.dispose(),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this.Q.dispose(),this}}Vi().transport;function $T(){return Vi().transport}Vi().destination;Vi().destination;function une(){return Vi().destination}Vi().listener;Vi().draw;Vi();const ow=Ir("256n").toSeconds(),hne=Ir("8n").toSeconds();function fne(){const t=new zT;t.set({wet:0});const e=new Ay;e.set({wet:0,delayTime:ow,maxDelay:"1n",feedback:.666});const n=new FT;n.set({wet:0,depth:.999,frequency:7,feedback:.666});const r=new BT;r.set({wet:0,Q:10});const i=new Lp;i.set({wet:0,distortion:.9});const s=new VT;return s.set({wet:0,depth:.2}),{reverb:t,echo:e,chorus:n,phaser:r,distortion:i,vibrato:s}}const dne={a:1,b:2,c:3,d:4,e:5,f:6,g:7,x:8,"#":9,"!":10,y:13,t:14,s:15,i:16,q:17,h:18,w:19,3:20,".":21,"+":11,"-":12,0:22,1:23,2:24,p:25,4:26,5:27,6:29,7:28,8:30,9:31};let pne=0;function mne(t,e,n){let r=e,i=3,s="32n",o="",a="";const c=[];function l(){a="",o="",r+=Ir(s).toSeconds()}function u(){a===null?(c.push([r,[t,s,a]]),l()):mt(a)?(c.push([r,[t,s,a]]),l()):a!==""&&(c.push([r,[t,s,`${a}${o}${i}`]]),l())}for(let h=0;h{if(!f_){const t=$T();t.bpm.value=107,t.start(),ro("synth","audio is enabled!"),f_=!0}}).catch(()=>{})}function _ne(){const t=une(),e=new Ll(8);e.connect(t);const n=new WT({threshold:-24,ratio:4,attack:.003,release:.25,knee:30});n.connect(e);const r=new jt;r.connect(n);const i=new Ll(2);i.connect(n);const s=[sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r),sc(r)],o=new tv().connect(i);o.maxPolyphony=8,o.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"square"}});function a(De){o.triggerAttackRelease("C6","1i",De)}const c=new Li().connect(i);o.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"square"}});function l(De){const A=Ir("64n").toSeconds();c.triggerAttackRelease("C6","8n",De),c.frequency.exponentialRampToValueAtTime("C11",A+De)}const u=new Zs(350,"bandpass").connect(i),h=new jt().connect(u);h.gain.value=0;const p=new tv().connect(h);p.maxPolyphony=8,p.set({envelope:{attack:.001,decay:.01,sustain:.1,release:.1},oscillator:{type:"square"}});function m(De,A){const ie=Ir("64n").toSeconds()+Ir(De).toSeconds();h.gain.setValueAtTime(.5,A),h.gain.exponentialRampToValueAtTime(.01,ie+A),p.triggerAttackRelease([800,540],De,A)}const g=new jT(-10,10,-1).connect(i),v=new Zs(800,"highpass",-12);v.connect(g);const y=new mf;y.set({envelope:{attack:.01,decay:.1,sustain:.1,release:.1}}),y.connect(v);function _(De,A){y.triggerAttackRelease(De,A)}const S=new Lp().connect(i);S.set({distortion:.666});const E=new Li;E.set({envelope:{attack:0,decay:.1,sustain:0,release:1},oscillator:{type:"triangle"}}),E.connect(S);const b=new Zs;b.set({type:"highpass",frequency:1e4}),b.connect(S);const N=new mf;N.set({envelope:{attack:.01,decay:.1,sustain:0,release:.1}}),N.connect(b);function R(De,A){const ie=Ir("512n").toSeconds(),te=Ir("32n").toSeconds();E.triggerAttackRelease(1e4,De,A,1),E.frequency.exponentialRampToValueAtTime(300,A+ie),E.frequency.exponentialRampToValueAtTime(100,A+te),N.triggerAttackRelease("8n",A,.333),N.volume.setValueAtTime(1,A),N.volume.exponentialRampToValueAtTime(0,A+Ir("32n").toSeconds())}const M=new Zs;M.set({type:"bandpass",frequency:256,Q:.17}),M.connect(i);const O=new Li;O.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"sawtooth"}}),O.connect(M);const C=new Li;C.set({envelope:{attack:.001,decay:.1,sustain:.001,release:.1},oscillator:{type:"sine"}}),C.connect(M);function I(De,A){O.triggerAttackRelease(2e3,De,A),O.frequency.exponentialRampToValueAtTime(1e3,A+Ir("32n").toSeconds()),C.triggerAttackRelease(999,De,A),C.frequency.exponentialRampToValueAtTime(888,A+Ir("256n").toSeconds())}const U=new Lp().connect(i);U.set({distortion:.876});const L=new Li;L.set({envelope:{attack:0,decay:.1,sustain:0,release:1},oscillator:{type:"triangle"}}),L.connect(U);const P=new Zs;P.set({type:"highpass",frequency:1e4}),P.connect(U);const T=new mf;T.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1}}),T.connect(P);function H(De,A){const ie=Ir("512n").toSeconds(),te=Ir("32n").toSeconds();L.triggerAttackRelease(1e4,De,A,1),L.frequency.exponentialRampToValueAtTime(150,A+ie),L.frequency.exponentialRampToValueAtTime(100,A+te),T.triggerAttackRelease("8n",A,.25),T.volume.setValueAtTime(1,A),T.volume.exponentialRampToValueAtTime(0,A+Ir("32n").toSeconds())}const V=new Li().connect(i);V.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1},oscillator:{type:"sawtooth"}});const B=new Li().connect(i);V.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1},oscillator:{type:"triangle"}});const z=new mf().connect(i);z.set({envelope:{attack:.01,decay:.1,sustain:.001,release:.1}});function W(De,A){const ie=Ir("256n").toSeconds(),te=Ir(De).toSeconds()-ie;V.triggerAttackRelease("C4",te,A,1),V.frequency.exponentialRampToValueAtTime(gN("C0").toFrequency(),A+te),B.triggerAttackRelease("C5",te,A,.5),B.frequency.exponentialRampToValueAtTime(gN("C0").toFrequency(),A+te);const X=Ir("4n").toSeconds();z.triggerAttackRelease("8n",A),z.volume.setValueAtTime(1,A),z.volume.exponentialRampToValueAtTime(0,A+X)}const K=new Zs;K.set({type:"bandpass",frequency:256,Q:.17}),K.connect(i);const j=new Li;j.set({envelope:{attack:.001,decay:.001,sustain:.001,release:.1},oscillator:{type:"sawtooth"}}),j.connect(K);const Y=new Li;Y.set({envelope:{attack:.001,decay:.1,sustain:.001,release:.1},oscillator:{type:"sine"}}),Y.connect(K);function ge(De,A){j.triggerAttackRelease(2e3,De,A),j.frequency.exponentialRampToValueAtTime(100,A+Ir("32n").toSeconds()),Y.triggerAttackRelease(699,De,A),Y.frequency.exponentialRampToValueAtTime(399,A+Ir("256n").toSeconds())}const Q=new Em().connect(i);Q.set({octaves:8});function re(De){Q.triggerAttackRelease("C1","8n",De)}const we=new nv(Ae);function Ae(De,A){if(A===null)return;const[ie,te,X]=A;if(Kt(X)&&Z(s[ie])&&s[ie].source.triggerAttackRelease(X,te,De),mt(X))switch(X){case 0:a(De);break;case 1:l(De);break;case 2:m(te,De);break;case 3:_(te,De);break;case 4:R(te,De);break;case 5:I(te,De);break;case 6:H(te,De);break;case 7:W(te,De);break;case 8:ge(te,De);break;case 9:re(De);break;case-1:--Ve,Ve===0&&(Le=-1);break}}function Ee(De,A,ie){let te=A;const X=mne(De,A,ie),$=X[X.length-1];Z($)&&(te=Math.max(te,$[0]));for(let ne=0;ne{if(f_&&!Z(mu)&&(mu=_ne()),!!Z(mu))switch(t.target){case"tts":sp("tts",async()=>{if(cn(t.data)){const[e,n]=t.data;await Sne(e||"en-US-GuyNeural",n)}});break;case"play":if(cn(t.data)){const[e,n]=t.data;n===""?mu.stopplay():mu.addplay(e,n)}break;case"voice":if(cn(t.data)){const[e,n,r]=t.data,i=mu.SOURCE[e];if(!Z(i)){Pn(oc.name(),t.target,`unknown voice ${e}`);return}switch(n){case"bpm":if(mt(r)){$T().bpm.value=r;return}break;case"vol":case"volume":if(mt(r)){i.source.volume.value=r;return}break;case"port":case"portamento":if(mt(r)){i.source.portamento=r;return}break;case"env":case"envelope":if(cn(r)){const[s,o,a,c]=r;i.source.set({envelope:{attack:s,decay:o,sustain:a,release:c}});return}break;default:if(Kt(n)){if(vne(n,r)){i.source.set({oscillator:{type:n}}),cn(r)&&i.source.set({oscillator:{partials:r}}),mt(r)&&i.source.set({oscillator:{partials:[r]}});return}const s=i.source.get().oscillator.type;switch(s){case"pwm":switch(n){case"modfreq":case"modulationfrequency":if(mt(r)){i.source.set({oscillator:{modulationFrequency:r}});return}break}break;case"pulse":switch(n){case"width":if(mt(r)){i.source.set({oscillator:{width:r}});return}break}break;case"custom":case"sine":case"square":case"triangle":case"sawtooth":switch(n){case"phase":if(mt(r)){i.source.set({oscillator:{phase:r}});return}break}break;case"amcustom":case"amsine":case"amsquare":case"amtriangle":case"amsawtooth":switch(n){case"harmonicity":if(mt(r)){i.source.set({oscillator:{harmonicity:r}});return}break;case"modtype":case"modulationtype":if(Kt(r)){i.source.set({oscillator:{modulationType:r}});return}break;case"modenv":case"modulationenvelope":if(cn(r)){const[o,a,c,l]=r;i.source.set({oscillator:{modulationEnvelope:{attack:o,decay:a,sustain:c,release:l}}});return}break}break;case"fmcustom":case"fmsine":case"fmsquare":case"fmtriangle":case"fmsawtooth":switch(n){case"harmonicity":if(mt(r)){i.source.set({oscillator:{harmonicity:r}});return}break;case"modindex":if(mt(r)){i.source.set({oscillator:{modulationIndex:r}});return}break;case"modtype":if(Kt(r)){i.source.set({oscillator:{modulationType:r}});return}break;case"modenv":if(cn(r)){const[o,a,c,l]=r;i.source.set({oscillator:{modulationEnvelope:{attack:o,decay:a,sustain:c,release:l}}});return}break}break;case"fatcustom":case"fatsine":case"fatsquare":case"fattriangle":case"fatsawtooth":switch(n){case"count":if(mt(r)){i.source.set({oscillator:{count:r}});return}break;case"phase":if(mt(r)){i.source.set({oscillator:{phase:r}});return}break;case"spread":if(mt(r)){i.source.set({oscillator:{spread:r}});return}break}break}Pn(oc.name(),t.target,`unknown ${s} config ${n}`)}break}}break;case"voicefx":if(cn(t.data)){const[e,n,r,i]=t.data,s=mu.SOURCE[e],o=s==null?void 0:s.fx[n];if(Z(o)){switch(r){case"on":o.wet.value=.2;break;case"off":o.wet.value=0;break;default:if(mt(r))o.wet.value=Cn(.01*r,0,1);else switch(n){case"vibrato":{switch(r){default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"chorus":{switch(r){default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"phaser":{const a=o;switch(r){case"q":mt(i)&&(a.Q.value=i);break;case"octaves":mt(i)&&(a.octaves=i);break;case"basefrequency":mt(i)&&(a.baseFrequency=i);break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"distortion":{const a=o;switch(r){case"distortion":mt(i)&&(a.distortion=i);break;case"oversample":switch(i){case"2x":case"4x":case"none":a.oversample=i;break}break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"echo":{const a=o;switch(r){case"delaytime":a.delayTime.value=i;break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}case"reverb":{const a=o;switch(r){case"decay":a.decay=i;break;case"predelay":a.preDelay=i;break;default:Pn(oc.name(),t.target,`unknown ${n} config ${r}`);break}break}}break}o instanceof Ay&&(o.wet.value===0?o.set({delayTime:ow}):o.get().delayTime===ow&&o.set({delayTime:hne}));return}Pn(oc.name(),t.target,`unknown fx ${n}`)}break}}),SN=t=>{let e;const n=new Set,r=(l,u)=>{const h=typeof l=="function"?l(e):l;if(!Object.is(h,e)){const p=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(m=>m(e,p))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=e=t(r,i,a);return a},qT=t=>t?SN(t):SN,Ene=t=>t;function XT(t,e=Ene){const n=Co.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return Co.useDebugValue(n),n}const EN=t=>{const e=qT(t),n=r=>XT(e,r);return Object.assign(n,e),n},bm=t=>t?EN(t):EN;function wne(t){const e=Ne.useRef();return n=>{const r=t(n);return(e.current===void 0||r===void 0?e.current===r:oL(e.current,r))?e.current:e.current=r}}const os=bm(()=>({desync:!1,gadget:{player:"",layers:[],panels:[],reset:!1,focus:""}}));function KT(){return os(t=>t.gadget.player)}function iv(){return os.getState().gadget.player}var d_=(t=>(t[t.OFF=0]="OFF",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t))(d_||{});const wN=128;var Pi=(t=>(t[t.TOP=0]="TOP",t[t.BOTTOM=1]="BOTTOM",t[t.FULL=2]="FULL",t[t.SPLIT_Y=3]="SPLIT_Y",t[t.SPLIT_Y_ALT=4]="SPLIT_Y_ALT",t[t.MAX=5]="MAX",t))(Pi||{});const ts=bm(()=>({layout:1,terminal:{open:!1,level:1,logs:[]},editor:{open:!1,player:"",book:"",page:"",type:"",title:""}})),br=bm(()=>({scroll:0,xcursor:0,ycursor:0,xselect:void 0,yselect:void 0,bufferindex:0,buffer:[""]})),hr=bm(()=>({id:"",xscroll:0,yscroll:0,cursor:0,select:void 0}));/** * postprocessing v6.36.4 build Tue Nov 05 2024 * https://github.com/pmndrs/postprocessing * Copyright 2015-2024 Raoul van Rüschen @@ -4899,6 +4899,6 @@ https://github.com/nodeca/pako/blob/main/LICENSE `,i,!1);const b=Ne.useCallback(R=>{const M=R.alt?10:1;Rl(p,Math.min(h,g+M))},[h,g,p]),N=Ne.useCallback(R=>{const M=R.alt?10:1;Rl(p,Math.max(u,g-M))},[u,g,p]);return ve.jsx(ve.Fragment,{children:e&&ve.jsx(gs,{MOVE_LEFT:N,MOVE_RIGHT:b})})}function Upe({chip:t,active:e,label:n,args:r,context:i}){const[s,...o]=[ao(r[0],""),...r.slice(1)],a=0,c=o.length-1,l=yd(t,s),u=yA(l),h=(u==null?void 0:u.value)??0,p=$a(),m=`${o[h]}`,g=n.trim(),v=Jl(e);Hn(` $dkred ? ${v}${g} `,i,!1);const y=e?p?"$26":"$27":"/";Hn(`${h+1}$green${y}${v}${c+1}`,i,!1),i.writefullwidth=32,Hn(` $green${m}`,i,!1),i.writefullwidth=void 0,Hn(` `,i,!1);const _=Ne.useCallback(E=>{const b=E.alt?10:1;Rl(l,Math.min(c,h+b))},[c,h,l]),S=Ne.useCallback(E=>{const b=E.alt?10:1;Rl(l,Math.max(a,h-b))},[a,h,l]);return ve.jsx(ve.Fragment,{children:e&&ve.jsx(gs,{MOVE_LEFT:S,MOVE_RIGHT:_})})}function Fpe({chip:t,active:e,label:n,args:r,context:i}){const s=ao(r[0],""),o=yd(t,s),a=DU(o),c=a==null?void 0:a.value,l=(c==null?void 0:c.toJSON())??"",u=$a(),[h,p]=Ne.useState(0),[m,g]=Ne.useState(!1),[v,y]=Ne.useState(void 0),_=`${l} `,S=n.trim(),E=Jl(e);Hn(`$green $20 ${E}${S} $green`,i,!1);const b=i.x,R=i.y*i.width;i.writefullwidth=32,Hn(`${_}`,i,!1),i.writefullwidth=void 0,Hn(` `,i,!1);const M=Z(v),O=i.width-b-2,C=M?Math.min(v,h):h;let I=M?Math.max(v,h):h;M&&(I!==C&&I===h&&--I,ix(b+C+R,b+I+R,15,8,i)),m&&u&&rx(b+h+R,"Û",i);function U(){Z(c)&&(p(C),y(void 0),c.delete(C,I-C+1))}return ve.jsxs(ve.Fragment,{children:[e&&ve.jsx(gs,{OK_BUTTON:()=>{c&&(g(!0),p(c.length),y(void 0))}}),m&&ve.jsx(Im,{blockhotkeys:!0,children:ve.jsx(gs,{MOVE_LEFT:L=>{L.shift?Z(v)||y(Cn(h-1,0,l.length)):y(void 0),p(P=>Cn(P-1,0,l.length))},MOVE_RIGHT:L=>{L.shift?Z(v)||y(h):y(void 0),p(P=>Cn(P+1,0,l.length))},CANCEL_BUTTON:()=>{g(!1),p(l.length),y(void 0)},OK_BUTTON:()=>g(!1),keydown:L=>{if(!c)return;const{key:P}=L,T=$t(P),H={alt:L.altKey,ctrl:td?L.metaKey:L.ctrlKey,shift:L.shiftKey},V=c.toJSON();switch(T){case"delete":M?U():V.length>0&&c.delete(h,1);break;case"backspace":M?U():h>0&&(c.delete(h-1,1),p(B=>Math.max(0,B-1)));break;default:if(H.ctrl)switch(T){case"a":y(0),p(V.length);break;case"c":Z(navigator.clipboard)&&navigator.clipboard.writeText(c.toJSON()).catch(B=>console.error(B));break;case"v":Z(navigator.clipboard)&&navigator.clipboard.readText().then(B=>{M&&U(),c.insert(h,B),p(h+B.length)}).catch(B=>console.error(B));break;case"x":Z(navigator.clipboard)&&navigator.clipboard.writeText(c.toJSON()).then(()=>U()).catch(B=>console.error(B));break}else H.alt||P.length===1&&V.lengthB+1));break}}})})]})}function Bpe({item:t,active:e}){const n=KT(),r=ja();if(r.iseven=r.y%2===0,typeof t=="string")return ve.jsx(Ipe,{player:n,item:t,context:r});if(cn(t)){const[i,s,o,...a]=t;if(typeof i!="string"||typeof s!="string"||typeof o!="string")return null;const c={player:n,chip:i,active:e,label:s,args:a,context:r};switch($t(o)){case"hk":case"hotkey":return ve.jsx(Ope,{...c});case"hyperlink":return ve.jsx(Lpe,{...c});case"rn":case"range":return ve.jsx(Dpe,{...c});case"sl":case"select":return ve.jsx(Upe,{...c});case"nm":case"number":return ve.jsx(Ppe,{...c});case"tx":case"text":return ve.jsx(Fpe,{...c})}nx(r)}return null}function uM({store:t,children:e}){return ve.jsx(cM.Provider,{value:t,children:e})}function hM({width:t,height:e}){const n=Ne.useContext(cM),[r,i,s]=XT(n,Yl(o=>[o.char,o.color,o.bg,o.render]));return t>0&&e>0&&ve.jsx(u3,{char:r.slice(),color:i.slice(),bg:s.slice(),width:t,height:e})}function QF({margin:t=1,selected:e=-1,width:n,height:r,color:i,bg:s,text:o}){const a=lM(n,r,0,i,s),c=a.getState(),l={...jm(n,r,i,s,0,t,n-t,r),...a.getState(),x:t};return Npe(c,0,i,s),c.changed(),ve.jsxs(uM,{store:a,children:[ve.jsx(Nu.Provider,{value:l,children:o.map((u,h)=>ve.jsx(Bpe,{item:u,active:h===e},h))}),ve.jsx(hM,{width:n,height:r})]})}var zpe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.01,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1/(2*Math.PI);return r/Math.atan(1/n)*Math.atan(Math.sin(2*Math.PI*e*i)/n)},Vpe=function(e){return 1/(1+e+.48*e*e+.235*e*e*e)};function Hpe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.25,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.01,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:1/0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Vpe,a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:.001,c="velocity_"+e;if(t.__damp===void 0&&(t.__damp={}),t.__damp[c]===void 0&&(t.__damp[c]=0),Math.abs(t[e]-n)<=a)return t[e]=n,!1;r=Math.max(1e-4,r);var l=2/r,u=o(l*i),h=t[e]-n,p=n,m=s*r;h=Math.min(Math.max(h,-m),m),n=t[e]-h;var g=(t.__damp[c]+l*h)*i;t.__damp[c]=(t.__damp[c]-l*g)*u;var v=n+(h+g)*u;return p-t[e]>0==v>p&&(v=p,t.__damp[c]=(v-p)/i),t[e]=v,!0}const Gpe=2,Wpe=14,eB=Wpe*Gpe;function jpe(t){return CW(t,eB*.5)}function $pe(t,e,n,r,i=1.235){function s(a){return zpe(a,r)}Hpe(t.userData,e,n,i,r,eB*12,s),t.position[e]=jpe(t.userData[e]);const o=n-t.position.y;return Math.abs(o)<.1}function VI({x:t,y:e,color:n,on:r=232,off:i=7,alt:s}){const o=$a(),a=kpe(),c=Ne.useRef(0),l=Z(s)?c.current%2===0?r:s:r;return Pr(a,a.width,a.height,t,e,{char:o?l:i,color:n}),a.changed(),o&&++c.current,null}function qpe({store:t,children:e}){return ve.jsx(YF.Provider,{value:t,children:e})}function Xpe({width:t,height:e}){const n=Ne.useContext(YF),[r]=XT(n,Yl(i=>[i.dither,i.render]));return t>0&&e>0&&ve.jsx(Vy,{alphas:r.slice(),width:t,height:e})}function Kpe({name:t,width:e,height:n,color:r,bg:i,text:s,shouldclose:o}){const{viewport:a}=va(),c=e-3,l=n-3,u=lM(e,n,0,r,i),h=Rpe(c,l,0),p=Ne.useContext(sx),m=u.getState();for(let T=1;T2&&T{o&&p.didclose()},[o,p]);Ne.useEffect(()=>{if(I.current&&!o){const T=a.height;I.current.position.y=T,I.current.userData.y=T,I.current.userData.vy=0}},[o]),Hv(Ne.useCallback((T,H)=>{if(Z(I.current)){const V=o?n*2*-Hi:0;$pe(I.current,"y",V,H)&&U()}},[o,U,n]));const L=Ne.useCallback(T=>{const H=T.alt?10:1;E(V=>Math.max(0,V-H))},[E]),P=Ne.useCallback(T=>{const H=T.alt?10:1;E(V=>Math.min(s.length,V+H))},[E,s.length]);return ve.jsx(uM,{store:u,children:ve.jsx(qpe,{store:h,children:ve.jsx("group",{ref:I,"position-y":1e6,children:ve.jsxs(Im,{children:[ve.jsx(gs,{MOVE_UP:L,MOVE_DOWN:P,CANCEL_BUTTON:p.sendclose}),ve.jsx(hM,{width:e,height:n}),ve.jsxs("group",{position:[2*as,2*Hi,0],children:[ve.jsx(Xpe,{width:c,height:l}),ve.jsx(QF,{name:t,width:c,height:l,margin:0,color:r,bg:wn.ONCLEAR,text:N,selected:R}),ve.jsx(VI,{x:1,y:1}),ve.jsx(VI,{x:1,y:2+R,on:26,alt:27,off:45,color:12})]})]})})})})}function HI({rect:t,shouldclose:e=!1}){switch(t.type){case 0:return ve.jsx(QF,{name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text});case 1:return ve.jsx(Kpe,{name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text,shouldclose:e});case 2:return ve.jsx(tle,{width:t.width,height:t.height})}return null}function Ype(){const t=va(g=>g.viewport),{width:e,height:n}=t.getCurrentViewport(),r=Math.floor(e/as),i=Math.floor(n/Hi),s=e-r*as,o=n-i*Hi,[a,c]=Ne.useState(),[l,u]=os(wne(g=>[g.gadget.player,g.gadget.panels]));if(r<1||i<1)return null;const h={name:"main",type:2,x:0,y:0,width:r,height:i,text:[]},p=[];let m=!0;return u.forEach(g=>{let v;switch(g.edge){case Si.LEFT:v={name:g.name,type:0,x:h.x,y:h.y,width:g.size,height:h.height,text:g.text},h.x+=g.size,h.width-=g.size,p.push(v);break;default:case Si.RIGHT:v={name:g.name,type:0,x:h.x+h.width-g.size,y:h.y,width:g.size,height:h.height,text:g.text},h.width-=g.size,p.push(v);break;case Si.TOP:v={name:g.name,type:0,x:h.x,y:h.y,width:h.width,height:g.size,text:g.text},h.y+=g.size,h.height-=g.size,p.push(v);break;case Si.BOTTOM:v={name:g.name,type:0,x:h.x,y:h.y+h.height-g.size,width:h.width,height:g.size,text:g.text},h.height-=g.size,p.push(v);break;case Si.SCROLL:v={name:g.name,type:1,x:0,y:0,width:Cn(g.size||50,24,h.width-2),height:Cn(18,8,h.height-8),text:g.text},v.x=h.x+Math.floor((h.width-v.width)*.5),v.y=h.y+Math.floor((h.height-v.height)*.5),m=!1,Bf(a,v)||c(Bi(v))}}),p.unshift(h),ve.jsx(sx.Provider,{value:{sendmessage(g,v){Yt.emit(g,"gadget",v,l)},sendclose(){g9("gadget",l)},didclose(){c(void 0)}},children:ve.jsxs("group",{position:[s*.5,o*.5,-512],children:[p.map(g=>ve.jsx("group",{position:[g.x*as,g.y*Hi,0],children:ve.jsx(HI,{rect:g})},g.name)),a&&ve.jsxs(Co.Fragment,{children:[ve.jsx("group",{position:[0,0,800],children:ve.jsx(Ace,{width:r,height:i,alpha:.14})}),ve.jsx("group",{position:[a.x*as,a.y*Hi,900],children:ve.jsx(HI,{rect:a,shouldclose:m})})]},a.name)]})})}const Zpe=250,Jpe=249,Kp=wn.BLUE,Qpe=wn.WHITE,Wl=wn.DKBLUE,eme=wn.DKGRAY,tB=wn.BLACK,kv=1,VS=as*kv,HS=Hi*kv,nB=Ne.createContext({sendmessage(){}});function Of(t,e,n,r,i){const s=qo(i);i.iseven=i.y%2===0,i.active.bg=e&&!t?tB:Wl,i.active.leftedge=s.left,i.active.rightedge=s.right,i.active.topedge=s.top,i.active.bottomedge=s.bottom,i.x=i.active.leftedge+n,i.y=i.active.topedge+r}function yf(t,e,n,r,i,s,o,a){const c=qo(i);i.iseven=i.y%2===0,i.active.bg=Wl,i.active.leftedge=c.left+s,i.active.rightedge=c.right-s,i.active.topedge=c.top+o,i.active.bottomedge=c.bottom-a,i.x=i.active.leftedge+n,i.y=i.active.topedge+r}function tme(t){let e=0;return t.split(/\r?\n/).map(r=>{const i=e,s=`${r} -`;return e+=s.length,{start:i,code:s,end:i+r.length}})}function nme(t){return t.reduce((e,n)=>{const r=n.code.length;return r>e?r:e},0)}function rme(t,e){for(let n=0;n{const e="nativeEvent"in t?t.nativeEvent:t;return{deltaX:e.deltaX||0,deltaY:e.deltaY||0,deltaZ:e.deltaZ||0,timeStamp:e.timeStamp}},ame=t=>[t.deltaX,t.deltaY,t.deltaZ],K0=t=>{const e=ame(t).map(Math.abs);return Math.max(...e)};var xl;(function(t){t.ALL_OTHER_CHECKS_FAILED="ALL_OTHER_CHECKS_FAILED",t.NO_PREVIOUS_EVENT_TO_COMPARE="NO_PREVIOUS_EVENT_TO_COMPARE",t.PAST_TIMESTAMP_EVENT="PAST_TIMESTAMP_EVENT",t.ENOUGH_TIME_PASSED="ENOUGH_TIME_PASSED",t.NON_DECREASING_DELTAS_OF_KNOWN_HUMAN="NON_DECREASING_DELTAS_OF_KNOWN_HUMAN",t.DELTA_MODULE_HAS_BEEN_INCREASING="DELTA_MODULE_HAS_BEEN_INCREASING"})(xl||(xl={}));class cme{constructor({sensitivity:e=2,delay:n=100,increasingDeltasThreshold:r=3}={}){vt(this,"sensitivity");vt(this,"delay");vt(this,"increasingDeltasThreshold");vt(this,"previousEvents");this.sensitivity=Math.max(1,e),this.delay=Math.max(1,n),this.increasingDeltasThreshold=Math.max(2,r),this.previousEvents=[]}check(e){var s;if(!(("nativeEvent"in e?e.nativeEvent:e)instanceof Event))throw new Error(`"${e}" is not a valid event`);const r=ome(e);if(K0(r)(((s=this.previousEvents.at(-1))==null?void 0:s.timeStamp)||0)&&this.previousEvents.push(r),i}isHuman(e){const n=this.previousEvents.at(-1);if(!n)return{isHuman:!0,reason:xl.NO_PREVIOUS_EVENT_TO_COMPARE};if(e.timeStampn.timeStamp+this.delay)return{isHuman:!0,reason:xl.ENOUGH_TIME_PASSED};const s=K0(e),o=K0(n);if(s>=o){if(this.previousEvents.length===1)return{isHuman:!0,reason:xl.NON_DECREASING_DELTAS_OF_KNOWN_HUMAN};if(this.increasingDeltasThreshold<=2||this.previousEvents.length>=this.increasingDeltasThreshold&&this.previousEvents.slice(-this.increasingDeltasThreshold).map(K0).every((u,h,p)=>h===0||u>p[h-1]))return{isHuman:!0,reason:xl.DELTA_MODULE_HAS_BEEN_INCREASING}}return{isHuman:!1,reason:xl.ALL_OTHER_CHECKS_FAILED}}}function GI(){}const lme=Co.forwardRef(function({args:e,children:n,...r},i){const s=Co.useRef(null);return Co.useImperativeHandle(i,()=>s.current),ve.jsxs("mesh",{ref:s,...r,children:[ve.jsx("planeGeometry",{attach:"geometry",args:e}),n]})}),ume=Co.forwardRef(function({blocking:e=!1,cursor:n="default",x:r=0,y:i=0,width:s=1,height:o=1,opacity:a=1,visible:c=!0,...l},u){const h=s*.5,p=o*.5,m=[(r+h)*as,(i+p)*Hi,0],g=Fy();return ve.jsx(lme,{ref:u,args:[s*as,o*Hi],userData:{blocking:e,cursor:n,clippingPlanes:g},onClick:e?GI:void 0,onPointerMove:e?GI:void 0,position:m,...l,children:ve.jsx("meshBasicMaterial",{color:"white",opacity:a,visible:c,transparent:a!==1,clippingPlanes:g})})}),hme=new cme({sensitivity:td?7:2}),WI=4,fme=.75;function dme(t){const e=Cn(t,-WI,WI);return Math.round(e*fme)}function iB({debug:t=!1,disabled:e=!1,blocking:n=!0,cursor:r="pointer",x:i=0,y:s=0,width:o=30,height:a=10,children:c,onScroll:l,...u}){return ve.jsxs("group",{...u,children:[ve.jsx(ume,{blocking:n,cursor:r,visible:t,x:i,y:s,width:o,height:a,onWheel:h=>{e||!hme.check(h)||l==null||l(dme(h.deltaY))}}),c]})}function pme({tapeycursor:t,logrowtotalheight:e}){const n=$a(),r=ja(),i=br(),s=KT(),o=qo(r),a=i.buffer[i.bufferindex];let c=i.xcursor,l=i.xcursor,u=!1;Z(i.xselect)&&Z(i.yselect)&&(u=!0,c=Math.min(i.xcursor,i.xselect),l=Math.max(i.xcursor,i.xselect),i.xcursor!==i.xselect&&--l);const h=l-c+1,p=i.ycursor===0,m=u?a.substring(c,l+1):a;function g(O,C,I){i.bufferindex>0&&br.setState({bufferindex:0}),i.buffer[0]=ime(a,O,C,I),br.setState({buffer:i.buffer,xselect:void 0,xcursor:O+(I??"").length})}function v(O){const C=i.buffer.length-1,I=Cn(O,0,C);br.setState({bufferindex:I,xcursor:i.buffer[I].length,ycursor:0,xselect:void 0,yselect:void 0})}function y(O){O?Z(i.xselect)||br.setState({xselect:i.xcursor,yselect:i.ycursor}):br.setState({xselect:void 0,yselect:void 0})}function _(){Z(i.xselect)&&(br.setState({xcursor:c,xselect:void 0,yselect:void 0}),g(c,h))}function S(){br.setState({xcursor:a.length,ycursor:0,xselect:void 0,yselect:void 0})}Of(!1,!1,0,0,r);const E="main:0.20.32 - if lost try #help";r.x=o.right-E.length,Hn(`$dkcyan${E}`,r,!0);const b="$196",R="$205".repeat(o.width-6);Of(!1,!1,0,o.height-2,r),Hn(` ${b}${R}${b} `,r,!0);const M=a.padEnd(o.width," ");if(Of(!1,!1,0,o.height-1,r),qF(M,r,!0),Z(i.xselect)&&Z(i.yselect)&&i.xcursor!==i.xselect){const O=Math.min(i.xcursor,i.xselect),C=Math.min(i.ycursor,i.yselect),I=Math.max(i.xcursor,i.xselect)-1,U=Math.max(i.ycursor,i.yselect);for(let L=C;L<=U;++L){const P=O+(o.bottom-L)*o.width,T=I+(o.bottom-L)*o.width;ix(P,T,15,8,r)}}if(n){const O=o.left+i.xcursor,C=o.top+t;rx(O+C*r.width,"Ý",r)}return Ne.useEffect(()=>{let O=i.scroll;t<4&&O++,t>o.bottom-4&&O--,br.setState({scroll:Math.round(Cn(O,0,e))})},[i.scroll,t,e,o.bottom]),r.changed(),ve.jsxs(ve.Fragment,{children:[ve.jsx(iB,{blocking:!0,x:o.left,y:o.top,width:o.width,height:o.height,onScroll:O=>{y(!1),br.setState({ycursor:Cn(Math.round(i.ycursor-O),0,e)})}}),ve.jsx(gs,{keydown:O=>{const{key:C}=O,I=$t(C),U=Gy(O);switch(I){case"arrowleft":y(U.shift),U.ctrl?br.setState({xcursor:0}):br.setState({xcursor:Cn(i.xcursor-(U.alt?10:1),0,o.right)});break;case"arrowright":y(U.shift),U.ctrl?br.setState({xcursor:p?a.length:o.right}):br.setState({xcursor:Cn(i.xcursor+(U.alt?10:1),0,o.right)});break;case"arrowup":U.ctrl?v(i.bufferindex+1):(y(U.shift),br.setState({ycursor:Cn(Math.round(i.ycursor+(U.alt?10:1)),0,e)}));break;case"arrowdown":U.ctrl?v(i.bufferindex-1):(y(U.shift),br.setState({ycursor:Cn(Math.round(i.ycursor-(U.alt?10:1)),0,e)}));break;case"enter":{const L=u?m:a;L.length&&(p?(br.setState({xcursor:0,bufferindex:0,xselect:void 0,yselect:void 0,buffer:["",L,...i.buffer.slice(1).filter(P=>P!==L)]}),Wv("tape",L,s)):S());break}case"esc":case"escape":Pb("tape");break;case"tab":pL("tape",!U.shift);break;case"delete":p?u?_():a.length>0&&g(i.xcursor,1):S();break;case"backspace":p?u?_():i.xcursor>0&&g(i.xcursor-1,1):S();break;default:if(U.ctrl)switch(I){case"a":br.setState({xselect:0,yselect:0,xcursor:a.length,ycursor:0});break;case"c":p&&Z(navigator.clipboard)?navigator.clipboard.writeText(m).catch(L=>console.error(L)):S();break;case"v":p&&Z(navigator.clipboard)?navigator.clipboard.readText().then(L=>{const P=L.replaceAll("\r","");u?g(c,h,P):g(i.xcursor,0,P)}).catch(L=>console.error(L)):S();break;case"x":p&&Z(navigator.clipboard)?navigator.clipboard.writeText(m).then(()=>_()).catch(L=>console.error(L)):S();break}else U.alt||C.length===1&&(p&&i.xcursor<=a.length?u?(g(c,h,C),br.setState({xselect:void 0})):g(i.xcursor,0,C):S());break}}})]})}function mme({blink:t,active:e,prefix:n,label:r,words:i,y:s}){const o=ja(),a=Ne.useCallback(()=>{if(Z(navigator.clipboard)){const[,...l]=i,u=l.join(" ");navigator.clipboard.writeText(u).then(()=>hn("copyit","copied!")).catch(h=>console.error(h))}},[i]),c=Jl(!!e);return Of(!!t,!!e,0,s,o),Hn(`${n} $purple$16 $yellowCOPYIT ${c}${r}`,o,!0),o.changed(),e&&ve.jsx(gs,{OK_BUTTON:a})}function gme({blink:t,active:e,prefix:n,label:r,words:i,y:s}){const o=ja(),a=Ne.useContext(nB),c=Ne.useCallback(()=>{const[u,h]=i;a.sendmessage(u,h)},[i,a]),l=Jl(!!e);return Of(!!t,!!e,0,s,o),Hn(`${n} $purple$16 ${l}${r}`,o,!0),o.changed(),e&&ve.jsx(gs,{OK_BUTTON:c})}function sB({blink:t,active:e,text:n,y:r}){const i=ja(),s=qo(i),o=n.startsWith("!");if(Of(!!t,!!e,0,r,i),i.active.bottomedge=s.bottom,Hn(o?"":n,i,!0),o){const[a,...c]=n.slice(1).split("!"),l=`${c.join("!")}`;let u="PRESS ME";const h=[];tx(l,!0).tokens.forEach(y=>{switch(y.tokenType){case sM:u=y.image.slice(1);break;default:h.push(y.image);break}});const[m,...g]=h,v={blink:t,active:e,prefix:a,label:u,words:g,y:r};switch($t(m)){case"hk":case"hotkey":return null;case"rn":case"range":return null;case"sl":case"select":return null;case"nm":case"number":return null;case"tx":case"text":return null;case"copyit":return ve.jsx(mme,{...v,words:h});default:case"hyperlink":return ve.jsx(gme,{...v,words:h})}}return null}function _me(t){const e=$a();return ve.jsx(sB,{active:!0,blink:e,...t})}function GS(){const t=KT(),[e,n]=ts(Yl(p=>[p.terminal.logs,p.editor.open])),r=ja(),i=br(),s=qo(r),o=e.map(p=>{const[,m,g,...v]=p;let y="$white";switch(m){case"debug":y="$yellow";break;case"error":y="$red";break}const _=v.map(b=>`${b}`).join(" "),S=_.startsWith("!"),E=`$blue[${y}${g}$blue]`;return`${S?"!":""}${E} ${_}`}),a=o.map(p=>{if(p.startsWith("!"))return 1;const m=aM(p,s.width,s.height);return(m==null?void 0:m.y)??1});let c=0,l=s.bottom-1;const u=a.map(p=>(l-=p,c+=p,l));++c;const h=s.bottom-i.ycursor+i.scroll;return ve.jsxs(ve.Fragment,{children:[ve.jsx(fM,{context:r}),ve.jsxs(nB.Provider,{value:{sendmessage(p,m){const[g,v]=sme(p);if(g==="self"){const y=`#${v} ${m??""}`;Wv("tape",y,t)}else Yt.emit(`${g}:${v}`,"gadget",m,t)}},children:[o.map((p,m)=>{const g=u[m]+i.scroll,v=a[m],y=g+v;return y<0||g>s.bottom-1?null:!n&&h>=g&&h[m.editor.type,m.editor.title])),o=$a(),a="$205".repeat(e.width-4);yf(!1,!1,0,1,t,0,0,0),Hn(`$179$${o?"7":"232"}$200${a}$181`,t,!0);const l=` ${`[${i}] `}${s} `,u=aM(l,e.width,e.height),h=(u==null?void 0:u.measuredwidth)??1,p=Math.round(e.width*.5)-Math.round(h*.5);return yf(!1,!1,p,0,t,0,0,0),Hn(l,t,!0),t.changed(),null}function yme({xcursor:t,ycursor:e,xoffset:n,yoffset:r,rows:i,codepage:s}){var P,T;const o=$a(),a=ja(),c=Ne.useRef(),l=hr(),u=qo(a),h=ts(H=>H.editor.player),p=rB(s),m=Z(p)?p.toJSON():"",g=i.length-1,v=t+1-n,y=e+2-r;if(Z(s)){const H=((P=c.current)==null?void 0:P.x)!==v||((T=c.current)==null?void 0:T.y)!==y;if(o||H){const V=u.left+v,B=u.top+y;B>u.top+1&&Bu.left&&V0&&(p==null||p.delete(H,V)),Z(B)&&(p==null||p.insert(H,B)),hr.setState({cursor:H+(B??"").length,select:void 0})}function I(){Z(l.select)&&(hr.setState({cursor:E}),C(E,R))}function U(){hr.setState({cursor:_,select:void 0})}const L=Ne.useCallback(function(V){const B=Math.round(e+V);if(B<0)hr.setState({cursor:0});else if(B>g)hr.setState({cursor:_});else{const z=i[B];hr.setState({cursor:z.start+Math.min(t,z.code.length-1)})}},[_,i,g,t,e]);return a.changed(),ve.jsxs(ve.Fragment,{children:[ve.jsx(iB,{blocking:!0,x:u.left,y:u.top,width:u.width,height:u.height,onScroll:H=>L(H*.75)}),ve.jsx(gs,{keydown:H=>{if(!Z(p))return;const{key:V}=H,B=$t(V),z=Gy(H);switch(B){case"arrowleft":if(O(z.shift),z.ctrl)hr.setState({cursor:S.start});else{const W=l.cursor-(z.alt?10:1);hr.setState({cursor:Cn(W,0,_)})}break;case"arrowright":if(O(z.shift),z.ctrl)hr.setState({cursor:S.end});else{const W=l.cursor+(z.alt?10:1);hr.setState({cursor:Cn(W,0,_)})}break;case"arrowup":O(z.shift),z.ctrl?hr.setState({cursor:0}):L(z.alt?-10:-1);break;case"arrowdown":O(z.shift),z.ctrl?hr.setState({cursor:_}):L(z.alt?10:1);break;case"enter":Z(p)&&(p.insert(l.cursor,` +`;return e+=s.length,{start:i,code:s,end:i+r.length}})}function nme(t){return t.reduce((e,n)=>{const r=n.code.length;return r>e?r:e},0)}function rme(t,e){for(let n=0;n{const e="nativeEvent"in t?t.nativeEvent:t;return{deltaX:e.deltaX||0,deltaY:e.deltaY||0,deltaZ:e.deltaZ||0,timeStamp:e.timeStamp}},ame=t=>[t.deltaX,t.deltaY,t.deltaZ],K0=t=>{const e=ame(t).map(Math.abs);return Math.max(...e)};var xl;(function(t){t.ALL_OTHER_CHECKS_FAILED="ALL_OTHER_CHECKS_FAILED",t.NO_PREVIOUS_EVENT_TO_COMPARE="NO_PREVIOUS_EVENT_TO_COMPARE",t.PAST_TIMESTAMP_EVENT="PAST_TIMESTAMP_EVENT",t.ENOUGH_TIME_PASSED="ENOUGH_TIME_PASSED",t.NON_DECREASING_DELTAS_OF_KNOWN_HUMAN="NON_DECREASING_DELTAS_OF_KNOWN_HUMAN",t.DELTA_MODULE_HAS_BEEN_INCREASING="DELTA_MODULE_HAS_BEEN_INCREASING"})(xl||(xl={}));class cme{constructor({sensitivity:e=2,delay:n=100,increasingDeltasThreshold:r=3}={}){vt(this,"sensitivity");vt(this,"delay");vt(this,"increasingDeltasThreshold");vt(this,"previousEvents");this.sensitivity=Math.max(1,e),this.delay=Math.max(1,n),this.increasingDeltasThreshold=Math.max(2,r),this.previousEvents=[]}check(e){var s;if(!(("nativeEvent"in e?e.nativeEvent:e)instanceof Event))throw new Error(`"${e}" is not a valid event`);const r=ome(e);if(K0(r)(((s=this.previousEvents.at(-1))==null?void 0:s.timeStamp)||0)&&this.previousEvents.push(r),i}isHuman(e){const n=this.previousEvents.at(-1);if(!n)return{isHuman:!0,reason:xl.NO_PREVIOUS_EVENT_TO_COMPARE};if(e.timeStampn.timeStamp+this.delay)return{isHuman:!0,reason:xl.ENOUGH_TIME_PASSED};const s=K0(e),o=K0(n);if(s>=o){if(this.previousEvents.length===1)return{isHuman:!0,reason:xl.NON_DECREASING_DELTAS_OF_KNOWN_HUMAN};if(this.increasingDeltasThreshold<=2||this.previousEvents.length>=this.increasingDeltasThreshold&&this.previousEvents.slice(-this.increasingDeltasThreshold).map(K0).every((u,h,p)=>h===0||u>p[h-1]))return{isHuman:!0,reason:xl.DELTA_MODULE_HAS_BEEN_INCREASING}}return{isHuman:!1,reason:xl.ALL_OTHER_CHECKS_FAILED}}}function GI(){}const lme=Co.forwardRef(function({args:e,children:n,...r},i){const s=Co.useRef(null);return Co.useImperativeHandle(i,()=>s.current),ve.jsxs("mesh",{ref:s,...r,children:[ve.jsx("planeGeometry",{attach:"geometry",args:e}),n]})}),ume=Co.forwardRef(function({blocking:e=!1,cursor:n="default",x:r=0,y:i=0,width:s=1,height:o=1,opacity:a=1,visible:c=!0,...l},u){const h=s*.5,p=o*.5,m=[(r+h)*as,(i+p)*Hi,0],g=Fy();return ve.jsx(lme,{ref:u,args:[s*as,o*Hi],userData:{blocking:e,cursor:n,clippingPlanes:g},onClick:e?GI:void 0,onPointerMove:e?GI:void 0,position:m,...l,children:ve.jsx("meshBasicMaterial",{color:"white",opacity:a,visible:c,transparent:a!==1,clippingPlanes:g})})}),hme=new cme({sensitivity:td?7:2}),WI=4,fme=.75;function dme(t){const e=Cn(t,-WI,WI);return Math.round(e*fme)}function iB({debug:t=!1,disabled:e=!1,blocking:n=!0,cursor:r="pointer",x:i=0,y:s=0,width:o=30,height:a=10,children:c,onScroll:l,...u}){return ve.jsxs("group",{...u,children:[ve.jsx(ume,{blocking:n,cursor:r,visible:t,x:i,y:s,width:o,height:a,onWheel:h=>{e||!hme.check(h)||l==null||l(dme(h.deltaY))}}),c]})}function pme({tapeycursor:t,logrowtotalheight:e}){const n=$a(),r=ja(),i=br(),s=KT(),o=qo(r),a=i.buffer[i.bufferindex];let c=i.xcursor,l=i.xcursor,u=!1;Z(i.xselect)&&Z(i.yselect)&&(u=!0,c=Math.min(i.xcursor,i.xselect),l=Math.max(i.xcursor,i.xselect),i.xcursor!==i.xselect&&--l);const h=l-c+1,p=i.ycursor===0,m=u?a.substring(c,l+1):a;function g(O,C,I){i.bufferindex>0&&br.setState({bufferindex:0}),i.buffer[0]=ime(a,O,C,I),br.setState({buffer:i.buffer,xselect:void 0,xcursor:O+(I??"").length})}function v(O){const C=i.buffer.length-1,I=Cn(O,0,C);br.setState({bufferindex:I,xcursor:i.buffer[I].length,ycursor:0,xselect:void 0,yselect:void 0})}function y(O){O?Z(i.xselect)||br.setState({xselect:i.xcursor,yselect:i.ycursor}):br.setState({xselect:void 0,yselect:void 0})}function _(){Z(i.xselect)&&(br.setState({xcursor:c,xselect:void 0,yselect:void 0}),g(c,h))}function S(){br.setState({xcursor:a.length,ycursor:0,xselect:void 0,yselect:void 0})}Of(!1,!1,0,0,r);const E="main:0.20.33 - if lost try #help";r.x=o.right-E.length,Hn(`$dkcyan${E}`,r,!0);const b="$196",R="$205".repeat(o.width-6);Of(!1,!1,0,o.height-2,r),Hn(` ${b}${R}${b} `,r,!0);const M=a.padEnd(o.width," ");if(Of(!1,!1,0,o.height-1,r),qF(M,r,!0),Z(i.xselect)&&Z(i.yselect)&&i.xcursor!==i.xselect){const O=Math.min(i.xcursor,i.xselect),C=Math.min(i.ycursor,i.yselect),I=Math.max(i.xcursor,i.xselect)-1,U=Math.max(i.ycursor,i.yselect);for(let L=C;L<=U;++L){const P=O+(o.bottom-L)*o.width,T=I+(o.bottom-L)*o.width;ix(P,T,15,8,r)}}if(n){const O=o.left+i.xcursor,C=o.top+t;rx(O+C*r.width,"Ý",r)}return Ne.useEffect(()=>{let O=i.scroll;t<4&&O++,t>o.bottom-4&&O--,br.setState({scroll:Math.round(Cn(O,0,e))})},[i.scroll,t,e,o.bottom]),r.changed(),ve.jsxs(ve.Fragment,{children:[ve.jsx(iB,{blocking:!0,x:o.left,y:o.top,width:o.width,height:o.height,onScroll:O=>{y(!1),br.setState({ycursor:Cn(Math.round(i.ycursor-O),0,e)})}}),ve.jsx(gs,{keydown:O=>{const{key:C}=O,I=$t(C),U=Gy(O);switch(I){case"arrowleft":y(U.shift),U.ctrl?br.setState({xcursor:0}):br.setState({xcursor:Cn(i.xcursor-(U.alt?10:1),0,o.right)});break;case"arrowright":y(U.shift),U.ctrl?br.setState({xcursor:p?a.length:o.right}):br.setState({xcursor:Cn(i.xcursor+(U.alt?10:1),0,o.right)});break;case"arrowup":U.ctrl?v(i.bufferindex+1):(y(U.shift),br.setState({ycursor:Cn(Math.round(i.ycursor+(U.alt?10:1)),0,e)}));break;case"arrowdown":U.ctrl?v(i.bufferindex-1):(y(U.shift),br.setState({ycursor:Cn(Math.round(i.ycursor-(U.alt?10:1)),0,e)}));break;case"enter":{const L=u?m:a;L.length&&(p?(br.setState({xcursor:0,bufferindex:0,xselect:void 0,yselect:void 0,buffer:["",L,...i.buffer.slice(1).filter(P=>P!==L)]}),Wv("tape",L,s)):S());break}case"esc":case"escape":Pb("tape");break;case"tab":pL("tape",!U.shift);break;case"delete":p?u?_():a.length>0&&g(i.xcursor,1):S();break;case"backspace":p?u?_():i.xcursor>0&&g(i.xcursor-1,1):S();break;default:if(U.ctrl)switch(I){case"a":br.setState({xselect:0,yselect:0,xcursor:a.length,ycursor:0});break;case"c":p&&Z(navigator.clipboard)?navigator.clipboard.writeText(m).catch(L=>console.error(L)):S();break;case"v":p&&Z(navigator.clipboard)?navigator.clipboard.readText().then(L=>{const P=L.replaceAll("\r","");u?g(c,h,P):g(i.xcursor,0,P)}).catch(L=>console.error(L)):S();break;case"x":p&&Z(navigator.clipboard)?navigator.clipboard.writeText(m).then(()=>_()).catch(L=>console.error(L)):S();break}else U.alt||C.length===1&&(p&&i.xcursor<=a.length?u?(g(c,h,C),br.setState({xselect:void 0})):g(i.xcursor,0,C):S());break}}})]})}function mme({blink:t,active:e,prefix:n,label:r,words:i,y:s}){const o=ja(),a=Ne.useCallback(()=>{if(Z(navigator.clipboard)){const[,...l]=i,u=l.join(" ");navigator.clipboard.writeText(u).then(()=>hn("copyit","copied!")).catch(h=>console.error(h))}},[i]),c=Jl(!!e);return Of(!!t,!!e,0,s,o),Hn(`${n} $purple$16 $yellowCOPYIT ${c}${r}`,o,!0),o.changed(),e&&ve.jsx(gs,{OK_BUTTON:a})}function gme({blink:t,active:e,prefix:n,label:r,words:i,y:s}){const o=ja(),a=Ne.useContext(nB),c=Ne.useCallback(()=>{const[u,h]=i;a.sendmessage(u,h)},[i,a]),l=Jl(!!e);return Of(!!t,!!e,0,s,o),Hn(`${n} $purple$16 ${l}${r}`,o,!0),o.changed(),e&&ve.jsx(gs,{OK_BUTTON:c})}function sB({blink:t,active:e,text:n,y:r}){const i=ja(),s=qo(i),o=n.startsWith("!");if(Of(!!t,!!e,0,r,i),i.active.bottomedge=s.bottom,Hn(o?"":n,i,!0),o){const[a,...c]=n.slice(1).split("!"),l=`${c.join("!")}`;let u="PRESS ME";const h=[];tx(l,!0).tokens.forEach(y=>{switch(y.tokenType){case sM:u=y.image.slice(1);break;default:h.push(y.image);break}});const[m,...g]=h,v={blink:t,active:e,prefix:a,label:u,words:g,y:r};switch($t(m)){case"hk":case"hotkey":return null;case"rn":case"range":return null;case"sl":case"select":return null;case"nm":case"number":return null;case"tx":case"text":return null;case"copyit":return ve.jsx(mme,{...v,words:h});default:case"hyperlink":return ve.jsx(gme,{...v,words:h})}}return null}function _me(t){const e=$a();return ve.jsx(sB,{active:!0,blink:e,...t})}function GS(){const t=KT(),[e,n]=ts(Yl(p=>[p.terminal.logs,p.editor.open])),r=ja(),i=br(),s=qo(r),o=e.map(p=>{const[,m,g,...v]=p;let y="$white";switch(m){case"debug":y="$yellow";break;case"error":y="$red";break}const _=v.map(b=>`${b}`).join(" "),S=_.startsWith("!"),E=`$blue[${y}${g}$blue]`;return`${S?"!":""}${E} ${_}`}),a=o.map(p=>{if(p.startsWith("!"))return 1;const m=aM(p,s.width,s.height);return(m==null?void 0:m.y)??1});let c=0,l=s.bottom-1;const u=a.map(p=>(l-=p,c+=p,l));++c;const h=s.bottom-i.ycursor+i.scroll;return ve.jsxs(ve.Fragment,{children:[ve.jsx(fM,{context:r}),ve.jsxs(nB.Provider,{value:{sendmessage(p,m){const[g,v]=sme(p);if(g==="self"){const y=`#${v} ${m??""}`;Wv("tape",y,t)}else Yt.emit(`${g}:${v}`,"gadget",m,t)}},children:[o.map((p,m)=>{const g=u[m]+i.scroll,v=a[m],y=g+v;return y<0||g>s.bottom-1?null:!n&&h>=g&&h[m.editor.type,m.editor.title])),o=$a(),a="$205".repeat(e.width-4);yf(!1,!1,0,1,t,0,0,0),Hn(`$179$${o?"7":"232"}$200${a}$181`,t,!0);const l=` ${`[${i}] `}${s} `,u=aM(l,e.width,e.height),h=(u==null?void 0:u.measuredwidth)??1,p=Math.round(e.width*.5)-Math.round(h*.5);return yf(!1,!1,p,0,t,0,0,0),Hn(l,t,!0),t.changed(),null}function yme({xcursor:t,ycursor:e,xoffset:n,yoffset:r,rows:i,codepage:s}){var P,T;const o=$a(),a=ja(),c=Ne.useRef(),l=hr(),u=qo(a),h=ts(H=>H.editor.player),p=rB(s),m=Z(p)?p.toJSON():"",g=i.length-1,v=t+1-n,y=e+2-r;if(Z(s)){const H=((P=c.current)==null?void 0:P.x)!==v||((T=c.current)==null?void 0:T.y)!==y;if(o||H){const V=u.left+v,B=u.top+y;B>u.top+1&&Bu.left&&V0&&(p==null||p.delete(H,V)),Z(B)&&(p==null||p.insert(H,B)),hr.setState({cursor:H+(B??"").length,select:void 0})}function I(){Z(l.select)&&(hr.setState({cursor:E}),C(E,R))}function U(){hr.setState({cursor:_,select:void 0})}const L=Ne.useCallback(function(V){const B=Math.round(e+V);if(B<0)hr.setState({cursor:0});else if(B>g)hr.setState({cursor:_});else{const z=i[B];hr.setState({cursor:z.start+Math.min(t,z.code.length-1)})}},[_,i,g,t,e]);return a.changed(),ve.jsxs(ve.Fragment,{children:[ve.jsx(iB,{blocking:!0,x:u.left,y:u.top,width:u.width,height:u.height,onScroll:H=>L(H*.75)}),ve.jsx(gs,{keydown:H=>{if(!Z(p))return;const{key:V}=H,B=$t(V),z=Gy(H);switch(B){case"arrowleft":if(O(z.shift),z.ctrl)hr.setState({cursor:S.start});else{const W=l.cursor-(z.alt?10:1);hr.setState({cursor:Cn(W,0,_)})}break;case"arrowright":if(O(z.shift),z.ctrl)hr.setState({cursor:S.end});else{const W=l.cursor+(z.alt?10:1);hr.setState({cursor:Cn(W,0,_)})}break;case"arrowup":O(z.shift),z.ctrl?hr.setState({cursor:0}):L(z.alt?-10:-1);break;case"arrowdown":O(z.shift),z.ctrl?hr.setState({cursor:_}):L(z.alt?10:1);break;case"enter":Z(p)&&(p.insert(l.cursor,` `),hr.setState({cursor:l.cursor+1}));break;case"esc":case"escape":z.shift||z.alt||z.ctrl?Pb("tape"):M9("editor");break;case"tab":pL("editor",!z.shift);break;case"delete":N?I():C(l.cursor,1);break;case"backspace":N?I():m.length>0&&C(Math.max(l.cursor-1,0),1);break;default:if(z.ctrl)switch(B){case"a":hr.setState({cursor:_,select:0});break;case"c":Z(navigator.clipboard)?navigator.clipboard.writeText(M).catch(W=>Pn("tape","clipboard",W)):U();break;case"v":Z(navigator.clipboard)?navigator.clipboard.readText().then(W=>{const K=W.replaceAll("\r","");N?C(E,R,K):C(l.cursor,0,K)}).catch(W=>Pn("tape","clipboard",W)):U();break;case"x":Z(navigator.clipboard)?navigator.clipboard.writeText(M).then(()=>I()).catch(W=>Pn("tape","clipboard",W)):U();break;case"p":Wv("editor",M,h),hn("editor",`running: ${M}`);break}else if(!z.alt){if(V.length===1)if(N)C(E,R,V);else{const W=l.cursor+V.length;p.insert(l.cursor,V),hr.setState({cursor:W})}}break}}})]})}function xme({ycursor:t,xoffset:e,yoffset:n,rows:r,codepage:i}){const s=$a(),o=ja(),a=hr(),c=qo(o);if(!Z(i)){const m=(s?"|":"-").repeat(3);return yf(!1,!1,0,0,o,1,2,1),Hn(` ${m} LOADING ${m}`,o,!0),null}let l=a.cursor,u=a.cursor,h=!1;Z(a.select)&&(h=!0,l=Math.min(a.cursor,a.select),u=Math.max(a.cursor,a.select),a.cursor!==a.select&&--u);const p=c.left+1;yf(!1,!1,-e,-n,o,1,2,1);for(let m=0;m=l){const _=Math.max(g.start,l)-g.start-e,S=Math.min(g.end,u)-g.start-e,E=c.width-3,b=1+o.y*o.width,N=Math.max(0,_),R=Math.min(E,S);N<=E&&R>=p&&ix(b+N,b+R,Qpe,eme,o)}if(++o.y,o.y>=c.bottom)break}return o.disablewrap=!1,null}function WS(){const[t]=ts(Yl(v=>[v.editor])),e=ja(),n=hr(),r=DU(mL(t.book,t.page)),i=qo(e);Ne.useEffect(()=>(L9("editor",t.book,t.page,t.player),()=>{P9("editor",t.book,t.page,t.player)}),[t.book,t.page,t.player]);const s=rB(r),o=Z(s)?s.toJSON():"",a=tme(o),c=rme(n.cursor,a),l=n.cursor-a[c].start,u=nme(a),h={rows:a,xcursor:l,ycursor:c,codepage:r,xoffset:n.xscroll,yoffset:n.yscroll},p=32,m=(Math.round(u/p)+1)*p,g=a.length;return Ne.useEffect(()=>{let v=n.xscroll;const y=l-v,_=i.width-3;let S=Math.round(Cn(Math.abs(y)*.5,1,p));S<8&&(S=1),y>_-8&&(v+=S),y<8&&(v-=S);let E=n.yscroll;const b=c-E,N=i.height-4,R=Math.round(N*.5);let M=Math.round(Cn(Math.abs(b)*.25,1,R));M<8&&(M=1),b>N-4&&(E+=M),b<4&&(E-=M),setTimeout(()=>hr.setState({xscroll:Math.round(Cn(v,0,m)),yscroll:Math.round(Cn(E,0,g))}),16)},[l,m,n.xscroll,c,g,n.yscroll,i.width,i.height]),ve.jsxs(ve.Fragment,{children:[ve.jsx(fM,{context:e}),ve.jsx(vme,{}),ve.jsx(xme,{...h}),ve.jsx(yme,{...h})]})}function jI(t,e,n,r,i){return{...i,x:t,y:e,reset:{...i.reset,topedge:e,leftedge:t,rightedge:n,bottomedge:r},active:{...i.reset,topedge:e,leftedge:t,rightedge:n,bottomedge:r}}}function Sme({context:t}){const[e,n]=ts(Yl(l=>[l.layout,l.editor.open])),r=t.width-1,i=t.height-1,s=qo(t),o=Math.floor(s.height*.5),a=Ne.useMemo(()=>jI(0,0,r,o-1,t),[o,r,t]),c=Ne.useMemo(()=>jI(0,o,r,i,t),[o,r,i,t]);if(n){let l,u;switch(e){case Pi.SPLIT_Y:case Pi.SPLIT_Y_ALT:l=a,u=c;break}if(Z(l)&&Z(u))switch(e){case Pi.SPLIT_Y:return ve.jsxs(ve.Fragment,{children:[ve.jsx(Nu.Provider,{value:l,children:ve.jsx(GS,{})}),ve.jsx(Nu.Provider,{value:u,children:ve.jsx(WS,{})})]});case Pi.SPLIT_Y_ALT:return ve.jsxs(ve.Fragment,{children:[ve.jsx(Nu.Provider,{value:l,children:ve.jsx(WS,{})}),ve.jsx(Nu.Provider,{value:u,children:ve.jsx(GS,{})})]})}}return ve.jsx(ve.Fragment,{children:ve.jsx(Nu.Provider,{value:t,children:n?ve.jsx(WS,{}):ve.jsx(GS,{})})})}function Eme(){const t=va(_=>_.viewport),{width:e,height:n}=t.getCurrentViewport(),r=Math.floor(e/as),i=Math.floor(n/Hi),s=Math.floor(e/VS),o=Math.floor(n/HS),a=e-s*VS,c=n-o*HS;let l=0;const u=0,h=s;let p=o;const[m,g]=ts(Yl(_=>[_.layout,_.terminal.open]));switch(m){case Pi.TOP:p=Math.round(o*.5);break;case Pi.BOTTOM:p=Math.round(o*.5),l=o-p;break;default:case Pi.FULL:break}const v=lM(h,p,0,Kp,Wl),y={...jm(h,p,Kp,Wl),...v.getState()};return h<1||p<1?null:ve.jsx(uM,{store:v,children:ve.jsxs("group",{position:[0,0,900],children:[g&&ve.jsx(Mce,{width:r,height:i,top:l,left:u,right:u+h-1,bottom:l+p-1}),ve.jsx("group",{position:[a*.5+u*VS,c+l*HS,1],scale:[kv,kv,1],children:g?ve.jsxs(Im,{blockhotkeys:!0,children:[ve.jsx(fM,{context:y}),ve.jsx(Sme,{context:y}),ve.jsx(hM,{width:h,height:p})]}):ve.jsx(xp,{hotkey:"Shift+?",children:()=>T9("tape")})})]})})}Rb({OrthographicCamera:Bv});Xae();function wme(){const t=va(p=>p.viewport),e=Ne.useRef(null),{width:n,height:r}=t.getCurrentViewport(),i=YT(Kre);i.minFilter=vr,i.magFilter=vr;const[s]=Ne.useState(()=>new Dre);Ne.useEffect(()=>{if(!Fre)return;document.body.appendChild(s.dom),s.showPanel(0),s.dom.style.cssText="position:fixed;bottom:0;left:0;";const p=dW(()=>s.begin()),m=pW(()=>s.end());return()=>{document.body.removeChild(s.dom),p(),m()}},[s]);const[o,a]=Ne.useState();Ne.useEffect(()=>{Lre({benchmarksURL:"/benchmarks-min"}).then(a).catch(p=>Pn("gpu","detect",p))},[]);const c=!zre&&o&&o.tier>2&&!o.isMobile,l=va(({set:p})=>p),u=va(({size:p})=>p),h=va(({camera:p})=>p);return Ne.useLayoutEffect(()=>{var p;(p=e.current)==null||p.updateProjectionMatrix()}),Ne.useLayoutEffect(()=>{const p=h;return l(()=>({camera:e.current})),()=>l(()=>({camera:p}))},[l,h,e]),ve.jsxs(ve.Fragment,{children:[ve.jsx("orthographicCamera",{ref:e,left:u.width/-2,right:u.width/2,top:u.height/2,bottom:u.height/-2,near:1,far:2e3,position:[0,0,1e3]}),ve.jsx("group",{"scale-x":-1,"rotation-z":Math.PI,children:ve.jsx("group",{position:[n*-.5,r*-.5,0],children:ve.jsxs(Im,{children:[ve.jsx(Ype,{}),ve.jsx(Eme,{})]})})}),c&&ve.jsx(Mre,{children:ve.jsx(Xre,{splat:i,viewheight:r})})]})}Rb({BufferGeometry:Bo,Group:rp,Mesh:Ao,MeshBasicMaterial:wb,OrthographicCamera:Bv,PlaneGeometry:em,Points:PG});document.addEventListener("keydown",()=>{gd()});window.addEventListener("touchstart",()=>{gd()});window.addEventListener("click",()=>{gd()});window.addEventListener("dragover",t=>{t.preventDefault()});window.addEventListener("contextmenu",t=>{gd(),t.preventDefault()});window.addEventListener("paste",t=>{var n;if(!((n=t.clipboardData)!=null&&n.files.length))return;gd(),t.preventDefault(),[...t.clipboardData.files].forEach(r=>HE("loadfile",r,iv()))});window.addEventListener("drop",t=>{var e,n;gd(),t.preventDefault(),(e=t.dataTransfer)!=null&&e.items?[...t.dataTransfer.items].forEach(i=>{if(i.kind==="file"){const s=i.getAsFile();Z(s)&&HE("loadfile",s,iv())}}):[...((n=t.dataTransfer)==null?void 0:n.files)??[]].forEach(i=>HE("loadfile",i,iv()))});function bme(){return ve.jsx(wme,{})}const $I=new xe,qI=new xe,XI=t=>({...EW(t),filter:e=>{const n=e.filter(o=>!(!o.object.visible||(o.object.userData.clippingPlanes??[]).some(c=>(c.projectPoint(o.point,$I),qI.subVectors(o.point,$I).normalize().round(),c.normal.equals(qI)===!1)))),r=n.findIndex(o=>o.object.userData.blocking),i=r===-1?n:n.slice(0,r+1);let s="default";return i.some(o=>o.object.userData.cursor?(s=o.object.userData.cursor,!0):!1),document.querySelectorAll("html, body").forEach(o=>{o.style.cursor=s}),i}}),KI=document.querySelector("canvas");if(Z(KI)){const t=yW(KI),e={dpr:1,flat:!0,linear:!0,shadows:!1,gl:{alpha:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!0}};t.configure({...e,events:XI,onCreated({gl:r}){r.localClippingEnabled=!0}});const n=bW((r,i)=>{t.configure({...e,events:XI,size:{width:r,height:i,top:0,left:0},onCreated({gl:s}){s.localClippingEnabled=!0}})},256);window.addEventListener("resize",()=>{n(c2(window.innerWidth),c2(window.innerHeight))}),t.render(ve.jsx(bme,{}))}});export default Tme(); diff --git a/index.html b/index.html index 32ee690b..44fa5e51 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - ZSS - main:0.20.32:a2a5194f4f0662a3a228e8b1ff3234d119559d62 + ZSS - main:0.20.33:ae41512604f4b0e7d959a110ae05f615eb3a102e @@ -36,7 +36,7 @@ }(window.location)) - +