@blibliki/engine 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/Engine.d.ts +10 -10
- package/dist/build/core/Module/PolyModule.d.ts +2 -0
- package/dist/build/modules/VoiceScheduler.d.ts +1 -0
- package/dist/build/modules/index.d.ts +1 -0
- package/dist/main.cjs.js +12 -12
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.esm.js +12 -12
- package/dist/main.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/Engine.ts +34 -23
- package/src/core/IO/AudioNode.ts +5 -1
- package/src/core/Module/PolyModule.ts +3 -1
- package/src/modules/index.ts +1 -0
package/dist/main.cjs.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}),n=(t,e,n)=>({endTime:e,insertTime:n,type:"linearRampToValue",value:t}),s=(t,e)=>({startTime:e,type:"setValue",value:t}),i=(t,e,n)=>({duration:n,startTime:e,type:"setValueCurve",values:t}),r=(t,e,{startTime:n,target:s,timeConstant:i})=>s+(e-s)*Math.exp((n-t)/i),o=t=>"exponentialRampToValue"===t.type,a=t=>"linearRampToValue"===t.type,u=t=>o(t)||a(t),c=t=>"setValue"===t.type,l=t=>"setValueCurve"===t.type,h=(t,e,n,s)=>{const i=t[e];return void 0===i?s:u(i)||c(i)?i.value:l(i)?i.values[i.values.length-1]:r(n,h(t,e-1,i.startTime,s),i)},p=(t,e,n,s,i)=>void 0===n?[s.insertTime,i]:u(n)?[n.endTime,n.value]:c(n)?[n.startTime,n.value]:l(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,h(t,e-1,n.startTime,i)],d=t=>"cancelAndHold"===t.type,f=t=>"cancelScheduledValues"===t.type,_=t=>d(t)||f(t)?t.cancelTime:o(t)||a(t)?t.endTime:t.startTime,m=(t,e,n,{endTime:s,value:i})=>n===i?i:0<n&&0<i||n<0&&i<0?n*(i/n)**((t-e)/(s-e)):0,g=(t,e,n,{endTime:s,value:i})=>n+(t-e)/(s-e)*(i-n),v=(t,{duration:e,startTime:n,values:s})=>((t,e)=>{const n=Math.floor(e),s=Math.ceil(e);return n===s?t[n]:(1-(e-n))*t[n]+(1-(s-e))*t[s]})(s,(t-n)/e*(s.length-1)),y=t=>"setTarget"===t.type;class w{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const r=_(t);if(d(t)||f(t)){const a=this._automationEvents.findIndex((e=>f(t)&&l(e)?e.startTime+e.duration>=r:_(e)>=r)),c=this._automationEvents[a];if(-1!==a&&(this._automationEvents=this._automationEvents.slice(0,a)),d(t)){const t=this._automationEvents[this._automationEvents.length-1];if(void 0!==c&&u(c)){if(void 0!==t&&y(t))throw new Error("The internal list is malformed.");const s=void 0===t?c.insertTime:l(t)?t.startTime+t.duration:_(t),i=void 0===t?this._defaultValue:l(t)?t.values[t.values.length-1]:t.value,a=o(c)?m(r,s,i,c):g(r,s,i,c),u=o(c)?e(a,r,this._currenTime):n(a,r,this._currenTime);this._automationEvents.push(u)}if(void 0!==t&&y(t)&&this._automationEvents.push(s(this.getValue(r),r)),void 0!==t&&l(t)&&t.startTime+t.duration>r){const e=r-t.startTime,n=(t.values.length-1)/t.duration,s=Math.max(2,1+Math.ceil(e*n)),o=e/(s-1)*n,a=t.values.slice(0,s);if(o<1)for(let e=1;e<s;e+=1){const n=o*e%1;a[e]=t.values[e-1]*(1-n)+t.values[e]*n}this._automationEvents[this._automationEvents.length-1]=i(a,t.startTime,e)}}}else{const s=this._automationEvents.findIndex((t=>_(t)>r)),i=-1===s?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[s-1];if(void 0!==i&&l(i)&&_(i)+i.duration>r)return!1;const u=o(t)?e(t.value,t.endTime,this._currenTime):a(t)?n(t.value,r,this._currenTime):t;if(-1===s)this._automationEvents.push(u);else{if(l(t)&&r+t.duration>_(this._automationEvents[s]))return!1;this._automationEvents.splice(s,0,u)}}return!0}flush(t){const e=this._automationEvents.findIndex((e=>_(e)>t));if(e>1){const t=this._automationEvents.slice(e-1),n=t[0];y(n)&&t.unshift(s(h(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=t}}getValue(t){if(0===this._automationEvents.length)return this._defaultValue;const e=this._automationEvents.findIndex((e=>_(e)>t)),n=this._automationEvents[e],s=(-1===e?this._automationEvents.length:e)-1,i=this._automationEvents[s];if(void 0!==i&&y(i)&&(void 0===n||!u(n)||n.insertTime>t))return r(t,h(this._automationEvents,s-1,i.startTime,this._defaultValue),i);if(void 0!==i&&c(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==i&&l(i)&&(void 0===n||!u(n)||i.startTime+i.duration>t))return t<i.startTime+i.duration?v(t,i):i.values[i.values.length-1];if(void 0!==i&&u(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==n&&o(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return m(t,e,r,n)}if(void 0!==n&&a(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return g(t,e,r,n)}return this._defaultValue}}const b=new WeakSet,x=new WeakMap,T=new WeakMap,A=new WeakMap,k=new WeakMap,C=new WeakMap,S=new WeakMap,O=new WeakMap,M=new WeakMap,E=new WeakMap,D={construct:()=>D},I=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,R=(t,e)=>{const n=[];let s=t.replace(/^[\s]+/,""),i=s.match(I);for(;null!==i;){const t=i[1].slice(1,-1),r=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(r),s=s.slice(i[0].length).replace(/^[\s]+/,""),i=s.match(I)}return[n.join(";"),s]},N=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},B=t=>{if(!(t=>{try{new new Proxy(t,D)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},P=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},V=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[s]=n;return t.delete(s),s},q=(t,e,n,s)=>{const i=P(t,e),r=V(i,(t=>t[0]===n&&t[1]===s));return 0===i.size&&t.delete(e),r},F=t=>P(S,t),j=t=>{if(b.has(t))throw new Error("The AudioNode is already stored.");b.add(t),F(t).forEach((t=>t(!0)))},z=t=>"port"in t,W=t=>{if(!b.has(t))throw new Error("The AudioNode is not stored.");b.delete(t),F(t).forEach((t=>t(!1)))},L=(t,e)=>{!z(t)&&e.every((t=>0===t.size))&&W(t)},U={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},H=(t,e)=>t.context===e,$=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},G=()=>new DOMException("","IndexSizeError"),X=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw G();throw t}})},Z={numberOfChannels:1},Y=-34028234663852886e22,Q=-Y,K=t=>b.has(t),J={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},tt=t=>P(x,t),et=t=>P(A,t),nt=(t,e)=>{const{activeInputs:n}=tt(t);n.forEach((n=>n.forEach((([n])=>{e.includes(t)||nt(n,[...e,t])}))));const s=(t=>"playbackRate"in t)(t)?[t.playbackRate]:z(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t)(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of s){const n=et(t);void 0!==n&&n.activeInputs.forEach((([t])=>nt(t,e)))}K(t)&&W(t)},st=t=>{nt(t.destination,[])},it=t=>"context"in t,rt=t=>it(t[0]),ot=(t,e,n,s)=>{for(const e of t)if(n(e)){if(s)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},at=(t,e,[n,s],i)=>{ot(t,[e,n,s],(t=>t[0]===e&&t[1]===n),i)},ut=(t,[e,n,s],i)=>{const r=t.get(e);void 0===r?t.set(e,new Set([[n,s]])):ot(r,[n,s],(t=>t[0]===n),i)},ct=t=>"inputs"in t,lt=(t,e,n,s)=>{if(ct(e)){const i=e.inputs[s];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,s),[e,n,s]},ht=(t,e,n)=>{for(const s of t)if(s[0]===e&&s[1]===n)return t.delete(s),s;return null},pt=(t,e)=>{if(!F(t).delete(e))throw new Error("Missing the expected event listener.")},dt=(t,e,n)=>{const s=P(t,e),i=V(s,(t=>t[0]===n));return 0===s.size&&t.delete(e),i},ft=(t,e,n,s)=>{ct(e)?t.disconnect(e.inputs[s],n,0):t.disconnect(e,n,s)},_t=t=>P(T,t),mt=t=>P(k,t),gt=t=>O.has(t),vt=t=>!b.has(t),yt=(t,e)=>new Promise((n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),s=t.createGain(),i=t.createBuffer(1,2,44100),r=i.getChannelData(0);r[0]=1,r[1]=1;const o=t.createBufferSource();o.buffer=i,o.loop=!0,o.connect(e).connect(t.destination),o.connect(s),o.disconnect(s),e.onaudioprocess=s=>{const i=s.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(t=>1===t))?n(!0):n(!1),o.stop(),e.onaudioprocess=null,o.disconnect(e),e.disconnect(t.destination)},o.start()}})),wt=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach(((t,n)=>e(n,t)))},bt=t=>"context"in t,xt=(t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=et(e),{outputs:o}=tt(t),a=F(t),u=o=>{const a=_t(t),u=mt(e);if(o){const e=dt(r,t,n);at(i,t,e,!1),s||gt(t)||a.connect(u,n)}else{const e=((t,e,n)=>V(t,(t=>t[0]===e&&t[1]===n)))(i,t,n);ut(r,e,!1),s||gt(t)||a.disconnect(u,n)}};return!!ot(o,[e,n],(t=>t[0]===e&&t[1]===n),!0)&&(a.add(u),K(t)?at(i,t,[n,u],!0):ut(r,[t,n,u],!0),!0)},Tt=(t,e,n,s,i)=>{const[r,o]=((t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=tt(e),o=ht(i[s],t,n);if(null===o)return[q(r,t,n,s)[2],!1];return[o[2],!0]})(t,n,s,i);if(null!==r&&(pt(t,r),!o||e||gt(t)||ft(_t(t),_t(n),s,i)),K(n)){const{activeInputs:t}=tt(n);L(n,t)}},At=(t,e,n,s)=>{const[i,r]=((t,e,n)=>{const{activeInputs:s,passiveInputs:i}=et(e),r=ht(s,t,n);if(null===r)return[dt(i,t,n)[1],!1];return[r[2],!0]})(t,n,s);null!==i&&(pt(t,i),!r||e||gt(t)||_t(t).disconnect(mt(n),s))};class kt{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach(((n,s)=>t.call(e,n,s,this)))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Ct={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function St(t,e,n,s,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],s,i);else{const r=t.getChannelData(s);if(0===e[n].byteLength)e[n]=r.slice(i,i+128);else{const t=new Float32Array(r.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ot=(t,e,n,s,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],s,i):0!==e[n].byteLength&&t.getChannelData(s).set(e[n],i)},Mt=(t,e)=>{const n=[];for(let s=0;s<t;s+=1){const t=[],i="number"==typeof e?e:e[s];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Et=async(t,e,n,s,i,r,o)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=s.channelCount*s.numberOfInputs,c=i.reduce(((t,e)=>t+e),0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===r)throw new Error("Missing the processor constructor.");const h=tt(t),p=await((t,e)=>{const n=P(E,t),s=_t(e);return P(n,s)})(n,t),d=Mt(s.numberOfInputs,s.channelCount),f=Mt(s.numberOfOutputs,i),_=Array.from(t.parameters.keys()).reduce(((t,e)=>({...t,[e]:new Float32Array(128)})),{});for(let c=0;c<a;c+=128){if(s.numberOfInputs>0&&null!==e)for(let t=0;t<s.numberOfInputs;t+=1)for(let n=0;n<s.channelCount;n+=1)St(e,d[t],n,n,c);void 0!==r.parameterDescriptors&&null!==e&&r.parameterDescriptors.forEach((({name:t},n)=>{St(e,_,t,u+n,c)}));for(let t=0;t<s.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=d.map(((t,e)=>0===h.activeInputs[e].size?[]:t)),e=o(c/n.sampleRate,n.sampleRate,(()=>p.process(t,f,_)));if(null!==l)for(let t=0,e=0;t<s.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ot(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},Dt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},It={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Rt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Nt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Bt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Pt=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise((s=>{const i=()=>{n.onmessage=null,e.close(),n.close(),s()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}}))},Vt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},qt=(t,e,n)=>{const s=e[n];if(void 0===s)throw t();return s},Ft={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},jt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},zt=()=>new DOMException("","InvalidStateError"),Wt=()=>new DOMException("","InvalidAccessError"),Lt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Ut=(t,e,n,s,i,r,o,a,u,c,l)=>{const h=c.length;let p=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const s=p-e&u-1;h+=n[e]*r[s],h-=t[e]*o[s]}for(let t=i;t<s;t+=1)h+=n[t]*r[p-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*o[p-n&u-1];r[p]=c[a],o[p]=h,p=p+1&u-1,l[a]=h}return p},Ht={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},$t=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},Gt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n]&&(t[n]=s)},Xt=(t,e)=>{Gt(t,e,"channelCount"),Gt(t,e,"channelCountMode"),Gt(t,e,"channelInterpretation")},Zt=t=>"function"==typeof t.getFloatTimeDomainData,Yt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n].value&&(t[n].value=s)},Qt=t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{if("number"==typeof i&&i<0||s<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,s,i)})},Kt=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},Jt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),te=async(t,e)=>{const n=await(t=>new Promise(((e,n)=>{const{port1:s,port2:i}=new MessageChannel;s.onmessage=({data:t})=>{s.close(),i.close(),e(t)},s.onmessageerror=({data:t})=>{s.close(),i.close(),n(t)},i.postMessage(t)})))(e);return new t(n)},ee=(t,e)=>{const n=t.createBiquadFilter();return Xt(n,e),Yt(n,e,"Q"),Yt(n,e,"detune"),Yt(n,e,"frequency"),Yt(n,e,"gain"),Gt(n,e,"type"),n},ne=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Xt(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw zt()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw zt()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw zt()}})})(n),n},se=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),ie=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Xt(n,e),Yt(n,e,"delayTime"),n},re=(t,e)=>{const n=t.createGain();return Xt(n,e),Yt(n,e,"gain"),n};function oe(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function ae(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)i=e,n=[(s=n)[0]*i[0]-s[1]*i[1],s[0]*i[1]+s[1]*i[0]],n[0]+=t[r];var s,i;return n}const ue=(t,e,n,s)=>t.createScriptProcessor(e,n,s),ce=()=>new DOMException("","NotSupportedError"),le={numberOfChannels:1},he={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},pe={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},de={disableNormalization:!1},fe={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},_e={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},me=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),ge=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},ve=(t,e,n,s)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:r,set:o}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(r),set:s(o)})},ye=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(s){if(9!==s.code)throw s;ye(t,e,n+1e-7)}},we=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},be=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},xe=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Te=(t,e)=>{const n=e.createGain();t.connect(n);const s=(e=>()=>{e.call(t,n),t.removeEventListener("ended",s)})(t.disconnect);t.addEventListener("ended",s),se(t,n),t.stop=(e=>{let s=!1;return(i=0)=>{if(s)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),s=!0}})(t.stop)},Ae=(t,e)=>n=>{const s={value:t};return Object.defineProperties(n,{currentTarget:s,target:s}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)},ke=(t=>(e,n,[s,i,r],o)=>{t(e[i],[n,s,r],(t=>t[0]===n&&t[1]===s),o)})(ot),Ce=(t=>(e,n,[s,i,r],o)=>{const a=e.get(s);void 0===a?e.set(s,new Set([[i,n,r]])):t(a,[i,n,r],(t=>t[0]===i&&t[1]===n),o)})(ot),Se=(t=>(e,n,s,i)=>t(e[i],(t=>t[0]===n&&t[1]===s)))(V),Oe=new WeakMap,Me=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Oe),Ee=(De=new Map,Ie=new WeakMap,(t,e)=>{const n=Ie.get(t);if(void 0!==n)return n;const s=De.get(t);if(void 0!==s)return s;try{const n=e();return n instanceof Promise?(De.set(t,n),n.catch((()=>!1)).then((e=>(De.delete(t),Ie.set(t,e),e)))):(Ie.set(t,n),n)}catch{return Ie.set(t,!1),!1}});var De,Ie;const Re="undefined"==typeof window?null:window,Ne=((t,e)=>(n,s)=>{const i=n.createAnalyser();if(Xt(i,s),!(s.maxDecibels>s.minDecibels))throw e();return Gt(i,s,"fftSize"),Gt(i,s,"maxDecibels"),Gt(i,s,"minDecibels"),Gt(i,s,"smoothingTimeConstant"),t(Zt,(()=>Zt(i)))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const s=Math.max(n.length,t.fftSize);for(let t=0;t<s;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Ee,G),Be=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(tt),Pe=((t,e,n)=>async(s,i,r)=>{const o=t(s);await Promise.all(o.activeInputs.map(((t,o)=>Array.from(t).map((async([t,a])=>{const u=e(t),c=await u.render(t,i),l=s.context.destination;n(t)||s===l&&n(s)||c.connect(r,a,o)})))).reduce(((t,e)=>[...t,...e]),[]))})(tt,Be,gt),Ve=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(Ne,_t,Pe),qe=(Fe=C,t=>{const e=Fe.get(t);if(void 0===e)throw zt();return e});var Fe;const je=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Re),ze=(t=>e=>null!==t&&e instanceof t)(je),We=new WeakMap,Le=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,s){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,s)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const s=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===s?null:s,n)}})(Ae),Ue=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Re),He=(t=>e=>null!==t&&e instanceof t)(Ue),$e=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Re),Ge=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Re),Xe=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Re),Ze=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>class extends c{constructor(e,s,i,r){super(i),this._context=e,this._nativeAudioNode=i;const o=l(e);h(o)&&!0!==n(yt,(()=>yt(o,_)))&&(t=>{const e=new Map;t.connect=(t=>(n,s=0,i=0)=>{const r=bt(n)?t(n,s,i):t(n,s),o=e.get(n);return void 0===o?e.set(n,[{input:i,output:s}]):o.every((t=>t.input!==i||t.output!==s))&&o.push({input:i,output:s}),r})(t.connect.bind(t)),t.disconnect=(n=>(s,i,r)=>{if(n.apply(t),void 0===s)e.clear();else if("number"==typeof s)for(const[t,n]of e){const i=n.filter((t=>t.output!==s));0===i.length?e.delete(t):e.set(t,i)}else if(e.has(s))if(void 0===i)e.delete(s);else{const t=e.get(s);if(void 0!==t){const n=t.filter((t=>t.output!==i&&(t.input!==r||void 0===r)));0===n.length?e.delete(s):e.set(s,n)}}for(const[n,s]of e)s.forEach((e=>{bt(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)}))})(t.disconnect)})(i),T.set(this,i),S.set(this,new Set),"closed"!==e.state&&s&&j(this),t(this,r,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(p(t)||d(t))throw r();if(it(t)){const i=_t(t);try{const e=lt(this._nativeAudioNode,i,n,a),s=vt(this);(h||s)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!s&&vt(t)&&j(t)}catch(t){if(12===t.code)throw r();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wt(e,s(h))}return t}const _=mt(t);if("playbackRate"===_.name&&1024===_.maxValue)throw o();try{this._nativeAudioNode.connect(_,n),(h||vt(this))&&this._nativeAudioNode.disconnect(_,n)}catch(t){if(12===t.code)throw r();throw t}if(xt(this,t,n,h)){const e=u([this],t);wt(e,s(h))}}disconnect(t,e,n){let s;const o=l(this._context),c=f(o);if(void 0===t)s=((t,e)=>{const n=tt(t),s=[];for(const i of n.outputs)rt(i)?Tt(t,e,...i):At(t,e,...i),s.push(i[0]);return n.outputs.clear(),s})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();s=((t,e,n)=>{const s=tt(t),i=[];for(const r of s.outputs)r[1]===n&&(rt(r)?Tt(t,e,...r):At(t,e,...r),i.push(r[0]),s.outputs.delete(r));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(it(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(s=((t,e,n,s,i)=>{const r=tt(t);return Array.from(r.outputs).filter((t=>!(t[0]!==n||void 0!==s&&t[1]!==s||void 0!==i&&t[2]!==i))).map((n=>(rt(n)?Tt(t,e,...n):At(t,e,...n),r.outputs.delete(n),n[0])))})(this,c,t,e,n),0===s.length)throw r()}for(const t of s){const e=u([this],t);wt(e,a)}}})((Ye=x,(t,e,n)=>{const s=[];for(let t=0;t<n.numberOfInputs;t+=1)s.push(new Set);Ye.set(t,{activeInputs:s,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{const d=new WeakMap;return(f,_,m,g,v)=>{const{activeInputs:y,passiveInputs:w}=r(_),{outputs:b}=r(f),x=a(f),T=r=>{const a=u(_),c=u(f);if(r){const e=q(w,f,m,g);t(y,f,e,!1),v||h(f)||n(c,a,m,g),p(_)&&j(_)}else{const t=s(y,f,m,g);e(w,g,t,!1),v||h(f)||i(c,a,m,g);const n=o(_);if(0===n)l(_)&&L(_,y);else{const t=d.get(_);void 0!==t&&clearTimeout(t),d.set(_,setTimeout((()=>{l(_)&&L(_,y)}),1e3*n))}}};return!!c(b,[_,m,g],(t=>t[0]===_&&t[1]===m&&t[2]===g),!0)&&(x.add(T),l(f)?t(y,f,[m,g,T],!0):e(w,g,[f,m,T],!0),!0)}})(ke,Ce,lt,Se,ft,tt,Me,F,_t,ot,K,gt,vt),Ee,((t,e,n,s,i,r)=>o=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!o&&r(a)){const t=s(a),{outputs:r}=n(a);for(const n of r)if(rt(n)){const i=s(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(O,ft,tt,_t,mt,K),G,Wt,ce,((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=r(u.context),p=a(h);if(l===c){if(e.delete(u),!p&&o(u)){const e=s(u),{outputs:r}=n(u);for(const n of r)if(rt(n)){const i=s(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(lt,O,tt,_t,mt,qe,K,ze),((t,e,n)=>function s(i,r){const o=it(r)?r:n(t,r);if((t=>"delayTime"in t)(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];const{outputs:a}=e(o);return Array.from(a).map((t=>s([...i,o],t[0]))).reduce(((t,e)=>t.concat(e)),[])})(We,tt,P),Le,qe,He,$e,Ge,ze,Xe);var Ye;const Qe=((t,e,n,s,i,r)=>class extends t{constructor(t,n){const o=i(t),a={...U,...n},u=s(o,a);super(t,!1,u,r(o)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Ze,Ve,G,Ne,qe,ze),Ke=new WeakSet,Je=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Re),tn=(en=new Uint32Array(1),t=>(en[0]=t,en[0]));var en;const nn=((t,e)=>n=>{n.copyFromChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)s[t]=c[t+o]},n.copyToChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)c[t+o]=s[t]}})(tn,G),sn=(t=>e=>{e.copyFromChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyFromChannel),e.copyToChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyToChannel)})(tn),rn=((t,e,n,s,i,r,o,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:p}={...Z,...c};null===u&&(u=new i(1,1,44100));const d=null!==s&&e(r,r)?new s({length:l,numberOfChannels:h,sampleRate:p}):u.createBuffer(h,l,p);if(0===d.numberOfChannels)throw n();return"function"!=typeof d.copyFromChannel?(o(d),X(d)):e($,(()=>$(d)))||a(d),t.add(d),d}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(Ke,Ee,ce,Je,je,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(Je),nn,sn),on=(t=>(e,n)=>{const s=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(s).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(s),s.disconnect()};n.addEventListener("ended",i)})(re),an=((t,e,n)=>async(s,i,r)=>{const o=e(s);await Promise.all(Array.from(o.activeInputs).map((async([e,s])=>{const o=t(e),a=await o.render(e,i);n(e)||a.connect(r,s)})))})(Be,et,gt),un=(t=>(e,n,s)=>t(n,e,s))(an),cn=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=h.createBufferSource();return Xt(d,p),Yt(d,p,"playbackRate"),Gt(d,p,"buffer"),Gt(d,p,"loop"),Gt(d,p,"loopEnd"),Gt(d,p,"loopStart"),e(n,(()=>n(h)))||(t=>{t.start=(e=>{let n=!1;return(s=0,i=0,r)=>{if(n)throw zt();e.call(t,s,i,r),n=!0}})(t.start)})(d),e(s,(()=>s(h)))||u(d),e(i,(()=>i(h)))||c(d,h),e(r,(()=>r(h)))||Qt(d),e(o,(()=>o(h)))||l(d,h),e(a,(()=>a(h)))||Kt(d),t(h,d),d})(on,Ee,(t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1}),(t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0}),(t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0}),we,be,xe,(t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{const r=t.buffer,o=null===r?s:Math.min(r.duration,s);null!==r&&o>r.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,o,i)})}),(t=>(e,n)=>{const s=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=s),t(e,"buffer",(t=>()=>{const n=t.call(e);return n===s?null:n}),(t=>n=>t.call(e,null===n?s:n)))})(ve),Te),ln=((t,e)=>(n,s,i)=>(t(s).replay(i),e(s,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(et),an),hn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==o&&l.start(...o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await s(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(un,cn,_t,ln,Pe),pn=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m=null,g=null)=>{const v=_.value,y=new w(v),b=f?s(y):null,x={get defaultValue(){return v},get maxValue(){return null===m?_.maxValue:m},get minValue(){return null===g?_.minValue:g},get value(){return _.value},set value(t){_.value=t,x.setValueAtTime(t,d.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof _.cancelAndHoldAtTime)null===b&&y.flush(d.context.currentTime),y.add(i(t)),_.cancelAndHoldAtTime(t);else{const e=Array.from(y).pop();null===b&&y.flush(d.context.currentTime),y.add(i(t));const n=Array.from(y).pop();_.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?_.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?_.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?_.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&_.setValueCurveAtTime(n.values,n.startTime,n.duration))}return x},cancelScheduledValues:t=>(null===b&&y.flush(d.context.currentTime),y.add(r(t)),_.cancelScheduledValues(t),x),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=d.context.currentTime;return null===b&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(o(t,e)),_.exponentialRampToValueAtTime(t,e),x},linearRampToValueAtTime(t,e){const n=d.context.currentTime;return null===b&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(a(t,e)),_.linearRampToValueAtTime(t,e),x},setTargetAtTime:(t,e,n)=>(null===b&&y.flush(d.context.currentTime),y.add(u(t,e,n)),_.setTargetAtTime(t,e,n),x),setValueAtTime:(t,e)=>(null===b&&y.flush(d.context.currentTime),y.add(c(t,e)),_.setValueAtTime(t,e),x),setValueCurveAtTime(t,e,n){const s=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=d.context.sampleRate,r=Math.ceil(e*i),o=Math.floor(t*i),a=o-r,u=new Float32Array(a);for(let t=0;t<a;t+=1){const o=(s.length-1)/n*((r+t)/i-e),a=Math.floor(o),c=Math.ceil(o);u[t]=a===c?s[a]:(1-(o-a))*s[a]+(1-(c-o))*s[c]}null===b&&y.flush(d.context.currentTime),y.add(l(u,e,n)),_.setValueCurveAtTime(u,e,n);const c=o/i;c<t&&p(x,u[u.length-1],c),p(x,s[s.length-1],t)}else null===b&&y.flush(d.context.currentTime),y.add(l(s,e,n)),_.setValueCurveAtTime(s,e,n);return x}};return n.set(x,_),e.set(x,d),t(x,b),x})((dn=A,(t,e)=>{dn.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),We,k,(t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:s}=n;e.exponentialRampToValueAtTime(s,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:s}=n;e.linearRampToValueAtTime(s,t)}else if("setTarget"===n.type){const{startTime:t,target:s,timeConstant:i}=n;e.setTargetAtTime(s,t,i)}else if("setValue"===n.type){const{startTime:t,value:s}=n;e.setValueAtTime(s,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:s,values:i}=n;e.setValueCurveAtTime(i,s,t)}}}})),(t=>({cancelTime:t,type:"cancelAndHold"})),(t=>({cancelTime:t,type:"cancelScheduledValues"})),((t,e)=>({endTime:e,type:"exponentialRampToValue",value:t})),((t,e)=>({endTime:e,type:"linearRampToValue",value:t})),((t,e,n)=>({startTime:e,target:t,timeConstant:n,type:"setTarget"})),s,i,Ue,ye);var dn;const fn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const a=r(t),u={...J,...s},c=i(a,u),l=o(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Q,Y)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){j(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ze,hn,pn,zt,cn,qe,ze,Ae),_n=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,n){const s=r(t),u=o(s),c=i(s,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Ze,(t=>{const e=new WeakMap;return{render(n,s){const i=e.get(s);return void 0!==i?Promise.resolve(i):(async(n,s)=>{const i=s.destination;return e.set(s,i),await t(n,s,i),i})(n,s)}}}),G,zt,((t,e)=>(n,s,i)=>{const r=n.destination;if(r.channelCount!==s)try{r.channelCount=s}catch{}i&&"explicit"!==r.channelCountMode&&(r.channelCountMode="explicit"),0===r.maxChannelCount&&Object.defineProperty(r,"maxChannelCount",{value:s});const o=t(n,{channelCount:s,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,gain:1});return e(o,"channelCount",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e);try{r.channelCount=e}catch(t){if(e>r.maxChannelCount)throw t}})),e(o,"channelCountMode",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelCountMode=e})),e(o,"channelInterpretation",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelInterpretation=e})),Object.defineProperty(o,"maxChannelCount",{get:()=>r.maxChannelCount}),o.connect(r),o})(re,ve),qe,ze,Pe),mn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return r.set(a,u),c?(await t(a,o.Q,u.Q),await t(a,o.detune,u.detune),await t(a,o.frequency,u.frequency),await t(a,o.gain,u.gain)):(await s(a,o.Q,u.Q),await s(a,o.detune,u.detune),await s(a,o.frequency,u.frequency),await s(a,o.gain,u.gain)),await i(o,a,u),u})(o,a)}}})(un,ee,_t,ln,Pe),gn=(t=>(e,n)=>t.set(e,n))(Oe),vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const u=r(t),c={...Dt,...s},l=i(u,c),h=o(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Q,Y),this._detune=e(this,h,l.detune,1200*Math.log2(Q),-1200*Math.log2(Q)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Q),Y),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw s();throw t}if(t.length!==e.length||e.length!==n.length)throw s()}})(Ze,pn,mn,Wt,ee,qe,ze,gn),yn=((t,e)=>(n,s,i)=>{const r=new Set;return n.connect=(i=>(o,a=0,u=0)=>{const c=0===r.size;if(e(o))return i.call(n,o,a,u),t(r,[o,a,u],(t=>t[0]===o&&t[1]===a&&t[2]===u),!0),c&&s(),o;i.call(n,o,a),t(r,[o,a],(t=>t[0]===o&&t[1]===a),!0),c&&s()})(n.connect),n.disconnect=(t=>(s,o,a)=>{const u=r.size>0;if(void 0===s)t.apply(n),r.clear();else if("number"==typeof s){t.call(n,s);for(const t of r)t[1]===s&&r.delete(t)}else{e(s)?t.call(n,s,o,a):t.call(n,s,o);for(const t of r)t[0]!==s||void 0!==o&&t[1]!==o||void 0!==a&&t[2]!==a||r.delete(t)}const c=0===r.size;u&&c&&i()})(n.disconnect),n})(ot,$e),wn=((t,e)=>(n,s)=>{s.channelCount=1,s.channelCountMode="explicit",Object.defineProperty(s,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(s,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(s,(()=>{const t=s.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(s,0,e)}),(()=>i.disconnect(s)))})(zt,yn),bn=((t,e)=>(n,s)=>{const i=n.createChannelMerger(s.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Xt(i,s),i})(Ue,wn),xn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(bn,_t,Pe),Tn=((t,e,n,s,i)=>class extends t{constructor(t,r){const o=s(t),a={...It,...r};super(t,!1,n(o,a),i(o)?e():null)}})(Ze,xn,bn,qe,ze),An=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(ne,_t,Pe),kn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=r({...Rt,...o});super(t,!1,n(a,u),i(a)?e():null)}})(Ze,An,ne,qe,ze,(t=>({...t,channelCount:t.numberOfOutputs}))),Cn=((t,e,n,s)=>(i,{offset:r,...o})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...o,gain:r}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),s(se(h,c),(()=>u.connect(c)),(()=>u.disconnect(c)))})(on,cn,re,yn),Sn=((t,e,n,s,i)=>(r,o)=>{if(void 0===r.createConstantSource)return n(r,o);const a=r.createConstantSource();return Xt(a,o),Yt(a,o,"offset"),e(s,(()=>s(r)))||Qt(a),e(i,(()=>i(r)))||Kt(a),t(r,a),a})(on,Ee,Cn,we,xe),On=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==o&&l.start(o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.offset,l.offset):await s(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(un,Sn,_t,ln,Pe),Mn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...Nt,...o},c=s(a,u),l=r(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Q,Y),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Ze,pn,On,Sn,qe,ze,Ae),En=((t,e)=>(n,s)=>{const i=n.createConvolver();if(Xt(i,s),s.disableNormalization===i.normalize&&(i.normalize=!s.disableNormalization),Gt(i,s,"buffer"),s.channelCount>2)throw t();if(e(i,"channelCount",(t=>()=>t.call(i)),(e=>n=>{if(n>2)throw t();return e.call(i,n)})),"max"===s.channelCountMode)throw t();return e(i,"channelCountMode",(t=>()=>t.call(i)),(e=>n=>{if("max"===n)throw t();return e.call(i,n)})),i})(ce,ve),Dn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(En,_t,Pe),In=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u={...Bt,...o},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&r(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,r(this,0)}else this._isBufferNullified=!1,r(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(Ze,Dn,En,qe,ze,gn),Rn=((t,e,n,s,i)=>r=>{const o=new WeakMap;return{render(a,u){const c=o.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=H(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:r};c=e(u,t)}return o.set(u,c),l?await t(u,a.delayTime,c.delayTime):await s(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(un,ie,_t,ln,Pe),Nn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...Vt,...a},l=s(u,c),h=r(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),o(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Ze,pn,Rn,ie,qe,ze,gn),Bn=(t=>(e,n)=>{const s=e.createDynamicsCompressor();if(Xt(s,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Yt(s,n,"attack"),Yt(s,n,"knee"),Yt(s,n,"ratio"),Yt(s,n,"release"),Yt(s,n,"threshold"),s})(ce),Pn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return r.set(a,u),c?(await t(a,o.attack,u.attack),await t(a,o.knee,u.knee),await t(a,o.ratio,u.ratio),await t(a,o.release,u.release),await t(a,o.threshold,u.threshold)):(await s(a,o.attack,u.attack),await s(a,o.knee,u.knee),await s(a,o.ratio,u.ratio),await s(a,o.release,u.release),await s(a,o.threshold,u.threshold)),await i(o,a,u),u})(o,a)}}})(un,Bn,_t,ln,Pe),Vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,i){const u=r(t),c={...Ft,...i},l=s(u,c),h=o(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Ze,pn,Pn,Bn,ce,qe,ze,gn),qn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.gain,u.gain):await s(a,o.gain,u.gain),await i(o,a,u),u})(o,a)}}})(un,re,_t,ln,Pe),Fn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...jt,...o},c=s(a,u),l=r(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Q,Y)}get gain(){return this._gain}})(Ze,pn,qn,re,qe,ze),jn=((t,e,n,s)=>(i,r,{channelCount:o,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Jt(r,i.sampleRate),p=c instanceof Float64Array?c:new Float64Array(c),d=l instanceof Float64Array?l:new Float64Array(l),f=p.length,_=d.length,m=Math.min(f,_);if(0===f||f>20)throw s();if(0===p[0])throw e();if(0===_||_>20)throw s();if(0===d[0])throw e();if(1!==p[0]){for(let t=0;t<_;t+=1)d[t]/=p[0];for(let t=1;t<f;t+=1)p[t]/=p[0]}const g=n(i,h,o,o);g.channelCount=o,g.channelCountMode=a,g.channelInterpretation=u;const v=[],y=[],w=[];for(let t=0;t<o;t+=1){v.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),y.push(t),w.push(e)}g.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,s=e.numberOfChannels;for(let t=0;t<s;t+=1){const s=e.getChannelData(t),i=n.getChannelData(t);v[t]=Ut(p,f,d,_,m,y[t],w[t],v[t],32,s,i)}};const b=i.sampleRate/2,x={get bufferSize(){return h},get channelCount(){return g.channelCount},set channelCount(t){g.channelCount=t},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){g.channelCountMode=t},get channelInterpretation(){return g.channelInterpretation},set channelInterpretation(t){g.channelInterpretation=t},get context(){return g.context},get inputs(){return[g]},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},addEventListener:(...t)=>g.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>g.dispatchEvent(t[0]),getFrequencyResponse(e,n,s){if(e.length!==n.length||n.length!==s.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/b),r=[Math.cos(i),Math.sin(i)],o=oe(ae(d,r),ae(p,r));n[t]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),s[t]=Math.atan2(o[1],o[0])}},removeEventListener:(...t)=>g.removeEventListener(t[0],t[1],t[2])};return se(x,g)})(Wt,zt,ue,ce),zn=((t,e,n,s)=>i=>t($t,(()=>$t(i)))?Promise.resolve(t(s,s)).then((t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()})):new Promise((t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(Ee,re,ue,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),s=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((t=>{n.oncomplete=()=>{s.disconnect(),t(0!==n.currentTime)},n.startRendering()}))})(re,je)),Wn=((t,e,n,s,i)=>(r,o)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,p=e(c);const d=H(p,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):d||(p=l.createIIRFilter(o,r)),a.set(l,null===h?p:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await s(c,t,t.destination);return((t,e,n,s)=>{const i=n instanceof Float64Array?n:new Float64Array(n),r=s instanceof Float64Array?s:new Float64Array(s),o=i.length,a=r.length,u=Math.min(o,a);if(1!==i[0]){for(let t=0;t<o;t+=1)r[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),p=t.numberOfChannels;for(let e=0;e<p;e+=1){const n=t.getChannelData(e),s=h.getChannelData(e);c.fill(0),l.fill(0),Ut(i,o,r,a,u,c,l,0,32,n,s)}return h})(await i(t),l,r,o)})()}const t=await u;return h.buffer=t,h.start(0),h}return await s(c,l,p),p};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(cn,_t,je,Pe,zn),Ln=(t=>(e,n,s)=>{if(void 0===e.createIIRFilter)return t(e,n,s);const i=e.createIIRFilter(s.feedforward,s.feedback);return Xt(i,s),i})(jn),Un=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=i(a),c={...Lt,...o},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,s,i)=>{if(n.length!==s.length||s.length!==i.length)throw Wt();return e.call(t,n,s,i)})})(l),this._nativeIIRFilterNode=l,r(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(Ze,Ln,Wn,qe,ze,gn),Hn=((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:p,forwardZ:d,positionX:f,positionY:_,positionZ:m,upX:g,upY:v,upZ:y}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),p=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),d=o(c);let f=!1,_=[0,0,-1,0,1,0],m=[0,0,0];const g=()=>{if(f)return;f=!0;const t=s(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[r(t,h,0),r(t,h,1),r(t,h,2),r(t,h,3),r(t,h,4),r(t,h,5)];e.some(((t,e)=>t!==_[e]))&&(l.setOrientation(...e),_=e);const n=[r(t,h,6),r(t,h,7),r(t,h,8)];n.some(((t,e)=>t!==m[e]))&&(l.setPosition(...n),m=n)},p.connect(t)},v=t=>e=>{e!==_[t]&&(_[t]=e,l.setOrientation(..._))},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setPosition(...m))},w=(e,s,r)=>{const o=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:s});o.connect(p,0,e),o.start(),Object.defineProperty(o.offset,"defaultValue",{get:()=>s});const l=t({context:u},d,o.offset,Q,Y);var h,f,_,m,v,y,w;return a(l,"value",(t=>()=>t.call(l)),(t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}g(),d&&r(e)})),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,d?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return g(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,d?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return g(),e}),l.exponentialRampToValueAtTime=(_=l.exponentialRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=_.apply(l,t);return g(),e}),l.linearRampToValueAtTime=(m=l.linearRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return g(),e}),l.setTargetAtTime=(v=l.setTargetAtTime,d?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return g(),e}),l.setValueAtTime=(y=l.setValueAtTime,d?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return g(),e}),l.setValueCurveAtTime=(w=l.setValueCurveAtTime,d?()=>{throw i()}:(...t)=>{const e=w.apply(l,t);return g(),e}),l};return{forwardX:w(0,0,v(0)),forwardY:w(1,0,v(1)),forwardZ:w(2,-1,v(2)),positionX:w(6,0,y(0)),positionY:w(7,0,y(1)),positionZ:w(8,0,y(2)),upX:w(3,0,v(3)),upY:w(4,1,v(4)),upZ:w(5,0,v(5))}})():l;return{get forwardX(){return h},get forwardY(){return p},get forwardZ(){return d},get positionX(){return f},get positionY(){return _},get positionZ(){return m},get upX(){return g},get upY(){return v},get upZ(){return y}}})(pn,bn,Sn,ue,ce,me,ze,ve),$n=new WeakMap,Gn=((t,e,n,s,i,r)=>class extends n{constructor(n,r){super(n),this._nativeContext=n,C.set(this,n),s(n)&&i.set(n,new Set),this._destination=new t(this,r),this._listener=e(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(t){const e="function"==typeof t?r(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(_n,Hn,Le,ze,$n,Ae),Xn=((t,e,n,s,i,r)=>(o,a)=>{const u=o.createOscillator();return Xt(u,a),Yt(u,a,"detune"),Yt(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Gt(u,a,"type"),e(n,(()=>n(o)))||Qt(u),e(s,(()=>s(o)))||r(u,o),e(i,(()=>i(o)))||Kt(u),t(o,u),u})(on,Ee,we,be,xe,Te),Zn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null,u=null;return{set periodicWave(t){o=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=r.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const p=H(h,l);if(!p){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===o?void 0:o,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return r.set(l,h),p?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await s(l,c.detune,h.detune),await s(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(un,Xn,_t,ln,Pe),Yn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...he,...o},c=n(a,u),l=r(a),h=l?s():null,p=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,p,-p),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Ze,pn,Xn,Zn,qe,ze,Ae),Qn=(t=>(e,n)=>{const s=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return s.buffer=i,s.loop=!0,s.connect(n),s.start(),()=>{s.stop(),s.disconnect(n)}})(cn),Kn=((t,e,n,s,i)=>(r,{curve:o,oversample:a,...u})=>{const c=r.createWaveShaper(),l=r.createWaveShaper();Xt(c,u),Xt(l,u);const h=n(r,{...u,gain:1}),p=n(r,{...u,gain:-1}),d=n(r,{...u,gain:1}),f=n(r,{...u,gain:-1});let _=null,m=!1,g=null;const v={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,p.channelCount=t,c.channelCount=t,d.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,p.channelCountMode=t,c.channelCountMode=t,d.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,p.channelInterpretation=t,c.channelInterpretation=t,d.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return g},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),s=new Float32Array(t+2-t%2);e[0]=n[0],s[0]=-n[t-1];const i=Math.ceil((t+1)/2),r=(t+1)/2-1;for(let o=1;o<i;o+=1){const a=o/i*r,u=Math.floor(a),c=Math.ceil(a);e[o]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],s[o]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=s}g=n,m&&(s(g)&&null===_?_=t(r,h):null!==_&&(_(),_=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==o&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==v.oversample&&(v.oversample=a);return i(se(v,d),(()=>{h.connect(c).connect(d),h.connect(p).connect(l).connect(f).connect(d),m=!0,s(g)&&(_=t(r,h))}),(()=>{h.disconnect(c),c.disconnect(d),h.disconnect(p),p.disconnect(l),l.disconnect(f),f.disconnect(d),m=!1,null!==_&&(_(),_=null)}))})(Qn,zt,re,ge,yn),Jn=((t,e,n,s,i,r,o)=>(a,u)=>{const c=a.createWaveShaper();if(null!==r&&"webkitAudioContext"===r.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Xt(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Gt(c,{curve:l},"curve"),Gt(c,u,"oversample");let h=null,p=!1;o(c,"curve",(t=>()=>t.call(c)),(e=>n=>(e.call(c,n),p&&(s(n)&&null===h?h=t(a,c):s(n)||null===h||(h(),h=null)),n)));return i(c,(()=>{p=!0,s(c.curve)&&(h=t(a,c))}),(()=>{p=!1,null!==h&&(h(),h=null)}))})(Qn,zt,Kn,ge,yn,Ue,ve),ts=((t,e,n,s,i,r,o,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:p,coneOuterGain:d,distanceModel:f,maxDistance:_,orientationX:m,orientationY:g,orientationZ:v,panningModel:y,positionX:w,positionY:b,positionZ:x,refDistance:T,rolloffFactor:A,...k})=>{const C=l.createPanner();if(k.channelCount>2)throw o();if("max"===k.channelCountMode)throw o();Xt(C,k);const S={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...S,channelInterpretation:"speakers",numberOfInputs:6}),M=s(l,{...k,gain:1}),E=s(l,{...S,gain:1}),D=s(l,{...S,gain:0}),I=s(l,{...S,gain:0}),R=s(l,{...S,gain:0}),N=s(l,{...S,gain:0}),B=s(l,{...S,gain:0}),P=i(l,256,6,1),V=r(l,{...S,curve:new Float32Array([1,1]),oversample:"none"});let q=[m,g,v],F=[w,b,x];const j=new Float32Array(1);P.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,j,0),u(t,j,1),u(t,j,2)];e.some(((t,e)=>t!==q[e]))&&(C.setOrientation(...e),q=e);const n=[u(t,j,3),u(t,j,4),u(t,j,5)];n.some(((t,e)=>t!==F[e]))&&(C.setPosition(...n),F=n)},Object.defineProperty(D.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(B.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(t){if(t>2)throw o();M.channelCount=t,C.channelCount=t},get channelCountMode(){return C.channelCountMode},set channelCountMode(t){if("max"===t)throw o();M.channelCountMode=t,C.channelCountMode=t},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(t){M.channelInterpretation=t,C.channelInterpretation=t},get coneInnerAngle(){return C.coneInnerAngle},set coneInnerAngle(t){C.coneInnerAngle=t},get coneOuterAngle(){return C.coneOuterAngle},set coneOuterAngle(t){C.coneOuterAngle=t},get coneOuterGain(){return C.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();C.coneOuterGain=t},get context(){return C.context},get distanceModel(){return C.distanceModel},set distanceModel(t){C.distanceModel=t},get inputs(){return[M]},get maxDistance(){return C.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;C.maxDistance=t},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get orientationX(){return E.gain},get orientationY(){return D.gain},get orientationZ(){return I.gain},get panningModel(){return C.panningModel},set panningModel(t){C.panningModel=t},get positionX(){return R.gain},get positionY(){return N.gain},get positionZ(){return B.gain},get refDistance(){return C.refDistance},set refDistance(t){if(t<0)throw new RangeError;C.refDistance=t},get rolloffFactor(){return C.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;C.rolloffFactor=t},addEventListener:(...t)=>M.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>M.dispatchEvent(t[0]),removeEventListener:(...t)=>M.removeEventListener(t[0],t[1],t[2])};h!==z.coneInnerAngle&&(z.coneInnerAngle=h),p!==z.coneOuterAngle&&(z.coneOuterAngle=p),d!==z.coneOuterGain&&(z.coneOuterGain=d),f!==z.distanceModel&&(z.distanceModel=f),_!==z.maxDistance&&(z.maxDistance=_),m!==z.orientationX.value&&(z.orientationX.value=m),g!==z.orientationY.value&&(z.orientationY.value=g),v!==z.orientationZ.value&&(z.orientationZ.value=v),y!==z.panningModel&&(z.panningModel=y),w!==z.positionX.value&&(z.positionX.value=w),b!==z.positionY.value&&(z.positionY.value=b),x!==z.positionZ.value&&(z.positionZ.value=x),T!==z.refDistance&&(z.refDistance=T),A!==z.rolloffFactor&&(z.rolloffFactor=A),1===q[0]&&0===q[1]&&0===q[2]||C.setOrientation(...q),0===F[0]&&0===F[1]&&0===F[2]||C.setPosition(...F);return c(se(z,C),(()=>{M.connect(C),t(M,V,0,0),V.connect(E).connect(O,0,0),V.connect(D).connect(O,0,1),V.connect(I).connect(O,0,2),V.connect(R).connect(O,0,3),V.connect(N).connect(O,0,4),V.connect(B).connect(O,0,5),O.connect(P).connect(l.destination)}),(()=>{M.disconnect(C),a(M,V,0,0),V.disconnect(E),E.disconnect(O),V.disconnect(D),D.disconnect(O),V.disconnect(I),I.disconnect(O),V.disconnect(R),R.disconnect(O),V.disconnect(N),N.disconnect(O),V.disconnect(B),B.disconnect(O),O.disconnect(P),P.disconnect(l.destination)}))})(lt,zt,bn,re,ue,Jn,ce,ft,me,yn),es=(t=>(e,n)=>{const s=e.createPanner();return void 0===s.orientationX?t(e,n):(Xt(s,n),Yt(s,n,"orientationX"),Yt(s,n,"orientationY"),Yt(s,n,"orientationZ"),Yt(s,n,"positionX"),Yt(s,n,"positionY"),Yt(s,n,"positionZ"),Gt(s,n,"coneInnerAngle"),Gt(s,n,"coneOuterAngle"),Gt(s,n,"coneOuterGain"),Gt(s,n,"distanceModel"),Gt(s,n,"maxDistance"),Gt(s,n,"panningModel"),Gt(s,n,"refDistance"),Gt(s,n,"rolloffFactor"),s)})(ts),ns=((t,e,n,s,i,r,o,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(p,d){const f=l.get(d);return void 0!==f?Promise.resolve(f):(async(p,d)=>{let f=null,_=r(p);const m={channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation},g={...m,coneInnerAngle:_.coneInnerAngle,coneOuterAngle:_.coneOuterAngle,coneOuterGain:_.coneOuterGain,distanceModel:_.distanceModel,maxDistance:_.maxDistance,panningModel:_.panningModel,refDistance:_.refDistance,rolloffFactor:_.rolloffFactor},v=H(_,d);if("bufferSize"in _)f=s(d,{...m,gain:1});else if(!v){const t={...g,orientationX:_.orientationX.value,orientationY:_.orientationY.value,orientationZ:_.orientationZ.value,positionX:_.positionX.value,positionY:_.positionY.value,positionZ:_.positionZ.value};_=i(d,t)}if(l.set(d,null===f?_:f),null!==f){if(null===h){if(null===o)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new o(6,p.context.length,d.sampleRate),s=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});s.connect(t.destination),h=(async()=>{const e=await Promise.all([p.orientationX,p.orientationY,p.orientationZ,p.positionX,p.positionY,p.positionZ].map((async(e,s)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===s?1:0});return await a(t,e,i.offset),i})));for(let t=0;t<6;t+=1)e[t].connect(s,0,t),e[t].start(0);return c(t)})()}const t=await h,r=s(d,{...m,gain:1});await u(p,d,r);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let _=[l[0][0],l[1][0],l[2][0]],v=[l[3][0],l[4][0],l[5][0]],y=s(d,{...m,gain:1}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]});r.connect(y).connect(w.inputs[0]),w.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some(((t,e)=>t!==_[e]))||n.some(((t,e)=>t!==v[e]))){_=t,v=n;const o=e/d.sampleRate;y.gain.setValueAtTime(0,o),y=s(d,{...m,gain:0}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),r.connect(y).connect(w.inputs[0]),w.connect(f)}}return f}return v?(await t(d,p.orientationX,_.orientationX),await t(d,p.orientationY,_.orientationY),await t(d,p.orientationZ,_.orientationZ),await t(d,p.positionX,_.positionX),await t(d,p.positionY,_.positionY),await t(d,p.positionZ,_.positionZ)):(await a(d,p.orientationX,_.orientationX),await a(d,p.orientationY,_.orientationY),await a(d,p.orientationZ,_.orientationZ),await a(d,p.positionX,_.positionX),await a(d,p.positionY,_.positionY),await a(d,p.positionZ,_.positionZ)),ct(_)?await u(p,d,_.inputs[0]):await u(p,d,_),_})(p,d)}}})(un,bn,Sn,re,es,_t,je,ln,Pe,zn),ss=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...pe,...a},l=n(u,c),h=r(u);super(t,!1,l,h?s():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Q,Y),this._orientationY=e(this,h,l.orientationY,Q,Y),this._orientationZ=e(this,h,l.orientationZ,Q,Y),this._positionX=e(this,h,l.positionX,Q,Y),this._positionY=e(this,h,l.positionY,Q,Y),this._positionZ=e(this,h,l.positionZ,Q,Y),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(Ze,pn,es,ns,qe,ze,gn),is=(t=>(e,{disableNormalization:n,imag:s,real:i})=>{const r=s instanceof Float32Array?s:new Float32Array(s),o=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(o,r,{disableNormalization:n});if(Array.from(s).length<2)throw t();return a})(G),rs=((t,e,n,s)=>class i{constructor(i,r){const o=e(i),a=s({...de,...r}),u=t(o,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(is,qe,new WeakSet,(t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,(()=>0))}:{...t,imag:e,real:n}})),os=((t,e,n,s,i,r)=>{const o=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,r,h,p,d)=>{if(1===r)return((t,e,i,r)=>{const h=new Float32Array(o),p=new Float32Array(o);for(let t=0;t<o;t+=1){const e=t/16384*u;h[t]=Math.cos(e),p[t]=Math.sin(e)}const d=n(t,{...c,gain:0}),f=s(t,{...l,curve:h}),_=s(t,{...l,curve:a}),m=n(t,{...c,gain:0}),g=s(t,{...l,curve:p});return{connectGraph(){e.connect(d),e.connect(void 0===_.inputs?_:_.inputs[0]),e.connect(m),_.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===g.inputs?g:g.inputs[0]),f.connect(d.gain),g.connect(m.gain),d.connect(r,0,0),m.connect(r,0,1)},disconnectGraph(){e.disconnect(d),e.disconnect(void 0===_.inputs?_:_.inputs[0]),e.disconnect(m),_.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===g.inputs?g:g.inputs[0]),f.disconnect(d.gain),g.disconnect(m.gain),d.disconnect(r,0,0),m.disconnect(r,0,1)}}})(t,h,p,d);if(2===r)return((t,i,r,h)=>{const p=new Float32Array(o),d=new Float32Array(o),f=new Float32Array(o),_=new Float32Array(o),m=Math.floor(8192.5);for(let t=0;t<o;t+=1)if(t>m){const e=(t-m)/(16384-m)*u;p[t]=Math.cos(e),d[t]=Math.sin(e),f[t]=0,_[t]=1}else{const e=t/(16384-m)*u;p[t]=1,d[t]=0,f[t]=Math.cos(e),_[t]=Math.sin(e)}const g=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),v=n(t,{...c,gain:0}),y=s(t,{...l,curve:p}),w=n(t,{...c,gain:0}),b=s(t,{...l,curve:d}),x=s(t,{...l,curve:a}),T=n(t,{...c,gain:0}),A=s(t,{...l,curve:f}),k=n(t,{...c,gain:0}),C=s(t,{...l,curve:_});return{connectGraph(){i.connect(g),i.connect(void 0===x.inputs?x:x.inputs[0]),g.connect(v,0),g.connect(w,0),g.connect(T,1),g.connect(k,1),x.connect(r),r.connect(void 0===y.inputs?y:y.inputs[0]),r.connect(void 0===b.inputs?b:b.inputs[0]),r.connect(void 0===A.inputs?A:A.inputs[0]),r.connect(void 0===C.inputs?C:C.inputs[0]),y.connect(v.gain),b.connect(w.gain),A.connect(T.gain),C.connect(k.gain),v.connect(h,0,0),T.connect(h,0,0),w.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(g),i.disconnect(void 0===x.inputs?x:x.inputs[0]),g.disconnect(v,0),g.disconnect(w,0),g.disconnect(T,1),g.disconnect(k,1),x.disconnect(r),r.disconnect(void 0===y.inputs?y:y.inputs[0]),r.disconnect(void 0===b.inputs?b:b.inputs[0]),r.disconnect(void 0===A.inputs?A:A.inputs[0]),r.disconnect(void 0===C.inputs?C:C.inputs[0]),y.disconnect(v.gain),b.disconnect(w.gain),A.disconnect(T.gain),C.disconnect(k.gain),v.disconnect(h,0,0),T.disconnect(h,0,0),w.disconnect(h,0,1),k.disconnect(h,0,1)}}})(t,h,p,d);throw i()};return(e,{channelCount:s,channelCountMode:o,pan:a,...u})=>{if("max"===o)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:o,numberOfInputs:2}),l=n(e,{...u,channelCount:s,channelCountMode:o,gain:1}),p=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:d,disconnectGraph:f}=h(e,s,l,p,c);Object.defineProperty(p.gain,"defaultValue",{get:()=>0}),Object.defineProperty(p.gain,"maxValue",{get:()=>1}),Object.defineProperty(p.gain,"minValue",{get:()=>-1});const _={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(m&&f(),({connectGraph:d,disconnectGraph:f}=h(e,t,l,p,c)),m&&d()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return p.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let m=!1;return r(se(_,c),(()=>{d(),m=!0}),(()=>{f(),m=!1}))}})(bn,ne,re,Jn,ce,yn),as=((t,e)=>(n,s)=>{const i=s.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,s);const r=n.createStereoPanner();return Xt(r,s),Yt(r,s,"pan"),Object.defineProperty(r,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),r})(os,ce),us=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.pan,u.pan):await s(a,o.pan,u.pan),ct(u)?await i(o,a,u.inputs[0]):await i(o,a,u),u})(o,a)}}})(un,as,_t,ln,Pe),cs=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...fe,...o},c=n(a,u),l=r(a);super(t,!1,c,l?s():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(Ze,pn,as,us,qe,ze),ls=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(Jn,_t,Pe),hs=((t,e,n,s,i,r,o)=>class extends t{constructor(t,e){const a=i(t),u={..._e,...e},c=n(a,u);super(t,!0,c,r(a)?s():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(Ze,zt,Jn,ls,qe,ze,gn),ps=(t=>null!==t&&t.isSecureContext)(Re),ds=(t=>(e,n,s)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return s()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Re),fs=new WeakMap,_s=((t,e)=>n=>{let s=t.get(n);if(void 0!==s)return s;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return s=new e(1,1,44100),t.set(n,s),s})(fs,je),ms=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{let d=0;return(f,_,m={credentials:"omit"})=>{const g=l.get(f);if(void 0!==g&&g.has(_))return Promise.resolve();const v=c.get(f);if(void 0!==v){const t=v.get(_);if(void 0!==t)return t}const y=r(f),w=void 0===y.audioWorklet?i(_).then((([t,e])=>{const[s,i]=R(t,e);return n(`${s};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const t=p._AWGS.pop();if(void 0===t)throw new SyntaxError;s(y.currentTime,y.sampleRate,(()=>t(class{},void 0,((t,n)=>{if(""===t.trim())throw e();const s=M.get(y);if(void 0!==s){if(s.has(t))throw e();B(n),N(n.parameterDescriptors),s.set(t,n)}else B(n),N(n.parameterDescriptors),M.set(y,new Map([[t,n]]))}),y.sampleRate,void 0,void 0)))})):Promise.all([i(_),Promise.resolve(t(h,h))]).then((([[t,e],n])=>{const s=d+1;d=s;const[i,r]=R(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${r}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${s}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return y.audioWorklet.addModule(l,m).then((()=>{if(a(y))return y;const t=o(y);return t.audioWorklet.addModule(l,m).then((()=>t))})).then((t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${s}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(l)))}));return void 0===v?c.set(f,new Map([[_,w]])):v.set(_,w),w.then((()=>{const t=l.get(f);void 0===t?l.set(f,new Set([_])):t.add(_)})).finally((()=>{const t=c.get(f);void 0!==t&&t.delete(_)})),w}})(Ee,ce,(t=>e=>new Promise(((n,s)=>{if(null===t)return void s(new SyntaxError);const i=t.document.head;if(null===i)s(new SyntaxError);else{const r=t.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,r,o)=>n===a||n===t.location.href&&1===i&&1===r?(c(),s(o),!1):null!==u?u(e,n,i,r,o):void 0,r.onerror=()=>{c(),s(new SyntaxError)},r.onload=()=>{c(),n()},r.src=a,r.type="module",i.appendChild(r)}})))(Re),ds,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})((()=>new DOMException("","AbortError"))),qe,_s,ze,Xe,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),s=new e(1,128,44100),i=URL.createObjectURL(n);let r=!1,o=!1;try{await s.audioWorklet.addModule(i);const e=new t(s,"a",{numberOfOutputs:0}),n=s.createOscillator();e.port.onmessage=()=>r=!0,e.onprocessorerror=()=>o=!0,n.connect(e),n.start(0),await s.startRendering(),await new Promise((t=>setTimeout(t)))}catch{}finally{URL.revokeObjectURL(i)}return r&&!o})(Xe,je),Re):void 0,gs=((t,e)=>n=>t(n)||e(n))(He,ze),vs=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=o(h)?h:r(h);if(i.has(p)){const t=n();return Promise.reject(t)}try{i.add(p)}catch{}return e(u,(()=>u(d)))?d.decodeAudioData(p).then((n=>(Pt(p).catch((()=>{})),e(a,(()=>a(n)))||l(n),t.add(n),n))):new Promise(((e,n)=>{const i=async()=>{try{await Pt(p)}catch{}},r=t=>{n(t),i()};try{d.decodeAudioData(p,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),X(n)),t.add(n),i().then((()=>e(n)))}),(t=>{r(null===t?s():t)}))}catch(t){r(t)}}))})(Ke,Ee,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,qe,gs,$,$t,nn,sn),ys=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_,m,g,v,y)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,s){return new n({length:e,numberOfChannels:t,sampleRate:s})}createBufferSource(){return new s(this)}createChannelMerger(t=6){return new r(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new o(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new p(this)}createIIRFilter(t,e){return new d(this,{feedback:e,feedforward:t})}createOscillator(){return new _(this)}createPanner(){return new m(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new g(this,{...n,imag:e,real:t})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then((t=>("function"==typeof e&&e(t),t)),(t=>{throw"function"==typeof n&&n(t),t}))}})(ms,Qe,rn,fn,vn,Tn,kn,Mn,In,vs,Nn,Vn,Fn,Un,Gn,Yn,ss,rs,cs,hs),ws=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw TypeError();super(t,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Ze,((t,e)=>t.createMediaElementSource(e.mediaElement)),qe,ze),bs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t);if(s(r))throw new TypeError;const o={...Ht,...i},a=e(r,o);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Ze,((t,e)=>{const n=t.createMediaStreamDestination();return Xt(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),qe,ze),xs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw new TypeError;super(t,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Ze,((t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort(((t,e)=>t.id<e.id?-1:t.id>e.id?1:0));const s=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(i,"mediaStream",{value:e}),i}),qe,ze),Ts=((t,e)=>(n,{mediaStreamTrack:s})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(s);const i=new MediaStream([s]),r=n.createMediaStreamSource(i);if("audio"!==s.kind)throw t();if(e(n))throw new TypeError;return r})(zt,ze),As=((t,e,n)=>class extends t{constructor(t,s){const i=n(t);super(t,!0,e(i,s),null)}})(Ze,Ts,qe),ks=((t,e,n,s,i,r,o,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw s();if(!(t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t))(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:r}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/r:"interactive"===i||void 0===i?256/r:"playback"===i?1024/r:128*Math.max(2,Math.min(128,Math.round(i*r/128)))/r,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw e()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),st(this)})))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new r(this)}createMediaStreamSource(t){return new o(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise(((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((t=>{if(void 0===t||15===t.code)throw e();throw t}))}suspend(){return this._nativeAudioContext.suspend().catch((t=>{if(void 0===t)throw e();throw t}))}})(ys,zt,ce,(()=>new DOMException("","UnknownError")),ws,bs,xs,As,Ue),Cs=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})($n),Ss=(t=>(e,n)=>{t(e).add(n)})(Cs),Os=(t=>(e,n,s=0,i=0)=>{const r=e[s];if(void 0===r)throw t();return bt(n)?r.connect(n,0,i):r.connect(n,0)})(G),Ms=(t=>(e,n)=>{t(e).delete(n)})(Cs),Es=(t=>(e,n=void 0,s=void 0,i=0)=>void 0===n?e.forEach((t=>t.disconnect())):"number"==typeof n?qt(t,e,n).disconnect():bt(n)?void 0===s?e.forEach((t=>t.disconnect(n))):void 0===i?qt(t,e,s).disconnect(n,0):qt(t,e,s).disconnect(n,0,i):void 0===s?e.forEach((t=>t.disconnect(n))):qt(t,e,s).disconnect(n,0))(G),Ds=new WeakMap,Is=((t,e)=>n=>e(t,n))(Ds,P),Rs=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m)=>{if(0===m.numberOfInputs&&0===m.numberOfOutputs)throw u();const g=Array.isArray(m.outputChannelCount)?m.outputChannelCount:Array.from(m.outputChannelCount);if(g.some((t=>t<1)))throw u();if(g.length!==m.numberOfOutputs)throw e();if("explicit"!==m.channelCountMode)throw u();const v=m.channelCount*m.numberOfInputs,y=g.reduce(((t,e)=>t+e),0),w=void 0===_.parameterDescriptors?0:_.parameterDescriptors.length;if(v+w>6||y>6)throw u();const b=new MessageChannel,x=[],T=[];for(let t=0;t<m.numberOfInputs;t+=1)x.push(o(d,{channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation,gain:1})),T.push(i(d,{channelCount:m.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:m.channelCount}));const A=[];if(void 0!==_.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:s}of _.parameterDescriptors){const i=r(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==m.parameterData[s]?m.parameterData[s]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Q:e},minValue:{get:()=>void 0===n?Y:n}}),A.push(i)}const k=s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,v+w)}),C=Jt(f,d.sampleRate),S=a(d,C,v+w,Math.max(1,y)),O=i(d,{channelCount:Math.max(1,y),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,y)}),M=[];for(let t=0;t<m.numberOfOutputs;t+=1)M.push(s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:g[t]}));for(let t=0;t<m.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[t].connect(k,e,t*m.channelCount+e)}const D=new kt(void 0===_.parameterDescriptors?[]:_.parameterDescriptors.map((({name:t},e)=>{const n=A[e];return n.connect(k,0,v+e),n.start(0),[t,n.offset]})));k.connect(S);let I=m.channelInterpretation,R=null;const N=0===m.numberOfOutputs?[S]:M,B={get bufferSize(){return C},get channelCount(){return m.channelCount},set channelCount(t){throw n()},get channelCountMode(){return m.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return I},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;I=t},get context(){return S.context},get inputs(){return x},get numberOfInputs(){return m.numberOfInputs},get numberOfOutputs(){return m.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(t){"function"==typeof R&&B.removeEventListener("processorerror",R),R="function"==typeof t?t:null,"function"==typeof R&&B.addEventListener("processorerror",R)},get parameters(){return D},get port(){return b.port2},addEventListener:(...t)=>S.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,N),disconnect:c.bind(null,N),dispatchEvent:(...t)=>S.dispatchEvent(t[0]),removeEventListener:(...t)=>S.removeEventListener(t[0],t[1],t[2])},P=new Map;var V,q;b.port1.addEventListener=(V=b.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(d.currentTime,d.sampleRate,(()=>e(t)))},P.set(e,t[1]))}}return V.call(b.port1,t[0],t[1],t[2])}),b.port1.removeEventListener=(q=b.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return q.call(b.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(b.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&b.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(b.port1.addEventListener("message",F),b.port1.start())}}),_.prototype.port=b.port1;let j=null;const z=((t,e,n,s)=>{let i=E.get(t);void 0===i&&(i=new WeakMap,E.set(t,i));const r=te(n,s);return i.set(e,r),r})(d,B,_,m);z.then((t=>j=t));const W=Mt(m.numberOfInputs,m.channelCount),L=Mt(m.numberOfOutputs,g),U=void 0===_.parameterDescriptors?[]:_.parameterDescriptors.reduce(((t,{name:e})=>({...t,[e]:new Float32Array(128)})),{});let H=!0;const $=()=>{m.numberOfOutputs>0&&S.disconnect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.disconnect(n,e+s,s);e+=g[t]}},G=new Map;S.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==j){const n=h(B);for(let s=0;s<C;s+=128){for(let e=0;e<m.numberOfInputs;e+=1)for(let n=0;n<m.channelCount;n+=1)St(t,W[e],n,n,s);void 0!==_.parameterDescriptors&&_.parameterDescriptors.forEach((({name:e},n)=>{St(t,U,e,v+n,s)}));for(let t=0;t<m.numberOfInputs;t+=1)for(let e=0;e<g[t];e+=1)0===L[t][e].byteLength&&(L[t][e]=new Float32Array(128));try{const t=W.map(((t,e)=>{if(n[e].size>0)return G.set(e,C/128),t;const s=G.get(e);return void 0===s?[]:(t.every((t=>t.every((t=>0===t))))&&(1===s?G.delete(e):G.set(e,s-1)),t)})),i=l(d.currentTime+s/d.sampleRate,d.sampleRate,(()=>j.process(t,L,U)));H=i;for(let t=0,n=0;t<m.numberOfOutputs;t+=1){for(let i=0;i<g[t];i+=1)Ot(e,L[t],i,n+i,s);n+=g[t]}}catch(t){H=!1,B.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!H){for(let t=0;t<m.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[s].disconnect(k,e,t*m.channelCount+e)}if(void 0!==_.parameterDescriptors){const t=_.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=A[e];t.disconnect(k,0,v+e),t.stop()}}k.disconnect(S),S.onaudioprocess=null,X?$():J();break}}}};let X=!1;const Z=o(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),K=()=>S.connect(Z).connect(d.destination),J=()=>{S.disconnect(Z),Z.disconnect()};return K(),p(B,(()=>{if(H){J(),m.numberOfOutputs>0&&S.connect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.connect(n,e+s,s);e+=g[t]}}X=!0}),(()=>{H&&(K(),$()),X=!1}))})(Os,G,zt,bn,ne,Sn,re,ue,ce,Es,ds,Is,yn),Ns=((t,e,n,s,i)=>(r,o,a,u,c,l)=>{if(null!==a)try{const e=new a(r,u,l),s=new Map;let o=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>o,set:t=>{"function"==typeof o&&e.removeEventListener("processorerror",o),o="function"==typeof t?t:null,"function"==typeof o&&e.addEventListener("processorerror",o)}}}),e.addEventListener=(p=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=s.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},s.set(e,t[1]))}}return p.call(e,"error",t[1],t[2]),p.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=s.get(t[1]);void 0!==e&&(s.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(r.destination);return i(e,(()=>t.disconnect()),(()=>t.connect(r.destination)))}return e}catch(t){if(11===t.code)throw s();throw t}var h,p;if(void 0===c)throw s();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(r,o,c,l)})(zt,Rs,re,ce,yn),Bs=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>(m,g,v)=>{const y=new WeakMap;let w=null;return{render(b,x){a(x,b);const T=y.get(x);return void 0!==T?Promise.resolve(T):(async(a,b)=>{let x=l(a),T=null;const A=H(x,b),k=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(null===h){const t=k.reduce(((t,e)=>t+e),0),n=i(b,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),r=[];for(let t=0;t<a.numberOfOutputs;t+=1)r.push(s(b,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:k[t]}));const c=o(b,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1});c.connect=e.bind(null,r),c.disconnect=u.bind(null,r),T=[n,r,c]}else A||(x=new h(b,m));if(y.set(b,null===T?x:T[2]),null!==T){if(null===w){if(void 0===v)throw new Error("Missing the processor constructor.");if(null===p)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===v.parameterDescriptors?0:v.parameterDescriptors.length,n=t+e,u=async()=>{const u=new p(n,128*Math.ceil(a.context.length/128),b.sampleRate),c=[],l=[];for(let t=0;t<g.numberOfInputs;t+=1)c.push(o(u,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),l.push(i(u,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map((async t=>{const e=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await d(u,t,e.offset),e}))),m=s(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<g.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<g.channelCount;e+=1)l[t].connect(m,e,t*g.channelCount+e)}for(const[e,n]of h.entries())n.connect(m,0,t+e),n.start(0);return m.connect(u.destination),await Promise.all(c.map((t=>f(a,u,t)))),_(u)};w=Et(a,0===n?null:await u(),b,g,k,v,c)}const t=await w,e=n(b,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let s=0;s<k[t];s+=1)u.connect(n,e+s,s);e+=k[t]}return h}if(A)for(const[e,n]of a.parameters.entries())await t(b,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await d(b,e,x.parameters.get(t));return await f(a,b,x),x})(b,x)}}})(un,Os,cn,bn,ne,Sn,re,Ms,Es,ds,_t,Xe,je,ln,Pe,zn),Ps=(t=>e=>t.get(e))(fs),Vs=(t=>(e,n)=>{t.set(e,n)})(Ds),qs=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p,d)=>class extends e{constructor(e,d,f){var _;const m=a(e),g=u(m),v=l({...Ct,...f});p(v);const y=M.get(m),w=null==y?void 0:y.get(d),b=g||"closed"!==m.state?m:null!==(_=o(m))&&void 0!==_?_:m,x=i(b,g?null:e.baseLatency,c,d,w,v);super(e,!0,x,g?s(d,v,w):null);const T=[];x.parameters.forEach(((t,e)=>{const s=n(this,g,t);T.push([e,s])})),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new kt(T),g&&t(m,this);const{activeInputs:A}=r(this);h(x,A)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?d(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Ss,Ze,pn,Bs,Ns,tt,Ps,qe,ze,Xe,(t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},(()=>1))})),Vs,(t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}}),Ae):void 0,Fs=((t,e)=>(n,s,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,s,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(ce,je),js=((t,e,n,s,i,r,o,a)=>(u,c)=>n(u).render(u,c).then((()=>Promise.all(Array.from(s(c)).map((t=>n(t).render(t,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(o(n),X(n)):e(r,(()=>r(n)))||a(n),t.add(n),n))))(Ke,Ee,Be,Cs,zn,$,nn,sn),zs=((t,e,n,s,i)=>class extends t{constructor(t,n,i){let r;if("number"==typeof t&&void 0!==n&&void 0!==i)r={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");r=t}const{length:o,numberOfChannels:a,sampleRate:u}={...le,...r},c=s(a,o,u);e($t,(()=>$t(c)))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=o,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally((()=>{this._state=null,st(this)})))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout((()=>this._waitForThePromiseToSettle(t)))}})(ys,Ee,zt,Fs,js),Ws=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,He),Ls=((t,e)=>n=>t.has(n)||e(n))(T,$e),Us=((t,e)=>n=>t.has(n)||e(n))(k,Ge),Hs=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,ze);function $s(t,e){if(!t)throw new Error(e)}function Gs(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Xs(t){t.isOffline||"running"===t.state||Ys('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Zs=console;function Ys(...t){Zs.warn(...t)}function Qs(t){return void 0===t}function Ks(t){return!Qs(t)}function Js(t){return"number"==typeof t}function ti(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ei(t){return"boolean"==typeof t}function ni(t){return Array.isArray(t)}function si(t){return"string"==typeof t}function ii(t){return si(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}const ri="object"==typeof self?self:null,oi=ri&&(ri.hasOwnProperty("AudioContext")||ri.hasOwnProperty("webkitAudioContext"));function ai(t,e,n,s){var i,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r<3?i(o):r>3?i(e,n,o):i(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o}function ui(t,e,n,s){return new(n||(n=Promise))((function(i,r){function o(t){try{u(s.next(t))}catch(t){r(t)}}function a(t){try{u(s.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class ci{constructor(t,e,n){this._callback=t,this._type=e,this._updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout((()=>{this._createTimeout(),this._callback()}),1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&(clearTimeout(this._timeout),this._timeout=0),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){this._updateInterval=Math.max(t,128/44100),"worker"===this._type&&this._worker.postMessage(Math.max(1e3*t,1))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}function li(t){return Us(t)}function hi(t){return Ls(t)}function pi(t){return Hs(t)}function di(t){return Ws(t)}function fi(t){return t instanceof AudioBuffer}function _i(t,e){return"value"===t||li(e)||hi(e)||fi(e)}function mi(t,...e){if(!e.length)return t;const n=e.shift();if(ti(t)&&ti(n))for(const e in n)_i(e,n[e])?t[e]=n[e]:ti(n[e])?(t[e]||Object.assign(t,{[e]:{}}),mi(t[e],n[e])):Object.assign(t,{[e]:n[e]});return mi(t,...e)}function gi(t,e,n=[],s){const i={},r=Array.from(e);if(ti(r[0])&&s&&!Reflect.has(r[0],s)){Object.keys(r[0]).some((e=>Reflect.has(t,e)))||(mi(i,{[s]:r[0]}),n.splice(n.indexOf(s),1),r.shift())}if(1===r.length&&ti(r[0]))mi(i,r[0]);else for(let t=0;t<n.length;t++)Ks(r[t])&&(i[n[t]]=r[t]);return mi(t,i)}function vi(t,e){return Qs(t)?e:t}function yi(t,e){return e.forEach((e=>{Reflect.has(t,e)&&delete t[e]})),t}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}),n=(t,e,n)=>({endTime:e,insertTime:n,type:"linearRampToValue",value:t}),s=(t,e)=>({startTime:e,type:"setValue",value:t}),i=(t,e,n)=>({duration:n,startTime:e,type:"setValueCurve",values:t}),r=(t,e,{startTime:n,target:s,timeConstant:i})=>s+(e-s)*Math.exp((n-t)/i),o=t=>"exponentialRampToValue"===t.type,a=t=>"linearRampToValue"===t.type,u=t=>o(t)||a(t),c=t=>"setValue"===t.type,l=t=>"setValueCurve"===t.type,h=(t,e,n,s)=>{const i=t[e];return void 0===i?s:u(i)||c(i)?i.value:l(i)?i.values[i.values.length-1]:r(n,h(t,e-1,i.startTime,s),i)},p=(t,e,n,s,i)=>void 0===n?[s.insertTime,i]:u(n)?[n.endTime,n.value]:c(n)?[n.startTime,n.value]:l(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,h(t,e-1,n.startTime,i)],d=t=>"cancelAndHold"===t.type,f=t=>"cancelScheduledValues"===t.type,_=t=>d(t)||f(t)?t.cancelTime:o(t)||a(t)?t.endTime:t.startTime,m=(t,e,n,{endTime:s,value:i})=>n===i?i:0<n&&0<i||n<0&&i<0?n*(i/n)**((t-e)/(s-e)):0,g=(t,e,n,{endTime:s,value:i})=>n+(t-e)/(s-e)*(i-n),v=(t,{duration:e,startTime:n,values:s})=>((t,e)=>{const n=Math.floor(e),s=Math.ceil(e);return n===s?t[n]:(1-(e-n))*t[n]+(1-(s-e))*t[s]})(s,(t-n)/e*(s.length-1)),y=t=>"setTarget"===t.type;class w{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const r=_(t);if(d(t)||f(t)){const a=this._automationEvents.findIndex((e=>f(t)&&l(e)?e.startTime+e.duration>=r:_(e)>=r)),c=this._automationEvents[a];if(-1!==a&&(this._automationEvents=this._automationEvents.slice(0,a)),d(t)){const t=this._automationEvents[this._automationEvents.length-1];if(void 0!==c&&u(c)){if(void 0!==t&&y(t))throw new Error("The internal list is malformed.");const s=void 0===t?c.insertTime:l(t)?t.startTime+t.duration:_(t),i=void 0===t?this._defaultValue:l(t)?t.values[t.values.length-1]:t.value,a=o(c)?m(r,s,i,c):g(r,s,i,c),u=o(c)?e(a,r,this._currenTime):n(a,r,this._currenTime);this._automationEvents.push(u)}if(void 0!==t&&y(t)&&this._automationEvents.push(s(this.getValue(r),r)),void 0!==t&&l(t)&&t.startTime+t.duration>r){const e=r-t.startTime,n=(t.values.length-1)/t.duration,s=Math.max(2,1+Math.ceil(e*n)),o=e/(s-1)*n,a=t.values.slice(0,s);if(o<1)for(let e=1;e<s;e+=1){const n=o*e%1;a[e]=t.values[e-1]*(1-n)+t.values[e]*n}this._automationEvents[this._automationEvents.length-1]=i(a,t.startTime,e)}}}else{const s=this._automationEvents.findIndex((t=>_(t)>r)),i=-1===s?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[s-1];if(void 0!==i&&l(i)&&_(i)+i.duration>r)return!1;const u=o(t)?e(t.value,t.endTime,this._currenTime):a(t)?n(t.value,r,this._currenTime):t;if(-1===s)this._automationEvents.push(u);else{if(l(t)&&r+t.duration>_(this._automationEvents[s]))return!1;this._automationEvents.splice(s,0,u)}}return!0}flush(t){const e=this._automationEvents.findIndex((e=>_(e)>t));if(e>1){const t=this._automationEvents.slice(e-1),n=t[0];y(n)&&t.unshift(s(h(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=t}}getValue(t){if(0===this._automationEvents.length)return this._defaultValue;const e=this._automationEvents.findIndex((e=>_(e)>t)),n=this._automationEvents[e],s=(-1===e?this._automationEvents.length:e)-1,i=this._automationEvents[s];if(void 0!==i&&y(i)&&(void 0===n||!u(n)||n.insertTime>t))return r(t,h(this._automationEvents,s-1,i.startTime,this._defaultValue),i);if(void 0!==i&&c(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==i&&l(i)&&(void 0===n||!u(n)||i.startTime+i.duration>t))return t<i.startTime+i.duration?v(t,i):i.values[i.values.length-1];if(void 0!==i&&u(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==n&&o(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return m(t,e,r,n)}if(void 0!==n&&a(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return g(t,e,r,n)}return this._defaultValue}}const b=new WeakSet,x=new WeakMap,T=new WeakMap,A=new WeakMap,k=new WeakMap,C=new WeakMap,S=new WeakMap,O=new WeakMap,M=new WeakMap,E=new WeakMap,D={construct:()=>D},I=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,R=(t,e)=>{const n=[];let s=t.replace(/^[\s]+/,""),i=s.match(I);for(;null!==i;){const t=i[1].slice(1,-1),r=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(r),s=s.slice(i[0].length).replace(/^[\s]+/,""),i=s.match(I)}return[n.join(";"),s]},N=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},B=t=>{if(!(t=>{try{new new Proxy(t,D)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},P=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},V=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[s]=n;return t.delete(s),s},F=(t,e,n,s)=>{const i=P(t,e),r=V(i,(t=>t[0]===n&&t[1]===s));return 0===i.size&&t.delete(e),r},q=t=>P(S,t),j=t=>{if(b.has(t))throw new Error("The AudioNode is already stored.");b.add(t),q(t).forEach((t=>t(!0)))},z=t=>"port"in t,W=t=>{if(!b.has(t))throw new Error("The AudioNode is not stored.");b.delete(t),q(t).forEach((t=>t(!1)))},L=(t,e)=>{!z(t)&&e.every((t=>0===t.size))&&W(t)},U={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},H=(t,e)=>t.context===e,$=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},G=()=>new DOMException("","IndexSizeError"),X=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw G();throw t}})},Z={numberOfChannels:1},Y=-34028234663852886e22,Q=-Y,K=t=>b.has(t),J={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},tt=t=>P(x,t),et=t=>P(A,t),nt=(t,e)=>{const{activeInputs:n}=tt(t);n.forEach((n=>n.forEach((([n])=>{e.includes(t)||nt(n,[...e,t])}))));const s=(t=>"playbackRate"in t)(t)?[t.playbackRate]:z(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t)(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of s){const n=et(t);void 0!==n&&n.activeInputs.forEach((([t])=>nt(t,e)))}K(t)&&W(t)},st=t=>{nt(t.destination,[])},it=t=>"context"in t,rt=t=>it(t[0]),ot=(t,e,n,s)=>{for(const e of t)if(n(e)){if(s)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},at=(t,e,[n,s],i)=>{ot(t,[e,n,s],(t=>t[0]===e&&t[1]===n),i)},ut=(t,[e,n,s],i)=>{const r=t.get(e);void 0===r?t.set(e,new Set([[n,s]])):ot(r,[n,s],(t=>t[0]===n),i)},ct=t=>"inputs"in t,lt=(t,e,n,s)=>{if(ct(e)){const i=e.inputs[s];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,s),[e,n,s]},ht=(t,e,n)=>{for(const s of t)if(s[0]===e&&s[1]===n)return t.delete(s),s;return null},pt=(t,e)=>{if(!q(t).delete(e))throw new Error("Missing the expected event listener.")},dt=(t,e,n)=>{const s=P(t,e),i=V(s,(t=>t[0]===n));return 0===s.size&&t.delete(e),i},ft=(t,e,n,s)=>{ct(e)?t.disconnect(e.inputs[s],n,0):t.disconnect(e,n,s)},_t=t=>P(T,t),mt=t=>P(k,t),gt=t=>O.has(t),vt=t=>!b.has(t),yt=(t,e)=>new Promise((n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),s=t.createGain(),i=t.createBuffer(1,2,44100),r=i.getChannelData(0);r[0]=1,r[1]=1;const o=t.createBufferSource();o.buffer=i,o.loop=!0,o.connect(e).connect(t.destination),o.connect(s),o.disconnect(s),e.onaudioprocess=s=>{const i=s.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(t=>1===t))?n(!0):n(!1),o.stop(),e.onaudioprocess=null,o.disconnect(e),e.disconnect(t.destination)},o.start()}})),wt=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach(((t,n)=>e(n,t)))},bt=t=>"context"in t,xt=(t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=et(e),{outputs:o}=tt(t),a=q(t),u=o=>{const a=_t(t),u=mt(e);if(o){const e=dt(r,t,n);at(i,t,e,!1),s||gt(t)||a.connect(u,n)}else{const e=((t,e,n)=>V(t,(t=>t[0]===e&&t[1]===n)))(i,t,n);ut(r,e,!1),s||gt(t)||a.disconnect(u,n)}};return!!ot(o,[e,n],(t=>t[0]===e&&t[1]===n),!0)&&(a.add(u),K(t)?at(i,t,[n,u],!0):ut(r,[t,n,u],!0),!0)},Tt=(t,e,n,s,i)=>{const[r,o]=((t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=tt(e),o=ht(i[s],t,n);if(null===o)return[F(r,t,n,s)[2],!1];return[o[2],!0]})(t,n,s,i);if(null!==r&&(pt(t,r),!o||e||gt(t)||ft(_t(t),_t(n),s,i)),K(n)){const{activeInputs:t}=tt(n);L(n,t)}},At=(t,e,n,s)=>{const[i,r]=((t,e,n)=>{const{activeInputs:s,passiveInputs:i}=et(e),r=ht(s,t,n);if(null===r)return[dt(i,t,n)[1],!1];return[r[2],!0]})(t,n,s);null!==i&&(pt(t,i),!r||e||gt(t)||_t(t).disconnect(mt(n),s))};class kt{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach(((n,s)=>t.call(e,n,s,this)))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Ct={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function St(t,e,n,s,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],s,i);else{const r=t.getChannelData(s);if(0===e[n].byteLength)e[n]=r.slice(i,i+128);else{const t=new Float32Array(r.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ot=(t,e,n,s,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],s,i):0!==e[n].byteLength&&t.getChannelData(s).set(e[n],i)},Mt=(t,e)=>{const n=[];for(let s=0;s<t;s+=1){const t=[],i="number"==typeof e?e:e[s];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Et=async(t,e,n,s,i,r,o)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=s.channelCount*s.numberOfInputs,c=i.reduce(((t,e)=>t+e),0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===r)throw new Error("Missing the processor constructor.");const h=tt(t),p=await((t,e)=>{const n=P(E,t),s=_t(e);return P(n,s)})(n,t),d=Mt(s.numberOfInputs,s.channelCount),f=Mt(s.numberOfOutputs,i),_=Array.from(t.parameters.keys()).reduce(((t,e)=>({...t,[e]:new Float32Array(128)})),{});for(let c=0;c<a;c+=128){if(s.numberOfInputs>0&&null!==e)for(let t=0;t<s.numberOfInputs;t+=1)for(let n=0;n<s.channelCount;n+=1)St(e,d[t],n,n,c);void 0!==r.parameterDescriptors&&null!==e&&r.parameterDescriptors.forEach((({name:t},n)=>{St(e,_,t,u+n,c)}));for(let t=0;t<s.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=d.map(((t,e)=>0===h.activeInputs[e].size?[]:t)),e=o(c/n.sampleRate,n.sampleRate,(()=>p.process(t,f,_)));if(null!==l)for(let t=0,e=0;t<s.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ot(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},Dt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},It={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Rt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Nt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Bt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Pt=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise((s=>{const i=()=>{n.onmessage=null,e.close(),n.close(),s()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}}))},Vt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Ft=(t,e,n)=>{const s=e[n];if(void 0===s)throw t();return s},qt={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},jt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},zt=()=>new DOMException("","InvalidStateError"),Wt=()=>new DOMException("","InvalidAccessError"),Lt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Ut=(t,e,n,s,i,r,o,a,u,c,l)=>{const h=c.length;let p=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const s=p-e&u-1;h+=n[e]*r[s],h-=t[e]*o[s]}for(let t=i;t<s;t+=1)h+=n[t]*r[p-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*o[p-n&u-1];r[p]=c[a],o[p]=h,p=p+1&u-1,l[a]=h}return p},Ht={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},$t=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},Gt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n]&&(t[n]=s)},Xt=(t,e)=>{Gt(t,e,"channelCount"),Gt(t,e,"channelCountMode"),Gt(t,e,"channelInterpretation")},Zt=t=>"function"==typeof t.getFloatTimeDomainData,Yt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n].value&&(t[n].value=s)},Qt=t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{if("number"==typeof i&&i<0||s<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,s,i)})},Kt=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},Jt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),te=async(t,e)=>{const n=await(t=>new Promise(((e,n)=>{const{port1:s,port2:i}=new MessageChannel;s.onmessage=({data:t})=>{s.close(),i.close(),e(t)},s.onmessageerror=({data:t})=>{s.close(),i.close(),n(t)},i.postMessage(t)})))(e);return new t(n)},ee=(t,e)=>{const n=t.createBiquadFilter();return Xt(n,e),Yt(n,e,"Q"),Yt(n,e,"detune"),Yt(n,e,"frequency"),Yt(n,e,"gain"),Gt(n,e,"type"),n},ne=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Xt(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw zt()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw zt()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw zt()}})})(n),n},se=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),ie=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Xt(n,e),Yt(n,e,"delayTime"),n},re=(t,e)=>{const n=t.createGain();return Xt(n,e),Yt(n,e,"gain"),n};function oe(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function ae(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)i=e,n=[(s=n)[0]*i[0]-s[1]*i[1],s[0]*i[1]+s[1]*i[0]],n[0]+=t[r];var s,i;return n}const ue=(t,e,n,s)=>t.createScriptProcessor(e,n,s),ce=()=>new DOMException("","NotSupportedError"),le={numberOfChannels:1},he={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},pe={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},de={disableNormalization:!1},fe={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},_e={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},me=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),ge=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},ve=(t,e,n,s)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:r,set:o}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(r),set:s(o)})},ye=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(s){if(9!==s.code)throw s;ye(t,e,n+1e-7)}},we=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},be=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},xe=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Te=(t,e)=>{const n=e.createGain();t.connect(n);const s=(e=>()=>{e.call(t,n),t.removeEventListener("ended",s)})(t.disconnect);t.addEventListener("ended",s),se(t,n),t.stop=(e=>{let s=!1;return(i=0)=>{if(s)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),s=!0}})(t.stop)},Ae=(t,e)=>n=>{const s={value:t};return Object.defineProperties(n,{currentTarget:s,target:s}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)},ke=(t=>(e,n,[s,i,r],o)=>{t(e[i],[n,s,r],(t=>t[0]===n&&t[1]===s),o)})(ot),Ce=(t=>(e,n,[s,i,r],o)=>{const a=e.get(s);void 0===a?e.set(s,new Set([[i,n,r]])):t(a,[i,n,r],(t=>t[0]===i&&t[1]===n),o)})(ot),Se=(t=>(e,n,s,i)=>t(e[i],(t=>t[0]===n&&t[1]===s)))(V),Oe=new WeakMap,Me=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Oe),Ee=(De=new Map,Ie=new WeakMap,(t,e)=>{const n=Ie.get(t);if(void 0!==n)return n;const s=De.get(t);if(void 0!==s)return s;try{const n=e();return n instanceof Promise?(De.set(t,n),n.catch((()=>!1)).then((e=>(De.delete(t),Ie.set(t,e),e)))):(Ie.set(t,n),n)}catch{return Ie.set(t,!1),!1}});var De,Ie;const Re="undefined"==typeof window?null:window,Ne=((t,e)=>(n,s)=>{const i=n.createAnalyser();if(Xt(i,s),!(s.maxDecibels>s.minDecibels))throw e();return Gt(i,s,"fftSize"),Gt(i,s,"maxDecibels"),Gt(i,s,"minDecibels"),Gt(i,s,"smoothingTimeConstant"),t(Zt,(()=>Zt(i)))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const s=Math.max(n.length,t.fftSize);for(let t=0;t<s;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Ee,G),Be=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(tt),Pe=((t,e,n)=>async(s,i,r)=>{const o=t(s);await Promise.all(o.activeInputs.map(((t,o)=>Array.from(t).map((async([t,a])=>{const u=e(t),c=await u.render(t,i),l=s.context.destination;n(t)||s===l&&n(s)||c.connect(r,a,o)})))).reduce(((t,e)=>[...t,...e]),[]))})(tt,Be,gt),Ve=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(Ne,_t,Pe),Fe=(qe=C,t=>{const e=qe.get(t);if(void 0===e)throw zt();return e});var qe;const je=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Re),ze=(t=>e=>null!==t&&e instanceof t)(je),We=new WeakMap,Le=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,s){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,s)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const s=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===s?null:s,n)}})(Ae),Ue=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Re),He=(t=>e=>null!==t&&e instanceof t)(Ue),$e=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Re),Ge=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Re),Xe=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Re),Ze=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>class extends c{constructor(e,s,i,r){super(i),this._context=e,this._nativeAudioNode=i;const o=l(e);h(o)&&!0!==n(yt,(()=>yt(o,_)))&&(t=>{const e=new Map;t.connect=(t=>(n,s=0,i=0)=>{const r=bt(n)?t(n,s,i):t(n,s),o=e.get(n);return void 0===o?e.set(n,[{input:i,output:s}]):o.every((t=>t.input!==i||t.output!==s))&&o.push({input:i,output:s}),r})(t.connect.bind(t)),t.disconnect=(n=>(s,i,r)=>{if(n.apply(t),void 0===s)e.clear();else if("number"==typeof s)for(const[t,n]of e){const i=n.filter((t=>t.output!==s));0===i.length?e.delete(t):e.set(t,i)}else if(e.has(s))if(void 0===i)e.delete(s);else{const t=e.get(s);if(void 0!==t){const n=t.filter((t=>t.output!==i&&(t.input!==r||void 0===r)));0===n.length?e.delete(s):e.set(s,n)}}for(const[n,s]of e)s.forEach((e=>{bt(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)}))})(t.disconnect)})(i),T.set(this,i),S.set(this,new Set),"closed"!==e.state&&s&&j(this),t(this,r,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(p(t)||d(t))throw r();if(it(t)){const i=_t(t);try{const e=lt(this._nativeAudioNode,i,n,a),s=vt(this);(h||s)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!s&&vt(t)&&j(t)}catch(t){if(12===t.code)throw r();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wt(e,s(h))}return t}const _=mt(t);if("playbackRate"===_.name&&1024===_.maxValue)throw o();try{this._nativeAudioNode.connect(_,n),(h||vt(this))&&this._nativeAudioNode.disconnect(_,n)}catch(t){if(12===t.code)throw r();throw t}if(xt(this,t,n,h)){const e=u([this],t);wt(e,s(h))}}disconnect(t,e,n){let s;const o=l(this._context),c=f(o);if(void 0===t)s=((t,e)=>{const n=tt(t),s=[];for(const i of n.outputs)rt(i)?Tt(t,e,...i):At(t,e,...i),s.push(i[0]);return n.outputs.clear(),s})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();s=((t,e,n)=>{const s=tt(t),i=[];for(const r of s.outputs)r[1]===n&&(rt(r)?Tt(t,e,...r):At(t,e,...r),i.push(r[0]),s.outputs.delete(r));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(it(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(s=((t,e,n,s,i)=>{const r=tt(t);return Array.from(r.outputs).filter((t=>!(t[0]!==n||void 0!==s&&t[1]!==s||void 0!==i&&t[2]!==i))).map((n=>(rt(n)?Tt(t,e,...n):At(t,e,...n),r.outputs.delete(n),n[0])))})(this,c,t,e,n),0===s.length)throw r()}for(const t of s){const e=u([this],t);wt(e,a)}}})((Ye=x,(t,e,n)=>{const s=[];for(let t=0;t<n.numberOfInputs;t+=1)s.push(new Set);Ye.set(t,{activeInputs:s,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{const d=new WeakMap;return(f,_,m,g,v)=>{const{activeInputs:y,passiveInputs:w}=r(_),{outputs:b}=r(f),x=a(f),T=r=>{const a=u(_),c=u(f);if(r){const e=F(w,f,m,g);t(y,f,e,!1),v||h(f)||n(c,a,m,g),p(_)&&j(_)}else{const t=s(y,f,m,g);e(w,g,t,!1),v||h(f)||i(c,a,m,g);const n=o(_);if(0===n)l(_)&&L(_,y);else{const t=d.get(_);void 0!==t&&clearTimeout(t),d.set(_,setTimeout((()=>{l(_)&&L(_,y)}),1e3*n))}}};return!!c(b,[_,m,g],(t=>t[0]===_&&t[1]===m&&t[2]===g),!0)&&(x.add(T),l(f)?t(y,f,[m,g,T],!0):e(w,g,[f,m,T],!0),!0)}})(ke,Ce,lt,Se,ft,tt,Me,q,_t,ot,K,gt,vt),Ee,((t,e,n,s,i,r)=>o=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!o&&r(a)){const t=s(a),{outputs:r}=n(a);for(const n of r)if(rt(n)){const i=s(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(O,ft,tt,_t,mt,K),G,Wt,ce,((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=r(u.context),p=a(h);if(l===c){if(e.delete(u),!p&&o(u)){const e=s(u),{outputs:r}=n(u);for(const n of r)if(rt(n)){const i=s(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(lt,O,tt,_t,mt,Fe,K,ze),((t,e,n)=>function s(i,r){const o=it(r)?r:n(t,r);if((t=>"delayTime"in t)(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];const{outputs:a}=e(o);return Array.from(a).map((t=>s([...i,o],t[0]))).reduce(((t,e)=>t.concat(e)),[])})(We,tt,P),Le,Fe,He,$e,Ge,ze,Xe);var Ye;const Qe=((t,e,n,s,i,r)=>class extends t{constructor(t,n){const o=i(t),a={...U,...n},u=s(o,a);super(t,!1,u,r(o)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Ze,Ve,G,Ne,Fe,ze),Ke=new WeakSet,Je=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Re),tn=(en=new Uint32Array(1),t=>(en[0]=t,en[0]));var en;const nn=((t,e)=>n=>{n.copyFromChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)s[t]=c[t+o]},n.copyToChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)c[t+o]=s[t]}})(tn,G),sn=(t=>e=>{e.copyFromChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyFromChannel),e.copyToChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyToChannel)})(tn),rn=((t,e,n,s,i,r,o,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:p}={...Z,...c};null===u&&(u=new i(1,1,44100));const d=null!==s&&e(r,r)?new s({length:l,numberOfChannels:h,sampleRate:p}):u.createBuffer(h,l,p);if(0===d.numberOfChannels)throw n();return"function"!=typeof d.copyFromChannel?(o(d),X(d)):e($,(()=>$(d)))||a(d),t.add(d),d}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(Ke,Ee,ce,Je,je,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(Je),nn,sn),on=(t=>(e,n)=>{const s=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(s).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(s),s.disconnect()};n.addEventListener("ended",i)})(re),an=((t,e,n)=>async(s,i,r)=>{const o=e(s);await Promise.all(Array.from(o.activeInputs).map((async([e,s])=>{const o=t(e),a=await o.render(e,i);n(e)||a.connect(r,s)})))})(Be,et,gt),un=(t=>(e,n,s)=>t(n,e,s))(an),cn=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=h.createBufferSource();return Xt(d,p),Yt(d,p,"playbackRate"),Gt(d,p,"buffer"),Gt(d,p,"loop"),Gt(d,p,"loopEnd"),Gt(d,p,"loopStart"),e(n,(()=>n(h)))||(t=>{t.start=(e=>{let n=!1;return(s=0,i=0,r)=>{if(n)throw zt();e.call(t,s,i,r),n=!0}})(t.start)})(d),e(s,(()=>s(h)))||u(d),e(i,(()=>i(h)))||c(d,h),e(r,(()=>r(h)))||Qt(d),e(o,(()=>o(h)))||l(d,h),e(a,(()=>a(h)))||Kt(d),t(h,d),d})(on,Ee,(t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1}),(t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0}),(t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0}),we,be,xe,(t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{const r=t.buffer,o=null===r?s:Math.min(r.duration,s);null!==r&&o>r.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,o,i)})}),(t=>(e,n)=>{const s=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=s),t(e,"buffer",(t=>()=>{const n=t.call(e);return n===s?null:n}),(t=>n=>t.call(e,null===n?s:n)))})(ve),Te),ln=((t,e)=>(n,s,i)=>(t(s).replay(i),e(s,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(et),an),hn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==o&&l.start(...o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await s(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(un,cn,_t,ln,Pe),pn=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m=null,g=null)=>{const v=_.value,y=new w(v),b=f?s(y):null,x={get defaultValue(){return v},get maxValue(){return null===m?_.maxValue:m},get minValue(){return null===g?_.minValue:g},get value(){return _.value},set value(t){_.value=t,x.setValueAtTime(t,d.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof _.cancelAndHoldAtTime)null===b&&y.flush(d.context.currentTime),y.add(i(t)),_.cancelAndHoldAtTime(t);else{const e=Array.from(y).pop();null===b&&y.flush(d.context.currentTime),y.add(i(t));const n=Array.from(y).pop();_.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?_.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?_.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?_.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&_.setValueCurveAtTime(n.values,n.startTime,n.duration))}return x},cancelScheduledValues:t=>(null===b&&y.flush(d.context.currentTime),y.add(r(t)),_.cancelScheduledValues(t),x),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=d.context.currentTime;return null===b&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(o(t,e)),_.exponentialRampToValueAtTime(t,e),x},linearRampToValueAtTime(t,e){const n=d.context.currentTime;return null===b&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(a(t,e)),_.linearRampToValueAtTime(t,e),x},setTargetAtTime:(t,e,n)=>(null===b&&y.flush(d.context.currentTime),y.add(u(t,e,n)),_.setTargetAtTime(t,e,n),x),setValueAtTime:(t,e)=>(null===b&&y.flush(d.context.currentTime),y.add(c(t,e)),_.setValueAtTime(t,e),x),setValueCurveAtTime(t,e,n){const s=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=d.context.sampleRate,r=Math.ceil(e*i),o=Math.floor(t*i),a=o-r,u=new Float32Array(a);for(let t=0;t<a;t+=1){const o=(s.length-1)/n*((r+t)/i-e),a=Math.floor(o),c=Math.ceil(o);u[t]=a===c?s[a]:(1-(o-a))*s[a]+(1-(c-o))*s[c]}null===b&&y.flush(d.context.currentTime),y.add(l(u,e,n)),_.setValueCurveAtTime(u,e,n);const c=o/i;c<t&&p(x,u[u.length-1],c),p(x,s[s.length-1],t)}else null===b&&y.flush(d.context.currentTime),y.add(l(s,e,n)),_.setValueCurveAtTime(s,e,n);return x}};return n.set(x,_),e.set(x,d),t(x,b),x})((dn=A,(t,e)=>{dn.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),We,k,(t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:s}=n;e.exponentialRampToValueAtTime(s,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:s}=n;e.linearRampToValueAtTime(s,t)}else if("setTarget"===n.type){const{startTime:t,target:s,timeConstant:i}=n;e.setTargetAtTime(s,t,i)}else if("setValue"===n.type){const{startTime:t,value:s}=n;e.setValueAtTime(s,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:s,values:i}=n;e.setValueCurveAtTime(i,s,t)}}}})),(t=>({cancelTime:t,type:"cancelAndHold"})),(t=>({cancelTime:t,type:"cancelScheduledValues"})),((t,e)=>({endTime:e,type:"exponentialRampToValue",value:t})),((t,e)=>({endTime:e,type:"linearRampToValue",value:t})),((t,e,n)=>({startTime:e,target:t,timeConstant:n,type:"setTarget"})),s,i,Ue,ye);var dn;const fn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const a=r(t),u={...J,...s},c=i(a,u),l=o(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Q,Y)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){j(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ze,hn,pn,zt,cn,Fe,ze,Ae),_n=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,n){const s=r(t),u=o(s),c=i(s,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Ze,(t=>{const e=new WeakMap;return{render(n,s){const i=e.get(s);return void 0!==i?Promise.resolve(i):(async(n,s)=>{const i=s.destination;return e.set(s,i),await t(n,s,i),i})(n,s)}}}),G,zt,((t,e)=>(n,s,i)=>{const r=n.destination;if(r.channelCount!==s)try{r.channelCount=s}catch{}i&&"explicit"!==r.channelCountMode&&(r.channelCountMode="explicit"),0===r.maxChannelCount&&Object.defineProperty(r,"maxChannelCount",{value:s});const o=t(n,{channelCount:s,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,gain:1});return e(o,"channelCount",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e);try{r.channelCount=e}catch(t){if(e>r.maxChannelCount)throw t}})),e(o,"channelCountMode",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelCountMode=e})),e(o,"channelInterpretation",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelInterpretation=e})),Object.defineProperty(o,"maxChannelCount",{get:()=>r.maxChannelCount}),o.connect(r),o})(re,ve),Fe,ze,Pe),mn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return r.set(a,u),c?(await t(a,o.Q,u.Q),await t(a,o.detune,u.detune),await t(a,o.frequency,u.frequency),await t(a,o.gain,u.gain)):(await s(a,o.Q,u.Q),await s(a,o.detune,u.detune),await s(a,o.frequency,u.frequency),await s(a,o.gain,u.gain)),await i(o,a,u),u})(o,a)}}})(un,ee,_t,ln,Pe),gn=(t=>(e,n)=>t.set(e,n))(Oe),vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const u=r(t),c={...Dt,...s},l=i(u,c),h=o(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Q,Y),this._detune=e(this,h,l.detune,1200*Math.log2(Q),-1200*Math.log2(Q)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Q),Y),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw s();throw t}if(t.length!==e.length||e.length!==n.length)throw s()}})(Ze,pn,mn,Wt,ee,Fe,ze,gn),yn=((t,e)=>(n,s,i)=>{const r=new Set;return n.connect=(i=>(o,a=0,u=0)=>{const c=0===r.size;if(e(o))return i.call(n,o,a,u),t(r,[o,a,u],(t=>t[0]===o&&t[1]===a&&t[2]===u),!0),c&&s(),o;i.call(n,o,a),t(r,[o,a],(t=>t[0]===o&&t[1]===a),!0),c&&s()})(n.connect),n.disconnect=(t=>(s,o,a)=>{const u=r.size>0;if(void 0===s)t.apply(n),r.clear();else if("number"==typeof s){t.call(n,s);for(const t of r)t[1]===s&&r.delete(t)}else{e(s)?t.call(n,s,o,a):t.call(n,s,o);for(const t of r)t[0]!==s||void 0!==o&&t[1]!==o||void 0!==a&&t[2]!==a||r.delete(t)}const c=0===r.size;u&&c&&i()})(n.disconnect),n})(ot,$e),wn=((t,e)=>(n,s)=>{s.channelCount=1,s.channelCountMode="explicit",Object.defineProperty(s,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(s,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(s,(()=>{const t=s.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(s,0,e)}),(()=>i.disconnect(s)))})(zt,yn),bn=((t,e)=>(n,s)=>{const i=n.createChannelMerger(s.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Xt(i,s),i})(Ue,wn),xn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(bn,_t,Pe),Tn=((t,e,n,s,i)=>class extends t{constructor(t,r){const o=s(t),a={...It,...r};super(t,!1,n(o,a),i(o)?e():null)}})(Ze,xn,bn,Fe,ze),An=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(ne,_t,Pe),kn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=r({...Rt,...o});super(t,!1,n(a,u),i(a)?e():null)}})(Ze,An,ne,Fe,ze,(t=>({...t,channelCount:t.numberOfOutputs}))),Cn=((t,e,n,s)=>(i,{offset:r,...o})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...o,gain:r}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),s(se(h,c),(()=>u.connect(c)),(()=>u.disconnect(c)))})(on,cn,re,yn),Sn=((t,e,n,s,i)=>(r,o)=>{if(void 0===r.createConstantSource)return n(r,o);const a=r.createConstantSource();return Xt(a,o),Yt(a,o,"offset"),e(s,(()=>s(r)))||Qt(a),e(i,(()=>i(r)))||Kt(a),t(r,a),a})(on,Ee,Cn,we,xe),On=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==o&&l.start(o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.offset,l.offset):await s(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(un,Sn,_t,ln,Pe),Mn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...Nt,...o},c=s(a,u),l=r(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Q,Y),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Ze,pn,On,Sn,Fe,ze,Ae),En=((t,e)=>(n,s)=>{const i=n.createConvolver();if(Xt(i,s),s.disableNormalization===i.normalize&&(i.normalize=!s.disableNormalization),Gt(i,s,"buffer"),s.channelCount>2)throw t();if(e(i,"channelCount",(t=>()=>t.call(i)),(e=>n=>{if(n>2)throw t();return e.call(i,n)})),"max"===s.channelCountMode)throw t();return e(i,"channelCountMode",(t=>()=>t.call(i)),(e=>n=>{if("max"===n)throw t();return e.call(i,n)})),i})(ce,ve),Dn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(En,_t,Pe),In=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u={...Bt,...o},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&r(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,r(this,0)}else this._isBufferNullified=!1,r(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(Ze,Dn,En,Fe,ze,gn),Rn=((t,e,n,s,i)=>r=>{const o=new WeakMap;return{render(a,u){const c=o.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=H(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:r};c=e(u,t)}return o.set(u,c),l?await t(u,a.delayTime,c.delayTime):await s(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(un,ie,_t,ln,Pe),Nn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...Vt,...a},l=s(u,c),h=r(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),o(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Ze,pn,Rn,ie,Fe,ze,gn),Bn=(t=>(e,n)=>{const s=e.createDynamicsCompressor();if(Xt(s,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Yt(s,n,"attack"),Yt(s,n,"knee"),Yt(s,n,"ratio"),Yt(s,n,"release"),Yt(s,n,"threshold"),s})(ce),Pn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return r.set(a,u),c?(await t(a,o.attack,u.attack),await t(a,o.knee,u.knee),await t(a,o.ratio,u.ratio),await t(a,o.release,u.release),await t(a,o.threshold,u.threshold)):(await s(a,o.attack,u.attack),await s(a,o.knee,u.knee),await s(a,o.ratio,u.ratio),await s(a,o.release,u.release),await s(a,o.threshold,u.threshold)),await i(o,a,u),u})(o,a)}}})(un,Bn,_t,ln,Pe),Vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,i){const u=r(t),c={...qt,...i},l=s(u,c),h=o(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Ze,pn,Pn,Bn,ce,Fe,ze,gn),Fn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.gain,u.gain):await s(a,o.gain,u.gain),await i(o,a,u),u})(o,a)}}})(un,re,_t,ln,Pe),qn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...jt,...o},c=s(a,u),l=r(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Q,Y)}get gain(){return this._gain}})(Ze,pn,Fn,re,Fe,ze),jn=((t,e,n,s)=>(i,r,{channelCount:o,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Jt(r,i.sampleRate),p=c instanceof Float64Array?c:new Float64Array(c),d=l instanceof Float64Array?l:new Float64Array(l),f=p.length,_=d.length,m=Math.min(f,_);if(0===f||f>20)throw s();if(0===p[0])throw e();if(0===_||_>20)throw s();if(0===d[0])throw e();if(1!==p[0]){for(let t=0;t<_;t+=1)d[t]/=p[0];for(let t=1;t<f;t+=1)p[t]/=p[0]}const g=n(i,h,o,o);g.channelCount=o,g.channelCountMode=a,g.channelInterpretation=u;const v=[],y=[],w=[];for(let t=0;t<o;t+=1){v.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),y.push(t),w.push(e)}g.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,s=e.numberOfChannels;for(let t=0;t<s;t+=1){const s=e.getChannelData(t),i=n.getChannelData(t);v[t]=Ut(p,f,d,_,m,y[t],w[t],v[t],32,s,i)}};const b=i.sampleRate/2,x={get bufferSize(){return h},get channelCount(){return g.channelCount},set channelCount(t){g.channelCount=t},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){g.channelCountMode=t},get channelInterpretation(){return g.channelInterpretation},set channelInterpretation(t){g.channelInterpretation=t},get context(){return g.context},get inputs(){return[g]},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},addEventListener:(...t)=>g.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>g.dispatchEvent(t[0]),getFrequencyResponse(e,n,s){if(e.length!==n.length||n.length!==s.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/b),r=[Math.cos(i),Math.sin(i)],o=oe(ae(d,r),ae(p,r));n[t]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),s[t]=Math.atan2(o[1],o[0])}},removeEventListener:(...t)=>g.removeEventListener(t[0],t[1],t[2])};return se(x,g)})(Wt,zt,ue,ce),zn=((t,e,n,s)=>i=>t($t,(()=>$t(i)))?Promise.resolve(t(s,s)).then((t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()})):new Promise((t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(Ee,re,ue,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),s=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((t=>{n.oncomplete=()=>{s.disconnect(),t(0!==n.currentTime)},n.startRendering()}))})(re,je)),Wn=((t,e,n,s,i)=>(r,o)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,p=e(c);const d=H(p,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):d||(p=l.createIIRFilter(o,r)),a.set(l,null===h?p:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await s(c,t,t.destination);return((t,e,n,s)=>{const i=n instanceof Float64Array?n:new Float64Array(n),r=s instanceof Float64Array?s:new Float64Array(s),o=i.length,a=r.length,u=Math.min(o,a);if(1!==i[0]){for(let t=0;t<o;t+=1)r[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),p=t.numberOfChannels;for(let e=0;e<p;e+=1){const n=t.getChannelData(e),s=h.getChannelData(e);c.fill(0),l.fill(0),Ut(i,o,r,a,u,c,l,0,32,n,s)}return h})(await i(t),l,r,o)})()}const t=await u;return h.buffer=t,h.start(0),h}return await s(c,l,p),p};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(cn,_t,je,Pe,zn),Ln=(t=>(e,n,s)=>{if(void 0===e.createIIRFilter)return t(e,n,s);const i=e.createIIRFilter(s.feedforward,s.feedback);return Xt(i,s),i})(jn),Un=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=i(a),c={...Lt,...o},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,s,i)=>{if(n.length!==s.length||s.length!==i.length)throw Wt();return e.call(t,n,s,i)})})(l),this._nativeIIRFilterNode=l,r(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(Ze,Ln,Wn,Fe,ze,gn),Hn=((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:p,forwardZ:d,positionX:f,positionY:_,positionZ:m,upX:g,upY:v,upZ:y}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),p=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),d=o(c);let f=!1,_=[0,0,-1,0,1,0],m=[0,0,0];const g=()=>{if(f)return;f=!0;const t=s(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[r(t,h,0),r(t,h,1),r(t,h,2),r(t,h,3),r(t,h,4),r(t,h,5)];e.some(((t,e)=>t!==_[e]))&&(l.setOrientation(...e),_=e);const n=[r(t,h,6),r(t,h,7),r(t,h,8)];n.some(((t,e)=>t!==m[e]))&&(l.setPosition(...n),m=n)},p.connect(t)},v=t=>e=>{e!==_[t]&&(_[t]=e,l.setOrientation(..._))},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setPosition(...m))},w=(e,s,r)=>{const o=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:s});o.connect(p,0,e),o.start(),Object.defineProperty(o.offset,"defaultValue",{get:()=>s});const l=t({context:u},d,o.offset,Q,Y);var h,f,_,m,v,y,w;return a(l,"value",(t=>()=>t.call(l)),(t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}g(),d&&r(e)})),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,d?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return g(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,d?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return g(),e}),l.exponentialRampToValueAtTime=(_=l.exponentialRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=_.apply(l,t);return g(),e}),l.linearRampToValueAtTime=(m=l.linearRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return g(),e}),l.setTargetAtTime=(v=l.setTargetAtTime,d?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return g(),e}),l.setValueAtTime=(y=l.setValueAtTime,d?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return g(),e}),l.setValueCurveAtTime=(w=l.setValueCurveAtTime,d?()=>{throw i()}:(...t)=>{const e=w.apply(l,t);return g(),e}),l};return{forwardX:w(0,0,v(0)),forwardY:w(1,0,v(1)),forwardZ:w(2,-1,v(2)),positionX:w(6,0,y(0)),positionY:w(7,0,y(1)),positionZ:w(8,0,y(2)),upX:w(3,0,v(3)),upY:w(4,1,v(4)),upZ:w(5,0,v(5))}})():l;return{get forwardX(){return h},get forwardY(){return p},get forwardZ(){return d},get positionX(){return f},get positionY(){return _},get positionZ(){return m},get upX(){return g},get upY(){return v},get upZ(){return y}}})(pn,bn,Sn,ue,ce,me,ze,ve),$n=new WeakMap,Gn=((t,e,n,s,i,r)=>class extends n{constructor(n,r){super(n),this._nativeContext=n,C.set(this,n),s(n)&&i.set(n,new Set),this._destination=new t(this,r),this._listener=e(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(t){const e="function"==typeof t?r(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(_n,Hn,Le,ze,$n,Ae),Xn=((t,e,n,s,i,r)=>(o,a)=>{const u=o.createOscillator();return Xt(u,a),Yt(u,a,"detune"),Yt(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Gt(u,a,"type"),e(n,(()=>n(o)))||Qt(u),e(s,(()=>s(o)))||r(u,o),e(i,(()=>i(o)))||Kt(u),t(o,u),u})(on,Ee,we,be,xe,Te),Zn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null,u=null;return{set periodicWave(t){o=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=r.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const p=H(h,l);if(!p){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===o?void 0:o,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return r.set(l,h),p?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await s(l,c.detune,h.detune),await s(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(un,Xn,_t,ln,Pe),Yn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...he,...o},c=n(a,u),l=r(a),h=l?s():null,p=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,p,-p),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Ze,pn,Xn,Zn,Fe,ze,Ae),Qn=(t=>(e,n)=>{const s=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return s.buffer=i,s.loop=!0,s.connect(n),s.start(),()=>{s.stop(),s.disconnect(n)}})(cn),Kn=((t,e,n,s,i)=>(r,{curve:o,oversample:a,...u})=>{const c=r.createWaveShaper(),l=r.createWaveShaper();Xt(c,u),Xt(l,u);const h=n(r,{...u,gain:1}),p=n(r,{...u,gain:-1}),d=n(r,{...u,gain:1}),f=n(r,{...u,gain:-1});let _=null,m=!1,g=null;const v={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,p.channelCount=t,c.channelCount=t,d.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,p.channelCountMode=t,c.channelCountMode=t,d.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,p.channelInterpretation=t,c.channelInterpretation=t,d.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return g},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),s=new Float32Array(t+2-t%2);e[0]=n[0],s[0]=-n[t-1];const i=Math.ceil((t+1)/2),r=(t+1)/2-1;for(let o=1;o<i;o+=1){const a=o/i*r,u=Math.floor(a),c=Math.ceil(a);e[o]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],s[o]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=s}g=n,m&&(s(g)&&null===_?_=t(r,h):null!==_&&(_(),_=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==o&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==v.oversample&&(v.oversample=a);return i(se(v,d),(()=>{h.connect(c).connect(d),h.connect(p).connect(l).connect(f).connect(d),m=!0,s(g)&&(_=t(r,h))}),(()=>{h.disconnect(c),c.disconnect(d),h.disconnect(p),p.disconnect(l),l.disconnect(f),f.disconnect(d),m=!1,null!==_&&(_(),_=null)}))})(Qn,zt,re,ge,yn),Jn=((t,e,n,s,i,r,o)=>(a,u)=>{const c=a.createWaveShaper();if(null!==r&&"webkitAudioContext"===r.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Xt(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Gt(c,{curve:l},"curve"),Gt(c,u,"oversample");let h=null,p=!1;o(c,"curve",(t=>()=>t.call(c)),(e=>n=>(e.call(c,n),p&&(s(n)&&null===h?h=t(a,c):s(n)||null===h||(h(),h=null)),n)));return i(c,(()=>{p=!0,s(c.curve)&&(h=t(a,c))}),(()=>{p=!1,null!==h&&(h(),h=null)}))})(Qn,zt,Kn,ge,yn,Ue,ve),ts=((t,e,n,s,i,r,o,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:p,coneOuterGain:d,distanceModel:f,maxDistance:_,orientationX:m,orientationY:g,orientationZ:v,panningModel:y,positionX:w,positionY:b,positionZ:x,refDistance:T,rolloffFactor:A,...k})=>{const C=l.createPanner();if(k.channelCount>2)throw o();if("max"===k.channelCountMode)throw o();Xt(C,k);const S={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...S,channelInterpretation:"speakers",numberOfInputs:6}),M=s(l,{...k,gain:1}),E=s(l,{...S,gain:1}),D=s(l,{...S,gain:0}),I=s(l,{...S,gain:0}),R=s(l,{...S,gain:0}),N=s(l,{...S,gain:0}),B=s(l,{...S,gain:0}),P=i(l,256,6,1),V=r(l,{...S,curve:new Float32Array([1,1]),oversample:"none"});let F=[m,g,v],q=[w,b,x];const j=new Float32Array(1);P.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,j,0),u(t,j,1),u(t,j,2)];e.some(((t,e)=>t!==F[e]))&&(C.setOrientation(...e),F=e);const n=[u(t,j,3),u(t,j,4),u(t,j,5)];n.some(((t,e)=>t!==q[e]))&&(C.setPosition(...n),q=n)},Object.defineProperty(D.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(B.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(t){if(t>2)throw o();M.channelCount=t,C.channelCount=t},get channelCountMode(){return C.channelCountMode},set channelCountMode(t){if("max"===t)throw o();M.channelCountMode=t,C.channelCountMode=t},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(t){M.channelInterpretation=t,C.channelInterpretation=t},get coneInnerAngle(){return C.coneInnerAngle},set coneInnerAngle(t){C.coneInnerAngle=t},get coneOuterAngle(){return C.coneOuterAngle},set coneOuterAngle(t){C.coneOuterAngle=t},get coneOuterGain(){return C.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();C.coneOuterGain=t},get context(){return C.context},get distanceModel(){return C.distanceModel},set distanceModel(t){C.distanceModel=t},get inputs(){return[M]},get maxDistance(){return C.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;C.maxDistance=t},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get orientationX(){return E.gain},get orientationY(){return D.gain},get orientationZ(){return I.gain},get panningModel(){return C.panningModel},set panningModel(t){C.panningModel=t},get positionX(){return R.gain},get positionY(){return N.gain},get positionZ(){return B.gain},get refDistance(){return C.refDistance},set refDistance(t){if(t<0)throw new RangeError;C.refDistance=t},get rolloffFactor(){return C.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;C.rolloffFactor=t},addEventListener:(...t)=>M.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>M.dispatchEvent(t[0]),removeEventListener:(...t)=>M.removeEventListener(t[0],t[1],t[2])};h!==z.coneInnerAngle&&(z.coneInnerAngle=h),p!==z.coneOuterAngle&&(z.coneOuterAngle=p),d!==z.coneOuterGain&&(z.coneOuterGain=d),f!==z.distanceModel&&(z.distanceModel=f),_!==z.maxDistance&&(z.maxDistance=_),m!==z.orientationX.value&&(z.orientationX.value=m),g!==z.orientationY.value&&(z.orientationY.value=g),v!==z.orientationZ.value&&(z.orientationZ.value=v),y!==z.panningModel&&(z.panningModel=y),w!==z.positionX.value&&(z.positionX.value=w),b!==z.positionY.value&&(z.positionY.value=b),x!==z.positionZ.value&&(z.positionZ.value=x),T!==z.refDistance&&(z.refDistance=T),A!==z.rolloffFactor&&(z.rolloffFactor=A),1===F[0]&&0===F[1]&&0===F[2]||C.setOrientation(...F),0===q[0]&&0===q[1]&&0===q[2]||C.setPosition(...q);return c(se(z,C),(()=>{M.connect(C),t(M,V,0,0),V.connect(E).connect(O,0,0),V.connect(D).connect(O,0,1),V.connect(I).connect(O,0,2),V.connect(R).connect(O,0,3),V.connect(N).connect(O,0,4),V.connect(B).connect(O,0,5),O.connect(P).connect(l.destination)}),(()=>{M.disconnect(C),a(M,V,0,0),V.disconnect(E),E.disconnect(O),V.disconnect(D),D.disconnect(O),V.disconnect(I),I.disconnect(O),V.disconnect(R),R.disconnect(O),V.disconnect(N),N.disconnect(O),V.disconnect(B),B.disconnect(O),O.disconnect(P),P.disconnect(l.destination)}))})(lt,zt,bn,re,ue,Jn,ce,ft,me,yn),es=(t=>(e,n)=>{const s=e.createPanner();return void 0===s.orientationX?t(e,n):(Xt(s,n),Yt(s,n,"orientationX"),Yt(s,n,"orientationY"),Yt(s,n,"orientationZ"),Yt(s,n,"positionX"),Yt(s,n,"positionY"),Yt(s,n,"positionZ"),Gt(s,n,"coneInnerAngle"),Gt(s,n,"coneOuterAngle"),Gt(s,n,"coneOuterGain"),Gt(s,n,"distanceModel"),Gt(s,n,"maxDistance"),Gt(s,n,"panningModel"),Gt(s,n,"refDistance"),Gt(s,n,"rolloffFactor"),s)})(ts),ns=((t,e,n,s,i,r,o,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(p,d){const f=l.get(d);return void 0!==f?Promise.resolve(f):(async(p,d)=>{let f=null,_=r(p);const m={channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation},g={...m,coneInnerAngle:_.coneInnerAngle,coneOuterAngle:_.coneOuterAngle,coneOuterGain:_.coneOuterGain,distanceModel:_.distanceModel,maxDistance:_.maxDistance,panningModel:_.panningModel,refDistance:_.refDistance,rolloffFactor:_.rolloffFactor},v=H(_,d);if("bufferSize"in _)f=s(d,{...m,gain:1});else if(!v){const t={...g,orientationX:_.orientationX.value,orientationY:_.orientationY.value,orientationZ:_.orientationZ.value,positionX:_.positionX.value,positionY:_.positionY.value,positionZ:_.positionZ.value};_=i(d,t)}if(l.set(d,null===f?_:f),null!==f){if(null===h){if(null===o)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new o(6,p.context.length,d.sampleRate),s=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});s.connect(t.destination),h=(async()=>{const e=await Promise.all([p.orientationX,p.orientationY,p.orientationZ,p.positionX,p.positionY,p.positionZ].map((async(e,s)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===s?1:0});return await a(t,e,i.offset),i})));for(let t=0;t<6;t+=1)e[t].connect(s,0,t),e[t].start(0);return c(t)})()}const t=await h,r=s(d,{...m,gain:1});await u(p,d,r);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let _=[l[0][0],l[1][0],l[2][0]],v=[l[3][0],l[4][0],l[5][0]],y=s(d,{...m,gain:1}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]});r.connect(y).connect(w.inputs[0]),w.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some(((t,e)=>t!==_[e]))||n.some(((t,e)=>t!==v[e]))){_=t,v=n;const o=e/d.sampleRate;y.gain.setValueAtTime(0,o),y=s(d,{...m,gain:0}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),r.connect(y).connect(w.inputs[0]),w.connect(f)}}return f}return v?(await t(d,p.orientationX,_.orientationX),await t(d,p.orientationY,_.orientationY),await t(d,p.orientationZ,_.orientationZ),await t(d,p.positionX,_.positionX),await t(d,p.positionY,_.positionY),await t(d,p.positionZ,_.positionZ)):(await a(d,p.orientationX,_.orientationX),await a(d,p.orientationY,_.orientationY),await a(d,p.orientationZ,_.orientationZ),await a(d,p.positionX,_.positionX),await a(d,p.positionY,_.positionY),await a(d,p.positionZ,_.positionZ)),ct(_)?await u(p,d,_.inputs[0]):await u(p,d,_),_})(p,d)}}})(un,bn,Sn,re,es,_t,je,ln,Pe,zn),ss=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...pe,...a},l=n(u,c),h=r(u);super(t,!1,l,h?s():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Q,Y),this._orientationY=e(this,h,l.orientationY,Q,Y),this._orientationZ=e(this,h,l.orientationZ,Q,Y),this._positionX=e(this,h,l.positionX,Q,Y),this._positionY=e(this,h,l.positionY,Q,Y),this._positionZ=e(this,h,l.positionZ,Q,Y),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(Ze,pn,es,ns,Fe,ze,gn),is=(t=>(e,{disableNormalization:n,imag:s,real:i})=>{const r=s instanceof Float32Array?s:new Float32Array(s),o=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(o,r,{disableNormalization:n});if(Array.from(s).length<2)throw t();return a})(G),rs=((t,e,n,s)=>class i{constructor(i,r){const o=e(i),a=s({...de,...r}),u=t(o,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(is,Fe,new WeakSet,(t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,(()=>0))}:{...t,imag:e,real:n}})),os=((t,e,n,s,i,r)=>{const o=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,r,h,p,d)=>{if(1===r)return((t,e,i,r)=>{const h=new Float32Array(o),p=new Float32Array(o);for(let t=0;t<o;t+=1){const e=t/16384*u;h[t]=Math.cos(e),p[t]=Math.sin(e)}const d=n(t,{...c,gain:0}),f=s(t,{...l,curve:h}),_=s(t,{...l,curve:a}),m=n(t,{...c,gain:0}),g=s(t,{...l,curve:p});return{connectGraph(){e.connect(d),e.connect(void 0===_.inputs?_:_.inputs[0]),e.connect(m),_.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===g.inputs?g:g.inputs[0]),f.connect(d.gain),g.connect(m.gain),d.connect(r,0,0),m.connect(r,0,1)},disconnectGraph(){e.disconnect(d),e.disconnect(void 0===_.inputs?_:_.inputs[0]),e.disconnect(m),_.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===g.inputs?g:g.inputs[0]),f.disconnect(d.gain),g.disconnect(m.gain),d.disconnect(r,0,0),m.disconnect(r,0,1)}}})(t,h,p,d);if(2===r)return((t,i,r,h)=>{const p=new Float32Array(o),d=new Float32Array(o),f=new Float32Array(o),_=new Float32Array(o),m=Math.floor(8192.5);for(let t=0;t<o;t+=1)if(t>m){const e=(t-m)/(16384-m)*u;p[t]=Math.cos(e),d[t]=Math.sin(e),f[t]=0,_[t]=1}else{const e=t/(16384-m)*u;p[t]=1,d[t]=0,f[t]=Math.cos(e),_[t]=Math.sin(e)}const g=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),v=n(t,{...c,gain:0}),y=s(t,{...l,curve:p}),w=n(t,{...c,gain:0}),b=s(t,{...l,curve:d}),x=s(t,{...l,curve:a}),T=n(t,{...c,gain:0}),A=s(t,{...l,curve:f}),k=n(t,{...c,gain:0}),C=s(t,{...l,curve:_});return{connectGraph(){i.connect(g),i.connect(void 0===x.inputs?x:x.inputs[0]),g.connect(v,0),g.connect(w,0),g.connect(T,1),g.connect(k,1),x.connect(r),r.connect(void 0===y.inputs?y:y.inputs[0]),r.connect(void 0===b.inputs?b:b.inputs[0]),r.connect(void 0===A.inputs?A:A.inputs[0]),r.connect(void 0===C.inputs?C:C.inputs[0]),y.connect(v.gain),b.connect(w.gain),A.connect(T.gain),C.connect(k.gain),v.connect(h,0,0),T.connect(h,0,0),w.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(g),i.disconnect(void 0===x.inputs?x:x.inputs[0]),g.disconnect(v,0),g.disconnect(w,0),g.disconnect(T,1),g.disconnect(k,1),x.disconnect(r),r.disconnect(void 0===y.inputs?y:y.inputs[0]),r.disconnect(void 0===b.inputs?b:b.inputs[0]),r.disconnect(void 0===A.inputs?A:A.inputs[0]),r.disconnect(void 0===C.inputs?C:C.inputs[0]),y.disconnect(v.gain),b.disconnect(w.gain),A.disconnect(T.gain),C.disconnect(k.gain),v.disconnect(h,0,0),T.disconnect(h,0,0),w.disconnect(h,0,1),k.disconnect(h,0,1)}}})(t,h,p,d);throw i()};return(e,{channelCount:s,channelCountMode:o,pan:a,...u})=>{if("max"===o)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:o,numberOfInputs:2}),l=n(e,{...u,channelCount:s,channelCountMode:o,gain:1}),p=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:d,disconnectGraph:f}=h(e,s,l,p,c);Object.defineProperty(p.gain,"defaultValue",{get:()=>0}),Object.defineProperty(p.gain,"maxValue",{get:()=>1}),Object.defineProperty(p.gain,"minValue",{get:()=>-1});const _={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(m&&f(),({connectGraph:d,disconnectGraph:f}=h(e,t,l,p,c)),m&&d()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return p.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let m=!1;return r(se(_,c),(()=>{d(),m=!0}),(()=>{f(),m=!1}))}})(bn,ne,re,Jn,ce,yn),as=((t,e)=>(n,s)=>{const i=s.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,s);const r=n.createStereoPanner();return Xt(r,s),Yt(r,s,"pan"),Object.defineProperty(r,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),r})(os,ce),us=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.pan,u.pan):await s(a,o.pan,u.pan),ct(u)?await i(o,a,u.inputs[0]):await i(o,a,u),u})(o,a)}}})(un,as,_t,ln,Pe),cs=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...fe,...o},c=n(a,u),l=r(a);super(t,!1,c,l?s():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(Ze,pn,as,us,Fe,ze),ls=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(Jn,_t,Pe),hs=((t,e,n,s,i,r,o)=>class extends t{constructor(t,e){const a=i(t),u={..._e,...e},c=n(a,u);super(t,!0,c,r(a)?s():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(Ze,zt,Jn,ls,Fe,ze,gn),ps=(t=>null!==t&&t.isSecureContext)(Re),ds=(t=>(e,n,s)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return s()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Re),fs=new WeakMap,_s=((t,e)=>n=>{let s=t.get(n);if(void 0!==s)return s;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return s=new e(1,1,44100),t.set(n,s),s})(fs,je),ms=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{let d=0;return(f,_,m={credentials:"omit"})=>{const g=l.get(f);if(void 0!==g&&g.has(_))return Promise.resolve();const v=c.get(f);if(void 0!==v){const t=v.get(_);if(void 0!==t)return t}const y=r(f),w=void 0===y.audioWorklet?i(_).then((([t,e])=>{const[s,i]=R(t,e);return n(`${s};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const t=p._AWGS.pop();if(void 0===t)throw new SyntaxError;s(y.currentTime,y.sampleRate,(()=>t(class{},void 0,((t,n)=>{if(""===t.trim())throw e();const s=M.get(y);if(void 0!==s){if(s.has(t))throw e();B(n),N(n.parameterDescriptors),s.set(t,n)}else B(n),N(n.parameterDescriptors),M.set(y,new Map([[t,n]]))}),y.sampleRate,void 0,void 0)))})):Promise.all([i(_),Promise.resolve(t(h,h))]).then((([[t,e],n])=>{const s=d+1;d=s;const[i,r]=R(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${r}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${s}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return y.audioWorklet.addModule(l,m).then((()=>{if(a(y))return y;const t=o(y);return t.audioWorklet.addModule(l,m).then((()=>t))})).then((t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${s}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(l)))}));return void 0===v?c.set(f,new Map([[_,w]])):v.set(_,w),w.then((()=>{const t=l.get(f);void 0===t?l.set(f,new Set([_])):t.add(_)})).finally((()=>{const t=c.get(f);void 0!==t&&t.delete(_)})),w}})(Ee,ce,(t=>e=>new Promise(((n,s)=>{if(null===t)return void s(new SyntaxError);const i=t.document.head;if(null===i)s(new SyntaxError);else{const r=t.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,r,o)=>n===a||n===t.location.href&&1===i&&1===r?(c(),s(o),!1):null!==u?u(e,n,i,r,o):void 0,r.onerror=()=>{c(),s(new SyntaxError)},r.onload=()=>{c(),n()},r.src=a,r.type="module",i.appendChild(r)}})))(Re),ds,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})((()=>new DOMException("","AbortError"))),Fe,_s,ze,Xe,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),s=new e(1,128,44100),i=URL.createObjectURL(n);let r=!1,o=!1;try{await s.audioWorklet.addModule(i);const e=new t(s,"a",{numberOfOutputs:0}),n=s.createOscillator();e.port.onmessage=()=>r=!0,e.onprocessorerror=()=>o=!0,n.connect(e),n.start(0),await s.startRendering(),await new Promise((t=>setTimeout(t)))}catch{}finally{URL.revokeObjectURL(i)}return r&&!o})(Xe,je),Re):void 0,gs=((t,e)=>n=>t(n)||e(n))(He,ze),vs=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=o(h)?h:r(h);if(i.has(p)){const t=n();return Promise.reject(t)}try{i.add(p)}catch{}return e(u,(()=>u(d)))?d.decodeAudioData(p).then((n=>(Pt(p).catch((()=>{})),e(a,(()=>a(n)))||l(n),t.add(n),n))):new Promise(((e,n)=>{const i=async()=>{try{await Pt(p)}catch{}},r=t=>{n(t),i()};try{d.decodeAudioData(p,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),X(n)),t.add(n),i().then((()=>e(n)))}),(t=>{r(null===t?s():t)}))}catch(t){r(t)}}))})(Ke,Ee,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,Fe,gs,$,$t,nn,sn),ys=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_,m,g,v,y)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,s){return new n({length:e,numberOfChannels:t,sampleRate:s})}createBufferSource(){return new s(this)}createChannelMerger(t=6){return new r(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new o(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new p(this)}createIIRFilter(t,e){return new d(this,{feedback:e,feedforward:t})}createOscillator(){return new _(this)}createPanner(){return new m(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new g(this,{...n,imag:e,real:t})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then((t=>("function"==typeof e&&e(t),t)),(t=>{throw"function"==typeof n&&n(t),t}))}})(ms,Qe,rn,fn,vn,Tn,kn,Mn,In,vs,Nn,Vn,qn,Un,Gn,Yn,ss,rs,cs,hs),ws=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw TypeError();super(t,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Ze,((t,e)=>t.createMediaElementSource(e.mediaElement)),Fe,ze),bs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t);if(s(r))throw new TypeError;const o={...Ht,...i},a=e(r,o);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Ze,((t,e)=>{const n=t.createMediaStreamDestination();return Xt(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),Fe,ze),xs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw new TypeError;super(t,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Ze,((t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort(((t,e)=>t.id<e.id?-1:t.id>e.id?1:0));const s=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(i,"mediaStream",{value:e}),i}),Fe,ze),Ts=((t,e)=>(n,{mediaStreamTrack:s})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(s);const i=new MediaStream([s]),r=n.createMediaStreamSource(i);if("audio"!==s.kind)throw t();if(e(n))throw new TypeError;return r})(zt,ze),As=((t,e,n)=>class extends t{constructor(t,s){const i=n(t);super(t,!0,e(i,s),null)}})(Ze,Ts,Fe),ks=((t,e,n,s,i,r,o,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw s();if(!(t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t))(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:r}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/r:"interactive"===i||void 0===i?256/r:"playback"===i?1024/r:128*Math.max(2,Math.min(128,Math.round(i*r/128)))/r,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw e()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),st(this)})))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new r(this)}createMediaStreamSource(t){return new o(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise(((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((t=>{if(void 0===t||15===t.code)throw e();throw t}))}suspend(){return this._nativeAudioContext.suspend().catch((t=>{if(void 0===t)throw e();throw t}))}})(ys,zt,ce,(()=>new DOMException("","UnknownError")),ws,bs,xs,As,Ue),Cs=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})($n),Ss=(t=>(e,n)=>{t(e).add(n)})(Cs),Os=(t=>(e,n,s=0,i=0)=>{const r=e[s];if(void 0===r)throw t();return bt(n)?r.connect(n,0,i):r.connect(n,0)})(G),Ms=(t=>(e,n)=>{t(e).delete(n)})(Cs),Es=(t=>(e,n=void 0,s=void 0,i=0)=>void 0===n?e.forEach((t=>t.disconnect())):"number"==typeof n?Ft(t,e,n).disconnect():bt(n)?void 0===s?e.forEach((t=>t.disconnect(n))):void 0===i?Ft(t,e,s).disconnect(n,0):Ft(t,e,s).disconnect(n,0,i):void 0===s?e.forEach((t=>t.disconnect(n))):Ft(t,e,s).disconnect(n,0))(G),Ds=new WeakMap,Is=((t,e)=>n=>e(t,n))(Ds,P),Rs=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m)=>{if(0===m.numberOfInputs&&0===m.numberOfOutputs)throw u();const g=Array.isArray(m.outputChannelCount)?m.outputChannelCount:Array.from(m.outputChannelCount);if(g.some((t=>t<1)))throw u();if(g.length!==m.numberOfOutputs)throw e();if("explicit"!==m.channelCountMode)throw u();const v=m.channelCount*m.numberOfInputs,y=g.reduce(((t,e)=>t+e),0),w=void 0===_.parameterDescriptors?0:_.parameterDescriptors.length;if(v+w>6||y>6)throw u();const b=new MessageChannel,x=[],T=[];for(let t=0;t<m.numberOfInputs;t+=1)x.push(o(d,{channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation,gain:1})),T.push(i(d,{channelCount:m.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:m.channelCount}));const A=[];if(void 0!==_.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:s}of _.parameterDescriptors){const i=r(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==m.parameterData[s]?m.parameterData[s]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Q:e},minValue:{get:()=>void 0===n?Y:n}}),A.push(i)}const k=s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,v+w)}),C=Jt(f,d.sampleRate),S=a(d,C,v+w,Math.max(1,y)),O=i(d,{channelCount:Math.max(1,y),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,y)}),M=[];for(let t=0;t<m.numberOfOutputs;t+=1)M.push(s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:g[t]}));for(let t=0;t<m.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[t].connect(k,e,t*m.channelCount+e)}const D=new kt(void 0===_.parameterDescriptors?[]:_.parameterDescriptors.map((({name:t},e)=>{const n=A[e];return n.connect(k,0,v+e),n.start(0),[t,n.offset]})));k.connect(S);let I=m.channelInterpretation,R=null;const N=0===m.numberOfOutputs?[S]:M,B={get bufferSize(){return C},get channelCount(){return m.channelCount},set channelCount(t){throw n()},get channelCountMode(){return m.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return I},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;I=t},get context(){return S.context},get inputs(){return x},get numberOfInputs(){return m.numberOfInputs},get numberOfOutputs(){return m.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(t){"function"==typeof R&&B.removeEventListener("processorerror",R),R="function"==typeof t?t:null,"function"==typeof R&&B.addEventListener("processorerror",R)},get parameters(){return D},get port(){return b.port2},addEventListener:(...t)=>S.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,N),disconnect:c.bind(null,N),dispatchEvent:(...t)=>S.dispatchEvent(t[0]),removeEventListener:(...t)=>S.removeEventListener(t[0],t[1],t[2])},P=new Map;var V,F;b.port1.addEventListener=(V=b.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(d.currentTime,d.sampleRate,(()=>e(t)))},P.set(e,t[1]))}}return V.call(b.port1,t[0],t[1],t[2])}),b.port1.removeEventListener=(F=b.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return F.call(b.port1,t[0],t[1],t[2])});let q=null;Object.defineProperty(b.port1,"onmessage",{get:()=>q,set:t=>{"function"==typeof q&&b.port1.removeEventListener("message",q),q="function"==typeof t?t:null,"function"==typeof q&&(b.port1.addEventListener("message",q),b.port1.start())}}),_.prototype.port=b.port1;let j=null;const z=((t,e,n,s)=>{let i=E.get(t);void 0===i&&(i=new WeakMap,E.set(t,i));const r=te(n,s);return i.set(e,r),r})(d,B,_,m);z.then((t=>j=t));const W=Mt(m.numberOfInputs,m.channelCount),L=Mt(m.numberOfOutputs,g),U=void 0===_.parameterDescriptors?[]:_.parameterDescriptors.reduce(((t,{name:e})=>({...t,[e]:new Float32Array(128)})),{});let H=!0;const $=()=>{m.numberOfOutputs>0&&S.disconnect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.disconnect(n,e+s,s);e+=g[t]}},G=new Map;S.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==j){const n=h(B);for(let s=0;s<C;s+=128){for(let e=0;e<m.numberOfInputs;e+=1)for(let n=0;n<m.channelCount;n+=1)St(t,W[e],n,n,s);void 0!==_.parameterDescriptors&&_.parameterDescriptors.forEach((({name:e},n)=>{St(t,U,e,v+n,s)}));for(let t=0;t<m.numberOfInputs;t+=1)for(let e=0;e<g[t];e+=1)0===L[t][e].byteLength&&(L[t][e]=new Float32Array(128));try{const t=W.map(((t,e)=>{if(n[e].size>0)return G.set(e,C/128),t;const s=G.get(e);return void 0===s?[]:(t.every((t=>t.every((t=>0===t))))&&(1===s?G.delete(e):G.set(e,s-1)),t)})),i=l(d.currentTime+s/d.sampleRate,d.sampleRate,(()=>j.process(t,L,U)));H=i;for(let t=0,n=0;t<m.numberOfOutputs;t+=1){for(let i=0;i<g[t];i+=1)Ot(e,L[t],i,n+i,s);n+=g[t]}}catch(t){H=!1,B.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!H){for(let t=0;t<m.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[s].disconnect(k,e,t*m.channelCount+e)}if(void 0!==_.parameterDescriptors){const t=_.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=A[e];t.disconnect(k,0,v+e),t.stop()}}k.disconnect(S),S.onaudioprocess=null,X?$():J();break}}}};let X=!1;const Z=o(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),K=()=>S.connect(Z).connect(d.destination),J=()=>{S.disconnect(Z),Z.disconnect()};return K(),p(B,(()=>{if(H){J(),m.numberOfOutputs>0&&S.connect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.connect(n,e+s,s);e+=g[t]}}X=!0}),(()=>{H&&(K(),$()),X=!1}))})(Os,G,zt,bn,ne,Sn,re,ue,ce,Es,ds,Is,yn),Ns=((t,e,n,s,i)=>(r,o,a,u,c,l)=>{if(null!==a)try{const e=new a(r,u,l),s=new Map;let o=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>o,set:t=>{"function"==typeof o&&e.removeEventListener("processorerror",o),o="function"==typeof t?t:null,"function"==typeof o&&e.addEventListener("processorerror",o)}}}),e.addEventListener=(p=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=s.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},s.set(e,t[1]))}}return p.call(e,"error",t[1],t[2]),p.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=s.get(t[1]);void 0!==e&&(s.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(r.destination);return i(e,(()=>t.disconnect()),(()=>t.connect(r.destination)))}return e}catch(t){if(11===t.code)throw s();throw t}var h,p;if(void 0===c)throw s();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(r,o,c,l)})(zt,Rs,re,ce,yn),Bs=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>(m,g,v)=>{const y=new WeakMap;let w=null;return{render(b,x){a(x,b);const T=y.get(x);return void 0!==T?Promise.resolve(T):(async(a,b)=>{let x=l(a),T=null;const A=H(x,b),k=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(null===h){const t=k.reduce(((t,e)=>t+e),0),n=i(b,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),r=[];for(let t=0;t<a.numberOfOutputs;t+=1)r.push(s(b,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:k[t]}));const c=o(b,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1});c.connect=e.bind(null,r),c.disconnect=u.bind(null,r),T=[n,r,c]}else A||(x=new h(b,m));if(y.set(b,null===T?x:T[2]),null!==T){if(null===w){if(void 0===v)throw new Error("Missing the processor constructor.");if(null===p)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===v.parameterDescriptors?0:v.parameterDescriptors.length,n=t+e,u=async()=>{const u=new p(n,128*Math.ceil(a.context.length/128),b.sampleRate),c=[],l=[];for(let t=0;t<g.numberOfInputs;t+=1)c.push(o(u,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),l.push(i(u,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map((async t=>{const e=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await d(u,t,e.offset),e}))),m=s(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<g.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<g.channelCount;e+=1)l[t].connect(m,e,t*g.channelCount+e)}for(const[e,n]of h.entries())n.connect(m,0,t+e),n.start(0);return m.connect(u.destination),await Promise.all(c.map((t=>f(a,u,t)))),_(u)};w=Et(a,0===n?null:await u(),b,g,k,v,c)}const t=await w,e=n(b,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let s=0;s<k[t];s+=1)u.connect(n,e+s,s);e+=k[t]}return h}if(A)for(const[e,n]of a.parameters.entries())await t(b,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await d(b,e,x.parameters.get(t));return await f(a,b,x),x})(b,x)}}})(un,Os,cn,bn,ne,Sn,re,Ms,Es,ds,_t,Xe,je,ln,Pe,zn),Ps=(t=>e=>t.get(e))(fs),Vs=(t=>(e,n)=>{t.set(e,n)})(Ds),Fs=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p,d)=>class extends e{constructor(e,d,f){var _;const m=a(e),g=u(m),v=l({...Ct,...f});p(v);const y=M.get(m),w=null==y?void 0:y.get(d),b=g||"closed"!==m.state?m:null!==(_=o(m))&&void 0!==_?_:m,x=i(b,g?null:e.baseLatency,c,d,w,v);super(e,!0,x,g?s(d,v,w):null);const T=[];x.parameters.forEach(((t,e)=>{const s=n(this,g,t);T.push([e,s])})),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new kt(T),g&&t(m,this);const{activeInputs:A}=r(this);h(x,A)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?d(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Ss,Ze,pn,Bs,Ns,tt,Ps,Fe,ze,Xe,(t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},(()=>1))})),Vs,(t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}}),Ae):void 0,qs=((t,e)=>(n,s,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,s,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(ce,je),js=((t,e,n,s,i,r,o,a)=>(u,c)=>n(u).render(u,c).then((()=>Promise.all(Array.from(s(c)).map((t=>n(t).render(t,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(o(n),X(n)):e(r,(()=>r(n)))||a(n),t.add(n),n))))(Ke,Ee,Be,Cs,zn,$,nn,sn),zs=((t,e,n,s,i)=>class extends t{constructor(t,n,i){let r;if("number"==typeof t&&void 0!==n&&void 0!==i)r={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");r=t}const{length:o,numberOfChannels:a,sampleRate:u}={...le,...r},c=s(a,o,u);e($t,(()=>$t(c)))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=o,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally((()=>{this._state=null,st(this)})))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout((()=>this._waitForThePromiseToSettle(t)))}})(ys,Ee,zt,qs,js),Ws=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,He),Ls=((t,e)=>n=>t.has(n)||e(n))(T,$e),Us=((t,e)=>n=>t.has(n)||e(n))(k,Ge),Hs=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,ze);function $s(t,e){if(!t)throw new Error(e)}function Gs(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Xs(t){t.isOffline||"running"===t.state||Ys('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Zs=console;function Ys(...t){Zs.warn(...t)}function Qs(t){return void 0===t}function Ks(t){return!Qs(t)}function Js(t){return"number"==typeof t}function ti(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ei(t){return"boolean"==typeof t}function ni(t){return Array.isArray(t)}function si(t){return"string"==typeof t}function ii(t){return si(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}const ri="object"==typeof self?self:null,oi=ri&&(ri.hasOwnProperty("AudioContext")||ri.hasOwnProperty("webkitAudioContext"));function ai(t,e,n,s){var i,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r<3?i(o):r>3?i(e,n,o):i(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o}function ui(t,e,n,s){return new(n||(n=Promise))((function(i,r){function o(t){try{u(s.next(t))}catch(t){r(t)}}function a(t){try{u(s.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class ci{constructor(t,e,n){this._callback=t,this._type=e,this._updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout((()=>{this._createTimeout(),this._callback()}),1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&(clearTimeout(this._timeout),this._timeout=0),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){this._updateInterval=Math.max(t,128/44100),"worker"===this._type&&this._worker.postMessage(Math.max(1e3*t,1))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}function li(t){return Us(t)}function hi(t){return Ls(t)}function pi(t){return Hs(t)}function di(t){return Ws(t)}function fi(t){return t instanceof AudioBuffer}function _i(t,e){return"value"===t||li(e)||hi(e)||fi(e)}function mi(t,...e){if(!e.length)return t;const n=e.shift();if(ti(t)&&ti(n))for(const e in n)_i(e,n[e])?t[e]=n[e]:ti(n[e])?(t[e]||Object.assign(t,{[e]:{}}),mi(t[e],n[e])):Object.assign(t,{[e]:n[e]});return mi(t,...e)}function gi(t,e,n=[],s){const i={},r=Array.from(e);if(ti(r[0])&&s&&!Reflect.has(r[0],s)){Object.keys(r[0]).some((e=>Reflect.has(t,e)))||(mi(i,{[s]:r[0]}),n.splice(n.indexOf(s),1),r.shift())}if(1===r.length&&ti(r[0]))mi(i,r[0]);else for(let t=0;t<n.length;t++)Ks(r[t])&&(i[n[t]]=r[t]);return mi(t,i)}function vi(t,e){return Qs(t)?e:t}function yi(t,e){return e.forEach((e=>{Reflect.has(t,e)&&delete t[e]})),t}
|
|
2
2
|
/**
|
|
3
3
|
* Tone.js
|
|
4
4
|
* @author Yotam Mann
|
|
5
5
|
* @license http://opensource.org/licenses/MIT MIT License
|
|
6
6
|
* @copyright 2014-2019 Yotam Mann
|
|
7
|
-
*/class wi{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||ri&&this.toString()===ri.TONE_DEBUG_CLASS)&&function(...t){Zs.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}wi.version=t;const bi=1e-6;function xi(t,e){return t>e+bi}function Ti(t,e){return xi(t,e)||ki(t,e)}function Ai(t,e){return t+bi<e}function ki(t,e){return Math.abs(t-e)<bi}class Ci extends wi{constructor(){super(),this.name="Timeline",this._timeline=[];const t=gi(Ci.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if($s(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];$s(Ti(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(ki(this._timeline[e].time,t)){for(let n=e;n>=0&&ki(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ti(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const s=this._timeline.length;let i=s;if(s>0&&this._timeline[s-1][e]<=t)return s-1;for(;n<i;){let s=Math.floor(n+(i-n)/2);const r=this._timeline[s],o=this._timeline[s+1];if(ki(r[e],t)){for(let n=s;n<this._timeline.length;n++){if(!ki(this._timeline[n][e],t))break;s=n}return s}if(Ai(r[e],t)&&xi(o[e],t))return s;xi(r[e],t)?i=s:n=s+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let s=this._search(t),i=this._search(e);return-1!==s&&-1!==i?(this._timeline[s].time!==t&&(s+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,s,i)):-1===s&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&ki(this._timeline[n].time,t)){let s=n;for(let e=n;e>=0&&ki(this._timeline[e].time,t);e--)s=e;this._iterate((t=>{e(t)}),s,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Si=[];function Oi(t){Si.push(t)}const Mi=[];function Ei(t){Mi.push(t)}class Di extends wi{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach((t=>{Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)})),this}once(t,e){const n=(...s)=>{e(...s),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach((n=>{if(Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Qs(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}})),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,s=n.length;t<s;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach((e=>{const n=Object.getOwnPropertyDescriptor(Di.prototype,e);Object.defineProperty(t.prototype,e,n)}))}dispose(){return super.dispose(),this._events=void 0,this}}class Ii extends Di{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Ri extends Ii{constructor(){super(),this.name="Context",this._constants=new Map,this._timeouts=new Ci,this._timeoutIds=0,this._initialized=!1,this.isOffline=!1,this._workletModules=new Map;const t=gi(Ri.getDefaults(),arguments,["context"]);t.context?this._context=t.context:this._context=function(t){return new ks(t)}({latencyHint:t.latencyHint}),this._ticker=new ci(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this._setLatencyHint(t.latencyHint),this.lookAhead=t.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Si.forEach((e=>e(t))),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){$s(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){$s(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){$s(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){$s(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return $s(Ks(qs),"This node only works in a secure context (https or localhost)"),new qs(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){$s(Ks(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletModules.has(e)||this._workletModules.set(e,this.rawContext.audioWorklet.addModule(t)),yield this._workletModules.get(e)}))}workletsAreReady(){return ui(this,void 0,void 0,(function*(){const t=[];this._workletModules.forEach((e=>t.push(e))),yield Promise.all(t)}))}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get latencyHint(){return this._latencyHint}_setLatencyHint(t){let e=0;if(this._latencyHint=t,si(t))switch(t){case"interactive":e=.1;break;case"playback":e=.5;break;case"balanced":e=.25}this.lookAhead=e,this.updateInterval=e/2}get rawContext(){return this._context}now(){return this._context.currentTime+this.lookAhead}immediate(){return this._context.currentTime}resume(){return di(this._context)?this._context.resume():Promise.resolve()}close(){return ui(this,void 0,void 0,(function*(){var t;di(this._context)&&(yield this._context.close()),this._initialized&&(t=this,Mi.forEach((e=>e(t))))}))}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const s=this._context.createBufferSource();return s.channelCount=1,s.channelCountMode="explicit",s.buffer=e,s.loop=!0,s.start(0),this._constants.set(t,s),s}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map((t=>this._constants[t].disconnect())),this}_timeoutLoop(){const t=this.now();let e=this._timeouts.peek();for(;this._timeouts.length&&e&&e.time<=t;)e.callback(),this._timeouts.shift(),e=this._timeouts.peek()}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach((e=>{e.id===t&&this._timeouts.remove(e)})),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,s=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),s()},id:n,time:i+e})};return s(),n}}function Ni(t,e){ni(e)?e.forEach((e=>Ni(t,e))):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Bi(t,e){ni(e)?e.forEach((e=>Bi(t,e))):Object.defineProperty(t,e,{writable:!0})}const Pi=()=>{};class Vi extends wi{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Pi;const t=gi(Vi.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,t.url&&fi(t.url)||t.url instanceof Vi?this.set(t.url):si(t.url)&&this.load(t.url).catch(t.onerror)}static getDefaults(){return{onerror:Pi,onload:Pi,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zi().sampleRate}set(t){return t instanceof Vi?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return ui(this,void 0,void 0,(function*(){const e=Vi.load(t).then((t=>{this.set(t),this.onload(this)}));Vi.downloads.push(e);try{yield e}finally{const t=Vi.downloads.indexOf(e);Vi.downloads.splice(t,1)}return this}))}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ni(t)&&t[0].length>0,n=e?t.length:1,s=e?t[0].length:t.length,i=zi(),r=i.createBuffer(n,s,i.sampleRate),o=e||1!==n?t:[t];for(let t=0;t<n;t++)r.copyToChannel(o[t],t);return this._buffer=r,this}toMono(t){if(Js(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map((t=>t/e)),this.fromArray(t)}return this}toArray(t){if(Js(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){const n=Math.floor(t*this.sampleRate),s=Math.floor(e*this.sampleRate);$s(n<s,"The start time must be less than the end time");const i=s-n,r=zi().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)r.copyToChannel(this.getChannelData(t).subarray(n,s),t);return new Vi(r)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new Vi).fromArray(t)}static fromUrl(t){return ui(this,void 0,void 0,(function*(){const e=new Vi;return yield e.load(t)}))}static load(t){return ui(this,void 0,void 0,(function*(){const e=t.match(/\[([^\]\[]+\|.+)\]$/);if(e){const n=e[1].split("|");let s=n[0];for(const t of n)if(Vi.supportsType(t)){s=t;break}t=t.replace(e[0],s)}const n=""===Vi.baseUrl||Vi.baseUrl.endsWith("/")?Vi.baseUrl:Vi.baseUrl+"/",s=yield fetch(n+t);if(!s.ok)throw new Error(`could not load url: ${t}`);const i=yield s.arrayBuffer();return yield zi().decodeAudioData(i)}))}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return ui(this,void 0,void 0,(function*(){for(yield Promise.resolve();Vi.downloads.length;)yield Vi.downloads[0]}))}}Vi.baseUrl="",Vi.downloads=[];class qi extends Ri{constructor(){var t,e,n;super({clockSource:"offline",context:pi(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zs(t,e,n)),lookAhead:0,updateInterval:pi(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=pi(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return ui(this,void 0,void 0,(function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n==0&&(yield new Promise((t=>setTimeout(t,1))))}}))}render(t=!0){return ui(this,void 0,void 0,(function*(){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Vi(e)}))}close(){return Promise.resolve()}}const Fi=new class extends Ii{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){return Promise.resolve()}))}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let ji=Fi;function zi(){return ji===Fi&&oi&&Wi(new Ri),ji}function Wi(t){ji=di(t)?new Ri(t):pi(t)?new qi(t):t}if(ri&&!ri.TONE_SILENCE_LOGGING){const e=` * Tone.js ${"v"}${t} * `;console.log(`%c${e}`,"background: #000; color: #fff")}function Li(t){return Math.pow(2,t/12)}let Ui=440;function Hi(t){return Math.round($i(t))}function $i(t){return 69+12*Math.log2(t/Ui)}class Gi extends wi{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),s="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*s:this._beatsToUnits(4/n)*s},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let s=0;return t&&"0"!==t&&(s+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s+=this._beatsToUnits(parseFloat(n)/4)),s},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Gi&&this.fromType(this._val),Qs(this._val))return this._noArg();if(si(this._val)&&Qs(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(ti(this._val)){let t=0;for(const e in this._val)if(Ks(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(Ks(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return si(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Xi extends Gi{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Xi(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),s=this.valueOf();return s+(Math.round(s/n)*n-s)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],s=new Xi(this.context,e[0]).toSeconds();return e.forEach((e=>{const i=new Xi(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(s-t)&&(n=e,s=i)})),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let s=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=s.toString();i.length>3&&(s=parseFloat(parseFloat(i).toFixed(3)));return[n,e,s].join(":")}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())}toSeconds(){return this.valueOf()}toMidi(){return Hi(this.toFrequency())}_now(){return this.context.now()}}class Zi extends Xi{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return Ui}static set A4(t){!function(t){Ui=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Zi.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method(t,e){const n=Yi[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Zi.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let s=1;return t&&"0"!==t&&(s*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s*=this._beatsToUnits(parseFloat(n)/4)),s}}})}transpose(t){return new Zi(this.context,this.valueOf()*Li(t))}harmonize(t){return t.map((t=>this.transpose(t)))}toMidi(){return Hi(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Zi.A4);let n=Math.round(12*e)+57;const s=Math.floor(n/12);s<0&&(n+=-12*s);return Qi[n%12]+s.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return function(t){return Ui*Math.pow(2,(t-69)/12)}(t)}static ftom(t){return Hi(t)}}const Yi={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},Qi=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ki extends Xi{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Ji extends wi{constructor(){super();const t=gi(Ji.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zi()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return new Xi(this.context,t).toSeconds()}toFrequency(t){return new Zi(this.context,t).toFrequency()}toTicks(t){return new Ki(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach((n=>{Qs(t[n])&&delete e[n]})),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach((e=>{if(Reflect.has(this,e)){const n=this[e];Ks(n)&&Ks(n.value)&&Ks(n.setValueAtTime)?t[e]=n.value:n instanceof Ji?t[e]=n._getPartialProperties(t[e]):ni(n)||Js(n)||si(n)||ei(n)?t[e]=n:delete t[e]}})),t}set(t){return Object.keys(t).forEach((e=>{Reflect.has(this,e)&&Ks(this[e])&&(this[e]&&Ks(this[e].value)&&Ks(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Ji?this[e].set(t[e]):this[e]=t[e])})),this}}class tr extends Ci{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return Gs(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class er extends Ji{constructor(){super(gi(er.getDefaults(),arguments,["param","units","convert"])),this.name="Param",this.overridden=!1,this._minOutput=1e-7;const t=gi(er.getDefaults(),arguments,["param","units","convert"]);for($s(Ks(t.param)&&(li(t.param)||t.param instanceof er),"param must be an AudioParam");!li(t.param);)t.param=t.param._param;this._swappable=!!Ks(t.swappable)&&t.swappable,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new Ci(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,Ks(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Ji.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return Ks(this._minValue)?this._minValue:"time"===this.units||"frequency"===this.units||"normalRange"===this.units||"positive"===this.units||"transportTime"===this.units||"ticks"===this.units||"bpm"===this.units||"hertz"===this.units||"samples"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return Ks(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return Ks(this.maxValue)&&Ks(this.minValue)&&Gs(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),s=this._fromType(t);return $s(isFinite(s)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),s=this._events.get(e);let i=this._initialValue;if(null===s)i=this._initialValue;else if("setTargetAtTime"!==s.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=s.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=s.value;if("setTargetAtTime"===s.type){const e=this._events.getBefore(s.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(s.time,t,n.time,n.value,e):this._exponentialInterpolate(s.time,t,n.time,n.value,e)}else i=s.value;else{const t=this._events.getBefore(s.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===s.type&&(i=this._exponentialApproach(s.time,n,s.value,s.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:s,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,s),this._param.linearRampToValueAtTime(n,s),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=ki(n,0)?this._minOutput:n,this._assertRange(n);const s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:s,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,s),this._param.exponentialRampToValueAtTime(n,s),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const s=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,s),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const s=this._fromType(t);$s(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(s),$s(isFinite(s)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:s}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(s,i,n),this}setValueCurveAtTime(t,e,n,s=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*s;this.setValueAtTime(this._toType(i),e);const r=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*s;this.linearRampToValueAtTime(this._toType(i),e+n*r)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return $s(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));$s(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const s=this._events.get(e),i=this._events.getAfter(e);return s&&ki(s.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const s=this._events.getAfter(n.time),i=s?s.time:e+2,r=(i-e)/10;for(let n=e;n<i;n+=r)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,(e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)})),this}setParam(t){$s(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,s,i){return n+(e-n)*Math.exp(-(i-t)/s)}_linearInterpolate(t,e,n,s,i){return e+(i-t)/(n-t)*(s-e)}_exponentialInterpolate(t,e,n,s,i){return e*Math.pow(s/e,(i-t)/(n-t))}}class nr extends Ji{constructor(){super(...arguments),this.name="ToneAudioNode",this._internalChannels=[]}get numberOfInputs(){return Ks(this.input)?li(this.input)||this.input instanceof er?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Ks(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return Ks(t)&&(t instanceof nr||hi(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach((e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation}))}_getChannelProperties(){const t=this._getInternalNodes();$s(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return ir(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Ys("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return function(t,e,n=0,s=0){if(Ks(e))for(;e instanceof nr;)e=e.input;for(;!hi(t);)Ks(t.output)&&(t=t.output);li(e)?t.disconnect(e,n):hi(e)?t.disconnect(e,n,s):t.disconnect()}(this,t,e,n),this}chain(...t){return sr(this,...t),this}fan(...t){return t.forEach((t=>this.connect(t))),this}dispose(){return super.dispose(),Ks(this.input)&&(this.input instanceof nr?this.input.dispose():hi(this.input)&&this.input.disconnect()),Ks(this.output)&&(this.output instanceof nr?this.output.dispose():hi(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function sr(...t){const e=t.shift();t.reduce(((t,e)=>(t instanceof nr?t.connect(e):hi(t)&&ir(t,e),e)),e)}function ir(t,e,n=0,s=0){for($s(Ks(t),"Cannot connect from undefined node"),$s(Ks(e),"Cannot connect to undefined node"),(e instanceof nr||hi(e))&&$s(e.numberOfInputs>0,"Cannot connect to node with no inputs"),$s(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof nr||e instanceof er;)Ks(e.input)&&(e=e.input);for(;t instanceof nr;)Ks(t.output)&&(t=t.output);li(e)?t.connect(e,n):t.connect(e,n,s)}class rr extends nr{constructor(){super(gi(rr.getDefaults(),arguments,["gain","units"])),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode;const t=gi(rr.getDefaults(),arguments,["gain","units"]);this.gain=new er({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Ni(this,"gain")}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class or extends nr{constructor(t){super(t),this.onended=Pi,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rr({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(nr.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Pi})}_startGain(t,e=1){$s(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){$s(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.context.currentTime),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout((()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()}),this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Pi&&(this.onended(this),this.onended=Pi,!this.context.isOffline)){const t=()=>this.dispose();void 0!==window.requestIdleCallback?window.requestIdleCallback(t):setTimeout(t,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),$s(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.disconnect(),this}}class ar extends or{constructor(){super(gi(ar.getDefaults(),arguments,["offset"])),this.name="ToneConstantSource",this._source=this.context.createConstantSource();const t=gi(ar.getDefaults(),arguments,["offset"]);ir(this._source,this._gainNode),this.offset=new er({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(or.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ur extends nr{constructor(){super(gi(ur.getDefaults(),arguments,["value","units"])),this.name="Signal",this.override=!0;const t=gi(ur.getDefaults(),arguments,["value","units"]);this.output=this._constantSource=new ar({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return cr(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,s){return this._param.setValueCurveAtTime(t,e,n,s),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function cr(t,e,n,s){(e instanceof er||li(e)||e instanceof ur&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ur&&(e.overridden=!0)),ir(t,e,n,s)}class lr extends er{constructor(){super(gi(lr.getDefaults(),arguments,["value"])),this.name="TickParam",this._events=new Ci(1/0),this._multiplier=1;const t=gi(lr.getDefaults(),arguments,["value"]);this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(er.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const s=this._fromType(t),i=this._events.get(e),r=Math.round(Math.max(1/n,1));for(let t=0;t<=r;t++){const r=n*t+e,o=this._exponentialApproach(i.time,i.value,s,n,r);this.linearRampToValueAtTime(this._toType(o),r)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),s=this._events.get(e),i=Math.round(Math.max(10*(e-s.time),1)),r=(e-s.time)/i;for(let t=0;t<=i;t++){const i=r*t+s.time,o=this._exponentialInterpolate(s.time,s.value,e,n,i);this.linearRampToValueAtTime(this._toType(o),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Qs(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let s=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(s=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+s)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(e);return this.getTimeOfTick(s+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const s=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-s)/(n.time-e.time),r=Math.sqrt(Math.pow(s,2)-2*i*(e.ticks-t)),o=(-s+r)/i;return(o>0?o:(-s-r)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),s=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+s)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class hr extends ur{constructor(){super(gi(hr.getDefaults(),arguments,["value"])),this.name="TickSignal";const t=gi(hr.getDefaults(),arguments,["value"]);this.input=this._param=new lr({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ur.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class pr extends Ji{constructor(){super(gi(pr.getDefaults(),arguments,["frequency"])),this.name="TickSource",this._state=new tr,this._tickOffset=new Ci;const t=gi(pr.getDefaults(),arguments,["frequency"]);this.frequency=new hr({context:this.context,units:t.units,value:t.frequency}),Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Ji.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),Ks(e)&&this.setTicksAtTime(e,n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&this._state.setStateAtTime("paused",e),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),s={state:"paused",time:e};this._state.add(s);let i=n,r=0;return this._state.forEachBetween(n.time,e+this.sampleTime,(t=>{let e=i.time;const n=this._tickOffset.get(t.time);n&&n.time>=i.time&&(r=n.ticks,e=n.time),"started"===i.state&&"started"!==t.state&&(r+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),i=t})),this._state.remove(s),r}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);let s=e,i=0;return this._state.forEachBetween(e.time,t+this.sampleTime,(t=>{let e=s.time;const n=this._tickOffset.get(t.time);n&&n.time>=s.time&&(i=n.seconds,e=n.time),"started"===s.state&&"started"!==t.state&&(i+=t.time-e),s=t})),this._state.remove(n),i}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),s=this._state.get(e),i=Math.max(n.time,s.time),r=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(r)}forEachTickBetween(t,e,n){let s=this._state.get(t);this._state.forEachBetween(t,e,(e=>{s&&"started"===s.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(s.time,t),e.time-this.sampleTime,n),s=e}));let i=null;if(s&&"started"===s.state){const r=Math.max(s.time,t),o=this.frequency.getTicksAtTime(r),a=o-this.frequency.getTicksAtTime(s.time);let u=Math.ceil(a)-a;u=ki(u,1)?0:u;let c=this.frequency.getTimeOfTick(o+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this.frequency.dispose(),this}}class dr extends Ji{constructor(){super(gi(dr.getDefaults(),arguments,["callback","frequency"])),this.name="Clock",this.callback=Pi,this._lastUpdate=0,this._state=new tr("stopped"),this._boundLoop=this._loop.bind(this);const t=gi(dr.getDefaults(),arguments,["callback","frequency"]);this.callback=t.callback,this._tickSource=new pr({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Xs(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(s+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,(t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}})),this._tickSource.forEachTickBetween(t,e,((t,e)=>{this.callback(t,e)})))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Di.mixin(dr);let fr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["delayTime","maxDelay"])),this.name="Delay";const e=gi(t.getDefaults(),arguments,["delayTime","maxDelay"]),n=this.toSeconds(e.maxDelay);this._maxDelay=Math.max(n,this.toSeconds(e.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(n),this.delayTime=new er({context:this.context,param:this._delayNode.delayTime,units:"time",value:e.delayTime,minValue:0,maxValue:this.maxDelay}),Ni(this,"delayTime")}static getDefaults(){return Object.assign(nr.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}};class _r extends wi{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=gi(_r.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach((e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)}))}static getDefaults(){return{baseUrl:"",onerror:Pi,onload:Pi,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return $s(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every((([t,e])=>e.loaded))}add(t,e,n=Pi,s=Pi){return si(e)?this._buffers.set(t.toString(),new Vi(this.baseUrl+e,n,s)):this._buffers.set(t.toString(),new Vi(e,n,s)),this}dispose(){return super.dispose(),this._buffers.forEach((t=>t.dispose())),this._buffers.clear(),this}}class mr extends Ki{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class gr extends Ji{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Ci,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=t;){const e=this._events.shift();e&&t-e.time<=this.expiration&&e.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}Oi((t=>{t.draw=new gr({context:t})})),Ei((t=>{t.draw.dispose()}));class vr extends wi{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){$s(Ks(t.time),"Events must have a time property"),$s(Ks(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new yr(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,(t=>this.remove(t))),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),s=t.right;s&&(t.right=s.left,s.left=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),s=t.left;s&&(t.left=s.right,s.right=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse((t=>e.push(t))),e.forEach((e=>{e.event&&t(e.event)}))}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse((t=>t.dispose())),this._root=null,this}}class yr{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}let wr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["volume"])),this.name="Volume";const e=gi(t.getDefaults(),arguments,["volume"]);this.input=this.output=new rr({context:this.context,gain:e.volume,units:"decibels"}),this.volume=this.output.gain,Ni(this,"volume"),this._unmutedVolume=e.volume,this.mute=e.mute}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}};class br extends nr{constructor(){super(gi(br.getDefaults(),arguments)),this.name="Destination",this.input=new wr({context:this.context}),this.output=new rr({context:this.context}),this.volume=this.input.volume;const t=gi(br.getDefaults(),arguments);sr(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),sr(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Oi((t=>{t.destination=new br({context:t})})),Ei((t=>{t.destination.dispose()}));class xr extends wi{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ci({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class Tr{constructor(t,e){this.id=Tr._eventId++;const n=Object.assign(Tr.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=n.time}static getDefaults(){return{callback:Pi,once:!1,time:0}}invoke(t){this.callback&&(this.callback(t),this._once&&this.transport.clear(this.id))}dispose(){return this.callback=void 0,this}}Tr._eventId=0;class Ar extends Tr{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Ar.getDefaults(),e);this.duration=new mr(t.context,n.duration).valueOf(),this._interval=new mr(t.context,n.interval).valueOf(),this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Tr.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvents(t){const e=this.transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.time;const e=this.transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds())}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this}}class kr extends Ji{constructor(){super(gi(kr.getDefaults(),arguments)),this.name="Transport",this._loop=new xr(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ci,this._repeatedEvents=new vr,this._syncedSignals=[],this._swingAmount=0;const t=gi(kr.getDefaults(),arguments);this._ppq=t.ppq,this._clock=new dr({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),Ni(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Ji.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),s=Math.sin(n*Math.PI)*this._swingAmount;t+=new mr(this.context,2*this._swingTicks/3).toSeconds()*s}this._timeline.forEachAtTime(e,(e=>e.invoke(t)))}schedule(t,e){const n=new Tr(this,{callback:t,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,s=1/0){const i=new Ar(this,{callback:t,duration:new Xi(this.context,s).toTicks(),interval:new Xi(this.context,e).toTicks(),time:new Ki(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Tr(this,{callback:t,once:!0,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,(t=>this.clear(t.id))),this._repeatedEvents.forEachFrom(e,(t=>this.clear(t.id))),this}_bindClockEvents(){this._clock.on("start",((t,e)=>{e=new mr(this.context,e).toSeconds(),this.emit("start",t,e)})),this._clock.on("stop",(t=>{this.emit("stop",t)})),this._clock.on("pause",(t=>{this.emit("pause",t)}))}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return Ks(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ni(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Xi(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Xi(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new mr(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new mr(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),s=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",s),this._clock.setTicksAtTime(t,s),this.emit("start",s,this._clock.getSecondsAtTime(s))}else this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return Math.round(this._clock.getTicksAtTime(t))}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){if(!e){const n=this.now();if(0!==t.getValueAtTime(n)){const s=1/(60/this.bpm.getValueAtTime(n)/this.PPQ);e=t.getValueAtTime(n)/s}else e=0}const n=new rr(e);return this.bpm.connect(n),n.connect(t._param),this._syncedSignals.push({initial:t.value,ratio:n,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Bi(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Di.mixin(kr),Oi((t=>{t.transport=new kr({context:t})})),Ei((t=>{t.transport.dispose()}));class Cr extends nr{constructor(t){super(t),this.input=void 0,this._state=new tr("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Pi,this._syncedStop=Pi,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new wr({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,onstop:Pi,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let s=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(s=this._clampToCurrentTime(s),this._synced||"started"!==this._state.getValueAtTime(s))if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const t=this._state.get(s);t&&(t.offset=this.toSeconds(vi(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule((t=>{this._start(t,e,n)}),s);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else Xs(this.context),this._start(s,e,n);else $s(xi(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,e,n);return this}stop(t){let e=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||Ks(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(e>0){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const s=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-s),this._start(t,this.toSeconds(n.offset)+s,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach((t=>this.context.transport.clear(t))),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Pi,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Sr extends or{constructor(){super(gi(Sr.getDefaults(),arguments,["url","onload"])),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1;const t=gi(Sr.getDefaults(),arguments,["url","onload"]);ir(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new er({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new Vi(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(or.getDefaults(),{url:new Vi,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,s=1){$s(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,s),e=this.loop?vi(e,this.loopStart):vi(e,0);let r=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ti(r,t)&&(r=(r-e)%n+e),ki(r,this.buffer.duration)&&(r=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ai(r,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,r)),Ks(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Or extends Cr{constructor(){super(gi(Or.getDefaults(),arguments,["type"])),this.name="Noise",this._source=null;const t=gi(Or.getDefaults(),arguments,["type"]);this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if($s(t in Dr,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=Dr[this._type];this._source=new Sr({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const Mr=220500,Er={brown:null,pink:null,white:null},Dr={get brown(){if(!Er.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;let s=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;n[t]=(s+.02*e)/1.02,s=n[t],n[t]*=3.5}}Er.brown=(new Vi).fromArray(t)}return Er.brown},get pink(){if(!Er.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);let s,i,r,o,a,u,c;t[e]=n,s=i=r=o=a=u=c=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;s=.99886*s+.0555179*e,i=.99332*i+.0750759*e,r=.969*r+.153852*e,o=.8665*o+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=s+i+r+o+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}Er.pink=(new Vi).fromArray(t)}return Er.pink},get white(){if(!Er.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;for(let t=0;t<Mr;t++)n[t]=2*Math.random()-1}Er.white=(new Vi).fromArray(t)}return Er.white}};function Ir(t,e){return ui(this,void 0,void 0,(function*(){const n=e/t.context.sampleRate,s=new qi(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:s})).toDestination().start(0);return(yield s.render()).getChannelData(0)}))}class Rr extends or{constructor(){super(gi(Rr.getDefaults(),arguments,["frequency","type"])),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator];const t=gi(Rr.getDefaults(),arguments,["frequency","type"]);ir(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new er({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new er({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(or.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}let Nr=class t extends Cr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type"])),this.name="Oscillator",this._oscillator=null;const e=gi(t.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),Ni(this,"frequency"),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),Ni(this,"detune"),this._partials=e.partials,this._partialCount=e.partialCount,this._type=e.type,e.partialCount&&"custom"!==e.type&&(this._type=this.baseType+e.partialCount.toString()),this.phase=e.phase}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rr({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return t._periodicWaveCache.find((t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every(((t,e)=>n[e]===t)));var e,n}))}{const e=t._periodicWaveCache.find((t=>t.type===this._type&&t.phase===this._phase));return this._partialCount=e?e.partialCount:this._partialCount,e}}get type(){return this._type}set type(e){this._type=e;const n=-1!==["sine","square","sawtooth","triangle"].indexOf(e);if(0===this._phase&&n)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=e);else{const n=this._getCachedPeriodicWave();if(Ks(n)){const{partials:t,wave:e}=n;this._wave=e,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[n,s]=this._getRealImaginary(e,this._phase),i=this.context.createPeriodicWave(n,s);this._wave=i,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),t._periodicWaveCache.push({imag:s,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:n,type:this._type,wave:this._wave}),t._periodicWaveCache.length>100&&t._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){Gs(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach(((t,n)=>e[n]=t)),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const s=new Float32Array(n),i=new Float32Array(n);let r=1;if("custom"===t){if(r=this._partials.length+1,this._partialCount=this._partials.length,n=r,0===this._partials.length)return[s,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(r=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],r=Math.max(r,2),n=r):this._partialCount=0,this._partials=[]}for(let o=1;o<n;++o){const n=2/(o*Math.PI);let a;switch(t){case"sine":a=o<=r?1:0,this._partials[o-1]=a;break;case"square":a=1&o?2*n:0,this._partials[o-1]=a;break;case"sawtooth":a=n*(1&o?1:-1),this._partials[o-1]=a;break;case"triangle":a=1&o?n*n*2*(o-1>>1&1?-1:1):0,this._partials[o-1]=a;break;case"custom":a=this._partials[o-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(s[o]=-a*Math.sin(e*o),i[o]=a*Math.cos(e*o)):(s[o]=0,i[o]=0)}return[s,i]}_inverseFFT(t,e,n){let s=0;const i=t.length;for(let r=0;r<i;r++)s+=t[r]*Math.cos(r*n)+e[r]*Math.sin(r*n);return s}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const s=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*s),n);return i=-this._inverseFFT(t,e,this._phase)/n,r=-1,o=1,Math.max(Math.min(i,o),r);var i,r,o}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};Nr._periodicWaveCache=[];class Br extends nr{constructor(){super(Object.assign(gi(Br.getDefaults(),arguments,["context"])))}connect(t,e=0,n=0){return cr(this,t,e,n),this}}class Pr extends Br{constructor(){super(Object.assign(gi(Pr.getDefaults(),arguments,["mapping","length"]))),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper;const t=gi(Pr.getDefaults(),arguments,["mapping","length"]);ni(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ur.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let s=0,i=e;s<i;s++){const e=s/(i-1)*2-1;n[s]=t(e,s)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){$s(["none","2x","4x"].some((e=>e.includes(t))),"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Vr extends Br{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new Pr({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class qr extends ur{constructor(){super(Object.assign(gi(qr.getDefaults(),arguments,["value"]))),this.name="Multiply",this.override=!1;const t=gi(qr.getDefaults(),arguments,["value"]);this._mult=this.input=this.output=new rr({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class Fr extends Cr{constructor(){super(gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="AMOscillator",this._modulationScale=new Vr({context:this.context}),this._modulationNode=new rr({context:this.context});const t=gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),Ni(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class jr extends Cr{constructor(){super(gi(jr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="FMOscillator",this._modulationNode=new rr({context:this.context,gain:0});const t=gi(jr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new qr({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),Ni(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class zr extends Cr{constructor(){super(gi(zr.getDefaults(),arguments,["frequency","width"])),this.name="PulseOscillator",this._widthGate=new rr({context:this.context,gain:0}),this._thresh=new Pr({context:this.context,mapping:t=>t<=0?-1:1});const t=gi(zr.getDefaults(),arguments,["frequency","width"]);this.width=new ur({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),Ni(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Wr extends Cr{constructor(){super(gi(Wr.getDefaults(),arguments,["frequency","type","spread"])),this.name="FatOscillator",this._oscillators=[];const t=gi(Wr.getDefaults(),arguments,["frequency","type","spread"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach((e=>e.start(t)))}_stop(t){t=this.toSeconds(t),this._forEach((e=>e.stop(t)))}_restart(t){this._forEach((e=>e.restart(t)))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach((e=>e.type=t))}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach(((t,s)=>t.detune.value=e+n*s))}}get count(){return this._oscillators.length}set count(t){if(Gs(t,1),this._oscillators.length!==t){this._forEach((t=>t.dispose())),this._oscillators=[];for(let e=0;e<t;e++){const n=new Nr({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Pi});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach((t=>t.start()))}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach(((t,e)=>t.phase=this._phase+e/this.count*360))}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach((e=>e.baseType=t)),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach((e=>e.partials=t)))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach((e=>e.partialCount=t)),this._type=this._oscillators[0].type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach((t=>t.dispose())),this}}class Lr extends Cr{constructor(){super(gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"])),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new qr({context:this.context,value:2});const t=gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"]);this._pulse=new zr({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),Ni(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ur={am:Fr,fat:Wr,fm:jr,oscillator:Nr,pulse:zr,pwm:Lr};class Hr extends Cr{constructor(){super(gi(Hr.getDefaults(),arguments,["frequency","type"])),this.name="OmniOscillator";const t=gi(Hr.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),Ni(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Nr.getDefaults(),jr.getDefaults(),Fr.getDefaults(),Wr.getDefaults(),zr.getDefaults(),Lr.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some((t=>this._sourceType===t))&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ur[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout((()=>t.dispose()),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ur[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&si(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class $r extends ur{constructor(){super(Object.assign(gi($r.getDefaults(),arguments,["value"]))),this.override=!1,this.name="Add",this._sum=new rr({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,sr(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Gr extends Br{constructor(){super(Object.assign(gi(Gr.getDefaults(),arguments,["min","max"]))),this.name="Scale";const t=gi(Gr.getDefaults(),arguments,["min","max"]);this._mult=this.input=new qr({context:this.context,value:t.max-t.min}),this._add=this.output=new $r({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(Br.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}function Xr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(s,t,e),n.set(this,s)}})}}function Zr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(this.toSeconds(s),t,e),n.set(this,s)}})}}class Yr extends Cr{constructor(){super(gi(Yr.getDefaults(),arguments,["url","onload"])),this.name="Player",this._activeSources=new Set;const t=gi(Yr.getDefaults(),arguments,["url","onload"]);this._buffer=new Vi({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1,reverse:!1})}load(t){return ui(this,void 0,void 0,(function*(){return yield this._buffer.load(t),this._onload(),this}))}_onload(t=Pi){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?vi(e,this._loopStart):vi(e,0);const s=this.toSeconds(e),i=n;n=vi(n,Math.max(this._buffer.duration-s,0));let r=this.toSeconds(n);r/=this._playbackRate,t=this.toSeconds(t);const o=new Sr({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+r),this._state.setStateAtTime("stopped",t+r,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&Qs(i)?o.start(t,s):o.start(t,s,r-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach((t=>t.stop(e)))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){this._stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopStart=t}))}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopEnd=t}))}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach((e=>{e.loop=t})),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach((t=>t.cancelStop()))),this._activeSources.forEach((n=>{n.playbackRate.setValueAtTime(t,e)}))}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach((t=>t.dispose())),this._activeSources.clear(),this._buffer.dispose(),this}}ai([Zr(0)],Yr.prototype,"fadeIn",void 0),ai([Zr(0)],Yr.prototype,"fadeOut",void 0);class Qr extends Br{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new Pr({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Kr extends Br{constructor(){super(Object.assign(gi(Kr.getDefaults(),arguments,["value"]))),this.name="Pow";const t=gi(Kr.getDefaults(),arguments,["value"]);this._exponentScaler=this.input=this.output=new Pr({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(Br.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}let Jr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="Envelope",this._sig=new ur({context:this.context,value:0}),this.output=this._sig,this.input=void 0;const e=gi(t.getDefaults(),arguments,["attack","decay","sustain","release"]);this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve,this.decayCurve=e.decayCurve}static getDefaults(){return Object.assign(nr.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(si(t))return t;{let n;for(n in to)if(to[n][e]===t)return n;return t}}_setCurve(t,e,n){if(si(n)&&Reflect.has(to,n)){const s=to[n];ti(s)?"_decayCurve"!==t&&(this[t]=s[e]):this[t]=s}else{if(!ni(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._decayCurve}set decayCurve(t){$s(["linear","exponential"].some((e=>e===t)),`Invalid envelope curve: ${t}`),this._decayCurve=t}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const s=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let s=this._attackCurve;for(let t=1;t<s.length;t++)if(s[t-1]<=i&&i<=s[t]){s=this._attackCurve.slice(t),s[0]=i;break}this._sig.setValueCurveAtTime(s,t,n,e)}if(s&&this.sustain<1){const i=e*this.sustain,r=t+n;this.log("decay",r),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,s+r):this._sig.exponentialApproachValueAtTime(i,r,s)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):($s(ni(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return cr(this,t,e,n),this}asArray(t=1024){return ui(this,void 0,void 0,(function*(){const e=t/this.context.sampleRate,n=new qi(1,e,this.context.sampleRate),s=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=s+this.toSeconds(this.release),r=.1*i,o=i+r,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/o,decay:e*this.toSeconds(this.decay)/o,release:e*this.toSeconds(this.release)/o,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(s+r)/o,0);return(yield n.render()).getChannelData(0)}))}dispose(){return super.dispose(),this._sig.dispose(),this}};ai([Zr(0)],Jr.prototype,"attack",void 0),ai([Zr(0)],Jr.prototype,"decay",void 0),ai([Xr(0,1)],Jr.prototype,"sustain",void 0),ai([Zr(0)],Jr.prototype,"release",void 0);const to=(()=>{const t=128;let e,n;const s=[];for(e=0;e<t;e++)s[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const r=[];for(e=0;e<t;e++)r[e]=Math.ceil(e/127*5)/5;const o=[];for(e=0;e<t;e++)n=e/127,o[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,s=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(s*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:s,Out:(c=s,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:o,Out:u(o)},step:{In:r,Out:u(r)}};var c})();class eo extends nr{constructor(){super(gi(eo.getDefaults(),arguments)),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease;const t=gi(eo.getDefaults(),arguments);this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume")}static getDefaults(){return Object.assign(nr.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const s=t[e],i=this.context.transport.schedule((s=>{t[e]=s,n.apply(this,t)}),s);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach((t=>this.context.transport.clear(t))),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this}triggerAttackRelease(t,e,n,s){const i=this.toSeconds(n),r=this.toSeconds(e);return this.triggerAttack(t,i,s),this.triggerRelease(i+r),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class no extends eo{constructor(){super(gi(no.getDefaults(),arguments));const t=gi(no.getDefaults(),arguments);this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(eo.getDefaults(),{detune:0,onsilence:Pi,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const s=this.toSeconds(e);return this._triggerEnvelopeAttack(s,n),this.setNote(t,s),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),s=t instanceof Zi?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(s,t,n)}else this.frequency.setValueAtTime(s,n);return this}}ai([Zr(0)],no.prototype,"portamento",void 0);class so extends Jr{constructor(){super(gi(so.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rr({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class io extends no{constructor(){super(gi(io.getDefaults(),arguments)),this.name="Synth";const t=gi(io.getDefaults(),arguments);this.oscillator=new Hr(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new so(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Ni(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(no.getDefaults(),{envelope:Object.assign(yi(Jr.getDefaults(),Object.keys(nr.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(yi(Hr.getDefaults(),[...Object.keys(Cr.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class ro extends nr{constructor(){super(gi(ro.getDefaults(),arguments,["frequency","type"])),this.name="BiquadFilter";const t=gi(ro.getDefaults(),arguments,["frequency","type"]);this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new er({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new er({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new er({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new er({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const s=19980*Math.pow(n/t,2)+20;e[n]=s}const n=new Float32Array(t),s=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,s),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}let oo=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type","rolloff"])),this.name="Filter",this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this._filters=[];const e=gi(t.getDefaults(),arguments,["frequency","type","rolloff"]);this._filters=[],this.Q=new ur({context:this.context,units:"positive",value:e.Q}),this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),this.gain=new ur({context:this.context,units:"decibels",convert:!1,value:e.gain}),this._type=e.type,this.rolloff=e.rolloff,Ni(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach((e=>e.type=t))}get rolloff(){return this._rolloff}set rolloff(t){const e=Js(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let s=n.indexOf(e);$s(-1!==s,`rolloff can only be ${n.join(", ")}`),s+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach((t=>t.disconnect())),this._filters=new Array(s);for(let t=0;t<s;t++){const e=new ro({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,sr(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new ro({frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map((()=>1));return this._filters.forEach((()=>{e.getFrequencyResponse(t).forEach(((t,e)=>n[e]*=t))})),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach((t=>{t.dispose()})),Bi(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}};class ao extends Jr{constructor(){super(gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="FrequencyEnvelope";const t=gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"]);this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new Kr({context:this.context,value:t.exponent}),this._scale=this.output=new Gr({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(Jr.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Gs(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class uo extends io{constructor(){super(gi(uo.getDefaults(),arguments)),this.name="MembraneSynth",this.portamento=0;const t=gi(uo.getDefaults(),arguments);this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Ni(this,["oscillator","envelope"])}static getDefaults(){return mi(no.getDefaults(),io.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),s=this.toFrequency(t instanceof Zi?t.toFrequency():t),i=s*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(s,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ai([Xr(0)],uo.prototype,"octaves",void 0),ai([Zr(0)],uo.prototype,"pitchDecay",void 0);const co=new Set;function lo(t){co.add(t)}function ho(t,e){const n=`registerProcessor("${t}", ${e})`;co.add(n)}class po extends nr{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Pi;const e=URL.createObjectURL(new Blob([Array.from(co).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e,n).then((()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))}))}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}lo('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');lo("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");lo("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");ho("feedback-comb-filter",'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class fo extends eo{constructor(){super(gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls")),this.name="Sampler",this._activeSources=new Map;const t=gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),e={};Object.keys(t.urls).forEach((n=>{const s=parseInt(n,10);if($s(ii(n)||Js(s)&&isFinite(s),`url key is neither a note or midi pitch: ${n}`),ii(n)){const s=new Zi(this.context,n).toMidi();e[s]=t.urls[n]}else Js(s)&&isFinite(s)&&(e[s]=t.urls[s])})),this._buffers=new _r({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(eo.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Pi,onerror:Pi,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach((t=>{const s=$i(new Zi(this.context,t).toFrequency()),i=Math.round(s),r=s-i,o=this._findClosest(i),a=i-o,u=this._buffers.get(a),c=Li(o+r),l=new Sr({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ni(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}})),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach((t=>{const n=new Zi(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach((t=>{t.stop(e)})),this._activeSources.set(n,[])}})),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach((t=>{for(;t.length;){t.shift().stop(e)}})),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,s=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,s),ni(e)?($s(ni(t),"notes must be an array when duration is array"),t.forEach(((t,n)=>{const s=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(s))}))):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if($s(ii(t)||isFinite(t),`note must be a pitch or midi: ${t}`),ii(t)){const s=new Zi(this.context,t).toMidi();this._buffers.add(s,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach((t=>{t.forEach((t=>t.dispose()))})),this._activeSources.clear(),this}}ai([Zr(0)],fo.prototype,"attack",void 0),ai([Zr(0)],fo.prototype,"release",void 0);class _o extends Ji{constructor(){super(gi(_o.getDefaults(),arguments,["callback","value"])),this.name="ToneEvent",this._state=new tr("stopped"),this._startOffset=0;const t=gi(_o.getDefaults(),arguments,["callback","value"]);this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,(t=>{let e;if("started"===t.state){-1!==t.id&&this.context.transport.clear(t.id);const n=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||Js(this._loop)&&this._loop>1){e=1/0,Js(this._loop)&&(e=this._loop*this._getLoopDuration());const s=this._state.getAfter(n);null!==s&&(e=Math.min(e,s.time-n)),e!==1/0&&(this._state.setStateAtTime("stopped",n+e+1,{id:-1}),e=new mr(this.context,e));const i=new mr(this.context,this._getLoopDuration());t.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new mr(this.context,n),e)}else t.id=this.context.transport.schedule(this._tick.bind(this),new mr(this.context,n))}}))}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return"stopped"===this._state.getValueAtTime(e)&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if("started"===this._state.getValueAtTime(e)){this._state.setStateAtTime("stopped",e,{id:-1});const t=this._state.getBefore(e);let n=e;null!==t&&(n=t.time),this._rescheduleEvents(n)}return this}cancel(t){t=vi(t,-1/0);const e=this.toTicks(t);return this._state.forEachFrom(e,(t=>{this.context.transport.clear(t.id)})),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&"started"===this._state.getValueAtTime(e)){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let e=.02;ei(this.humanize)||(e=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*e}this.callback(t,this.value)}}_getLoopDuration(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(null!==e&&"started"===e.state){const n=this._getLoopDuration();return(t-e.time)%n/n}return 0}return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}}class mo extends _o{constructor(){super(gi(mo.getDefaults(),arguments,["callback","events"])),this.name="Part",this._state=new tr("stopped"),this._events=new Set;const t=gi(mo.getDefaults(),arguments,["callback","events"]);this._state.increasing=!0,t.events.forEach((t=>{ni(t)?this.add(t[0],t[1]):this.add(t)}))}static getDefaults(){return Object.assign(_o.getDefaults(),{events:[]})}start(t,e){const n=this.toTicks(t);if("started"!==this._state.getValueAtTime(n)){e=vi(e,this._loop?this._loopStart:0),e=this._loop?vi(e,this._loopStart):vi(e,0);const t=this.toTicks(e);this._state.add({id:-1,offset:t,state:"started",time:n}),this._forEach((e=>{this._startNote(e,n,t)}))}return this}_startNote(t,e,n){e-=n,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<n&&(e+=this._getLoopDuration()),t.start(new mr(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=n&&(t.loop=!1,t.start(new mr(this.context,e))):t.startOffset>=n&&t.start(new mr(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach((t=>{t.startOffset+=this._startOffset}))}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach((e=>{e.stop(t)})),this}at(t,e){const n=new Ki(this.context,t).toTicks(),s=new mr(this.context,1).toSeconds(),i=this._events.values();let r=i.next();for(;!r.done;){const t=r.value;if(Math.abs(n-t.startOffset)<s)return Ks(e)&&(t.value=e),t;r=i.next()}return Ks(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(t=(e=t).time);const n=this.toTicks(t);let s;return e instanceof _o?(s=e,s.callback=this._tick.bind(this)):s=new _o({callback:this._tick.bind(this),context:this.context,value:e}),s.startOffset=n,s.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(s),this._restartEvent(s),this}_restartEvent(t){this._state.forEach((e=>{"started"===e.state?this._startNote(t,e.time,e.offset):t.stop(new mr(this.context,e.time))}))}remove(t,e){return ti(t)&&t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),this._events.forEach((n=>{n.startOffset===t&&(Qs(e)||Ks(e)&&n.value===e)&&(this._events.delete(n),n.dispose())})),this}clear(){return this._forEach((t=>t.dispose())),this._events.clear(),this}cancel(t){return this._forEach((e=>e.cancel(t))),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach((e=>{e instanceof mo?e._forEach(t):t(e)})),this}_setAll(t,e){this._forEach((n=>{n[t]=e}))}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):"stopped"===t.state&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach((e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)}))}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach((e=>{e.loopEnd=t,this._testLoopBoundries(e)}))}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach((t=>{t.loopStart=this.loopStart,this._testLoopBoundries(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}}class go extends nr{constructor(){super(Object.assign(gi(go.getDefaults(),arguments,["fade"]))),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Qr({context:this.context}),this.a=new rr({context:this.context,gain:0}),this.b=new rr({context:this.context,gain:0}),this.output=new rr({context:this.context}),this._internalChannels=[this.a,this.b];const t=gi(go.getDefaults(),arguments,["fade"]);this.fade=new ur({context:this.context,units:"normalRange",value:t.fade}),Ni(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",ir(this._split,this.a.gain,0),ir(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(nr.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}let vo=class extends nr{constructor(t){super(t),this.name="Effect",this._dryWet=new go({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new rr({context:this.context}),this.effectReturn=new rr({context:this.context}),this.input=new rr({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],Ni(this,"wet")}static getDefaults(){return Object.assign(nr.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}};class yo extends nr{constructor(){super(Object.assign(gi(yo.getDefaults(),arguments,["pan"]))),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner;const t=gi(yo.getDefaults(),arguments,["pan"]);this.pan=new er({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",Ni(this,"pan")}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const wo="bit-crusher";ho(wo,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\n\t\t\t\tautomationRate: 'k-rate'\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, _channel, parameters) {\n\t\t\tconst step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");let bo=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["bits"])),this.name="BitCrusher";const e=gi(t.getDefaults(),arguments,["bits"]);this._bitCrusherWorklet=new xo({context:this.context,bits:e.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(vo.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}};class xo extends po{constructor(){super(gi(xo.getDefaults(),arguments)),this.name="BitCrusherWorklet";const t=gi(xo.getDefaults(),arguments);this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this.bits=new er({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(po.getDefaults(),{bits:12})}_audioWorkletName(){return wo}onReady(t){sr(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class To extends nr{constructor(){super(gi(To.getDefaults(),arguments,["channels"])),this.name="Merge";const t=gi(To.getDefaults(),arguments,["channels"]);this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign(nr.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}let Ao=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["distortion"])),this.name="Distortion";const e=gi(t.getDefaults(),arguments,["distortion"]);this._shaper=new Pr({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(vo.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(t){this._distortion=t;const e=100*t,n=Math.PI/180;this._shaper.setMap((t=>Math.abs(t)<.001?0:(3+e)*t*20*n/(Math.PI+e*Math.abs(t))))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}};class ko extends vo{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new rr({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Ni(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(vo.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Co extends ko{constructor(){super(gi(Co.getDefaults(),arguments,["delayTime","feedback"])),this.name="FeedbackDelay";const t=gi(Co.getDefaults(),arguments,["delayTime","feedback"]);this._delayNode=new fr({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Ni(this,"delayTime")}static getDefaults(){return Object.assign(ko.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}let So=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["decay"])),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const e=gi(t.getDefaults(),arguments,["decay"]);this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(vo.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){Gs(t=this.toSeconds(t),.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){Gs(t=this.toSeconds(t),0),this._preDelay=t,this.generate()}generate(){return ui(this,void 0,void 0,(function*(){const t=this.ready,e=new qi(2,this._decay+this._preDelay,this.context.sampleRate),n=new Or({context:e}),s=new Or({context:e}),i=new To({context:e});n.connect(i,0,0),s.connect(i,0,1);const r=new rr({context:e}).toDestination();i.connect(r),n.start(0),s.start(0),r.gain.setValueAtTime(0,0),r.gain.setValueAtTime(1,this._preDelay),r.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const o=e.render();return this.ready=o.then(Pi),yield t,this._convolver.buffer=(yield o).get(),this}))}dispose(){return super.dispose(),this._convolver.disconnect(),this}};class Oo extends nr{constructor(){super(gi(Oo.getDefaults(),arguments,["solo"])),this.name="Solo";const t=gi(Oo.getDefaults(),arguments,["solo"]);this.input=this.output=new rr({context:this.context}),Oo._allSolos.has(this.context)||Oo._allSolos.set(this.context,new Set),Oo._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(nr.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),Oo._allSolos.get(this.context).forEach((t=>t._updateSolo()))}get muted(){return 0===this.input.gain.value}_addSolo(){Oo._soloed.has(this.context)||Oo._soloed.set(this.context,new Set),Oo._soloed.get(this.context).add(this)}_removeSolo(){Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).delete(this)}_isSoloed(){return Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).has(this)}_noSolos(){return!Oo._soloed.has(this.context)||Oo._soloed.has(this.context)&&0===Oo._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Oo._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Oo._allSolos=new Map,Oo._soloed=new Map;class Mo extends nr{constructor(){super(gi(Mo.getDefaults(),arguments,["pan","volume"])),this.name="PanVol";const t=gi(Mo.getDefaults(),arguments,["pan","volume"]);this._panner=this.input=new yo({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Eo extends nr{constructor(){super(gi(Eo.getDefaults(),arguments,["volume","pan"])),this.name="Channel";const t=gi(Eo.getDefaults(),arguments,["volume","pan"]);this._solo=this.input=new Oo({solo:t.solo,context:this.context}),this._panVol=this.output=new Mo({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return Eo.buses.has(t)||Eo.buses.set(t,new rr({context:this.context})),Eo.buses.get(t)}send(t,e=0){const n=this._getBus(t),s=new rr({context:this.context,units:"decibels",gain:e});return this.connect(s),s.connect(n),s}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}Eo.buses=new Map;class Do extends nr{constructor(){super(...arguments),this.name="Listener",this.positionX=new er({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new er({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new er({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new er({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new er({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new er({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new er({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new er({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new er({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(nr.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}function Io(){return zi().now()}Oi((t=>{t.listener=new Do({context:t})})),Ei((t=>{t.listener.dispose()})),zi().transport,zi().destination,zi().destination,zi().listener,zi().draw,zi();const Ro={C0:16.35,"C#0":17.32,Db0:17.32,D0:18.35,"D#0":19.45,Eb0:19.45,E0:20.6,F0:21.83,"F#0":23.12,Gb0:23.12,G0:24.5,"G#0":25.96,Ab0:25.96,A0:27.5,"A#0":29.14,Bb0:29.14,B0:30.87,C1:32.7,"C#1":34.65,Db1:34.65,D1:36.71,"D#1":38.89,Eb1:38.89,E1:41.2,F1:43.65,"F#1":46.25,Gb1:46.25,G1:49,"G#1":51.91,Ab1:51.91,A1:55,"A#1":58.27,Bb1:58.27,B1:61.74,C2:65.41,"C#2":69.3,Db2:69.3,D2:73.42,"D#2":77.78,Eb2:77.78,E2:82.41,F2:87.31,"F#2":92.5,Gb2:92.5,G2:98,"G#2":103.83,Ab2:103.83,A2:110,"A#2":116.54,Bb2:116.54,B2:123.47,C3:130.81,"C#3":138.59,Db3:138.59,D3:146.83,"D#3":155.56,Eb3:155.56,E3:164.81,F3:174.61,"F#3":185,Gb3:185,G3:196,"G#3":207.65,Ab3:207.65,A3:220,"A#3":233.08,Bb3:233.08,B3:246.94,C4:261.63,"C#4":277.18,Db4:277.18,D4:293.66,"D#4":311.13,Eb4:311.13,E4:329.63,F4:349.23,"F#4":369.99,Gb4:369.99,G4:392,"G#4":415.3,Ab4:415.3,A4:440,"A#4":466.16,Bb4:466.16,B4:493.88,C5:523.25,"C#5":554.37,Db5:554.37,D5:587.33,"D#5":622.25,Eb5:622.25,E5:659.26,F5:698.46,"F#5":739.99,Gb5:739.99,G5:783.99,"G#5":830.61,Ab5:830.61,A5:880,"A#5":932.33,Bb5:932.33,B5:987.77,C6:1046.5,"C#6":1108.73,Db6:1108.73,D6:1174.66,"D#6":1244.51,Eb6:1244.51,E6:1318.51,F6:1396.91,"F#6":1479.98,Gb6:1479.98,G6:1567.98,"G#6":1661.22,Ab6:1661.22,A6:1760,"A#6":1864.66,Bb6:1864.66,B6:1975.53,C7:2093,"C#7":2217.46,Db7:2217.46,D7:2349.32,"D#7":2489.02,Eb7:2489.02,E7:2637.02,F7:2793.83,"F#7":2959.96,Gb7:2959.96,G7:3135.96,"G#7":3322.44,Ab7:3322.44,A7:3520,"A#7":3729.31,Bb7:3729.31,B7:3951.07,C8:4186.01,"C#8":4434.92,Db8:4434.92,D8:4698.64,"D#8":4978.03,Eb8:4978.03},No=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Bo=No.length;class Po{static _notes;name;octave;velocity=1;duration;frequency;constructor(t){"number"==typeof t?this.fromFrequency(t):"string"==typeof t?this.fromString(t):t instanceof MIDIMessageEvent?this.fromEvent(t):this.fromProps(t)}static notes(t=3){return No.map((e=>new Po(`${e}${t}`)))}get isSemi(){return"#"===this.name.slice(-1)}get fullName(){return`${this.name}${this.octave}`}midiData(t=!0){return new Uint8Array([t?144:128,0,100*this.velocity])}get midiNumber(){return 12*(this.octave+2)+this.noteIndex}get noteIndex(){return No.indexOf(this.name)}adjustFrequency(t=0,e=0){if(this.frequency)return this.frequency;let n=this.octave+t;const s=No.indexOf(this.name)+e;let i=s;s>=Bo?(n++,i=s%Bo):s<0&&(n--,i=Bo+i);const r=No[i];return Ro[`${r}${n}`]}valueOf(){return this.fullName}serialize(){return{note:this.fullName,frequency:this.frequency,velocity:this.velocity,duration:this.duration}}fromFrequency(t){this.frequency=t}fromString(t){const e=t.match(/(\w#?)(\d)?/)||[];this.name=e[1],this.octave=e[2]?parseInt(e[2]):1}fromEvent(t){this.name=No[t.data[1]%12],this.octave=Math.floor(t.data[1]/12)-2}fromProps(t){if(Object.assign(this,t),!t.note)throw Error("note props is mandatory");this.fromString(t.note)}}const Vo={128:"noteOff",144:"noteOn",176:"cc"};class qo{note;voiceNo;triggeredAt;_type;data;event;static fromSequence(t,e){return t.notes.map((t=>this.fromNote(t,!0,e)))}static fromNote(t,e=!0,n){const s=t instanceof Po?t:new Po(t),i=new qo(new MIDIMessageEvent("",{data:s.midiData(e)}),n);return i.note=s,i}static fromCC(t,e,n){return new qo(new MIDIMessageEvent("",{data:new Uint8Array([176,t,e])}),n)}constructor(t,e){this.event=t,this.triggeredAt=e||Io(),this.data=t.data,this.defineNotes()}get statusByte(){return this.data[0]}get firstData(){return this.data[1]}get secondData(){return this.data[2]}get type(){if(this._type)return this._type;let t=Vo[240&this.statusByte];return"noteOn"===t&&0===this.secondData&&(t="noteOff"),this._type=t}get isNote(){return"noteOn"===this.type||"noteOff"===this.type}defineNotes(){this.isNote&&(this.note||(this.note=new Po(this.event)))}}class Fo{id;name;state;eventListerCallbacks=[];_midi;constructor(t){this.id=t.id,this.name=t.name||`Device ${t.id}`,this.state=t.state,this._midi=t,this.connect()}connect(){this._midi.onmidimessage=t=>{(t instanceof MIDIMessageEvent||t instanceof qo)&&this.processEvent(t)}}disconnect(){this._midi.onmidimessage=null}serialize(){const{id:t,name:e,state:n}=this;return{id:t,name:e,state:n}}addEventListener(t){this.eventListerCallbacks.push(t)}removeEventListener(t){this.eventListerCallbacks=this.eventListerCallbacks.filter((e=>e!==t))}processEvent(t){const e=t instanceof qo?t:new qo(t);switch(e.type){case"noteOn":case"noteOff":this.eventListerCallbacks.forEach((t=>t(e)))}}}const jo={a:new Po("C3"),s:new Po("D3"),d:new Po("E3"),f:new Po("F3"),g:new Po("G3"),h:new Po("A3"),j:new Po("B3"),k:new Po("C4"),l:new Po("D4"),w:new Po("C#3"),e:new Po("D#3"),t:new Po("F#3"),y:new Po("G#3"),u:new Po("A#3"),o:new Po("C#4"),p:new Po("D#4")},zo={id:"computer_keyboard",name:"Computer Keyboard",state:"connected"};class Wo{id;name;state;onmidimessage;constructor(){Object.assign(this,zo),document.addEventListener("keydown",this.onKeyTrigger(!0)),document.addEventListener("keyup",this.onKeyTrigger(!1))}onKeyTrigger=t=>e=>{if(!this.onmidimessage)return;const n=this.extractNote(e);if(!n)return;const s=qo.fromNote(n,t);this.onmidimessage(s)};extractNote(t){if(!t.repeat)return jo[t.key]}}class Lo{devices={};initialized=!1;computerKeyboardInput;constructor(){this.computerKeyboardInput=new Wo,this.initializeDevices().then((()=>{this.listenChanges(),this.initialized=!0})).catch((()=>{}))}find(t){const e=this.devices[t];return e||null}onStateChange(t){navigator.requestMIDIAccess().then((e=>{e.onstatechange=e=>{if(!(e instanceof MIDIConnectionEvent))return;if(e.port instanceof MIDIOutput)return;const n=e.port,s=new Fo(n);t(s)}})).catch((()=>{}))}listenChanges(){this.onStateChange((t=>{"disconnected"===t.state?(t.disconnect(),delete this.devices[t.id]):this.devices[t.id]=t}))}async initializeDevices(){return this.initialized||(await this.inputs()).forEach((t=>{this.devices[t.id]||(this.devices[t.id]=new Fo(t))})),Object.values(this.devices)}async inputs(){const t=[this.computerKeyboardInput];return(await navigator.requestMIDIAccess()).inputs.forEach((e=>t.push(e))),t}}var Uo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ho(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $o={exports:{}};
|
|
8
|
-
/**
|
|
9
|
-
* @license
|
|
10
|
-
* Lodash <https://lodash.com/>
|
|
11
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
12
|
-
* Released under MIT license <https://lodash.com/license>
|
|
13
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
14
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
15
|
-
*/!function(t,e){(function(){var n,s="Expected a function",i="__lodash_hash_undefined__",r="__lodash_placeholder__",o=16,a=32,u=64,c=128,l=256,h=1/0,p=9007199254740991,d=NaN,f=4294967295,_=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",a],["partialRight",u],["rearg",l]],m="[object Arguments]",g="[object Array]",v="[object Boolean]",y="[object Date]",w="[object Error]",b="[object Function]",x="[object GeneratorFunction]",T="[object Map]",A="[object Number]",k="[object Object]",C="[object Promise]",S="[object RegExp]",O="[object Set]",M="[object String]",E="[object Symbol]",D="[object WeakMap]",I="[object ArrayBuffer]",R="[object DataView]",N="[object Float32Array]",B="[object Float64Array]",P="[object Int8Array]",V="[object Int16Array]",q="[object Int32Array]",F="[object Uint8Array]",j="[object Uint8ClampedArray]",z="[object Uint16Array]",W="[object Uint32Array]",L=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,X=RegExp($.source),Z=RegExp(G.source),Y=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(nt.source),it=/^\s+/,rt=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,ut=/,? & /,ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ht=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,xt="\\ud800-\\udfff",Tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",kt="a-z\\xdf-\\xf6\\xf8-\\xff",Ct="A-Z\\xc0-\\xd6\\xd8-\\xde",St="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Mt="['’]",Et="["+xt+"]",Dt="["+Ot+"]",It="["+Tt+"]",Rt="\\d+",Nt="["+At+"]",Bt="["+kt+"]",Pt="[^"+xt+Ot+Rt+At+kt+Ct+"]",Vt="\\ud83c[\\udffb-\\udfff]",qt="[^"+xt+"]",Ft="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",zt="["+Ct+"]",Wt="\\u200d",Lt="(?:"+Bt+"|"+Pt+")",Ut="(?:"+zt+"|"+Pt+")",Ht="(?:['’](?:d|ll|m|re|s|t|ve))?",$t="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+It+"|"+Vt+")"+"?",Xt="["+St+"]?",Zt=Xt+Gt+("(?:"+Wt+"(?:"+[qt,Ft,jt].join("|")+")"+Xt+Gt+")*"),Yt="(?:"+[Nt,Ft,jt].join("|")+")"+Zt,Qt="(?:"+[qt+It+"?",It,Ft,jt,Et].join("|")+")",Kt=RegExp(Mt,"g"),Jt=RegExp(It,"g"),te=RegExp(Vt+"(?="+Vt+")|"+Qt+Zt,"g"),ee=RegExp([zt+"?"+Bt+"+"+Ht+"(?="+[Dt,zt,"$"].join("|")+")",Ut+"+"+$t+"(?="+[Dt,zt+Lt,"$"].join("|")+")",zt+"?"+Lt+"+"+Ht,zt+"+"+$t,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rt,Yt].join("|"),"g"),ne=RegExp("["+Wt+xt+Tt+St+"]"),se=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ie=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],re=-1,oe={};oe[N]=oe[B]=oe[P]=oe[V]=oe[q]=oe[F]=oe[j]=oe[z]=oe[W]=!0,oe[m]=oe[g]=oe[I]=oe[v]=oe[R]=oe[y]=oe[w]=oe[b]=oe[T]=oe[A]=oe[k]=oe[S]=oe[O]=oe[M]=oe[D]=!1;var ae={};ae[m]=ae[g]=ae[I]=ae[R]=ae[v]=ae[y]=ae[N]=ae[B]=ae[P]=ae[V]=ae[q]=ae[T]=ae[A]=ae[k]=ae[S]=ae[O]=ae[M]=ae[E]=ae[F]=ae[j]=ae[z]=ae[W]=!0,ae[w]=ae[b]=ae[D]=!1;var ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ce=parseFloat,le=parseInt,he="object"==typeof Uo&&Uo&&Uo.Object===Object&&Uo,pe="object"==typeof self&&self&&self.Object===Object&&self,de=he||pe||Function("return this")(),fe=e&&!e.nodeType&&e,_e=fe&&t&&!t.nodeType&&t,me=_e&&_e.exports===fe,ge=me&&he.process,ve=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ye=ve&&ve.isArrayBuffer,we=ve&&ve.isDate,be=ve&&ve.isMap,xe=ve&&ve.isRegExp,Te=ve&&ve.isSet,Ae=ve&&ve.isTypedArray;function ke(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ce(t,e,n,s){for(var i=-1,r=null==t?0:t.length;++i<r;){var o=t[i];e(s,o,n(o),t)}return s}function Se(t,e){for(var n=-1,s=null==t?0:t.length;++n<s&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Me(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(!e(t[n],n,t))return!1;return!0}function Ee(t,e){for(var n=-1,s=null==t?0:t.length,i=0,r=[];++n<s;){var o=t[n];e(o,n,t)&&(r[i++]=o)}return r}function De(t,e){return!!(null==t?0:t.length)&&ze(t,e,0)>-1}function Ie(t,e,n){for(var s=-1,i=null==t?0:t.length;++s<i;)if(n(e,t[s]))return!0;return!1}function Re(t,e){for(var n=-1,s=null==t?0:t.length,i=Array(s);++n<s;)i[n]=e(t[n],n,t);return i}function Ne(t,e){for(var n=-1,s=e.length,i=t.length;++n<s;)t[i+n]=e[n];return t}function Be(t,e,n,s){var i=-1,r=null==t?0:t.length;for(s&&r&&(n=t[++i]);++i<r;)n=e(n,t[i],i,t);return n}function Pe(t,e,n,s){var i=null==t?0:t.length;for(s&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Ve(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(e(t[n],n,t))return!0;return!1}var qe=He("length");function Fe(t,e,n){var s;return n(t,(function(t,n,i){if(e(t,n,i))return s=n,!1})),s}function je(t,e,n,s){for(var i=t.length,r=n+(s?1:-1);s?r--:++r<i;)if(e(t[r],r,t))return r;return-1}function ze(t,e,n){return e==e?function(t,e,n){var s=n-1,i=t.length;for(;++s<i;)if(t[s]===e)return s;return-1}(t,e,n):je(t,Le,n)}function We(t,e,n,s){for(var i=n-1,r=t.length;++i<r;)if(s(t[i],e))return i;return-1}function Le(t){return t!=t}function Ue(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:d}function He(t){return function(e){return null==e?n:e[t]}}function $e(t){return function(e){return null==t?n:t[e]}}function Ge(t,e,n,s,i){return i(t,(function(t,i,r){n=s?(s=!1,t):e(n,t,i,r)})),n}function Xe(t,e){for(var s,i=-1,r=t.length;++i<r;){var o=e(t[i]);o!==n&&(s=s===n?o:s+o)}return s}function Ze(t,e){for(var n=-1,s=Array(t);++n<t;)s[n]=e(n);return s}function Ye(t){return t?t.slice(0,fn(t)+1).replace(it,""):t}function Qe(t){return function(e){return t(e)}}function Ke(t,e){return Re(e,(function(e){return t[e]}))}function Je(t,e){return t.has(e)}function tn(t,e){for(var n=-1,s=t.length;++n<s&&ze(e,t[n],0)>-1;);return n}function en(t,e){for(var n=t.length;n--&&ze(e,t[n],0)>-1;);return n}var nn=$e({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),sn=$e({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(t){return"\\"+ue[t]}function on(t){return ne.test(t)}function an(t){var e=-1,n=Array(t.size);return t.forEach((function(t,s){n[++e]=[s,t]})),n}function un(t,e){return function(n){return t(e(n))}}function cn(t,e){for(var n=-1,s=t.length,i=0,o=[];++n<s;){var a=t[n];a!==e&&a!==r||(t[n]=r,o[i++]=n)}return o}function ln(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function pn(t){return on(t)?function(t){var e=te.lastIndex=0;for(;te.test(t);)++e;return e}(t):qe(t)}function dn(t){return on(t)?function(t){return t.match(te)||[]}(t):function(t){return t.split("")}(t)}function fn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var _n=$e({"&":"&","<":"<",">":">",""":'"',"'":"'"});var mn=function t(e){var rt,xt=(e=null==e?de:mn.defaults(de.Object(),e,mn.pick(de,ie))).Array,Tt=e.Date,At=e.Error,kt=e.Function,Ct=e.Math,St=e.Object,Ot=e.RegExp,Mt=e.String,Et=e.TypeError,Dt=xt.prototype,It=kt.prototype,Rt=St.prototype,Nt=e["__core-js_shared__"],Bt=It.toString,Pt=Rt.hasOwnProperty,Vt=0,qt=(rt=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+rt:"",Ft=Rt.toString,jt=Bt.call(St),zt=de._,Wt=Ot("^"+Bt.call(Pt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Lt=me?e.Buffer:n,Ut=e.Symbol,Ht=e.Uint8Array,$t=Lt?Lt.allocUnsafe:n,Gt=un(St.getPrototypeOf,St),Xt=St.create,Zt=Rt.propertyIsEnumerable,Yt=Dt.splice,Qt=Ut?Ut.isConcatSpreadable:n,te=Ut?Ut.iterator:n,ne=Ut?Ut.toStringTag:n,ue=function(){try{var t=pr(St,"defineProperty");return t({},"",{}),t}catch(t){}}(),he=e.clearTimeout!==de.clearTimeout&&e.clearTimeout,pe=Tt&&Tt.now!==de.Date.now&&Tt.now,fe=e.setTimeout!==de.setTimeout&&e.setTimeout,_e=Ct.ceil,ge=Ct.floor,ve=St.getOwnPropertySymbols,qe=Lt?Lt.isBuffer:n,$e=e.isFinite,gn=Dt.join,vn=un(St.keys,St),yn=Ct.max,wn=Ct.min,bn=Tt.now,xn=e.parseInt,Tn=Ct.random,An=Dt.reverse,kn=pr(e,"DataView"),Cn=pr(e,"Map"),Sn=pr(e,"Promise"),On=pr(e,"Set"),Mn=pr(e,"WeakMap"),En=pr(St,"create"),Dn=Mn&&new Mn,In={},Rn=qr(kn),Nn=qr(Cn),Bn=qr(Sn),Pn=qr(On),Vn=qr(Mn),qn=Ut?Ut.prototype:n,Fn=qn?qn.valueOf:n,jn=qn?qn.toString:n;function zn(t){if(na(t)&&!Ho(t)&&!(t instanceof Hn)){if(t instanceof Un)return t;if(Pt.call(t,"__wrapped__"))return Fr(t)}return new Un(t)}var Wn=function(){function t(){}return function(e){if(!ea(e))return{};if(Xt)return Xt(e);t.prototype=e;var s=new t;return t.prototype=n,s}}();function Ln(){}function Un(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=n}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Zn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Xn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Gn(t);this.size=e.size}function Qn(t,e){var n=Ho(t),s=!n&&Uo(t),i=!n&&!s&&Zo(t),r=!n&&!s&&!i&&la(t),o=n||s||i||r,a=o?Ze(t.length,Mt):[],u=a.length;for(var c in t)!e&&!Pt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yr(c,u))||a.push(c);return a}function Kn(t){var e=t.length;return e?t[Zs(0,e-1)]:n}function Jn(t,e){return Br(Ei(t),us(e,0,t.length))}function ts(t){return Br(Ei(t))}function es(t,e,s){(s!==n&&!zo(t[e],s)||s===n&&!(e in t))&&os(t,e,s)}function ns(t,e,s){var i=t[e];Pt.call(t,e)&&zo(i,s)&&(s!==n||e in t)||os(t,e,s)}function ss(t,e){for(var n=t.length;n--;)if(zo(t[n][0],e))return n;return-1}function is(t,e,n,s){return ds(t,(function(t,i,r){e(s,t,n(t),r)})),s}function rs(t,e){return t&&Di(e,Ia(e),t)}function os(t,e,n){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function as(t,e){for(var s=-1,i=e.length,r=xt(i),o=null==t;++s<i;)r[s]=o?n:Sa(t,e[s]);return r}function us(t,e,s){return t==t&&(s!==n&&(t=t<=s?t:s),e!==n&&(t=t>=e?t:e)),t}function cs(t,e,s,i,r,o){var a,u=1&e,c=2&e,l=4&e;if(s&&(a=r?s(t,i,r,o):s(t)),a!==n)return a;if(!ea(t))return t;var h=Ho(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Pt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Ei(t,a)}else{var p=_r(t),d=p==b||p==x;if(Zo(t))return Ai(t,u);if(p==k||p==m||d&&!r){if(a=c||d?{}:gr(t),!u)return c?function(t,e){return Di(t,fr(t),e)}(t,function(t,e){return t&&Di(e,Ra(e),t)}(a,t)):function(t,e){return Di(t,dr(t),e)}(t,rs(a,t))}else{if(!ae[p])return r?t:{};a=function(t,e,n){var s=t.constructor;switch(e){case I:return ki(t);case v:case y:return new s(+t);case R:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case N:case B:case P:case V:case q:case F:case j:case z:case W:return Ci(t,n);case T:return new s;case A:case M:return new s(t);case S:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new s;case E:return i=t,Fn?St(Fn.call(i)):{}}var i}(t,p,u)}}o||(o=new Yn);var f=o.get(t);if(f)return f;o.set(t,a),aa(t)?t.forEach((function(n){a.add(cs(n,e,s,n,t,o))})):sa(t)&&t.forEach((function(n,i){a.set(i,cs(n,e,s,i,t,o))}));var _=h?n:(l?c?rr:ir:c?Ra:Ia)(t);return Se(_||t,(function(n,i){_&&(n=t[i=n]),ns(a,i,cs(n,e,s,i,t,o))})),a}function ls(t,e,s){var i=s.length;if(null==t)return!i;for(t=St(t);i--;){var r=s[i],o=e[r],a=t[r];if(a===n&&!(r in t)||!o(a))return!1}return!0}function hs(t,e,i){if("function"!=typeof t)throw new Et(s);return Dr((function(){t.apply(n,i)}),e)}function ps(t,e,n,s){var i=-1,r=De,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Re(e,Qe(n))),s?(r=Ie,o=!1):e.length>=200&&(r=Je,o=!1,e=new Zn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=s||0!==l?l:0,o&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;u.push(l)}else r(e,h,s)||u.push(l)}return u}zn.templateSettings={escape:Y,evaluate:Q,interpolate:K,variable:"",imports:{_:zn}},zn.prototype=Ln.prototype,zn.prototype.constructor=zn,Un.prototype=Wn(Ln.prototype),Un.prototype.constructor=Un,Hn.prototype=Wn(Ln.prototype),Hn.prototype.constructor=Hn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(t){var e=this.__data__;if(En){var s=e[t];return s===i?n:s}return Pt.call(e,t)?e[t]:n},$n.prototype.has=function(t){var e=this.__data__;return En?e[t]!==n:Pt.call(e,t)},$n.prototype.set=function(t,e){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=En&&e===n?i:e,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=ss(e,t);return!(n<0)&&(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,!0)},Gn.prototype.get=function(t){var e=this.__data__,s=ss(e,t);return s<0?n:e[s][1]},Gn.prototype.has=function(t){return ss(this.__data__,t)>-1},Gn.prototype.set=function(t,e){var n=this.__data__,s=ss(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Xn.prototype.delete=function(t){var e=lr(this,t).delete(t);return this.size-=e?1:0,e},Xn.prototype.get=function(t){return lr(this,t).get(t)},Xn.prototype.has=function(t){return lr(this,t).has(t)},Xn.prototype.set=function(t,e){var n=lr(this,t),s=n.size;return n.set(t,e),this.size+=n.size==s?0:1,this},Zn.prototype.add=Zn.prototype.push=function(t){return this.__data__.set(t,i),this},Zn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Gn){var s=n.__data__;if(!Cn||s.length<199)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new Xn(s)}return n.set(t,e),this.size=n.size,this};var ds=Ni(bs),fs=Ni(xs,!0);function _s(t,e){var n=!0;return ds(t,(function(t,s,i){return n=!!e(t,s,i)})),n}function ms(t,e,s){for(var i=-1,r=t.length;++i<r;){var o=t[i],a=e(o);if(null!=a&&(u===n?a==a&&!ca(a):s(a,u)))var u=a,c=o}return c}function gs(t,e){var n=[];return ds(t,(function(t,s,i){e(t,s,i)&&n.push(t)})),n}function vs(t,e,n,s,i){var r=-1,o=t.length;for(n||(n=vr),i||(i=[]);++r<o;){var a=t[r];e>0&&n(a)?e>1?vs(a,e-1,n,s,i):Ne(i,a):s||(i[i.length]=a)}return i}var ys=Bi(),ws=Bi(!0);function bs(t,e){return t&&ys(t,e,Ia)}function xs(t,e){return t&&ws(t,e,Ia)}function Ts(t,e){return Ee(e,(function(e){return Ko(t[e])}))}function As(t,e){for(var s=0,i=(e=wi(e,t)).length;null!=t&&s<i;)t=t[Vr(e[s++])];return s&&s==i?t:n}function ks(t,e,n){var s=e(t);return Ho(t)?s:Ne(s,n(t))}function Cs(t){return null==t?t===n?"[object Undefined]":"[object Null]":ne&&ne in St(t)?function(t){var e=Pt.call(t,ne),s=t[ne];try{t[ne]=n;var i=!0}catch(t){}var r=Ft.call(t);i&&(e?t[ne]=s:delete t[ne]);return r}(t):function(t){return Ft.call(t)}(t)}function Ss(t,e){return t>e}function Os(t,e){return null!=t&&Pt.call(t,e)}function Ms(t,e){return null!=t&&e in St(t)}function Es(t,e,s){for(var i=s?Ie:De,r=t[0].length,o=t.length,a=o,u=xt(o),c=1/0,l=[];a--;){var h=t[a];a&&e&&(h=Re(h,Qe(e))),c=wn(h.length,c),u[a]=!s&&(e||r>=120&&h.length>=120)?new Zn(a&&h):n}h=t[0];var p=-1,d=u[0];t:for(;++p<r&&l.length<c;){var f=h[p],_=e?e(f):f;if(f=s||0!==f?f:0,!(d?Je(d,_):i(l,_,s))){for(a=o;--a;){var m=u[a];if(!(m?Je(m,_):i(t[a],_,s)))continue t}d&&d.push(_),l.push(f)}}return l}function Ds(t,e,s){var i=null==(t=Or(t,e=wi(e,t)))?t:t[Vr(Yr(e))];return null==i?n:ke(i,t,s)}function Is(t){return na(t)&&Cs(t)==m}function Rs(t,e,s,i,r){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,s,i,r,o){var a=Ho(t),u=Ho(e),c=a?g:_r(t),l=u?g:_r(e),h=(c=c==m?k:c)==k,p=(l=l==m?k:l)==k,d=c==l;if(d&&Zo(t)){if(!Zo(e))return!1;a=!0,h=!1}if(d&&!h)return o||(o=new Yn),a||la(t)?nr(t,e,s,i,r,o):function(t,e,n,s,i,r,o){switch(n){case R:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case I:return!(t.byteLength!=e.byteLength||!r(new Ht(t),new Ht(e)));case v:case y:case A:return zo(+t,+e);case w:return t.name==e.name&&t.message==e.message;case S:case M:return t==e+"";case T:var a=an;case O:var u=1&s;if(a||(a=ln),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;s|=2,o.set(t,e);var l=nr(a(t),a(e),s,i,r,o);return o.delete(t),l;case E:if(Fn)return Fn.call(t)==Fn.call(e)}return!1}(t,e,c,s,i,r,o);if(!(1&s)){var f=h&&Pt.call(t,"__wrapped__"),_=p&&Pt.call(e,"__wrapped__");if(f||_){var b=f?t.value():t,x=_?e.value():e;return o||(o=new Yn),r(b,x,s,i,o)}}if(!d)return!1;return o||(o=new Yn),function(t,e,s,i,r,o){var a=1&s,u=ir(t),c=u.length,l=ir(e),h=l.length;if(c!=h&&!a)return!1;var p=c;for(;p--;){var d=u[p];if(!(a?d in e:Pt.call(e,d)))return!1}var f=o.get(t),_=o.get(e);if(f&&_)return f==e&&_==t;var m=!0;o.set(t,e),o.set(e,t);var g=a;for(;++p<c;){var v=t[d=u[p]],y=e[d];if(i)var w=a?i(y,v,d,e,t,o):i(v,y,d,t,e,o);if(!(w===n?v===y||r(v,y,s,i,o):w)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var b=t.constructor,x=e.constructor;b==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return o.delete(t),o.delete(e),m}(t,e,s,i,r,o)}(t,e,s,i,Rs,r))}function Ns(t,e,s,i){var r=s.length,o=r,a=!i;if(null==t)return!o;for(t=St(t);r--;){var u=s[r];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++r<o;){var c=(u=s[r])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===n&&!(c in t))return!1}else{var p=new Yn;if(i)var d=i(l,h,c,t,e,p);if(!(d===n?Rs(h,l,3,i,p):d))return!1}}return!0}function Bs(t){return!(!ea(t)||(e=t,qt&&qt in e))&&(Ko(t)?Wt:mt).test(qr(t));var e}function Ps(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?Ho(t)?Ws(t[0],t[1]):zs(t):du(t)}function Vs(t){if(!Ar(t))return vn(t);var e=[];for(var n in St(t))Pt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function qs(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in St(t))e.push(n);return e}(t);var e=Ar(t),n=[];for(var s in t)("constructor"!=s||!e&&Pt.call(t,s))&&n.push(s);return n}function Fs(t,e){return t<e}function js(t,e){var n=-1,s=Go(t)?xt(t.length):[];return ds(t,(function(t,i,r){s[++n]=e(t,i,r)})),s}function zs(t){var e=hr(t);return 1==e.length&&e[0][2]?Cr(e[0][0],e[0][1]):function(n){return n===t||Ns(n,t,e)}}function Ws(t,e){return br(t)&&kr(e)?Cr(Vr(t),e):function(s){var i=Sa(s,t);return i===n&&i===e?Oa(s,t):Rs(e,i,3)}}function Ls(t,e,s,i,r){t!==e&&ys(e,(function(o,a){if(r||(r=new Yn),ea(o))!function(t,e,s,i,r,o,a){var u=Mr(t,s),c=Mr(e,s),l=a.get(c);if(l)return void es(t,s,l);var h=o?o(u,c,s+"",t,e,a):n,p=h===n;if(p){var d=Ho(c),f=!d&&Zo(c),_=!d&&!f&&la(c);h=c,d||f||_?Ho(u)?h=u:Xo(u)?h=Ei(u):f?(p=!1,h=Ai(c,!0)):_?(p=!1,h=Ci(c,!0)):h=[]:ra(c)||Uo(c)?(h=u,Uo(u)?h=va(u):ea(u)&&!Ko(u)||(h=gr(c))):p=!1}p&&(a.set(c,h),r(h,c,i,o,a),a.delete(c));es(t,s,h)}(t,e,a,s,Ls,i,r);else{var u=i?i(Mr(t,a),o,a+"",t,e,r):n;u===n&&(u=o),es(t,a,u)}}),Ra)}function Us(t,e){var s=t.length;if(s)return yr(e+=e<0?s:0,s)?t[e]:n}function Hs(t,e,n){e=e.length?Re(e,(function(t){return Ho(t)?function(e){return As(e,1===t.length?t[0]:t)}:t})):[iu];var s=-1;e=Re(e,Qe(cr()));var i=js(t,(function(t,n,i){var r=Re(e,(function(e){return e(t)}));return{criteria:r,index:++s,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var s=-1,i=t.criteria,r=e.criteria,o=i.length,a=n.length;for(;++s<o;){var u=Si(i[s],r[s]);if(u)return s>=a?u:u*("desc"==n[s]?-1:1)}return t.index-e.index}(t,e,n)}))}function $s(t,e,n){for(var s=-1,i=e.length,r={};++s<i;){var o=e[s],a=As(t,o);n(a,o)&&ti(r,wi(o,t),a)}return r}function Gs(t,e,n,s){var i=s?We:ze,r=-1,o=e.length,a=t;for(t===e&&(e=Ei(e)),n&&(a=Re(t,Qe(n)));++r<o;)for(var u=0,c=e[r],l=n?n(c):c;(u=i(a,l,u,s))>-1;)a!==t&&Yt.call(a,u,1),Yt.call(t,u,1);return t}function Xs(t,e){for(var n=t?e.length:0,s=n-1;n--;){var i=e[n];if(n==s||i!==r){var r=i;yr(i)?Yt.call(t,i,1):pi(t,i)}}return t}function Zs(t,e){return t+ge(Tn()*(e-t+1))}function Ys(t,e){var n="";if(!t||e<1||e>p)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qs(t,e){return Ir(Sr(t,e,iu),t+"")}function Ks(t){return Kn(za(t))}function Js(t,e){var n=za(t);return Br(n,us(e,0,n.length))}function ti(t,e,s,i){if(!ea(t))return t;for(var r=-1,o=(e=wi(e,t)).length,a=o-1,u=t;null!=u&&++r<o;){var c=Vr(e[r]),l=s;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(r!=a){var h=u[c];(l=i?i(h,c,u):n)===n&&(l=ea(h)?h:yr(e[r+1])?[]:{})}ns(u,c,l),u=u[c]}return t}var ei=Dn?function(t,e){return Dn.set(t,e),t}:iu,ni=ue?function(t,e){return ue(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function si(t){return Br(za(t))}function ii(t,e,n){var s=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=xt(i);++s<i;)r[s]=t[s+e];return r}function ri(t,e){var n;return ds(t,(function(t,s,i){return!(n=e(t,s,i))})),!!n}function oi(t,e,n){var s=0,i=null==t?s:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;s<i;){var r=s+i>>>1,o=t[r];null!==o&&!ca(o)&&(n?o<=e:o<e)?s=r+1:i=r}return i}return ai(t,e,iu,n)}function ai(t,e,s,i){var r=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=s(e))!=e,u=null===e,c=ca(e),l=e===n;r<o;){var h=ge((r+o)/2),p=s(t[h]),d=p!==n,f=null===p,_=p==p,m=ca(p);if(a)var g=i||_;else g=l?_&&(i||d):u?_&&d&&(i||!f):c?_&&d&&!f&&(i||!m):!f&&!m&&(i?p<=e:p<e);g?r=h+1:o=h}return wn(o,4294967294)}function ui(t,e){for(var n=-1,s=t.length,i=0,r=[];++n<s;){var o=t[n],a=e?e(o):o;if(!n||!zo(a,u)){var u=a;r[i++]=0===o?0:o}}return r}function ci(t){return"number"==typeof t?t:ca(t)?d:+t}function li(t){if("string"==typeof t)return t;if(Ho(t))return Re(t,li)+"";if(ca(t))return jn?jn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var s=-1,i=De,r=t.length,o=!0,a=[],u=a;if(n)o=!1,i=Ie;else if(r>=200){var c=e?null:Yi(t);if(c)return ln(c);o=!1,i=Je,u=new Zn}else u=e?[]:a;t:for(;++s<r;){var l=t[s],h=e?e(l):l;if(l=n||0!==l?l:0,o&&h==h){for(var p=u.length;p--;)if(u[p]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function pi(t,e){return null==(t=Or(t,e=wi(e,t)))||delete t[Vr(Yr(e))]}function di(t,e,n,s){return ti(t,e,n(As(t,e)),s)}function fi(t,e,n,s){for(var i=t.length,r=s?i:-1;(s?r--:++r<i)&&e(t[r],r,t););return n?ii(t,s?0:r,s?r+1:i):ii(t,s?r+1:0,s?i:r)}function _i(t,e){var n=t;return n instanceof Hn&&(n=n.value()),Be(e,(function(t,e){return e.func.apply(e.thisArg,Ne([t],e.args))}),n)}function mi(t,e,n){var s=t.length;if(s<2)return s?hi(t[0]):[];for(var i=-1,r=xt(s);++i<s;)for(var o=t[i],a=-1;++a<s;)a!=i&&(r[i]=ps(r[i]||o,t[a],e,n));return hi(vs(r,1),e,n)}function gi(t,e,s){for(var i=-1,r=t.length,o=e.length,a={};++i<r;){var u=i<o?e[i]:n;s(a,t[i],u)}return a}function vi(t){return Xo(t)?t:[]}function yi(t){return"function"==typeof t?t:iu}function wi(t,e){return Ho(t)?t:br(t,e)?[t]:Pr(ya(t))}var bi=Qs;function xi(t,e,s){var i=t.length;return s=s===n?i:s,!e&&s>=i?t:ii(t,e,s)}var Ti=he||function(t){return de.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,s=$t?$t(n):new t.constructor(n);return t.copy(s),s}function ki(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function Ci(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(t,e){if(t!==e){var s=t!==n,i=null===t,r=t==t,o=ca(t),a=e!==n,u=null===e,c=e==e,l=ca(e);if(!u&&!l&&!o&&t>e||o&&a&&c&&!u&&!l||i&&a&&c||!s&&c||!r)return 1;if(!i&&!o&&!l&&t<e||l&&s&&r&&!i&&!o||u&&s&&r||!a&&r||!c)return-1}return 0}function Oi(t,e,n,s){for(var i=-1,r=t.length,o=n.length,a=-1,u=e.length,c=yn(r-o,0),l=xt(u+c),h=!s;++a<u;)l[a]=e[a];for(;++i<o;)(h||i<r)&&(l[n[i]]=t[i]);for(;c--;)l[a++]=t[i++];return l}function Mi(t,e,n,s){for(var i=-1,r=t.length,o=-1,a=n.length,u=-1,c=e.length,l=yn(r-a,0),h=xt(l+c),p=!s;++i<l;)h[i]=t[i];for(var d=i;++u<c;)h[d+u]=e[u];for(;++o<a;)(p||i<r)&&(h[d+n[o]]=t[i++]);return h}function Ei(t,e){var n=-1,s=t.length;for(e||(e=xt(s));++n<s;)e[n]=t[n];return e}function Di(t,e,s,i){var r=!s;s||(s={});for(var o=-1,a=e.length;++o<a;){var u=e[o],c=i?i(s[u],t[u],u,s,t):n;c===n&&(c=t[u]),r?os(s,u,c):ns(s,u,c)}return s}function Ii(t,e){return function(n,s){var i=Ho(n)?Ce:is,r=e?e():{};return i(n,t,cr(s,2),r)}}function Ri(t){return Qs((function(e,s){var i=-1,r=s.length,o=r>1?s[r-1]:n,a=r>2?s[2]:n;for(o=t.length>3&&"function"==typeof o?(r--,o):n,a&&wr(s[0],s[1],a)&&(o=r<3?n:o,r=1),e=St(e);++i<r;){var u=s[i];u&&t(e,u,i,o)}return e}))}function Ni(t,e){return function(n,s){if(null==n)return n;if(!Go(n))return t(n,s);for(var i=n.length,r=e?i:-1,o=St(n);(e?r--:++r<i)&&!1!==s(o[r],r,o););return n}}function Bi(t){return function(e,n,s){for(var i=-1,r=St(e),o=s(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===n(r[u],u,r))break}return e}}function Pi(t){return function(e){var s=on(e=ya(e))?dn(e):n,i=s?s[0]:e.charAt(0),r=s?xi(s,1).join(""):e.slice(1);return i[t]()+r}}function Vi(t){return function(e){return Be(Ka(Ua(e).replace(Kt,"")),t,"")}}function qi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Wn(t.prototype),s=t.apply(n,e);return ea(s)?s:n}}function Fi(t){return function(e,s,i){var r=St(e);if(!Go(e)){var o=cr(s,3);e=Ia(e),s=function(t){return o(r[t],t,r)}}var a=t(e,s,i);return a>-1?r[o?e[a]:a]:n}}function ji(t){return sr((function(e){var i=e.length,r=i,o=Un.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Et(s);if(o&&!u&&"wrapper"==ar(a))var u=new Un([],!0)}for(r=u?r:i;++r<i;){var c=ar(a=e[r]),l="wrapper"==c?or(a):n;u=l&&xr(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ar(l[0])].apply(u,l[3]):1==a.length&&xr(a)?u[c]():u.thru(a)}return function(){var t=arguments,n=t[0];if(u&&1==t.length&&Ho(n))return u.plant(n).value();for(var s=0,r=i?e[s].apply(this,t):n;++s<i;)r=e[s].call(this,r);return r}}))}function zi(t,e,s,i,r,o,a,u,l,h){var p=e&c,d=1&e,f=2&e,_=24&e,m=512&e,g=f?n:qi(t);return function c(){for(var v=arguments.length,y=xt(v),w=v;w--;)y[w]=arguments[w];if(_)var b=ur(c),x=function(t,e){for(var n=t.length,s=0;n--;)t[n]===e&&++s;return s}(y,b);if(i&&(y=Oi(y,i,r,_)),o&&(y=Mi(y,o,a,_)),v-=x,_&&v<h){var T=cn(y,b);return Xi(t,e,zi,c.placeholder,s,y,T,u,l,h-v)}var A=d?s:this,k=f?A[t]:t;return v=y.length,u?y=function(t,e){var s=t.length,i=wn(e.length,s),r=Ei(t);for(;i--;){var o=e[i];t[i]=yr(o,s)?r[o]:n}return t}(y,u):m&&v>1&&y.reverse(),p&&l<v&&(y.length=l),this&&this!==de&&this instanceof c&&(k=g||qi(k)),k.apply(A,y)}}function Wi(t,e){return function(n,s){return function(t,e,n,s){return bs(t,(function(t,i,r){e(s,n(t),i,r)})),s}(n,t,e(s),{})}}function Li(t,e){return function(s,i){var r;if(s===n&&i===n)return e;if(s!==n&&(r=s),i!==n){if(r===n)return i;"string"==typeof s||"string"==typeof i?(s=li(s),i=li(i)):(s=ci(s),i=ci(i)),r=t(s,i)}return r}}function Ui(t){return sr((function(e){return e=Re(e,Qe(cr())),Qs((function(n){var s=this;return t(e,(function(t){return ke(t,s,n)}))}))}))}function Hi(t,e){var s=(e=e===n?" ":li(e)).length;if(s<2)return s?Ys(e,t):e;var i=Ys(e,_e(t/pn(e)));return on(e)?xi(dn(i),0,t).join(""):i.slice(0,t)}function $i(t){return function(e,s,i){return i&&"number"!=typeof i&&wr(e,s,i)&&(s=i=n),e=fa(e),s===n?(s=e,e=0):s=fa(s),function(t,e,n,s){for(var i=-1,r=yn(_e((e-t)/(n||1)),0),o=xt(r);r--;)o[s?r:++i]=t,t+=n;return o}(e,s,i=i===n?e<s?1:-1:fa(i),t)}}function Gi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ga(e),n=ga(n)),t(e,n)}}function Xi(t,e,s,i,r,o,c,l,h,p){var d=8&e;e|=d?a:u,4&(e&=~(d?u:a))||(e&=-4);var f=[t,e,r,d?o:n,d?c:n,d?n:o,d?n:c,l,h,p],_=s.apply(n,f);return xr(t)&&Er(_,f),_.placeholder=i,Rr(_,t,e)}function Zi(t){var e=Ct[t];return function(t,n){if(t=ga(t),(n=null==n?0:wn(_a(n),292))&&$e(t)){var s=(ya(t)+"e").split("e");return+((s=(ya(e(s[0]+"e"+(+s[1]+n)))+"e").split("e"))[0]+"e"+(+s[1]-n))}return e(t)}}var Yi=On&&1/ln(new On([,-0]))[1]==h?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=_r(e);return n==T?an(e):n==O?hn(e):function(t,e){return Re(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ki(t,e,i,h,p,d,f,_){var m=2&e;if(!m&&"function"!=typeof t)throw new Et(s);var g=h?h.length:0;if(g||(e&=-97,h=p=n),f=f===n?f:yn(_a(f),0),_=_===n?_:_a(_),g-=p?p.length:0,e&u){var v=h,y=p;h=p=n}var w=m?n:or(t),b=[t,e,i,h,p,v,y,d,f,_];if(w&&function(t,e){var n=t[1],s=e[1],i=n|s,o=i<131,a=s==c&&8==n||s==c&&n==l&&t[7].length<=e[8]||384==s&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&s&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var h=t[3];t[3]=h?Oi(h,u,e[4]):u,t[4]=h?cn(t[3],r):e[4]}(u=e[5])&&(h=t[5],t[5]=h?Mi(h,u,e[6]):u,t[6]=h?cn(t[5],r):e[6]);(u=e[7])&&(t[7]=u);s&c&&(t[8]=null==t[8]?e[8]:wn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(b,w),t=b[0],e=b[1],i=b[2],h=b[3],p=b[4],!(_=b[9]=b[9]===n?m?0:t.length:yn(b[9]-g,0))&&24&e&&(e&=-25),e&&1!=e)x=8==e||e==o?function(t,e,s){var i=qi(t);return function r(){for(var o=arguments.length,a=xt(o),u=o,c=ur(r);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==c&&a[o-1]!==c?[]:cn(a,c);return(o-=l.length)<s?Xi(t,e,zi,r.placeholder,n,a,l,n,n,s-o):ke(this&&this!==de&&this instanceof r?i:t,this,a)}}(t,e,_):e!=a&&33!=e||p.length?zi.apply(n,b):function(t,e,n,s){var i=1&e,r=qi(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=s.length,l=xt(c+a),h=this&&this!==de&&this instanceof e?r:t;++u<c;)l[u]=s[u];for(;a--;)l[u++]=arguments[++o];return ke(h,i?n:this,l)}}(t,e,i,h);else var x=function(t,e,n){var s=1&e,i=qi(t);return function e(){return(this&&this!==de&&this instanceof e?i:t).apply(s?n:this,arguments)}}(t,e,i);return Rr((w?ei:Er)(x,b),t,e)}function Ji(t,e,s,i){return t===n||zo(t,Rt[s])&&!Pt.call(i,s)?e:t}function tr(t,e,s,i,r,o){return ea(t)&&ea(e)&&(o.set(e,t),Ls(t,e,n,tr,o),o.delete(e)),t}function er(t){return ra(t)?n:t}function nr(t,e,s,i,r,o){var a=1&s,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=o.get(t),h=o.get(e);if(l&&h)return l==e&&h==t;var p=-1,d=!0,f=2&s?new Zn:n;for(o.set(t,e),o.set(e,t);++p<u;){var _=t[p],m=e[p];if(i)var g=a?i(m,_,p,e,t,o):i(_,m,p,t,e,o);if(g!==n){if(g)continue;d=!1;break}if(f){if(!Ve(e,(function(t,e){if(!Je(f,e)&&(_===t||r(_,t,s,i,o)))return f.push(e)}))){d=!1;break}}else if(_!==m&&!r(_,m,s,i,o)){d=!1;break}}return o.delete(t),o.delete(e),d}function sr(t){return Ir(Sr(t,n,Hr),t+"")}function ir(t){return ks(t,Ia,dr)}function rr(t){return ks(t,Ra,fr)}var or=Dn?function(t){return Dn.get(t)}:cu;function ar(t){for(var e=t.name+"",n=In[e],s=Pt.call(In,e)?n.length:0;s--;){var i=n[s],r=i.func;if(null==r||r==t)return i.name}return e}function ur(t){return(Pt.call(zn,"placeholder")?zn:t).placeholder}function cr(){var t=zn.iteratee||ru;return t=t===ru?Ps:t,arguments.length?t(arguments[0],arguments[1]):t}function lr(t,e){var n,s,i=t.__data__;return("string"==(s=typeof(n=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function hr(t){for(var e=Ia(t),n=e.length;n--;){var s=e[n],i=t[s];e[n]=[s,i,kr(i)]}return e}function pr(t,e){var s=function(t,e){return null==t?n:t[e]}(t,e);return Bs(s)?s:n}var dr=ve?function(t){return null==t?[]:(t=St(t),Ee(ve(t),(function(e){return Zt.call(t,e)})))}:mu,fr=ve?function(t){for(var e=[];t;)Ne(e,dr(t)),t=Gt(t);return e}:mu,_r=Cs;function mr(t,e,n){for(var s=-1,i=(e=wi(e,t)).length,r=!1;++s<i;){var o=Vr(e[s]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++s!=i?r:!!(i=null==t?0:t.length)&&ta(i)&&yr(o,i)&&(Ho(t)||Uo(t))}function gr(t){return"function"!=typeof t.constructor||Ar(t)?{}:Wn(Gt(t))}function vr(t){return Ho(t)||Uo(t)||!!(Qt&&t&&t[Qt])}function yr(t,e){var n=typeof t;return!!(e=null==e?p:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function wr(t,e,n){if(!ea(n))return!1;var s=typeof e;return!!("number"==s?Go(n)&&yr(e,n.length):"string"==s&&e in n)&&zo(n[e],t)}function br(t,e){if(Ho(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(tt.test(t)||!J.test(t)||null!=e&&t in St(e))}function xr(t){var e=ar(t),n=zn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var s=or(n);return!!s&&t===s[0]}(kn&&_r(new kn(new ArrayBuffer(1)))!=R||Cn&&_r(new Cn)!=T||Sn&&_r(Sn.resolve())!=C||On&&_r(new On)!=O||Mn&&_r(new Mn)!=D)&&(_r=function(t){var e=Cs(t),s=e==k?t.constructor:n,i=s?qr(s):"";if(i)switch(i){case Rn:return R;case Nn:return T;case Bn:return C;case Pn:return O;case Vn:return D}return e});var Tr=Nt?Ko:gu;function Ar(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function kr(t){return t==t&&!ea(t)}function Cr(t,e){return function(s){return null!=s&&(s[t]===e&&(e!==n||t in St(s)))}}function Sr(t,e,s){return e=yn(e===n?t.length-1:e,0),function(){for(var n=arguments,i=-1,r=yn(n.length-e,0),o=xt(r);++i<r;)o[i]=n[e+i];i=-1;for(var a=xt(e+1);++i<e;)a[i]=n[i];return a[e]=s(o),ke(t,this,a)}}function Or(t,e){return e.length<2?t:As(t,ii(e,0,-1))}function Mr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Er=Nr(ei),Dr=fe||function(t,e){return de.setTimeout(t,e)},Ir=Nr(ni);function Rr(t,e,n){var s=e+"";return Ir(t,function(t,e){var n=e.length;if(!n)return t;var s=n-1;return e[s]=(n>1?"& ":"")+e[s],e=e.join(n>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(s,function(t,e){return Se(_,(function(n){var s="_."+n[0];e&n[1]&&!De(t,s)&&t.push(s)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(ut):[]}(s),n)))}function Nr(t){var e=0,s=0;return function(){var i=bn(),r=16-(i-s);if(s=i,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(n,arguments)}}function Br(t,e){var s=-1,i=t.length,r=i-1;for(e=e===n?i:e;++s<e;){var o=Zs(s,r),a=t[o];t[o]=t[s],t[s]=a}return t.length=e,t}var Pr=function(t){var e=Bo(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,(function(t,n,s,i){e.push(s?i.replace(ht,"$1"):n||t)})),e}));function Vr(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function qr(t){if(null!=t){try{return Bt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fr(t){if(t instanceof Hn)return t.clone();var e=new Un(t.__wrapped__,t.__chain__);return e.__actions__=Ei(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var jr=Qs((function(t,e){return Xo(t)?ps(t,vs(e,1,Xo,!0)):[]})),zr=Qs((function(t,e){var s=Yr(e);return Xo(s)&&(s=n),Xo(t)?ps(t,vs(e,1,Xo,!0),cr(s,2)):[]})),Wr=Qs((function(t,e){var s=Yr(e);return Xo(s)&&(s=n),Xo(t)?ps(t,vs(e,1,Xo,!0),n,s):[]}));function Lr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),je(t,cr(e,3),i)}function Ur(t,e,s){var i=null==t?0:t.length;if(!i)return-1;var r=i-1;return s!==n&&(r=_a(s),r=s<0?yn(i+r,0):wn(r,i-1)),je(t,cr(e,3),r,!0)}function Hr(t){return(null==t?0:t.length)?vs(t,1):[]}function $r(t){return t&&t.length?t[0]:n}var Gr=Qs((function(t){var e=Re(t,vi);return e.length&&e[0]===t[0]?Es(e):[]})),Xr=Qs((function(t){var e=Yr(t),s=Re(t,vi);return e===Yr(s)?e=n:s.pop(),s.length&&s[0]===t[0]?Es(s,cr(e,2)):[]})),Zr=Qs((function(t){var e=Yr(t),s=Re(t,vi);return(e="function"==typeof e?e:n)&&s.pop(),s.length&&s[0]===t[0]?Es(s,n,e):[]}));function Yr(t){var e=null==t?0:t.length;return e?t[e-1]:n}var Qr=Qs(Kr);function Kr(t,e){return t&&t.length&&e&&e.length?Gs(t,e):t}var Jr=sr((function(t,e){var n=null==t?0:t.length,s=as(t,e);return Xs(t,Re(e,(function(t){return yr(t,n)?+t:t})).sort(Si)),s}));function to(t){return null==t?t:An.call(t)}var eo=Qs((function(t){return hi(vs(t,1,Xo,!0))})),no=Qs((function(t){var e=Yr(t);return Xo(e)&&(e=n),hi(vs(t,1,Xo,!0),cr(e,2))})),so=Qs((function(t){var e=Yr(t);return e="function"==typeof e?e:n,hi(vs(t,1,Xo,!0),n,e)}));function io(t){if(!t||!t.length)return[];var e=0;return t=Ee(t,(function(t){if(Xo(t))return e=yn(t.length,e),!0})),Ze(e,(function(e){return Re(t,He(e))}))}function ro(t,e){if(!t||!t.length)return[];var s=io(t);return null==e?s:Re(s,(function(t){return ke(e,n,t)}))}var oo=Qs((function(t,e){return Xo(t)?ps(t,e):[]})),ao=Qs((function(t){return mi(Ee(t,Xo))})),uo=Qs((function(t){var e=Yr(t);return Xo(e)&&(e=n),mi(Ee(t,Xo),cr(e,2))})),co=Qs((function(t){var e=Yr(t);return e="function"==typeof e?e:n,mi(Ee(t,Xo),n,e)})),lo=Qs(io);var ho=Qs((function(t){var e=t.length,s=e>1?t[e-1]:n;return s="function"==typeof s?(t.pop(),s):n,ro(t,s)}));function po(t){var e=zn(t);return e.__chain__=!0,e}function fo(t,e){return e(t)}var _o=sr((function(t){var e=t.length,s=e?t[0]:0,i=this.__wrapped__,r=function(e){return as(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Hn&&yr(s)?((i=i.slice(s,+s+(e?1:0))).__actions__.push({func:fo,args:[r],thisArg:n}),new Un(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(n),t}))):this.thru(r)}));var mo=Ii((function(t,e,n){Pt.call(t,n)?++t[n]:os(t,n,1)}));var go=Fi(Lr),vo=Fi(Ur);function yo(t,e){return(Ho(t)?Se:ds)(t,cr(e,3))}function wo(t,e){return(Ho(t)?Oe:fs)(t,cr(e,3))}var bo=Ii((function(t,e,n){Pt.call(t,n)?t[n].push(e):os(t,n,[e])}));var xo=Qs((function(t,e,n){var s=-1,i="function"==typeof e,r=Go(t)?xt(t.length):[];return ds(t,(function(t){r[++s]=i?ke(e,t,n):Ds(t,e,n)})),r})),To=Ii((function(t,e,n){os(t,n,e)}));function Ao(t,e){return(Ho(t)?Re:js)(t,cr(e,3))}var ko=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Co=Qs((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wr(t,e[0],e[1])?e=[]:n>2&&wr(e[0],e[1],e[2])&&(e=[e[0]]),Hs(t,vs(e,1),[])})),So=pe||function(){return de.Date.now()};function Oo(t,e,s){return e=s?n:e,e=t&&null==e?t.length:e,Ki(t,c,n,n,n,n,e)}function Mo(t,e){var i;if("function"!=typeof e)throw new Et(s);return t=_a(t),function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=n),i}}var Eo=Qs((function(t,e,n){var s=1;if(n.length){var i=cn(n,ur(Eo));s|=a}return Ki(t,s,e,n,i)})),Do=Qs((function(t,e,n){var s=3;if(n.length){var i=cn(n,ur(Do));s|=a}return Ki(e,s,t,n,i)}));function Io(t,e,i){var r,o,a,u,c,l,h=0,p=!1,d=!1,f=!0;if("function"!=typeof t)throw new Et(s);function _(e){var s=r,i=o;return r=o=n,h=e,u=t.apply(i,s)}function m(t){var s=t-l;return l===n||s>=e||s<0||d&&t-h>=a}function g(){var t=So();if(m(t))return v(t);c=Dr(g,function(t){var n=e-(t-l);return d?wn(n,a-(t-h)):n}(t))}function v(t){return c=n,f&&r?_(t):(r=o=n,u)}function y(){var t=So(),s=m(t);if(r=arguments,o=this,l=t,s){if(c===n)return function(t){return h=t,c=Dr(g,e),p?_(t):u}(l);if(d)return Ti(c),c=Dr(g,e),_(l)}return c===n&&(c=Dr(g,e)),u}return e=ga(e)||0,ea(i)&&(p=!!i.leading,a=(d="maxWait"in i)?yn(ga(i.maxWait)||0,e):a,f="trailing"in i?!!i.trailing:f),y.cancel=function(){c!==n&&Ti(c),h=0,r=l=o=c=n},y.flush=function(){return c===n?u:v(So())},y}var Ro=Qs((function(t,e){return hs(t,1,e)})),No=Qs((function(t,e,n){return hs(t,ga(e)||0,n)}));function Bo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Et(s);var n=function(){var s=arguments,i=e?e.apply(this,s):s[0],r=n.cache;if(r.has(i))return r.get(i);var o=t.apply(this,s);return n.cache=r.set(i,o)||r,o};return n.cache=new(Bo.Cache||Xn),n}function Po(t){if("function"!=typeof t)throw new Et(s);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bo.Cache=Xn;var Vo=bi((function(t,e){var n=(e=1==e.length&&Ho(e[0])?Re(e[0],Qe(cr())):Re(vs(e,1),Qe(cr()))).length;return Qs((function(s){for(var i=-1,r=wn(s.length,n);++i<r;)s[i]=e[i].call(this,s[i]);return ke(t,this,s)}))})),qo=Qs((function(t,e){var s=cn(e,ur(qo));return Ki(t,a,n,e,s)})),Fo=Qs((function(t,e){var s=cn(e,ur(Fo));return Ki(t,u,n,e,s)})),jo=sr((function(t,e){return Ki(t,l,n,n,n,e)}));function zo(t,e){return t===e||t!=t&&e!=e}var Wo=Gi(Ss),Lo=Gi((function(t,e){return t>=e})),Uo=Is(function(){return arguments}())?Is:function(t){return na(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Ho=xt.isArray,$o=ye?Qe(ye):function(t){return na(t)&&Cs(t)==I};function Go(t){return null!=t&&ta(t.length)&&!Ko(t)}function Xo(t){return na(t)&&Go(t)}var Zo=qe||gu,Yo=we?Qe(we):function(t){return na(t)&&Cs(t)==y};function Qo(t){if(!na(t))return!1;var e=Cs(t);return e==w||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Ko(t){if(!ea(t))return!1;var e=Cs(t);return e==b||e==x||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Jo(t){return"number"==typeof t&&t==_a(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=p}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var sa=be?Qe(be):function(t){return na(t)&&_r(t)==T};function ia(t){return"number"==typeof t||na(t)&&Cs(t)==A}function ra(t){if(!na(t)||Cs(t)!=k)return!1;var e=Gt(t);if(null===e)return!0;var n=Pt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==jt}var oa=xe?Qe(xe):function(t){return na(t)&&Cs(t)==S};var aa=Te?Qe(Te):function(t){return na(t)&&_r(t)==O};function ua(t){return"string"==typeof t||!Ho(t)&&na(t)&&Cs(t)==M}function ca(t){return"symbol"==typeof t||na(t)&&Cs(t)==E}var la=Ae?Qe(Ae):function(t){return na(t)&&ta(t.length)&&!!oe[Cs(t)]};var ha=Gi(Fs),pa=Gi((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Go(t))return ua(t)?dn(t):Ei(t);if(te&&t[te])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[te]());var e=_r(t);return(e==T?an:e==O?ln:za)(t)}function fa(t){return t?(t=ga(t))===h||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function _a(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ma(t){return t?us(_a(t),0,f):0}function ga(t){if("number"==typeof t)return t;if(ca(t))return d;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ye(t);var n=_t.test(t);return n||gt.test(t)?le(t.slice(2),n?2:8):ft.test(t)?d:+t}function va(t){return Di(t,Ra(t))}function ya(t){return null==t?"":li(t)}var wa=Ri((function(t,e){if(Ar(e)||Go(e))Di(e,Ia(e),t);else for(var n in e)Pt.call(e,n)&&ns(t,n,e[n])})),ba=Ri((function(t,e){Di(e,Ra(e),t)})),xa=Ri((function(t,e,n,s){Di(e,Ra(e),t,s)})),Ta=Ri((function(t,e,n,s){Di(e,Ia(e),t,s)})),Aa=sr(as);var ka=Qs((function(t,e){t=St(t);var s=-1,i=e.length,r=i>2?e[2]:n;for(r&&wr(e[0],e[1],r)&&(i=1);++s<i;)for(var o=e[s],a=Ra(o),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===n||zo(h,Rt[l])&&!Pt.call(t,l))&&(t[l]=o[l])}return t})),Ca=Qs((function(t){return t.push(n,tr),ke(Ba,n,t)}));function Sa(t,e,s){var i=null==t?n:As(t,e);return i===n?s:i}function Oa(t,e){return null!=t&&mr(t,e,Ms)}var Ma=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=n}),eu(iu)),Ea=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Pt.call(t,e)?t[e].push(n):t[e]=[n]}),cr),Da=Qs(Ds);function Ia(t){return Go(t)?Qn(t):Vs(t)}function Ra(t){return Go(t)?Qn(t,!0):qs(t)}var Na=Ri((function(t,e,n){Ls(t,e,n)})),Ba=Ri((function(t,e,n,s){Ls(t,e,n,s)})),Pa=sr((function(t,e){var n={};if(null==t)return n;var s=!1;e=Re(e,(function(e){return e=wi(e,t),s||(s=e.length>1),e})),Di(t,rr(t),n),s&&(n=cs(n,7,er));for(var i=e.length;i--;)pi(n,e[i]);return n}));var Va=sr((function(t,e){return null==t?{}:function(t,e){return $s(t,e,(function(e,n){return Oa(t,n)}))}(t,e)}));function qa(t,e){if(null==t)return{};var n=Re(rr(t),(function(t){return[t]}));return e=cr(e),$s(t,n,(function(t,n){return e(t,n[0])}))}var Fa=Qi(Ia),ja=Qi(Ra);function za(t){return null==t?[]:Ke(t,Ia(t))}var Wa=Vi((function(t,e,n){return e=e.toLowerCase(),t+(n?La(e):e)}));function La(t){return Qa(ya(t).toLowerCase())}function Ua(t){return(t=ya(t))&&t.replace(yt,nn).replace(Jt,"")}var Ha=Vi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Vi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ga=Pi("toLowerCase");var Xa=Vi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Za=Vi((function(t,e,n){return t+(n?" ":"")+Qa(e)}));var Ya=Vi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Qa=Pi("toUpperCase");function Ka(t,e,s){return t=ya(t),(e=s?n:e)===n?function(t){return se.test(t)}(t)?function(t){return t.match(ee)||[]}(t):function(t){return t.match(ct)||[]}(t):t.match(e)||[]}var Ja=Qs((function(t,e){try{return ke(t,n,e)}catch(t){return Qo(t)?t:new At(t)}})),tu=sr((function(t,e){return Se(e,(function(e){e=Vr(e),os(t,e,Eo(t[e],t))})),t}));function eu(t){return function(){return t}}var nu=ji(),su=ji(!0);function iu(t){return t}function ru(t){return Ps("function"==typeof t?t:cs(t,1))}var ou=Qs((function(t,e){return function(n){return Ds(n,t,e)}})),au=Qs((function(t,e){return function(n){return Ds(t,n,e)}}));function uu(t,e,n){var s=Ia(e),i=Ts(e,s);null!=n||ea(e)&&(i.length||!s.length)||(n=e,e=t,t=this,i=Ts(e,Ia(e)));var r=!(ea(n)&&"chain"in n&&!n.chain),o=Ko(t);return Se(i,(function(n){var s=e[n];t[n]=s,o&&(t.prototype[n]=function(){var e=this.__chain__;if(r||e){var n=t(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:s,args:arguments,thisArg:t}),n.__chain__=e,n}return s.apply(t,Ne([this.value()],arguments))})})),t}function cu(){}var lu=Ui(Re),hu=Ui(Me),pu=Ui(Ve);function du(t){return br(t)?He(Vr(t)):function(t){return function(e){return As(e,t)}}(t)}var fu=$i(),_u=$i(!0);function mu(){return[]}function gu(){return!1}var vu=Li((function(t,e){return t+e}),0),yu=Zi("ceil"),wu=Li((function(t,e){return t/e}),1),bu=Zi("floor");var xu,Tu=Li((function(t,e){return t*e}),1),Au=Zi("round"),ku=Li((function(t,e){return t-e}),0);return zn.after=function(t,e){if("function"!=typeof e)throw new Et(s);return t=_a(t),function(){if(--t<1)return e.apply(this,arguments)}},zn.ary=Oo,zn.assign=wa,zn.assignIn=ba,zn.assignInWith=xa,zn.assignWith=Ta,zn.at=Aa,zn.before=Mo,zn.bind=Eo,zn.bindAll=tu,zn.bindKey=Do,zn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ho(t)?t:[t]},zn.chain=po,zn.chunk=function(t,e,s){e=(s?wr(t,e,s):e===n)?1:yn(_a(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var r=0,o=0,a=xt(_e(i/e));r<i;)a[o++]=ii(t,r,r+=e);return a},zn.compact=function(t){for(var e=-1,n=null==t?0:t.length,s=0,i=[];++e<n;){var r=t[e];r&&(i[s++]=r)}return i},zn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=xt(t-1),n=arguments[0],s=t;s--;)e[s-1]=arguments[s];return Ne(Ho(n)?Ei(n):[n],vs(e,1))},zn.cond=function(t){var e=null==t?0:t.length,n=cr();return t=e?Re(t,(function(t){if("function"!=typeof t[1])throw new Et(s);return[n(t[0]),t[1]]})):[],Qs((function(n){for(var s=-1;++s<e;){var i=t[s];if(ke(i[0],this,n))return ke(i[1],this,n)}}))},zn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ls(n,t,e)}}(cs(t,1))},zn.constant=eu,zn.countBy=mo,zn.create=function(t,e){var n=Wn(t);return null==e?n:rs(n,e)},zn.curry=function t(e,s,i){var r=Ki(e,8,n,n,n,n,n,s=i?n:s);return r.placeholder=t.placeholder,r},zn.curryRight=function t(e,s,i){var r=Ki(e,o,n,n,n,n,n,s=i?n:s);return r.placeholder=t.placeholder,r},zn.debounce=Io,zn.defaults=ka,zn.defaultsDeep=Ca,zn.defer=Ro,zn.delay=No,zn.difference=jr,zn.differenceBy=zr,zn.differenceWith=Wr,zn.drop=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,(e=s||e===n?1:_a(e))<0?0:e,i):[]},zn.dropRight=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,0,(e=i-(e=s||e===n?1:_a(e)))<0?0:e):[]},zn.dropRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0,!0):[]},zn.dropWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0):[]},zn.fill=function(t,e,s,i){var r=null==t?0:t.length;return r?(s&&"number"!=typeof s&&wr(t,e,s)&&(s=0,i=r),function(t,e,s,i){var r=t.length;for((s=_a(s))<0&&(s=-s>r?0:r+s),(i=i===n||i>r?r:_a(i))<0&&(i+=r),i=s>i?0:ma(i);s<i;)t[s++]=e;return t}(t,e,s,i)):[]},zn.filter=function(t,e){return(Ho(t)?Ee:gs)(t,cr(e,3))},zn.flatMap=function(t,e){return vs(Ao(t,e),1)},zn.flatMapDeep=function(t,e){return vs(Ao(t,e),h)},zn.flatMapDepth=function(t,e,s){return s=s===n?1:_a(s),vs(Ao(t,e),s)},zn.flatten=Hr,zn.flattenDeep=function(t){return(null==t?0:t.length)?vs(t,h):[]},zn.flattenDepth=function(t,e){return(null==t?0:t.length)?vs(t,e=e===n?1:_a(e)):[]},zn.flip=function(t){return Ki(t,512)},zn.flow=nu,zn.flowRight=su,zn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,s={};++e<n;){var i=t[e];s[i[0]]=i[1]}return s},zn.functions=function(t){return null==t?[]:Ts(t,Ia(t))},zn.functionsIn=function(t){return null==t?[]:Ts(t,Ra(t))},zn.groupBy=bo,zn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},zn.intersection=Gr,zn.intersectionBy=Xr,zn.intersectionWith=Zr,zn.invert=Ma,zn.invertBy=Ea,zn.invokeMap=xo,zn.iteratee=ru,zn.keyBy=To,zn.keys=Ia,zn.keysIn=Ra,zn.map=Ao,zn.mapKeys=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,e(t,s,i),t)})),n},zn.mapValues=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,s,e(t,s,i))})),n},zn.matches=function(t){return zs(cs(t,1))},zn.matchesProperty=function(t,e){return Ws(t,cs(e,1))},zn.memoize=Bo,zn.merge=Na,zn.mergeWith=Ba,zn.method=ou,zn.methodOf=au,zn.mixin=uu,zn.negate=Po,zn.nthArg=function(t){return t=_a(t),Qs((function(e){return Us(e,t)}))},zn.omit=Pa,zn.omitBy=function(t,e){return qa(t,Po(cr(e)))},zn.once=function(t){return Mo(2,t)},zn.orderBy=function(t,e,s,i){return null==t?[]:(Ho(e)||(e=null==e?[]:[e]),Ho(s=i?n:s)||(s=null==s?[]:[s]),Hs(t,e,s))},zn.over=lu,zn.overArgs=Vo,zn.overEvery=hu,zn.overSome=pu,zn.partial=qo,zn.partialRight=Fo,zn.partition=ko,zn.pick=Va,zn.pickBy=qa,zn.property=du,zn.propertyOf=function(t){return function(e){return null==t?n:As(t,e)}},zn.pull=Qr,zn.pullAll=Kr,zn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Gs(t,e,cr(n,2)):t},zn.pullAllWith=function(t,e,s){return t&&t.length&&e&&e.length?Gs(t,e,n,s):t},zn.pullAt=Jr,zn.range=fu,zn.rangeRight=_u,zn.rearg=jo,zn.reject=function(t,e){return(Ho(t)?Ee:gs)(t,Po(cr(e,3)))},zn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var s=-1,i=[],r=t.length;for(e=cr(e,3);++s<r;){var o=t[s];e(o,s,t)&&(n.push(o),i.push(s))}return Xs(t,i),n},zn.rest=function(t,e){if("function"!=typeof t)throw new Et(s);return Qs(t,e=e===n?e:_a(e))},zn.reverse=to,zn.sampleSize=function(t,e,s){return e=(s?wr(t,e,s):e===n)?1:_a(e),(Ho(t)?Jn:Js)(t,e)},zn.set=function(t,e,n){return null==t?t:ti(t,e,n)},zn.setWith=function(t,e,s,i){return i="function"==typeof i?i:n,null==t?t:ti(t,e,s,i)},zn.shuffle=function(t){return(Ho(t)?ts:si)(t)},zn.slice=function(t,e,s){var i=null==t?0:t.length;return i?(s&&"number"!=typeof s&&wr(t,e,s)?(e=0,s=i):(e=null==e?0:_a(e),s=s===n?i:_a(s)),ii(t,e,s)):[]},zn.sortBy=Co,zn.sortedUniq=function(t){return t&&t.length?ui(t):[]},zn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cr(e,2)):[]},zn.split=function(t,e,s){return s&&"number"!=typeof s&&wr(t,e,s)&&(e=s=n),(s=s===n?f:s>>>0)?(t=ya(t))&&("string"==typeof e||null!=e&&!oa(e))&&!(e=li(e))&&on(t)?xi(dn(t),0,s):t.split(e,s):[]},zn.spread=function(t,e){if("function"!=typeof t)throw new Et(s);return e=null==e?0:yn(_a(e),0),Qs((function(n){var s=n[e],i=xi(n,0,e);return s&&Ne(i,s),ke(t,this,i)}))},zn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},zn.take=function(t,e,s){return t&&t.length?ii(t,0,(e=s||e===n?1:_a(e))<0?0:e):[]},zn.takeRight=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,(e=i-(e=s||e===n?1:_a(e)))<0?0:e,i):[]},zn.takeRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!1,!0):[]},zn.takeWhile=function(t,e){return t&&t.length?fi(t,cr(e,3)):[]},zn.tap=function(t,e){return e(t),t},zn.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new Et(s);return ea(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Io(t,e,{leading:i,maxWait:e,trailing:r})},zn.thru=fo,zn.toArray=da,zn.toPairs=Fa,zn.toPairsIn=ja,zn.toPath=function(t){return Ho(t)?Re(t,Vr):ca(t)?[t]:Ei(Pr(ya(t)))},zn.toPlainObject=va,zn.transform=function(t,e,n){var s=Ho(t),i=s||Zo(t)||la(t);if(e=cr(e,4),null==n){var r=t&&t.constructor;n=i?s?new r:[]:ea(t)&&Ko(r)?Wn(Gt(t)):{}}return(i?Se:bs)(t,(function(t,s,i){return e(n,t,s,i)})),n},zn.unary=function(t){return Oo(t,1)},zn.union=eo,zn.unionBy=no,zn.unionWith=so,zn.uniq=function(t){return t&&t.length?hi(t):[]},zn.uniqBy=function(t,e){return t&&t.length?hi(t,cr(e,2)):[]},zn.uniqWith=function(t,e){return e="function"==typeof e?e:n,t&&t.length?hi(t,n,e):[]},zn.unset=function(t,e){return null==t||pi(t,e)},zn.unzip=io,zn.unzipWith=ro,zn.update=function(t,e,n){return null==t?t:di(t,e,yi(n))},zn.updateWith=function(t,e,s,i){return i="function"==typeof i?i:n,null==t?t:di(t,e,yi(s),i)},zn.values=za,zn.valuesIn=function(t){return null==t?[]:Ke(t,Ra(t))},zn.without=oo,zn.words=Ka,zn.wrap=function(t,e){return qo(yi(e),t)},zn.xor=ao,zn.xorBy=uo,zn.xorWith=co,zn.zip=lo,zn.zipObject=function(t,e){return gi(t||[],e||[],ns)},zn.zipObjectDeep=function(t,e){return gi(t||[],e||[],ti)},zn.zipWith=ho,zn.entries=Fa,zn.entriesIn=ja,zn.extend=ba,zn.extendWith=xa,uu(zn,zn),zn.add=vu,zn.attempt=Ja,zn.camelCase=Wa,zn.capitalize=La,zn.ceil=yu,zn.clamp=function(t,e,s){return s===n&&(s=e,e=n),s!==n&&(s=(s=ga(s))==s?s:0),e!==n&&(e=(e=ga(e))==e?e:0),us(ga(t),e,s)},zn.clone=function(t){return cs(t,4)},zn.cloneDeep=function(t){return cs(t,5)},zn.cloneDeepWith=function(t,e){return cs(t,5,e="function"==typeof e?e:n)},zn.cloneWith=function(t,e){return cs(t,4,e="function"==typeof e?e:n)},zn.conformsTo=function(t,e){return null==e||ls(t,e,Ia(e))},zn.deburr=Ua,zn.defaultTo=function(t,e){return null==t||t!=t?e:t},zn.divide=wu,zn.endsWith=function(t,e,s){t=ya(t),e=li(e);var i=t.length,r=s=s===n?i:us(_a(s),0,i);return(s-=e.length)>=0&&t.slice(s,r)==e},zn.eq=zo,zn.escape=function(t){return(t=ya(t))&&Z.test(t)?t.replace(G,sn):t},zn.escapeRegExp=function(t){return(t=ya(t))&&st.test(t)?t.replace(nt,"\\$&"):t},zn.every=function(t,e,s){var i=Ho(t)?Me:_s;return s&&wr(t,e,s)&&(e=n),i(t,cr(e,3))},zn.find=go,zn.findIndex=Lr,zn.findKey=function(t,e){return Fe(t,cr(e,3),bs)},zn.findLast=vo,zn.findLastIndex=Ur,zn.findLastKey=function(t,e){return Fe(t,cr(e,3),xs)},zn.floor=bu,zn.forEach=yo,zn.forEachRight=wo,zn.forIn=function(t,e){return null==t?t:ys(t,cr(e,3),Ra)},zn.forInRight=function(t,e){return null==t?t:ws(t,cr(e,3),Ra)},zn.forOwn=function(t,e){return t&&bs(t,cr(e,3))},zn.forOwnRight=function(t,e){return t&&xs(t,cr(e,3))},zn.get=Sa,zn.gt=Wo,zn.gte=Lo,zn.has=function(t,e){return null!=t&&mr(t,e,Os)},zn.hasIn=Oa,zn.head=$r,zn.identity=iu,zn.includes=function(t,e,n,s){t=Go(t)?t:za(t),n=n&&!s?_a(n):0;var i=t.length;return n<0&&(n=yn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&ze(t,e,n)>-1},zn.indexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),ze(t,e,i)},zn.inRange=function(t,e,s){return e=fa(e),s===n?(s=e,e=0):s=fa(s),function(t,e,n){return t>=wn(e,n)&&t<yn(e,n)}(t=ga(t),e,s)},zn.invoke=Da,zn.isArguments=Uo,zn.isArray=Ho,zn.isArrayBuffer=$o,zn.isArrayLike=Go,zn.isArrayLikeObject=Xo,zn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Cs(t)==v},zn.isBuffer=Zo,zn.isDate=Yo,zn.isElement=function(t){return na(t)&&1===t.nodeType&&!ra(t)},zn.isEmpty=function(t){if(null==t)return!0;if(Go(t)&&(Ho(t)||"string"==typeof t||"function"==typeof t.splice||Zo(t)||la(t)||Uo(t)))return!t.length;var e=_r(t);if(e==T||e==O)return!t.size;if(Ar(t))return!Vs(t).length;for(var n in t)if(Pt.call(t,n))return!1;return!0},zn.isEqual=function(t,e){return Rs(t,e)},zn.isEqualWith=function(t,e,s){var i=(s="function"==typeof s?s:n)?s(t,e):n;return i===n?Rs(t,e,n,s):!!i},zn.isError=Qo,zn.isFinite=function(t){return"number"==typeof t&&$e(t)},zn.isFunction=Ko,zn.isInteger=Jo,zn.isLength=ta,zn.isMap=sa,zn.isMatch=function(t,e){return t===e||Ns(t,e,hr(e))},zn.isMatchWith=function(t,e,s){return s="function"==typeof s?s:n,Ns(t,e,hr(e),s)},zn.isNaN=function(t){return ia(t)&&t!=+t},zn.isNative=function(t){if(Tr(t))throw new At("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bs(t)},zn.isNil=function(t){return null==t},zn.isNull=function(t){return null===t},zn.isNumber=ia,zn.isObject=ea,zn.isObjectLike=na,zn.isPlainObject=ra,zn.isRegExp=oa,zn.isSafeInteger=function(t){return Jo(t)&&t>=-9007199254740991&&t<=p},zn.isSet=aa,zn.isString=ua,zn.isSymbol=ca,zn.isTypedArray=la,zn.isUndefined=function(t){return t===n},zn.isWeakMap=function(t){return na(t)&&_r(t)==D},zn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Cs(t)},zn.join=function(t,e){return null==t?"":gn.call(t,e)},zn.kebabCase=Ha,zn.last=Yr,zn.lastIndexOf=function(t,e,s){var i=null==t?0:t.length;if(!i)return-1;var r=i;return s!==n&&(r=(r=_a(s))<0?yn(i+r,0):wn(r,i-1)),e==e?function(t,e,n){for(var s=n+1;s--;)if(t[s]===e)return s;return s}(t,e,r):je(t,Le,r,!0)},zn.lowerCase=$a,zn.lowerFirst=Ga,zn.lt=ha,zn.lte=pa,zn.max=function(t){return t&&t.length?ms(t,iu,Ss):n},zn.maxBy=function(t,e){return t&&t.length?ms(t,cr(e,2),Ss):n},zn.mean=function(t){return Ue(t,iu)},zn.meanBy=function(t,e){return Ue(t,cr(e,2))},zn.min=function(t){return t&&t.length?ms(t,iu,Fs):n},zn.minBy=function(t,e){return t&&t.length?ms(t,cr(e,2),Fs):n},zn.stubArray=mu,zn.stubFalse=gu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Tu,zn.nth=function(t,e){return t&&t.length?Us(t,_a(e)):n},zn.noConflict=function(){return de._===this&&(de._=zt),this},zn.noop=cu,zn.now=So,zn.pad=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;if(!e||s>=e)return t;var i=(e-s)/2;return Hi(ge(i),n)+t+Hi(_e(i),n)},zn.padEnd=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;return e&&s<e?t+Hi(e-s,n):t},zn.padStart=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;return e&&s<e?Hi(e-s,n)+t:t},zn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(ya(t).replace(it,""),e||0)},zn.random=function(t,e,s){if(s&&"boolean"!=typeof s&&wr(t,e,s)&&(e=s=n),s===n&&("boolean"==typeof e?(s=e,e=n):"boolean"==typeof t&&(s=t,t=n)),t===n&&e===n?(t=0,e=1):(t=fa(t),e===n?(e=t,t=0):e=fa(e)),t>e){var i=t;t=e,e=i}if(s||t%1||e%1){var r=Tn();return wn(t+r*(e-t+ce("1e-"+((r+"").length-1))),e)}return Zs(t,e)},zn.reduce=function(t,e,n){var s=Ho(t)?Be:Ge,i=arguments.length<3;return s(t,cr(e,4),n,i,ds)},zn.reduceRight=function(t,e,n){var s=Ho(t)?Pe:Ge,i=arguments.length<3;return s(t,cr(e,4),n,i,fs)},zn.repeat=function(t,e,s){return e=(s?wr(t,e,s):e===n)?1:_a(e),Ys(ya(t),e)},zn.replace=function(){var t=arguments,e=ya(t[0]);return t.length<3?e:e.replace(t[1],t[2])},zn.result=function(t,e,s){var i=-1,r=(e=wi(e,t)).length;for(r||(r=1,t=n);++i<r;){var o=null==t?n:t[Vr(e[i])];o===n&&(i=r,o=s),t=Ko(o)?o.call(t):o}return t},zn.round=Au,zn.runInContext=t,zn.sample=function(t){return(Ho(t)?Kn:Ks)(t)},zn.size=function(t){if(null==t)return 0;if(Go(t))return ua(t)?pn(t):t.length;var e=_r(t);return e==T||e==O?t.size:Vs(t).length},zn.snakeCase=Xa,zn.some=function(t,e,s){var i=Ho(t)?Ve:ri;return s&&wr(t,e,s)&&(e=n),i(t,cr(e,3))},zn.sortedIndex=function(t,e){return oi(t,e)},zn.sortedIndexBy=function(t,e,n){return ai(t,e,cr(n,2))},zn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var s=oi(t,e);if(s<n&&zo(t[s],e))return s}return-1},zn.sortedLastIndex=function(t,e){return oi(t,e,!0)},zn.sortedLastIndexBy=function(t,e,n){return ai(t,e,cr(n,2),!0)},zn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=oi(t,e,!0)-1;if(zo(t[n],e))return n}return-1},zn.startCase=Za,zn.startsWith=function(t,e,n){return t=ya(t),n=null==n?0:us(_a(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},zn.subtract=ku,zn.sum=function(t){return t&&t.length?Xe(t,iu):0},zn.sumBy=function(t,e){return t&&t.length?Xe(t,cr(e,2)):0},zn.template=function(t,e,s){var i=zn.templateSettings;s&&wr(t,e,s)&&(e=n),t=ya(t),e=xa({},e,i,Ji);var r,o,a=xa({},e.imports,i.imports,Ji),u=Ia(a),c=Ke(a,u),l=0,h=e.interpolate||wt,p="__p += '",d=Ot((e.escape||wt).source+"|"+h.source+"|"+(h===K?pt:wt).source+"|"+(e.evaluate||wt).source+"|$","g"),f="//# sourceURL="+(Pt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++re+"]")+"\n";t.replace(d,(function(e,n,s,i,a,u){return s||(s=i),p+=t.slice(l,u).replace(bt,rn),n&&(r=!0,p+="' +\n__e("+n+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),s&&(p+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"),l=u+e.length,e})),p+="';\n";var _=Pt.call(e,"variable")&&e.variable;if(_){if(lt.test(_))throw new At("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(L,""):p).replace(U,"$1").replace(H,"$1;"),p="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Ja((function(){return kt(u,f+"return "+p).apply(n,c)}));if(m.source=p,Qo(m))throw m;return m},zn.times=function(t,e){if((t=_a(t))<1||t>p)return[];var n=f,s=wn(t,f);e=cr(e),t-=f;for(var i=Ze(s,e);++n<t;)e(n);return i},zn.toFinite=fa,zn.toInteger=_a,zn.toLength=ma,zn.toLower=function(t){return ya(t).toLowerCase()},zn.toNumber=ga,zn.toSafeInteger=function(t){return t?us(_a(t),-9007199254740991,p):0===t?t:0},zn.toString=ya,zn.toUpper=function(t){return ya(t).toUpperCase()},zn.trim=function(t,e,s){if((t=ya(t))&&(s||e===n))return Ye(t);if(!t||!(e=li(e)))return t;var i=dn(t),r=dn(e);return xi(i,tn(i,r),en(i,r)+1).join("")},zn.trimEnd=function(t,e,s){if((t=ya(t))&&(s||e===n))return t.slice(0,fn(t)+1);if(!t||!(e=li(e)))return t;var i=dn(t);return xi(i,0,en(i,dn(e))+1).join("")},zn.trimStart=function(t,e,s){if((t=ya(t))&&(s||e===n))return t.replace(it,"");if(!t||!(e=li(e)))return t;var i=dn(t);return xi(i,tn(i,dn(e))).join("")},zn.truncate=function(t,e){var s=30,i="...";if(ea(e)){var r="separator"in e?e.separator:r;s="length"in e?_a(e.length):s,i="omission"in e?li(e.omission):i}var o=(t=ya(t)).length;if(on(t)){var a=dn(t);o=a.length}if(s>=o)return t;var u=s-pn(i);if(u<1)return i;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(r===n)return c+i;if(a&&(u+=c.length-u),oa(r)){if(t.slice(u).search(r)){var l,h=c;for(r.global||(r=Ot(r.source,ya(dt.exec(r))+"g")),r.lastIndex=0;l=r.exec(h);)var p=l.index;c=c.slice(0,p===n?u:p)}}else if(t.indexOf(li(r),u)!=u){var d=c.lastIndexOf(r);d>-1&&(c=c.slice(0,d))}return c+i},zn.unescape=function(t){return(t=ya(t))&&X.test(t)?t.replace($,_n):t},zn.uniqueId=function(t){var e=++Vt;return ya(t)+e},zn.upperCase=Ya,zn.upperFirst=Qa,zn.each=yo,zn.eachRight=wo,zn.first=$r,uu(zn,(xu={},bs(zn,(function(t,e){Pt.call(zn.prototype,e)||(xu[e]=t)})),xu),{chain:!1}),zn.VERSION="4.17.21",Se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){zn[t].placeholder=zn})),Se(["drop","take"],(function(t,e){Hn.prototype[t]=function(s){s=s===n?1:yn(_a(s),0);var i=this.__filtered__&&!e?new Hn(this):this.clone();return i.__filtered__?i.__takeCount__=wn(s,i.__takeCount__):i.__views__.push({size:wn(s,f),type:t+(i.__dir__<0?"Right":"")}),i},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Se(["filter","map","takeWhile"],(function(t,e){var n=e+1,s=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cr(t,3),type:n}),e.__filtered__=e.__filtered__||s,e}})),Se(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),Se(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(iu)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Qs((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ds(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Po(cr(t)))},Hn.prototype.slice=function(t,e){t=_a(t);var s=this;return s.__filtered__&&(t>0||e<0)?new Hn(s):(t<0?s=s.takeRight(-t):t&&(s=s.drop(t)),e!==n&&(s=(e=_a(e))<0?s.dropRight(-e):s.take(e-t)),s)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(f)},bs(Hn.prototype,(function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),r=zn[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);r&&(zn.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,u=e instanceof Hn,c=a[0],l=u||Ho(e),h=function(t){var e=r.apply(zn,Ne([t],a));return i&&p?e[0]:e};l&&s&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,_=u&&!d;if(!o&&l){e=_?e:new Hn(this);var m=t.apply(e,a);return m.__actions__.push({func:fo,args:[h],thisArg:n}),new Un(m,p)}return f&&_?t.apply(this,a):(m=this.thru(h),f?i?m.value()[0]:m.value():m)})})),Se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Dt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);zn.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(Ho(i)?i:[],t)}return this[n]((function(n){return e.apply(Ho(n)?n:[],t)}))}})),bs(Hn.prototype,(function(t,e){var n=zn[e];if(n){var s=n.name+"";Pt.call(In,s)||(In[s]=[]),In[s].push({name:e,func:n})}})),In[zi(n,2).name]=[{name:"wrapper",func:n}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Ei(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ei(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ei(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ho(t),s=e<0,i=n?t.length:0,r=function(t,e,n){var s=-1,i=n.length;for(;++s<i;){var r=n[s],o=r.size;switch(r.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=wn(e,t+o);break;case"takeRight":t=yn(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=r.start,a=r.end,u=a-o,c=s?a:o-1,l=this.__iteratees__,h=l.length,p=0,d=wn(u,this.__takeCount__);if(!n||!s&&i==u&&d==u)return _i(t,this.__actions__);var f=[];t:for(;u--&&p<d;){for(var _=-1,m=t[c+=e];++_<h;){var g=l[_],v=g.iteratee,y=g.type,w=v(m);if(2==y)m=w;else if(!w){if(1==y)continue t;break t}}f[p++]=m}return f},zn.prototype.at=_o,zn.prototype.chain=function(){return po(this)},zn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===n&&(this.__values__=da(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},zn.prototype.plant=function(t){for(var e,s=this;s instanceof Ln;){var i=Fr(s);i.__index__=0,i.__values__=n,e?r.__wrapped__=i:e=i;var r=i;s=s.__wrapped__}return r.__wrapped__=t,e},zn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var e=t;return this.__actions__.length&&(e=new Hn(this)),(e=e.reverse()).__actions__.push({func:fo,args:[to],thisArg:n}),new Un(e,this.__chain__)}return this.thru(to)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return _i(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,te&&(zn.prototype[te]=function(){return this}),zn}();_e?((_e.exports=mn)._=mn,fe._=mn):de._=mn}).call(Uo)}($o,$o.exports);var Go,Xo=$o.exports,Zo=new Uint8Array(16);function Yo(){if(!Go&&!(Go="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Go(Zo)}var Qo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Ko=[],Jo=0;Jo<256;++Jo)Ko.push((Jo+256).toString(16).substr(1));function ta(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ko[t[e+0]]+Ko[t[e+1]]+Ko[t[e+2]]+Ko[t[e+3]]+"-"+Ko[t[e+4]]+Ko[t[e+5]]+"-"+Ko[t[e+6]]+Ko[t[e+7]]+"-"+Ko[t[e+8]]+Ko[t[e+9]]+"-"+Ko[t[e+10]]+Ko[t[e+11]]+Ko[t[e+12]]+Ko[t[e+13]]+Ko[t[e+14]]+Ko[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&Qo.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n}function ea(t,e,n){var s=(t=t||{}).random||(t.rng||Yo)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=s[i];return e}return ta(s)}var na={exports:{}};var sa,ia={exports:{}};function ra(){return sa||(sa=1,ia.exports=function(){var t=t||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==Uo&&Uo.crypto&&(n=Uo.crypto),!n)try{n=require("crypto")}catch(t){}var s=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},a=o.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,s=this.sigBytes,i=t.sigBytes;if(this.clamp(),s%4)for(var r=0;r<i;r++){var o=n[r>>>2]>>>24-r%4*8&255;e[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a<i;a+=4)e[s+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(s());return new u.init(e,t)}}),c=r.enc={},l=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s+=2)n[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new u.init(n,e/2)}},h=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s++)n[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new u.init(n,e)}},p=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,l=t.min(4*c,r);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(i,h);n=i.splice(0,c),s.sigBytes-=l}return new u.init(n,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});o.Hasher=d.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=r.algo={};return r}(Math);return t}()),ia.exports}var oa,aa={exports:{}};function ua(){return oa||(oa=1,aa.exports=function(t){return s=(n=t).lib,i=s.Base,r=s.WordArray,(o=n.x64={}).Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],s=0;s<e;s++){var i=t[s];n.push(i.high),n.push(i.low)}return r.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,s=0;s<n;s++)e[s]=e[s].clone();return t}}),t;var e,n,s,i,r,o}(ra())),aa.exports}var ca,la={exports:{}};function ha(){return ca||(ca=1,la.exports=function(t){return function(){if("function"==typeof ArrayBuffer){var e=t.lib.WordArray,n=e.init,s=e.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,s=[],i=0;i<e;i++)s[i>>>2]|=t[i]<<24-i%4*8;n.call(this,s,e)}else n.apply(this,arguments)};s.prototype=e}}(),t.lib.WordArray}(ra())),la.exports}var pa,da={exports:{}};function fa(){return pa||(pa=1,da.exports=function(t){return function(){var e=t,n=e.lib.WordArray,s=e.enc;function i(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i+=2){var r=e[i>>>2]>>>16-i%4*8&65535;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return n.create(s,2*e)}},s.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],r=0;r<n;r+=2){var o=i(e[r>>>2]>>>16-r%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(t){for(var e=t.length,s=[],r=0;r<e;r++)s[r>>>1]|=i(t.charCodeAt(r)<<16-r%2*16);return n.create(s,2*e)}}}(),t.enc.Utf16}(ra())),da.exports}var _a,ma={exports:{}};function ga(){return _a||(_a=1,ma.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,s=this._map;t.clamp();for(var i=[],r=0;r<n;r+=3)for(var o=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a<n;a++)i.push(s.charAt(o>>>6*(3-a)&63));var u=s.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r<n.length;r++)i[n.charCodeAt(r)]=r}var o=n.charAt(64);if(o){var a=t.indexOf(o);-1!==a&&(e=a)}return s(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64}(ra())),ma.exports}var va,ya={exports:{}};function wa(){return va||(va=1,ya.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var n=t.words,s=t.sigBytes,i=e?this._safe_map:this._map;t.clamp();for(var r=[],o=0;o<s;o+=3)for(var a=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,u=0;u<4&&o+.75*u<s;u++)r.push(i.charAt(a>>>6*(3-u)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var n=t.length,i=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<i.length;o++)r[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var u=t.indexOf(a);-1!==u&&(n=u)}return s(t,n,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),t.enc.Base64url}(ra())),ya.exports}var ba,xa={exports:{}};function Ta(){return ba||(ba=1,xa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,o=t[e+0],u=t[e+1],d=t[e+2],f=t[e+3],_=t[e+4],m=t[e+5],g=t[e+6],v=t[e+7],y=t[e+8],w=t[e+9],b=t[e+10],x=t[e+11],T=t[e+12],A=t[e+13],k=t[e+14],C=t[e+15],S=r[0],O=r[1],M=r[2],E=r[3];S=c(S,O,M,E,o,7,a[0]),E=c(E,S,O,M,u,12,a[1]),M=c(M,E,S,O,d,17,a[2]),O=c(O,M,E,S,f,22,a[3]),S=c(S,O,M,E,_,7,a[4]),E=c(E,S,O,M,m,12,a[5]),M=c(M,E,S,O,g,17,a[6]),O=c(O,M,E,S,v,22,a[7]),S=c(S,O,M,E,y,7,a[8]),E=c(E,S,O,M,w,12,a[9]),M=c(M,E,S,O,b,17,a[10]),O=c(O,M,E,S,x,22,a[11]),S=c(S,O,M,E,T,7,a[12]),E=c(E,S,O,M,A,12,a[13]),M=c(M,E,S,O,k,17,a[14]),S=l(S,O=c(O,M,E,S,C,22,a[15]),M,E,u,5,a[16]),E=l(E,S,O,M,g,9,a[17]),M=l(M,E,S,O,x,14,a[18]),O=l(O,M,E,S,o,20,a[19]),S=l(S,O,M,E,m,5,a[20]),E=l(E,S,O,M,b,9,a[21]),M=l(M,E,S,O,C,14,a[22]),O=l(O,M,E,S,_,20,a[23]),S=l(S,O,M,E,w,5,a[24]),E=l(E,S,O,M,k,9,a[25]),M=l(M,E,S,O,f,14,a[26]),O=l(O,M,E,S,y,20,a[27]),S=l(S,O,M,E,A,5,a[28]),E=l(E,S,O,M,d,9,a[29]),M=l(M,E,S,O,v,14,a[30]),S=h(S,O=l(O,M,E,S,T,20,a[31]),M,E,m,4,a[32]),E=h(E,S,O,M,y,11,a[33]),M=h(M,E,S,O,x,16,a[34]),O=h(O,M,E,S,k,23,a[35]),S=h(S,O,M,E,u,4,a[36]),E=h(E,S,O,M,_,11,a[37]),M=h(M,E,S,O,v,16,a[38]),O=h(O,M,E,S,b,23,a[39]),S=h(S,O,M,E,A,4,a[40]),E=h(E,S,O,M,o,11,a[41]),M=h(M,E,S,O,f,16,a[42]),O=h(O,M,E,S,g,23,a[43]),S=h(S,O,M,E,w,4,a[44]),E=h(E,S,O,M,T,11,a[45]),M=h(M,E,S,O,C,16,a[46]),S=p(S,O=h(O,M,E,S,d,23,a[47]),M,E,o,6,a[48]),E=p(E,S,O,M,v,10,a[49]),M=p(M,E,S,O,k,15,a[50]),O=p(O,M,E,S,m,21,a[51]),S=p(S,O,M,E,T,6,a[52]),E=p(E,S,O,M,f,10,a[53]),M=p(M,E,S,O,b,15,a[54]),O=p(O,M,E,S,u,21,a[55]),S=p(S,O,M,E,y,6,a[56]),E=p(E,S,O,M,C,10,a[57]),M=p(M,E,S,O,g,15,a[58]),O=p(O,M,E,S,A,21,a[59]),S=p(S,O,M,E,_,6,a[60]),E=p(E,S,O,M,x,10,a[61]),M=p(M,E,S,O,d,15,a[62]),O=p(O,M,E,S,w,21,a[63]),r[0]=r[0]+S|0,r[1]=r[1]+O|0,r[2]=r[2]+M|0,r[3]=r[3]+E|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var r=e.floor(s/4294967296),o=s;n[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,s,i,r,o){var a=t+(e&n|~e&s)+i+o;return(a<<r|a>>>32-r)+e}function l(t,e,n,s,i,r,o){var a=t+(e&s|n&~s)+i+o;return(a<<r|a>>>32-r)+e}function h(t,e,n,s,i,r,o){var a=t+(e^n^s)+i+o;return(a<<r|a>>>32-r)+e}function p(t,e,n,s,i,r,o){var a=t+(n^(e|~s))+i+o;return(a<<r|a>>>32-r)+e}n.MD5=r._createHelper(u),n.HmacMD5=r._createHmacHelper(u)}(Math),t.MD5}(ra())),xa.exports}var Aa,ka={exports:{}};function Ca(){return Aa||(Aa=1,ka.exports=function(t){return n=(e=t).lib,s=n.WordArray,i=n.Hasher,r=e.algo,o=[],a=r.SHA1=i.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var h=(s<<5|s>>>27)+u+o[c];h+=c<20?1518500249+(i&r|~i&a):c<40?1859775393+(i^r^a):c<60?(i&r|i&a|r&a)-1894007588:(i^r^a)-899497514,u=a,a=r,r=i<<30|i>>>2,i=s,s=h}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(s+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=i._createHelper(a),e.HmacSHA1=i._createHmacHelper(a),t.SHA1;var e,n,s,i,r,o,a}(ra())),ka.exports}var Sa,Oa={exports:{}};function Ma(){return Sa||(Sa=1,Oa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var s=2,i=0;i<64;)t(s)&&(i<8&&(a[i]=n(e.pow(s,.5))),u[i]=n(e.pow(s,1/3)),i++),s++}();var c=[],l=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var f=c[d-15],_=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,m=c[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[d]=_+c[d-7]+g+c[d-16]}var v=s&i^s&r^i&r,y=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),w=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+u[d]+c[d];p=h,h=l,l=a,a=o+w|0,o=r,r=i,i=s,s=w+(y+v)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=r._createHelper(l),n.HmacSHA256=r._createHmacHelper(l)}(Math),t.SHA256}(ra())),Oa.exports}var Ea,Da={exports:{}};var Ia,Ra={exports:{}};function Na(){return Ia||(Ia=1,Ra.exports=function(t){return function(){var e=t,n=e.lib.Hasher,s=e.x64,i=s.Word,r=s.WordArray,o=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=a()}();var l=o.SHA512=n.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=s.high,f=s.low,_=i.high,m=i.low,g=r.high,v=r.low,y=o.high,w=o.low,b=a.high,x=a.low,T=l.high,A=l.low,k=h.high,C=h.low,S=p.high,O=p.low,M=d,E=f,D=_,I=m,R=g,N=v,B=y,P=w,V=b,q=x,F=T,j=A,z=k,W=C,L=S,U=O,H=0;H<80;H++){var $,G,X=c[H];if(H<16)G=X.high=0|t[e+2*H],$=X.low=0|t[e+2*H+1];else{var Z=c[H-15],Y=Z.high,Q=Z.low,K=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,J=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),tt=c[H-2],et=tt.high,nt=tt.low,st=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,it=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),rt=c[H-7],ot=rt.high,at=rt.low,ut=c[H-16],ct=ut.high,lt=ut.low;G=(G=(G=K+ot+(($=J+at)>>>0<J>>>0?1:0))+st+(($+=it)>>>0<it>>>0?1:0))+ct+(($+=lt)>>>0<lt>>>0?1:0),X.high=G,X.low=$}var ht,pt=V&F^~V&z,dt=q&j^~q&W,ft=M&D^M&R^D&R,_t=E&I^E&N^I&N,mt=(M>>>28|E<<4)^(M<<30|E>>>2)^(M<<25|E>>>7),gt=(E>>>28|M<<4)^(E<<30|M>>>2)^(E<<25|M>>>7),vt=(V>>>14|q<<18)^(V>>>18|q<<14)^(V<<23|q>>>9),yt=(q>>>14|V<<18)^(q>>>18|V<<14)^(q<<23|V>>>9),wt=u[H],bt=wt.high,xt=wt.low,Tt=L+vt+((ht=U+yt)>>>0<U>>>0?1:0),At=gt+_t;L=z,U=W,z=F,W=j,F=V,j=q,V=B+(Tt=(Tt=(Tt=Tt+pt+((ht+=dt)>>>0<dt>>>0?1:0))+bt+((ht+=xt)>>>0<xt>>>0?1:0))+G+((ht+=$)>>>0<$>>>0?1:0))+((q=P+ht|0)>>>0<P>>>0?1:0)|0,B=R,P=N,R=D,N=I,D=M,I=E,M=Tt+(mt+ft+(At>>>0<gt>>>0?1:0))+((E=ht+At|0)>>>0<ht>>>0?1:0)|0}f=s.low=f+E,s.high=d+M+(f>>>0<E>>>0?1:0),m=i.low=m+I,i.high=_+D+(m>>>0<I>>>0?1:0),v=r.low=v+N,r.high=g+R+(v>>>0<N>>>0?1:0),w=o.low=w+P,o.high=y+B+(w>>>0<P>>>0?1:0),x=a.low=x+q,a.high=b+V+(x>>>0<q>>>0?1:0),A=l.low=A+j,l.high=T+F+(A>>>0<j>>>0?1:0),C=h.low=C+W,h.high=k+z+(C>>>0<W>>>0?1:0),O=p.low=O+U,p.high=S+L+(O>>>0<U>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[30+(s+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(s+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(l),e.HmacSHA512=n._createHmacHelper(l)}(),t.SHA512}(ra(),ua())),Ra.exports}var Ba,Pa={exports:{}};var Va,qa={exports:{}};function Fa(){return Va||(Va=1,qa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.x64.Word,a=n.algo,u=[],c=[],l=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var s=(2*t+3*e)%5;t=e%5,e=s}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var a=0,h=0,p=0;p<7;p++){if(1&i){var d=(1<<p)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[r]=o.create(a,h)}}();var h=[];!function(){for(var t=0;t<25;t++)h[t]=o.create()}();var p=a.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,s=this.blockSize/2,i=0;i<s;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(O=n[i]).high^=o,O.low^=r}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var d=0,f=0,_=0;_<5;_++)d^=(O=n[p+5*_]).high,f^=O.low;var m=h[p];m.high=d,m.low=f}for(p=0;p<5;p++){var g=h[(p+4)%5],v=h[(p+1)%5],y=v.high,w=v.low;for(d=g.high^(y<<1|w>>>31),f=g.low^(w<<1|y>>>31),_=0;_<5;_++)(O=n[p+5*_]).high^=d,O.low^=f}for(var b=1;b<25;b++){var x=(O=n[b]).high,T=O.low,A=u[b];A<32?(d=x<<A|T>>>32-A,f=T<<A|x>>>32-A):(d=T<<A-32|x>>>64-A,f=x<<A-32|T>>>64-A);var k=h[c[b]];k.high=d,k.low=f}var C=h[0],S=n[0];for(C.high=S.high,C.low=S.low,p=0;p<5;p++)for(_=0;_<5;_++){var O=n[b=p+5*_],M=h[b],E=h[(p+1)%5+5*_],D=h[(p+2)%5+5*_];O.high=M.high^~E.high&D.high,O.low=M.low^~E.low&D.low}O=n[0];var I=l[a];O.high^=I.high,O.low^=I.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var s=8*t.sigBytes,r=32*this.blockSize;n[s>>>5]|=1<<24-s%32,n[(e.ceil((s+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l<u;l++){var h=o[l],p=h.high,d=h.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(p)}return new i.init(c,a)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=r._createHelper(p),n.HmacSHA3=r._createHmacHelper(p)}(Math),t.SHA3}(ra(),ua())),qa.exports}var ja,za={exports:{}};var Wa,La={exports:{}};function Ua(){return Wa||(Wa=1,La.exports=function(t){var e,n,s;n=(e=t).lib.Base,s=e.enc.Utf8,e.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),a=r.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;r.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}(ra())),La.exports}var Ha,$a={exports:{}};var Ga,Xa={exports:{}};function Za(){return Ga||(Ga=1,Xa.exports=function(t){return n=(e=t).lib,s=n.Base,i=n.WordArray,r=e.algo,o=r.MD5,a=r.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,s=this.cfg,r=s.hasher.create(),o=i.create(),a=o.words,u=s.keySize,c=s.iterations;a.length<u;){n&&r.update(n),n=r.update(t).finalize(e),r.reset();for(var l=1;l<c;l++)n=r.finalize(n),r.reset();o.concat(n)}return o.sigBytes=4*u,o}}),e.EvpKDF=function(t,e,n){return a.create(n).compute(t,e)},t.EvpKDF;var e,n,s,i,r,o,a}(ra(),Ca(),Ua())),Xa.exports}var Ya,Qa={exports:{}};function Ka(){return Ya||(Ya=1,Qa.exports=function(t){t.lib.Cipher||function(e){var n=t,s=n.lib,i=s.Base,r=s.WordArray,o=s.BufferedBlockAlgorithm,a=n.enc;a.Utf8;var u=a.Base64,c=n.algo.EvpKDF,l=s.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:g}return function(e){return{encrypt:function(n,s,i){return t(s).encrypt(e,n,s,i)},decrypt:function(n,s,i){return t(s).decrypt(e,n,s,i)}}}}()});s.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=n.mode={},p=s.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=h.CBC=function(){var t=p.extend();function n(t,n,s){var i,r=this._iv;r?(i=r,this._iv=e):i=this._prevBlock;for(var o=0;o<s;o++)t[n+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i),s.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),t.Decryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);s.decryptBlock(t,e),n.call(this,t,e,i),this._prevBlock=r}}),t}(),f=(n.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,s=n-t.sigBytes%n,i=s<<24|s<<16|s<<8|s,o=[],a=0;a<s;a+=4)o.push(i);var u=r.create(o,s);t.concat(u)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};s.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){var t;l.reset.call(this);var e=this.cfg,n=e.iv,s=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=s.createEncryptor:(t=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(s,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var _=s.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?r.create([1398893684,1701076831]).concat(n).concat(e):e).toString(u)},parse:function(t){var e,n=u.parse(t),s=n.words;return 1398893684==s[0]&&1701076831==s[1]&&(e=r.create(s.slice(2,4)),s.splice(0,4),n.sigBytes-=16),_.create({ciphertext:n,salt:e})}},g=s.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(t,e,n,s){s=this.cfg.extend(s);var i=t.createEncryptor(n,s),r=i.finalize(e),o=i.cfg;return _.create({ciphertext:r,key:n,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:s.format})},decrypt:function(t,e,n,s){return s=this.cfg.extend(s),e=this._parse(e,s.format),t.createDecryptor(n,s).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(n.kdf={}).OpenSSL={execute:function(t,e,n,s,i){if(s||(s=r.random(8)),i)o=c.create({keySize:e+n,hasher:i}).compute(t,s);else var o=c.create({keySize:e+n}).compute(t,s);var a=r.create(o.words.slice(e),4*n);return o.sigBytes=4*e,_.create({key:o,iv:a,salt:s})}},y=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,n,s){var i=(s=this.cfg.extend(s)).kdf.execute(n,t.keySize,t.ivSize,s.salt,s.hasher);s.iv=i.iv;var r=g.encrypt.call(this,t,e,i.key,s);return r.mixIn(i),r},decrypt:function(t,e,n,s){s=this.cfg.extend(s),e=this._parse(e,s.format);var i=s.kdf.execute(n,t.keySize,t.ivSize,e.salt,s.hasher);return s.iv=i.iv,g.decrypt.call(this,t,e,i.key,s)}})}()}(ra(),Za())),Qa.exports}var Ja,tu={exports:{}};function eu(){return Ja||(Ja=1,tu.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function n(t,e,n,s){var i,r=this._iv;r?(i=r.slice(0),this._iv=void 0):i=this._prevBlock,s.encryptBlock(i,0);for(var o=0;o<n;o++)t[e+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i,s),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);n.call(this,t,e,i,s),this._prevBlock=r}}),e}(),t.mode.CFB}(ra(),Ka())),tu.exports}var nu,su={exports:{}};function iu(){return nu||(nu=1,su.exports=function(t){return t.mode.CTR=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._counter;i&&(r=this._counter=i.slice(0),this._iv=void 0);var o=r.slice(0);n.encryptBlock(o,0),r[s-1]=r[s-1]+1|0;for(var a=0;a<s;a++)t[e+a]^=o[a]}}),e.Decryptor=n,e),t.mode.CTR;var e,n}(ra(),Ka())),su.exports}var ru,ou={exports:{}};function au(){return ru||(ru=1,ou.exports=function(t){
|
|
7
|
+
*/class wi{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||ri&&this.toString()===ri.TONE_DEBUG_CLASS)&&function(...t){Zs.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}wi.version=t;const bi=1e-6;function xi(t,e){return t>e+bi}function Ti(t,e){return xi(t,e)||ki(t,e)}function Ai(t,e){return t+bi<e}function ki(t,e){return Math.abs(t-e)<bi}class Ci extends wi{constructor(){super(),this.name="Timeline",this._timeline=[];const t=gi(Ci.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if($s(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];$s(Ti(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(ki(this._timeline[e].time,t)){for(let n=e;n>=0&&ki(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ti(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const s=this._timeline.length;let i=s;if(s>0&&this._timeline[s-1][e]<=t)return s-1;for(;n<i;){let s=Math.floor(n+(i-n)/2);const r=this._timeline[s],o=this._timeline[s+1];if(ki(r[e],t)){for(let n=s;n<this._timeline.length;n++){if(!ki(this._timeline[n][e],t))break;s=n}return s}if(Ai(r[e],t)&&xi(o[e],t))return s;xi(r[e],t)?i=s:n=s+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let s=this._search(t),i=this._search(e);return-1!==s&&-1!==i?(this._timeline[s].time!==t&&(s+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,s,i)):-1===s&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&ki(this._timeline[n].time,t)){let s=n;for(let e=n;e>=0&&ki(this._timeline[e].time,t);e--)s=e;this._iterate((t=>{e(t)}),s,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Si=[];function Oi(t){Si.push(t)}const Mi=[];function Ei(t){Mi.push(t)}class Di extends wi{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach((t=>{Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)})),this}once(t,e){const n=(...s)=>{e(...s),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach((n=>{if(Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Qs(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}})),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,s=n.length;t<s;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach((e=>{const n=Object.getOwnPropertyDescriptor(Di.prototype,e);Object.defineProperty(t.prototype,e,n)}))}dispose(){return super.dispose(),this._events=void 0,this}}class Ii extends Di{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Ri extends Ii{constructor(){super(),this.name="Context",this._constants=new Map,this._timeouts=new Ci,this._timeoutIds=0,this._initialized=!1,this.isOffline=!1,this._workletModules=new Map;const t=gi(Ri.getDefaults(),arguments,["context"]);t.context?this._context=t.context:this._context=function(t){return new ks(t)}({latencyHint:t.latencyHint}),this._ticker=new ci(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this._setLatencyHint(t.latencyHint),this.lookAhead=t.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Si.forEach((e=>e(t))),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){$s(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){$s(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){$s(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){$s(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return $s(Ks(Fs),"This node only works in a secure context (https or localhost)"),new Fs(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){$s(Ks(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletModules.has(e)||this._workletModules.set(e,this.rawContext.audioWorklet.addModule(t)),yield this._workletModules.get(e)}))}workletsAreReady(){return ui(this,void 0,void 0,(function*(){const t=[];this._workletModules.forEach((e=>t.push(e))),yield Promise.all(t)}))}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get latencyHint(){return this._latencyHint}_setLatencyHint(t){let e=0;if(this._latencyHint=t,si(t))switch(t){case"interactive":e=.1;break;case"playback":e=.5;break;case"balanced":e=.25}this.lookAhead=e,this.updateInterval=e/2}get rawContext(){return this._context}now(){return this._context.currentTime+this.lookAhead}immediate(){return this._context.currentTime}resume(){return di(this._context)?this._context.resume():Promise.resolve()}close(){return ui(this,void 0,void 0,(function*(){var t;di(this._context)&&(yield this._context.close()),this._initialized&&(t=this,Mi.forEach((e=>e(t))))}))}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const s=this._context.createBufferSource();return s.channelCount=1,s.channelCountMode="explicit",s.buffer=e,s.loop=!0,s.start(0),this._constants.set(t,s),s}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map((t=>this._constants[t].disconnect())),this}_timeoutLoop(){const t=this.now();let e=this._timeouts.peek();for(;this._timeouts.length&&e&&e.time<=t;)e.callback(),this._timeouts.shift(),e=this._timeouts.peek()}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach((e=>{e.id===t&&this._timeouts.remove(e)})),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,s=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),s()},id:n,time:i+e})};return s(),n}}function Ni(t,e){ni(e)?e.forEach((e=>Ni(t,e))):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Bi(t,e){ni(e)?e.forEach((e=>Bi(t,e))):Object.defineProperty(t,e,{writable:!0})}const Pi=()=>{};class Vi extends wi{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Pi;const t=gi(Vi.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,t.url&&fi(t.url)||t.url instanceof Vi?this.set(t.url):si(t.url)&&this.load(t.url).catch(t.onerror)}static getDefaults(){return{onerror:Pi,onload:Pi,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zi().sampleRate}set(t){return t instanceof Vi?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return ui(this,void 0,void 0,(function*(){const e=Vi.load(t).then((t=>{this.set(t),this.onload(this)}));Vi.downloads.push(e);try{yield e}finally{const t=Vi.downloads.indexOf(e);Vi.downloads.splice(t,1)}return this}))}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ni(t)&&t[0].length>0,n=e?t.length:1,s=e?t[0].length:t.length,i=zi(),r=i.createBuffer(n,s,i.sampleRate),o=e||1!==n?t:[t];for(let t=0;t<n;t++)r.copyToChannel(o[t],t);return this._buffer=r,this}toMono(t){if(Js(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map((t=>t/e)),this.fromArray(t)}return this}toArray(t){if(Js(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){const n=Math.floor(t*this.sampleRate),s=Math.floor(e*this.sampleRate);$s(n<s,"The start time must be less than the end time");const i=s-n,r=zi().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)r.copyToChannel(this.getChannelData(t).subarray(n,s),t);return new Vi(r)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new Vi).fromArray(t)}static fromUrl(t){return ui(this,void 0,void 0,(function*(){const e=new Vi;return yield e.load(t)}))}static load(t){return ui(this,void 0,void 0,(function*(){const e=t.match(/\[([^\]\[]+\|.+)\]$/);if(e){const n=e[1].split("|");let s=n[0];for(const t of n)if(Vi.supportsType(t)){s=t;break}t=t.replace(e[0],s)}const n=""===Vi.baseUrl||Vi.baseUrl.endsWith("/")?Vi.baseUrl:Vi.baseUrl+"/",s=yield fetch(n+t);if(!s.ok)throw new Error(`could not load url: ${t}`);const i=yield s.arrayBuffer();return yield zi().decodeAudioData(i)}))}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return ui(this,void 0,void 0,(function*(){for(yield Promise.resolve();Vi.downloads.length;)yield Vi.downloads[0]}))}}Vi.baseUrl="",Vi.downloads=[];class Fi extends Ri{constructor(){var t,e,n;super({clockSource:"offline",context:pi(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zs(t,e,n)),lookAhead:0,updateInterval:pi(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=pi(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return ui(this,void 0,void 0,(function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n==0&&(yield new Promise((t=>setTimeout(t,1))))}}))}render(t=!0){return ui(this,void 0,void 0,(function*(){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Vi(e)}))}close(){return Promise.resolve()}}const qi=new class extends Ii{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){return Promise.resolve()}))}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let ji=qi;function zi(){return ji===qi&&oi&&Wi(new Ri),ji}function Wi(t){ji=di(t)?new Ri(t):pi(t)?new Fi(t):t}if(ri&&!ri.TONE_SILENCE_LOGGING){const e=` * Tone.js ${"v"}${t} * `;console.log(`%c${e}`,"background: #000; color: #fff")}function Li(t){return Math.pow(2,t/12)}let Ui=440;function Hi(t){return Math.round($i(t))}function $i(t){return 69+12*Math.log2(t/Ui)}class Gi extends wi{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),s="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*s:this._beatsToUnits(4/n)*s},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let s=0;return t&&"0"!==t&&(s+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s+=this._beatsToUnits(parseFloat(n)/4)),s},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Gi&&this.fromType(this._val),Qs(this._val))return this._noArg();if(si(this._val)&&Qs(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(ti(this._val)){let t=0;for(const e in this._val)if(Ks(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(Ks(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return si(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Xi extends Gi{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Xi(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),s=this.valueOf();return s+(Math.round(s/n)*n-s)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],s=new Xi(this.context,e[0]).toSeconds();return e.forEach((e=>{const i=new Xi(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(s-t)&&(n=e,s=i)})),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let s=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=s.toString();i.length>3&&(s=parseFloat(parseFloat(i).toFixed(3)));return[n,e,s].join(":")}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())}toSeconds(){return this.valueOf()}toMidi(){return Hi(this.toFrequency())}_now(){return this.context.now()}}class Zi extends Xi{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return Ui}static set A4(t){!function(t){Ui=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Zi.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method(t,e){const n=Yi[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Zi.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let s=1;return t&&"0"!==t&&(s*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s*=this._beatsToUnits(parseFloat(n)/4)),s}}})}transpose(t){return new Zi(this.context,this.valueOf()*Li(t))}harmonize(t){return t.map((t=>this.transpose(t)))}toMidi(){return Hi(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Zi.A4);let n=Math.round(12*e)+57;const s=Math.floor(n/12);s<0&&(n+=-12*s);return Qi[n%12]+s.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return function(t){return Ui*Math.pow(2,(t-69)/12)}(t)}static ftom(t){return Hi(t)}}const Yi={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},Qi=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ki extends Xi{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Ji extends wi{constructor(){super();const t=gi(Ji.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zi()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return new Xi(this.context,t).toSeconds()}toFrequency(t){return new Zi(this.context,t).toFrequency()}toTicks(t){return new Ki(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach((n=>{Qs(t[n])&&delete e[n]})),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach((e=>{if(Reflect.has(this,e)){const n=this[e];Ks(n)&&Ks(n.value)&&Ks(n.setValueAtTime)?t[e]=n.value:n instanceof Ji?t[e]=n._getPartialProperties(t[e]):ni(n)||Js(n)||si(n)||ei(n)?t[e]=n:delete t[e]}})),t}set(t){return Object.keys(t).forEach((e=>{Reflect.has(this,e)&&Ks(this[e])&&(this[e]&&Ks(this[e].value)&&Ks(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Ji?this[e].set(t[e]):this[e]=t[e])})),this}}class tr extends Ci{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return Gs(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class er extends Ji{constructor(){super(gi(er.getDefaults(),arguments,["param","units","convert"])),this.name="Param",this.overridden=!1,this._minOutput=1e-7;const t=gi(er.getDefaults(),arguments,["param","units","convert"]);for($s(Ks(t.param)&&(li(t.param)||t.param instanceof er),"param must be an AudioParam");!li(t.param);)t.param=t.param._param;this._swappable=!!Ks(t.swappable)&&t.swappable,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new Ci(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,Ks(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Ji.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return Ks(this._minValue)?this._minValue:"time"===this.units||"frequency"===this.units||"normalRange"===this.units||"positive"===this.units||"transportTime"===this.units||"ticks"===this.units||"bpm"===this.units||"hertz"===this.units||"samples"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return Ks(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return Ks(this.maxValue)&&Ks(this.minValue)&&Gs(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),s=this._fromType(t);return $s(isFinite(s)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),s=this._events.get(e);let i=this._initialValue;if(null===s)i=this._initialValue;else if("setTargetAtTime"!==s.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=s.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=s.value;if("setTargetAtTime"===s.type){const e=this._events.getBefore(s.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(s.time,t,n.time,n.value,e):this._exponentialInterpolate(s.time,t,n.time,n.value,e)}else i=s.value;else{const t=this._events.getBefore(s.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===s.type&&(i=this._exponentialApproach(s.time,n,s.value,s.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:s,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,s),this._param.linearRampToValueAtTime(n,s),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=ki(n,0)?this._minOutput:n,this._assertRange(n);const s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:s,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,s),this._param.exponentialRampToValueAtTime(n,s),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const s=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,s),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const s=this._fromType(t);$s(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(s),$s(isFinite(s)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:s}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(s,i,n),this}setValueCurveAtTime(t,e,n,s=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*s;this.setValueAtTime(this._toType(i),e);const r=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*s;this.linearRampToValueAtTime(this._toType(i),e+n*r)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return $s(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));$s(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const s=this._events.get(e),i=this._events.getAfter(e);return s&&ki(s.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const s=this._events.getAfter(n.time),i=s?s.time:e+2,r=(i-e)/10;for(let n=e;n<i;n+=r)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,(e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)})),this}setParam(t){$s(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,s,i){return n+(e-n)*Math.exp(-(i-t)/s)}_linearInterpolate(t,e,n,s,i){return e+(i-t)/(n-t)*(s-e)}_exponentialInterpolate(t,e,n,s,i){return e*Math.pow(s/e,(i-t)/(n-t))}}class nr extends Ji{constructor(){super(...arguments),this.name="ToneAudioNode",this._internalChannels=[]}get numberOfInputs(){return Ks(this.input)?li(this.input)||this.input instanceof er?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Ks(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return Ks(t)&&(t instanceof nr||hi(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach((e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation}))}_getChannelProperties(){const t=this._getInternalNodes();$s(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return ir(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Ys("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return function(t,e,n=0,s=0){if(Ks(e))for(;e instanceof nr;)e=e.input;for(;!hi(t);)Ks(t.output)&&(t=t.output);li(e)?t.disconnect(e,n):hi(e)?t.disconnect(e,n,s):t.disconnect()}(this,t,e,n),this}chain(...t){return sr(this,...t),this}fan(...t){return t.forEach((t=>this.connect(t))),this}dispose(){return super.dispose(),Ks(this.input)&&(this.input instanceof nr?this.input.dispose():hi(this.input)&&this.input.disconnect()),Ks(this.output)&&(this.output instanceof nr?this.output.dispose():hi(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function sr(...t){const e=t.shift();t.reduce(((t,e)=>(t instanceof nr?t.connect(e):hi(t)&&ir(t,e),e)),e)}function ir(t,e,n=0,s=0){for($s(Ks(t),"Cannot connect from undefined node"),$s(Ks(e),"Cannot connect to undefined node"),(e instanceof nr||hi(e))&&$s(e.numberOfInputs>0,"Cannot connect to node with no inputs"),$s(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof nr||e instanceof er;)Ks(e.input)&&(e=e.input);for(;t instanceof nr;)Ks(t.output)&&(t=t.output);li(e)?t.connect(e,n):t.connect(e,n,s)}class rr extends nr{constructor(){super(gi(rr.getDefaults(),arguments,["gain","units"])),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode;const t=gi(rr.getDefaults(),arguments,["gain","units"]);this.gain=new er({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Ni(this,"gain")}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class or extends nr{constructor(t){super(t),this.onended=Pi,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rr({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(nr.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Pi})}_startGain(t,e=1){$s(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){$s(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.context.currentTime),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout((()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()}),this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Pi&&(this.onended(this),this.onended=Pi,!this.context.isOffline)){const t=()=>this.dispose();void 0!==window.requestIdleCallback?window.requestIdleCallback(t):setTimeout(t,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),$s(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.disconnect(),this}}class ar extends or{constructor(){super(gi(ar.getDefaults(),arguments,["offset"])),this.name="ToneConstantSource",this._source=this.context.createConstantSource();const t=gi(ar.getDefaults(),arguments,["offset"]);ir(this._source,this._gainNode),this.offset=new er({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(or.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ur extends nr{constructor(){super(gi(ur.getDefaults(),arguments,["value","units"])),this.name="Signal",this.override=!0;const t=gi(ur.getDefaults(),arguments,["value","units"]);this.output=this._constantSource=new ar({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return cr(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,s){return this._param.setValueCurveAtTime(t,e,n,s),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function cr(t,e,n,s){(e instanceof er||li(e)||e instanceof ur&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ur&&(e.overridden=!0)),ir(t,e,n,s)}class lr extends er{constructor(){super(gi(lr.getDefaults(),arguments,["value"])),this.name="TickParam",this._events=new Ci(1/0),this._multiplier=1;const t=gi(lr.getDefaults(),arguments,["value"]);this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(er.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const s=this._fromType(t),i=this._events.get(e),r=Math.round(Math.max(1/n,1));for(let t=0;t<=r;t++){const r=n*t+e,o=this._exponentialApproach(i.time,i.value,s,n,r);this.linearRampToValueAtTime(this._toType(o),r)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),s=this._events.get(e),i=Math.round(Math.max(10*(e-s.time),1)),r=(e-s.time)/i;for(let t=0;t<=i;t++){const i=r*t+s.time,o=this._exponentialInterpolate(s.time,s.value,e,n,i);this.linearRampToValueAtTime(this._toType(o),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Qs(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let s=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(s=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+s)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(e);return this.getTimeOfTick(s+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const s=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-s)/(n.time-e.time),r=Math.sqrt(Math.pow(s,2)-2*i*(e.ticks-t)),o=(-s+r)/i;return(o>0?o:(-s-r)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),s=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+s)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class hr extends ur{constructor(){super(gi(hr.getDefaults(),arguments,["value"])),this.name="TickSignal";const t=gi(hr.getDefaults(),arguments,["value"]);this.input=this._param=new lr({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ur.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class pr extends Ji{constructor(){super(gi(pr.getDefaults(),arguments,["frequency"])),this.name="TickSource",this._state=new tr,this._tickOffset=new Ci;const t=gi(pr.getDefaults(),arguments,["frequency"]);this.frequency=new hr({context:this.context,units:t.units,value:t.frequency}),Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Ji.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),Ks(e)&&this.setTicksAtTime(e,n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&this._state.setStateAtTime("paused",e),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),s={state:"paused",time:e};this._state.add(s);let i=n,r=0;return this._state.forEachBetween(n.time,e+this.sampleTime,(t=>{let e=i.time;const n=this._tickOffset.get(t.time);n&&n.time>=i.time&&(r=n.ticks,e=n.time),"started"===i.state&&"started"!==t.state&&(r+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),i=t})),this._state.remove(s),r}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);let s=e,i=0;return this._state.forEachBetween(e.time,t+this.sampleTime,(t=>{let e=s.time;const n=this._tickOffset.get(t.time);n&&n.time>=s.time&&(i=n.seconds,e=n.time),"started"===s.state&&"started"!==t.state&&(i+=t.time-e),s=t})),this._state.remove(n),i}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),s=this._state.get(e),i=Math.max(n.time,s.time),r=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(r)}forEachTickBetween(t,e,n){let s=this._state.get(t);this._state.forEachBetween(t,e,(e=>{s&&"started"===s.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(s.time,t),e.time-this.sampleTime,n),s=e}));let i=null;if(s&&"started"===s.state){const r=Math.max(s.time,t),o=this.frequency.getTicksAtTime(r),a=o-this.frequency.getTicksAtTime(s.time);let u=Math.ceil(a)-a;u=ki(u,1)?0:u;let c=this.frequency.getTimeOfTick(o+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this.frequency.dispose(),this}}class dr extends Ji{constructor(){super(gi(dr.getDefaults(),arguments,["callback","frequency"])),this.name="Clock",this.callback=Pi,this._lastUpdate=0,this._state=new tr("stopped"),this._boundLoop=this._loop.bind(this);const t=gi(dr.getDefaults(),arguments,["callback","frequency"]);this.callback=t.callback,this._tickSource=new pr({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Xs(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(s+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,(t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}})),this._tickSource.forEachTickBetween(t,e,((t,e)=>{this.callback(t,e)})))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Di.mixin(dr);let fr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["delayTime","maxDelay"])),this.name="Delay";const e=gi(t.getDefaults(),arguments,["delayTime","maxDelay"]),n=this.toSeconds(e.maxDelay);this._maxDelay=Math.max(n,this.toSeconds(e.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(n),this.delayTime=new er({context:this.context,param:this._delayNode.delayTime,units:"time",value:e.delayTime,minValue:0,maxValue:this.maxDelay}),Ni(this,"delayTime")}static getDefaults(){return Object.assign(nr.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}};class _r extends wi{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=gi(_r.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach((e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)}))}static getDefaults(){return{baseUrl:"",onerror:Pi,onload:Pi,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return $s(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every((([t,e])=>e.loaded))}add(t,e,n=Pi,s=Pi){return si(e)?this._buffers.set(t.toString(),new Vi(this.baseUrl+e,n,s)):this._buffers.set(t.toString(),new Vi(e,n,s)),this}dispose(){return super.dispose(),this._buffers.forEach((t=>t.dispose())),this._buffers.clear(),this}}class mr extends Ki{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class gr extends Ji{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Ci,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=t;){const e=this._events.shift();e&&t-e.time<=this.expiration&&e.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}Oi((t=>{t.draw=new gr({context:t})})),Ei((t=>{t.draw.dispose()}));class vr extends wi{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){$s(Ks(t.time),"Events must have a time property"),$s(Ks(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new yr(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,(t=>this.remove(t))),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),s=t.right;s&&(t.right=s.left,s.left=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),s=t.left;s&&(t.left=s.right,s.right=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse((t=>e.push(t))),e.forEach((e=>{e.event&&t(e.event)}))}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse((t=>t.dispose())),this._root=null,this}}class yr{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}let wr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["volume"])),this.name="Volume";const e=gi(t.getDefaults(),arguments,["volume"]);this.input=this.output=new rr({context:this.context,gain:e.volume,units:"decibels"}),this.volume=this.output.gain,Ni(this,"volume"),this._unmutedVolume=e.volume,this.mute=e.mute}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}};class br extends nr{constructor(){super(gi(br.getDefaults(),arguments)),this.name="Destination",this.input=new wr({context:this.context}),this.output=new rr({context:this.context}),this.volume=this.input.volume;const t=gi(br.getDefaults(),arguments);sr(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),sr(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Oi((t=>{t.destination=new br({context:t})})),Ei((t=>{t.destination.dispose()}));class xr extends wi{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ci({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class Tr{constructor(t,e){this.id=Tr._eventId++;const n=Object.assign(Tr.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=n.time}static getDefaults(){return{callback:Pi,once:!1,time:0}}invoke(t){this.callback&&(this.callback(t),this._once&&this.transport.clear(this.id))}dispose(){return this.callback=void 0,this}}Tr._eventId=0;class Ar extends Tr{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Ar.getDefaults(),e);this.duration=new mr(t.context,n.duration).valueOf(),this._interval=new mr(t.context,n.interval).valueOf(),this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Tr.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvents(t){const e=this.transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.time;const e=this.transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds())}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this}}class kr extends Ji{constructor(){super(gi(kr.getDefaults(),arguments)),this.name="Transport",this._loop=new xr(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ci,this._repeatedEvents=new vr,this._syncedSignals=[],this._swingAmount=0;const t=gi(kr.getDefaults(),arguments);this._ppq=t.ppq,this._clock=new dr({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),Ni(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Ji.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),s=Math.sin(n*Math.PI)*this._swingAmount;t+=new mr(this.context,2*this._swingTicks/3).toSeconds()*s}this._timeline.forEachAtTime(e,(e=>e.invoke(t)))}schedule(t,e){const n=new Tr(this,{callback:t,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,s=1/0){const i=new Ar(this,{callback:t,duration:new Xi(this.context,s).toTicks(),interval:new Xi(this.context,e).toTicks(),time:new Ki(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Tr(this,{callback:t,once:!0,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,(t=>this.clear(t.id))),this._repeatedEvents.forEachFrom(e,(t=>this.clear(t.id))),this}_bindClockEvents(){this._clock.on("start",((t,e)=>{e=new mr(this.context,e).toSeconds(),this.emit("start",t,e)})),this._clock.on("stop",(t=>{this.emit("stop",t)})),this._clock.on("pause",(t=>{this.emit("pause",t)}))}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return Ks(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ni(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Xi(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Xi(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new mr(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new mr(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),s=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",s),this._clock.setTicksAtTime(t,s),this.emit("start",s,this._clock.getSecondsAtTime(s))}else this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return Math.round(this._clock.getTicksAtTime(t))}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){if(!e){const n=this.now();if(0!==t.getValueAtTime(n)){const s=1/(60/this.bpm.getValueAtTime(n)/this.PPQ);e=t.getValueAtTime(n)/s}else e=0}const n=new rr(e);return this.bpm.connect(n),n.connect(t._param),this._syncedSignals.push({initial:t.value,ratio:n,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Bi(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Di.mixin(kr),Oi((t=>{t.transport=new kr({context:t})})),Ei((t=>{t.transport.dispose()}));class Cr extends nr{constructor(t){super(t),this.input=void 0,this._state=new tr("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Pi,this._syncedStop=Pi,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new wr({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,onstop:Pi,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let s=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(s=this._clampToCurrentTime(s),this._synced||"started"!==this._state.getValueAtTime(s))if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const t=this._state.get(s);t&&(t.offset=this.toSeconds(vi(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule((t=>{this._start(t,e,n)}),s);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else Xs(this.context),this._start(s,e,n);else $s(xi(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,e,n);return this}stop(t){let e=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||Ks(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(e>0){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const s=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-s),this._start(t,this.toSeconds(n.offset)+s,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach((t=>this.context.transport.clear(t))),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Pi,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Sr extends or{constructor(){super(gi(Sr.getDefaults(),arguments,["url","onload"])),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1;const t=gi(Sr.getDefaults(),arguments,["url","onload"]);ir(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new er({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new Vi(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(or.getDefaults(),{url:new Vi,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,s=1){$s(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,s),e=this.loop?vi(e,this.loopStart):vi(e,0);let r=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ti(r,t)&&(r=(r-e)%n+e),ki(r,this.buffer.duration)&&(r=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ai(r,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,r)),Ks(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Or extends Cr{constructor(){super(gi(Or.getDefaults(),arguments,["type"])),this.name="Noise",this._source=null;const t=gi(Or.getDefaults(),arguments,["type"]);this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if($s(t in Dr,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=Dr[this._type];this._source=new Sr({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const Mr=220500,Er={brown:null,pink:null,white:null},Dr={get brown(){if(!Er.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;let s=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;n[t]=(s+.02*e)/1.02,s=n[t],n[t]*=3.5}}Er.brown=(new Vi).fromArray(t)}return Er.brown},get pink(){if(!Er.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);let s,i,r,o,a,u,c;t[e]=n,s=i=r=o=a=u=c=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;s=.99886*s+.0555179*e,i=.99332*i+.0750759*e,r=.969*r+.153852*e,o=.8665*o+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=s+i+r+o+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}Er.pink=(new Vi).fromArray(t)}return Er.pink},get white(){if(!Er.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;for(let t=0;t<Mr;t++)n[t]=2*Math.random()-1}Er.white=(new Vi).fromArray(t)}return Er.white}};function Ir(t,e){return ui(this,void 0,void 0,(function*(){const n=e/t.context.sampleRate,s=new Fi(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:s})).toDestination().start(0);return(yield s.render()).getChannelData(0)}))}class Rr extends or{constructor(){super(gi(Rr.getDefaults(),arguments,["frequency","type"])),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator];const t=gi(Rr.getDefaults(),arguments,["frequency","type"]);ir(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new er({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new er({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(or.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}let Nr=class t extends Cr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type"])),this.name="Oscillator",this._oscillator=null;const e=gi(t.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),Ni(this,"frequency"),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),Ni(this,"detune"),this._partials=e.partials,this._partialCount=e.partialCount,this._type=e.type,e.partialCount&&"custom"!==e.type&&(this._type=this.baseType+e.partialCount.toString()),this.phase=e.phase}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rr({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return t._periodicWaveCache.find((t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every(((t,e)=>n[e]===t)));var e,n}))}{const e=t._periodicWaveCache.find((t=>t.type===this._type&&t.phase===this._phase));return this._partialCount=e?e.partialCount:this._partialCount,e}}get type(){return this._type}set type(e){this._type=e;const n=-1!==["sine","square","sawtooth","triangle"].indexOf(e);if(0===this._phase&&n)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=e);else{const n=this._getCachedPeriodicWave();if(Ks(n)){const{partials:t,wave:e}=n;this._wave=e,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[n,s]=this._getRealImaginary(e,this._phase),i=this.context.createPeriodicWave(n,s);this._wave=i,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),t._periodicWaveCache.push({imag:s,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:n,type:this._type,wave:this._wave}),t._periodicWaveCache.length>100&&t._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){Gs(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach(((t,n)=>e[n]=t)),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const s=new Float32Array(n),i=new Float32Array(n);let r=1;if("custom"===t){if(r=this._partials.length+1,this._partialCount=this._partials.length,n=r,0===this._partials.length)return[s,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(r=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],r=Math.max(r,2),n=r):this._partialCount=0,this._partials=[]}for(let o=1;o<n;++o){const n=2/(o*Math.PI);let a;switch(t){case"sine":a=o<=r?1:0,this._partials[o-1]=a;break;case"square":a=1&o?2*n:0,this._partials[o-1]=a;break;case"sawtooth":a=n*(1&o?1:-1),this._partials[o-1]=a;break;case"triangle":a=1&o?n*n*2*(o-1>>1&1?-1:1):0,this._partials[o-1]=a;break;case"custom":a=this._partials[o-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(s[o]=-a*Math.sin(e*o),i[o]=a*Math.cos(e*o)):(s[o]=0,i[o]=0)}return[s,i]}_inverseFFT(t,e,n){let s=0;const i=t.length;for(let r=0;r<i;r++)s+=t[r]*Math.cos(r*n)+e[r]*Math.sin(r*n);return s}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const s=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*s),n);return i=-this._inverseFFT(t,e,this._phase)/n,r=-1,o=1,Math.max(Math.min(i,o),r);var i,r,o}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};Nr._periodicWaveCache=[];class Br extends nr{constructor(){super(Object.assign(gi(Br.getDefaults(),arguments,["context"])))}connect(t,e=0,n=0){return cr(this,t,e,n),this}}class Pr extends Br{constructor(){super(Object.assign(gi(Pr.getDefaults(),arguments,["mapping","length"]))),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper;const t=gi(Pr.getDefaults(),arguments,["mapping","length"]);ni(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ur.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let s=0,i=e;s<i;s++){const e=s/(i-1)*2-1;n[s]=t(e,s)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){$s(["none","2x","4x"].some((e=>e.includes(t))),"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Vr extends Br{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new Pr({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Fr extends ur{constructor(){super(Object.assign(gi(Fr.getDefaults(),arguments,["value"]))),this.name="Multiply",this.override=!1;const t=gi(Fr.getDefaults(),arguments,["value"]);this._mult=this.input=this.output=new rr({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class qr extends Cr{constructor(){super(gi(qr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="AMOscillator",this._modulationScale=new Vr({context:this.context}),this._modulationNode=new rr({context:this.context});const t=gi(qr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Fr({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),Ni(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class jr extends Cr{constructor(){super(gi(jr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="FMOscillator",this._modulationNode=new rr({context:this.context,gain:0});const t=gi(jr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Fr({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new Fr({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),Ni(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class zr extends Cr{constructor(){super(gi(zr.getDefaults(),arguments,["frequency","width"])),this.name="PulseOscillator",this._widthGate=new rr({context:this.context,gain:0}),this._thresh=new Pr({context:this.context,mapping:t=>t<=0?-1:1});const t=gi(zr.getDefaults(),arguments,["frequency","width"]);this.width=new ur({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),Ni(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Wr extends Cr{constructor(){super(gi(Wr.getDefaults(),arguments,["frequency","type","spread"])),this.name="FatOscillator",this._oscillators=[];const t=gi(Wr.getDefaults(),arguments,["frequency","type","spread"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach((e=>e.start(t)))}_stop(t){t=this.toSeconds(t),this._forEach((e=>e.stop(t)))}_restart(t){this._forEach((e=>e.restart(t)))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach((e=>e.type=t))}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach(((t,s)=>t.detune.value=e+n*s))}}get count(){return this._oscillators.length}set count(t){if(Gs(t,1),this._oscillators.length!==t){this._forEach((t=>t.dispose())),this._oscillators=[];for(let e=0;e<t;e++){const n=new Nr({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Pi});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach((t=>t.start()))}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach(((t,e)=>t.phase=this._phase+e/this.count*360))}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach((e=>e.baseType=t)),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach((e=>e.partials=t)))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach((e=>e.partialCount=t)),this._type=this._oscillators[0].type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach((t=>t.dispose())),this}}class Lr extends Cr{constructor(){super(gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"])),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new Fr({context:this.context,value:2});const t=gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"]);this._pulse=new zr({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Nr({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),Ni(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ur={am:qr,fat:Wr,fm:jr,oscillator:Nr,pulse:zr,pwm:Lr};class Hr extends Cr{constructor(){super(gi(Hr.getDefaults(),arguments,["frequency","type"])),this.name="OmniOscillator";const t=gi(Hr.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),Ni(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Nr.getDefaults(),jr.getDefaults(),qr.getDefaults(),Wr.getDefaults(),zr.getDefaults(),Lr.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some((t=>this._sourceType===t))&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ur[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout((()=>t.dispose()),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ur[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&si(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class $r extends ur{constructor(){super(Object.assign(gi($r.getDefaults(),arguments,["value"]))),this.override=!1,this.name="Add",this._sum=new rr({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,sr(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Gr extends Br{constructor(){super(Object.assign(gi(Gr.getDefaults(),arguments,["min","max"]))),this.name="Scale";const t=gi(Gr.getDefaults(),arguments,["min","max"]);this._mult=this.input=new Fr({context:this.context,value:t.max-t.min}),this._add=this.output=new $r({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(Br.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}function Xr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(s,t,e),n.set(this,s)}})}}function Zr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(this.toSeconds(s),t,e),n.set(this,s)}})}}class Yr extends Cr{constructor(){super(gi(Yr.getDefaults(),arguments,["url","onload"])),this.name="Player",this._activeSources=new Set;const t=gi(Yr.getDefaults(),arguments,["url","onload"]);this._buffer=new Vi({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1,reverse:!1})}load(t){return ui(this,void 0,void 0,(function*(){return yield this._buffer.load(t),this._onload(),this}))}_onload(t=Pi){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?vi(e,this._loopStart):vi(e,0);const s=this.toSeconds(e),i=n;n=vi(n,Math.max(this._buffer.duration-s,0));let r=this.toSeconds(n);r/=this._playbackRate,t=this.toSeconds(t);const o=new Sr({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+r),this._state.setStateAtTime("stopped",t+r,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&Qs(i)?o.start(t,s):o.start(t,s,r-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach((t=>t.stop(e)))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){this._stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopStart=t}))}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopEnd=t}))}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach((e=>{e.loop=t})),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach((t=>t.cancelStop()))),this._activeSources.forEach((n=>{n.playbackRate.setValueAtTime(t,e)}))}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach((t=>t.dispose())),this._activeSources.clear(),this._buffer.dispose(),this}}ai([Zr(0)],Yr.prototype,"fadeIn",void 0),ai([Zr(0)],Yr.prototype,"fadeOut",void 0);class Qr extends Br{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new Pr({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Kr extends Br{constructor(){super(Object.assign(gi(Kr.getDefaults(),arguments,["value"]))),this.name="Pow";const t=gi(Kr.getDefaults(),arguments,["value"]);this._exponentScaler=this.input=this.output=new Pr({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(Br.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}let Jr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="Envelope",this._sig=new ur({context:this.context,value:0}),this.output=this._sig,this.input=void 0;const e=gi(t.getDefaults(),arguments,["attack","decay","sustain","release"]);this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve,this.decayCurve=e.decayCurve}static getDefaults(){return Object.assign(nr.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(si(t))return t;{let n;for(n in to)if(to[n][e]===t)return n;return t}}_setCurve(t,e,n){if(si(n)&&Reflect.has(to,n)){const s=to[n];ti(s)?"_decayCurve"!==t&&(this[t]=s[e]):this[t]=s}else{if(!ni(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._decayCurve}set decayCurve(t){$s(["linear","exponential"].some((e=>e===t)),`Invalid envelope curve: ${t}`),this._decayCurve=t}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const s=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let s=this._attackCurve;for(let t=1;t<s.length;t++)if(s[t-1]<=i&&i<=s[t]){s=this._attackCurve.slice(t),s[0]=i;break}this._sig.setValueCurveAtTime(s,t,n,e)}if(s&&this.sustain<1){const i=e*this.sustain,r=t+n;this.log("decay",r),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,s+r):this._sig.exponentialApproachValueAtTime(i,r,s)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):($s(ni(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return cr(this,t,e,n),this}asArray(t=1024){return ui(this,void 0,void 0,(function*(){const e=t/this.context.sampleRate,n=new Fi(1,e,this.context.sampleRate),s=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=s+this.toSeconds(this.release),r=.1*i,o=i+r,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/o,decay:e*this.toSeconds(this.decay)/o,release:e*this.toSeconds(this.release)/o,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(s+r)/o,0);return(yield n.render()).getChannelData(0)}))}dispose(){return super.dispose(),this._sig.dispose(),this}};ai([Zr(0)],Jr.prototype,"attack",void 0),ai([Zr(0)],Jr.prototype,"decay",void 0),ai([Xr(0,1)],Jr.prototype,"sustain",void 0),ai([Zr(0)],Jr.prototype,"release",void 0);const to=(()=>{const t=128;let e,n;const s=[];for(e=0;e<t;e++)s[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const r=[];for(e=0;e<t;e++)r[e]=Math.ceil(e/127*5)/5;const o=[];for(e=0;e<t;e++)n=e/127,o[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,s=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(s*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:s,Out:(c=s,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:o,Out:u(o)},step:{In:r,Out:u(r)}};var c})();class eo extends nr{constructor(){super(gi(eo.getDefaults(),arguments)),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease;const t=gi(eo.getDefaults(),arguments);this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume")}static getDefaults(){return Object.assign(nr.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const s=t[e],i=this.context.transport.schedule((s=>{t[e]=s,n.apply(this,t)}),s);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach((t=>this.context.transport.clear(t))),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this}triggerAttackRelease(t,e,n,s){const i=this.toSeconds(n),r=this.toSeconds(e);return this.triggerAttack(t,i,s),this.triggerRelease(i+r),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class no extends eo{constructor(){super(gi(no.getDefaults(),arguments));const t=gi(no.getDefaults(),arguments);this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(eo.getDefaults(),{detune:0,onsilence:Pi,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const s=this.toSeconds(e);return this._triggerEnvelopeAttack(s,n),this.setNote(t,s),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),s=t instanceof Zi?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(s,t,n)}else this.frequency.setValueAtTime(s,n);return this}}ai([Zr(0)],no.prototype,"portamento",void 0);class so extends Jr{constructor(){super(gi(so.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rr({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class io extends no{constructor(){super(gi(io.getDefaults(),arguments)),this.name="Synth";const t=gi(io.getDefaults(),arguments);this.oscillator=new Hr(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new so(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Ni(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(no.getDefaults(),{envelope:Object.assign(yi(Jr.getDefaults(),Object.keys(nr.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(yi(Hr.getDefaults(),[...Object.keys(Cr.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class ro extends nr{constructor(){super(gi(ro.getDefaults(),arguments,["frequency","type"])),this.name="BiquadFilter";const t=gi(ro.getDefaults(),arguments,["frequency","type"]);this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new er({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new er({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new er({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new er({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const s=19980*Math.pow(n/t,2)+20;e[n]=s}const n=new Float32Array(t),s=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,s),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}let oo=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type","rolloff"])),this.name="Filter",this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this._filters=[];const e=gi(t.getDefaults(),arguments,["frequency","type","rolloff"]);this._filters=[],this.Q=new ur({context:this.context,units:"positive",value:e.Q}),this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),this.gain=new ur({context:this.context,units:"decibels",convert:!1,value:e.gain}),this._type=e.type,this.rolloff=e.rolloff,Ni(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach((e=>e.type=t))}get rolloff(){return this._rolloff}set rolloff(t){const e=Js(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let s=n.indexOf(e);$s(-1!==s,`rolloff can only be ${n.join(", ")}`),s+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach((t=>t.disconnect())),this._filters=new Array(s);for(let t=0;t<s;t++){const e=new ro({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,sr(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new ro({frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map((()=>1));return this._filters.forEach((()=>{e.getFrequencyResponse(t).forEach(((t,e)=>n[e]*=t))})),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach((t=>{t.dispose()})),Bi(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}};class ao extends Jr{constructor(){super(gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="FrequencyEnvelope";const t=gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"]);this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new Kr({context:this.context,value:t.exponent}),this._scale=this.output=new Gr({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(Jr.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Gs(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class uo extends io{constructor(){super(gi(uo.getDefaults(),arguments)),this.name="MembraneSynth",this.portamento=0;const t=gi(uo.getDefaults(),arguments);this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Ni(this,["oscillator","envelope"])}static getDefaults(){return mi(no.getDefaults(),io.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),s=this.toFrequency(t instanceof Zi?t.toFrequency():t),i=s*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(s,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ai([Xr(0)],uo.prototype,"octaves",void 0),ai([Zr(0)],uo.prototype,"pitchDecay",void 0);const co=new Set;function lo(t){co.add(t)}function ho(t,e){const n=`registerProcessor("${t}", ${e})`;co.add(n)}class po extends nr{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Pi;const e=URL.createObjectURL(new Blob([Array.from(co).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e,n).then((()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))}))}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}lo('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');lo("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");lo("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");ho("feedback-comb-filter",'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class fo extends eo{constructor(){super(gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls")),this.name="Sampler",this._activeSources=new Map;const t=gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),e={};Object.keys(t.urls).forEach((n=>{const s=parseInt(n,10);if($s(ii(n)||Js(s)&&isFinite(s),`url key is neither a note or midi pitch: ${n}`),ii(n)){const s=new Zi(this.context,n).toMidi();e[s]=t.urls[n]}else Js(s)&&isFinite(s)&&(e[s]=t.urls[s])})),this._buffers=new _r({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(eo.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Pi,onerror:Pi,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach((t=>{const s=$i(new Zi(this.context,t).toFrequency()),i=Math.round(s),r=s-i,o=this._findClosest(i),a=i-o,u=this._buffers.get(a),c=Li(o+r),l=new Sr({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ni(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}})),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach((t=>{const n=new Zi(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach((t=>{t.stop(e)})),this._activeSources.set(n,[])}})),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach((t=>{for(;t.length;){t.shift().stop(e)}})),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,s=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,s),ni(e)?($s(ni(t),"notes must be an array when duration is array"),t.forEach(((t,n)=>{const s=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(s))}))):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if($s(ii(t)||isFinite(t),`note must be a pitch or midi: ${t}`),ii(t)){const s=new Zi(this.context,t).toMidi();this._buffers.add(s,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach((t=>{t.forEach((t=>t.dispose()))})),this._activeSources.clear(),this}}ai([Zr(0)],fo.prototype,"attack",void 0),ai([Zr(0)],fo.prototype,"release",void 0);class _o extends Ji{constructor(){super(gi(_o.getDefaults(),arguments,["callback","value"])),this.name="ToneEvent",this._state=new tr("stopped"),this._startOffset=0;const t=gi(_o.getDefaults(),arguments,["callback","value"]);this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,(t=>{let e;if("started"===t.state){-1!==t.id&&this.context.transport.clear(t.id);const n=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||Js(this._loop)&&this._loop>1){e=1/0,Js(this._loop)&&(e=this._loop*this._getLoopDuration());const s=this._state.getAfter(n);null!==s&&(e=Math.min(e,s.time-n)),e!==1/0&&(this._state.setStateAtTime("stopped",n+e+1,{id:-1}),e=new mr(this.context,e));const i=new mr(this.context,this._getLoopDuration());t.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new mr(this.context,n),e)}else t.id=this.context.transport.schedule(this._tick.bind(this),new mr(this.context,n))}}))}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return"stopped"===this._state.getValueAtTime(e)&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if("started"===this._state.getValueAtTime(e)){this._state.setStateAtTime("stopped",e,{id:-1});const t=this._state.getBefore(e);let n=e;null!==t&&(n=t.time),this._rescheduleEvents(n)}return this}cancel(t){t=vi(t,-1/0);const e=this.toTicks(t);return this._state.forEachFrom(e,(t=>{this.context.transport.clear(t.id)})),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&"started"===this._state.getValueAtTime(e)){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let e=.02;ei(this.humanize)||(e=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*e}this.callback(t,this.value)}}_getLoopDuration(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(null!==e&&"started"===e.state){const n=this._getLoopDuration();return(t-e.time)%n/n}return 0}return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}}class mo extends _o{constructor(){super(gi(mo.getDefaults(),arguments,["callback","events"])),this.name="Part",this._state=new tr("stopped"),this._events=new Set;const t=gi(mo.getDefaults(),arguments,["callback","events"]);this._state.increasing=!0,t.events.forEach((t=>{ni(t)?this.add(t[0],t[1]):this.add(t)}))}static getDefaults(){return Object.assign(_o.getDefaults(),{events:[]})}start(t,e){const n=this.toTicks(t);if("started"!==this._state.getValueAtTime(n)){e=vi(e,this._loop?this._loopStart:0),e=this._loop?vi(e,this._loopStart):vi(e,0);const t=this.toTicks(e);this._state.add({id:-1,offset:t,state:"started",time:n}),this._forEach((e=>{this._startNote(e,n,t)}))}return this}_startNote(t,e,n){e-=n,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<n&&(e+=this._getLoopDuration()),t.start(new mr(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=n&&(t.loop=!1,t.start(new mr(this.context,e))):t.startOffset>=n&&t.start(new mr(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach((t=>{t.startOffset+=this._startOffset}))}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach((e=>{e.stop(t)})),this}at(t,e){const n=new Ki(this.context,t).toTicks(),s=new mr(this.context,1).toSeconds(),i=this._events.values();let r=i.next();for(;!r.done;){const t=r.value;if(Math.abs(n-t.startOffset)<s)return Ks(e)&&(t.value=e),t;r=i.next()}return Ks(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(t=(e=t).time);const n=this.toTicks(t);let s;return e instanceof _o?(s=e,s.callback=this._tick.bind(this)):s=new _o({callback:this._tick.bind(this),context:this.context,value:e}),s.startOffset=n,s.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(s),this._restartEvent(s),this}_restartEvent(t){this._state.forEach((e=>{"started"===e.state?this._startNote(t,e.time,e.offset):t.stop(new mr(this.context,e.time))}))}remove(t,e){return ti(t)&&t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),this._events.forEach((n=>{n.startOffset===t&&(Qs(e)||Ks(e)&&n.value===e)&&(this._events.delete(n),n.dispose())})),this}clear(){return this._forEach((t=>t.dispose())),this._events.clear(),this}cancel(t){return this._forEach((e=>e.cancel(t))),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach((e=>{e instanceof mo?e._forEach(t):t(e)})),this}_setAll(t,e){this._forEach((n=>{n[t]=e}))}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):"stopped"===t.state&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach((e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)}))}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach((e=>{e.loopEnd=t,this._testLoopBoundries(e)}))}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach((t=>{t.loopStart=this.loopStart,this._testLoopBoundries(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}}class go extends nr{constructor(){super(Object.assign(gi(go.getDefaults(),arguments,["fade"]))),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Qr({context:this.context}),this.a=new rr({context:this.context,gain:0}),this.b=new rr({context:this.context,gain:0}),this.output=new rr({context:this.context}),this._internalChannels=[this.a,this.b];const t=gi(go.getDefaults(),arguments,["fade"]);this.fade=new ur({context:this.context,units:"normalRange",value:t.fade}),Ni(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",ir(this._split,this.a.gain,0),ir(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(nr.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}let vo=class extends nr{constructor(t){super(t),this.name="Effect",this._dryWet=new go({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new rr({context:this.context}),this.effectReturn=new rr({context:this.context}),this.input=new rr({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],Ni(this,"wet")}static getDefaults(){return Object.assign(nr.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}};class yo extends nr{constructor(){super(Object.assign(gi(yo.getDefaults(),arguments,["pan"]))),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner;const t=gi(yo.getDefaults(),arguments,["pan"]);this.pan=new er({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",Ni(this,"pan")}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const wo="bit-crusher";ho(wo,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\n\t\t\t\tautomationRate: 'k-rate'\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, _channel, parameters) {\n\t\t\tconst step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");let bo=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["bits"])),this.name="BitCrusher";const e=gi(t.getDefaults(),arguments,["bits"]);this._bitCrusherWorklet=new xo({context:this.context,bits:e.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(vo.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}};class xo extends po{constructor(){super(gi(xo.getDefaults(),arguments)),this.name="BitCrusherWorklet";const t=gi(xo.getDefaults(),arguments);this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this.bits=new er({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(po.getDefaults(),{bits:12})}_audioWorkletName(){return wo}onReady(t){sr(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class To extends nr{constructor(){super(gi(To.getDefaults(),arguments,["channels"])),this.name="Merge";const t=gi(To.getDefaults(),arguments,["channels"]);this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign(nr.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}let Ao=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["distortion"])),this.name="Distortion";const e=gi(t.getDefaults(),arguments,["distortion"]);this._shaper=new Pr({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(vo.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(t){this._distortion=t;const e=100*t,n=Math.PI/180;this._shaper.setMap((t=>Math.abs(t)<.001?0:(3+e)*t*20*n/(Math.PI+e*Math.abs(t))))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}};class ko extends vo{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new rr({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Ni(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(vo.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Co extends ko{constructor(){super(gi(Co.getDefaults(),arguments,["delayTime","feedback"])),this.name="FeedbackDelay";const t=gi(Co.getDefaults(),arguments,["delayTime","feedback"]);this._delayNode=new fr({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Ni(this,"delayTime")}static getDefaults(){return Object.assign(ko.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}let So=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["decay"])),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const e=gi(t.getDefaults(),arguments,["decay"]);this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(vo.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){Gs(t=this.toSeconds(t),.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){Gs(t=this.toSeconds(t),0),this._preDelay=t,this.generate()}generate(){return ui(this,void 0,void 0,(function*(){const t=this.ready,e=new Fi(2,this._decay+this._preDelay,this.context.sampleRate),n=new Or({context:e}),s=new Or({context:e}),i=new To({context:e});n.connect(i,0,0),s.connect(i,0,1);const r=new rr({context:e}).toDestination();i.connect(r),n.start(0),s.start(0),r.gain.setValueAtTime(0,0),r.gain.setValueAtTime(1,this._preDelay),r.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const o=e.render();return this.ready=o.then(Pi),yield t,this._convolver.buffer=(yield o).get(),this}))}dispose(){return super.dispose(),this._convolver.disconnect(),this}};class Oo extends nr{constructor(){super(gi(Oo.getDefaults(),arguments,["solo"])),this.name="Solo";const t=gi(Oo.getDefaults(),arguments,["solo"]);this.input=this.output=new rr({context:this.context}),Oo._allSolos.has(this.context)||Oo._allSolos.set(this.context,new Set),Oo._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(nr.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),Oo._allSolos.get(this.context).forEach((t=>t._updateSolo()))}get muted(){return 0===this.input.gain.value}_addSolo(){Oo._soloed.has(this.context)||Oo._soloed.set(this.context,new Set),Oo._soloed.get(this.context).add(this)}_removeSolo(){Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).delete(this)}_isSoloed(){return Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).has(this)}_noSolos(){return!Oo._soloed.has(this.context)||Oo._soloed.has(this.context)&&0===Oo._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Oo._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Oo._allSolos=new Map,Oo._soloed=new Map;class Mo extends nr{constructor(){super(gi(Mo.getDefaults(),arguments,["pan","volume"])),this.name="PanVol";const t=gi(Mo.getDefaults(),arguments,["pan","volume"]);this._panner=this.input=new yo({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Eo extends nr{constructor(){super(gi(Eo.getDefaults(),arguments,["volume","pan"])),this.name="Channel";const t=gi(Eo.getDefaults(),arguments,["volume","pan"]);this._solo=this.input=new Oo({solo:t.solo,context:this.context}),this._panVol=this.output=new Mo({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return Eo.buses.has(t)||Eo.buses.set(t,new rr({context:this.context})),Eo.buses.get(t)}send(t,e=0){const n=this._getBus(t),s=new rr({context:this.context,units:"decibels",gain:e});return this.connect(s),s.connect(n),s}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}Eo.buses=new Map;class Do extends nr{constructor(){super(...arguments),this.name="Listener",this.positionX=new er({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new er({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new er({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new er({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new er({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new er({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new er({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new er({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new er({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(nr.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}function Io(){return zi().now()}Oi((t=>{t.listener=new Do({context:t})})),Ei((t=>{t.listener.dispose()})),zi().transport,zi().destination,zi().destination,zi().listener,zi().draw,zi();const Ro={C0:16.35,"C#0":17.32,Db0:17.32,D0:18.35,"D#0":19.45,Eb0:19.45,E0:20.6,F0:21.83,"F#0":23.12,Gb0:23.12,G0:24.5,"G#0":25.96,Ab0:25.96,A0:27.5,"A#0":29.14,Bb0:29.14,B0:30.87,C1:32.7,"C#1":34.65,Db1:34.65,D1:36.71,"D#1":38.89,Eb1:38.89,E1:41.2,F1:43.65,"F#1":46.25,Gb1:46.25,G1:49,"G#1":51.91,Ab1:51.91,A1:55,"A#1":58.27,Bb1:58.27,B1:61.74,C2:65.41,"C#2":69.3,Db2:69.3,D2:73.42,"D#2":77.78,Eb2:77.78,E2:82.41,F2:87.31,"F#2":92.5,Gb2:92.5,G2:98,"G#2":103.83,Ab2:103.83,A2:110,"A#2":116.54,Bb2:116.54,B2:123.47,C3:130.81,"C#3":138.59,Db3:138.59,D3:146.83,"D#3":155.56,Eb3:155.56,E3:164.81,F3:174.61,"F#3":185,Gb3:185,G3:196,"G#3":207.65,Ab3:207.65,A3:220,"A#3":233.08,Bb3:233.08,B3:246.94,C4:261.63,"C#4":277.18,Db4:277.18,D4:293.66,"D#4":311.13,Eb4:311.13,E4:329.63,F4:349.23,"F#4":369.99,Gb4:369.99,G4:392,"G#4":415.3,Ab4:415.3,A4:440,"A#4":466.16,Bb4:466.16,B4:493.88,C5:523.25,"C#5":554.37,Db5:554.37,D5:587.33,"D#5":622.25,Eb5:622.25,E5:659.26,F5:698.46,"F#5":739.99,Gb5:739.99,G5:783.99,"G#5":830.61,Ab5:830.61,A5:880,"A#5":932.33,Bb5:932.33,B5:987.77,C6:1046.5,"C#6":1108.73,Db6:1108.73,D6:1174.66,"D#6":1244.51,Eb6:1244.51,E6:1318.51,F6:1396.91,"F#6":1479.98,Gb6:1479.98,G6:1567.98,"G#6":1661.22,Ab6:1661.22,A6:1760,"A#6":1864.66,Bb6:1864.66,B6:1975.53,C7:2093,"C#7":2217.46,Db7:2217.46,D7:2349.32,"D#7":2489.02,Eb7:2489.02,E7:2637.02,F7:2793.83,"F#7":2959.96,Gb7:2959.96,G7:3135.96,"G#7":3322.44,Ab7:3322.44,A7:3520,"A#7":3729.31,Bb7:3729.31,B7:3951.07,C8:4186.01,"C#8":4434.92,Db8:4434.92,D8:4698.64,"D#8":4978.03,Eb8:4978.03},No=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Bo=No.length;class Po{static _notes;name;octave;velocity=1;duration;frequency;constructor(t){"number"==typeof t?this.fromFrequency(t):"string"==typeof t?this.fromString(t):t instanceof MIDIMessageEvent?this.fromEvent(t):this.fromProps(t)}static notes(t=3){return No.map((e=>new Po(`${e}${t}`)))}get isSemi(){return"#"===this.name.slice(-1)}get fullName(){return`${this.name}${this.octave}`}midiData(t=!0){return new Uint8Array([t?144:128,0,100*this.velocity])}get midiNumber(){return 12*(this.octave+2)+this.noteIndex}get noteIndex(){return No.indexOf(this.name)}adjustFrequency(t=0,e=0){if(this.frequency)return this.frequency;let n=this.octave+t;const s=No.indexOf(this.name)+e;let i=s;s>=Bo?(n++,i=s%Bo):s<0&&(n--,i=Bo+i);const r=No[i];return Ro[`${r}${n}`]}valueOf(){return this.fullName}serialize(){return{note:this.fullName,frequency:this.frequency,velocity:this.velocity,duration:this.duration}}fromFrequency(t){this.frequency=t}fromString(t){const e=t.match(/(\w#?)(\d)?/)||[];this.name=e[1],this.octave=e[2]?parseInt(e[2]):1}fromEvent(t){this.name=No[t.data[1]%12],this.octave=Math.floor(t.data[1]/12)-2}fromProps(t){if(Object.assign(this,t),!t.note)throw Error("note props is mandatory");this.fromString(t.note)}}const Vo={128:"noteOff",144:"noteOn",176:"cc"};class Fo{note;voiceNo;triggeredAt;_type;data;event;static fromSequence(t,e){return t.notes.map((t=>this.fromNote(t,!0,e)))}static fromNote(t,e=!0,n){const s=t instanceof Po?t:new Po(t),i=new Fo(new MIDIMessageEvent("",{data:s.midiData(e)}),n);return i.note=s,i}static fromCC(t,e,n){return new Fo(new MIDIMessageEvent("",{data:new Uint8Array([176,t,e])}),n)}constructor(t,e){this.event=t,this.triggeredAt=e||Io(),this.data=t.data,this.defineNotes()}get statusByte(){return this.data[0]}get firstData(){return this.data[1]}get secondData(){return this.data[2]}get type(){if(this._type)return this._type;let t=Vo[240&this.statusByte];return"noteOn"===t&&0===this.secondData&&(t="noteOff"),this._type=t}get isNote(){return"noteOn"===this.type||"noteOff"===this.type}defineNotes(){this.isNote&&(this.note||(this.note=new Po(this.event)))}}class qo{id;name;state;eventListerCallbacks=[];_midi;constructor(t){this.id=t.id,this.name=t.name||`Device ${t.id}`,this.state=t.state,this._midi=t,this.connect()}connect(){this._midi.onmidimessage=t=>{(t instanceof MIDIMessageEvent||t instanceof Fo)&&this.processEvent(t)}}disconnect(){this._midi.onmidimessage=null}serialize(){const{id:t,name:e,state:n}=this;return{id:t,name:e,state:n}}addEventListener(t){this.eventListerCallbacks.push(t)}removeEventListener(t){this.eventListerCallbacks=this.eventListerCallbacks.filter((e=>e!==t))}processEvent(t){const e=t instanceof Fo?t:new Fo(t);switch(e.type){case"noteOn":case"noteOff":this.eventListerCallbacks.forEach((t=>t(e)))}}}const jo={a:new Po("C3"),s:new Po("D3"),d:new Po("E3"),f:new Po("F3"),g:new Po("G3"),h:new Po("A3"),j:new Po("B3"),k:new Po("C4"),l:new Po("D4"),w:new Po("C#3"),e:new Po("D#3"),t:new Po("F#3"),y:new Po("G#3"),u:new Po("A#3"),o:new Po("C#4"),p:new Po("D#4")},zo={id:"computer_keyboard",name:"Computer Keyboard",state:"connected"};class Wo{id;name;state;onmidimessage;constructor(){Object.assign(this,zo),document.addEventListener("keydown",this.onKeyTrigger(!0)),document.addEventListener("keyup",this.onKeyTrigger(!1))}onKeyTrigger=t=>e=>{if(!this.onmidimessage)return;const n=this.extractNote(e);if(!n)return;const s=Fo.fromNote(n,t);this.onmidimessage(s)};extractNote(t){if(!t.repeat)return jo[t.key]}}class Lo{devices={};initialized=!1;computerKeyboardInput;constructor(){this.computerKeyboardInput=new Wo,this.initializeDevices().then((()=>{this.listenChanges(),this.initialized=!0})).catch((()=>{}))}find(t){const e=this.devices[t];return e||null}onStateChange(t){navigator.requestMIDIAccess().then((e=>{e.onstatechange=e=>{if(!(e instanceof MIDIConnectionEvent))return;if(e.port instanceof MIDIOutput)return;const n=e.port,s=new qo(n);t(s)}})).catch((()=>{}))}listenChanges(){this.onStateChange((t=>{"disconnected"===t.state?(t.disconnect(),delete this.devices[t.id]):this.devices[t.id]=t}))}async initializeDevices(){return this.initialized||(await this.inputs()).forEach((t=>{this.devices[t.id]||(this.devices[t.id]=new qo(t))})),Object.values(this.devices)}async inputs(){const t=[this.computerKeyboardInput];return(await navigator.requestMIDIAccess()).inputs.forEach((e=>t.push(e))),t}}var Uo,Ho=new Uint8Array(16);function $o(){if(!Uo&&!(Uo="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Uo(Ho)}var Go=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Xo=[],Zo=0;Zo<256;++Zo)Xo.push((Zo+256).toString(16).substr(1));function Yo(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Xo[t[e+0]]+Xo[t[e+1]]+Xo[t[e+2]]+Xo[t[e+3]]+"-"+Xo[t[e+4]]+Xo[t[e+5]]+"-"+Xo[t[e+6]]+Xo[t[e+7]]+"-"+Xo[t[e+8]]+Xo[t[e+9]]+"-"+Xo[t[e+10]]+Xo[t[e+11]]+Xo[t[e+12]]+Xo[t[e+13]]+Xo[t[e+14]]+Xo[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&Go.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n}function Qo(t,e,n){var s=(t=t||{}).random||(t.rng||$o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=s[i];return e}return Yo(s)}var Ko="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Jo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ta={exports:{}};var ea,na={exports:{}};function sa(){return ea||(ea=1,na.exports=function(){var t=t||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==Ko&&Ko.crypto&&(n=Ko.crypto),!n)try{n=require("crypto")}catch(t){}var s=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},a=o.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,s=this.sigBytes,i=t.sigBytes;if(this.clamp(),s%4)for(var r=0;r<i;r++){var o=n[r>>>2]>>>24-r%4*8&255;e[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a<i;a+=4)e[s+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(s());return new u.init(e,t)}}),c=r.enc={},l=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s+=2)n[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new u.init(n,e/2)}},h=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s++)n[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new u.init(n,e)}},p=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,l=t.min(4*c,r);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(i,h);n=i.splice(0,c),s.sigBytes-=l}return new u.init(n,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});o.Hasher=d.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=r.algo={};return r}(Math);return t}()),na.exports}var ia,ra={exports:{}};function oa(){return ia||(ia=1,ra.exports=function(t){return s=(n=t).lib,i=s.Base,r=s.WordArray,(o=n.x64={}).Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],s=0;s<e;s++){var i=t[s];n.push(i.high),n.push(i.low)}return r.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,s=0;s<n;s++)e[s]=e[s].clone();return t}}),t;var e,n,s,i,r,o}(sa())),ra.exports}var aa,ua={exports:{}};function ca(){return aa||(aa=1,ua.exports=function(t){return function(){if("function"==typeof ArrayBuffer){var e=t.lib.WordArray,n=e.init,s=e.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,s=[],i=0;i<e;i++)s[i>>>2]|=t[i]<<24-i%4*8;n.call(this,s,e)}else n.apply(this,arguments)};s.prototype=e}}(),t.lib.WordArray}(sa())),ua.exports}var la,ha={exports:{}};function pa(){return la||(la=1,ha.exports=function(t){return function(){var e=t,n=e.lib.WordArray,s=e.enc;function i(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i+=2){var r=e[i>>>2]>>>16-i%4*8&65535;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return n.create(s,2*e)}},s.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],r=0;r<n;r+=2){var o=i(e[r>>>2]>>>16-r%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(t){for(var e=t.length,s=[],r=0;r<e;r++)s[r>>>1]|=i(t.charCodeAt(r)<<16-r%2*16);return n.create(s,2*e)}}}(),t.enc.Utf16}(sa())),ha.exports}var da,fa={exports:{}};function _a(){return da||(da=1,fa.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,s=this._map;t.clamp();for(var i=[],r=0;r<n;r+=3)for(var o=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a<n;a++)i.push(s.charAt(o>>>6*(3-a)&63));var u=s.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r<n.length;r++)i[n.charCodeAt(r)]=r}var o=n.charAt(64);if(o){var a=t.indexOf(o);-1!==a&&(e=a)}return s(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64}(sa())),fa.exports}var ma,ga={exports:{}};function va(){return ma||(ma=1,ga.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var n=t.words,s=t.sigBytes,i=e?this._safe_map:this._map;t.clamp();for(var r=[],o=0;o<s;o+=3)for(var a=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,u=0;u<4&&o+.75*u<s;u++)r.push(i.charAt(a>>>6*(3-u)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var n=t.length,i=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<i.length;o++)r[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var u=t.indexOf(a);-1!==u&&(n=u)}return s(t,n,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),t.enc.Base64url}(sa())),ga.exports}var ya,wa={exports:{}};function ba(){return ya||(ya=1,wa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,o=t[e+0],u=t[e+1],d=t[e+2],f=t[e+3],_=t[e+4],m=t[e+5],g=t[e+6],v=t[e+7],y=t[e+8],w=t[e+9],b=t[e+10],x=t[e+11],T=t[e+12],A=t[e+13],k=t[e+14],C=t[e+15],S=r[0],O=r[1],M=r[2],E=r[3];S=c(S,O,M,E,o,7,a[0]),E=c(E,S,O,M,u,12,a[1]),M=c(M,E,S,O,d,17,a[2]),O=c(O,M,E,S,f,22,a[3]),S=c(S,O,M,E,_,7,a[4]),E=c(E,S,O,M,m,12,a[5]),M=c(M,E,S,O,g,17,a[6]),O=c(O,M,E,S,v,22,a[7]),S=c(S,O,M,E,y,7,a[8]),E=c(E,S,O,M,w,12,a[9]),M=c(M,E,S,O,b,17,a[10]),O=c(O,M,E,S,x,22,a[11]),S=c(S,O,M,E,T,7,a[12]),E=c(E,S,O,M,A,12,a[13]),M=c(M,E,S,O,k,17,a[14]),S=l(S,O=c(O,M,E,S,C,22,a[15]),M,E,u,5,a[16]),E=l(E,S,O,M,g,9,a[17]),M=l(M,E,S,O,x,14,a[18]),O=l(O,M,E,S,o,20,a[19]),S=l(S,O,M,E,m,5,a[20]),E=l(E,S,O,M,b,9,a[21]),M=l(M,E,S,O,C,14,a[22]),O=l(O,M,E,S,_,20,a[23]),S=l(S,O,M,E,w,5,a[24]),E=l(E,S,O,M,k,9,a[25]),M=l(M,E,S,O,f,14,a[26]),O=l(O,M,E,S,y,20,a[27]),S=l(S,O,M,E,A,5,a[28]),E=l(E,S,O,M,d,9,a[29]),M=l(M,E,S,O,v,14,a[30]),S=h(S,O=l(O,M,E,S,T,20,a[31]),M,E,m,4,a[32]),E=h(E,S,O,M,y,11,a[33]),M=h(M,E,S,O,x,16,a[34]),O=h(O,M,E,S,k,23,a[35]),S=h(S,O,M,E,u,4,a[36]),E=h(E,S,O,M,_,11,a[37]),M=h(M,E,S,O,v,16,a[38]),O=h(O,M,E,S,b,23,a[39]),S=h(S,O,M,E,A,4,a[40]),E=h(E,S,O,M,o,11,a[41]),M=h(M,E,S,O,f,16,a[42]),O=h(O,M,E,S,g,23,a[43]),S=h(S,O,M,E,w,4,a[44]),E=h(E,S,O,M,T,11,a[45]),M=h(M,E,S,O,C,16,a[46]),S=p(S,O=h(O,M,E,S,d,23,a[47]),M,E,o,6,a[48]),E=p(E,S,O,M,v,10,a[49]),M=p(M,E,S,O,k,15,a[50]),O=p(O,M,E,S,m,21,a[51]),S=p(S,O,M,E,T,6,a[52]),E=p(E,S,O,M,f,10,a[53]),M=p(M,E,S,O,b,15,a[54]),O=p(O,M,E,S,u,21,a[55]),S=p(S,O,M,E,y,6,a[56]),E=p(E,S,O,M,C,10,a[57]),M=p(M,E,S,O,g,15,a[58]),O=p(O,M,E,S,A,21,a[59]),S=p(S,O,M,E,_,6,a[60]),E=p(E,S,O,M,x,10,a[61]),M=p(M,E,S,O,d,15,a[62]),O=p(O,M,E,S,w,21,a[63]),r[0]=r[0]+S|0,r[1]=r[1]+O|0,r[2]=r[2]+M|0,r[3]=r[3]+E|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var r=e.floor(s/4294967296),o=s;n[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,s,i,r,o){var a=t+(e&n|~e&s)+i+o;return(a<<r|a>>>32-r)+e}function l(t,e,n,s,i,r,o){var a=t+(e&s|n&~s)+i+o;return(a<<r|a>>>32-r)+e}function h(t,e,n,s,i,r,o){var a=t+(e^n^s)+i+o;return(a<<r|a>>>32-r)+e}function p(t,e,n,s,i,r,o){var a=t+(n^(e|~s))+i+o;return(a<<r|a>>>32-r)+e}n.MD5=r._createHelper(u),n.HmacMD5=r._createHmacHelper(u)}(Math),t.MD5}(sa())),wa.exports}var xa,Ta={exports:{}};function Aa(){return xa||(xa=1,Ta.exports=function(t){return n=(e=t).lib,s=n.WordArray,i=n.Hasher,r=e.algo,o=[],a=r.SHA1=i.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var h=(s<<5|s>>>27)+u+o[c];h+=c<20?1518500249+(i&r|~i&a):c<40?1859775393+(i^r^a):c<60?(i&r|i&a|r&a)-1894007588:(i^r^a)-899497514,u=a,a=r,r=i<<30|i>>>2,i=s,s=h}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(s+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=i._createHelper(a),e.HmacSHA1=i._createHmacHelper(a),t.SHA1;var e,n,s,i,r,o,a}(sa())),Ta.exports}var ka,Ca={exports:{}};function Sa(){return ka||(ka=1,Ca.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var s=2,i=0;i<64;)t(s)&&(i<8&&(a[i]=n(e.pow(s,.5))),u[i]=n(e.pow(s,1/3)),i++),s++}();var c=[],l=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var f=c[d-15],_=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,m=c[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[d]=_+c[d-7]+g+c[d-16]}var v=s&i^s&r^i&r,y=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),w=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+u[d]+c[d];p=h,h=l,l=a,a=o+w|0,o=r,r=i,i=s,s=w+(y+v)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=r._createHelper(l),n.HmacSHA256=r._createHmacHelper(l)}(Math),t.SHA256}(sa())),Ca.exports}var Oa,Ma={exports:{}};var Ea,Da={exports:{}};function Ia(){return Ea||(Ea=1,Da.exports=function(t){return function(){var e=t,n=e.lib.Hasher,s=e.x64,i=s.Word,r=s.WordArray,o=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=a()}();var l=o.SHA512=n.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=s.high,f=s.low,_=i.high,m=i.low,g=r.high,v=r.low,y=o.high,w=o.low,b=a.high,x=a.low,T=l.high,A=l.low,k=h.high,C=h.low,S=p.high,O=p.low,M=d,E=f,D=_,I=m,R=g,N=v,B=y,P=w,V=b,F=x,q=T,j=A,z=k,W=C,L=S,U=O,H=0;H<80;H++){var $,G,X=c[H];if(H<16)G=X.high=0|t[e+2*H],$=X.low=0|t[e+2*H+1];else{var Z=c[H-15],Y=Z.high,Q=Z.low,K=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,J=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),tt=c[H-2],et=tt.high,nt=tt.low,st=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,it=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),rt=c[H-7],ot=rt.high,at=rt.low,ut=c[H-16],ct=ut.high,lt=ut.low;G=(G=(G=K+ot+(($=J+at)>>>0<J>>>0?1:0))+st+(($+=it)>>>0<it>>>0?1:0))+ct+(($+=lt)>>>0<lt>>>0?1:0),X.high=G,X.low=$}var ht,pt=V&q^~V&z,dt=F&j^~F&W,ft=M&D^M&R^D&R,_t=E&I^E&N^I&N,mt=(M>>>28|E<<4)^(M<<30|E>>>2)^(M<<25|E>>>7),gt=(E>>>28|M<<4)^(E<<30|M>>>2)^(E<<25|M>>>7),vt=(V>>>14|F<<18)^(V>>>18|F<<14)^(V<<23|F>>>9),yt=(F>>>14|V<<18)^(F>>>18|V<<14)^(F<<23|V>>>9),wt=u[H],bt=wt.high,xt=wt.low,Tt=L+vt+((ht=U+yt)>>>0<U>>>0?1:0),At=gt+_t;L=z,U=W,z=q,W=j,q=V,j=F,V=B+(Tt=(Tt=(Tt=Tt+pt+((ht+=dt)>>>0<dt>>>0?1:0))+bt+((ht+=xt)>>>0<xt>>>0?1:0))+G+((ht+=$)>>>0<$>>>0?1:0))+((F=P+ht|0)>>>0<P>>>0?1:0)|0,B=R,P=N,R=D,N=I,D=M,I=E,M=Tt+(mt+ft+(At>>>0<gt>>>0?1:0))+((E=ht+At|0)>>>0<ht>>>0?1:0)|0}f=s.low=f+E,s.high=d+M+(f>>>0<E>>>0?1:0),m=i.low=m+I,i.high=_+D+(m>>>0<I>>>0?1:0),v=r.low=v+N,r.high=g+R+(v>>>0<N>>>0?1:0),w=o.low=w+P,o.high=y+B+(w>>>0<P>>>0?1:0),x=a.low=x+F,a.high=b+V+(x>>>0<F>>>0?1:0),A=l.low=A+j,l.high=T+q+(A>>>0<j>>>0?1:0),C=h.low=C+W,h.high=k+z+(C>>>0<W>>>0?1:0),O=p.low=O+U,p.high=S+L+(O>>>0<U>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[30+(s+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(s+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(l),e.HmacSHA512=n._createHmacHelper(l)}(),t.SHA512}(sa(),oa())),Da.exports}var Ra,Na={exports:{}};var Ba,Pa={exports:{}};function Va(){return Ba||(Ba=1,Pa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.x64.Word,a=n.algo,u=[],c=[],l=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var s=(2*t+3*e)%5;t=e%5,e=s}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var a=0,h=0,p=0;p<7;p++){if(1&i){var d=(1<<p)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[r]=o.create(a,h)}}();var h=[];!function(){for(var t=0;t<25;t++)h[t]=o.create()}();var p=a.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,s=this.blockSize/2,i=0;i<s;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(O=n[i]).high^=o,O.low^=r}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var d=0,f=0,_=0;_<5;_++)d^=(O=n[p+5*_]).high,f^=O.low;var m=h[p];m.high=d,m.low=f}for(p=0;p<5;p++){var g=h[(p+4)%5],v=h[(p+1)%5],y=v.high,w=v.low;for(d=g.high^(y<<1|w>>>31),f=g.low^(w<<1|y>>>31),_=0;_<5;_++)(O=n[p+5*_]).high^=d,O.low^=f}for(var b=1;b<25;b++){var x=(O=n[b]).high,T=O.low,A=u[b];A<32?(d=x<<A|T>>>32-A,f=T<<A|x>>>32-A):(d=T<<A-32|x>>>64-A,f=x<<A-32|T>>>64-A);var k=h[c[b]];k.high=d,k.low=f}var C=h[0],S=n[0];for(C.high=S.high,C.low=S.low,p=0;p<5;p++)for(_=0;_<5;_++){var O=n[b=p+5*_],M=h[b],E=h[(p+1)%5+5*_],D=h[(p+2)%5+5*_];O.high=M.high^~E.high&D.high,O.low=M.low^~E.low&D.low}O=n[0];var I=l[a];O.high^=I.high,O.low^=I.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var s=8*t.sigBytes,r=32*this.blockSize;n[s>>>5]|=1<<24-s%32,n[(e.ceil((s+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l<u;l++){var h=o[l],p=h.high,d=h.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(p)}return new i.init(c,a)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=r._createHelper(p),n.HmacSHA3=r._createHmacHelper(p)}(Math),t.SHA3}(sa(),oa())),Pa.exports}var Fa,qa={exports:{}};var ja,za={exports:{}};function Wa(){return ja||(ja=1,za.exports=function(t){var e,n,s;n=(e=t).lib.Base,s=e.enc.Utf8,e.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),a=r.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;r.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}(sa())),za.exports}var La,Ua={exports:{}};var Ha,$a={exports:{}};function Ga(){return Ha||(Ha=1,$a.exports=function(t){return n=(e=t).lib,s=n.Base,i=n.WordArray,r=e.algo,o=r.MD5,a=r.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,s=this.cfg,r=s.hasher.create(),o=i.create(),a=o.words,u=s.keySize,c=s.iterations;a.length<u;){n&&r.update(n),n=r.update(t).finalize(e),r.reset();for(var l=1;l<c;l++)n=r.finalize(n),r.reset();o.concat(n)}return o.sigBytes=4*u,o}}),e.EvpKDF=function(t,e,n){return a.create(n).compute(t,e)},t.EvpKDF;var e,n,s,i,r,o,a}(sa(),Aa(),Wa())),$a.exports}var Xa,Za={exports:{}};function Ya(){return Xa||(Xa=1,Za.exports=function(t){t.lib.Cipher||function(e){var n=t,s=n.lib,i=s.Base,r=s.WordArray,o=s.BufferedBlockAlgorithm,a=n.enc;a.Utf8;var u=a.Base64,c=n.algo.EvpKDF,l=s.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:g}return function(e){return{encrypt:function(n,s,i){return t(s).encrypt(e,n,s,i)},decrypt:function(n,s,i){return t(s).decrypt(e,n,s,i)}}}}()});s.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=n.mode={},p=s.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=h.CBC=function(){var t=p.extend();function n(t,n,s){var i,r=this._iv;r?(i=r,this._iv=e):i=this._prevBlock;for(var o=0;o<s;o++)t[n+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i),s.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),t.Decryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);s.decryptBlock(t,e),n.call(this,t,e,i),this._prevBlock=r}}),t}(),f=(n.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,s=n-t.sigBytes%n,i=s<<24|s<<16|s<<8|s,o=[],a=0;a<s;a+=4)o.push(i);var u=r.create(o,s);t.concat(u)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};s.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){var t;l.reset.call(this);var e=this.cfg,n=e.iv,s=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=s.createEncryptor:(t=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(s,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var _=s.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?r.create([1398893684,1701076831]).concat(n).concat(e):e).toString(u)},parse:function(t){var e,n=u.parse(t),s=n.words;return 1398893684==s[0]&&1701076831==s[1]&&(e=r.create(s.slice(2,4)),s.splice(0,4),n.sigBytes-=16),_.create({ciphertext:n,salt:e})}},g=s.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(t,e,n,s){s=this.cfg.extend(s);var i=t.createEncryptor(n,s),r=i.finalize(e),o=i.cfg;return _.create({ciphertext:r,key:n,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:s.format})},decrypt:function(t,e,n,s){return s=this.cfg.extend(s),e=this._parse(e,s.format),t.createDecryptor(n,s).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(n.kdf={}).OpenSSL={execute:function(t,e,n,s,i){if(s||(s=r.random(8)),i)o=c.create({keySize:e+n,hasher:i}).compute(t,s);else var o=c.create({keySize:e+n}).compute(t,s);var a=r.create(o.words.slice(e),4*n);return o.sigBytes=4*e,_.create({key:o,iv:a,salt:s})}},y=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,n,s){var i=(s=this.cfg.extend(s)).kdf.execute(n,t.keySize,t.ivSize,s.salt,s.hasher);s.iv=i.iv;var r=g.encrypt.call(this,t,e,i.key,s);return r.mixIn(i),r},decrypt:function(t,e,n,s){s=this.cfg.extend(s),e=this._parse(e,s.format);var i=s.kdf.execute(n,t.keySize,t.ivSize,e.salt,s.hasher);return s.iv=i.iv,g.decrypt.call(this,t,e,i.key,s)}})}()}(sa(),Ga())),Za.exports}var Qa,Ka={exports:{}};function Ja(){return Qa||(Qa=1,Ka.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function n(t,e,n,s){var i,r=this._iv;r?(i=r.slice(0),this._iv=void 0):i=this._prevBlock,s.encryptBlock(i,0);for(var o=0;o<n;o++)t[e+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i,s),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);n.call(this,t,e,i,s),this._prevBlock=r}}),e}(),t.mode.CFB}(sa(),Ya())),Ka.exports}var tu,eu={exports:{}};function nu(){return tu||(tu=1,eu.exports=function(t){return t.mode.CTR=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._counter;i&&(r=this._counter=i.slice(0),this._iv=void 0);var o=r.slice(0);n.encryptBlock(o,0),r[s-1]=r[s-1]+1|0;for(var a=0;a<s;a++)t[e+a]^=o[a]}}),e.Decryptor=n,e),t.mode.CTR;var e,n}(sa(),Ya())),eu.exports}var su,iu={exports:{}};function ru(){return su||(su=1,iu.exports=function(t){
|
|
16
8
|
/** @preserve
|
|
17
9
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
18
10
|
* derived from CryptoJS.mode.CTR
|
|
19
11
|
* Jan Hruby jhruby.web@gmail.com
|
|
20
12
|
*/
|
|
21
|
-
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}else t+=1<<24;return t}function s(t){return 0===(t[0]=n(t[0]))&&(t[1]=n(t[1])),t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),s(o);var a=o.slice(0);n.encryptBlock(a,0);for(var u=0;u<i;u++)t[e+u]^=a[u]}});return e.Decryptor=i,e}(),t.mode.CTRGladman}(ra(),Ka())),ou.exports}var uu,cu={exports:{}};function lu(){return uu||(uu=1,cu.exports=function(t){return t.mode.OFB=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._keystream;i&&(r=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(r,0);for(var o=0;o<s;o++)t[e+o]^=r[o]}}),e.Decryptor=n,e),t.mode.OFB;var e,n}(ra(),Ka())),cu.exports}var hu,pu={exports:{}};var du,fu={exports:{}};var _u,mu={exports:{}};var gu,vu={exports:{}};var yu,wu={exports:{}};var bu,xu={exports:{}};var Tu,Au={exports:{}};var ku,Cu={exports:{}};var Su,Ou={exports:{}};function Mu(){return Su||(Su=1,Ou.exports=function(t){return function(){var e=t,n=e.lib,s=n.WordArray,i=n.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var s=o[n]-1;e[n]=t[s>>>5]>>>31-s%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var c=i[r]=[],l=u[r];for(n=0;n<24;n++)c[n/6|0]|=e[(a[n]-1+l)%28]<<31-n%6,c[4+(n/6|0)]|=e[28+(a[n+24]-1+l)%28]<<31-n%6;for(c[0]=c[0]<<1|c[0]>>>31,n=1;n<7;n++)c[n]=c[n]>>>4*(n-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=i[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var s=0;s<16;s++){for(var i=n[s],r=this._lBlock,o=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=r^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function d(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}e.DES=i._createHelper(h);var f=r.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=h.createEncryptor(s.create(e)),this._des2=h.createEncryptor(s.create(n)),this._des3=h.createEncryptor(s.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(f)}(),t.TripleDES}(ra(),ga(),Ta(),Za(),Ka())),Ou.exports}var Eu,Du={exports:{}};var Iu,Ru={exports:{}};var Nu,Bu={exports:{}};var Pu,Vu={exports:{}};function qu(){return Pu||(Pu=1,Vu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo;const i=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function u(t,e){let n=e>>24&255,s=e>>16&255,i=e>>8&255,r=255&e,o=t.sbox[0][n]+t.sbox[1][s];return o^=t.sbox[2][i],o+=t.sbox[3][r],o}function c(t,e,n){let s,r=e,o=n;for(let e=0;e<i;++e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[i],r^=t.pbox[i+1],{left:r,right:o}}function l(t,e,n){let s,r=e,o=n;for(let e=i+1;e>1;--e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,n){for(let e=0;e<4;e++){t.sbox[e]=[];for(let n=0;n<256;n++)t.sbox[e][n]=o[e][n]}let s=0;for(let o=0;o<i+2;o++)t.pbox[o]=r[o]^e[s],s++,s>=n&&(s=0);let a=0,u=0,l=0;for(let e=0;e<i+2;e+=2)l=c(t,a,u),a=l.left,u=l.right,t.pbox[e]=a,t.pbox[e+1]=u;for(let e=0;e<4;e++)for(let n=0;n<256;n+=2)l=c(t,a,u),a=l.left,u=l.right,t.sbox[e][n]=a,t.sbox[e][n+1]=u;return!0}var p=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4;h(a,e,n)}},encryptBlock:function(t,e){var n=c(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},decryptBlock:function(t,e){var n=l(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(p)}(),t.Blowfish}(ra(),ga(),Ta(),Za(),Ka())),Vu.exports}na.exports=function(t){return t}(ra(),ua(),ha(),fa(),ga(),wa(),Ta(),Ca(),Ma(),Ea||(Ea=1,Da.exports=function(t){return n=(e=t).lib.WordArray,s=e.algo,i=s.SHA256,r=s.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r),t.SHA224;var e,n,s,i,r}(ra(),Ma())),Na(),Ba||(Ba=1,Pa.exports=function(t){return n=(e=t).x64,s=n.Word,i=n.WordArray,r=e.algo,o=r.SHA512,a=r.SHA384=o.extend({_doReset:function(){this._hash=new i.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=o._createHelper(a),e.HmacSHA384=o._createHmacHelper(a),t.SHA384;var e,n,s,i,r,o,a}(ra(),ua(),Na())),Fa(),ja||(ja=1,za.exports=function(t){
|
|
13
|
+
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}else t+=1<<24;return t}function s(t){return 0===(t[0]=n(t[0]))&&(t[1]=n(t[1])),t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),s(o);var a=o.slice(0);n.encryptBlock(a,0);for(var u=0;u<i;u++)t[e+u]^=a[u]}});return e.Decryptor=i,e}(),t.mode.CTRGladman}(sa(),Ya())),iu.exports}var ou,au={exports:{}};function uu(){return ou||(ou=1,au.exports=function(t){return t.mode.OFB=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._keystream;i&&(r=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(r,0);for(var o=0;o<s;o++)t[e+o]^=r[o]}}),e.Decryptor=n,e),t.mode.OFB;var e,n}(sa(),Ya())),au.exports}var cu,lu={exports:{}};var hu,pu={exports:{}};var du,fu={exports:{}};var _u,mu={exports:{}};var gu,vu={exports:{}};var yu,wu={exports:{}};var bu,xu={exports:{}};var Tu,Au={exports:{}};var ku,Cu={exports:{}};function Su(){return ku||(ku=1,Cu.exports=function(t){return function(){var e=t,n=e.lib,s=n.WordArray,i=n.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var s=o[n]-1;e[n]=t[s>>>5]>>>31-s%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var c=i[r]=[],l=u[r];for(n=0;n<24;n++)c[n/6|0]|=e[(a[n]-1+l)%28]<<31-n%6,c[4+(n/6|0)]|=e[28+(a[n+24]-1+l)%28]<<31-n%6;for(c[0]=c[0]<<1|c[0]>>>31,n=1;n<7;n++)c[n]=c[n]>>>4*(n-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=i[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var s=0;s<16;s++){for(var i=n[s],r=this._lBlock,o=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=r^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function d(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}e.DES=i._createHelper(h);var f=r.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=h.createEncryptor(s.create(e)),this._des2=h.createEncryptor(s.create(n)),this._des3=h.createEncryptor(s.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(f)}(),t.TripleDES}(sa(),_a(),ba(),Ga(),Ya())),Cu.exports}var Ou,Mu={exports:{}};var Eu,Du={exports:{}};var Iu,Ru={exports:{}};var Nu,Bu={exports:{}};function Pu(){return Nu||(Nu=1,Bu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo;const i=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function u(t,e){let n=e>>24&255,s=e>>16&255,i=e>>8&255,r=255&e,o=t.sbox[0][n]+t.sbox[1][s];return o^=t.sbox[2][i],o+=t.sbox[3][r],o}function c(t,e,n){let s,r=e,o=n;for(let e=0;e<i;++e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[i],r^=t.pbox[i+1],{left:r,right:o}}function l(t,e,n){let s,r=e,o=n;for(let e=i+1;e>1;--e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,n){for(let e=0;e<4;e++){t.sbox[e]=[];for(let n=0;n<256;n++)t.sbox[e][n]=o[e][n]}let s=0;for(let o=0;o<i+2;o++)t.pbox[o]=r[o]^e[s],s++,s>=n&&(s=0);let a=0,u=0,l=0;for(let e=0;e<i+2;e+=2)l=c(t,a,u),a=l.left,u=l.right,t.pbox[e]=a,t.pbox[e+1]=u;for(let e=0;e<4;e++)for(let n=0;n<256;n+=2)l=c(t,a,u),a=l.left,u=l.right,t.sbox[e][n]=a,t.sbox[e][n+1]=u;return!0}var p=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4;h(a,e,n)}},encryptBlock:function(t,e){var n=c(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},decryptBlock:function(t,e){var n=l(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(p)}(),t.Blowfish}(sa(),_a(),ba(),Ga(),Ya())),Bu.exports}ta.exports=function(t){return t}(sa(),oa(),ca(),pa(),_a(),va(),ba(),Aa(),Sa(),Oa||(Oa=1,Ma.exports=function(t){return n=(e=t).lib.WordArray,s=e.algo,i=s.SHA256,r=s.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r),t.SHA224;var e,n,s,i,r}(sa(),Sa())),Ia(),Ra||(Ra=1,Na.exports=function(t){return n=(e=t).x64,s=n.Word,i=n.WordArray,r=e.algo,o=r.SHA512,a=r.SHA384=o.extend({_doReset:function(){this._hash=new i.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=o._createHelper(a),e.HmacSHA384=o._createHmacHelper(a),t.SHA384;var e,n,s,i,r,o,a}(sa(),oa(),Ia())),Va(),Fa||(Fa=1,qa.exports=function(t){
|
|
22
14
|
/** @preserve
|
|
23
15
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
24
16
|
|
|
@@ -29,5 +21,13 @@ return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();functio
|
|
|
29
21
|
|
|
30
22
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
23
|
*/
|
|
32
|
-
return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(ra())),Ua(),Ha||(Ha=1,$a.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(ra(),Ma(),Ua())),Za(),Ka(),eu(),iu(),au(),lu(),hu||(hu=1,pu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(ra(),Ka())),du||(du=1,fu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(ra(),Ka())),_u||(_u=1,mu.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(ra(),Ka())),gu||(gu=1,vu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(ra(),Ka())),yu||(yu=1,wu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(ra(),Ka())),bu||(bu=1,xu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(ra(),Ka())),Tu||(Tu=1,Au.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(ra(),Ka())),ku||(ku=1,Cu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(ra(),ga(),Ta(),Za(),Ka())),Mu(),Eu||(Eu=1,Du.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(ra(),ga(),Ta(),Za(),Ka())),Iu||(Iu=1,Ru.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(ra(),ga(),Ta(),Za(),Ka())),Nu||(Nu=1,Bu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(ra(),ga(),Ta(),Za(),Ka())),qu());var Fu,ju=Ho(na.exports);function zu(t,e){const n=`${t}:${e}`,s=ju.SHA256(n).toString(ju.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function Wu(t,e){if(t instanceof Gu&&e instanceof Xu)t.plug(e);else if(t instanceof Zu&&e instanceof Yu)t.plug(e);else if(t instanceof Hu&&e instanceof $u)t.plug(e);else if(t instanceof Hu&&e instanceof Yu)t.plug(e);else if(t instanceof Hu&&e instanceof Xu)t.plug(e);else if(t instanceof Gu&&e instanceof $u)t.plug(e);else{if(!(t instanceof Zu&&e instanceof $u))throw Error("Input and output type is not compatible");t.plug(e)}}function Lu(t,e){if(t instanceof Gu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Zu&&e instanceof Yu)t.unPlug(e);else if(t instanceof Hu&&e instanceof $u)t.unPlug(e);else if(t instanceof Hu&&e instanceof Yu)t.unPlug(e);else if(t instanceof Hu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Gu&&e instanceof $u)t.unPlug(e);else{if(!(t instanceof Zu&&e instanceof $u))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Fu||(Fu={}));class Uu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=zu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Hu extends Uu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof $u||(t instanceof $u?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Wu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Wu(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof $u||(t instanceof $u?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Lu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Lu(e,t))))}unPlugAll(){Uu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class $u extends Uu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Hu||(t instanceof Hu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Wu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Wu(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Hu||(t instanceof Hu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Lu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Lu(t,e))))}unPlugAll(){Uu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Gu extends Uu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Uu.unPlugAll(this)}}class Xu extends Uu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Hu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Hu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){Uu.unPlugAll(this)}}class Zu extends Uu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Uu.unPlugAll(this)}}class Yu extends Uu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Uu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Zu))}}class Qu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Fu.AudioInput:if(this.plugableModule instanceof ec)throw Error("PolyModule is not supported");e=new Gu(this.plugableModule,t);break;case Fu.AudioOutput:if(this.plugableModule instanceof ec)throw Error("PolyModule is not supported");e=new Xu(this.plugableModule,t);break;case Fu.ForwardInput:if(this.plugableModule instanceof tc)throw Error("MonoModule is not supported");e=new Hu(this.plugableModule,t);break;case Fu.ForwardOutput:if(this.plugableModule instanceof tc)throw Error("MonoModule is not supported");e=new $u(this.plugableModule,t);break;case Fu.MidiInput:e=new Zu(this.plugableModule,t);break;case Fu.MidiOutput:e=new Yu(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class Ku{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Ju,tc=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||ea(),delete e.id,this.inputs=new Qu(this),this.outputs=new Qu(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Wu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:Fu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Fu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Fu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Fu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class ec{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||ea(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=1,this.inputs=new Qu(this),this.outputs=new Qu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Wu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:Fu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Fu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Fu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Fu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=zu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof ec)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(Ju||(Ju={}));const nc=.01,sc={attack:nc,decay:nc,sustain:1,release:nc};class ic extends tc{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...sc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(Ju.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(Ju.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(Ju.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(Ju.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.activeNote&&this.activeNote!==t.fullName||(this.internalModule.triggerRelease(e),this.activeNote=void 0)};maxTime(t){return t===Ju.Sustain?1:2}minTime(t){return t===Ju.Sustain?0:nc}}class rc extends ec{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...sc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class oc extends ic{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class ac extends rc{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:oc,props:{...sc,...s}})}}class uc extends ic{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class cc extends rc{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:uc,props:s})}}const lc={amount:0};class hc extends ic{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...lc,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class pc extends rc{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:hc,props:s})}}const dc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class fc extends tc{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{...dc,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!Wc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class _c extends ec{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:fc,props:{...dc,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const mc={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class gc extends tc{_cutoff;_amount;constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{...mc,...s}}),this._cutoff=new $r(this.cutoff),this._cutoff.connect(this.internalModule.frequency),this._amount=new qr,this._amount.connect(this._cutoff),this.updateAmountFactor(),this.registerBasicInputs(),this.registerOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._cutoff&&(this._cutoff.addend.value=t),this._props={...this.props,cutoff:t},this.updateAmountFactor()}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t},this.updateAmountFactor()}registerOutputs(){this.registerBasicOutputs(),this.registerAudioInput({name:"cutoff",internalModule:this._amount})}updateAmountFactor(){if(!this._amount)return;const t=this.envelopeAmount>0?this.envelopeAmount*Math.abs(2e4-this.cutoff):this.envelopeAmount*Math.abs(1-this.cutoff);this._amount.factor.value=t}}class vc extends ec{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:gc,props:{...mc,...s}}),this.registerBasicInputs(),this.registerOutputs()}registerOutputs(){this.registerBasicOutputs(),this.registerInput({name:"cutoff"})}}class yc extends tc{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerAudioInput({name:"input",internalModule:this.internalModule})}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class wc extends ec{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:bc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class bc extends tc{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new Ku,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const xc={selectedId:null};class Tc extends tc{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Ku,{id:e,name:n,props:{...xc,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=Wc.midiDeviceManager.find(t);e?.addEventListener(this.forwardMidiEvent)}forwardMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=Wc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this.forwardMidiEvent)}}const Ac={volume:-1/0};class kc extends tc{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...Ac,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class Cc extends ec{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:kc,props:{...Ac,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Sc={activeNotes:[]};class Oc extends tc{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Ku,{id:e,name:n,props:{...Sc,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=(t,e)=>{this.activeNotes=[...this.activeNotes,t.fullName],Wc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!0,e))};triggerRelease=(t,e)=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),Wc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!1,e))};serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}const Mc={wet:1};class Ec extends tc{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Mc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}get wet(){return this._props.wet}set wet(t){this._props={...this.props,wet:t},this.internalModule.wet.value=this.wet}}const Dc={decay:1.5,preDelay:.025};class Ic extends Ec{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Dc,...s}})}get decay(){return this._props.decay}set decay(t){this._props={...this.props,decay:t},this.internalModule.decay=this.decay}get preDelay(){return this._props.preDelay}set preDelay(t){this._props={...this.props,preDelay:t},this.internalModule.preDelay=this.preDelay}}const Rc={delayTime:1,feedback:.3};class Nc extends Ec{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Rc,...s}})}get delayTime(){return this._props.delayTime}set delayTime(t){this._props={...this.props,delayTime:t},this.internalModule.delayTime.value=this.delayTime}get feedback(){return this._props.feedback}set feedback(t){this._props={...this.props,feedback:t},this.internalModule.feedback.value=this.feedback}}const Bc={drive:.3};class Pc extends Ec{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Bc,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Vc={bits:16};class qc extends Ec{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new bo,props:{...Vc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class Fc extends tc{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new Ku,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){Wc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&qo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function jc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=Xo.upperFirst(Xo.camelCase(t))){case _c.moduleName:return _c;case ac.moduleName:return ac;case cc.moduleName:return cc;case pc.moduleName:return pc;case vc.moduleName:return vc;case Cc.moduleName:return Cc;case yc.moduleName:return yc;case wc.moduleName:return wc;case Tc.moduleName:return Tc;case Oc.moduleName:return Oc;case Ic.moduleName:return Ic;case Nc.moduleName:return Nc;case Pc.moduleName:return Pc;case qc.moduleName:return qc;case Fc.moduleName:return Fc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class zc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return zc.instance||(zc.instance=new zc),zc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new Lo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,type:s,props:i={}}=t,r=jc({id:e,name:n,type:s,props:{}});return r.props=i,this.modules[r.id]=r,this.updateRoutes(),r.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateNameModule(t,e){const n=this.findById(t);return n.name=e,n.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}updatePropsModule(t,e){const n=this.findById(t),s=this.applyRoutesRequired(n,e);return n.props=e,s&&this.updateRoutes(),n.serialize()}addRoute(t){const e=function(t){const e=t.id||ea();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(qo.fromNote(e,"noteOn"===n))}dispose(){Object.values(this.modules).forEach((t=>{t.dispose()})),this.modules={},this.routes={}}findById(t){const e=this.modules[t];if(!e)throw Error(`Audio module with id ${t} not exists`);return e}get isStarted(){return void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(Wc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=Wc.findById(e),o=Wc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return Wu(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}applyRoutesRequired(t,e){return!!e.polyNumber&&(t instanceof wc&&e.polyNumber!==t.polyNumber)}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var Wc=zc.getInstance();exports.MidiDevice=Fo,exports.MidiDeviceManager=Lo,exports.Note=Po,exports.default=Wc;
|
|
24
|
+
return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(sa())),Wa(),La||(La=1,Ua.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(sa(),Sa(),Wa())),Ga(),Ya(),Ja(),nu(),ru(),uu(),cu||(cu=1,lu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(sa(),Ya())),hu||(hu=1,pu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(sa(),Ya())),du||(du=1,fu.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(sa(),Ya())),_u||(_u=1,mu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(sa(),Ya())),gu||(gu=1,vu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(sa(),Ya())),yu||(yu=1,wu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(sa(),Ya())),bu||(bu=1,xu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(sa(),Ya())),Tu||(Tu=1,Au.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(sa(),_a(),ba(),Ga(),Ya())),Su(),Ou||(Ou=1,Mu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(sa(),_a(),ba(),Ga(),Ya())),Eu||(Eu=1,Du.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(sa(),_a(),ba(),Ga(),Ya())),Iu||(Iu=1,Ru.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(sa(),_a(),ba(),Ga(),Ya())),Pu());var Vu,Fu=Jo(ta.exports);function qu(t,e){const n=`${t}:${e}`,s=Fu.SHA256(n).toString(Fu.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function ju(t,e){if(t instanceof Hu&&e instanceof $u)t.plug(e);else if(t instanceof Gu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof Uu)t.plug(e);else if(t instanceof Lu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof $u)t.plug(e);else if(t instanceof Hu&&e instanceof Uu)t.plug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.plug(e)}}function zu(t,e){if(t instanceof Hu&&e instanceof $u)t.unPlug(e);else if(t instanceof Gu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Uu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof $u)t.unPlug(e);else if(t instanceof Hu&&e instanceof Uu)t.unPlug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Vu||(Vu={}));class Wu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=qu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Lu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);ju(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>ju(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);zu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>zu(e,t))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Uu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);ju(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>ju(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);zu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>zu(t,e))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Hu extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class $u extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Lu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){if(super.unPlug(t,e),!(t instanceof Lu))try{this.internalModule.disconnect(t.internalModule)}catch(t){console.error(t)}}unPlugAll(){Wu.unPlugAll(this)}}class Gu extends Wu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class Xu extends Wu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Gu))}}class Zu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Vu.AudioInput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Hu(this.plugableModule,t);break;case Vu.AudioOutput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new $u(this.plugableModule,t);break;case Vu.ForwardInput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Lu(this.plugableModule,t);break;case Vu.ForwardOutput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Uu(this.plugableModule,t);break;case Vu.MidiInput:e=new Gu(this.plugableModule,t);break;case Vu.MidiOutput:e=new Xu(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class Yu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Qu=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||Qo(),delete e.id,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Vu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Vu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class Ku{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||Qo(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=t.numberOfVoices||1,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,numberOfVoices:this.numberOfVoices,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:Vu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Vu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=qu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof Ku)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}var Ju={exports:{}};
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Lodash <https://lodash.com/>
|
|
28
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
29
|
+
* Released under MIT license <https://lodash.com/license>
|
|
30
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
31
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
32
|
+
*/!function(t,e){(function(){var n,s="Expected a function",i="__lodash_hash_undefined__",r="__lodash_placeholder__",o=16,a=32,u=64,c=128,l=256,h=1/0,p=9007199254740991,d=NaN,f=4294967295,_=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",a],["partialRight",u],["rearg",l]],m="[object Arguments]",g="[object Array]",v="[object Boolean]",y="[object Date]",w="[object Error]",b="[object Function]",x="[object GeneratorFunction]",T="[object Map]",A="[object Number]",k="[object Object]",C="[object Promise]",S="[object RegExp]",O="[object Set]",M="[object String]",E="[object Symbol]",D="[object WeakMap]",I="[object ArrayBuffer]",R="[object DataView]",N="[object Float32Array]",B="[object Float64Array]",P="[object Int8Array]",V="[object Int16Array]",F="[object Int32Array]",q="[object Uint8Array]",j="[object Uint8ClampedArray]",z="[object Uint16Array]",W="[object Uint32Array]",L=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,X=RegExp($.source),Z=RegExp(G.source),Y=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(nt.source),it=/^\s+/,rt=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,ut=/,? & /,ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ht=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,xt="\\ud800-\\udfff",Tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",kt="a-z\\xdf-\\xf6\\xf8-\\xff",Ct="A-Z\\xc0-\\xd6\\xd8-\\xde",St="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Mt="['’]",Et="["+xt+"]",Dt="["+Ot+"]",It="["+Tt+"]",Rt="\\d+",Nt="["+At+"]",Bt="["+kt+"]",Pt="[^"+xt+Ot+Rt+At+kt+Ct+"]",Vt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+xt+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",zt="["+Ct+"]",Wt="\\u200d",Lt="(?:"+Bt+"|"+Pt+")",Ut="(?:"+zt+"|"+Pt+")",Ht="(?:['’](?:d|ll|m|re|s|t|ve))?",$t="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+It+"|"+Vt+")"+"?",Xt="["+St+"]?",Zt=Xt+Gt+("(?:"+Wt+"(?:"+[Ft,qt,jt].join("|")+")"+Xt+Gt+")*"),Yt="(?:"+[Nt,qt,jt].join("|")+")"+Zt,Qt="(?:"+[Ft+It+"?",It,qt,jt,Et].join("|")+")",Kt=RegExp(Mt,"g"),Jt=RegExp(It,"g"),te=RegExp(Vt+"(?="+Vt+")|"+Qt+Zt,"g"),ee=RegExp([zt+"?"+Bt+"+"+Ht+"(?="+[Dt,zt,"$"].join("|")+")",Ut+"+"+$t+"(?="+[Dt,zt+Lt,"$"].join("|")+")",zt+"?"+Lt+"+"+Ht,zt+"+"+$t,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rt,Yt].join("|"),"g"),ne=RegExp("["+Wt+xt+Tt+St+"]"),se=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ie=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],re=-1,oe={};oe[N]=oe[B]=oe[P]=oe[V]=oe[F]=oe[q]=oe[j]=oe[z]=oe[W]=!0,oe[m]=oe[g]=oe[I]=oe[v]=oe[R]=oe[y]=oe[w]=oe[b]=oe[T]=oe[A]=oe[k]=oe[S]=oe[O]=oe[M]=oe[D]=!1;var ae={};ae[m]=ae[g]=ae[I]=ae[R]=ae[v]=ae[y]=ae[N]=ae[B]=ae[P]=ae[V]=ae[F]=ae[T]=ae[A]=ae[k]=ae[S]=ae[O]=ae[M]=ae[E]=ae[q]=ae[j]=ae[z]=ae[W]=!0,ae[w]=ae[b]=ae[D]=!1;var ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ce=parseFloat,le=parseInt,he="object"==typeof Ko&&Ko&&Ko.Object===Object&&Ko,pe="object"==typeof self&&self&&self.Object===Object&&self,de=he||pe||Function("return this")(),fe=e&&!e.nodeType&&e,_e=fe&&t&&!t.nodeType&&t,me=_e&&_e.exports===fe,ge=me&&he.process,ve=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ye=ve&&ve.isArrayBuffer,we=ve&&ve.isDate,be=ve&&ve.isMap,xe=ve&&ve.isRegExp,Te=ve&&ve.isSet,Ae=ve&&ve.isTypedArray;function ke(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ce(t,e,n,s){for(var i=-1,r=null==t?0:t.length;++i<r;){var o=t[i];e(s,o,n(o),t)}return s}function Se(t,e){for(var n=-1,s=null==t?0:t.length;++n<s&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Me(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(!e(t[n],n,t))return!1;return!0}function Ee(t,e){for(var n=-1,s=null==t?0:t.length,i=0,r=[];++n<s;){var o=t[n];e(o,n,t)&&(r[i++]=o)}return r}function De(t,e){return!!(null==t?0:t.length)&&ze(t,e,0)>-1}function Ie(t,e,n){for(var s=-1,i=null==t?0:t.length;++s<i;)if(n(e,t[s]))return!0;return!1}function Re(t,e){for(var n=-1,s=null==t?0:t.length,i=Array(s);++n<s;)i[n]=e(t[n],n,t);return i}function Ne(t,e){for(var n=-1,s=e.length,i=t.length;++n<s;)t[i+n]=e[n];return t}function Be(t,e,n,s){var i=-1,r=null==t?0:t.length;for(s&&r&&(n=t[++i]);++i<r;)n=e(n,t[i],i,t);return n}function Pe(t,e,n,s){var i=null==t?0:t.length;for(s&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Ve(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(e(t[n],n,t))return!0;return!1}var Fe=He("length");function qe(t,e,n){var s;return n(t,(function(t,n,i){if(e(t,n,i))return s=n,!1})),s}function je(t,e,n,s){for(var i=t.length,r=n+(s?1:-1);s?r--:++r<i;)if(e(t[r],r,t))return r;return-1}function ze(t,e,n){return e==e?function(t,e,n){var s=n-1,i=t.length;for(;++s<i;)if(t[s]===e)return s;return-1}(t,e,n):je(t,Le,n)}function We(t,e,n,s){for(var i=n-1,r=t.length;++i<r;)if(s(t[i],e))return i;return-1}function Le(t){return t!=t}function Ue(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:d}function He(t){return function(e){return null==e?n:e[t]}}function $e(t){return function(e){return null==t?n:t[e]}}function Ge(t,e,n,s,i){return i(t,(function(t,i,r){n=s?(s=!1,t):e(n,t,i,r)})),n}function Xe(t,e){for(var s,i=-1,r=t.length;++i<r;){var o=e(t[i]);o!==n&&(s=s===n?o:s+o)}return s}function Ze(t,e){for(var n=-1,s=Array(t);++n<t;)s[n]=e(n);return s}function Ye(t){return t?t.slice(0,fn(t)+1).replace(it,""):t}function Qe(t){return function(e){return t(e)}}function Ke(t,e){return Re(e,(function(e){return t[e]}))}function Je(t,e){return t.has(e)}function tn(t,e){for(var n=-1,s=t.length;++n<s&&ze(e,t[n],0)>-1;);return n}function en(t,e){for(var n=t.length;n--&&ze(e,t[n],0)>-1;);return n}var nn=$e({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),sn=$e({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(t){return"\\"+ue[t]}function on(t){return ne.test(t)}function an(t){var e=-1,n=Array(t.size);return t.forEach((function(t,s){n[++e]=[s,t]})),n}function un(t,e){return function(n){return t(e(n))}}function cn(t,e){for(var n=-1,s=t.length,i=0,o=[];++n<s;){var a=t[n];a!==e&&a!==r||(t[n]=r,o[i++]=n)}return o}function ln(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function pn(t){return on(t)?function(t){var e=te.lastIndex=0;for(;te.test(t);)++e;return e}(t):Fe(t)}function dn(t){return on(t)?function(t){return t.match(te)||[]}(t):function(t){return t.split("")}(t)}function fn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var _n=$e({"&":"&","<":"<",">":">",""":'"',"'":"'"});var mn=function t(e){var rt,xt=(e=null==e?de:mn.defaults(de.Object(),e,mn.pick(de,ie))).Array,Tt=e.Date,At=e.Error,kt=e.Function,Ct=e.Math,St=e.Object,Ot=e.RegExp,Mt=e.String,Et=e.TypeError,Dt=xt.prototype,It=kt.prototype,Rt=St.prototype,Nt=e["__core-js_shared__"],Bt=It.toString,Pt=Rt.hasOwnProperty,Vt=0,Ft=(rt=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+rt:"",qt=Rt.toString,jt=Bt.call(St),zt=de._,Wt=Ot("^"+Bt.call(Pt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Lt=me?e.Buffer:n,Ut=e.Symbol,Ht=e.Uint8Array,$t=Lt?Lt.allocUnsafe:n,Gt=un(St.getPrototypeOf,St),Xt=St.create,Zt=Rt.propertyIsEnumerable,Yt=Dt.splice,Qt=Ut?Ut.isConcatSpreadable:n,te=Ut?Ut.iterator:n,ne=Ut?Ut.toStringTag:n,ue=function(){try{var t=pr(St,"defineProperty");return t({},"",{}),t}catch(t){}}(),he=e.clearTimeout!==de.clearTimeout&&e.clearTimeout,pe=Tt&&Tt.now!==de.Date.now&&Tt.now,fe=e.setTimeout!==de.setTimeout&&e.setTimeout,_e=Ct.ceil,ge=Ct.floor,ve=St.getOwnPropertySymbols,Fe=Lt?Lt.isBuffer:n,$e=e.isFinite,gn=Dt.join,vn=un(St.keys,St),yn=Ct.max,wn=Ct.min,bn=Tt.now,xn=e.parseInt,Tn=Ct.random,An=Dt.reverse,kn=pr(e,"DataView"),Cn=pr(e,"Map"),Sn=pr(e,"Promise"),On=pr(e,"Set"),Mn=pr(e,"WeakMap"),En=pr(St,"create"),Dn=Mn&&new Mn,In={},Rn=Fr(kn),Nn=Fr(Cn),Bn=Fr(Sn),Pn=Fr(On),Vn=Fr(Mn),Fn=Ut?Ut.prototype:n,qn=Fn?Fn.valueOf:n,jn=Fn?Fn.toString:n;function zn(t){if(na(t)&&!Ho(t)&&!(t instanceof Hn)){if(t instanceof Un)return t;if(Pt.call(t,"__wrapped__"))return qr(t)}return new Un(t)}var Wn=function(){function t(){}return function(e){if(!ea(e))return{};if(Xt)return Xt(e);t.prototype=e;var s=new t;return t.prototype=n,s}}();function Ln(){}function Un(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=n}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Zn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Xn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Gn(t);this.size=e.size}function Qn(t,e){var n=Ho(t),s=!n&&Uo(t),i=!n&&!s&&Zo(t),r=!n&&!s&&!i&&la(t),o=n||s||i||r,a=o?Ze(t.length,Mt):[],u=a.length;for(var c in t)!e&&!Pt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yr(c,u))||a.push(c);return a}function Kn(t){var e=t.length;return e?t[Zs(0,e-1)]:n}function Jn(t,e){return Br(Ei(t),us(e,0,t.length))}function ts(t){return Br(Ei(t))}function es(t,e,s){(s!==n&&!zo(t[e],s)||s===n&&!(e in t))&&os(t,e,s)}function ns(t,e,s){var i=t[e];Pt.call(t,e)&&zo(i,s)&&(s!==n||e in t)||os(t,e,s)}function ss(t,e){for(var n=t.length;n--;)if(zo(t[n][0],e))return n;return-1}function is(t,e,n,s){return ds(t,(function(t,i,r){e(s,t,n(t),r)})),s}function rs(t,e){return t&&Di(e,Ia(e),t)}function os(t,e,n){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function as(t,e){for(var s=-1,i=e.length,r=xt(i),o=null==t;++s<i;)r[s]=o?n:Sa(t,e[s]);return r}function us(t,e,s){return t==t&&(s!==n&&(t=t<=s?t:s),e!==n&&(t=t>=e?t:e)),t}function cs(t,e,s,i,r,o){var a,u=1&e,c=2&e,l=4&e;if(s&&(a=r?s(t,i,r,o):s(t)),a!==n)return a;if(!ea(t))return t;var h=Ho(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Pt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Ei(t,a)}else{var p=_r(t),d=p==b||p==x;if(Zo(t))return Ai(t,u);if(p==k||p==m||d&&!r){if(a=c||d?{}:gr(t),!u)return c?function(t,e){return Di(t,fr(t),e)}(t,function(t,e){return t&&Di(e,Ra(e),t)}(a,t)):function(t,e){return Di(t,dr(t),e)}(t,rs(a,t))}else{if(!ae[p])return r?t:{};a=function(t,e,n){var s=t.constructor;switch(e){case I:return ki(t);case v:case y:return new s(+t);case R:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case N:case B:case P:case V:case F:case q:case j:case z:case W:return Ci(t,n);case T:return new s;case A:case M:return new s(t);case S:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new s;case E:return i=t,qn?St(qn.call(i)):{}}var i}(t,p,u)}}o||(o=new Yn);var f=o.get(t);if(f)return f;o.set(t,a),aa(t)?t.forEach((function(n){a.add(cs(n,e,s,n,t,o))})):sa(t)&&t.forEach((function(n,i){a.set(i,cs(n,e,s,i,t,o))}));var _=h?n:(l?c?rr:ir:c?Ra:Ia)(t);return Se(_||t,(function(n,i){_&&(n=t[i=n]),ns(a,i,cs(n,e,s,i,t,o))})),a}function ls(t,e,s){var i=s.length;if(null==t)return!i;for(t=St(t);i--;){var r=s[i],o=e[r],a=t[r];if(a===n&&!(r in t)||!o(a))return!1}return!0}function hs(t,e,i){if("function"!=typeof t)throw new Et(s);return Dr((function(){t.apply(n,i)}),e)}function ps(t,e,n,s){var i=-1,r=De,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Re(e,Qe(n))),s?(r=Ie,o=!1):e.length>=200&&(r=Je,o=!1,e=new Zn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=s||0!==l?l:0,o&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;u.push(l)}else r(e,h,s)||u.push(l)}return u}zn.templateSettings={escape:Y,evaluate:Q,interpolate:K,variable:"",imports:{_:zn}},zn.prototype=Ln.prototype,zn.prototype.constructor=zn,Un.prototype=Wn(Ln.prototype),Un.prototype.constructor=Un,Hn.prototype=Wn(Ln.prototype),Hn.prototype.constructor=Hn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(t){var e=this.__data__;if(En){var s=e[t];return s===i?n:s}return Pt.call(e,t)?e[t]:n},$n.prototype.has=function(t){var e=this.__data__;return En?e[t]!==n:Pt.call(e,t)},$n.prototype.set=function(t,e){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=En&&e===n?i:e,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=ss(e,t);return!(n<0)&&(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,!0)},Gn.prototype.get=function(t){var e=this.__data__,s=ss(e,t);return s<0?n:e[s][1]},Gn.prototype.has=function(t){return ss(this.__data__,t)>-1},Gn.prototype.set=function(t,e){var n=this.__data__,s=ss(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Xn.prototype.delete=function(t){var e=lr(this,t).delete(t);return this.size-=e?1:0,e},Xn.prototype.get=function(t){return lr(this,t).get(t)},Xn.prototype.has=function(t){return lr(this,t).has(t)},Xn.prototype.set=function(t,e){var n=lr(this,t),s=n.size;return n.set(t,e),this.size+=n.size==s?0:1,this},Zn.prototype.add=Zn.prototype.push=function(t){return this.__data__.set(t,i),this},Zn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Gn){var s=n.__data__;if(!Cn||s.length<199)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new Xn(s)}return n.set(t,e),this.size=n.size,this};var ds=Ni(bs),fs=Ni(xs,!0);function _s(t,e){var n=!0;return ds(t,(function(t,s,i){return n=!!e(t,s,i)})),n}function ms(t,e,s){for(var i=-1,r=t.length;++i<r;){var o=t[i],a=e(o);if(null!=a&&(u===n?a==a&&!ca(a):s(a,u)))var u=a,c=o}return c}function gs(t,e){var n=[];return ds(t,(function(t,s,i){e(t,s,i)&&n.push(t)})),n}function vs(t,e,n,s,i){var r=-1,o=t.length;for(n||(n=vr),i||(i=[]);++r<o;){var a=t[r];e>0&&n(a)?e>1?vs(a,e-1,n,s,i):Ne(i,a):s||(i[i.length]=a)}return i}var ys=Bi(),ws=Bi(!0);function bs(t,e){return t&&ys(t,e,Ia)}function xs(t,e){return t&&ws(t,e,Ia)}function Ts(t,e){return Ee(e,(function(e){return Ko(t[e])}))}function As(t,e){for(var s=0,i=(e=wi(e,t)).length;null!=t&&s<i;)t=t[Vr(e[s++])];return s&&s==i?t:n}function ks(t,e,n){var s=e(t);return Ho(t)?s:Ne(s,n(t))}function Cs(t){return null==t?t===n?"[object Undefined]":"[object Null]":ne&&ne in St(t)?function(t){var e=Pt.call(t,ne),s=t[ne];try{t[ne]=n;var i=!0}catch(t){}var r=qt.call(t);i&&(e?t[ne]=s:delete t[ne]);return r}(t):function(t){return qt.call(t)}(t)}function Ss(t,e){return t>e}function Os(t,e){return null!=t&&Pt.call(t,e)}function Ms(t,e){return null!=t&&e in St(t)}function Es(t,e,s){for(var i=s?Ie:De,r=t[0].length,o=t.length,a=o,u=xt(o),c=1/0,l=[];a--;){var h=t[a];a&&e&&(h=Re(h,Qe(e))),c=wn(h.length,c),u[a]=!s&&(e||r>=120&&h.length>=120)?new Zn(a&&h):n}h=t[0];var p=-1,d=u[0];t:for(;++p<r&&l.length<c;){var f=h[p],_=e?e(f):f;if(f=s||0!==f?f:0,!(d?Je(d,_):i(l,_,s))){for(a=o;--a;){var m=u[a];if(!(m?Je(m,_):i(t[a],_,s)))continue t}d&&d.push(_),l.push(f)}}return l}function Ds(t,e,s){var i=null==(t=Or(t,e=wi(e,t)))?t:t[Vr(Yr(e))];return null==i?n:ke(i,t,s)}function Is(t){return na(t)&&Cs(t)==m}function Rs(t,e,s,i,r){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,s,i,r,o){var a=Ho(t),u=Ho(e),c=a?g:_r(t),l=u?g:_r(e),h=(c=c==m?k:c)==k,p=(l=l==m?k:l)==k,d=c==l;if(d&&Zo(t)){if(!Zo(e))return!1;a=!0,h=!1}if(d&&!h)return o||(o=new Yn),a||la(t)?nr(t,e,s,i,r,o):function(t,e,n,s,i,r,o){switch(n){case R:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case I:return!(t.byteLength!=e.byteLength||!r(new Ht(t),new Ht(e)));case v:case y:case A:return zo(+t,+e);case w:return t.name==e.name&&t.message==e.message;case S:case M:return t==e+"";case T:var a=an;case O:var u=1&s;if(a||(a=ln),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;s|=2,o.set(t,e);var l=nr(a(t),a(e),s,i,r,o);return o.delete(t),l;case E:if(qn)return qn.call(t)==qn.call(e)}return!1}(t,e,c,s,i,r,o);if(!(1&s)){var f=h&&Pt.call(t,"__wrapped__"),_=p&&Pt.call(e,"__wrapped__");if(f||_){var b=f?t.value():t,x=_?e.value():e;return o||(o=new Yn),r(b,x,s,i,o)}}if(!d)return!1;return o||(o=new Yn),function(t,e,s,i,r,o){var a=1&s,u=ir(t),c=u.length,l=ir(e),h=l.length;if(c!=h&&!a)return!1;var p=c;for(;p--;){var d=u[p];if(!(a?d in e:Pt.call(e,d)))return!1}var f=o.get(t),_=o.get(e);if(f&&_)return f==e&&_==t;var m=!0;o.set(t,e),o.set(e,t);var g=a;for(;++p<c;){var v=t[d=u[p]],y=e[d];if(i)var w=a?i(y,v,d,e,t,o):i(v,y,d,t,e,o);if(!(w===n?v===y||r(v,y,s,i,o):w)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var b=t.constructor,x=e.constructor;b==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return o.delete(t),o.delete(e),m}(t,e,s,i,r,o)}(t,e,s,i,Rs,r))}function Ns(t,e,s,i){var r=s.length,o=r,a=!i;if(null==t)return!o;for(t=St(t);r--;){var u=s[r];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++r<o;){var c=(u=s[r])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===n&&!(c in t))return!1}else{var p=new Yn;if(i)var d=i(l,h,c,t,e,p);if(!(d===n?Rs(h,l,3,i,p):d))return!1}}return!0}function Bs(t){return!(!ea(t)||(e=t,Ft&&Ft in e))&&(Ko(t)?Wt:mt).test(Fr(t));var e}function Ps(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?Ho(t)?Ws(t[0],t[1]):zs(t):du(t)}function Vs(t){if(!Ar(t))return vn(t);var e=[];for(var n in St(t))Pt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fs(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in St(t))e.push(n);return e}(t);var e=Ar(t),n=[];for(var s in t)("constructor"!=s||!e&&Pt.call(t,s))&&n.push(s);return n}function qs(t,e){return t<e}function js(t,e){var n=-1,s=Go(t)?xt(t.length):[];return ds(t,(function(t,i,r){s[++n]=e(t,i,r)})),s}function zs(t){var e=hr(t);return 1==e.length&&e[0][2]?Cr(e[0][0],e[0][1]):function(n){return n===t||Ns(n,t,e)}}function Ws(t,e){return br(t)&&kr(e)?Cr(Vr(t),e):function(s){var i=Sa(s,t);return i===n&&i===e?Oa(s,t):Rs(e,i,3)}}function Ls(t,e,s,i,r){t!==e&&ys(e,(function(o,a){if(r||(r=new Yn),ea(o))!function(t,e,s,i,r,o,a){var u=Mr(t,s),c=Mr(e,s),l=a.get(c);if(l)return void es(t,s,l);var h=o?o(u,c,s+"",t,e,a):n,p=h===n;if(p){var d=Ho(c),f=!d&&Zo(c),_=!d&&!f&&la(c);h=c,d||f||_?Ho(u)?h=u:Xo(u)?h=Ei(u):f?(p=!1,h=Ai(c,!0)):_?(p=!1,h=Ci(c,!0)):h=[]:ra(c)||Uo(c)?(h=u,Uo(u)?h=va(u):ea(u)&&!Ko(u)||(h=gr(c))):p=!1}p&&(a.set(c,h),r(h,c,i,o,a),a.delete(c));es(t,s,h)}(t,e,a,s,Ls,i,r);else{var u=i?i(Mr(t,a),o,a+"",t,e,r):n;u===n&&(u=o),es(t,a,u)}}),Ra)}function Us(t,e){var s=t.length;if(s)return yr(e+=e<0?s:0,s)?t[e]:n}function Hs(t,e,n){e=e.length?Re(e,(function(t){return Ho(t)?function(e){return As(e,1===t.length?t[0]:t)}:t})):[iu];var s=-1;e=Re(e,Qe(cr()));var i=js(t,(function(t,n,i){var r=Re(e,(function(e){return e(t)}));return{criteria:r,index:++s,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var s=-1,i=t.criteria,r=e.criteria,o=i.length,a=n.length;for(;++s<o;){var u=Si(i[s],r[s]);if(u)return s>=a?u:u*("desc"==n[s]?-1:1)}return t.index-e.index}(t,e,n)}))}function $s(t,e,n){for(var s=-1,i=e.length,r={};++s<i;){var o=e[s],a=As(t,o);n(a,o)&&ti(r,wi(o,t),a)}return r}function Gs(t,e,n,s){var i=s?We:ze,r=-1,o=e.length,a=t;for(t===e&&(e=Ei(e)),n&&(a=Re(t,Qe(n)));++r<o;)for(var u=0,c=e[r],l=n?n(c):c;(u=i(a,l,u,s))>-1;)a!==t&&Yt.call(a,u,1),Yt.call(t,u,1);return t}function Xs(t,e){for(var n=t?e.length:0,s=n-1;n--;){var i=e[n];if(n==s||i!==r){var r=i;yr(i)?Yt.call(t,i,1):pi(t,i)}}return t}function Zs(t,e){return t+ge(Tn()*(e-t+1))}function Ys(t,e){var n="";if(!t||e<1||e>p)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qs(t,e){return Ir(Sr(t,e,iu),t+"")}function Ks(t){return Kn(za(t))}function Js(t,e){var n=za(t);return Br(n,us(e,0,n.length))}function ti(t,e,s,i){if(!ea(t))return t;for(var r=-1,o=(e=wi(e,t)).length,a=o-1,u=t;null!=u&&++r<o;){var c=Vr(e[r]),l=s;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(r!=a){var h=u[c];(l=i?i(h,c,u):n)===n&&(l=ea(h)?h:yr(e[r+1])?[]:{})}ns(u,c,l),u=u[c]}return t}var ei=Dn?function(t,e){return Dn.set(t,e),t}:iu,ni=ue?function(t,e){return ue(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function si(t){return Br(za(t))}function ii(t,e,n){var s=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=xt(i);++s<i;)r[s]=t[s+e];return r}function ri(t,e){var n;return ds(t,(function(t,s,i){return!(n=e(t,s,i))})),!!n}function oi(t,e,n){var s=0,i=null==t?s:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;s<i;){var r=s+i>>>1,o=t[r];null!==o&&!ca(o)&&(n?o<=e:o<e)?s=r+1:i=r}return i}return ai(t,e,iu,n)}function ai(t,e,s,i){var r=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=s(e))!=e,u=null===e,c=ca(e),l=e===n;r<o;){var h=ge((r+o)/2),p=s(t[h]),d=p!==n,f=null===p,_=p==p,m=ca(p);if(a)var g=i||_;else g=l?_&&(i||d):u?_&&d&&(i||!f):c?_&&d&&!f&&(i||!m):!f&&!m&&(i?p<=e:p<e);g?r=h+1:o=h}return wn(o,4294967294)}function ui(t,e){for(var n=-1,s=t.length,i=0,r=[];++n<s;){var o=t[n],a=e?e(o):o;if(!n||!zo(a,u)){var u=a;r[i++]=0===o?0:o}}return r}function ci(t){return"number"==typeof t?t:ca(t)?d:+t}function li(t){if("string"==typeof t)return t;if(Ho(t))return Re(t,li)+"";if(ca(t))return jn?jn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var s=-1,i=De,r=t.length,o=!0,a=[],u=a;if(n)o=!1,i=Ie;else if(r>=200){var c=e?null:Yi(t);if(c)return ln(c);o=!1,i=Je,u=new Zn}else u=e?[]:a;t:for(;++s<r;){var l=t[s],h=e?e(l):l;if(l=n||0!==l?l:0,o&&h==h){for(var p=u.length;p--;)if(u[p]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function pi(t,e){return null==(t=Or(t,e=wi(e,t)))||delete t[Vr(Yr(e))]}function di(t,e,n,s){return ti(t,e,n(As(t,e)),s)}function fi(t,e,n,s){for(var i=t.length,r=s?i:-1;(s?r--:++r<i)&&e(t[r],r,t););return n?ii(t,s?0:r,s?r+1:i):ii(t,s?r+1:0,s?i:r)}function _i(t,e){var n=t;return n instanceof Hn&&(n=n.value()),Be(e,(function(t,e){return e.func.apply(e.thisArg,Ne([t],e.args))}),n)}function mi(t,e,n){var s=t.length;if(s<2)return s?hi(t[0]):[];for(var i=-1,r=xt(s);++i<s;)for(var o=t[i],a=-1;++a<s;)a!=i&&(r[i]=ps(r[i]||o,t[a],e,n));return hi(vs(r,1),e,n)}function gi(t,e,s){for(var i=-1,r=t.length,o=e.length,a={};++i<r;){var u=i<o?e[i]:n;s(a,t[i],u)}return a}function vi(t){return Xo(t)?t:[]}function yi(t){return"function"==typeof t?t:iu}function wi(t,e){return Ho(t)?t:br(t,e)?[t]:Pr(ya(t))}var bi=Qs;function xi(t,e,s){var i=t.length;return s=s===n?i:s,!e&&s>=i?t:ii(t,e,s)}var Ti=he||function(t){return de.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,s=$t?$t(n):new t.constructor(n);return t.copy(s),s}function ki(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function Ci(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(t,e){if(t!==e){var s=t!==n,i=null===t,r=t==t,o=ca(t),a=e!==n,u=null===e,c=e==e,l=ca(e);if(!u&&!l&&!o&&t>e||o&&a&&c&&!u&&!l||i&&a&&c||!s&&c||!r)return 1;if(!i&&!o&&!l&&t<e||l&&s&&r&&!i&&!o||u&&s&&r||!a&&r||!c)return-1}return 0}function Oi(t,e,n,s){for(var i=-1,r=t.length,o=n.length,a=-1,u=e.length,c=yn(r-o,0),l=xt(u+c),h=!s;++a<u;)l[a]=e[a];for(;++i<o;)(h||i<r)&&(l[n[i]]=t[i]);for(;c--;)l[a++]=t[i++];return l}function Mi(t,e,n,s){for(var i=-1,r=t.length,o=-1,a=n.length,u=-1,c=e.length,l=yn(r-a,0),h=xt(l+c),p=!s;++i<l;)h[i]=t[i];for(var d=i;++u<c;)h[d+u]=e[u];for(;++o<a;)(p||i<r)&&(h[d+n[o]]=t[i++]);return h}function Ei(t,e){var n=-1,s=t.length;for(e||(e=xt(s));++n<s;)e[n]=t[n];return e}function Di(t,e,s,i){var r=!s;s||(s={});for(var o=-1,a=e.length;++o<a;){var u=e[o],c=i?i(s[u],t[u],u,s,t):n;c===n&&(c=t[u]),r?os(s,u,c):ns(s,u,c)}return s}function Ii(t,e){return function(n,s){var i=Ho(n)?Ce:is,r=e?e():{};return i(n,t,cr(s,2),r)}}function Ri(t){return Qs((function(e,s){var i=-1,r=s.length,o=r>1?s[r-1]:n,a=r>2?s[2]:n;for(o=t.length>3&&"function"==typeof o?(r--,o):n,a&&wr(s[0],s[1],a)&&(o=r<3?n:o,r=1),e=St(e);++i<r;){var u=s[i];u&&t(e,u,i,o)}return e}))}function Ni(t,e){return function(n,s){if(null==n)return n;if(!Go(n))return t(n,s);for(var i=n.length,r=e?i:-1,o=St(n);(e?r--:++r<i)&&!1!==s(o[r],r,o););return n}}function Bi(t){return function(e,n,s){for(var i=-1,r=St(e),o=s(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===n(r[u],u,r))break}return e}}function Pi(t){return function(e){var s=on(e=ya(e))?dn(e):n,i=s?s[0]:e.charAt(0),r=s?xi(s,1).join(""):e.slice(1);return i[t]()+r}}function Vi(t){return function(e){return Be(Ka(Ua(e).replace(Kt,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Wn(t.prototype),s=t.apply(n,e);return ea(s)?s:n}}function qi(t){return function(e,s,i){var r=St(e);if(!Go(e)){var o=cr(s,3);e=Ia(e),s=function(t){return o(r[t],t,r)}}var a=t(e,s,i);return a>-1?r[o?e[a]:a]:n}}function ji(t){return sr((function(e){var i=e.length,r=i,o=Un.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Et(s);if(o&&!u&&"wrapper"==ar(a))var u=new Un([],!0)}for(r=u?r:i;++r<i;){var c=ar(a=e[r]),l="wrapper"==c?or(a):n;u=l&&xr(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ar(l[0])].apply(u,l[3]):1==a.length&&xr(a)?u[c]():u.thru(a)}return function(){var t=arguments,n=t[0];if(u&&1==t.length&&Ho(n))return u.plant(n).value();for(var s=0,r=i?e[s].apply(this,t):n;++s<i;)r=e[s].call(this,r);return r}}))}function zi(t,e,s,i,r,o,a,u,l,h){var p=e&c,d=1&e,f=2&e,_=24&e,m=512&e,g=f?n:Fi(t);return function c(){for(var v=arguments.length,y=xt(v),w=v;w--;)y[w]=arguments[w];if(_)var b=ur(c),x=function(t,e){for(var n=t.length,s=0;n--;)t[n]===e&&++s;return s}(y,b);if(i&&(y=Oi(y,i,r,_)),o&&(y=Mi(y,o,a,_)),v-=x,_&&v<h){var T=cn(y,b);return Xi(t,e,zi,c.placeholder,s,y,T,u,l,h-v)}var A=d?s:this,k=f?A[t]:t;return v=y.length,u?y=function(t,e){var s=t.length,i=wn(e.length,s),r=Ei(t);for(;i--;){var o=e[i];t[i]=yr(o,s)?r[o]:n}return t}(y,u):m&&v>1&&y.reverse(),p&&l<v&&(y.length=l),this&&this!==de&&this instanceof c&&(k=g||Fi(k)),k.apply(A,y)}}function Wi(t,e){return function(n,s){return function(t,e,n,s){return bs(t,(function(t,i,r){e(s,n(t),i,r)})),s}(n,t,e(s),{})}}function Li(t,e){return function(s,i){var r;if(s===n&&i===n)return e;if(s!==n&&(r=s),i!==n){if(r===n)return i;"string"==typeof s||"string"==typeof i?(s=li(s),i=li(i)):(s=ci(s),i=ci(i)),r=t(s,i)}return r}}function Ui(t){return sr((function(e){return e=Re(e,Qe(cr())),Qs((function(n){var s=this;return t(e,(function(t){return ke(t,s,n)}))}))}))}function Hi(t,e){var s=(e=e===n?" ":li(e)).length;if(s<2)return s?Ys(e,t):e;var i=Ys(e,_e(t/pn(e)));return on(e)?xi(dn(i),0,t).join(""):i.slice(0,t)}function $i(t){return function(e,s,i){return i&&"number"!=typeof i&&wr(e,s,i)&&(s=i=n),e=fa(e),s===n?(s=e,e=0):s=fa(s),function(t,e,n,s){for(var i=-1,r=yn(_e((e-t)/(n||1)),0),o=xt(r);r--;)o[s?r:++i]=t,t+=n;return o}(e,s,i=i===n?e<s?1:-1:fa(i),t)}}function Gi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ga(e),n=ga(n)),t(e,n)}}function Xi(t,e,s,i,r,o,c,l,h,p){var d=8&e;e|=d?a:u,4&(e&=~(d?u:a))||(e&=-4);var f=[t,e,r,d?o:n,d?c:n,d?n:o,d?n:c,l,h,p],_=s.apply(n,f);return xr(t)&&Er(_,f),_.placeholder=i,Rr(_,t,e)}function Zi(t){var e=Ct[t];return function(t,n){if(t=ga(t),(n=null==n?0:wn(_a(n),292))&&$e(t)){var s=(ya(t)+"e").split("e");return+((s=(ya(e(s[0]+"e"+(+s[1]+n)))+"e").split("e"))[0]+"e"+(+s[1]-n))}return e(t)}}var Yi=On&&1/ln(new On([,-0]))[1]==h?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=_r(e);return n==T?an(e):n==O?hn(e):function(t,e){return Re(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ki(t,e,i,h,p,d,f,_){var m=2&e;if(!m&&"function"!=typeof t)throw new Et(s);var g=h?h.length:0;if(g||(e&=-97,h=p=n),f=f===n?f:yn(_a(f),0),_=_===n?_:_a(_),g-=p?p.length:0,e&u){var v=h,y=p;h=p=n}var w=m?n:or(t),b=[t,e,i,h,p,v,y,d,f,_];if(w&&function(t,e){var n=t[1],s=e[1],i=n|s,o=i<131,a=s==c&&8==n||s==c&&n==l&&t[7].length<=e[8]||384==s&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&s&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var h=t[3];t[3]=h?Oi(h,u,e[4]):u,t[4]=h?cn(t[3],r):e[4]}(u=e[5])&&(h=t[5],t[5]=h?Mi(h,u,e[6]):u,t[6]=h?cn(t[5],r):e[6]);(u=e[7])&&(t[7]=u);s&c&&(t[8]=null==t[8]?e[8]:wn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(b,w),t=b[0],e=b[1],i=b[2],h=b[3],p=b[4],!(_=b[9]=b[9]===n?m?0:t.length:yn(b[9]-g,0))&&24&e&&(e&=-25),e&&1!=e)x=8==e||e==o?function(t,e,s){var i=Fi(t);return function r(){for(var o=arguments.length,a=xt(o),u=o,c=ur(r);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==c&&a[o-1]!==c?[]:cn(a,c);return(o-=l.length)<s?Xi(t,e,zi,r.placeholder,n,a,l,n,n,s-o):ke(this&&this!==de&&this instanceof r?i:t,this,a)}}(t,e,_):e!=a&&33!=e||p.length?zi.apply(n,b):function(t,e,n,s){var i=1&e,r=Fi(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=s.length,l=xt(c+a),h=this&&this!==de&&this instanceof e?r:t;++u<c;)l[u]=s[u];for(;a--;)l[u++]=arguments[++o];return ke(h,i?n:this,l)}}(t,e,i,h);else var x=function(t,e,n){var s=1&e,i=Fi(t);return function e(){return(this&&this!==de&&this instanceof e?i:t).apply(s?n:this,arguments)}}(t,e,i);return Rr((w?ei:Er)(x,b),t,e)}function Ji(t,e,s,i){return t===n||zo(t,Rt[s])&&!Pt.call(i,s)?e:t}function tr(t,e,s,i,r,o){return ea(t)&&ea(e)&&(o.set(e,t),Ls(t,e,n,tr,o),o.delete(e)),t}function er(t){return ra(t)?n:t}function nr(t,e,s,i,r,o){var a=1&s,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=o.get(t),h=o.get(e);if(l&&h)return l==e&&h==t;var p=-1,d=!0,f=2&s?new Zn:n;for(o.set(t,e),o.set(e,t);++p<u;){var _=t[p],m=e[p];if(i)var g=a?i(m,_,p,e,t,o):i(_,m,p,t,e,o);if(g!==n){if(g)continue;d=!1;break}if(f){if(!Ve(e,(function(t,e){if(!Je(f,e)&&(_===t||r(_,t,s,i,o)))return f.push(e)}))){d=!1;break}}else if(_!==m&&!r(_,m,s,i,o)){d=!1;break}}return o.delete(t),o.delete(e),d}function sr(t){return Ir(Sr(t,n,Hr),t+"")}function ir(t){return ks(t,Ia,dr)}function rr(t){return ks(t,Ra,fr)}var or=Dn?function(t){return Dn.get(t)}:cu;function ar(t){for(var e=t.name+"",n=In[e],s=Pt.call(In,e)?n.length:0;s--;){var i=n[s],r=i.func;if(null==r||r==t)return i.name}return e}function ur(t){return(Pt.call(zn,"placeholder")?zn:t).placeholder}function cr(){var t=zn.iteratee||ru;return t=t===ru?Ps:t,arguments.length?t(arguments[0],arguments[1]):t}function lr(t,e){var n,s,i=t.__data__;return("string"==(s=typeof(n=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function hr(t){for(var e=Ia(t),n=e.length;n--;){var s=e[n],i=t[s];e[n]=[s,i,kr(i)]}return e}function pr(t,e){var s=function(t,e){return null==t?n:t[e]}(t,e);return Bs(s)?s:n}var dr=ve?function(t){return null==t?[]:(t=St(t),Ee(ve(t),(function(e){return Zt.call(t,e)})))}:mu,fr=ve?function(t){for(var e=[];t;)Ne(e,dr(t)),t=Gt(t);return e}:mu,_r=Cs;function mr(t,e,n){for(var s=-1,i=(e=wi(e,t)).length,r=!1;++s<i;){var o=Vr(e[s]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++s!=i?r:!!(i=null==t?0:t.length)&&ta(i)&&yr(o,i)&&(Ho(t)||Uo(t))}function gr(t){return"function"!=typeof t.constructor||Ar(t)?{}:Wn(Gt(t))}function vr(t){return Ho(t)||Uo(t)||!!(Qt&&t&&t[Qt])}function yr(t,e){var n=typeof t;return!!(e=null==e?p:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function wr(t,e,n){if(!ea(n))return!1;var s=typeof e;return!!("number"==s?Go(n)&&yr(e,n.length):"string"==s&&e in n)&&zo(n[e],t)}function br(t,e){if(Ho(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(tt.test(t)||!J.test(t)||null!=e&&t in St(e))}function xr(t){var e=ar(t),n=zn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var s=or(n);return!!s&&t===s[0]}(kn&&_r(new kn(new ArrayBuffer(1)))!=R||Cn&&_r(new Cn)!=T||Sn&&_r(Sn.resolve())!=C||On&&_r(new On)!=O||Mn&&_r(new Mn)!=D)&&(_r=function(t){var e=Cs(t),s=e==k?t.constructor:n,i=s?Fr(s):"";if(i)switch(i){case Rn:return R;case Nn:return T;case Bn:return C;case Pn:return O;case Vn:return D}return e});var Tr=Nt?Ko:gu;function Ar(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function kr(t){return t==t&&!ea(t)}function Cr(t,e){return function(s){return null!=s&&(s[t]===e&&(e!==n||t in St(s)))}}function Sr(t,e,s){return e=yn(e===n?t.length-1:e,0),function(){for(var n=arguments,i=-1,r=yn(n.length-e,0),o=xt(r);++i<r;)o[i]=n[e+i];i=-1;for(var a=xt(e+1);++i<e;)a[i]=n[i];return a[e]=s(o),ke(t,this,a)}}function Or(t,e){return e.length<2?t:As(t,ii(e,0,-1))}function Mr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Er=Nr(ei),Dr=fe||function(t,e){return de.setTimeout(t,e)},Ir=Nr(ni);function Rr(t,e,n){var s=e+"";return Ir(t,function(t,e){var n=e.length;if(!n)return t;var s=n-1;return e[s]=(n>1?"& ":"")+e[s],e=e.join(n>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(s,function(t,e){return Se(_,(function(n){var s="_."+n[0];e&n[1]&&!De(t,s)&&t.push(s)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(ut):[]}(s),n)))}function Nr(t){var e=0,s=0;return function(){var i=bn(),r=16-(i-s);if(s=i,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(n,arguments)}}function Br(t,e){var s=-1,i=t.length,r=i-1;for(e=e===n?i:e;++s<e;){var o=Zs(s,r),a=t[o];t[o]=t[s],t[s]=a}return t.length=e,t}var Pr=function(t){var e=Bo(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,(function(t,n,s,i){e.push(s?i.replace(ht,"$1"):n||t)})),e}));function Vr(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Fr(t){if(null!=t){try{return Bt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function qr(t){if(t instanceof Hn)return t.clone();var e=new Un(t.__wrapped__,t.__chain__);return e.__actions__=Ei(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var jr=Qs((function(t,e){return Xo(t)?ps(t,vs(e,1,Xo,!0)):[]})),zr=Qs((function(t,e){var s=Yr(e);return Xo(s)&&(s=n),Xo(t)?ps(t,vs(e,1,Xo,!0),cr(s,2)):[]})),Wr=Qs((function(t,e){var s=Yr(e);return Xo(s)&&(s=n),Xo(t)?ps(t,vs(e,1,Xo,!0),n,s):[]}));function Lr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),je(t,cr(e,3),i)}function Ur(t,e,s){var i=null==t?0:t.length;if(!i)return-1;var r=i-1;return s!==n&&(r=_a(s),r=s<0?yn(i+r,0):wn(r,i-1)),je(t,cr(e,3),r,!0)}function Hr(t){return(null==t?0:t.length)?vs(t,1):[]}function $r(t){return t&&t.length?t[0]:n}var Gr=Qs((function(t){var e=Re(t,vi);return e.length&&e[0]===t[0]?Es(e):[]})),Xr=Qs((function(t){var e=Yr(t),s=Re(t,vi);return e===Yr(s)?e=n:s.pop(),s.length&&s[0]===t[0]?Es(s,cr(e,2)):[]})),Zr=Qs((function(t){var e=Yr(t),s=Re(t,vi);return(e="function"==typeof e?e:n)&&s.pop(),s.length&&s[0]===t[0]?Es(s,n,e):[]}));function Yr(t){var e=null==t?0:t.length;return e?t[e-1]:n}var Qr=Qs(Kr);function Kr(t,e){return t&&t.length&&e&&e.length?Gs(t,e):t}var Jr=sr((function(t,e){var n=null==t?0:t.length,s=as(t,e);return Xs(t,Re(e,(function(t){return yr(t,n)?+t:t})).sort(Si)),s}));function to(t){return null==t?t:An.call(t)}var eo=Qs((function(t){return hi(vs(t,1,Xo,!0))})),no=Qs((function(t){var e=Yr(t);return Xo(e)&&(e=n),hi(vs(t,1,Xo,!0),cr(e,2))})),so=Qs((function(t){var e=Yr(t);return e="function"==typeof e?e:n,hi(vs(t,1,Xo,!0),n,e)}));function io(t){if(!t||!t.length)return[];var e=0;return t=Ee(t,(function(t){if(Xo(t))return e=yn(t.length,e),!0})),Ze(e,(function(e){return Re(t,He(e))}))}function ro(t,e){if(!t||!t.length)return[];var s=io(t);return null==e?s:Re(s,(function(t){return ke(e,n,t)}))}var oo=Qs((function(t,e){return Xo(t)?ps(t,e):[]})),ao=Qs((function(t){return mi(Ee(t,Xo))})),uo=Qs((function(t){var e=Yr(t);return Xo(e)&&(e=n),mi(Ee(t,Xo),cr(e,2))})),co=Qs((function(t){var e=Yr(t);return e="function"==typeof e?e:n,mi(Ee(t,Xo),n,e)})),lo=Qs(io);var ho=Qs((function(t){var e=t.length,s=e>1?t[e-1]:n;return s="function"==typeof s?(t.pop(),s):n,ro(t,s)}));function po(t){var e=zn(t);return e.__chain__=!0,e}function fo(t,e){return e(t)}var _o=sr((function(t){var e=t.length,s=e?t[0]:0,i=this.__wrapped__,r=function(e){return as(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Hn&&yr(s)?((i=i.slice(s,+s+(e?1:0))).__actions__.push({func:fo,args:[r],thisArg:n}),new Un(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(n),t}))):this.thru(r)}));var mo=Ii((function(t,e,n){Pt.call(t,n)?++t[n]:os(t,n,1)}));var go=qi(Lr),vo=qi(Ur);function yo(t,e){return(Ho(t)?Se:ds)(t,cr(e,3))}function wo(t,e){return(Ho(t)?Oe:fs)(t,cr(e,3))}var bo=Ii((function(t,e,n){Pt.call(t,n)?t[n].push(e):os(t,n,[e])}));var xo=Qs((function(t,e,n){var s=-1,i="function"==typeof e,r=Go(t)?xt(t.length):[];return ds(t,(function(t){r[++s]=i?ke(e,t,n):Ds(t,e,n)})),r})),To=Ii((function(t,e,n){os(t,n,e)}));function Ao(t,e){return(Ho(t)?Re:js)(t,cr(e,3))}var ko=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Co=Qs((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wr(t,e[0],e[1])?e=[]:n>2&&wr(e[0],e[1],e[2])&&(e=[e[0]]),Hs(t,vs(e,1),[])})),So=pe||function(){return de.Date.now()};function Oo(t,e,s){return e=s?n:e,e=t&&null==e?t.length:e,Ki(t,c,n,n,n,n,e)}function Mo(t,e){var i;if("function"!=typeof e)throw new Et(s);return t=_a(t),function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=n),i}}var Eo=Qs((function(t,e,n){var s=1;if(n.length){var i=cn(n,ur(Eo));s|=a}return Ki(t,s,e,n,i)})),Do=Qs((function(t,e,n){var s=3;if(n.length){var i=cn(n,ur(Do));s|=a}return Ki(e,s,t,n,i)}));function Io(t,e,i){var r,o,a,u,c,l,h=0,p=!1,d=!1,f=!0;if("function"!=typeof t)throw new Et(s);function _(e){var s=r,i=o;return r=o=n,h=e,u=t.apply(i,s)}function m(t){var s=t-l;return l===n||s>=e||s<0||d&&t-h>=a}function g(){var t=So();if(m(t))return v(t);c=Dr(g,function(t){var n=e-(t-l);return d?wn(n,a-(t-h)):n}(t))}function v(t){return c=n,f&&r?_(t):(r=o=n,u)}function y(){var t=So(),s=m(t);if(r=arguments,o=this,l=t,s){if(c===n)return function(t){return h=t,c=Dr(g,e),p?_(t):u}(l);if(d)return Ti(c),c=Dr(g,e),_(l)}return c===n&&(c=Dr(g,e)),u}return e=ga(e)||0,ea(i)&&(p=!!i.leading,a=(d="maxWait"in i)?yn(ga(i.maxWait)||0,e):a,f="trailing"in i?!!i.trailing:f),y.cancel=function(){c!==n&&Ti(c),h=0,r=l=o=c=n},y.flush=function(){return c===n?u:v(So())},y}var Ro=Qs((function(t,e){return hs(t,1,e)})),No=Qs((function(t,e,n){return hs(t,ga(e)||0,n)}));function Bo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Et(s);var n=function(){var s=arguments,i=e?e.apply(this,s):s[0],r=n.cache;if(r.has(i))return r.get(i);var o=t.apply(this,s);return n.cache=r.set(i,o)||r,o};return n.cache=new(Bo.Cache||Xn),n}function Po(t){if("function"!=typeof t)throw new Et(s);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bo.Cache=Xn;var Vo=bi((function(t,e){var n=(e=1==e.length&&Ho(e[0])?Re(e[0],Qe(cr())):Re(vs(e,1),Qe(cr()))).length;return Qs((function(s){for(var i=-1,r=wn(s.length,n);++i<r;)s[i]=e[i].call(this,s[i]);return ke(t,this,s)}))})),Fo=Qs((function(t,e){var s=cn(e,ur(Fo));return Ki(t,a,n,e,s)})),qo=Qs((function(t,e){var s=cn(e,ur(qo));return Ki(t,u,n,e,s)})),jo=sr((function(t,e){return Ki(t,l,n,n,n,e)}));function zo(t,e){return t===e||t!=t&&e!=e}var Wo=Gi(Ss),Lo=Gi((function(t,e){return t>=e})),Uo=Is(function(){return arguments}())?Is:function(t){return na(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Ho=xt.isArray,$o=ye?Qe(ye):function(t){return na(t)&&Cs(t)==I};function Go(t){return null!=t&&ta(t.length)&&!Ko(t)}function Xo(t){return na(t)&&Go(t)}var Zo=Fe||gu,Yo=we?Qe(we):function(t){return na(t)&&Cs(t)==y};function Qo(t){if(!na(t))return!1;var e=Cs(t);return e==w||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Ko(t){if(!ea(t))return!1;var e=Cs(t);return e==b||e==x||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Jo(t){return"number"==typeof t&&t==_a(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=p}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var sa=be?Qe(be):function(t){return na(t)&&_r(t)==T};function ia(t){return"number"==typeof t||na(t)&&Cs(t)==A}function ra(t){if(!na(t)||Cs(t)!=k)return!1;var e=Gt(t);if(null===e)return!0;var n=Pt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==jt}var oa=xe?Qe(xe):function(t){return na(t)&&Cs(t)==S};var aa=Te?Qe(Te):function(t){return na(t)&&_r(t)==O};function ua(t){return"string"==typeof t||!Ho(t)&&na(t)&&Cs(t)==M}function ca(t){return"symbol"==typeof t||na(t)&&Cs(t)==E}var la=Ae?Qe(Ae):function(t){return na(t)&&ta(t.length)&&!!oe[Cs(t)]};var ha=Gi(qs),pa=Gi((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Go(t))return ua(t)?dn(t):Ei(t);if(te&&t[te])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[te]());var e=_r(t);return(e==T?an:e==O?ln:za)(t)}function fa(t){return t?(t=ga(t))===h||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function _a(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ma(t){return t?us(_a(t),0,f):0}function ga(t){if("number"==typeof t)return t;if(ca(t))return d;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ye(t);var n=_t.test(t);return n||gt.test(t)?le(t.slice(2),n?2:8):ft.test(t)?d:+t}function va(t){return Di(t,Ra(t))}function ya(t){return null==t?"":li(t)}var wa=Ri((function(t,e){if(Ar(e)||Go(e))Di(e,Ia(e),t);else for(var n in e)Pt.call(e,n)&&ns(t,n,e[n])})),ba=Ri((function(t,e){Di(e,Ra(e),t)})),xa=Ri((function(t,e,n,s){Di(e,Ra(e),t,s)})),Ta=Ri((function(t,e,n,s){Di(e,Ia(e),t,s)})),Aa=sr(as);var ka=Qs((function(t,e){t=St(t);var s=-1,i=e.length,r=i>2?e[2]:n;for(r&&wr(e[0],e[1],r)&&(i=1);++s<i;)for(var o=e[s],a=Ra(o),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===n||zo(h,Rt[l])&&!Pt.call(t,l))&&(t[l]=o[l])}return t})),Ca=Qs((function(t){return t.push(n,tr),ke(Ba,n,t)}));function Sa(t,e,s){var i=null==t?n:As(t,e);return i===n?s:i}function Oa(t,e){return null!=t&&mr(t,e,Ms)}var Ma=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=qt.call(e)),t[e]=n}),eu(iu)),Ea=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=qt.call(e)),Pt.call(t,e)?t[e].push(n):t[e]=[n]}),cr),Da=Qs(Ds);function Ia(t){return Go(t)?Qn(t):Vs(t)}function Ra(t){return Go(t)?Qn(t,!0):Fs(t)}var Na=Ri((function(t,e,n){Ls(t,e,n)})),Ba=Ri((function(t,e,n,s){Ls(t,e,n,s)})),Pa=sr((function(t,e){var n={};if(null==t)return n;var s=!1;e=Re(e,(function(e){return e=wi(e,t),s||(s=e.length>1),e})),Di(t,rr(t),n),s&&(n=cs(n,7,er));for(var i=e.length;i--;)pi(n,e[i]);return n}));var Va=sr((function(t,e){return null==t?{}:function(t,e){return $s(t,e,(function(e,n){return Oa(t,n)}))}(t,e)}));function Fa(t,e){if(null==t)return{};var n=Re(rr(t),(function(t){return[t]}));return e=cr(e),$s(t,n,(function(t,n){return e(t,n[0])}))}var qa=Qi(Ia),ja=Qi(Ra);function za(t){return null==t?[]:Ke(t,Ia(t))}var Wa=Vi((function(t,e,n){return e=e.toLowerCase(),t+(n?La(e):e)}));function La(t){return Qa(ya(t).toLowerCase())}function Ua(t){return(t=ya(t))&&t.replace(yt,nn).replace(Jt,"")}var Ha=Vi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Vi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ga=Pi("toLowerCase");var Xa=Vi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Za=Vi((function(t,e,n){return t+(n?" ":"")+Qa(e)}));var Ya=Vi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Qa=Pi("toUpperCase");function Ka(t,e,s){return t=ya(t),(e=s?n:e)===n?function(t){return se.test(t)}(t)?function(t){return t.match(ee)||[]}(t):function(t){return t.match(ct)||[]}(t):t.match(e)||[]}var Ja=Qs((function(t,e){try{return ke(t,n,e)}catch(t){return Qo(t)?t:new At(t)}})),tu=sr((function(t,e){return Se(e,(function(e){e=Vr(e),os(t,e,Eo(t[e],t))})),t}));function eu(t){return function(){return t}}var nu=ji(),su=ji(!0);function iu(t){return t}function ru(t){return Ps("function"==typeof t?t:cs(t,1))}var ou=Qs((function(t,e){return function(n){return Ds(n,t,e)}})),au=Qs((function(t,e){return function(n){return Ds(t,n,e)}}));function uu(t,e,n){var s=Ia(e),i=Ts(e,s);null!=n||ea(e)&&(i.length||!s.length)||(n=e,e=t,t=this,i=Ts(e,Ia(e)));var r=!(ea(n)&&"chain"in n&&!n.chain),o=Ko(t);return Se(i,(function(n){var s=e[n];t[n]=s,o&&(t.prototype[n]=function(){var e=this.__chain__;if(r||e){var n=t(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:s,args:arguments,thisArg:t}),n.__chain__=e,n}return s.apply(t,Ne([this.value()],arguments))})})),t}function cu(){}var lu=Ui(Re),hu=Ui(Me),pu=Ui(Ve);function du(t){return br(t)?He(Vr(t)):function(t){return function(e){return As(e,t)}}(t)}var fu=$i(),_u=$i(!0);function mu(){return[]}function gu(){return!1}var vu=Li((function(t,e){return t+e}),0),yu=Zi("ceil"),wu=Li((function(t,e){return t/e}),1),bu=Zi("floor");var xu,Tu=Li((function(t,e){return t*e}),1),Au=Zi("round"),ku=Li((function(t,e){return t-e}),0);return zn.after=function(t,e){if("function"!=typeof e)throw new Et(s);return t=_a(t),function(){if(--t<1)return e.apply(this,arguments)}},zn.ary=Oo,zn.assign=wa,zn.assignIn=ba,zn.assignInWith=xa,zn.assignWith=Ta,zn.at=Aa,zn.before=Mo,zn.bind=Eo,zn.bindAll=tu,zn.bindKey=Do,zn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ho(t)?t:[t]},zn.chain=po,zn.chunk=function(t,e,s){e=(s?wr(t,e,s):e===n)?1:yn(_a(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var r=0,o=0,a=xt(_e(i/e));r<i;)a[o++]=ii(t,r,r+=e);return a},zn.compact=function(t){for(var e=-1,n=null==t?0:t.length,s=0,i=[];++e<n;){var r=t[e];r&&(i[s++]=r)}return i},zn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=xt(t-1),n=arguments[0],s=t;s--;)e[s-1]=arguments[s];return Ne(Ho(n)?Ei(n):[n],vs(e,1))},zn.cond=function(t){var e=null==t?0:t.length,n=cr();return t=e?Re(t,(function(t){if("function"!=typeof t[1])throw new Et(s);return[n(t[0]),t[1]]})):[],Qs((function(n){for(var s=-1;++s<e;){var i=t[s];if(ke(i[0],this,n))return ke(i[1],this,n)}}))},zn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ls(n,t,e)}}(cs(t,1))},zn.constant=eu,zn.countBy=mo,zn.create=function(t,e){var n=Wn(t);return null==e?n:rs(n,e)},zn.curry=function t(e,s,i){var r=Ki(e,8,n,n,n,n,n,s=i?n:s);return r.placeholder=t.placeholder,r},zn.curryRight=function t(e,s,i){var r=Ki(e,o,n,n,n,n,n,s=i?n:s);return r.placeholder=t.placeholder,r},zn.debounce=Io,zn.defaults=ka,zn.defaultsDeep=Ca,zn.defer=Ro,zn.delay=No,zn.difference=jr,zn.differenceBy=zr,zn.differenceWith=Wr,zn.drop=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,(e=s||e===n?1:_a(e))<0?0:e,i):[]},zn.dropRight=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,0,(e=i-(e=s||e===n?1:_a(e)))<0?0:e):[]},zn.dropRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0,!0):[]},zn.dropWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0):[]},zn.fill=function(t,e,s,i){var r=null==t?0:t.length;return r?(s&&"number"!=typeof s&&wr(t,e,s)&&(s=0,i=r),function(t,e,s,i){var r=t.length;for((s=_a(s))<0&&(s=-s>r?0:r+s),(i=i===n||i>r?r:_a(i))<0&&(i+=r),i=s>i?0:ma(i);s<i;)t[s++]=e;return t}(t,e,s,i)):[]},zn.filter=function(t,e){return(Ho(t)?Ee:gs)(t,cr(e,3))},zn.flatMap=function(t,e){return vs(Ao(t,e),1)},zn.flatMapDeep=function(t,e){return vs(Ao(t,e),h)},zn.flatMapDepth=function(t,e,s){return s=s===n?1:_a(s),vs(Ao(t,e),s)},zn.flatten=Hr,zn.flattenDeep=function(t){return(null==t?0:t.length)?vs(t,h):[]},zn.flattenDepth=function(t,e){return(null==t?0:t.length)?vs(t,e=e===n?1:_a(e)):[]},zn.flip=function(t){return Ki(t,512)},zn.flow=nu,zn.flowRight=su,zn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,s={};++e<n;){var i=t[e];s[i[0]]=i[1]}return s},zn.functions=function(t){return null==t?[]:Ts(t,Ia(t))},zn.functionsIn=function(t){return null==t?[]:Ts(t,Ra(t))},zn.groupBy=bo,zn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},zn.intersection=Gr,zn.intersectionBy=Xr,zn.intersectionWith=Zr,zn.invert=Ma,zn.invertBy=Ea,zn.invokeMap=xo,zn.iteratee=ru,zn.keyBy=To,zn.keys=Ia,zn.keysIn=Ra,zn.map=Ao,zn.mapKeys=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,e(t,s,i),t)})),n},zn.mapValues=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,s,e(t,s,i))})),n},zn.matches=function(t){return zs(cs(t,1))},zn.matchesProperty=function(t,e){return Ws(t,cs(e,1))},zn.memoize=Bo,zn.merge=Na,zn.mergeWith=Ba,zn.method=ou,zn.methodOf=au,zn.mixin=uu,zn.negate=Po,zn.nthArg=function(t){return t=_a(t),Qs((function(e){return Us(e,t)}))},zn.omit=Pa,zn.omitBy=function(t,e){return Fa(t,Po(cr(e)))},zn.once=function(t){return Mo(2,t)},zn.orderBy=function(t,e,s,i){return null==t?[]:(Ho(e)||(e=null==e?[]:[e]),Ho(s=i?n:s)||(s=null==s?[]:[s]),Hs(t,e,s))},zn.over=lu,zn.overArgs=Vo,zn.overEvery=hu,zn.overSome=pu,zn.partial=Fo,zn.partialRight=qo,zn.partition=ko,zn.pick=Va,zn.pickBy=Fa,zn.property=du,zn.propertyOf=function(t){return function(e){return null==t?n:As(t,e)}},zn.pull=Qr,zn.pullAll=Kr,zn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Gs(t,e,cr(n,2)):t},zn.pullAllWith=function(t,e,s){return t&&t.length&&e&&e.length?Gs(t,e,n,s):t},zn.pullAt=Jr,zn.range=fu,zn.rangeRight=_u,zn.rearg=jo,zn.reject=function(t,e){return(Ho(t)?Ee:gs)(t,Po(cr(e,3)))},zn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var s=-1,i=[],r=t.length;for(e=cr(e,3);++s<r;){var o=t[s];e(o,s,t)&&(n.push(o),i.push(s))}return Xs(t,i),n},zn.rest=function(t,e){if("function"!=typeof t)throw new Et(s);return Qs(t,e=e===n?e:_a(e))},zn.reverse=to,zn.sampleSize=function(t,e,s){return e=(s?wr(t,e,s):e===n)?1:_a(e),(Ho(t)?Jn:Js)(t,e)},zn.set=function(t,e,n){return null==t?t:ti(t,e,n)},zn.setWith=function(t,e,s,i){return i="function"==typeof i?i:n,null==t?t:ti(t,e,s,i)},zn.shuffle=function(t){return(Ho(t)?ts:si)(t)},zn.slice=function(t,e,s){var i=null==t?0:t.length;return i?(s&&"number"!=typeof s&&wr(t,e,s)?(e=0,s=i):(e=null==e?0:_a(e),s=s===n?i:_a(s)),ii(t,e,s)):[]},zn.sortBy=Co,zn.sortedUniq=function(t){return t&&t.length?ui(t):[]},zn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cr(e,2)):[]},zn.split=function(t,e,s){return s&&"number"!=typeof s&&wr(t,e,s)&&(e=s=n),(s=s===n?f:s>>>0)?(t=ya(t))&&("string"==typeof e||null!=e&&!oa(e))&&!(e=li(e))&&on(t)?xi(dn(t),0,s):t.split(e,s):[]},zn.spread=function(t,e){if("function"!=typeof t)throw new Et(s);return e=null==e?0:yn(_a(e),0),Qs((function(n){var s=n[e],i=xi(n,0,e);return s&&Ne(i,s),ke(t,this,i)}))},zn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},zn.take=function(t,e,s){return t&&t.length?ii(t,0,(e=s||e===n?1:_a(e))<0?0:e):[]},zn.takeRight=function(t,e,s){var i=null==t?0:t.length;return i?ii(t,(e=i-(e=s||e===n?1:_a(e)))<0?0:e,i):[]},zn.takeRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!1,!0):[]},zn.takeWhile=function(t,e){return t&&t.length?fi(t,cr(e,3)):[]},zn.tap=function(t,e){return e(t),t},zn.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new Et(s);return ea(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Io(t,e,{leading:i,maxWait:e,trailing:r})},zn.thru=fo,zn.toArray=da,zn.toPairs=qa,zn.toPairsIn=ja,zn.toPath=function(t){return Ho(t)?Re(t,Vr):ca(t)?[t]:Ei(Pr(ya(t)))},zn.toPlainObject=va,zn.transform=function(t,e,n){var s=Ho(t),i=s||Zo(t)||la(t);if(e=cr(e,4),null==n){var r=t&&t.constructor;n=i?s?new r:[]:ea(t)&&Ko(r)?Wn(Gt(t)):{}}return(i?Se:bs)(t,(function(t,s,i){return e(n,t,s,i)})),n},zn.unary=function(t){return Oo(t,1)},zn.union=eo,zn.unionBy=no,zn.unionWith=so,zn.uniq=function(t){return t&&t.length?hi(t):[]},zn.uniqBy=function(t,e){return t&&t.length?hi(t,cr(e,2)):[]},zn.uniqWith=function(t,e){return e="function"==typeof e?e:n,t&&t.length?hi(t,n,e):[]},zn.unset=function(t,e){return null==t||pi(t,e)},zn.unzip=io,zn.unzipWith=ro,zn.update=function(t,e,n){return null==t?t:di(t,e,yi(n))},zn.updateWith=function(t,e,s,i){return i="function"==typeof i?i:n,null==t?t:di(t,e,yi(s),i)},zn.values=za,zn.valuesIn=function(t){return null==t?[]:Ke(t,Ra(t))},zn.without=oo,zn.words=Ka,zn.wrap=function(t,e){return Fo(yi(e),t)},zn.xor=ao,zn.xorBy=uo,zn.xorWith=co,zn.zip=lo,zn.zipObject=function(t,e){return gi(t||[],e||[],ns)},zn.zipObjectDeep=function(t,e){return gi(t||[],e||[],ti)},zn.zipWith=ho,zn.entries=qa,zn.entriesIn=ja,zn.extend=ba,zn.extendWith=xa,uu(zn,zn),zn.add=vu,zn.attempt=Ja,zn.camelCase=Wa,zn.capitalize=La,zn.ceil=yu,zn.clamp=function(t,e,s){return s===n&&(s=e,e=n),s!==n&&(s=(s=ga(s))==s?s:0),e!==n&&(e=(e=ga(e))==e?e:0),us(ga(t),e,s)},zn.clone=function(t){return cs(t,4)},zn.cloneDeep=function(t){return cs(t,5)},zn.cloneDeepWith=function(t,e){return cs(t,5,e="function"==typeof e?e:n)},zn.cloneWith=function(t,e){return cs(t,4,e="function"==typeof e?e:n)},zn.conformsTo=function(t,e){return null==e||ls(t,e,Ia(e))},zn.deburr=Ua,zn.defaultTo=function(t,e){return null==t||t!=t?e:t},zn.divide=wu,zn.endsWith=function(t,e,s){t=ya(t),e=li(e);var i=t.length,r=s=s===n?i:us(_a(s),0,i);return(s-=e.length)>=0&&t.slice(s,r)==e},zn.eq=zo,zn.escape=function(t){return(t=ya(t))&&Z.test(t)?t.replace(G,sn):t},zn.escapeRegExp=function(t){return(t=ya(t))&&st.test(t)?t.replace(nt,"\\$&"):t},zn.every=function(t,e,s){var i=Ho(t)?Me:_s;return s&&wr(t,e,s)&&(e=n),i(t,cr(e,3))},zn.find=go,zn.findIndex=Lr,zn.findKey=function(t,e){return qe(t,cr(e,3),bs)},zn.findLast=vo,zn.findLastIndex=Ur,zn.findLastKey=function(t,e){return qe(t,cr(e,3),xs)},zn.floor=bu,zn.forEach=yo,zn.forEachRight=wo,zn.forIn=function(t,e){return null==t?t:ys(t,cr(e,3),Ra)},zn.forInRight=function(t,e){return null==t?t:ws(t,cr(e,3),Ra)},zn.forOwn=function(t,e){return t&&bs(t,cr(e,3))},zn.forOwnRight=function(t,e){return t&&xs(t,cr(e,3))},zn.get=Sa,zn.gt=Wo,zn.gte=Lo,zn.has=function(t,e){return null!=t&&mr(t,e,Os)},zn.hasIn=Oa,zn.head=$r,zn.identity=iu,zn.includes=function(t,e,n,s){t=Go(t)?t:za(t),n=n&&!s?_a(n):0;var i=t.length;return n<0&&(n=yn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&ze(t,e,n)>-1},zn.indexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),ze(t,e,i)},zn.inRange=function(t,e,s){return e=fa(e),s===n?(s=e,e=0):s=fa(s),function(t,e,n){return t>=wn(e,n)&&t<yn(e,n)}(t=ga(t),e,s)},zn.invoke=Da,zn.isArguments=Uo,zn.isArray=Ho,zn.isArrayBuffer=$o,zn.isArrayLike=Go,zn.isArrayLikeObject=Xo,zn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Cs(t)==v},zn.isBuffer=Zo,zn.isDate=Yo,zn.isElement=function(t){return na(t)&&1===t.nodeType&&!ra(t)},zn.isEmpty=function(t){if(null==t)return!0;if(Go(t)&&(Ho(t)||"string"==typeof t||"function"==typeof t.splice||Zo(t)||la(t)||Uo(t)))return!t.length;var e=_r(t);if(e==T||e==O)return!t.size;if(Ar(t))return!Vs(t).length;for(var n in t)if(Pt.call(t,n))return!1;return!0},zn.isEqual=function(t,e){return Rs(t,e)},zn.isEqualWith=function(t,e,s){var i=(s="function"==typeof s?s:n)?s(t,e):n;return i===n?Rs(t,e,n,s):!!i},zn.isError=Qo,zn.isFinite=function(t){return"number"==typeof t&&$e(t)},zn.isFunction=Ko,zn.isInteger=Jo,zn.isLength=ta,zn.isMap=sa,zn.isMatch=function(t,e){return t===e||Ns(t,e,hr(e))},zn.isMatchWith=function(t,e,s){return s="function"==typeof s?s:n,Ns(t,e,hr(e),s)},zn.isNaN=function(t){return ia(t)&&t!=+t},zn.isNative=function(t){if(Tr(t))throw new At("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bs(t)},zn.isNil=function(t){return null==t},zn.isNull=function(t){return null===t},zn.isNumber=ia,zn.isObject=ea,zn.isObjectLike=na,zn.isPlainObject=ra,zn.isRegExp=oa,zn.isSafeInteger=function(t){return Jo(t)&&t>=-9007199254740991&&t<=p},zn.isSet=aa,zn.isString=ua,zn.isSymbol=ca,zn.isTypedArray=la,zn.isUndefined=function(t){return t===n},zn.isWeakMap=function(t){return na(t)&&_r(t)==D},zn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Cs(t)},zn.join=function(t,e){return null==t?"":gn.call(t,e)},zn.kebabCase=Ha,zn.last=Yr,zn.lastIndexOf=function(t,e,s){var i=null==t?0:t.length;if(!i)return-1;var r=i;return s!==n&&(r=(r=_a(s))<0?yn(i+r,0):wn(r,i-1)),e==e?function(t,e,n){for(var s=n+1;s--;)if(t[s]===e)return s;return s}(t,e,r):je(t,Le,r,!0)},zn.lowerCase=$a,zn.lowerFirst=Ga,zn.lt=ha,zn.lte=pa,zn.max=function(t){return t&&t.length?ms(t,iu,Ss):n},zn.maxBy=function(t,e){return t&&t.length?ms(t,cr(e,2),Ss):n},zn.mean=function(t){return Ue(t,iu)},zn.meanBy=function(t,e){return Ue(t,cr(e,2))},zn.min=function(t){return t&&t.length?ms(t,iu,qs):n},zn.minBy=function(t,e){return t&&t.length?ms(t,cr(e,2),qs):n},zn.stubArray=mu,zn.stubFalse=gu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Tu,zn.nth=function(t,e){return t&&t.length?Us(t,_a(e)):n},zn.noConflict=function(){return de._===this&&(de._=zt),this},zn.noop=cu,zn.now=So,zn.pad=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;if(!e||s>=e)return t;var i=(e-s)/2;return Hi(ge(i),n)+t+Hi(_e(i),n)},zn.padEnd=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;return e&&s<e?t+Hi(e-s,n):t},zn.padStart=function(t,e,n){t=ya(t);var s=(e=_a(e))?pn(t):0;return e&&s<e?Hi(e-s,n)+t:t},zn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(ya(t).replace(it,""),e||0)},zn.random=function(t,e,s){if(s&&"boolean"!=typeof s&&wr(t,e,s)&&(e=s=n),s===n&&("boolean"==typeof e?(s=e,e=n):"boolean"==typeof t&&(s=t,t=n)),t===n&&e===n?(t=0,e=1):(t=fa(t),e===n?(e=t,t=0):e=fa(e)),t>e){var i=t;t=e,e=i}if(s||t%1||e%1){var r=Tn();return wn(t+r*(e-t+ce("1e-"+((r+"").length-1))),e)}return Zs(t,e)},zn.reduce=function(t,e,n){var s=Ho(t)?Be:Ge,i=arguments.length<3;return s(t,cr(e,4),n,i,ds)},zn.reduceRight=function(t,e,n){var s=Ho(t)?Pe:Ge,i=arguments.length<3;return s(t,cr(e,4),n,i,fs)},zn.repeat=function(t,e,s){return e=(s?wr(t,e,s):e===n)?1:_a(e),Ys(ya(t),e)},zn.replace=function(){var t=arguments,e=ya(t[0]);return t.length<3?e:e.replace(t[1],t[2])},zn.result=function(t,e,s){var i=-1,r=(e=wi(e,t)).length;for(r||(r=1,t=n);++i<r;){var o=null==t?n:t[Vr(e[i])];o===n&&(i=r,o=s),t=Ko(o)?o.call(t):o}return t},zn.round=Au,zn.runInContext=t,zn.sample=function(t){return(Ho(t)?Kn:Ks)(t)},zn.size=function(t){if(null==t)return 0;if(Go(t))return ua(t)?pn(t):t.length;var e=_r(t);return e==T||e==O?t.size:Vs(t).length},zn.snakeCase=Xa,zn.some=function(t,e,s){var i=Ho(t)?Ve:ri;return s&&wr(t,e,s)&&(e=n),i(t,cr(e,3))},zn.sortedIndex=function(t,e){return oi(t,e)},zn.sortedIndexBy=function(t,e,n){return ai(t,e,cr(n,2))},zn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var s=oi(t,e);if(s<n&&zo(t[s],e))return s}return-1},zn.sortedLastIndex=function(t,e){return oi(t,e,!0)},zn.sortedLastIndexBy=function(t,e,n){return ai(t,e,cr(n,2),!0)},zn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=oi(t,e,!0)-1;if(zo(t[n],e))return n}return-1},zn.startCase=Za,zn.startsWith=function(t,e,n){return t=ya(t),n=null==n?0:us(_a(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},zn.subtract=ku,zn.sum=function(t){return t&&t.length?Xe(t,iu):0},zn.sumBy=function(t,e){return t&&t.length?Xe(t,cr(e,2)):0},zn.template=function(t,e,s){var i=zn.templateSettings;s&&wr(t,e,s)&&(e=n),t=ya(t),e=xa({},e,i,Ji);var r,o,a=xa({},e.imports,i.imports,Ji),u=Ia(a),c=Ke(a,u),l=0,h=e.interpolate||wt,p="__p += '",d=Ot((e.escape||wt).source+"|"+h.source+"|"+(h===K?pt:wt).source+"|"+(e.evaluate||wt).source+"|$","g"),f="//# sourceURL="+(Pt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++re+"]")+"\n";t.replace(d,(function(e,n,s,i,a,u){return s||(s=i),p+=t.slice(l,u).replace(bt,rn),n&&(r=!0,p+="' +\n__e("+n+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),s&&(p+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"),l=u+e.length,e})),p+="';\n";var _=Pt.call(e,"variable")&&e.variable;if(_){if(lt.test(_))throw new At("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(L,""):p).replace(U,"$1").replace(H,"$1;"),p="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Ja((function(){return kt(u,f+"return "+p).apply(n,c)}));if(m.source=p,Qo(m))throw m;return m},zn.times=function(t,e){if((t=_a(t))<1||t>p)return[];var n=f,s=wn(t,f);e=cr(e),t-=f;for(var i=Ze(s,e);++n<t;)e(n);return i},zn.toFinite=fa,zn.toInteger=_a,zn.toLength=ma,zn.toLower=function(t){return ya(t).toLowerCase()},zn.toNumber=ga,zn.toSafeInteger=function(t){return t?us(_a(t),-9007199254740991,p):0===t?t:0},zn.toString=ya,zn.toUpper=function(t){return ya(t).toUpperCase()},zn.trim=function(t,e,s){if((t=ya(t))&&(s||e===n))return Ye(t);if(!t||!(e=li(e)))return t;var i=dn(t),r=dn(e);return xi(i,tn(i,r),en(i,r)+1).join("")},zn.trimEnd=function(t,e,s){if((t=ya(t))&&(s||e===n))return t.slice(0,fn(t)+1);if(!t||!(e=li(e)))return t;var i=dn(t);return xi(i,0,en(i,dn(e))+1).join("")},zn.trimStart=function(t,e,s){if((t=ya(t))&&(s||e===n))return t.replace(it,"");if(!t||!(e=li(e)))return t;var i=dn(t);return xi(i,tn(i,dn(e))).join("")},zn.truncate=function(t,e){var s=30,i="...";if(ea(e)){var r="separator"in e?e.separator:r;s="length"in e?_a(e.length):s,i="omission"in e?li(e.omission):i}var o=(t=ya(t)).length;if(on(t)){var a=dn(t);o=a.length}if(s>=o)return t;var u=s-pn(i);if(u<1)return i;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(r===n)return c+i;if(a&&(u+=c.length-u),oa(r)){if(t.slice(u).search(r)){var l,h=c;for(r.global||(r=Ot(r.source,ya(dt.exec(r))+"g")),r.lastIndex=0;l=r.exec(h);)var p=l.index;c=c.slice(0,p===n?u:p)}}else if(t.indexOf(li(r),u)!=u){var d=c.lastIndexOf(r);d>-1&&(c=c.slice(0,d))}return c+i},zn.unescape=function(t){return(t=ya(t))&&X.test(t)?t.replace($,_n):t},zn.uniqueId=function(t){var e=++Vt;return ya(t)+e},zn.upperCase=Ya,zn.upperFirst=Qa,zn.each=yo,zn.eachRight=wo,zn.first=$r,uu(zn,(xu={},bs(zn,(function(t,e){Pt.call(zn.prototype,e)||(xu[e]=t)})),xu),{chain:!1}),zn.VERSION="4.17.21",Se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){zn[t].placeholder=zn})),Se(["drop","take"],(function(t,e){Hn.prototype[t]=function(s){s=s===n?1:yn(_a(s),0);var i=this.__filtered__&&!e?new Hn(this):this.clone();return i.__filtered__?i.__takeCount__=wn(s,i.__takeCount__):i.__views__.push({size:wn(s,f),type:t+(i.__dir__<0?"Right":"")}),i},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Se(["filter","map","takeWhile"],(function(t,e){var n=e+1,s=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cr(t,3),type:n}),e.__filtered__=e.__filtered__||s,e}})),Se(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),Se(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(iu)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Qs((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ds(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Po(cr(t)))},Hn.prototype.slice=function(t,e){t=_a(t);var s=this;return s.__filtered__&&(t>0||e<0)?new Hn(s):(t<0?s=s.takeRight(-t):t&&(s=s.drop(t)),e!==n&&(s=(e=_a(e))<0?s.dropRight(-e):s.take(e-t)),s)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(f)},bs(Hn.prototype,(function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),r=zn[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);r&&(zn.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,u=e instanceof Hn,c=a[0],l=u||Ho(e),h=function(t){var e=r.apply(zn,Ne([t],a));return i&&p?e[0]:e};l&&s&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,_=u&&!d;if(!o&&l){e=_?e:new Hn(this);var m=t.apply(e,a);return m.__actions__.push({func:fo,args:[h],thisArg:n}),new Un(m,p)}return f&&_?t.apply(this,a):(m=this.thru(h),f?i?m.value()[0]:m.value():m)})})),Se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Dt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);zn.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(Ho(i)?i:[],t)}return this[n]((function(n){return e.apply(Ho(n)?n:[],t)}))}})),bs(Hn.prototype,(function(t,e){var n=zn[e];if(n){var s=n.name+"";Pt.call(In,s)||(In[s]=[]),In[s].push({name:e,func:n})}})),In[zi(n,2).name]=[{name:"wrapper",func:n}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Ei(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ei(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ei(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ho(t),s=e<0,i=n?t.length:0,r=function(t,e,n){var s=-1,i=n.length;for(;++s<i;){var r=n[s],o=r.size;switch(r.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=wn(e,t+o);break;case"takeRight":t=yn(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=r.start,a=r.end,u=a-o,c=s?a:o-1,l=this.__iteratees__,h=l.length,p=0,d=wn(u,this.__takeCount__);if(!n||!s&&i==u&&d==u)return _i(t,this.__actions__);var f=[];t:for(;u--&&p<d;){for(var _=-1,m=t[c+=e];++_<h;){var g=l[_],v=g.iteratee,y=g.type,w=v(m);if(2==y)m=w;else if(!w){if(1==y)continue t;break t}}f[p++]=m}return f},zn.prototype.at=_o,zn.prototype.chain=function(){return po(this)},zn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===n&&(this.__values__=da(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},zn.prototype.plant=function(t){for(var e,s=this;s instanceof Ln;){var i=qr(s);i.__index__=0,i.__values__=n,e?r.__wrapped__=i:e=i;var r=i;s=s.__wrapped__}return r.__wrapped__=t,e},zn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var e=t;return this.__actions__.length&&(e=new Hn(this)),(e=e.reverse()).__actions__.push({func:fo,args:[to],thisArg:n}),new Un(e,this.__chain__)}return this.thru(to)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return _i(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,te&&(zn.prototype[te]=function(){return this}),zn}();_e?((_e.exports=mn)._=mn,fe._=mn):de._=mn}).call(Ko)}(Ju,Ju.exports);var tc,ec=Ju.exports;!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(tc||(tc={}));const nc=.01,sc={attack:nc,decay:nc,sustain:1,release:nc};class ic extends Qu{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...sc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(tc.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(tc.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(tc.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(tc.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.activeNote&&this.activeNote!==t.fullName||(this.internalModule.triggerRelease(e),this.activeNote=void 0)};maxTime(t){return t===tc.Sustain?1:2}minTime(t){return t===tc.Sustain?0:nc}}class rc extends Ku{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...sc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class oc extends ic{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class ac extends rc{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:oc,props:{...sc,...s}})}}class uc extends ic{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class cc extends rc{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:uc,props:s})}}const lc={amount:0};class hc extends ic{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...lc,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class pc extends rc{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:hc,props:s})}}const dc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class fc extends Qu{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{...dc,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!Wc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class _c extends Ku{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:fc,props:{...dc,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const mc={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class gc extends Qu{_cutoff;_amount;constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{...mc,...s}}),this._cutoff=new $r(this.cutoff),this._cutoff.connect(this.internalModule.frequency),this._amount=new Fr,this._amount.connect(this._cutoff),this.updateAmountFactor(),this.registerBasicInputs(),this.registerOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._cutoff&&(this._cutoff.addend.value=t),this._props={...this.props,cutoff:t},this.updateAmountFactor()}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t},this.updateAmountFactor()}registerOutputs(){this.registerBasicOutputs(),this.registerAudioInput({name:"cutoff",internalModule:this._amount})}updateAmountFactor(){if(!this._amount)return;const t=this.envelopeAmount>0?this.envelopeAmount*Math.abs(2e4-this.cutoff):this.envelopeAmount*Math.abs(1-this.cutoff);this._amount.factor.value=t}}class vc extends Ku{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:gc,props:{...mc,...s}}),this.registerBasicInputs(),this.registerOutputs()}registerOutputs(){this.registerBasicOutputs(),this.registerInput({name:"cutoff"})}}class yc extends Qu{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerAudioInput({name:"input",internalModule:this.internalModule})}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class wc extends Ku{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:bc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class bc extends Qu{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new Yu,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const xc={selectedId:null};class Tc extends Qu{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Yu,{id:e,name:n,props:{...xc,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=Wc.midiDeviceManager.find(t);e?.addEventListener(this.forwardMidiEvent)}forwardMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=Wc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this.forwardMidiEvent)}}const Ac={volume:-1/0};class kc extends Qu{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...Ac,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class Cc extends Ku{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:kc,props:{...Ac,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Sc={activeNotes:[]};class Oc extends Qu{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Yu,{id:e,name:n,props:{...Sc,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=(t,e)=>{this.activeNotes=[...this.activeNotes,t.fullName],Wc._triggerPropsUpdate(this.id,this.props),this.sendMidi(Fo.fromNote(t,!0,e))};triggerRelease=(t,e)=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),Wc._triggerPropsUpdate(this.id,this.props),this.sendMidi(Fo.fromNote(t,!1,e))};serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}const Mc={wet:1};class Ec extends Qu{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Mc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}get wet(){return this._props.wet}set wet(t){this._props={...this.props,wet:t},this.internalModule.wet.value=this.wet}}const Dc={decay:1.5,preDelay:.025};class Ic extends Ec{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Dc,...s}})}get decay(){return this._props.decay}set decay(t){this._props={...this.props,decay:t},this.internalModule.decay=this.decay}get preDelay(){return this._props.preDelay}set preDelay(t){this._props={...this.props,preDelay:t},this.internalModule.preDelay=this.preDelay}}const Rc={delayTime:1,feedback:.3};class Nc extends Ec{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Rc,...s}})}get delayTime(){return this._props.delayTime}set delayTime(t){this._props={...this.props,delayTime:t},this.internalModule.delayTime.value=this.delayTime}get feedback(){return this._props.feedback}set feedback(t){this._props={...this.props,feedback:t},this.internalModule.feedback.value=this.feedback}}const Bc={drive:.3};class Pc extends Ec{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Bc,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Vc={bits:16};class Fc extends Ec{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new bo,props:{...Vc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class qc extends Qu{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new Yu,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){Wc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&Fo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function jc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=ec.upperFirst(ec.camelCase(t))){case _c.moduleName:return _c;case ac.moduleName:return ac;case cc.moduleName:return cc;case pc.moduleName:return pc;case vc.moduleName:return vc;case Cc.moduleName:return Cc;case yc.moduleName:return yc;case wc.moduleName:return wc;case Tc.moduleName:return Tc;case Oc.moduleName:return Oc;case Ic.moduleName:return Ic;case Nc.moduleName:return Nc;case Pc.moduleName:return Pc;case Fc.moduleName:return Fc;case qc.moduleName:return qc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class zc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return zc.instance||(zc.instance=new zc),zc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new Lo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,numberOfVoices:s,type:i,props:r={}}=t,o=jc({id:e,name:n,type:i,props:{}});return o instanceof Ku&&s&&(o.numberOfVoices=s),o.props=r,this.modules[o.id]=o,this.updateRoutes(),o.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateModule(t){const{id:e,changes:{name:n,numberOfVoices:s,props:i={}}}=t,r=this.findById(e);return r.props=i,n&&(r.name=n),r instanceof Ku&&s&&(r.numberOfVoices=s),r.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}addRoute(t){const e=function(t){const e=t.id||Qo();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(Fo.fromNote(e,"noteOn"===n))}dispose(){Object.values(this.modules).forEach((t=>{t.dispose()})),this.modules={},this.routes={}}findById(t){const e=this.modules[t];if(!e)throw Error(`Audio module with id ${t} not exists`);return e}get isStarted(){return void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(Wc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=Wc.findById(e),o=Wc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return ju(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var Wc=zc.getInstance();exports.MidiDevice=qo,exports.MidiDeviceManager=Lo,exports.Note=Po,exports.default=Wc;
|
|
33
33
|
//# sourceMappingURL=main.cjs.js.map
|