@opendaw/studio-core 0.0.72 → 0.0.74

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.
@@ -1,6 +1,6 @@
1
1
  var vB=Object.defineProperty;var Da=(r,e)=>{for(var t in e)vB(r,t,{get:e[t],enumerable:!0})};var Xs=class r{static DEFAULT_SIZE=512;static DECAY=.9;#e;#t;#r;#i;#n;#o;#a;#c;#s=0;decay=!1;constructor(e=r.DEFAULT_SIZE){this.#e=e<<1,this.#r=new Lh(this.#e),this.#i=new Float32Array(this.#e),this.#n=new Float32Array(this.#e),this.#o=Du.create(Du.Type.Blackman,this.#e),this.#t=e,this.#a=new Float32Array(e),this.#c=new Float32Array(e)}clear(){this.#a.fill(0),this.#i.fill(0),this.#c.fill(0),this.#s=0}numBins(){return this.#t}bins(){return this.#a}waveform(){return this.#c}process(e,t,i,n){for(let o=i;o<n;++o)this.#i[this.#s]=e[o]+t[o],++this.#s===this.#e&&this.#l()}#l(){for(let t=0;t<this.#t;++t)this.#c[t]=this.#i[t<<1];for(let t=0;t<this.#e;++t)this.#i[t]*=this.#o[t];this.#r.process(this.#i,this.#n);let e=1/this.#t;for(let t=0;t<this.#t;++t){let i=this.#i[t],n=this.#n[t],o=Math.sqrt(i*i+n*n)*e;this.#a[t]<o?this.#a[t]=o:this.decay&&(this.#a[t]*=r.DECAY)}this.#s=0,this.#n.fill(0),this.decay=!1}};var Iu=r=>r,Z=r=>r!=null,Ia=r=>r===null,At=r=>r!==null,el=r=>r===void 0,Ca=r=>r!==void 0,vP=r=>r==null,bx=(r,e)=>r!=null?e(r):void 0,ee=(r,e="asDefined failed")=>r??F(on(e)),Ie=(r,e)=>r instanceof e,Ne=(r,e)=>r instanceof e?r:F(`${r} is not instance of ${e}`),Ax=(r,e)=>{r instanceof e||F(`${r} is not instance of ${e}`)};var on=r=>r instanceof Function?r():r;var _=(r,...e)=>r?.apply(null,e),Kh=r=>Z(r)&&typeof r=="object";var Wh=r=>{throw new Error(`Unhandled ${r}`)},F=r=>{throw typeof r=="string"?new Error(r):r},I=(r,e)=>r?void 0:F(on(e));var Ta=r=>new Proxy({},{get(){return F(r)}});var xx=class{value;status="success";constructor(e){this.value=e}error=Ta("Cannot access error when succeeded")},wx=class{error;status="failure";constructor(e){this.error=e}value=Ta("Cannot access value when failed")},jn=r=>{try{return new xx(r())}catch(e){return new wx(e)}};var Jr=(r,e)=>Object.keys(e).length===0?F("Empty enum object (are you using `const enum`?)"):Object.keys(e).filter(n=>isNaN(Number(n))).map(n=>e[n]).includes(r)?r:F(`Invalid enum value: ${String(r)}`),Mi=()=>{};var _x;(function(r){r[r.Ascending=1]="Ascending",r[r.Descending=-1]="Descending"})(_x||(_x={}));var R=class{static#e=Object.freeze(new Array(0));static empty=()=>this.#e;static clear=e=>{e.length=0};static replace=(e,t)=>{e.length=0,e.push(...t)};static consume=(e,t)=>{for(let i=0;i<e.length;)t(e[i])?e.splice(i,1):i++};static peekFirst=e=>e.at(0)??null;static peekLast=e=>e.at(-1)??null;static getFirst=(e,t)=>ee(e.at(0),t);static getLast=(e,t)=>ee(e.at(-1),t);static getPrev=(e,t)=>{let i=e.indexOf(t);return i===-1?F(`${t} not found in ${e}`):ee(e.at((i-1)%e.length),"Internal Error")};static getNext=(e,t)=>{let i=e.indexOf(t);return i===-1?F(`${t} not found in ${e}`):ee(e.at((i+1)%e.length),"Internal Error")};static removeLast=(e,t)=>ee(e.pop(),t);static create=(e,t)=>{let i=new Array(t);for(let n=0;n<t;n++)i[n]=e(n);return i};static equals=(e,t)=>{if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0};static satisfy=(e,t)=>{if(e.length<2)return!0;let i=e[0];for(let n=1;n<e.length;n++)if(!t(i,e[n]))return!1;return!0};static remove=(e,t)=>{let i=e.indexOf(t);if(i===-1)return F(`${t} not found in ${e}`);e.splice(i,1)};static removeIf=(e,t)=>{for(let i=e.length-1;i>=0;i--)t(e[i])&&e.splice(i,1)};static removeOpt=(e,t)=>{let i=e.indexOf(t);return i===-1?!1:(e.splice(i,1),!0)};static hasDuplicates=e=>new Set(e).size<e.length;static removeDuplicates=e=>{let t=0,i=new Set;for(let n of e)i.has(n)||(i.add(n),e[t++]=n);return e.length=t,e};static removeDuplicateKeys=(e,t)=>{let i=0,n=new Set;for(let o of e){let a=o[t];n.has(a)||(n.add(a),e[i++]=o)}return e.length=i,e};static subtract(e,t,i){return e.filter(n=>!t.some(o=>i(n,o)))}static intersect(e,t,i){return e.filter(n=>t.some(o=>i(n,o)))}static merge(e,t,i){return[...e.filter(n=>!t.some(o=>i(n,o))),...t]}static*iterate(e){for(let t=0;t<e.length;t++)yield e[t]}static*iterateReverse(e){for(let t=e.length-1;t>=0;t--)yield e[t]}static*iterateStateFull(e){let t=e.length-1;for(let i=0;i<=t;i++)yield{value:e[i],isFirst:i===0,isLast:i===t}}static*iterateAdjacent(e){if(!(e.length<=1))for(let t=1,i=e[0];t<e.length;t++){let n=e[t];yield[i,n],i=n}}static isSorted(e,t=_x.Ascending){if(e.length<2)return!0;let i=e[0];for(let n=1;n<e.length;n++){let o=e[n];if(Math.sign(i-o)===t)return!1;i=o}return!0}static toRecord(e,t){return e.reduce((i,n)=>(i[t(n)]=n,i),{})}static concatArrayBuffers(e,t){let i=new ArrayBuffer(e.byteLength+t.byteLength),n=new Uint8Array(i);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),i}};var g;(function(r){r.wrap=t=>Z(t)?new e(t):r.None,r.from=t=>r.wrap(t()),r.tryFrom=t=>{try{return r.wrap(t())}catch{return r.None}},r.execute=(t,...i)=>r.wrap(t?.apply(null,i)),r.async=t=>t.then(i=>r.wrap(i),()=>r.None);class e{#e;constructor(i){this.#e=ee(i)}unwrap(){return this.#e}unwrapOrElse(i){return this.#e}unwrapOrNull(){return this.#e}unwrapOrUndefined(){return this.#e}contains(i){return i===this.#e}match(i){return i.some(this.#e)}ifSome(i){return i(this.#e)}ifAbsent(i){}isEmpty(){return!1}nonEmpty(){return!0}map(i){return r.wrap(i(this.#e))}mapOr(i,n){return i(this.#e)}flatMap(i){return i(this.#e)}equals(i){return this.unwrapOrNull()===i.unwrapOrNull()}assert(i){return this}toString(){return`{Option.Some(${this.#e})}`}get[Symbol.toStringTag](){return this.toString()}}r.Some=e,r.None=new class{unwrap=t=>F(Z(t)?on(t):"unwrap failed");unwrapOrElse=t=>on(t);unwrapOrNull=()=>null;unwrapOrUndefined=()=>{};contains=t=>!1;match=t=>t.none();ifSome=t=>{};ifAbsent=t=>t(void 0);isEmpty=()=>!0;nonEmpty=()=>!1;map=t=>r.None;mapOr=(t,i)=>on(i);flatMap=t=>r.None;equals=t=>t.isEmpty();assert=t=>F(on(t)??"assert failed");toString=()=>"{Option.None}";get[Symbol.toStringTag](){return this.toString()}}})(g||(g={}));var Ln;(function(r){r.async=e=>e.then(t=>r.ok(t),t=>r.err(t)),r.tryGet=e=>{try{return r.ok(e())}catch(t){return r.err(t)}},r.ok=e=>new class{value;constructor(t){this.value=t}asOption=()=>g.wrap(this.value);failureReason=()=>{throw new Error("Attempt was successful.")};isFailure=()=>!1;isSuccess=()=>!0;result=()=>this.value;map=t=>{try{return r.ok(t(this.value))}catch(i){return r.err(i)}};mapOr=(t,i)=>t(this.value);unwrapOrElse=t=>this.value;flatMap=t=>t(this.value);match=t=>t.ok(this.value);toVoid=()=>r.ok(void 0);failure=()=>{throw new Error("Attempt was successful.")};toString=()=>`{Success: ${this.value}`;get[Symbol.toStringTag](){return"Success"}}(e),r.Ok=new class{constructor(){}asOption=()=>g.None;failureReason=()=>{throw new Error("Attempt was successful.")};isFailure=()=>!1;isSuccess=()=>!0;result=()=>{};map=e=>r.ok(e());mapOr=(e,t)=>e();unwrapOrElse=e=>{};flatMap=e=>e();match=e=>e.ok();toVoid=()=>r.ok(void 0);failure=()=>{throw new Error("Attempt was successful.")};toString=()=>"{Success: Ok";get[Symbol.toStringTag](){return"Success"}},r.err=e=>new class{reason;constructor(t){this.reason=t}asOption=()=>g.None;failureReason=()=>this.reason;isFailure=()=>!0;isSuccess=()=>!1;result=()=>F(`'${this.reason}'`);map=()=>this;mapOr=(t,i)=>on(i);unwrapOrElse=t=>on(t);flatMap=()=>this;match=t=>t.err(this.reason);toVoid=()=>r.err(this.reason);failure=()=>this;toString=()=>`{Failure: ${this.reason}`;get[Symbol.toStringTag](){return"Failure"}}(e)})(Ln||(Ln={}));var Ye;(function(r){r.exact=(e,t,i)=>{let n=0,o=e.length-1;for(;n<=o;){let a=n+o>>>1,s=i(e[a],t);if(s===0)return a;s<0?n=a+1:o=a-1}return-1},r.exactMapped=(e,t,i,n)=>{let o=0,a=e.length-1;for(;o<=a;){let s=o+a>>>1,l=i(n(e[s]),t);if(l===0)return s;l<0?o=s+1:a=s-1}return-1},r.leftMost=(e,t,i)=>{let n=0,o=e.length;for(;n<o;){let a=n+o>>>1;i(e[a],t)<0?n=a+1:o=a}return n},r.rightMost=(e,t,i)=>{let n=0,o=e.length;for(;n<o;){let a=n+o>>>1;i(e[a],t)<=0?n=a+1:o=a}return o-1},r.stableInsert=(e,t,i)=>{let n=0,o=e.length;for(;n<o;){let a=n+o>>>1;i(e[a],t)<0?n=a+1:o=a}for(;n<e.length&&i(e[n],t)===0;)n++;return n},r.leftMostMapped=(e,t,i,n)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;i(n(e[s]),t)<0?o=s+1:a=s}return o},r.rightMostMapped=(e,t,i,n)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;i(n(e[s]),t)<=0?o=s+1:a=s}return a-1},r.rangeMapped=(e,t,i,n)=>[r.leftMostMapped(e,t,i,n),r.rightMostMapped(e,t,i,n)]})(Ye||(Ye={}));var rt=class{static every=(e,t)=>(e&t)===t;static some=(e,t)=>(e&t)>0;#e;#t;constructor(e=32){this.#e=e,this.#t=new Int32Array((e-1>>>5)+1)}getBit(e){let t=e>>>5,i=1<<e-(t<<5);return(this.#t[t]&i)!==0}setBit(e,t){let i=e>>>5,n=1<<e-(i<<5),o=this.#t[i],a=t?o|n:o&~n;return a===o?!1:(this.#t[i]=a,!0)}isEmpty(){return this.#t.every(e=>e===0)}nonEmpty(){return this.#t.some(e=>e>0)}set buffer(e){this.#t.set(new Int32Array(e))}get buffer(){return this.#t.buffer}replace(e){let t=new Int32Array(e),i=!1;for(let n=0;n<t.length;n++)this.#t[n]!==t[n]&&(this.#t[n]=t[n],i=!0);return i}toString(){let e="";for(let t of R.iterateReverse(this.#t))e+=t.toString(2).padStart(32,"0");return e.substring(e.length-this.#e)}clear(){this.#t.fill(0)}};var Zh=class{#e;#t=null;constructor(e){this.#e=e}invalidate=()=>this.#t=null;get(){return this.#t===null&&(this.#t=this.#e()),this.#t}terminate(){this.invalidate()}};var _t=class r{static parseCssRgbOrRgba(e){let t=e.match(/\(([^)]+)\)/)?.at(1)?.split(",")?.map(Number);if(Z(t)&&t.every(i=>!isNaN(i))){if(t.length===3)return[t[0]/255,t[1]/255,t[2]/255,1];if(t.length===4)return[t[0]/255,t[1]/255,t[2]/255,t[3]]}throw new Error(`${e} is not proper formatted. Example: 'rgb(255, 255, 255)' or 'rgba(255, 255, 255, 1)'`)}static hslToHex(e,t,i){let n=l=>(l+e/30)%12,o=t*Math.min(i,1-i),a=l=>i-o*Math.max(-1,Math.min(n(l)-3,Math.min(9-n(l),1))),s=l=>Math.round(l*255).toString(16).padStart(2,"0");return`#${s(a(0))}${s(a(8))}${s(a(4))}`}static hexToHsl(e){let t=e.startsWith("#")?e.slice(1):e,i=parseInt(t.slice(0,2),16)/255,n=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,a=Math.max(i,n,o),s=Math.min(i,n,o),l=(a+s)/2,u=0,p=0;if(a!==s){let d=a-s;switch(p=l>.5?d/(2-a-s):d/(a+s),a){case i:u=((n-o)/d+(n<o?6:0))*60;break;case n:u=((o-i)/d+2)*60;break;case o:u=((i-n)/d+4)*60;break}}return{h:u,s:p,l}}static hslStringToHex(e){let[t,i,n]=e.match(/\d+(\.\d+)?/g).map(Number);return r.hslToHex(t,i/100,n/100)}#e;#t;#r;#i;constructor(e,t,i,n=1){this.#e=e,this.#t=t,this.#r=i,this.#i=n}opacity(e){return new r(this.#e,this.#t,this.#r,e)}brightness(e){let t=Math.max(0,Math.min(100,this.#r+e));return new r(this.#e,this.#t,t,this.#i)}saturate(e){return new r(this.#e,this.#t*e,this.#r,this.#i)}fade(e){let t=this.#t*(1-Math.sqrt(e)),i=this.#r+(100-this.#r)*e**3;return new r(this.#e,t,i,this.#i)}toString(){return this.#i===1?`hsl(${this.#e}, ${this.#t}%, ${this.#r}%)`:`hsla(${this.#e}, ${this.#t}%, ${this.#r}%, ${this.#i})`}};var Cu=(r,e)=>r-e;var Di=Math.PI*2,EM=Math.PI/2,Px=Math.PI/4,BM=1/Math.sqrt(2),le=(r,e,t)=>Math.max(e,Math.min(r,t)),Qr=r=>Math.max(0,Math.min(r,1)),yP=(r,e)=>e+(1-2*e)*Math.max(0,Math.min(r,1)),Kn=(r,e)=>Math.floor(r/e)*e;var Gh=(r,e,t)=>r+(e-r)*t,xP=(r,e,t)=>r*Math.pow(e/r,t);var Tu=(r,e)=>yB(r/e)*e,yB=r=>r-Math.floor(r),_o=r=>Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));var Sx=(r,e)=>r*e/((2*e-1)*(r-1)+e);var Yr;(function(r){r.valueAt=({slope:n,steps:o,y0:a,y1:s},l)=>r.normalizedAt(l/o,n)*(s-a)+a,r.normalizedAt=(n,o)=>{if(o>.499999&&o<.500001)return n;{let a=le(o,1e-15,.999999999999999);return a*a/(1-a*2)*(Math.pow((1-a)/a,2*n)-1)}},r.inverseAt=(n,o)=>{let a=le(o,1e-15,.999999999999999);return Math.log(n*(1-2*a)/(a*a)+1)/(2*Math.log((1-a)/a))},r.coefficients=n=>{let o=r.valueAt(n,1),s=(r.valueAt(n,2)-o)/(o-n.y0),l=o-s*n.y0;return{m:s,q:l}};function*t(n,o,a,s){let{m:l,q:u}=r.coefficients({slope:n,steps:o,y0:a,y1:s});for(let p=0,d=a;p<o;p++)yield d=l*d+u}r.walk=t;function*i(n,o){let a=1/o,s=r.normalizedAt(a,n),u=(r.normalizedAt(2*a,n)-s)/s;for(let p=0,d=0;p<o;p++)yield d=u*d+s}r.walkNormalized=i,r.byHalf=(n,o,a,s)=>({slope:r.slopeByHalf(o,a,s),steps:n,y0:o,y1:s}),r.slopeByHalf=(n,o,a)=>Math.abs(a-n)<1e-6?.5:(o-n)/(a-n)})(Yr||(Yr={}));var an=new DataView(new ArrayBuffer(8)),nr;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647,r.toByte=e=>(an.setInt8(0,e),an.getInt8(0)),r.toShort=e=>(an.setInt16(0,e),an.getInt16(0)),r.toInt=e=>(an.setInt32(0,e),an.getInt32(0))})(nr||(nr={}));var Wn;(function(r){let i=new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT),n=new Float32Array(i),o=new Int32Array(i);r.floatToIntBits=a=>{let s=r.floatToRawIntBits(a);return(s&2139095040)===2139095040&&s&8388607?2143289344:s},r.intBitsToFloat=a=>(o[0]=a,n[0]),r.floatToRawIntBits=a=>(n[0]=a,o[0]),r.toFloat32=a=>(an.setFloat32(0,a),an.getFloat32(0))})(Wn||(Wn={}));var wP;(function(r){r.floatToIntBits=e=>{let t=Wn.floatToIntBits(e),i=t>>>16&32768,n=(t&2147483647)+4096;return n>=1199570944?(t&2147483647)>=1199570944?n<2139095040?i|31744:i|31744|(t&8388607)>>>13:i|31743:n>=947912704?i|n-939524096>>>13:n<855638016?i:(n=(t&2147483647)>>>23,i|(t&8388607|8388608)+(8388608>>>n-102)>>>126-n)},r.intBitsToFloat=e=>{let t=e&1023,i=e&31744;if(i===31744)i=261120;else if(i!==0){if(i+=114688,t===0&&i>115712)return Wn.intBitsToFloat((e&32768)<<16|i<<13|1023)}else if(t!==0){i=115712;do t<<=1,i-=1024;while(!(t&1024));t&=1023}return Wn.intBitsToFloat((e&32768)<<16|(i|t)<<13)}})(wP||(wP={}));var qh;(function(r){let e=9218868437227405312n,t=4503599627370495n,i=new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT),n=new Float64Array(i),o=new BigInt64Array(i);r.float64ToLongBits=a=>{let s=r.float64ToRawLongBits(a);return(s&e)===e&&(s&t)!==0n?0x7ff8000000000000n:s},r.longBitsToFloat64=a=>(o[0]=a,n[0]),r.float64ToRawLongBits=a=>(n[0]=a,o[0]),r.clamp=a=>(an.setFloat64(0,a),an.getFloat64(0))})(qh||(qh={}));var Xe=class{static*empty(){}static one(e){return[e]}static count(e){let t=0;for(let i of e)t++;return t}static some(e,t){for(let i of e)if(t(i))return!0;return!1}static every(e,t){for(let i of e)if(!t(i))return!1;return!0}static reduce(e,t,i){let n=i,o=0;for(let a of e)n=t(n,a,o++);return n}static includes(e,t){for(let i of e)if(i===t)return!0;return!1}static forEach(e,t){for(let i of e)t(i)}static*map(e,t){let i=0;for(let n of e)yield t(n,i++)}static*take(e,t){let i=0;for(let n of e){if(i++>=t)return;yield n}}static filter(e,t){let i=[];for(let n of e)t(n)&&i.push(n);return i}static filterMap(e,t){let i=[];for(let n of e){let o=t(n);Z(o)&&i.push(o)}return i}static reverse(e){let t=[];for(let i of e)t.push(i);return t.reverse()}static*pairWise(e){let t=e[Symbol.iterator](),{done:i,value:n}=t.next(),o=n;if(i!==!0)for(;;){let{done:a,value:s}=t.next();if(a===!0){yield[o,null];return}yield[o,s],o=s}}};var $t=class r{static create(e=1024){return this.use(new ArrayBuffer(e))}static use(e,t=0){return new r(new DataView(e,t))}littleEndian=!1;#e;#t=0;constructor(e){this.#e=e}get remaining(){return this.#e.byteLength-this.#t}get position(){return this.#t}set position(e){e<0?F(`position(${e}) cannot be negative.`):e>this.#e.byteLength?F(`position(${e}) is outside range (${this.#e.byteLength}).`):this.#t=e}writeBoolean(e){this.writeByte(e?1:0)}writeByte(e){this.#r(1),this.#e.setInt8(this.#t++,e)}writeShort(e){this.#r(Int16Array.BYTES_PER_ELEMENT),this.#e.setInt16(this.#t,e,this.littleEndian),this.#t+=Int16Array.BYTES_PER_ELEMENT}writeInt(e){this.#r(Int32Array.BYTES_PER_ELEMENT),this.#e.setInt32(this.#t,e,this.littleEndian),this.#t+=Int32Array.BYTES_PER_ELEMENT}writeLong(e){this.#r(BigInt64Array.BYTES_PER_ELEMENT),this.#e.setBigInt64(this.#t,e,this.littleEndian),this.#t+=BigInt64Array.BYTES_PER_ELEMENT}writeFloat(e){this.#r(Float32Array.BYTES_PER_ELEMENT),this.#e.setFloat32(this.#t,e,this.littleEndian),this.#t+=Float32Array.BYTES_PER_ELEMENT}writeDouble(e){this.#r(Float64Array.BYTES_PER_ELEMENT),this.#e.setFloat64(this.#t,e,this.littleEndian),this.#t+=Float64Array.BYTES_PER_ELEMENT}writeBytes(e){this.#r(e.length);for(let t=0;t<e.length;++t)this.#e.setInt8(this.#t++,e[t])}writeString(e){let t=e.length;this.#r(Int32Array.BYTES_PER_ELEMENT+t*Int16Array.BYTES_PER_ELEMENT),this.writeInt(t);for(let i=0;i<t;i++)this.writeShort(e.charCodeAt(i))}toArrayBuffer(){return this.#e.buffer.slice(0,this.#t)}#r(e){let t=this.#e.byteLength;if(this.#t+e>t){let i=this.#e;this.#e=new DataView(new ArrayBuffer(_o(t+e)));for(let n=0;n<this.#t;n++)this.#e.setInt8(n,i.getInt8(n))}}},tl=class{#e=0;writeByte(e){this.#e++}writeShort(e){this.#e+=2}writeInt(e){this.#e+=4}writeLong(e){this.#e+=8}writeFloat(e){this.#e+=4}writeDouble(e){this.#e+=8}writeBoolean(e){this.#e++}writeBytes(e){this.#e+=e.length}writeString(e){this.#e+=e.length+4}get count(){return this.#e}},Hh=class{#e;#t=0;constructor(e=32){this.#e=new Int8Array(e)}result(){return this.#e}equals(e){return e===this?!0:this.#e.every((t,i)=>e.#e[i]===t)}writeBoolean(e){this.writeByte(e?31:11)}writeShort(e){this.writeByte(e&255),this.writeByte(e>>>8&255)}writeByte(e){this.#t>=this.#e.length&&(this.#t=0),this.#e[this.#t++]^=e}writeInt(e){this.writeByte(e&255),this.writeByte(e>>>8&255),this.writeByte(e>>>16&255),this.writeByte(e>>>24&255)}writeBytes(e){e.forEach(t=>this.writeByte(t))}writeFloat(e){this.writeInt(Wn.floatToIntBits(e))}writeDouble(e){this.writeLong(qh.float64ToLongBits(e))}writeLong(e){this.writeByte(Number(e)&255),this.writeByte(Number(e>>8n)&255),this.writeByte(Number(e>>16n)&255),this.writeByte(Number(e>>24n)&255),this.writeByte(Number(e>>32n)&255),this.writeByte(Number(e>>40n)&255),this.writeByte(Number(e>>48n)&255),this.writeByte(Number(e>>56n)&255)}writeString(e){for(let t=0;t<e.length;t++)this.writeShort(e.charCodeAt(t))}toHexString(){return Array.from(Xe.map(this.#e.values(),e=>(e&255).toString(16).padStart(2,"0"))).join("")}},lt=class{littleEndian=!1;#e;#t=0;constructor(e,t=0){this.#e=new DataView(e,t)}get position(){return this.#t}set position(e){e<0?F(`position(${e}) cannot be negative.`):e>this.#e.byteLength?F(`position(${e}) is outside range (${this.#e.byteLength}).`):this.#t=e}readByte(){return this.#e.getInt8(this.#t++)}readShort(){let e=this.#e.getInt16(this.#t,this.littleEndian);return this.#t+=Int16Array.BYTES_PER_ELEMENT,e}readInt(){let e=this.#e.getInt32(this.#t,this.littleEndian);return this.#t+=Int32Array.BYTES_PER_ELEMENT,e}readLong(){let e=this.#e.getBigInt64(this.#t,this.littleEndian);return this.#t+=BigInt64Array.BYTES_PER_ELEMENT,e}readFloat(){let e=this.#e.getFloat32(this.#t,this.littleEndian);return this.#t+=Float32Array.BYTES_PER_ELEMENT,e}readDouble(){let e=this.#e.getFloat64(this.#t,this.littleEndian);return this.#t+=Float64Array.BYTES_PER_ELEMENT,e}readBoolean(){return this.readByte()===1}readBytes(e){for(let t=0;t<e.length;t++)e[t]=this.readByte()}readString(){let e=this.readInt(),t="";for(let i=0;i<e;i++)t+=String.fromCharCode(this.readShort());return t}available(e){return this.#t+e<=this.#e.byteLength}remaining(){return this.#e.byteLength-this.#t}skip(e){this.position+=e}};var xB=r=>Z(r)?r.value!==void 0?"value":r.get!==void 0?"get":F(`Cannot resolve method key of ${r}`):F("Cannot resolve method key of undefined descriptor"),rl=(r,e,t)=>{if(!Z(t))return function(o,a){if(a&&a.kind==="getter")return function(){let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),e);if(!Z(s?.get))return F(`Cannot find getter for property '${e}'`);let l=s.get.apply(this);return Object.defineProperty(this,e,{value:l,configurable:!1,writable:!1,enumerable:!1}),l}};let i=xB(t),n=ee(t[i]);return{[i]:function(...o){if(o.length>0)return F("lazy accessory must not have any construction parameters");let a=n.apply(this);return Object.defineProperty(this,e,{value:i==="get"?a:()=>a,configurable:!1,writable:!1,enumerable:!1}),a}}};var Zn;(function(r){function*e(){}r.empty=e,r.next=i=>{let{value:n,done:o}=i.next();return o?null:n};function*t(...i){for(let n of i)for(let o of n)yield o}r.flatten=t})(Zn||(Zn={}));var Ru;(function(r){r.intersect1D=(e,t,i,n)=>Math.max(e,i)<=Math.min(t,n)})(Ru||(Ru={}));var Mt=class{#e=new Set;#t;constructor(){this.#t=new Proxy({},{get:(e,t)=>(...i)=>this.#e.forEach(n=>Object.getPrototypeOf(n)===Object.getPrototypeOf({})?_(n[t],...i):n[t]?.apply(n,i))})}get proxy(){return this.#t}get size(){return this.#e.size}subscribe(e){return this.#e.add(e),{terminate:()=>this.#e.delete(e)}}forEach(e){this.#e.forEach(e)}terminate(){this.#e.clear()}};var bP=(r,...e)=>new Proxy([],{get(t,i){if(typeof i=="string"){let n=Number(i);if(!isNaN(n)&&n>=0&&Number.isInteger(n))return new r(...e)}return i===Symbol.iterator?function*(){for(;;)yield new r(...e)}:t[i]},has(t,i){if(typeof i=="string"){let n=Number(i);if(!isNaN(n)&&n>=0)return!0}return i in t}});var Ra=class{static createIfAbsent(e,t,i){let n=e.get(t);return n===void 0&&(n=i(t),e.set(t,n)),n}};var Ou=class r{static#e=Object.freeze(new Set);static empty=()=>r.#e};var Jh=class r{#e;#t;constructor(e,t){this.#e=new Map(e),this.#t=g.wrap(t),this.#t.ifSome(i=>Array.from(this.#e.values()).forEach(n=>n.sort(i)))}[Symbol.iterator](){return this.#e.entries()}clear(){this.#e.clear()}containsEntry(e,t){return Xe.some(this.#e.entries(),i=>e===i[0]&&i[1].includes(t))}containsKey(e){return Xe.includes(this.#e.keys(),e)}containsValue(e){return Xe.some(this.#e.values(),t=>t.includes(e))}get(e){return this.#e.get(e)??R.empty()}isEmpty(){return this.keyCount()===0}add(e,t){let i=Ra.createIfAbsent(this.#e,e,()=>[]);if(this.#t.isEmpty())i.push(t);else{let n=Ye.stableInsert(i,t,this.#t.unwrap());i.splice(n,0,t)}}addAll(e,t){let i=Ra.createIfAbsent(this.#e,e,()=>[]);i.push(...t),this.#t.nonEmpty()&&i.sort(this.#t.unwrap())}remove(e,t){let i=this.#e.get(e);if(i===void 0)return!1;{let n=i.indexOf(t);return n===-1?!1:(i.splice(n,1),i.length===0&&this.#e.delete(e),!0)}}removeFromKeyIf(e,t){let i=this.#e.get(e);if(i===void 0)return null;{let n=i.findIndex(t);if(n===-1)return null;{let o=i.splice(n,1)[0];return i.length===0&&this.#e.delete(e),o}}}removeValueIf(e){let t=[];for(let[i,n]of this.#e.entries())for(let o of n.filter(a=>e(a)))t.push([i,o]);for(let[i,n]of t)this.remove(i,n);return new Set(t.map(([,i])=>i))}removeKey(e){let t=this.#e.get(e);return this.#e.delete(e),t??R.empty()}forEach(e){Xe.forEach(this.#e.entries(),t=>e(t[0],t[1]))}keyCount(){return this.#e.size}keys(){return this.#e.keys()}sortKeys(e){let t=this.clone(),i=Array.from(this.keys()).sort(e);this.#e.clear();for(let n of i)this.addAll(n,t.get(n));return this}clone(){let e=new r;return this.#e.forEach((t,i)=>{e.#e.set(i,t.map(n=>n))}),e}},il=class r{map;constructor(e){this.map=new Map(e?.map(t=>{let i=t[0],n=t[1];return[i,new Set(n)]}))}clear(){this.map.clear()}containsEntry(e,t){return Xe.some(this.map.entries(),i=>e===i[0]&&i[1].has(t))}containsKey(e){return Xe.includes(this.map.keys(),e)}containsValue(e){return Xe.some(this.map.values(),t=>t.has(e))}get(e){return this.map.get(e)??Ou.empty()}isEmpty(){return this.keyCount()===0}add(e,t){Ra.createIfAbsent(this.map,e,()=>new Set).add(t)}addAll(e,t){let i=Ra.createIfAbsent(this.map,e,()=>new Set);for(let n of t)i.add(n)}remove(e,t){let i=this.map.get(e);return i===void 0?!1:i.delete(t)?(i.size===0&&this.map.delete(e),!0):!1}removeValueIf(e){let t=new Set;for(let[i,n]of this.map.entries()){for(let o of n)e(o)&&(n.delete(o),t.add(o));n.size===0&&this.map.delete(i)}return t}removeFromKeyIf(e,t){let i=this.map.get(e);if(i===void 0)return null;for(let n of i)if(t(n))return i.delete(n),i.size===0&&this.map.delete(e),n;return null}removeKey(e){let t=this.map.get(e);return this.map.delete(e),t??Ou.empty()}forEach(e){Xe.forEach(this.map.entries(),t=>e(t[0],t[1]))}keyCount(){return this.map.size}keys(){return this.map.keys()}sortKeys(e){let t=this.clone(),i=Array.from(this.keys()).sort(e);this.map.clear();for(let n of i)this.addAll(n,t.get(n));return this}clone(){let e=new r;return this.map.forEach((t,i)=>{e.map.set(i,new Set(Array.from(t)))}),e}};var K=Object.freeze({Empty:{terminate:Mi},create:r=>({terminate:r}),many:(...r)=>({terminate:()=>{for(;r.length>0;)r.pop().terminate()}})}),U=class r{#e=[];isEmpty(){return this.#e.length===0}nonEmpty(){return this.#e.length>0}own(e){return this.#e.push(e),e}ownAll(...e){for(let t of e)this.#e.push(t)}spawn(){let e=new r;return e.own({terminate:()=>R.removeOpt(this.#e,e)}),this.own(e)}terminate(){for(;this.#e.length>0;)this.#e.pop().terminate()}};var re=class{static subscribeMany(e,...t){return K.many(...t.map(i=>i.subscribe(()=>e(i))))}#e=new Set;subscribe(e){return this.#e.add(e),{terminate:()=>this.#e.delete(e)}}isEmpty(){return this.#e.size===0}notify(e){this.#e.forEach(t=>t(e))}observers(){return this.#e}terminate(){this.#e.clear()}};var Ir;(function(r){let e=Object.freeze({});r.empty=()=>e,r.mergeNoOverlap=(t,i)=>{let n=new Set(Object.keys(t));for(let o of Object.keys(i))if(n.has(o))return F(`'${o}' is an overlapping key`);return{...t,...i}},r.include=(t,...i)=>{let n={};for(let o of i)n[o]=t[o];return n},r.exclude=(t,...i)=>{let n=new Set(i);return Object.entries(t).reduce((o,[a,s])=>(n.has(a)||(o[a]=s),o),{})},r.overwrite=(t,i)=>Object.assign(t,i)})(Ir||(Ir={}));var AP;(function(r){r.seal=e=>new class{getValue(){return e}subscribe(t){return K.Empty}catchupAndSubscribe(t){return t(this),K.Empty}}})(AP||(AP={}));var _P;(function(r){r.False=new class{getValue(){return!1}setValue(e){}subscribe(e){return K.Empty}catchupAndSubscribe(e){return e(this),K.Empty}},r.inverseBoolean=e=>new class{getValue(){return!e.getValue()}setValue(t){e.setValue(!t)}subscribe(t){return e.subscribe(t)}catchupAndSubscribe(t){return t(this),this.subscribe(t)}}})(_P||(_P={}));var Xr=class{#e;#t=g.None;constructor(e){this.#e=new re,this.wrap(e)}wrap(e){this.wrapOption(g.wrap(e))}wrapOption(e){this.#t.equals(e)||(this.#t=e,this.#e.notify(this))}clear(e){this.#t.isEmpty()||(Z(e)&&e(this.#t.unwrap()),this.#t=g.None,this.#e.notify(this))}assert(e){return this.#t.assert(e),this}contains(e){return this.#t.contains(e)}equals(e){return this.#t.equals(e)}flatMap(e){return this.#t.flatMap(e)}ifSome(e){return this.#t.ifSome(e)}ifAbsent(e){return this.#t.ifAbsent(e)}isEmpty(){return this.#t.isEmpty()}map(e){return this.#t.map(e)}mapOr(e,t){return this.#t.mapOr(e,t)}match(e){return this.#t.match(e)}nonEmpty(){return this.#t.nonEmpty()}unwrap(e){return this.#t.unwrap(e)}unwrapOrElse(e){return this.#t.unwrapOrElse(e)}unwrapOrNull(){return this.#t.unwrapOrNull()}unwrapOrUndefined(){return this.#t.unwrapOrUndefined()}subscribe(e){return this.#e.subscribe(()=>e(this))}catchupAndSubscribe(e){return e(this),this.#e.subscribe(()=>e(this))}terminate(){this.#e.terminate()}};var Cr=class{#e;#t=g.None;#r;constructor(e,t){this.#e=new re,this.#r=t?.guard(e)??e,this.#t=g.wrap(t)}setValue(e){this.#t.nonEmpty()&&(e=this.#t.unwrap().guard(e)),this.#r!==e&&(this.#r=e,this.#e.notify(this))}getValue(){return this.#r}subscribe(e){return this.#e.subscribe(e)}catchupAndSubscribe(e){return e(this),this.#e.subscribe(e)}terminate(){this.#e.terminate()}toString(){return`{DefaultObservableValue value: ${this.#r}`}};var Ex=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=t-e}x(e){return(this.clamp(e)-this.#e)/this.#r}y(e){return this.#e+le(e,0,1)*this.#r}clamp(e){return le(e,this.#e,this.#t)}floating(){return!0}},Bx=class{#e;#t;#r;constructor(e,t){this.#e=le(Math.round(e),nr.MIN_VALUE,nr.MAX_VALUE),this.#t=le(Math.round(t),nr.MIN_VALUE,nr.MAX_VALUE),this.#r=this.#t-this.#e}x(e){return(this.clamp(e)-this.#e)/this.#r}y(e){return this.#e+Math.round(le(e,0,1)*this.#r)}clamp(e){return le(Math.round(e),this.#e,this.#t)}floating(){return!1}},Fx=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=Math.log(t/e)}x(e){return Math.log(le(e,this.#e,this.#t)/this.#e)/this.#r}y(e){return this.#e*Math.exp(le(e,0,1)*this.#r)}clamp(e){return Math.min(this.#t,Math.max(this.#e,e))}floating(){return!0}},Nx=class{#e;constructor(e){this.#e=e}x(e){let t=this.#e.findIndex(i=>i===e);return t===-1?F(`Could not find index for ${e}`):t/(this.#e.length-1)}y(e){let t=Math.round(le(e,0,1)*(this.#e.length-1));return t>-1?ee(this.#e.at(t),`Could not find value for ${e}`):F(`Index ${t} is out of box.`)}clamp(e){return e}floating(){return!1}},kx=class{#e;#t;#r;#i;#n;constructor(e,t,i){this.#e=e,this.#t=i;let n=e*e,o=i*i,a=t*t,s=e+i-2*t,l=i-t;this.#r=((2*i-t)*e-t*i)/s,this.#i=(l*n+(a-o)*e+t*o-a*i)/(n+(2*i-4*t)*e+o-4*t*i+4*a),this.#n=-l/s}y(e){return e<=0?Number.NEGATIVE_INFINITY:e>=1?this.#t:this.#r-this.#i/(e+this.#n)}x(e){return this.#e>=e?0:this.#t<=e?1:-this.#i/(e-this.#r)-this.#n}clamp(e){return Math.min(this.#t,e)}floating(){return!0}},S;(function(r){r.linear=(o,a)=>new Ex(o,a),r.linearInteger=(o,a)=>new Bx(o,a),r.exponential=(o,a)=>new Fx(o,a),r.values=o=>new Nx(o),r.decibel=(o,a,s)=>new kx(o,a,s);let e=new class{x(o){return o?1:0}y(o){return o>=.5}clamp(o){return o}floating(){return!1}},t=r.linear(0,1),i=r.linear(-1,1);r.bool=e;let n=r.decibel(-72,-12,0);r.unipolar=()=>t,r.bipolar=()=>i,r.DefaultDecibel=n})(S||(S={}));var P;(function(r){r.percent=({bipolar:o,fractionDigits:a}={})=>new e("%",a,!1,o),r.numeric=({unit:o,fractionDigits:a,unitPrefix:s,bipolar:l}={})=>new e(o,a,s,l),r.indices=(o,a)=>new class{x(s){return{unit:o,value:a[s]}}y(s){let l=a.indexOf(s);return l===-1?{type:"unknown",value:"\u{1F4A3}"}:{type:"explicit",value:l}}},r.values=(o,a,s)=>new class{x(l){return{unit:o,value:s.at(a.indexOf(l))??"N/A"}}y(l){let u=s.indexOf(l);return u===-1?{type:"unknown",value:"\u{1F4A3}"}:{type:"explicit",value:a[u]}}},r.bool=new class{y(o){switch(o.trim()){case"on":case"yes":case"true":return{type:"explicit",value:!0};default:return{type:"explicit",value:!1}}}x(o){return{value:o?"On":"Off",unit:""}}},r.boolValues=(o,a)=>new class{y(s){switch(s.trim()){case a:case"on":case"yes":case"true":return{type:"explicit",value:!0};case o:default:return{type:"explicit",value:!1}}}x(s){return{value:s?"On":"Off",unit:""}}};class e{#e;#t;#r;#i;constructor(a,s,l,u){this.#e=a??"",this.#t=s??0,this.#r=l??!1,this.#i=u??!1}y(a){let s=a.trim(),l=parseFloat(s);if(isNaN(l))return{type:"unknown",value:s};if(this.#e==="%")return{type:"explicit",value:l/100};if(s.endsWith("%"))return{type:"unitValue",value:this.#i?le(l/200+.5,0,1):le(l/100,0,1)};{s.endsWith(this.#e)&&this.#e.length>0&&(s=s.slice(0,-this.#e.length));let d=/(\d+)(\D+)/.exec(s)?.at(2)?.at(0);if(Z(d)){let f=t.indexOf(d);if(f>-1)return{type:"explicit",value:l*Math.pow(10,(f-4)*3)}}return{type:"explicit",value:l}}}x(a){if(Number.isNaN(a))return{value:"\u{1F4A3}",unit:this.#e};if(Number.isFinite(a)){if(this.#e==="%")return this.#i?{value:(a*200-100).toFixed(this.#t),unit:this.#e}:{value:(a*100).toFixed(this.#t),unit:this.#e};if(this.#r){let{value:s,prefix:l}=n(a);return{value:s.toFixed(this.#t),unit:`${l}${this.#e}`}}else return{value:a.toFixed(this.#t),unit:this.#e}}else return{value:a===Number.POSITIVE_INFINITY?"\u221E":"-\u221E",unit:this.#e}}}let t=Object.freeze(["p","n","\u03BC","m","","k","M","G","T"]),i=o=>Math.log(o)/Math.log(9.999999999999998),n=o=>{let a=Math.floor(i(o)/3),s=t[a+4];return Z(s)?{value:o*Math.pow(10,a*-3),prefix:s}:{value:o,prefix:""}};r.decible=r.numeric({unit:"db",fractionDigits:1}),r.panning=r.percent({unit:"%",fractionDigits:0})})(P||(P={}));var Po;(function(r){r.alwaysTrue=()=>!0,r.alwaysFalse=()=>!1,r.definedPredicate=e=>e!=null})(Po||(Po={}));var nl;(function(r){r.create=(e=252854082)=>new $x(e),r.monotoneAscending=(e,t=128,i=r.create())=>{let n=e.length;if(n<2)return F("Array must have at least 2 elements");let o=0;for(let s=1;s<n;s++){let l=Math.floor(i.uniform()*(1+t))+1;e[s]=l,o+=l}let a=0;e[0]=0;for(let s=1;s<n;s++)a+=e[s],e[s]=a/o;return e}})(nl||(nl={}));var $x=class{#e=0;constructor(e){this.setSeed(e)}setSeed(e){this.#e=e&4294967295}nextDouble(e,t){return e+this.uniform()*(t-e)}nextInt(e,t){return e+Math.floor(this.uniform()*(t-e))}nextElement(e){return e[Math.floor(this.uniform()*e.length)]}nextBoolean(){return this.uniform()<.5}uniform(){let e=this.#e+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}};var yr;(function(r){class e{}r.createBuilder=i=>{let n=o=>{let a=o instanceof Array?[]:{};return Object.entries(o).forEach(([s,l])=>{l instanceof e?a[s]=l.initialValue():typeof l=="object"&&(a[s]=n(l))}),a};return()=>new t(i,Object.seal(n(i)))},r.bool=new class extends e{read(i){return i.readByte()===1}write(i,n){i.writeByte(n?1:0)}initialValue(){return!1}},r.int8=new class extends e{read(i){return i.readByte()}write(i,n){i.writeByte(n)}initialValue(){return 0}},r.int16=new class extends e{read(i){return i.readShort()}write(i,n){i.writeShort(n)}initialValue(){return 0}},r.int32=new class extends e{read(i){return i.readInt()}write(i,n){i.writeInt(n)}initialValue(){return 0}},r.float=new class extends e{read(i){return i.readFloat()}write(i,n){i.writeFloat(n)}initialValue(){return 0}},r.double=new class extends e{read(i){return i.readDouble()}write(i,n){i.writeDouble(n)}initialValue(){return 0}},r.int64=new class extends e{read(i){return i.readLong()}write(i,n){i.writeLong(n)}initialValue(){return 0n}},r.floats=i=>new class extends e{read(n,o){for(let a=0;a<o.length;a++)o[a]=n.readFloat();return o}write(n,o){for(let a=0;a<o.length;a++)n.writeFloat(o[a])}initialValue(){return new Float32Array(i)}},r.doubles=i=>new class extends e{read(n,o){for(let a=0;a<o.length;a++)o[a]=n.readDouble();return o}write(n,o){for(let a=0;a<o.length;a++)n.writeDouble(o[a])}initialValue(){return new Float64Array(i)}};class t{#e;#t;#r;constructor(n,o){this.#e=n,this.#t=o,this.#r=this.#i()}get object(){return this.#t}get bytesTotal(){return this.#r}read(n){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?p[l]=u.read(n,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}write(n){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?u.write(n,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}#i(){let n=new tl;return this.write(n),n.count}}})(yr||(yr={}));var ol=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=[]}add(e,t=!1){let i=this.#e(e),n=Ye.leftMostMapped(this.#r,i,this.#t,this.#e),o=this.#r[n];return Z(o)&&this.#t(this.#e(o),i)===0?t?(this.#r.splice(n,1,e),!0):!1:(this.#r.splice(n,0,e),!0)}getOrCreate(e,t){let i=Ye.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[i];if(Z(n)&&this.#t(this.#e(n),e)===0)return n;let o=t(e);return this.#r.splice(i,0,o),o}addMany(e){for(let t of e)this.#r.push(t);try{return this.#r.sort((t,i)=>{let n=this.#t(this.#e(t),this.#e(i));if(n===0)throw"cancel";return n}),!0}catch(t){if(t==="cancel"){let i=new Map(this.entries());return this.#r.splice(0,this.#r.length,...i.values()),this.#r.sort((n,o)=>this.#t(this.#e(n),this.#e(o))),!1}return F(t)}}removeByValue(e){return this.removeByKey(this.#e(e))}removeByKey(e){let t=Ye.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[t];return Z(i)&&this.#t(this.#e(i),e)===0?(this.#r.splice(t,1),i):F(`Could not remove ${e}`)}removeByKeyIfExist(e){let t=Ye.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[t];return Z(i)&&this.#t(this.#e(i),e)===0?(this.#r.splice(t,1),i):null}removeRange(e,t){this.#r.splice(e,(t??this.#r.length)-e)}removeByPredicate(e){let t=0,i=this.#r.length;for(;--i>=0;)e(this.#r[i])&&(this.#r.splice(i,1),t++);return t}get(e){return ee(this.#i(e),`Unknown key: ${e}`)}getOrThrow(e,t){let i=this.#i(e);if(Z(i))return i;throw t()}opt(e){return g.wrap(this.#i(e))}getOrNull(e){return this.#i(e)??null}getByIndex(e){return this.#r[e]}hasKey(e){return Z(this.#i(e))}hasValue(e){return Z(this.#i(this.#e(e)))}size(){return this.#r.length}isEmpty(){return this.#r.length===0}forEach(e){this.values().forEach(e)}values(){return this.#r}entries(){return this.#r.map(e=>[this.#e(e),e])}clear(){R.clear(this.#r)}[Symbol.iterator](){return this.#r.values()}#i(e){let t=Ye.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[t];return Z(i)&&this.#t(this.#e(i),e)===0?i:void 0}};var al=(()=>{let r=g.None;return{info:e=>r.match({none:()=>Promise.resolve(),some:t=>t.info(e)}),approve:e=>r.match({none:()=>Promise.resolve(!0),some:t=>t.approve(e)}),progress:e=>r.match({none:()=>({message:"",terminate:Mi}),some:t=>t.progress(e)}),install:e=>{I(r.isEmpty(),"RuntimeNotification already installed"),r=g.wrap(e)}}})();var Vu=class r{static POSITIVE_INFINITY=new r(Number.POSITIVE_INFINITY);static millis=e=>new r(e);static seconds=e=>new r(e*r.#e);static minutes=e=>new r(e*r.#t);static hours=e=>new r(e*r.#r);static days=e=>new r(e*r.#i);static#e=1e3;static#t=6e4;static#r=36e5;static#i=864e5;#n;constructor(e){this.#n=e}millis(){return this.#n}absSeconds(){return Math.abs(this.#n)/r.#e}absMinutes(){return Math.abs(this.#n)/r.#t}absHours(){return Math.abs(this.#n)/r.#r}absDays(){return Math.abs(this.#n)/r.#i}split(){return{d:Math.floor(this.absDays()),h:Math.floor(this.absHours())%24,m:Math.floor(this.absMinutes())%60,s:Math.floor(this.absSeconds())%60}}isNow(){return this.#n===0}isPast(){return this.#n<0}isFuture(){return this.#n>0}toUnitString(){let e,t,i=Math.floor(Math.abs(this.#n)/1e3),n=Math.floor(i/60),o=Math.floor(n/60),a=Math.floor(o/24);return i<60?(e=i,t="second"):n<60?(e=n,t="minute"):o<24?(e=o,t="hour"):(e=a,t="day"),new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"long"}).format(e*Math.sign(this.#n),t)}toString(){if(isNaN(this.#n))return"NaN";if(!isFinite(this.#n))return"\u221E";let{d:e,h:t,m:i,s:n}=this.split();return e>0?[r.#o("d",e),r.#o("h",t),r.#o("m",i),r.#o("s",n)].join(", "):t>0?[r.#o("h",t),r.#o("m",i),r.#o("s",n)].join(", "):i>0?[r.#o("m",i),r.#o("s",n)].join(", "):n>0?r.#o("s",n):"now"}static#o=(e,t)=>{switch(e){case"d":return`${t} ${t<2?"day":"days"}`;case"h":return`${t} ${t<2?"hour":"hours"}`;case"m":return`${t} ${t<2?"minute":"minutes"}`;case"s":return`${t} ${t<2?"second":"seconds"}`;default:return Wh(e)}}};var sl;(function(r){let e;(function(t){t[t.READING=0]="READING",t[t.READ=1]="READ",t[t.WRITING=2]="WRITING",t[t.WRITTEN=3]="WRITTEN"})(e||(e={})),r.writer=(t,i,n)=>{if(t.bytesTotal+1>i.byteLength)return F("Insufficient memory allocated.");let o=new Uint8Array(i),a=$t.use(i,1);return Atomics.store(o,0,e.READ),{tryWrite:()=>Atomics.compareExchange(o,0,e.READ,e.WRITING)===e.WRITING?(n(t.object),a.position=0,t.write(a),Atomics.store(o,0,e.WRITTEN),!0):!1}},r.reader=(t,i)=>{let n=new SharedArrayBuffer(t.bytesTotal+1),o=new Uint8Array(n),a=new lt(n,1);return{buffer:n,tryRead:()=>Atomics.compareExchange(o,0,e.WRITTEN,e.READING)===e.READING?(a.position=0,t.read(a),i(t.object),Atomics.store(o,0,e.READ),!0):!1}}})(sl||(sl={}));var w;(function(r){r.length=16,r.generate=()=>e(crypto.getRandomValues(new Uint8Array(r.length))),r.sha256=async t=>{let i=typeof process<"u"&&process.env?.VITEST==="true";return crypto.subtle.digest("SHA-256",i?new Uint8Array(t.slice(0)):t).then(n=>e(new Uint8Array(n.slice(0,r.length))))},r.validateBytes=t=>r.parse(r.toString(t)),r.validateString=t=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t),r.asString=t=>r.validateString(t)?t:F(`Invalid UUID format: ${t}`),r.fromDataInput=t=>{let i=new Uint8Array(r.length);return t.readBytes(new Int8Array(i.buffer)),i},r.toDataOutput=(t,i)=>t.writeBytes(new Int8Array(i.buffer)),r.toString=t=>{let i=R.create(n=>(n+256).toString(16).substring(1),256);return i[t[0]]+i[t[1]]+i[t[2]]+i[t[3]]+"-"+i[t[4]]+i[t[5]]+"-"+i[t[6]]+i[t[7]]+"-"+i[t[8]]+i[t[9]]+"-"+i[t[10]]+i[t[11]]+i[t[12]]+i[t[13]]+i[t[14]]+i[t[15]]},r.parse=t=>{let i=t.replace(/-/g,"").toLowerCase();if(i.length!==32)return F("Invalid UUID format");let n=new Uint8Array(r.length);for(let o=0,a=0;o<32;o+=2,a++)n[a]=parseInt(i.slice(o,o+2),16);return n},r.Comparator=(t,i)=>{if(t.length!==r.length||i.length!==r.length)return F("Unexpected array length for uuid(v4)");for(let n=0;n<r.length;n++){let o=t[n]-i[n];if(o!==0)return o}return 0},r.equals=(t,i)=>r.Comparator(t,i)===0,r.newSet=t=>new ol(t,r.Comparator),r.Lowest=r.parse("00000000-0000-4000-8000-000000000000"),r.Highest=r.parse("FFFFFFFF-FFFF-4FFF-BFFF-FFFFFFFFFFFF"),r.fromInt=t=>{let i=new Uint8Array(r.Lowest),n=new Uint8Array(new Uint32Array([t]).buffer);for(let o=0;o<4;o++)i[o]=n[o];return i},r.zType=t=>t.string().refine(i=>r.validateString(i),{message:"Invalid UUID format"}).transform(i=>i);let e=t=>(I(t.length===r.length,"UUID must be 16 bytes long"),t[6]=t[6]&15|64,t[8]=t[8]&63|128,t)})(w||(w={}));var ve=class r{static Empty=new r(2);#e;constructor(e=2){this.#e=R.create(()=>new Float32Array(128),e)}clear(e,t){this.#e.forEach(i=>i.fill(0,e,t))}numChannels(){return this.#e.length}getChannel(e){return e<this.numChannels()?this.#e[e]:this.#e[this.numChannels()-1]}assertSanity(){I(!this.#e.some(e=>e.some(t=>isNaN(t))),"AudioBuffer is invalid (NaN)")}channels(){return this.#e}replace(e){this.replaceInto(e.#e)}replaceInto(e){I(e.length===2,"mixLayout: target.length must be 2"),I(this.#e.length===1||this.#e.length===2,"mixLayout: target.length must be 1 or 2"),this.#e.length===1?(e[0].set(this.#e[0]),e[1].set(this.#e[0])):(e[0].set(this.#e[0]),e[1].set(this.#e[1]))}mixInto(e){I(e.length===2,"mixLayout: target.length must be 2"),I(this.#e.length===1||this.#e.length===2,"mixLayout: target.length must be 1 or 2");let[t,i]=e;if(this.#e.length===1){let[n]=this.#e;for(let o=0;o<128;o++)t[o]+=n[o],i[o]+=n[o]}else{let[n,o]=this.#e;for(let a=0;a<128;a++)t[a]+=n[a],i[a]+=o[a]}}};var ct;(function(r){r[r.Idle=0]="Idle",r[r.Attack=1]="Attack",r[r.Decay=2]="Decay",r[r.Sustain=3]="Sustain",r[r.Release=4]="Release"})(ct||(ct={}));var ll=class{#e;#t=ct.Idle;#r=0;#i=0;#n=0;#o=0;#a=0;#c=0;#s=0;#l=0;#u=0;constructor(e){this.#e=1/e}get gate(){return this.#t!==ct.Idle&&this.#t!==ct.Release}get complete(){return this.#t===ct.Idle}get value(){return this.#r}get phase(){return this.#i}set(e,t,i,n){this.#n=e,this.#o=t,this.#a=i,this.#c=n,this.#d()}#d(){switch(this.#t){case ct.Attack:{let e=1-this.#r;this.#s=e*this.#e/Math.max(this.#n,1e-6);break}case ct.Decay:{let e=this.#r-this.#a;this.#l=e*this.#e/Math.max(this.#o,1e-6);break}case ct.Release:{let e=this.#r;this.#u=e*this.#e/Math.max(this.#c,1e-6);break}case ct.Sustain:case ct.Idle:{this.#s=this.#e/Math.max(this.#n,1e-6),this.#l=(1-this.#a)*this.#e/Math.max(this.#o,1e-6),this.#u=this.#a*this.#e/Math.max(this.#c,1e-6);break}}}gateOn(){this.#t=ct.Attack}gateOff(){this.#t!==ct.Idle&&(this.#t=ct.Release,this.#d())}forceStop(){this.#t=ct.Idle,this.#r=0}process(e,t,i){for(let n=t;n<i;)switch(this.#t){case ct.Attack:for(;n<i;){if(this.#r+=this.#s,this.#r>=1){this.#r=1,this.#i=1,e[n++]=this.#r,this.#t=ct.Decay,this.#d();break}e[n++]=this.#i=this.#r}break;case ct.Decay:for(;n<i;){if(this.#r-=this.#l,this.#r<=this.#a){this.#r=this.#a,this.#i=2,e[n++]=this.#r,this.#t=ct.Sustain,this.#d();break}this.#i=1+(1-this.#r)/(1-this.#a),e[n++]=this.#r}break;case ct.Sustain:e.fill(this.#a,n,i);return;case ct.Release:for(;n<i;){if(this.#r-=this.#u,this.#r<=0){this.#r=0,this.#i=0,e[n++]=this.#r,this.#t=ct.Idle,this.#d();break}this.#i=3+(1-this.#r/this.#a),e[n++]=this.#r}break;case ct.Idle:e.fill(0,n,i);return}}};var sn=class{a1=0;a2=0;b0=0;b1=0;b2=0;constructor(){this.identity()}identity(){this.setNormalizedCoefficients(1,0,0,1,0,0)}setLowpassParams(e,t=Math.SQRT1_2){if(e=le(e,0,1),e>=.5)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let i=Di*e,n=Math.sin(i)/(2*t),o=Math.cos(i),a=(1-o)/2,s=a,l=2*a,u=a,p=1+n,d=-2*o,f=1-n;this.setNormalizedCoefficients(s,l,u,p,d,f)}else this.setNormalizedCoefficients(0,0,0,1,0,0);return this}setHighpassParams(e,t=Math.SQRT1_2){if(e=le(e,0,1),e===1)this.setNormalizedCoefficients(0,0,0,1,0,0);else if(e>0){let i=Di*e,n=Math.sin(i)/(2*t),o=Math.cos(i),a=(1+o)/2,s=a,l=-2*a,u=a,p=1+n,d=-2*o,f=1-n;this.setNormalizedCoefficients(s,l,u,p,d,f)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setNormalizedCoefficients(e,t,i,n,o,a){let s=1/n;return this.b0=e*s,this.b1=t*s,this.b2=i*s,this.a1=o*s,this.a2=a*s,this}setLowShelfParams(e,t){e=le(e,0,1);let i=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(i*i,0,0,1,0,0);else if(e>0){let n=Di*e,a=.5*Math.sin(n)*Math.sqrt((i+1/i)*(1/1-1)+2),s=Math.cos(n),l=2*Math.sqrt(i)*a,u=i+1,p=i-1,d=i*(u-p*s+l),f=2*i*(p-u*s),v=i*(u-p*s-l),m=u+p*s+l,y=-2*(p+u*s),x=u+p*s-l;this.setNormalizedCoefficients(d,f,v,m,y,x)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setHighShelfParams(e,t){e=le(e,0,1);let i=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let n=Di*e,a=.5*Math.sin(n)*Math.sqrt((i+1/i)*(1/1-1)+2),s=Math.cos(n),l=2*Math.sqrt(i)*a,u=i+1,p=i-1,d=i*(u+p*s+l),f=-2*i*(p+u*s),v=i*(u+p*s-l),m=u-p*s+l,y=2*(p-u*s),x=u-p*s-l;this.setNormalizedCoefficients(d,f,v,m,y,x)}else this.setNormalizedCoefficients(i*i,0,0,1,0,0);return this}setPeakingParams(e,t,i){e=le(e,0,1),t=Math.max(0,t);let n=Math.pow(10,i/40);if(e>0&&e<1)if(t>0){let o=Di*e,a=Math.sin(o)/(2*t),s=Math.cos(o),l=1+a*n,u=-2*s,p=1-a*n,d=1+a/n,f=-2*s,v=1-a/n;this.setNormalizedCoefficients(l,u,p,d,f,v)}else this.setNormalizedCoefficients(n*n,0,0,1,0,0);else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setAllpassParams(e,t){if(e=le(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let i=Di*e,n=Math.sin(i)/(2*t),o=Math.cos(i),a=1-n,s=-2*o,l=1+n,u=1+n,p=-2*o,d=1-n;this.setNormalizedCoefficients(a,s,l,u,p,d)}else this.setNormalizedCoefficients(-1,0,0,1,0,0);else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setNotchParams(e,t){if(e=le(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let i=Di*e,n=Math.sin(i)/(2*t),o=Math.cos(i),a=1,s=-2*o,l=1,u=1+n,p=-2*o,d=1-n;this.setNormalizedCoefficients(a,s,l,u,p,d)}else this.setNormalizedCoefficients(0,0,0,1,0,0);else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setBandpassParams(e,t){if(e=Math.max(0,e),t=Math.max(0,t),e>0&&e<1){let i=Di*e;if(t>0){let n=Math.sin(i)/(2*t),o=Math.cos(i),a=n,s=0,l=-n,u=1+n,p=-2*o,d=1-n;this.setNormalizedCoefficients(a,s,l,u,p,d)}else this.setNormalizedCoefficients(1,0,0,1,0,0)}else this.setNormalizedCoefficients(0,0,0,1,0,0);return this}getFrequencyResponse(e,t,i){I(e.length===t.length&&e.length===i.length,"Array lengths do not match");let n=this.b0,o=this.b1,a=this.b2,s=this.a1,l=this.a2;for(let u=0;u<e.length;++u){let p=-Math.PI*2*e[u],d=Math.cos(p),f=Math.sin(p),v=n+((o+a*d)*d-a*f*f),m=(o+a*d)*f+a*f*d,y=1+((s+l*d)*d-l*f*f),x=(s+l*d)*f+l*f*d,D=y*y+x*x,M=(v*y+m*x)/D,O=(m*y-v*x)/D;t[u]=Math.sqrt(M*M+O*O),i[u]=Math.atan2(O,M)}}};var Pt=class{#e=0;#t=0;#r=0;#i=0;reset(){this.#e=0,this.#t=0,this.#r=0,this.#i=0}process({a1:e,a2:t,b0:i,b1:n,b2:o},a,s,l,u){let p=this.#e,d=this.#t,f=this.#r,v=this.#i;for(let m=l;m<u;m++){let y=a[m],x=s[m]=i*y+n*p+o*d-e*f-t*v+1e-18-1e-18;d=p,p=y,v=f,f=x}this.#e=p,this.#t=d,this.#r=f,this.#i=v}processFrame({a1:e,a2:t,b0:i,b1:n,b2:o},a){let s=i*a+n*this.#e+o*this.#t-e*this.#r-t*this.#i+1e-18-1e-18;return this.#t=this.#e,this.#e=a,this.#i=this.#r,this.#r=s,s}},So=class{#e;#t;constructor(e){this.#e=R.create(()=>new Pt,e),this.#t=this.#e.length}get order(){return this.#t}set order(e){this.#t!==e&&(this.#t=e,this.reset())}reset(){this.#e.forEach(e=>e.reset())}process(e,t,i,n,o){for(let a=0;a<this.#t;a++)this.#e[a].process(e,t,i,n,o),t=i}processFrame(e,t){for(let i=0;i<this.#t;i++)t=this.#e[i].processFrame(e,t);return t}},zu=512,Qh=class{#e;#t=new sn;#r;#i=-1;constructor(e,t,i){this.#r=new So(4),this.#e=new Float32Array(zu+1);let n=Math.log(t/e),o=1/i;for(let a=0;a<=zu;a++)this.#e[a]=e*Math.exp(a/zu*n)*o}get order(){return this.#r.order}set order(e){this.#r.order=e}reset(){this.#r.reset()}process(e,t,i,n,o,a){let s=this.#e,l=this.#r,u=this.#t,p=n/l.order**1.25,d=o,f=this.#i;for(;d<a;){let v=Math.floor(Qr(i[d])*zu),m=d+1;for(;m<a&&Math.floor(Qr(i[m])*zu)===v;)++m;v!==f&&(f=v,u.setLowpassParams(s[v],p)),l.process(u,e,t,d,m),d=m}this.#i=f}};var PP=Math.log(10)/20,Uu=(r=60,e=440)=>e*Math.pow(2,(r+3)/12-6);var Oe=r=>Math.exp(r*PP),Mx=r=>Math.log(r)/PP,cl=r=>Oe(20*Math.log10(r));var wB=.02,SP=1e3,Yh=class{#e;#t;#r;#i;#n;#o;#a=NaN;#c=NaN;#s=0;#l=0;#u=0;#d=8;#p=0;#h=1;#f=!1;constructor(e){this.#e=e,this.#t=Math.ceil(e*wB)|0,this.#r=new sn,this.#r.setLowpassParams(.5),this.#i=[new Pt,new Pt],this.#n=[new Float32Array(128),new Float32Array(128)],this.#o=new Float32Array(2)}process(e,t,i,n){let[o,a]=e,[s,l]=t,[u,p]=this.#n;this.#i[0].process(this.#r,o,u,i,n),this.#i[1].process(this.#r,a,p,i,n);let d=Oe(this.#p),f=Oe(-this.#p/2),v=this.#e/this.#a,m=Math.pow(2,this.#d)-1,y=1/m;for(let x=i;x<n;x++)this.#l>0&&(this.#a+=this.#s,--this.#l===0&&(this.#s=0,this.#a=this.#c),this.#r.setLowpassParams(Math.max(this.#a,SP)/this.#e)),this.#u+=1,this.#u>=v&&(this.#u-=v,this.#o[0]=le(Math.round(u[x]*d*m)*y,-1,1),this.#o[1]=le(Math.round(p[x]*d*m)*y,-1,1)),s[x]=(o[x]*(1-this.#h)+this.#o[0]*this.#h)*f,l[x]=(a[x]*(1-this.#h)+this.#o[1]*this.#h)*f;this.#f=!0}setCrush(e){let t=xP(20,this.#e*.5,e);this.#f&&isFinite(this.#a)?(this.#c=t,this.#s=(t-this.#a)/this.#t,this.#l=this.#t):(this.#a=t,this.#r.setLowpassParams(Math.max(this.#a,SP)/this.#e))}setBitDepth(e){this.#d=le(e,1,16)}setBoost(e){this.#p=e}setMix(e){this.#h=Qr(e)}reset(){this.#f=!1,this.#c=NaN,this.#s=0,this.#l=0,this.#u=0,this.#o.fill(0),this.#i[0].reset(),this.#i[1].reset()}};var Xh=class r{static#e=10;#t=1;#r=0;#i=0;#n=0;#o=0;#a=0;set(e,t,i){this.#t=e,this.#r=t*r.#e,this.#i=Gh(1e-5,1-1e-5,i),this.#n=2**Math.abs(this.#r),this.#o=1/this.#i,this.#a=1/(1-this.#i)}compute(e){let t=e-Math.floor(e),i,n,o,a;return this.#r<0?(i=1-t,n=1-this.#i,o=this.#a,a=this.#o):(i=t,n=this.#i,o=this.#o,a=this.#a),i<=n?1-(1-i*o)**this.#n*this.#t:((1-i)*a)**this.#n*this.#t-this.#t+1}};var ju;(function(r){r.Comparator=(e,t)=>e.position-t.position,r.PositionExtractor=e=>e.position})(ju||(ju={}));var Oa;(function(r){r.complete=e=>e.position+e.duration,r.DescendingComparator=(e,t)=>r.complete(t)-r.complete(e)})(Oa||(Oa={}));var qt;(function(r){r.globalToLocal=(t,i)=>Tu(i-t.position+t.loopOffset,t.loopDuration),r.locateLoop=({position:t,complete:i,loopOffset:n,loopDuration:o},a,s)=>{let l=t-n,u=l+o;if(l>=s||u<=a)return g.None;let p=Math.max(l,a),d=Math.min(u,s);return g.wrap({index:0,rawStart:l,rawEnd:u,regionStart:Math.max(l,t),regionEnd:Math.min(u,i),resultStart:p,resultEnd:d,resultStartValue:l<p?(p-l)/o:0,resultEndValue:u>d?(d-l)/o:1})};function*e({position:t,complete:i,loopOffset:n,loopDuration:o},a,s){let l=t-n,u=Math.max(t,a),p=Math.min(i,s),d=Math.floor((u-l)/o),f=l+d*o;for(;f<p;){let v=f+o,m=Math.max(f,t),y=Math.min(v,i),x=Math.max(f,u),D=Math.min(v,p),M=f<x?(x-f)/o:0,O=v>D?(D-f)/o:1;yield{index:d++,rawStart:f,rawEnd:v,regionStart:m,regionEnd:y,resultStart:x,resultEnd:D,resultStartValue:M,resultEndValue:O},f=v}}r.locateLoops=e})(qt||(qt={}));var xr=class r{static DefaultComparator=(e,t)=>e.position-t.position;static create(e){return new r(e??r.DefaultComparator)}#e;constructor(e){this.#e=new ef(e)}add(e){this.#e.add(e)}remove(e){return this.#e.remove(e)}contains(e){return this.#e.contains(e)}clear(){this.#e.clear()}optAt(e){return this.#e.optAt(e)}asArray(){return this.#e.asArray()}lowerEqual(e,t){return this.#e.lowerEqual(e,t)}greaterEqual(e,t){return this.#e.greaterEqual(e,t)}floorLastIndex(e){return this.#e.floorLastIndex(e)}ceilFirstIndex(e){return this.#e.ceilFirstIndex(e)}iterateFrom(e,t){return this.#e.isEmpty()?Zn.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t,i){return this.#e.isEmpty()?Zn.empty():this.#e.iterate(this.#e.ceilFirstIndex(e),t,i)}first(){return this.#e.optAt(0)}last(){return this.#e.optAt(this.#e.length()-1)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}},Eo=class r{static Comparator=(e,t)=>e.position-t.position;static create(e){return new r(e)}#e;constructor(e=r.Comparator){this.#e=new ef(e)}add(e){this.#e.add(e)}remove(e){return this.#e.remove(e)}contains(e){return this.#e.contains(e)}clear(){this.#e.clear()}optAt(e){return this.#e.optAt(e)}asArray(){return this.#e.asArray()}lowerEqual(e,t){return this.#e.lowerEqual(e,t)}greaterEqual(e,t){return this.#e.greaterEqual(e,t)}floorLastIndex(e){return this.#e.floorLastIndex(e)}ceilFirstIndex(e){return this.#e.ceilFirstIndex(e)}iterateFrom(e,t){return this.#e.isEmpty()?Zn.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t){if(this.#e.isEmpty())return Zn.empty();let i=Math.max(0,this.#e.floorLastIndex(e)),n=this.#e.optAt(i);if(n===null)return Zn.empty();for(;n.position+n.duration<=e;)if(n=this.#e.optAt(++i),n===null||n.position>=t)return Zn.empty();return this.#e.iterate(i,t)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}},ul=class{#e;constructor(){this.#e=[]}addAndRetain(e){if(this.#e.length===0)this.#e.push(e);else{let t=Ye.leftMost(this.#e,e,Oa.DescendingComparator);this.#e.splice(t,0,e)}}*overlapping(e,t){let i=this.#e.filter(n=>n.position<=e&&e<n.position+n.duration);yield*Z(t)?i.sort(t):i}*releaseLinearCompleted(e){if(this.#e.length!==0)for(let t=this.#e.length-1;t>=0;t--){let i=this.#e[t];if(Oa.complete(i)<e)this.#e.splice(t,1),yield i;else return}}*releaseAll(){if(this.#e.length!==0)for(let e=this.#e.length-1;e>=0;e--){let t=this.#e[e];Number.POSITIVE_INFINITY>t.duration&&(this.#e.splice(e,1),yield t)}}isEmpty(){return this.#e.length===0}nonEmpty(){return this.#e.length>0}clear(){R.clear(this.#e)}},ef=class{comparator;#e=[];#t=!1;modCount=0;constructor(e){this.comparator=e}add(e){++this.modCount,this.#e.push(e),this.#e.length>1&&(this.#t=!0)}remove(e){++this.modCount;let t=this.#e.indexOf(e);return t===-1?!1:(this.#e.splice(t,1),!0)}contains(e){if(this.#e.length===0)return!1;this.#t&&this.#r();let i=e.position,n=Ye.leftMostMapped(this.#e,i,Cu,ju.PositionExtractor);for(let o=n;o<this.#e.length;o++){let a=this.#e[o];if(a===e)return!0;if(a.position!==i)return!1}return!1}clear(){++this.modCount,R.clear(this.#e),this.#t=!1}optAt(e){return e<0||e>=this.#e.length?null:(this.#t&&this.#r(),this.#e[e])}asArray(){return this.#t&&this.#r(),this.#e}lowerEqual(e,t){if(t===void 0)return this.optAt(this.floorLastIndex(e));let i=this.floorLastIndex(e);for(;i>=0;){let n=this.#e[i--];if(t(n))return n}return null}greaterEqual(e,t){if(t===void 0)return this.optAt(this.ceilFirstIndex(e));let i=this.ceilFirstIndex(e);for(;i<this.#e.length;){let n=this.#e[i++];if(t(n))return n}return null}floorLastIndex(e){return this.#t&&this.#r(),Ye.rightMostMapped(this.#e,e,Cu,ju.PositionExtractor)}ceilFirstIndex(e){return this.#t&&this.#r(),Ye.leftMostMapped(this.#e,e,Cu,ju.PositionExtractor)}iterateFrom(e,t){let i=this.floorLastIndex(e),n=i;if(n<0)return this.iterate(0,nr.MAX_VALUE,t);for(;n>=0;){let o=this.optAt(n);if(o!==null&&t!==void 0&&t(o))return this.iterate(n,nr.MAX_VALUE,t);n--}return this.iterate(i,nr.MAX_VALUE,t)}length(){return this.#e.length}isEmpty(){return this.#e.length===0}onIndexingChanged(){this.#t=this.length()>1}*iterate(e,t,i=Po.alwaysTrue){for(this.#t&&this.#r();e<this.#e.length;){let n=this.#e[e++];if(n.position>=t)return;i(n)&&(yield n)}}#r(){this.#e.sort(this.comparator),this.#t=!1}};var Lh=class r{static reverse(e){return e=(e&1431655765)<<1|e>>>1&1431655765,e=(e&858993459)<<2|e>>>2&858993459,e=(e&252645135)<<4|e>>>4&252645135,e=e<<24|(e&65280)<<8|e>>>8&65280|e>>>24,e}#e;#t;#r;#i;constructor(e){this.#e=e;let t=e/2;this.#t=32-Math.floor(Math.log2(e))|0,this.#r=new Float32Array(t),this.#i=new Float32Array(t);for(let i=0;i<t;i++){let n=2*Math.PI*i/e;this.#r[i]=Math.cos(n),this.#i[i]=Math.sin(n)}}process(e,t){let i,n,o,a;for(let u=0;u<this.#e;++u)n=r.reverse(u)>>>this.#t,n>u&&(a=e[u],e[u]=e[n],e[n]=a,a=t[u],t[u]=t[n],t[n]=a);let s=this.#r,l=this.#i;for(let u=2;u<=this.#e;u<<=1){let p=u>>1,d=this.#e/u;for(i=0;i<this.#e;i+=u){let f=i+p;for(n=i,o=0;n<f;n++,o=o+d|0){let v=n+p|0,m=s[o],y=l[o],x=e[v],D=t[v],M=x*m+D*y,O=D*m-x*y,T=e[n],V=t[n];e[v]=T-M,t[v]=V-O,e[n]=T+M,t[n]=V+O}}if(u===this.#e)break}}};var Dx=r=>{let e=.25*r+.25;return 4*(Math.abs(e-Math.round(e))-.25)};var Ix=(r,e)=>Math.floor(3840/e)*r,EP=(r,e=4,t=4)=>{let i=Ix(1,t),n=Math.floor(r/i),o=Math.floor(n/e),s=(Math.floor(r)-Ix(o*e,t))%i,l=Math.floor(s/240),u=s%240;return{bars:o,beats:n-o*e,semiquavers:l,ticks:u}},BP=(r,e)=>r*e/60*960,FP=(r,e)=>r*60/960/e,bB=(r,e)=>e*60/960/r,AB=(r,e,t)=>BP(r/t,e),_B=(r,e,t)=>FP(r,e)*t,Q={Bar:3840,Quarter:960,SemiQuaver:240,fromSignature:Ix,toParts:EP,secondsToPulses:BP,pulsesToSeconds:FP,secondsToBpm:bB,samplesToPulses:AB,pulsesToSamples:_B,toString:(r,e=4,t=4)=>{let{bars:i,beats:n,semiquavers:o,ticks:a}=EP(r|0,e,t);return`${i+1}.${n+1}.${o+1}:${a}`}};var or;(function(r){r.builder=()=>new e,r.toDouble=([t,i])=>t/i,r.toPPQN=([t,i])=>Q.fromSignature(t,i);class e{#e=[];add(i){return this.#e.push(i),this}asArray(){return this.#e}asAscendingArray(){return this.#e.toSorted((i,n)=>r.toDouble(i)-r.toDouble(n))}asDescendingArray(){return this.#e.toSorted((i,n)=>r.toDouble(n)-r.toDouble(i))}}})(or||(or={}));var ln=class{static*iterate(e,t,i){let n=Math.ceil(e/i),o=n*i;for(;o<t;)yield o,o=++n*i}static*iterateWithIndex(e,t,i){let n=Math.ceil(e/i),o=n*i;for(;o<t;)yield{position:o,index:n},o=++n*i}};var dl=class{#e=0;#t=NaN;#r=NaN;#i=0;#n=0;constructor(){}reset(){this.#e=0,this.#t=NaN,this.#r=NaN,this.#i=0,this.#n=0}init(e){this.#e=e,isNaN(this.#t)&&(this.#t=this.#e)}currentFrequency(){return this.#t}glideTo(e,t){if(t===0){this.#e=e;return}this.#e=this.#t,this.#r=e,this.#i=0,this.#n=t}process(e,t,i,n){if(isNaN(this.#r)){for(let o=i;o<n;o++)e[o]*=this.#e;this.#t=this.#e}else{let o=Q.samplesToPulses(1,t,sampleRate);for(let a=i;a<n;a++){if(this.#i+=o/this.#n,this.#i>=1){this.#i=1,this.#e=this.#r,this.#r=NaN;for(let s=a;s<n;s++)e[s]*=this.#e;break}e[a]*=this.#t=this.#e+(this.#r-this.#e)*this.#i}}}advance(e,t,i){if(isNaN(this.#r))this.#t=this.#e;else{let n=Q.samplesToPulses(i-t,e,sampleRate);this.#i+=n/this.#n,this.#i>=1?(this.#i=1,this.#e=this.#t=this.#r,this.#r=NaN):this.#t=this.#e+(this.#r-this.#e)*this.#i}}};var tf=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}addVertex(e){I(!this.#e.includes(e),"Vertex already exists"),this.#e.push(e),I(!this.#t.has(e),"Predecessor already exists"),this.#t.set(e,[])}removeVertex(e){R.remove(this.#e,e);let t=this.#t.delete(e);I(t,"Predecessor does not exists")}getPredecessors(e){return this.#t.get(e)??R.empty()}predecessors(){return this.#t}vertices(){return this.#e}addEdge([e,t]){let i=ee(this.#t.get(t),`[add] Edge has unannounced vertex. (${t})`);I(!i.includes(e),`${e} is already marked.`),i.push(e)}removeEdge([e,t]){let i=ee(this.#t.get(t),`[remove] Edge has unannounced vertex. (${t})`);I(i.includes(e),`${e} is not marked.`),R.remove(i,e)}isEmpty(){return this.#e.length===0}},rf=class{#e;#t;#r;#i;#n;constructor(e){this.#e=e,this.#t=[],this.#r=new Set,this.#i=new Set,this.#n=new Map}update(){this.#o(),this.#e.vertices().forEach(e=>this.#a(e))}sorted(){return this.#t}hasLoops(){return this.#i.size!==0}#o(){this.#c();let e=new Map;for(let i of this.#e.vertices())this.#n.set(i,new Set),e.set(i,new Set);for(let i of this.#e.vertices())for(let n of this.#e.getPredecessors(i))ee(this.#n.get(n),`Could not find Successor for ${n}`).add(i);let t;do{t=!1;for(let i of this.#e.vertices()){ee(e.get(i)).clear();for(let n of ee(this.#n.get(i)))for(let o of ee(this.#n.get(n)))this.#n.get(i)?.has(o)||(t=!0,ee(e.get(i)).add(o))}for(let i of this.#e.vertices()){let n=ee(this.#n.get(i));ee(e.get(i)).forEach(o=>n.add(o))}}while(t)}#a(e){if(!this.#r.has(e)){this.#r.add(e);for(let t of this.#e.getPredecessors(e)){if(ee(this.#n.get(e)).has(t)){this.#i.add(e),this.#i.add(t);continue}this.#a(t)}this.#t.push(e)}}#c(){R.clear(this.#t),this.#r.clear(),this.#i.clear(),this.#n.clear()}};var Lu;(function(r){r.Identity={warp:e=>e,unwarp:e=>e}})(Lu||(Lu={}));var nf=class{#e;constructor(e){this.#e=e}warp(e){return this.#t(!0,e)}unwarp(e){return this.#t(!1,e)}#t(e,t){let i=this.#e.duration(),n=Kn(t,i),o=(t-n)/i,a=e?this.#e.fx(o):this.#e.fy(o);return n+a*i}};var Le;(function(r){r[r.sine=0]="sine",r[r.triangle=1]="triangle",r[r.saw=2]="saw",r[r.square=3]="square"})(Le||(Le={}));var of=class{sampleRate;#e=0;constructor(e){this.sampleRate=e}fill(e,t,i,n,o){let a=i/this.sampleRate;switch(t){case Le.sine:{for(let s=n;s<o;s++)e[s]=Math.sin(this.#e*Math.PI*2),this.#e+=a,this.#e>=1&&(this.#e-=1);break}case Le.triangle:{for(let s=n;s<o;s++){let l=this.#e%1;e[s]=4*Math.abs(l-.5)-1,this.#e+=a,this.#e>=1&&(this.#e-=1)}break}case Le.saw:{for(let s=n;s<o;s++){let l=this.#e%1;e[s]=2*l-1,this.#e+=a,this.#e>=1&&(this.#e-=1)}break}case Le.square:{for(let s=n;s<o;s++){let l=this.#e%1;e[s]=l<.5?1:-1,this.#e+=a,this.#e>=1&&(this.#e-=1)}break}}}reset(){this.#e=0}};var cn;(function(r){r[r.Linear=0]="Linear",r[r.EqualPower=1]="EqualPower"})(cn||(cn={}));var af;(function(r){r.BlackKeyIndices=[1,3,6,8,10],r.BlackKeyBits=r.BlackKeyIndices.reduce((t,i)=>t|=1<<i,0),r.Names={English:["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],German:["C","Cis","D","Dis","E","F","Fis","G","Gis","A","Ais","H"],Solfege:["Do","Do#","R\xE9","R\xE9#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],French:["Do","Do#","R\xE9","R\xE9#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],Spanish:["Do","Do#","Re","Re#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],Japanese:["\u30C9","\u30C9\u266F","\u30EC","\u30EC\u266F","\u30DF","\u30D5\u30A1","\u30D5\u30A1\u266F","\u30BD","\u30BD\u266F","\u30E9","\u30E9\u266F","\u30B7"]},r.isBlackKey=t=>(r.BlackKeyBits&1<<t%12)!==0,r.toFullString=t=>`${r.Names.English[t%12]}${Math.floor(t/12)-2}`,r.keyboardTracking=(t,i)=>Qr((t-60)*i);class e{#e;#t;constructor(i,...n){this.#e=i,this.#t=n.reduce((o,a)=>o|=1<<a,0)}get name(){return this.#e}get bits(){return this.#t}has(i){return(this.#t&1<<i%12)!==0}equals(i){return this.#t===i.bits}}r.StockScales=[new e("Major",0,2,4,5,7,9,11),new e("Natural Minor",0,2,3,5,7,8,10),new e("Harmonic Minor",0,2,3,5,7,8,11),new e("Melodic Minor",0,2,3,5,7,9,11),new e("Dorian",0,2,3,5,7,9,10),new e("Phrygian",0,1,3,5,7,8,10),new e("Lydian",0,2,4,6,7,9,11),new e("Mixolydian",0,2,4,5,7,9,10),new e("Locrian",0,1,3,5,6,8,10),new e("Pentatonic Major",0,2,4,7,9),new e("Pentatonic Minor",0,3,5,7,10),new e("Blues",0,3,5,6,7,10),new e("Whole Tone",0,2,4,6,8,10),new e("Diminished",0,2,3,5,6,8,9,11),new e("Augmented",0,3,4,7,8,11)]})(af||(af={}));var ar;(function(r){r.isOfType=e=>e.type==="note-event",r.Comparator=(e,t)=>{let i=e.position-t.position;if(i!==0)return i;let n=e.pitch-t.pitch;return n!==0?n:0},r.curveFunc=(e,t)=>t<0?e**2**-t:1-(1-e)**2**t,r.inverseCurveFunc=(e,t)=>t<0?e**2**t:1-Math.max(0,1-e)**2**-t,r.CompleteComparator=(e,t)=>{let i=Oa.complete(e)-Oa.complete(t);return i!==0?i:e.pitch-t.pitch}})(ar||(ar={}));var Ku=class{#e;#t=0;#r=0;constructor(e){this.#e=1/e}generate(e,t,i,n,o){let a=t*this.#e;switch(i){case Le.sine:this.#i(e,a,n,o);break;case Le.saw:this.#n(e,a,n,o);break;case Le.square:this.#o(e,a,n,o);break;case Le.triangle:this.#a(e,a,n,o);break}}generateFromFrequencies(e,t,i,n,o){switch(i){case Le.sine:this.#c(e,t,n,o);break;case Le.saw:this.#s(e,t,n,o);break;case Le.square:this.#l(e,t,n,o);break;case Le.triangle:this.#u(e,t,n,o);break}}#i(e,t,i,n){let o=this.#t;for(let a=i;a<n;a++)e[a]=Math.sin(2*Math.PI*(o%1)),o+=t;this.#t=o}#n(e,t,i,n){let o=this.#t;for(let a=i;a<n;a++){let s=o%1;e[a]=2*s-1-un(s,t),o+=t}this.#t=o}#o(e,t,i,n){let o=this.#t;for(let a=i;a<n;a++){let s=o%1;e[a]=(s<.5?1:-1)+un(s,t)-un((s+.5)%1,t),o+=t}this.#t=o}#a(e,t,i,n){let o=this.#t,a=this.#r,s=4*t;for(let l=i;l<n;l++){let u=o%1,p=(u<.5?1:-1)+un(u,t)-un((u+.5)%1,t);a=a*.9995+p*s,e[l]=a,o+=t}this.#t=o,this.#r=a}#c(e,t,i,n){let o=this.#e,a=this.#t;for(let s=i;s<n;s++)e[s]=Math.sin(2*Math.PI*(a%1)),a+=t[s]*o;this.#t=a}#s(e,t,i,n){let o=this.#e,a=this.#t;for(let s=i;s<n;s++){let l=t[s]*o,u=a%1;e[s]=2*u-1-un(u,l),a+=l}this.#t=a}#l(e,t,i,n){let o=this.#e,a=this.#t;for(let s=i;s<n;s++){let l=t[s]*o,u=a%1;e[s]=(u<.5?1:-1)+un(u,l)-un((u+.5)%1,l),a+=l}this.#t=a}#u(e,t,i,n){let o=this.#e,a=this.#t,s=this.#r;for(let l=i;l<n;l++){let u=t[l]*o,p=a%1,d=(p<.5?1:-1)+un(p,u)-un((p+.5)%1,u);s=s*.9995+d*(4*u),e[l]=s,a+=u}this.#t=a,this.#r=s}},un=(r,e)=>r<e?(r/=e,r+r-r*r-1):r>1-e?(r=(r-1)/e,r*r+r+r+1):0;var Gn;(function(r){r.zero=()=>({ll:0,lr:0,rl:0,rr:0}),r.identity=()=>({ll:1,lr:0,rl:0,rr:1}),r.update=(e,{gain:t,panning:i,invertL:n,invertR:o,stereo:a,swap:s},l=cn.EqualPower)=>{let[u,p]=r.panningToGains(i,l),d=u*t,f=p*t;n&&(d*=-1),o&&(f*=-1);let v=Math.max(0,-a),m=Math.max(0,a),y=1-m,x=1+m,D=v*.5,M=1-v,O=(y+x)*.5,T=(y-x)*.5,V=(y-x)*.5,Y=(y+x)*.5,te=d*(D+M)*O+f*D*T,q=d*(D+M)*V+f*D*Y,ge=d*D*O+f*(D+M)*T,se=d*D*V+f*(D+M)*Y;s?(e.ll=q,e.rl=te,e.lr=se,e.rr=ge):(e.ll=te,e.lr=ge,e.rl=q,e.rr=se)},r.panningToGains=(e,t)=>{let i=le(e,-1,1);switch(t){case cn.Linear:return[Math.min(1-i,1),Math.min(i+1,1)];case cn.EqualPower:return[Math.cos((i+1)*Px),Math.sin((i+1)*Px)]}},r.applyFrame=(e,t,i)=>[e.ll*t+e.rl*i,e.lr*t+e.rr*i],r.processFrames=(e,t,i,n,o)=>{let[a,s]=t,[l,u]=i;for(let p=n;p<o;p++){let d=a[p],f=s[p];l[p]=e.ll*d+e.rl*f,u[p]=e.lr*d+e.rr*f}},r.replaceFrames=(e,[t,i],n,o)=>{for(let a=n;a<o;a++){let s=t[a],l=i[a];t[a]=e.ll*s+e.rl*l,i[a]=e.lr*s+e.rr*l}}})(Gn||(Gn={}));var Ht;(function(r){r.linear=(i,n=.005)=>new e(Math.ceil(i*n)|0),r.stereoMatrix=(i,n=.005)=>new t(Math.ceil(i*n)|0);class e{#e;#t=0;#r=0;#i=0;#n=0;constructor(n){this.#e=n}set(n,o){this.#t!==n&&(o===!0?(this.#r=n,this.#i=(n-this.#t)/this.#e,this.#n=this.#e):(this.#t=this.#r=n,this.#i=0,this.#n=0))}get(){return this.#t}moveAndGet(){return 0<this.#n&&(this.#t+=this.#i,--this.#n===0&&(this.#i=0,this.#t=this.#r)),this.#t}isFixed(n){return this.#t===n&&this.#n===0}isInterpolating(){return this.#n>0}}class t{#e;#t=Gn.zero();#r=Gn.zero();#i=Gn.zero();#n=0;constructor(n){this.#e=n}update(n,o,a){Gn.update(this.#r,n,o),a===!0?(this.#i.ll=(this.#r.ll-this.#t.ll)/this.#e,this.#i.lr=(this.#r.lr-this.#t.lr)/this.#e,this.#i.rl=(this.#r.rl-this.#t.rl)/this.#e,this.#i.rr=(this.#r.rr-this.#t.rr)/this.#e,this.#n=this.#e):(this.#t.ll=this.#r.ll,this.#t.lr=this.#r.lr,this.#t.rl=this.#r.rl,this.#t.rr=this.#r.rr,this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#n=0)}processFrames(n,o,a,s){let[l,u]=n,[p,d]=o;if(this.isInterpolating())for(let f=a;f<s;f++){let v=l[f],m=u[f],y=this.moveAndGet();p[f]=y.ll*v+y.rl*m,d[f]=y.lr*v+y.rr*m}else{let f=this.#r;for(let v=a;v<s;v++){let m=l[v],y=u[v];p[v]=f.ll*m+f.rl*y,d[v]=f.lr*m+f.rr*y}}}set(n,o){this.#o(n)||(o===!0?(this.#r.ll=n.ll,this.#r.lr=n.lr,this.#r.rl=n.rl,this.#r.rr=n.rr,this.#i.ll=(n.ll-this.#t.ll)/this.#e,this.#i.lr=(n.lr-this.#t.lr)/this.#e,this.#i.rl=(n.rl-this.#t.rl)/this.#e,this.#i.rr=(n.rr-this.#t.rr)/this.#e,this.#n=this.#e):(this.#t.ll=this.#r.ll=n.ll,this.#t.lr=this.#r.lr=n.lr,this.#t.rl=this.#r.rl=n.rl,this.#t.rr=this.#r.rr=n.rr,this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#n=0))}get(){return this.#t}moveAndGet(){return 0<this.#n&&(this.#t.ll+=this.#i.ll,this.#t.lr+=this.#i.lr,this.#t.rl+=this.#i.rl,this.#t.rr+=this.#i.rr,--this.#n===0&&(this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#t.ll=this.#r.ll,this.#t.lr=this.#r.lr,this.#t.rl=this.#r.rl,this.#t.rr=this.#r.rr)),this.#t}isFixed(n){return this.#o(n)&&this.#n===0}isInterpolating(){return this.#n>0}#o(n){return this.#t.ll===n.ll&&this.#t.lr===n.lr&&this.#t.rl===n.rl&&this.#t.rr===n.rr}}r.StereoMatrixRamp=t})(Ht||(Ht={}));var Wu=new Float32Array([-.00048076361,0,.00174689293,0,-.00421638042,0,.00854519755,0,-.01627072692,0,.03203375191,0,-.08251235634,0,.31203505397,.5,.31203505397,0,-.08251235634,0,.03203375191,0,-.01627072692,0,.00854519755,0,-.00421638042,0,.00174689293,0,-.00048076361]),Cx=new Float32Array(12),NP=new Float32Array(11);for(let r=0,e=0,t=0;r<Wu.length;r++)r%2===0?Cx[e++]=Wu[r]:NP[t++]=Wu[r];var Tx=class{#e=new Float32Array(Cx.length);#t=new Float32Array(Wu.length);#r=0;#i=0;reset(){this.#e.fill(0),this.#t.fill(0),this.#r=0,this.#i=0}upsample(e,t,i,n){let o=this.#e,a=Cx,s=NP;for(let l=i;l<n;l++){let u=e[l],p=(l-i)*2;o[this.#r]=u;let d=0;for(let v=0;v<a.length;v++){let m=(this.#r-v+o.length)%o.length;d+=o[m]*a[v]}t[p]=d*2;let f=0;for(let v=0;v<s.length;v++){let m=(this.#r-v+o.length-1)%o.length;f+=o[m]*s[v]}t[p+1]=f*2,this.#r=(this.#r+1)%o.length}}downsample(e,t,i,n){let o=this.#t,a=Wu;for(let s=i;s<n;s++){let l=(s-i)*2;o[this.#i]=e[l],this.#i=(this.#i+1)%o.length,o[this.#i]=e[l+1],this.#i=(this.#i+1)%o.length;let u=0;for(let p=0;p<a.length;p++){let d=(this.#i-1-p+o.length)%o.length;u+=o[d]*a[p]}t[s]=u}}},sf=class{#e;#t;#r;constructor(e){this.#e=e;let t=e===2?1:e===4?2:3;this.#t=R.create(()=>new Tx,t),this.#r=R.create(i=>new Float32Array(128*(2<<i)),t-1)}reset(){this.#t.forEach(e=>e.reset())}upsample(e,t,i,n){let o=n-i,a=e,s=i,l=n;for(let u=0;u<this.#t.length;u++){let d=u===this.#t.length-1?t:this.#r[u];this.#t[u].upsample(a,d,s,l),a=d,s=0,l=o*(2<<u)}}downsample(e,t,i,n){let o=n-i,a=e,s=o*this.#e;for(let l=this.#t.length-1;l>=0;l--){let u=l===0,p=u?t:this.#r[l-1],d=u?i:0,f=u?n:s/2;this.#t[l].downsample(a,p,d,f),a=p,s=f}}},lf=class{#e;#t;constructor(e){this.#e=new sf(e),this.#t=new sf(e)}reset(){this.#e.reset(),this.#t.reset()}upsample(e,t,i,n){this.#e.upsample(e[0],t[0],i,n),this.#t.upsample(e[1],t[1],i,n)}downsample(e,t,i,n){this.#e.downsample(e[0],t[0],i,n),this.#t.downsample(e[1],t[1],i,n)}};var pl=class{#e;#t;#r;#i;constructor(e){this.#e=new Float32Array(e),this.#t=1/e,this.#r=0,this.#i=0}pushPop(e){let t=e*e;return this.#i-=this.#e[this.#r],this.#i+=t,this.#e[this.#r]=t,++this.#r===this.#e.length&&(this.#r=0),this.#i<=0?0:Math.sqrt(this.#i*this.#t)}processBlock(e,t,i){let n=this.#e,o=n.length,a=this.#r,s=this.#i;for(let l=t;l<i;l++){let u=e[l]*e[l];s+=u-n[a],n[a]=u,++a===o&&(a=0)}return this.#r=a,this.#i=s,s<=0?0:Math.sqrt(s*this.#t)}clear(){this.#e.fill(0),this.#i=0,this.#r=0}};var cf=class r{static#e=.003;static#t=.02;#r;#i;#n=0;constructor(e){this.#r=Math.pow(.01,1/(r.#e*e)),this.#i=Math.pow(.01,1/(r.#t*e))}clear(){this.#n=0}replace(e,t,i){let n=this.#r,o=this.#i,[a,s]=e.channels(),l=this.#n;for(let u=t;u<i;++u){let p=a[u],d=s[u],f=Math.max(Math.abs(p),Math.abs(d));if(l=f>l?n*(l-f)+f:o*(l-f)+f,l>1){let v=1/l;a[u]=p*v,s[u]=d*v}}this.#n=l}};var Ii=class{#e;value=0;constructor(e,t){this.#e=1-Math.exp(-1/(e*t))}process(e){return this.value+=this.#e*(e-this.value),this.value}};var uf=class{#e=new U;#t;#r;constructor(e){this.#t=this.#e.own(new re),this.#e.own(e.subscribe(t=>{this.#r=t.getValue(),this.#t.notify(this)})),this.#r=e.getValue()}subscribe(e){return this.#t.subscribe(e)}getTempoAt(e){return this.#r}ppqnToSeconds(e){return Q.pulsesToSeconds(e,this.#r)}secondsToPPQN(e){return Q.secondsToPulses(e,this.#r)}intervalToSeconds(e,t){return Q.pulsesToSeconds(t-e,this.#r)}intervalToPPQN(e,t){return Q.secondsToPulses(t-e,this.#r)}terminate(){this.#t.terminate()}};var sr;(function(r){r.Musical="musical",r.Seconds="seconds"})(sr||(sr={}));var Bo;(function(r){function e(i,n,o){return new Ox(i,n,o)}r.musical=e;function t(i,n,o,a){return new Rx(i,n,o,a)}r.aware=t})(Bo||(Bo={}));var Rx=class{#e;#t;#r;#i;constructor(e,t,i,n){this.#i=n,this.#t=t,this.#r=i,this.#e=e}toPPQN(){let e=this.#i.getValue();if(this.getTimeBase()===sr.Musical)return e;let t=this.#r.getValue(),i=this.#e.ppqnToSeconds(t),n=i+e;return this.#e.intervalToPPQN(i,n)}fromPPQN(e){if(this.getTimeBase()===sr.Musical)this.#i.setValue(e);else{let t=this.#r.getValue(),i=this.#e.intervalToSeconds(t,t+e);this.#i.setValue(i)}}toSeconds(){let e=this.#i.getValue();if(this.getTimeBase()===sr.Seconds)return e;let t=this.#r.getValue();return this.#e.intervalToSeconds(t,t+e)}toSamples(e){return this.toSeconds()*e}rawValue(){return this.#i.getValue()}getTimeBase(){return Jr(this.#t.getValue(),sr)}},Ox=class{#e;#t;#r;constructor(e,t,i){this.#r=i,this.#t=t,this.#e=e}toPPQN(){return this.#r.getValue()}fromPPQN(e){this.#r.setValue(e)}toSeconds(){let e=this.#r.getValue(),t=this.#t.getValue();return this.#e.intervalToSeconds(t,t+e)}toSamples(e){return this.toSeconds()*e}rawValue(){return this.#r.getValue()}getTimeBase(){return sr.Musical}};var df=Q.fromSignature(1,384);var Fo={None:{type:"none"},Linear:{type:"linear"},Curve:r=>({type:"curve",slope:r})},pf;(function(r){r.Comparator=(n,o)=>{let a=n.position-o.position;if(a!==0)return a;let s=n.index-o.index;return s!==0?s:n===o?0:F(`${n} and ${o} are identical in terms of comparison`)};function*e(n,o,a){if(n.isEmpty())return Xe.empty();for(let s of n.iterateFrom(o))if(yield s,s.position>=a)return}r.iterateWindow=e,r.nextEvent=(n,o)=>{let a=n.asArray(),s=Ye.rightMost(a,o,r.Comparator);return s===-1?null:a[s+1]??null},r.valueAt=(n,o,a)=>{if(n.isEmpty())return a;let s=n.iterateFrom(o),{done:l,value:u}=s.next();if(l)return a;if(u.position<=o){let{done:p,value:d}=s.next();if(p)return u.value;if(o<d.position)return i(u,d,o);if(u.interpolation===Fo.None)return u.value}return u.value};function*t(n,o,a,s){if(n.isEmpty())return;let l=n.iterateFrom(o),{done:u,value:p}=l.next();if(u)return;let d=a/s,f=p;if(f.position>o){for(;o<f.position;)if(yield{position:o,value:f.value},o+=d,o>a)return;f.position<=a&&(yield f)}for(;o<=a;){let{done:v,value:m}=l.next();if(v)break;for(;o<m.position;){if(o>a)return;yield{position:o,value:i(f,m,o)},o+=d}m.position<a&&(f.interpolation===Fo.None&&(yield{position:m.position,value:f.value}),yield m),f=m}for(;o<=a;)yield{position:o,value:f.value},o+=d}r.quantise=t;let i=({value:n,position:o,interpolation:a},s,l)=>a.type==="none"?n:a.type==="linear"?n+(l-o)/(s.position-o)*(s.value-n):a.type==="curve"?Yr.valueAt({slope:a.slope,steps:s.position-o,y0:n,y1:s.value},l-o):F("Unknown interpolation")})(pf||(pf={}));var Du;(function(r){let e;(function(t){t[t.Bartlett=0]="Bartlett",t[t.Blackman=1]="Blackman",t[t.BlackmanHarris=2]="BlackmanHarris",t[t.Hamming=3]="Hamming",t[t.Hanning=4]="Hanning"})(e=r.Type||(r.Type={})),r.create=(t,i)=>{let n=new Float32Array(i),o=Math.PI/(i-1);switch(t){case e.Bartlett:{let a=(i>>1)-1,s=0;for(;s<=a;++s)n[s]=2*s/(i-1);for(;s<i;++s)n[s]=2-2*s/(i-1);return n}case e.Blackman:{let a=2*o,s=4*o;for(let l=0;l<i;++l)n[l]=.42323-.49755*Math.cos(a*l)+.07922*Math.cos(s*l);return n}case e.BlackmanHarris:{let a=2*o,s=4*o,l=6*o;for(let u=0;u<i;++u)n[u]=.35875-.48829*Math.cos(a*u)+.14128*Math.cos(s*u)-.01168*Math.cos(l*u);return n}case e.Hamming:{let a=2*o;for(let s=0;s<i;++s)n[s]=.54-.46*Math.cos(a*s);return n}case e.Hanning:{let a=2*o;for(let s=0;s<i;++s)n[s]=.5-.5*Math.cos(a*s);return n}}}})(Du||(Du={}));var hf=class extends AudioWorkletProcessor{#e;#t;#r;#i;#n;#o=0;constructor({processorOptions:{sab:e,numberOfChannels:t,rmsWindowInSeconds:i,valueDecay:n}}){super(),this.#e=t,this.#t=new Float32Array(t),this.#r=new Float32Array(t),this.#i=R.create(()=>new pl(sampleRate*i),t);let o=yr.createBuilder({peak:yr.floats(t),rms:yr.floats(t)})();this.#n=sl.writer(o,e,a=>{let s=Math.exp(-(128*this.#o)/(sampleRate*n));for(let l=0;l<t;++l){let u=this.#t[l],p=this.#r[l];a.peak[l]=u,a.rms[l]=Math.sqrt(p),this.#t[l]=u*s,this.#r[l]=p*s}this.#o=0})}process([e]){for(let t=0;t<this.#e;++t){let i=e[t];if(i===void 0)this.#t[t]=0,this.#r[t]=0;else{let n=this.#i[t],o=this.#t[t],a=this.#r[t];for(let s=0;s<128;++s){let l=i[s];o=Math.max(o,Math.abs(l)),a=Math.max(a,n.pushPop(l*l))}this.#t[t]=o,this.#r[t]=a}}return this.#o++,this.#n.tryWrite(),!0}};var Ae=class r{static newSet(e){return new ol(e,r.Comparator)}static compose=(e,...t)=>{let i=t.length===0?this.#e:new Int16Array(t);return I(i.every((n,o)=>n===t[o]),`fieldKeys (${i.join(",")}) only allows i16`),new r(e,i)};static decode(e){let t=e.split("/");return I(t.length>0,"Unable to parse Address"),r.compose(w.parse(t[0]),...t.slice(1).map(i=>parseInt(i)))}static reconstruct(e){return this.compose(e[0],...e[1])}static boxRange(e,t,i){let n=e.values(),o=Ye.leftMostMapped(n,t,w.Comparator,i),a=n.length;if(o<0||o>=a)return null;for(let s=o;s<a;s++)if(w.Comparator(i(n[s]),t)!==0)return o<s?[o,s]:null;return[o,a]}static Comparator=(e,t)=>{let i=w.Comparator(e.#t,t.#t);if(i!==0)return i;let n=Math.min(e.#r.length,t.#r.length);for(let o=0;o<n;o++){let a=e.#r[o]-t.#r[o];if(a!==0)return a}return e.#r.length-t.#r.length};static MinimalComparator=(e,t)=>{let i=w.Comparator(e.#t,t.#t);if(i!==0)return i;let n=Math.min(e.#r.length,t.#r.length);for(let o=0;o<n;o++){let a=e.#r[o]-t.#r[o];if(a!==0)return a}return 0};static LengthComparator=(e,t)=>{let i=w.Comparator(e.#t,t.#t);return i!==0?i:t.#r.length-e.#r.length};static#e=new Int16Array(0);#t;#r;constructor(e,t){this.#t=e,this.#r=t}get uuid(){return this.#t}get fieldKeys(){return this.#r}isBox(){return this.#r.length===0}isContent(){return!this.isBox()}equals(e){return r.Comparator(this,e)===0}compareTo(e){return r.Comparator(this,e)}append(e){return new r(this.#t,new Int16Array([...this.#r,e]))}startsWith(e){return w.Comparator(e.#t,this.#t)===0&&e.#r.length<=this.#r.length&&e.#r.every((t,i)=>this.#r[i]===t)}write(e){e.writeBytes(new Int8Array(this.#t.buffer)),e.writeByte(this.#r.length),this.#r.forEach(t=>e.writeShort(t))}moveTo(e){return new r(e,this.#r)}decompose(){return[this.#t,this.#r]}toJSON(){return{uuid:Array.from(this.#t.values()),fields:Array.from(this.#r.values())}}toArrayBuffer(){let e=new Uint8Array(w.length+this.#r.length);return e.set(this.#t,0),e.set(this.#r,w.length),e.buffer}toString(){return[w.toString(this.#t),...this.#r].join("/")}static read(e){let t=w.fromDataInput(e),i=e.readByte();return r.compose(t,...R.create(()=>e.readShort(),i))}},Va;(function(r){r.AddressReader=e=>e.address,r.Comparator=({address:e},{address:t})=>Ae.Comparator(e,t),r.equals=(e,t)=>{let[i,n]=Ye.rangeMapped(t,e,Ae.Comparator,r.AddressReader);return t.slice(i,n+1)},r.startsWith=(e,t)=>{let[i,n]=Ye.rangeMapped(t,e,Ae.MinimalComparator,r.AddressReader);return t.slice(i,n+1).filter(o=>o.address.startsWith(e))},r.endsWith=(e,t)=>{let i=Ye.leftMostMapped(t,e,Ae.LengthComparator,r.AddressReader),n=Ye.rightMostMapped(t,e,Ae.MinimalComparator,r.AddressReader);return t.slice(i,n+1).filter(o=>e.startsWith(o.address))}})(Va||(Va={}));var dn=class r{static validate(e,t){if(e.address.equals(t.address))return g.wrap(`PointerField cannot point to itself: ${e}`);if(!t.pointerRules.accepts.some(i=>i===e.pointerType)){let i=t.pointerRules.accepts.join(", ");return g.wrap(`${String(e.pointerType)} does not satisfy any of the allowed types (${i}).`)}return g.None}#e;#t;constructor(e){this.#e=e,this.#t=new Mt}subscribe(e,...t){return this.#r(this.#t,e,t)}catchupAndSubscribe(e,...t){let i=Ae.newSet(n=>n.address);return i.addMany(this.filter(...t)),i.forEach(n=>e.onAdded(n)),this.subscribe({onAdded:n=>{i.add(n)&&e.onAdded(n)},onRemoved:n=>{i.removeByKey(n.address),e.onRemoved(n)}},...t)}filter(...e){return e.length===0?this.incoming():Xe.filter(this.incoming().values(),t=>e.some(i=>i===t.pointerType))}size(){return this.incoming().length}isEmpty(){return this.size()===0}nonEmpty(){return this.size()>0}contains(e){return this.incoming().some(t=>e.address.equals(t.address))}incoming(){return this.#e.graph.edges().incomingEdgesOf(this.#e).slice()}onAdded(e){let t=r.validate(e,this.#e);if(t.nonEmpty())return F(t.unwrap());this.#t.proxy.onAdded(e)}onRemoved(e){this.#t.proxy.onRemoved(e)}toString(){return`{Pointers ${this.#e.address}, pointers: ${this.incoming().values().map(e=>e.toString())}}`}#r(e,t,i){return e.subscribe({onAdded:n=>{(i.length===0||i.some(o=>o===n.pointerType))&&t.onAdded(n)},onRemoved:n=>{(i.length===0||i.some(o=>o===n.pointerType))&&t.onRemoved(n)}})}};var Vx=function(r,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(n<3?a(o):n>3?a(e,t,o):a(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},hl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},W=class r{static hook(e){return new r(e)}#e;#t;#r;#i;#n;constructor({parent:e,fieldKey:t,fieldName:i,pointerRules:n,deprecated:o}){this.#e=e,this.#t=t,this.#r=i,this.#i=n,this.#n=o,n.mandatory&&this.graph.edges().watchVertex(this)}accept(e){return _(e.visitField,this)}get box(){return this.#e.box}get graph(){return this.#e.graph}get parent(){return this.#e}get fieldKey(){return this.#t}get fieldName(){return this.#r}get pointerRules(){return this.#i}get deprecated(){return this.#n}get pointerHub(){return new dn(this)}get address(){return this.#e.address.append(this.#t)}get debugPath(){return`${this.box.name}:${this.box.mapFields(e=>e.fieldName,...this.address.fieldKeys).join("/")}`}isBox(){return!1}isField(){return!0}isAttached(){return this.graph.findBox(this.address.uuid).nonEmpty()}fields(){return R.empty()}record(){return Ir.empty()}getField(e){return F()}optField(e){return g.None}read(e){}write(e){}toJSON(){}fromJSON(e){return F("fromJSON should never be called on a field")}disconnect(){if(this.pointerHub.isEmpty())return;let e=this.pointerHub.incoming();e.forEach(t=>{t.defer(),(t.mandatory||this.pointerRules.mandatory&&e.length===1)&&t.box.delete()})}toString(){return`{${this.box.constructor.name}:${this.constructor.name} (${this.fieldName}) ${this.address.toString()}`}};Vx([rl,hl("design:type",dn),hl("design:paramtypes",[])],W.prototype,"pointerHub",null);Vx([rl,hl("design:type",Ae),hl("design:paramtypes",[])],W.prototype,"address",null);Vx([rl,hl("design:type",String),hl("design:paramtypes",[])],W.prototype,"debugPath",null);var h=Object.freeze({mandatory:!1,accepts:[]});var ff=class r extends W{static create(e,t,i){return new r(e,t,i)}#e;constructor(e,t,i){super(e),this.#e=R.create(n=>t({parent:this,fieldKey:n,fieldName:String(n),pointerRules:h,deprecated:e.deprecated}),i)}accept(e){return _(e.visitArrayField,this)}fields(){return this.#e}record(){return R.toRecord(this.#e,e=>String(e.fieldKey))}getField(e){return ee(this.#e[e])}optField(e){return g.wrap(this.#e[e])}read(e){this.#e.forEach(t=>t.read(e))}write(e){this.#e.filter(t=>!t.deprecated).forEach(t=>t.write(e))}size(){return this.#e.length}toJSON(){if(!this.deprecated)return Object.values(this.#e).map(e=>e.toJSON()??null)}fromJSON(e){if(!this.deprecated)if(Array.isArray(e))e.forEach((t,i)=>this.#e[i].fromJSON(t));else return F("Type mismatch")}};var No;(function(r){r.writeFields=(t,i)=>{let n=Object.entries(i).filter(([o,a])=>!a.deprecated);t.writeInt(1179403347),t.writeShort(n.length),n.forEach(([o,a])=>{let s=$t.create();a.write(s);let l=new Int8Array(s.toArrayBuffer());t.writeShort(Number(o)),t.writeInt(l.length),t.writeBytes(l)})},r.readFields=(t,i)=>{I(t.readInt()===1179403347,"Serializer header is corrupt");let n=t.readShort();for(let o=0;o<n;o++){let a=t.readShort();if(el(i[a]))continue;let s=t.readInt(),l=new Int8Array(s);t.readBytes(l);let{status:u,error:p}=jn(()=>i[a]?.read(new lt(l.buffer)));u==="failure"&&console.warn(i,p)}}})(No||(No={}));var PB=function(r,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(n<3?a(o):n>3?a(e,t,o):a(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},kP=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},N=class r{static DEBUG_DELETION=!1;static Index=0;#e;#t;#r;#i;#n;#o=r.Index++;constructor({uuid:e,graph:t,name:i,pointerRules:n}){this.#e=Ae.compose(e),this.#t=t,this.#r=i,this.#i=n,this.#n=this.initializeFields(),n.mandatory&&this.graph.edges().watchVertex(this)}fields(){return Object.values(this.#n)}record(){return this.#n}getField(e){return ee(this.#n[e],()=>`Field ${String(e)} not found in ${this.toString()}`)}optField(e){return g.wrap(this.#n[e])}subscribe(e,t){return this.graph.subscribeVertexUpdates(e,this.address,t)}get box(){return this}get name(){return this.#r}get graph(){return this.#t}get parent(){return this}get address(){return this.#e}get pointerRules(){return this.#i}get creationIndex(){return this.#o}get pointerHub(){return new dn(this)}estimateMemory(){let e=new tl;return this.write(e),e.count}isBox(){return!0}asBox(e){return Ne(this,e)}isField(){return!1}isAttached(){return this.#t.findBox(this.address.uuid).nonEmpty()}read(e){No.readFields(e,this.#n)}write(e){No.writeFields(e,this.#n)}serialize(){let e=$t.create();return e.writeInt(this.#o),e.writeString(this.name),e.writeBytes(new Int8Array(this.address.uuid.buffer)),this.write(e),e.toArrayBuffer()}toArrayBuffer(){let e=$t.create();return this.write(e),e.toArrayBuffer()}toJSON(){return Object.entries(this.#n).reduce((e,[t,i])=>{let n=i.toJSON();return Z(n)&&(e[t]=n),e},{})}fromJSON(e){if(Kh(e))Object.entries(e).forEach(([t,i])=>{let n=this.#n[parseInt(t)];Z(i)&&n.fromJSON(i)});else return F("Type mismatch")}incomingEdges(){return this.graph.edges().incomingEdgesOf(this)}outgoingEdges(){return this.graph.edges().outgoingEdgesOf(this)}mapFields(e,...t){if(t.length===0)return R.empty();let i=this.getField(t[0]),n=[e(i)];for(let o=1;o<t.length;o++)i=i.getField(t[o]),n.push(e(i));return n}searchVertex(e){if(e.length===0)return g.wrap(this);let t=this.optField(e[0]);if(t.isEmpty())return g.None;for(let i=1;i<e.length;i++)if(t=t.unwrap().optField(e[i]),t.isEmpty())return g.None;return t}delete(){if(!this.isAttached())return;let{boxes:e,pointers:t}=this.graph.dependenciesOf(this);r.DEBUG_DELETION&&(console.debug(`Delete ${this.toString()}`),console.debug(" unplugs",[...t].map(i=>i.toString()).join(`
2
2
  `)),console.debug(" unstages",[...e].map(i=>i.toString()).join(`
3
- `),this));for(let i of t)i.defer();for(let i of e)i.unstage();this.unstage()}unstage(){this.graph.unstageBox(this)}isValid(){if(this.#i.mandatory&&this.pointerHub.incoming().length===0)return!1;let e=t=>t.every(i=>i.accept({visitPointerField:n=>!n.mandatory||n.nonEmpty(),visitArrayField:n=>e(n.fields()),visitObjectField:n=>e(n.fields()),visitPrimitiveField:n=>!0,visitField:n=>!0})??!0);return e(this.fields())}toString(){return`${this.constructor.name} ${this.address.toString()}`}};PB([rl,kP("design:type",dn),kP("design:paramtypes",[])],N.prototype,"pointerHub",null);var Zu;(function(r){r.clampInt32=(e,t)=>t,r.clampFloat32=(e,t)=>t})(Zu||(Zu={}));var ke;(function(r){r[r.This=0]="This",r[r.Parent=1]="Parent",r[r.Children=2]="Children"})(ke||(ke={}));var mf;(function(r){r.create=()=>new zx})(mf||(mf={}));var zx=class{#e=new Gu(Va.equals);#t=new Gu(Va.startsWith);#r=new Gu(Va.endsWith);#i=[];#n=0;#o=!1;subscribe(e,t,i){let n=new Ux(t,e,this.#n++,i);if(this.#o){let o=new jx(n,e);return this.#i.push(o),o}else return this.subscribeMonitor(n,e)}dispatch(e){this.#o=!0,[...this.#e.filter(e),...this.#t.filter(e),...this.#r.filter(e)].sort(({order:i},{order:n})=>i-n).forEach(i=>i.procedure(e)),this.#o=!1,this.#i.forEach(i=>i.subscribe(this)),this.#i.length=0}subscribeMonitor(e,t){switch(t){case ke.This:return this.#e.subscribe(e);case ke.Parent:return this.#t.subscribe(e);case ke.Children:return this.#r.subscribe(e);default:return Wh(t)}}countStations(){return this.#e.count()+this.#t.count()+this.#r.count()}},Ux=class{address;propagation;order;procedure;constructor(e,t,i,n){this.address=e,this.propagation=t,this.order=i,this.procedure=n}toString(){return`{ Monitor address: ${this.address}, propagation: ${ke[this.propagation]}, order: ${this.order} }`}},Gu=class{filterStrategy;#e=[];#t=!0;constructor(e){this.filterStrategy=e}subscribe(e){return this.#e.push(e),this.#t=this.#e.length<2,{terminate:()=>{let t=this.#e.length;for(;--t>=0;)this.#e[t]===e&&this.#e.splice(t,1)}}}stations(){return this.#t||(this.#e.sort(Va.Comparator),this.#t=!0),this.#e}filter(e){return this.filterStrategy(e.address,this.stations())}count(){return this.#e.length}},jx=class{monitor;propagation;#e=new U;#t=!1;constructor(e,t){this.monitor=e,this.propagation=t}subscribe(e){this.#t||(this.#e.terminate(),this.#e.own(e.subscribeMonitor(this.monitor,this.propagation)))}terminate(){this.#t=!0,this.#e.terminate()}};var ft;(function(r){r.Boolean="boolean",r.Float32="float32",r.Int32="int32",r.String="string",r.Bytes="bytes"})(ft||(ft={}));var Ua={[ft.Boolean]:{type:ft.Boolean,encode:(r,e)=>r.writeBoolean(e),decode:r=>r.readBoolean()},[ft.Float32]:{type:ft.Float32,encode:(r,e)=>r.writeFloat(e),decode:r=>r.readFloat()},[ft.Int32]:{type:ft.Int32,encode:(r,e)=>r.writeInt(e),decode:r=>r.readInt()},[ft.String]:{type:ft.String,encode:(r,e)=>r.writeString(e),decode:r=>r.readString()},[ft.Bytes]:{type:ft.Bytes,encode:(r,e)=>{r.writeInt(e.length),r.writeBytes(e)},decode:r=>{let e=new Int8Array(r.readInt());return r.readBytes(e),e}}},za=class extends W{#e;#t;#r;constructor(e,t,i){super(e),this.#e=t,this.#t=i,this.#r=this.#t}accept(e){return _(e.visitPrimitiveField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(ke.This,this.address,()=>e(this))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}get type(){return this.#e}get initValue(){return this.#t}setInitValue(e){I(this.graph.constructingBox(),"Cannot change initial value at runtime"),this.setValue(this.#t=this.clamp(e))}getValue(){return this.#r}setValue(e){let t=this.#r,i=this.clamp(e);this.equals(i)||(this.#r=i,this.graph.onPrimitiveValueUpdate(this,t,i))}writeValue(e,t){I(!this.deprecated,"PrimitiveField.write: deprecated field"),this.serialization().encode(e,t)}readValue(e){return this.serialization().decode(e)}toJSON(){if(this.deprecated)return;let e=this.getValue();return ArrayBuffer.isView(e)?F("not implemented"):e}fromJSON(e){return F("Type mismatch")}reset(){this.setValue(this.#t)}},$=class r extends za{static create(e,t=!1){return new r(e,t)}constructor(e,t){super(e,ft.Boolean,t)}toggle(){this.setValue(!this.getValue())}serialization(){return Ua[ft.Boolean]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readBoolean())}write(e){I(!this.deprecated,"BooleanField.write: deprecated field"),e.writeBoolean(this.getValue())}fromJSON(e){this.deprecated||(typeof e=="boolean"?this.setValue(e):console.warn("BooleanField Type mismatch",e,this.address.toString()))}},b=class r extends za{static create(e,t,i,n=0){return new r(e,t,i,n)}#e;#t;constructor(e,t,i,n){super(e,ft.Float32,n),this.#e=t,this.#t=i}serialization(){return Ua[ft.Float32]}equals(e){return this.getValue()===e}clamp(e){return Zu.clampFloat32(this.#e,Wn.toFloat32(e))}read(e){this.setValue(e.readFloat())}write(e){I(!this.deprecated,"FLoat32Field.write: deprecated field"),e.writeFloat(this.getValue())}get unit(){return this.#t}get constraints(){return this.#e}fromJSON(e){this.deprecated||(typeof e=="number"?this.setValue(e):console.warn("Float32Field Type mismatch",e,this.address.toString()))}},E=class r extends za{static create(e,t,i,n=0){return new r(e,t,i,n)}#e;#t;constructor(e,t,i,n){super(e,ft.Int32,n),this.#e=t,this.#t=i}serialization(){return Ua[ft.Int32]}equals(e){return this.getValue()===e}clamp(e){return Zu.clampInt32(this.#e,nr.toInt(e))}read(e){this.setValue(e.readInt())}write(e){I(!this.deprecated,"Int32Field.write: deprecated field"),e.writeInt(this.getValue())}get unit(){return this.#t}get constraints(){return this.#e}fromJSON(e){this.deprecated||(typeof e=="number"&&e===Math.floor(e)&&e>=nr.MIN_VALUE&&e<=nr.MAX_VALUE?this.setValue(e):console.warn("Int32Field Type mismatch",e,this.address.toString()))}},C=class r extends za{static create(e,t=""){return new r(e,t)}constructor(e,t){super(e,ft.String,t)}serialization(){return Ua[ft.String]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readString())}write(e){I(!this.deprecated,"StringField.write: deprecated field"),e.writeString(this.getValue())}fromJSON(e){this.deprecated||(typeof e=="string"?this.setValue(e):console.warn("StringField Type mismatch",e,this.address.toString()))}},$P=class r extends za{static create(e,t=this.#e){return new r(e,t)}static#e=Object.freeze(new Int8Array(0));constructor(e,t){super(e,ft.Bytes,t)}serialization(){return Ua[ft.Bytes]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){let t=new Int8Array(e.readInt());e.readBytes(t),this.setValue(t)}write(e){I(!this.deprecated,"ByteArrayField.write: deprecated field");let t=this.getValue();e.writeInt(t.length),e.writeBytes(t)}toJSON(){if(!this.deprecated)return Array.from(this.getValue().values())}fromJSON(e){this.deprecated||(Array.isArray(e)&&e.every(t=>typeof t=="number")?this.setValue(new Int8Array(e)):console.warn("ByteArrayField Type mismatch",e,this.address.toString()))}};var MP;(function(r){r.decode=e=>{let t=e.readInt();return R.create(()=>{switch(e.readString()){case"new":{let n=w.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new qu(n,o,a.buffer)}case"pointer":{let n=Ae.read(e),o=e.readBoolean()?g.wrap(Ae.read(e)):g.None,a=e.readBoolean()?g.wrap(Ae.read(e)):g.None;return new Ju(n,o,a)}case"primitive":{let n=Ae.read(e),o=e.readString(),a=Ua[o],s=a.decode(e),l=a.decode(e);return new Hu(n,a,s,l)}case"delete":{let n=w.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new Qu(n,o,a.buffer)}}},t)}})(MP||(MP={}));var qu=class{type="new";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.createBox(this.#t,this.#e,t=>t.read(new lt(this.#r)))}inverse(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}write(e){e.writeString(this.type),w.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{NewUpdate uuid: ${w.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}toDebugString(e){return this.toString()}},Hu=class{type="primitive";#e;#t;#r;#i;constructor(e,t,i,n){this.#e=e,this.#t=t,this.#r=i,this.#i=n}get address(){return this.#e}get oldValue(){return this.#r}get newValue(){return this.#i}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).setValue(this.#r)}forward(e){this.field(e).setValue(this.#i)}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PrimitiveField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),e.writeString(this.#t.type),this.#t.encode(e,this.#r),this.#t.encode(e,this.#i)}toString(){return`{PrimitiveUpdate oldValue: ${this.#r}, newValue: ${this.#i}`}},Ju=class{type="pointer";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get address(){return this.#e}get oldAddress(){return this.#t}get newAddress(){return this.#r}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).targetAddress=this.#t}forward(e){this.field(e).targetAddress=this.#r}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PointerField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),this.#t.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}}),this.#r.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}toString(){return`{PointerUpdate oldValue: ${this.#t.unwrapOrNull()}, newValue: ${this.#r.unwrapOrNull()}`}},Qu=class{type="delete";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}inverse(e){e.createBox(this.#t,this.#e,t=>t.read(new lt(this.#r)))}write(e){e.writeString(this.type),w.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{DeleteUpdate uuid: ${w.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}};var eT=Symbol("Unreferenceable"),B=class r extends W{static create(e,t,i){return new r(e,t,i)}static encodeWith(e,t){I(this.#e.isEmpty(),"SerializationEncoder already in use"),this.#e=g.wrap(e);let i=jn(t);if(this.#e=g.None,i.status==="failure")throw i.error;return i.value}static decodeWith(e,t){I(this.#t.isEmpty(),"SerializationDecoder already in use"),this.#t=g.wrap(e);let i=jn(t);if(this.#t=g.None,i.status==="failure")throw i.error;return i.value}static#e=g.None;static#t=g.None;#r;#i;#n=g.None;#o=g.None;constructor(e,t,i){super(e),this.#r=t,this.#i=i,i&&this.graph.edges().watchVertex(this)}get pointerHub(){return F(`${this} cannot be pointed to`)}get pointerType(){return this.#r}get mandatory(){return this.#i}accept(e){return _(e.visitPointerField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(ke.This,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}refer(e){this.targetVertex=g.wrap(e)}defer(){this.targetVertex=g.None}get targetVertex(){return this.graph.inTransaction()?this.#o.flatMap(e=>this.graph.findVertex(e)):this.#n}set targetVertex(e){if(e.nonEmpty()){let t=dn.validate(this,e.unwrap());t.nonEmpty()&&F(t.unwrap())}this.targetAddress=e.map(t=>t.address)}get targetAddress(){return this.#o}set targetAddress(e){let t=this.#o;t.isEmpty()&&e.isEmpty()||(e.nonEmpty()&&t.unwrapOrNull()?.equals(e.unwrap()))===!0||(this.#o=e,this.graph.onPointerAddressUpdated(this,t,e))}isEmpty(){return this.targetAddress.isEmpty()}nonEmpty(){return this.targetAddress.nonEmpty()}ifVertex(e){this.targetVertex.nonEmpty()&&e(this.targetVertex.unwrap())}resolvedTo(e){this.#n=e}read(e){let t=e.readBoolean()?g.wrap(Ae.read(e)):g.None;this.targetAddress=r.#t.match({none:()=>t,some:i=>i.map(this,t)})}write(e){I(!this.deprecated,"PointerField.write: deprecated field"),r.#e.match({none:()=>this.#o,some:t=>t.map(this)}).match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}toJSON(){if(!this.deprecated)return r.#e.match({none:()=>this.#o,some:e=>e.map(this)}).match({none:()=>null,some:e=>e.toString()})}fromJSON(e){if(!this.deprecated)if(Ia(e)||typeof e=="string"){let t=g.wrap(Ia(e)?null:Ae.decode(e));this.targetAddress=r.#t.match({none:()=>t,some:i=>i.map(this,t)})}else return F(`Pointer: Type mismatch. value (${typeof e}) must be a string.`)}};var gf=class{#e;#t;#r;#i;constructor(){this.#e=Ae.newSet(e=>e.address),this.#t=Ae.newSet(e=>e.address),this.#r=Ae.newSet(([e])=>e),this.#i=Ae.newSet(([e])=>e.address)}watchVertex(e){if(Ie(e,B)){if(!e.mandatory)return F("watchVertex called but has no edge requirement");this.#e.add(e)}else{if(!e.pointerRules.mandatory)return F("watchVertex called but has no edge requirement");this.#t.add(e)}}unwatchVerticesOf(...e){let t=({box:{address:{uuid:i}}})=>i;for(let{address:{uuid:i}}of e)this.#o(this.#e,i,t),this.#o(this.#t,i,t);for(let i of e){let n=this.outgoingEdgesOf(i);if(n.length>0)return F(`${i} has outgoing edges: ${n.map(([a,s])=>`[${a.toString()}, ${s.toString()}]`)}`);let o=this.incomingEdgesOf(i);if(o.length>0)return F(`${i} has incoming edges from: ${o.map(a=>a.toString())}`)}}connect(e,t){this.#i.add([e,t]),this.#r.opt(t).match({none:()=>this.#r.add([t,[e]]),some:([,i])=>i.push(e)})}disconnect(e){let[,t]=this.#i.removeByKey(e.address),[,i]=this.#r.get(t);R.remove(i,e),i.length===0&&this.#r.removeByKey(t)}isConnected(e,t){return this.#i.opt(e.address).mapOr(([,i])=>i.equals(t),!1)}outgoingEdgesOf(e){return this.#n(this.#i,e.address.uuid,([{box:{address:{uuid:t}}}])=>t)}incomingEdgesOf(e){return e.isBox()?this.#n(this.#r,e.address.uuid,([{uuid:t}])=>t).flatMap(([t,i])=>i):this.#r.opt(e.address).mapOr(([t,i])=>i,R.empty())}validateRequirements(){this.#e.forEach(e=>{if(e.isEmpty())return e.mandatory?F(`Pointer ${e.toString()} requires an edge.`):F(`Illegal state: ${e} has no edge requirements.`)}),this.#t.forEach(e=>{if(e.pointerHub.isEmpty())return e.pointerRules.mandatory?F(`Target ${e.toString()} requires an edge.`):F(`Illegal state: ${e} has no edge requirements.`)})}#n(e,t,i){let n=Ae.boxRange(e,t,i);return Z(n)?e.values().slice(n[0],n[1]):R.empty()}#o(e,t,i){let n=Ae.boxRange(e,t,i);Z(n)&&e.removeRange(n[0],n[1])}};var ja=class{#e;#t;#r;#i;#n;#o;#a;#c;#s;#l;#u=!1;#d=!1;constructor(e=g.None){this.#e=e,this.#t=w.newSet(t=>t.address.uuid),this.#r=[],this.#a=mf.create(),this.#i=new Mt,this.#n=new Mt,this.#o=new Mt,this.#c=new gf,this.#s=Ae.newSet(({pointer:t})=>t.address),this.#l=[]}beginTransaction(){I(!this.#u,"Transaction already in progress"),this.#u=!0,this.#o.proxy.onBeginTransaction()}endTransaction(){for(I(this.#u,"No transaction in progress"),this.#r.length>0&&(this.#r.forEach(({pointerField:e,update:t})=>this.#p(e,t)),this.#r.length=0),this.#s.values().toSorted((e,t)=>e.index-t.index).forEach(({pointer:e,initial:t,final:i})=>{t.equals(i)||(t.ifSome(n=>this.findVertex(n).unwrapOrUndefined()?.pointerHub.onRemoved(e)),i.ifSome(n=>this.findVertex(n).unwrapOrUndefined()?.pointerHub.onAdded(e)))}),this.#s.clear(),this.#u=!1;this.#l.length>0;)this.#l.splice(0).forEach(e=>e()),this.#l.length>0&&console.debug(`${this.#l.length} new observers while notifying`);this.#o.proxy.onEndTransaction()}inTransaction(){return this.#u}constructingBox(){return this.#d}createBox(e,t,i){return this.#e.unwrap("No box-factory installed")(e,this,t,i)}stageBox(e,t){this.#h(),I(!this.#d,"Cannot construct box while other box is constructing"),Z(t)&&(this.#d=!0,t(e),this.#d=!1);let i=this.#t.add(e);I(i,`${e} already staged`);let n=new qu(e.address.uuid,e.name,e.toArrayBuffer());return this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n),e}subscribeTransaction(e){return this.#o.subscribe(e)}subscribeToAllUpdates(e){return this.#i.subscribe(e)}subscribeToAllUpdatesImmediate(e){return this.#n.subscribe(e)}subscribeVertexUpdates(e,t,i){return this.#a.subscribe(e,t,i)}subscribeEndTransaction(e){this.#l.push(e)}unstageBox(e){this.#h();let t=this.#t.removeByKey(e.address.uuid);I(t===e,`${e} could not be found to unstage`),this.#c.unwatchVerticesOf(e);let i=new Qu(e.address.uuid,e.name,e.toArrayBuffer());this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i)}findBox(e){return this.#t.opt(e)}findVertex(e){return this.#t.opt(e.uuid).flatMap(t=>t.searchVertex(e.fieldKeys))}boxes(){return this.#t.values()}edges(){return this.#c}checksum(){let e=new Hh;return this.boxes().forEach(t=>t.write(e)),e.result()}onPrimitiveValueUpdate(e,t,i){if(this.#h(),e.isAttached()&&!this.#d){let n=new Hu(e.address,e.serialization(),t,i);this.#a.dispatch(n),this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n)}}onPointerAddressUpdated(e,t,i){this.#h(),t.nonEmpty()&&this.#c.disconnect(e),i.nonEmpty()&&this.#c.connect(e,i.unwrap());let n=new Ju(e.address,t,i);this.#d?this.#r.push({pointerField:e,update:n}):(this.#p(e,n),this.#n.proxy.onUpdate(n))}#p(e,t){let{oldAddress:i,newAddress:n}=t;e.resolvedTo(n.flatMap(a=>this.findVertex(a))),this.#s.opt(e.address).match({none:()=>this.#s.add({pointer:e,initial:i,final:n,index:this.#s.size()}),some:a=>a.final=n}),this.#a.dispatch(t),this.#i.proxy.onUpdate(t)}dependenciesOf(e,t={}){let i=Z(t.excludeBox)?t.excludeBox:Po.alwaysFalse,n=Z(t.alwaysFollowMandatory)?t.alwaysFollowMandatory:!1,o=new Set,a=new Set,s=l=>{o.has(l)||i(l)||(o.add(l),l.outgoingEdges().filter(([u])=>!a.has(u)).forEach(([u,p])=>{let d=this.findVertex(p).unwrap(`Could not find target of ${u.toString()}`);if(a.add(u),d.pointerRules.mandatory&&(n||d.pointerHub.incoming().every(f=>a.has(f))))return s(d.box)}),l.incomingEdges().forEach(u=>{a.add(u),u.mandatory&&s(u.box)}))};return s(e),o.delete(e),{boxes:o,pointers:Array.from(a).reverse()}}verifyPointers(){this.#c.validateRequirements();let e=0,t=i=>{for(let n of i.fields())n.accept({visitPointerField:o=>{if(o.targetAddress.nonEmpty()){let a=o.targetVertex.nonEmpty(),s=this.findVertex(o.targetAddress.unwrap()).nonEmpty();I(a,`pointer ${o.address} is broken`),I(s,`Cannot find target for pointer ${o.address}`),e++}},visitObjectField:o=>t(o)})};return this.#t.forEach(i=>t(i)),console.debug("verification complete."),{count:e}}debugBoxes(){console.table(this.#t.values().reduce((e,t)=>(e[w.toString(t.address.uuid)]={class:t.name,"incoming links":t.incomingEdges().length,"outgoing links":t.outgoingEdges().length,"est. memory (bytes)":t.estimateMemory()},e),{}))}debugDependencies(){console.debug("Dependencies:"),this.boxes().forEach(e=>{console.debug(` ${e}`);for(let t of this.dependenciesOf(e).boxes)console.debug(` ${t}`)})}addressToDebugPath(e){return e.flatMap(t=>t.isBox()?this.findBox(t.uuid).map(i=>i.name):this.findBox(t.uuid).flatMap(i=>i.searchVertex(t.fieldKeys).map(n=>n.isField()?n.debugPath:F("Unknown address"))))}toArrayBuffer(){let e=$t.create(),t=this.#t.values();return e.writeInt(t.length),t.forEach(i=>{let n=i.serialize();e.writeInt(n.byteLength),e.writeBytes(new Int8Array(n))}),e.toArrayBuffer()}fromArrayBuffer(e){I(this.#t.isEmpty(),"Cannot call fromArrayBuffer if boxes is not empty");let t=new lt(e),i=t.readInt();this.beginTransaction();let n=[];for(let o=0;o<i;o++){let a=t.readInt(),s=new Int8Array(a);t.readBytes(s);let l=new lt(s.buffer),u=l.readInt(),p=l.readString(),d=w.fromDataInput(l);n.push({creationIndex:u,name:p,uuid:d,boxStream:l})}n.sort((o,a)=>o.creationIndex-a.creationIndex).forEach(({name:o,uuid:a,boxStream:s})=>this.createBox(o,a,l=>l.read(s))),this.endTransaction()}toJSON(){return this.#t.values().map(e=>({name:e.name,uuid:e.address.toString(),fields:ee(e.toJSON())}))}#h(){I(this.#u,()=>"Modification only prohibited in transaction mode.")}};var fl;(function(r){r.insertOrder=(e,t=Number.MAX_SAFE_INTEGER)=>{let i=r.collectIndexedBoxes(e),n=le(t,0,i.length);if(n<i.length)for(let o=n;o<i.length;o++)i[o].index.setValue(o+1);return n},r.removeOrder=(e,t)=>{let i=r.collectIndexedBoxes(e);if(t<i.length)for(let n=t+1;n<i.length;n++)i[n].index.setValue(n-1)},r.moveIndex=(e,t,i)=>{let n=r.collectIndexedBoxes(e),o=n[t];if(i<0){let a=le(t+i,0,n.length-1);for(let s=a;s<t;s++)n[s].index.setValue(s+1);o.index.setValue(a)}else if(i>1){let a=le(t+(i-1),0,n.length-1);for(let s=t;s<a;s++)n[s+1].index.setValue(s);o.index.setValue(a)}else console.warn(`moveIndex had no effect: startIndex: ${t}, delta: ${i}`)},r.isIndexedBox=e=>"index"in e&&e.index instanceof E,r.collectIndexedBoxes=(e,t)=>e.pointerHub.incoming().map(({box:i})=>r.isIndexedBox(i)&&(t===void 0||i instanceof t)?i:F(`${i} has no index field`)).sort((i,n)=>i.index.getValue()-n.index.getValue())})(fl||(fl={}));var ze=class extends W{#e;constructor(e){super(e),this.#e=this.initializeFields()}accept(e){return _(e.visitObjectField,this)}fields(){return Object.values(this.#e)}record(){return this.#e}getField(e){return ee(this.#e[e])}optField(e){return g.wrap(this.#e[e])}subscribe(e){return this.graph.subscribeVertexUpdates(ke.Children,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}read(e){No.readFields(e,this.#e)}write(e){No.writeFields(e,this.#e)}toJSON(){if(!this.deprecated)return Object.entries(this.#e).reduce((e,[t,i])=>(e[t]=i.toJSON(),e),{})}fromJSON(e){if(!this.deprecated)if(Kh(e))Object.entries(e).forEach(([t,i])=>{let n=this.#e[parseInt(t)];Z(i)&&n.fromJSON(i)});else return F("Type mismatch")}};var qn;(function(r){r.sender=(n,o)=>o(new t(n)),r.executor=(n,o)=>new i(n,o);let e=n=>{let o=[];for(let a of n)a instanceof MessagePort&&o.push(a),typeof ImageBitmap<"u"&&a instanceof ImageBitmap&&o.push(a),typeof OffscreenCanvas<"u"&&a instanceof OffscreenCanvas&&o.push(a);return o};class t{#e;#t=new Map;#r;#i=0;constructor(o){this.#e=o,this.#r=o.subscribe(this.#n)}terminate(){this.#r.terminate()}dispatchAndForget=(o,...a)=>{let s=e(a);this.#e.send({type:"send",returnId:!1,func:o.name,args:Array.from(Xe.map(a,l=>({value:l})))},s)};dispatchAndReturn=(o,...a)=>new Promise((s,l)=>{let u=Xe.reduce(a,(d,f,v)=>(typeof f=="function"&&d.push([v,f]),d),[]);this.#t.set(this.#i,{executorTuple:{resolve:s,reject:l},callbacks:new Map(u)});let p=e(a);this.#e.send({type:"send",returnId:this.#i,func:o.name,args:Array.from(Xe.map(a,(d,f)=>typeof d=="function"?{callback:f}:{value:d}))},p),this.#i++});#n=o=>{let a=this.#t.get(o.returnId);Z(a)?o.type==="resolve"?(a.executorTuple.resolve(o.resolve),this.#t.delete(o.returnId)):o.type==="reject"?(a.executorTuple.reject(o.reject),this.#t.delete(o.returnId)):o.type==="callback"&&a.callbacks?.get(o.funcAt).apply(this,o.args):F(`Promise has already been resolved. ${JSON.stringify(o)}`)}}class i{#e;#t;#r;constructor(o,a){this.#e=o,this.#t=a,this.#r=o.subscribe(this.#i)}terminate(){this.#r.terminate()}#i=o=>{I(o.type==="send",()=>"Message type must be 'send'");let a=Object.getPrototypeOf(this.#t)===Object.getPrototypeOf({})?this.#t:Object.getPrototypeOf(this.#t),s=ee(a[o.func],`${o.func.toString()} does not exists on ${this.#t}`),l=o.returnId;if(l===!1)s.apply(this.#t,o.args.map(u=>"value"in u?u.value:F(`${o.func.toString()} has no promise.`)));else try{s.apply(this.#t,o.args.map(p=>"callback"in p?(...d)=>this.#a(l,p.callback,d):p.value)).then(p=>{try{this.#n(l,p)}catch(d){this.#o(l,d)}},p=>this.#o(l,p))}catch(u){this.#o(l,u)}};#n=(o,a)=>this.#e.send({type:"resolve",returnId:o,resolve:a});#o=(o,a)=>this.#e.send({type:"reject",returnId:o,reject:a});#a=(o,a,s)=>this.#e.send({type:"callback",returnId:o,funcAt:a,args:s})}r.Executor=i})(qn||(qn={}));var DP={for:r=>new Lx(r)},SB=[],Lx=class{#e;#t=new re;constructor(e){if(this.#e=e,Z(e.onmessage)||Z(e.onmessageerror))throw console.error(e),new Error(`${e} is already wrapped.`);e.onmessage=t=>this.#t.notify(t.data),e.onmessageerror=t=>{throw new Error(t.type)}}send(e,t){this.#e.postMessage(e,t??SB)}channel(e){return new Kx(this,e)}subscribe(e){return this.#t.subscribe(e)}terminate(){this.#t.terminate(),this.#e.onmessage=null,this.#e.onmessageerror=null}},Kx=class r{#e;#t;#r=new re;#i;constructor(e,t){this.#e=e,this.#t=t,this.#i=e.subscribe(i=>{"__id__"in i&&i.__id__==="42"&&"message"in i&&"channel"in i&&i.channel===t&&this.#r.notify(i.message)})}send(e,t){this.#e.send({__id__:"42",channel:this.#t,message:e},t)}channel(e){return new r(this,e)}subscribe(e){return this.#r.subscribe(e)}terminate(){this.#i.terminate(),this.#r.terminate()}};var vf;(function(r){r.frame=()=>new Promise(e=>requestAnimationFrame(()=>e())),r.frames=e=>new Promise(t=>{let i=e,n=()=>{--i<=0?t():requestAnimationFrame(n)};requestAnimationFrame(n)}),r.timeSpan=(e,...t)=>new Promise(i=>setTimeout(i,e.millis(),...t)),r.event=(e,t)=>new Promise(i=>e.addEventListener(t,i,{once:!0})),r.observable=e=>new Promise(t=>{let i=e.subscribe(()=>{i.terminate(),t()})}),r.complete=e=>new Promise((t,i)=>{let n=setInterval(()=>{let{status:o,value:a,error:s}=jn(()=>e.next());if(o==="success"){let{done:l,value:u}=a;l&&(clearInterval(n),t(u))}else clearInterval(n),i(s)},0)})})(vf||(vf={}));var Wx=class{maxRetry;timeSpan;#e=0;constructor(e,t){this.maxRetry=e,this.timeSpan=t}retry(e,t){return++this.#e===this.maxRetry?!1:(console.debug(`${e} > will retry in ${this.timeSpan.toString()}`),setTimeout(t,this.timeSpan.millis()),!0)}},yf;(function(r){class e{value;status="resolved";constructor(s){this.value=s}error=Ta("Cannot access error when promise is resolved")}r.ResolveResult=e;class t{error;status="rejected";constructor(s){this.error=s}value=Ta("Cannot access value when promise is rejected")}r.RejectedResult=t,r.makeAbortable=async(a,s)=>{let l=!0;return a.own(K.create(()=>l=!1)),new Promise((u,p)=>s.then(d=>{l&&u(d)},d=>{l&&p(d)}))},r.tryCatch=a=>a.then(s=>new e(s),s=>new t(s));let i=new Wx(3,Vu.seconds(3));r.retry=(a,s=i)=>a().catch(l=>new Promise((u,p)=>{let d=f=>{s.retry(f,()=>a().then(v=>u(v),d))||p(f)};d(l)})),r.guardedRetry=(a,s)=>{let l=async(u=0)=>{try{return await a()}catch(p){if(s(p,++u))return console.debug("retrying after failure:",p),await vf.timeSpan(Vu.seconds(1)),l(u);throw new Error(`Failed after ${u} retries: ${p}`)}};return l()},r.approvedRetry=(a,s)=>{let l=async()=>{try{return await a()}catch(u){if(await al.approve(s(u)))return l();throw u}};return l()},r.fail=(a,s)=>{let l=()=>new Promise((u,p)=>setTimeout(()=>p("fails first"),a.millis()));return()=>{let u=l();return l=s,u}},r.timeout=(a,s,l)=>new Promise((u,p)=>{let d=!0,f=setTimeout(()=>{d=!1,p(new Error(l??"timeout"))},s.millis());a.then(v=>{d&&u(v)},v=>{d&&p(v)}).finally(()=>clearTimeout(f))}),r.sequentialAll=a=>a.reduce((s,l)=>s.then(async u=>[...u,await l()]),Promise.resolve([])),r.sequentialize=a=>{let s=Promise.resolve();return l=>{let u=()=>a(l),p=s.then(u,u);return s=p.catch(()=>{}),p}},r.memoizeAsync=(a,s)=>{let l=null,u=Date.now();return()=>{let p=Date.now();return(Ia(l)||Z(s)&&p-u>s.millis())&&(u=p,l=a(),l.catch(d=>(l=null,d))),l}},r.allWithLimit=async(a,s=1)=>{let l=new Array(a.length),u=0,p=!1,d=async()=>{for(;u<a.length&&!p;){let f=u++;try{let v=await a[f]();p||(l[f]=v)}catch(v){throw p=!0,v}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},d)),l},r.allSettledWithLimit=async(a,s=1)=>{let l=new Array(a.length),u=0,p=async()=>{for(;u<a.length;){let d=u++;try{let f=await a[d]();l[d]={status:"fulfilled",value:f}}catch(f){l[d]={status:"rejected",reason:f}}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},p)),l};class n{max;#e;#t=0;constructor(s=1){this.max=s,this.#e=[]}async add(s){if(this.#t<this.max)return this.#t++,s().finally(()=>this.#r());{let l=Promise.withResolvers();return this.#e.push([s,l]),l.promise.finally(()=>this.#r())}}#r(){if(I(this.#t>0,"Internal Error in Promises.Limit"),--this.#t<this.max&&this.#e.length>0){let[s,{resolve:l,reject:u}]=this.#e.shift();this.#t++,s().then(l,u)}}}r.Limit=n;class o{#e;#t;#r;#i=g.None;constructor(s,l,u){this.#e=s,this.#t=l,this.#r=u}update(s){this.#i=g.wrap(s),s.then(l=>{this.#i.contains(s)&&this.#e(l)}).catch(l=>{this.#i.contains(s)&&this.#t(l)}).finally(()=>{this.#i.contains(s)&&(this.terminate(),_(this.#r))})}terminate(){this.#i=g.None}}r.Latest=o})(yf||(yf={}));var IP=(r,e)=>qn.executor(e,new class{sendUpdates(t){r.beginTransaction(),t.forEach(i=>{let n=i.type;n==="new"?r.createBox(i.name,i.uuid,o=>o.read(new lt(i.buffer))):n==="update-primitive"?r.findVertex(Ae.reconstruct(i.address)).unwrap(()=>`Could not find primitive field ${i.address}`).setValue(i.value):n==="update-pointer"?r.findVertex(Ae.reconstruct(i.address)).unwrap(()=>`Could not find pointer field ${i.address}`).targetAddress=Z(i.target)?g.wrap(Ae.reconstruct(i.target)):g.None:i.type==="delete"&&r.unstageBox(r.findBox(i.uuid).unwrap(()=>`Could not find box ${w.toString(i.uuid)}`))}),r.endTransaction()}checksum(t){return R.equals(r.checksum(),t)?Promise.resolve():Promise.reject("Checksum mismatch")}});var xf=class{#e=0;#t=!1;#r=!1;isRecording=!1;isCountingIn=!1;metronomeEnabled=!1;getLeapStateAndReset(){let e=this.#r;return this.#r=!1,e}get position(){return this.#e}set position(e){this.#e=e,this.#r=!0}get transporting(){return this.#t}set transporting(e){this.#t!==e&&(this.#t=e)}pause(){this.#t=!1,this.isRecording=!1,this.isCountingIn=!1}advanceTo(e){this.#e=e}};var CP;(function(r){r.NoSync="nosync",r.Pitch="pitch",r.Timestretch="timestretch",r.AudioFit="audiofit"})(CP||(CP={}));var TP;(function(r){r[r.Pre=0]="Pre",r[r.Post=1]="Post"})(TP||(TP={}));var St;(function(r){r.Instrument="instrument",r.Bus="bus",r.Aux="aux",r.Output="output"})(St||(St={}));var ml={white:new _t(0,0,100),blue:new _t(189,100,65),green:new _t(150,77,69),yellow:new _t(60,100,84),cream:new _t(65,20,83),orange:new _t(31,100,73),red:new _t(354,100,65),purple:new _t(314,100,78),bright:new _t(197,0,100),gray:new _t(197,31,85),dark:new _t(197,15,62),shadow:new _t(197,10,42),black:new _t(197,10,14),background:new _t(197,6,5),panelBackground:new _t(197,14,7),panelBackgroundBright:new _t(197,14,10),panelBackgroundDark:new _t(197,14,6)};var Me;(function(r){r[r.Add=0]="Add",r[r.Adsr=1]="Adsr",r[r.ArrayDown=2]="ArrayDown",r[r.AudioBus=3]="AudioBus",r[r.AudioDevice=4]="AudioDevice",r[r.AudioFile=5]="AudioFile",r[r.AutoGain=6]="AutoGain",r[r.Automation=7]="Automation",r[r.BassGuitar=8]="BassGuitar",r[r.Book=9]="Book",r[r.Box=10]="Box",r[r.Bug=11]="Bug",r[r.Fold=12]="Fold",r[r.Checkbox=13]="Checkbox",r[r.Clips=14]="Clips",r[r.Close=15]="Close",r[r.CloudFolder=16]="CloudFolder",r[r.CollapseDown=17]="CollapseDown",r[r.Compressor=18]="Compressor",r[r.Connected=19]="Connected",r[r.Cube=20]="Cube",r[r.Cursor=21]="Cursor",r[r.Curve=22]="Curve",r[r.Dattorro=23]="Dattorro",r[r.Delete=24]="Delete",r[r.Dial=25]="Dial",r[r.DinSlot=26]="DinSlot",r[r.Disconnected=27]="Disconnected",r[r.Divide=28]="Divide",r[r.DragConnections=29]="DragConnections",r[r.Dropdown=30]="Dropdown",r[r.Dropbox=31]="Dropbox",r[r.DrumSet=32]="DrumSet",r[r.Tidal=33]="Tidal",r[r.Duration=34]="Duration",r[r.EditBox=35]="EditBox",r[r.Effects=36]="Effects",r[r.Embed=37]="Embed",r[r.EQ=38]="EQ",r[r.Eraser=39]="Eraser",r[r.Exclude=40]="Exclude",r[r.Exit=41]="Exit",r[r.ExpandWidth=42]="ExpandWidth",r[r.FileList=43]="FileList",r[r.Flask=44]="Flask",r[r.Focus=45]="Focus",r[r.Generator=46]="Generator",r[r.GoogleDrive=47]="GoogleDrive",r[r.Groove=48]="Groove",r[r.Guitar=49]="Guitar",r[r.GuitarTab=50]="GuitarTab",r[r.Headphone=51]="Headphone",r[r.Heart=52]="Heart",r[r.Help=53]="Help",r[r.HighPass=54]="HighPass",r[r.HighShelf=55]="HighShelf",r[r.Insert=56]="Insert",r[r.Invert=57]="Invert",r[r.Loop=58]="Loop",r[r.LowPass=59]="LowPass",r[r.LowShelf=60]="LowShelf",r[r.Magnet=61]="Magnet",r[r.MainMenu=62]="MainMenu",r[r.Maximized=63]="Maximized",r[r.Menu=64]="Menu",r[r.Merge=65]="Merge",r[r.Metronome=66]="Metronome",r[r.Microphone=67]="Microphone",r[r.Midi=68]="Midi",r[r.Minimized=69]="Minimized",r[r.Mix=70]="Mix",r[r.Mixing=71]="Mixing",r[r.Mute=72]="Mute",r[r.NanoWave=73]="NanoWave",r[r.New=74]="New",r[r.NoAudio=75]="NoAudio",r[r.Note=76]="Note",r[r.NotePad=77]="NotePad",r[r.OpenDAW=78]="OpenDAW",r[r.Panel=79]="Panel",r[r.Peak=80]="Peak",r[r.Pencil=81]="Pencil",r[r.Piano=82]="Piano",r[r.Play=83]="Play",r[r.Playfield=84]="Playfield",r[r.PlayOnce=85]="PlayOnce",r[r.PlayRepeat=86]="PlayRepeat",r[r.PlayAlternate=87]="PlayAlternate",r[r.Pointer=88]="Pointer",r[r.Popout=89]="Popout",r[r.Primary=90]="Primary",r[r.Random=91]="Random",r[r.Record=92]="Record",r[r.Rectangle=93]="Rectangle",r[r.Region=94]="Region",r[r.Robot=95]="Robot",r[r.RoundDown=96]="RoundDown",r[r.RoundUp=97]="RoundUp",r[r.Run=98]="Run",r[r.Sawtooth=99]="Sawtooth",r[r.Saxophone=100]="Saxophone",r[r.Scissors=101]="Scissors",r[r.Search=102]="Search",r[r.Shadertoy=103]="Shadertoy",r[r.Sine=104]="Sine",r[r.Solo=105]="Solo",r[r.SoundFont=106]="SoundFont",r[r.SpeakerHeadphone=107]="SpeakerHeadphone",r[r.Square=108]="Square",r[r.Stack=109]="Stack",r[r.Start=110]="Start",r[r.Stereo=111]="Stereo",r[r.Stop=112]="Stop",r[r.Subtract=113]="Subtract",r[r.Sun=114]="Sun",r[r.Swap=115]="Swap",r[r.System=116]="System",r[r.Table=117]="Table",r[r.Tape=118]="Tape",r[r.TapeReel=119]="TapeReel",r[r.Time=120]="Time",r[r.Timeline=121]="Timeline",r[r.Tool=122]="Tool",r[r.Triangle=123]="Triangle",r[r.Unknown=124]="Unknown",r[r.UserFolder=125]="UserFolder",r[r.Velocity=126]="Velocity",r[r.Vinyl=127]="Vinyl",r[r.VUMeter=128]="VUMeter",r[r.Waveform=129]="Waveform",r[r.Zeitgeist=130]="Zeitgeist"})(Me||(Me={}));(function(r){r.toName=e=>r[e],r.fromName=e=>r[e]??r.Rectangle})(Me||(Me={}));var c;(function(r){r[r.Deprecated=NaN]="Deprecated",r[r.MetaData=0]="MetaData",r[r.AudioBusses=1]="AudioBusses",r[r.AudioConnection=2]="AudioConnection",r[r.AudioEffectHost=3]="AudioEffectHost",r[r.AudioFile=4]="AudioFile",r[r.AudioOutput=5]="AudioOutput",r[r.AudioPlayMode=6]="AudioPlayMode",r[r.AudioUnit=7]="AudioUnit",r[r.AudioUnits=8]="AudioUnits",r[r.Automation=9]="Automation",r[r.AuxSend=10]="AuxSend",r[r.Capture=11]="Capture",r[r.ClipCollection=12]="ClipCollection",r[r.ConnectionCollection=13]="ConnectionCollection",r[r.Device=14]="Device",r[r.DeviceUserInterface=15]="DeviceUserInterface",r[r.Editing=16]="Editing",r[r.FileUploadState=17]="FileUploadState",r[r.Groove=18]="Groove",r[r.InstrumentHost=19]="InstrumentHost",r[r.MarkerEvents=20]="MarkerEvents",r[r.MarkerTrack=21]="MarkerTrack",r[r.MidiControl=22]="MidiControl",r[r.MIDIDevice=23]="MIDIDevice",r[r.MidiEffectHost=24]="MidiEffectHost",r[r.ModularSetup=25]="ModularSetup",r[r.Modulation=26]="Modulation",r[r.ModuleCollection=27]="ModuleCollection",r[r.NoteEventCollection=28]="NoteEventCollection",r[r.NoteEventFeature=29]="NoteEventFeature",r[r.NoteEvents=30]="NoteEvents",r[r.NotesConnection=31]="NotesConnection",r[r.Parameter=32]="Parameter",r[r.ParameterController=33]="ParameterController",r[r.PianoMode=34]="PianoMode",r[r.RegionCollection=35]="RegionCollection",r[r.Sample=36]="Sample",r[r.Selection=37]="Selection",r[r.Shadertoy=38]="Shadertoy",r[r.SoundfontFile=39]="SoundfontFile",r[r.StepAutomation=40]="StepAutomation",r[r.Timeline=41]="Timeline",r[r.TrackCollection=42]="TrackCollection",r[r.TransientMarkers=43]="TransientMarkers",r[r.User=44]="User",r[r.ValueEventCollection=45]="ValueEventCollection",r[r.ValueEvents=46]="ValueEvents",r[r.ValueInterpolation=47]="ValueInterpolation",r[r.VoltageConnection=48]="VoltageConnection",r[r.WarpMarkers=49]="WarpMarkers"})(c||(c={}));var ko;(function(r){r[r.Once=0]="Once",r[r.Repeat=1]="Repeat",r[r.Pingpong=2]="Pingpong"})(ko||(ko={}));var pn;(function(r){r[r.Monophonic=0]="Monophonic",r[r.Polyphonic=1]="Polyphonic"})(pn||(pn={}));var RP=(r,e)=>{if(r===e)return 0;let t=r-e;return t===0?F(`Indices cannot be equal (${r}, ${e})`):t};var Hn=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},jt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},wf,Ci,$o,bf,Jn,Lt=class r{static create(e,t,i){return new r(e,t,i)}constructor(e,t,i){wf.set(this,void 0),Ci.set(this,void 0),$o.set(this,void 0),bf.set(this,void 0),Jn.set(this,null),Hn(this,wf,e,"f"),Hn(this,Ci,w.newSet(n=>n.adapter.uuid),"f"),Hn(this,$o,new Mt,"f"),Hn(this,bf,e.pointerHub.catchupAndSubscribe({onAdded:n=>{Hn(this,Jn,null,"f");let o=t(n.box),a=o.indexField.subscribe(()=>{Hn(this,Jn,null,"f"),jt(this,$o,"f").proxy.onReorder(o)}),s=jt(this,Ci,"f").add({adapter:o,subscription:a});I(s,`Could not add ${o}`),jt(this,$o,"f").proxy.onAdd(o)},onRemoved:n=>{Hn(this,Jn,null,"f");let o=n.box.address.uuid,{adapter:a,subscription:s}=jt(this,Ci,"f").removeByKey(o);s.terminate(),jt(this,$o,"f").proxy.onRemove(a)}},i),"f")}field(){return jt(this,wf,"f")}subscribe(e){return jt(this,$o,"f").subscribe(e)}catchupAndSubscribe(e){return jt(this,Ci,"f").forEach(({adapter:t})=>e.onAdd(t)),this.subscribe(e)}getAdapterByIndex(e){let t=Ye.exactMapped(this.adapters(),e,RP,i=>i.indexField.getValue());return t===-1?g.None:g.wrap(this.adapters()[t])}getAdapterById(e){return jt(this,Ci,"f").opt(e).map(({adapter:t})=>t)}getMinFreeIndex(){let e=this.adapters();for(let t=0;t<e.length;t++)if(e[t].indexField.getValue()>t)return t;return e.length}adapters(){return jt(this,Jn,"f")===null&&Hn(this,Jn,jt(this,Ci,"f").values().map(({adapter:e})=>e).sort((e,t)=>e.indexField.getValue()-t.indexField.getValue()),"f"),jt(this,Jn,"f")}move(e,t){this.moveIndex(e.indexField.getValue(),t)}moveIndex(e,t){let i=this.adapters(),n=i[e];if(t<0){let o=le(e+t,0,i.length-1);for(let a=o;a<e;a++)i[a].indexField.setValue(a+1);n.indexField.setValue(o)}else if(t>1){let o=le(e+(t-1),0,i.length-1);for(let a=e;a<o;a++)i[a+1].indexField.setValue(a);n.indexField.setValue(o)}else console.warn(`moveIndex had no effect: startIndex: ${e}, delta: ${t}`)}size(){return jt(this,Ci,"f").size()}isEmpty(){return this.size()===0}terminate(){Hn(this,Jn,null,"f"),jt(this,Ci,"f").forEach(({subscription:e})=>e.terminate()),jt(this,Ci,"f").clear(),jt(this,$o,"f").terminate(),jt(this,bf,"f").terminate()}};wf=new WeakMap,Ci=new WeakMap,$o=new WeakMap,bf=new WeakMap,Jn=new WeakMap;var La;(function(r){r.create=(e,t,i,n)=>{switch(e){case"MetaDataBox":return Qn.create(t,i,n);case"RootBox":return gl.create(t,i,n);case"SelectionBox":return hn.create(t,i,n);case"UserInterfaceBox":return Ka.create(t,i,n);case"UploadFileBox":return Af.create(t,i,n);case"ShadertoyBox":return _f.create(t,i,n);case"TimelineBox":return Wa.create(t,i,n);case"TrackBox":return lr.create(t,i,n);case"NoteEventBox":return Mo.create(t,i,n);case"NoteEventRepeatBox":return Pf.create(t,i,n);case"NoteEventCollectionBox":return Yn.create(t,i,n);case"NoteRegionBox":return Za.create(t,i,n);case"NoteClipBox":return vl.create(t,i,n);case"ValueEventBox":return Do.create(t,i,n);case"ValueEventCollectionBox":return Xn.create(t,i,n);case"ValueEventCurveBox":return Io.create(t,i,n);case"ValueRegionBox":return Ga.create(t,i,n);case"ValueClipBox":return yl.create(t,i,n);case"AudioRegionBox":return Co.create(t,i,n);case"AudioClipBox":return xl.create(t,i,n);case"AudioPitchStretchBox":return wl.create(t,i,n);case"AudioTimeStretchBox":return bl.create(t,i,n);case"TransientMarkerBox":return Sf.create(t,i,n);case"WarpMarkerBox":return To.create(t,i,n);case"MarkerBox":return Al.create(t,i,n);case"AudioFileBox":return Tr.create(t,i,n);case"SoundfontFileBox":return ei.create(t,i,n);case"AudioUnitBox":return it.create(t,i,n);case"CaptureAudioBox":return Ro.create(t,i,n);case"CaptureMidiBox":return Oo.create(t,i,n);case"AudioBusBox":return Ti.create(t,i,n);case"AuxSendBox":return qa.create(t,i,n);case"GrooveShuffleBox":return _l.create(t,i,n);case"UnknownAudioEffectDeviceBox":return Ef.create(t,i,n);case"UnknownMidiEffectDeviceBox":return Bf.create(t,i,n);case"DeviceInterfaceKnobBox":return Ff.create(t,i,n);case"ModularDeviceBox":return Nf.create(t,i,n);case"StereoToolDeviceBox":return kf.create(t,i,n);case"CompressorDeviceBox":return Pl.create(t,i,n);case"DelayDeviceBox":return $f.create(t,i,n);case"CrusherDeviceBox":return Mf.create(t,i,n);case"DattorroReverbDeviceBox":return Df.create(t,i,n);case"VelocityDeviceBox":return If.create(t,i,n);case"FoldDeviceBox":return Cf.create(t,i,n);case"TidalDeviceBox":return Tf.create(t,i,n);case"RevampDeviceBox":return Rf.create(t,i,n);case"ReverbDeviceBox":return Of.create(t,i,n);case"VaporisateurDeviceBox":return Sl.create(t,i,n);case"MIDIOutputDeviceBox":return El.create(t,i,n);case"MIDIOutputBox":return Ri.create(t,i,n);case"MIDIOutputParameterBox":return Oi.create(t,i,n);case"SoundfontDeviceBox":return Bl.create(t,i,n);case"NanoDeviceBox":return Fl.create(t,i,n);case"PlayfieldDeviceBox":return Nl.create(t,i,n);case"PlayfieldSampleBox":return Vo.create(t,i,n);case"TapeDeviceBox":return kl.create(t,i,n);case"ArpeggioDeviceBox":return Vf.create(t,i,n);case"PitchDeviceBox":return zf.create(t,i,n);case"ZeitgeistDeviceBox":return Uf.create(t,i,n);case"ModularBox":return jf.create(t,i,n);case"ModuleConnectionBox":return Lf.create(t,i,n);case"ModularAudioInputBox":return Kf.create(t,i,n);case"ModularAudioOutputBox":return Wf.create(t,i,n);case"ModuleDelayBox":return Zf.create(t,i,n);case"ModuleMultiplierBox":return Gf.create(t,i,n);case"ModuleGainBox":return qf.create(t,i,n);default:return F(`Unknown box class '${e}'`)}},r.deserialize=(e,t)=>{let i=new lt(t),n=i.readString(),o=w.fromDataInput(i),a=r.create(n,e,o);return a.read(i),a}})(La||(La={}));var Qn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MetaDataBox",pointerRules:h}),i)}static ClassName="MetaDataBox";constructor(e){super(e)}accept(e){return _(e.visitMetaDataBox,this)}get target(){return this.getField(1)}get origin(){return this.getField(2)}get value(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"target",deprecated:!1,pointerRules:h},c.MetaData,!0),2:C.create({parent:this,fieldKey:2,fieldName:"origin",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"value",deprecated:!1,pointerRules:h})}}};var Hf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get keyboard(){return this.getField(1)}get timeRangeInQuarters(){return this.getField(2)}get noteScale(){return this.getField(3)}get noteLabels(){return this.getField(4)}get transpose(){return this.getField(5)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"keyboard",deprecated:!1,pointerRules:h},{length:4},"",0),2:b.create({parent:this,fieldKey:2,fieldName:"timeRangeInQuarters",deprecated:!1,pointerRules:h},{min:1,max:64,scaling:"linear"},"",8),3:b.create({parent:this,fieldKey:3,fieldName:"noteScale",deprecated:!1,pointerRules:h},{min:.5,max:2,scaling:"linear"},"",1),4:$.create({parent:this,fieldKey:4,fieldName:"noteLabels",deprecated:!1,pointerRules:h},!1),5:E.create({parent:this,fieldKey:5,fieldName:"transpose",deprecated:!1,pointerRules:h},{min:-48,max:48},"st",0)}}};var gl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RootBox",pointerRules:h}),i)}static ClassName="RootBox";constructor(e){super(e)}accept(e){return _(e.visitRootBox,this)}get timeline(){return this.getField(1)}get users(){return this.getField(2)}get created(){return this.getField(3)}get groove(){return this.getField(4)}get modularSetups(){return this.getField(10)}get audioUnits(){return this.getField(20)}get audioBusses(){return this.getField(21)}get outputDevice(){return this.getField(30)}get outputMidiDevices(){return this.getField(35)}get pianoMode(){return this.getField(40)}get shadertoy(){return this.getField(100)}get editingChannel(){return this.getField(111)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"timeline",deprecated:!1,pointerRules:h},c.Timeline,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"users",deprecated:!1,pointerRules:{accepts:[c.User],mandatory:!0}}),3:C.create({parent:this,fieldKey:3,fieldName:"created",deprecated:!1,pointerRules:h}),4:B.create({parent:this,fieldKey:4,fieldName:"groove",deprecated:!1,pointerRules:h},c.Groove,!0),10:W.hook({parent:this,fieldKey:10,fieldName:"modularSetups",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!1}}),20:W.hook({parent:this,fieldKey:20,fieldName:"audioUnits",deprecated:!1,pointerRules:{accepts:[c.AudioUnits],mandatory:!1}}),21:W.hook({parent:this,fieldKey:21,fieldName:"audioBusses",deprecated:!1,pointerRules:{accepts:[c.AudioBusses],mandatory:!1}}),30:W.hook({parent:this,fieldKey:30,fieldName:"outputDevice",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!0}}),35:W.hook({parent:this,fieldKey:35,fieldName:"outputMidiDevices",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!1}}),40:Hf.create({parent:this,fieldKey:40,fieldName:"pianoMode",deprecated:!1,pointerRules:h}),100:B.create({parent:this,fieldKey:100,fieldName:"shadertoy",deprecated:!1,pointerRules:h},c.Shadertoy,!1),111:B.create({parent:this,fieldKey:111,fieldName:"editingChannel",deprecated:!1,pointerRules:h},c.Editing,!1)}}};var hn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SelectionBox",pointerRules:h}),i)}static ClassName="SelectionBox";constructor(e){super(e)}accept(e){return _(e.visitSelectionBox,this)}get selection(){return this.getField(1)}get selectable(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"selection",deprecated:!1,pointerRules:h},c.Selection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"selectable",deprecated:!1,pointerRules:h},c.Selection,!0)}}};var Ka=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UserInterfaceBox",pointerRules:{accepts:[c.MetaData],mandatory:!1}}),i)}static ClassName="UserInterfaceBox";constructor(e){super(e)}accept(e){return _(e.visitUserInterfaceBox,this)}get root(){return this.getField(1)}get selection(){return this.getField(10)}get uploadStates(){return this.getField(11)}get editingDeviceChain(){return this.getField(21)}get editingTimelineRegion(){return this.getField(22)}get editingModularSystem(){return this.getField(23)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:h},c.User,!0),10:W.hook({parent:this,fieldKey:10,fieldName:"selection",deprecated:!1,pointerRules:{accepts:[c.Selection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"uploadStates",deprecated:!1,pointerRules:{accepts:[c.FileUploadState],mandatory:!1}}),21:B.create({parent:this,fieldKey:21,fieldName:"editingDeviceChain",deprecated:!1,pointerRules:h},c.Editing,!1),22:B.create({parent:this,fieldKey:22,fieldName:"editingTimelineRegion",deprecated:!1,pointerRules:h},c.Editing,!1),23:B.create({parent:this,fieldKey:23,fieldName:"editingModularSystem",deprecated:!1,pointerRules:h},c.Editing,!1)}}};var Af=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UploadFileBox",pointerRules:h}),i)}static ClassName="UploadFileBox";constructor(e){super(e)}accept(e){return _(e.visitUploadFileBox,this)}get user(){return this.getField(1)}get file(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"user",deprecated:!1,pointerRules:h},c.FileUploadState,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.FileUploadState,!0)}}};var _f=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ShadertoyBox",pointerRules:{accepts:[c.Shadertoy],mandatory:!0}}),i)}static ClassName="ShadertoyBox";constructor(e){super(e)}accept(e){return _(e.visitShadertoyBox,this)}get shaderCode(){return this.getField(1)}get highres(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"shaderCode",deprecated:!1,pointerRules:h}),2:$.create({parent:this,fieldKey:2,fieldName:"highres",deprecated:!1,pointerRules:h},!0)}}};var Jf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get nominator(){return this.getField(1)}get denominator(){return this.getField(2)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"nominator",deprecated:!1,pointerRules:h},{min:1,max:32},"",4),2:E.create({parent:this,fieldKey:2,fieldName:"denominator",deprecated:!1,pointerRules:h},{min:1,max:32},"",4)}}};var Qf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get from(){return this.getField(2)}get to(){return this.getField(3)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),2:E.create({parent:this,fieldKey:2,fieldName:"from",deprecated:!1,pointerRules:h},"any","ppqn",0),3:E.create({parent:this,fieldKey:3,fieldName:"to",deprecated:!1,pointerRules:h},"any","ppqn",15360)}}};var Yf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get markers(){return this.getField(1)}get index(){return this.getField(10)}get enabled(){return this.getField(20)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"markers",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),20:$.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:h},!0)}}};var Wa=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TimelineBox",pointerRules:h}),i)}static ClassName="TimelineBox";constructor(e){super(e)}accept(e){return _(e.visitTimelineBox,this)}get root(){return this.getField(1)}get signature(){return this.getField(10)}get loopArea(){return this.getField(11)}get deprecatedMarkerTrack(){return this.getField(20)}get markerTrack(){return this.getField(21)}get durationInPulses(){return this.getField(30)}get bpm(){return this.getField(31)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:{accepts:[c.Timeline],mandatory:!0}}),10:Jf.create({parent:this,fieldKey:10,fieldName:"signature",deprecated:!1,pointerRules:h}),11:Qf.create({parent:this,fieldKey:11,fieldName:"loopArea",deprecated:!1,pointerRules:h}),20:W.hook({parent:this,fieldKey:20,fieldName:"deprecatedMarkerTrack",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1}}),21:Yf.create({parent:this,fieldKey:21,fieldName:"markerTrack",deprecated:!1,pointerRules:h}),30:E.create({parent:this,fieldKey:30,fieldName:"durationInPulses",deprecated:!1,pointerRules:h},"positive","ppqn",491520),31:b.create({parent:this,fieldKey:31,fieldName:"bpm",deprecated:!1,pointerRules:h},{min:30,max:999,scaling:"exponential"},"bpm",120)}}};var lr=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TrackBox",pointerRules:{accepts:[c.Selection,c.PianoMode,c.MetaData],mandatory:!1}}),i)}static ClassName="TrackBox";constructor(e){super(e)}accept(e){return _(e.visitTrackBox,this)}get tracks(){return this.getField(1)}get target(){return this.getField(2)}get regions(){return this.getField(3)}get clips(){return this.getField(4)}get index(){return this.getField(10)}get type(){return this.getField(11)}get enabled(){return this.getField(20)}get excludePianoMode(){return this.getField(30)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"tracks",deprecated:!1,pointerRules:h},c.TrackCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"target",deprecated:!1,pointerRules:h},c.Automation,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"regions",deprecated:!1,pointerRules:{accepts:[c.RegionCollection],mandatory:!1}}),4:W.hook({parent:this,fieldKey:4,fieldName:"clips",deprecated:!1,pointerRules:{accepts:[c.ClipCollection],mandatory:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),11:E.create({parent:this,fieldKey:11,fieldName:"type",deprecated:!1,pointerRules:h},{values:[0,1,2,3]},""),20:$.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),30:$.create({parent:this,fieldKey:30,fieldName:"excludePianoMode",deprecated:!1,pointerRules:h},!1)}}};var Mo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventBox",pointerRules:{accepts:[c.Selection,c.NoteEventFeature],mandatory:!1}}),i)}static ClassName="NoteEventBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get pitch(){return this.getField(20)}get velocity(){return this.getField(21)}get playCount(){return this.getField(22)}get playCurve(){return this.getField(23)}get cent(){return this.getField(24)}get chance(){return this.getField(25)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn",240),20:E.create({parent:this,fieldKey:20,fieldName:"pitch",deprecated:!1,pointerRules:h},{min:0,max:127},"",60),21:b.create({parent:this,fieldKey:21,fieldName:"velocity",deprecated:!1,pointerRules:h},"unipolar","%",.7874015748031497),22:E.create({parent:this,fieldKey:22,fieldName:"playCount",deprecated:!1,pointerRules:h},{min:1,max:128},"",1),23:b.create({parent:this,fieldKey:23,fieldName:"playCurve",deprecated:!1,pointerRules:h},"bipolar","%",0),24:b.create({parent:this,fieldKey:24,fieldName:"cent",deprecated:!1,pointerRules:h},{min:-50,max:50,scaling:"linear"},"ct",0),25:E.create({parent:this,fieldKey:25,fieldName:"chance",deprecated:!1,pointerRules:h},{min:0,max:100},"",100)}}};var Pf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventRepeatBox",pointerRules:h}),i)}static ClassName="NoteEventRepeatBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventRepeatBox,this)}get event(){return this.getField(1)}get count(){return this.getField(2)}get curve(){return this.getField(3)}get length(){return this.getField(4)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:h},c.NoteEventFeature,!0),2:E.create({parent:this,fieldKey:2,fieldName:"count",deprecated:!1,pointerRules:h},{min:1,max:128},"",1),3:b.create({parent:this,fieldKey:3,fieldName:"curve",deprecated:!1,pointerRules:h},"bipolar","%",0),4:b.create({parent:this,fieldKey:4,fieldName:"length",deprecated:!1,pointerRules:h},"unipolar","%",1)}}};var Yn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="NoteEventCollectionBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.NoteEvents],mandatory:!1}}),2:W.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.NoteEventCollection],mandatory:!0}})}}};var Za=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="NoteRegionBox";constructor(e){super(e)}accept(e){return _(e.visitNoteRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get eventOffset(){return this.getField(14)}get mute(){return this.getField(15)}get label(){return this.getField(16)}get hue(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"positive","ppqn"),14:E.create({parent:this,fieldKey:14,fieldName:"eventOffset",deprecated:!1,pointerRules:h},"any","ppqn"),15:$.create({parent:this,fieldKey:15,fieldName:"mute",deprecated:!1,pointerRules:h}),16:C.create({parent:this,fieldKey:16,fieldName:"label",deprecated:!1,pointerRules:h}),17:E.create({parent:this,fieldKey:17,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var zo=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get loop(){return this.getField(1)}get reverse(){return this.getField(2)}get mute(){return this.getField(3)}get speed(){return this.getField(4)}get quantise(){return this.getField(5)}get trigger(){return this.getField(6)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"loop",deprecated:!1,pointerRules:h},!0),2:$.create({parent:this,fieldKey:2,fieldName:"reverse",deprecated:!1,pointerRules:h}),3:$.create({parent:this,fieldKey:3,fieldName:"mute",deprecated:!0,pointerRules:h}),4:E.create({parent:this,fieldKey:4,fieldName:"speed",deprecated:!1,pointerRules:h},"non-negative",""),5:E.create({parent:this,fieldKey:5,fieldName:"quantise",deprecated:!1,pointerRules:h},"non-negative",""),6:E.create({parent:this,fieldKey:6,fieldName:"trigger",deprecated:!1,pointerRules:h},"non-negative","")}}};var vl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="NoteClipBox";constructor(e){super(e)}accept(e){return _(e.visitNoteClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Do=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ValueEventBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get index(){return this.getField(11)}get interpolation(){return this.getField(12)}get value(){return this.getField(13)}get slope(){return this.getField(14)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),12:E.create({parent:this,fieldKey:12,fieldName:"interpolation",deprecated:!1,pointerRules:{accepts:[c.ValueInterpolation],mandatory:!1}},{values:[0,1]},"",1),13:b.create({parent:this,fieldKey:13,fieldName:"value",deprecated:!1,pointerRules:h},"unipolar","%"),14:b.create({parent:this,fieldKey:14,fieldName:"slope",deprecated:!0,pointerRules:h},"any","",NaN)}}};var Xn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ValueEventCollectionBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.ValueEvents],mandatory:!1}}),2:W.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.ValueEventCollection],mandatory:!0}})}}};var Io=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCurveBox",pointerRules:h}),i)}static ClassName="ValueEventCurveBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventCurveBox,this)}get event(){return this.getField(1)}get slope(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:h},c.ValueInterpolation,!0),2:b.create({parent:this,fieldKey:2,fieldName:"slope",deprecated:!1,pointerRules:h},"unipolar","%",.5)}}};var Ga=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="ValueRegionBox";constructor(e){super(e)}accept(e){return _(e.visitValueRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"positive","ppqn"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:h}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:h}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var yl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="ValueClipBox";constructor(e){super(e)}accept(e){return _(e.visitValueClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Co=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioRegionBox";constructor(e){super(e)}accept(e){return _(e.visitAudioRegionBox,this)}get regions(){return this.getField(1)}get file(){return this.getField(2)}get playback(){return this.getField(3)}get timeBase(){return this.getField(4)}get events(){return this.getField(5)}get warping(){return this.getField(6)}get waveformOffset(){return this.getField(7)}get playMode(){return this.getField(8)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),3:C.create({parent:this,fieldKey:3,fieldName:"playback",deprecated:!0,pointerRules:h}),4:C.create({parent:this,fieldKey:4,fieldName:"timeBase",deprecated:!1,pointerRules:h},"musical"),5:B.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),6:B.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:h},c.Deprecated,!1),7:b.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:h},"any","seconds"),8:B.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:h},c.AudioPlayMode,!1),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:b.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"any","mixed"),12:b.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","mixed"),13:b.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"any","mixed"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:h}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:h}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0"),17:b.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!1,pointerRules:h},"decibel","db")}}};var xl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioClipBox";constructor(e){super(e)}accept(e){return _(e.visitAudioClipBox,this)}get clips(){return this.getField(1)}get file(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get events(){return this.getField(5)}get warping(){return this.getField(6)}get waveformOffset(){return this.getField(7)}get playMode(){return this.getField(8)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}get gain(){return this.getField(14)}get playback(){return this.getField(20)}get timeBase(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),5:B.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),6:B.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:h},c.Deprecated,!1),7:b.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:h},"any","seconds"),8:B.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:h},c.AudioPlayMode,!1),10:b.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"any","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0"),14:b.create({parent:this,fieldKey:14,fieldName:"gain",deprecated:!1,pointerRules:h},"decibel","db"),20:C.create({parent:this,fieldKey:20,fieldName:"playback",deprecated:!0,pointerRules:h}),21:C.create({parent:this,fieldKey:21,fieldName:"timeBase",deprecated:!1,pointerRules:h},"musical")}}};var wl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioPitchStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0}}),i)}static ClassName="AudioPitchStretchBox";constructor(e){super(e)}accept(e){return _(e.visitAudioPitchStretchBox,this)}get warpMarkers(){return this.getField(1)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0}})}}};var bl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioTimeStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0}}),i)}static ClassName="AudioTimeStretchBox";constructor(e){super(e)}accept(e){return _(e.visitAudioTimeStretchBox,this)}get warpMarkers(){return this.getField(1)}get transientPlayMode(){return this.getField(2)}get playbackRate(){return this.getField(3)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0}}),2:E.create({parent:this,fieldKey:2,fieldName:"transientPlayMode",deprecated:!1,pointerRules:h},"positive","enum",2),3:b.create({parent:this,fieldKey:3,fieldName:"playbackRate",deprecated:!1,pointerRules:h},"positive","ratio",1)}}};var Sf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TransientMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="TransientMarkerBox";constructor(e){super(e)}accept(e){return _(e.visitTransientMarkerBox,this)}get owner(){return this.getField(1)}get position(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.TransientMarkers,!0),2:b.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"non-negative","seconds")}}};var To=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"WarpMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="WarpMarkerBox";constructor(e){super(e)}accept(e){return _(e.visitWarpMarkerBox,this)}get owner(){return this.getField(1)}get position(){return this.getField(2)}get seconds(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.WarpMarkers,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),3:b.create({parent:this,fieldKey:3,fieldName:"seconds",deprecated:!1,pointerRules:h},"non-negative","seconds")}}};var Al=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MarkerBox",pointerRules:{accepts:[c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="MarkerBox";constructor(e){super(e)}accept(e){return _(e.visitMarkerBox,this)}get track(){return this.getField(1)}get position(){return this.getField(2)}get plays(){return this.getField(3)}get label(){return this.getField(4)}get hue(){return this.getField(5)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"track",deprecated:!1,pointerRules:h},c.MarkerTrack,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),3:E.create({parent:this,fieldKey:3,fieldName:"plays",deprecated:!1,pointerRules:h},"non-negative","",1),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:h}),5:E.create({parent:this,fieldKey:5,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Tr=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioFileBox",pointerRules:{accepts:[c.AudioFile,c.FileUploadState,c.MetaData],mandatory:!0}}),i)}static ClassName="AudioFileBox";constructor(e){super(e)}accept(e){return _(e.visitAudioFileBox,this)}get startInSeconds(){return this.getField(1)}get endInSeconds(){return this.getField(2)}get fileName(){return this.getField(3)}get transientMarkers(){return this.getField(10)}initializeFields(){return{1:b.create({parent:this,fieldKey:1,fieldName:"startInSeconds",deprecated:!1,pointerRules:h},"non-negative","s"),2:b.create({parent:this,fieldKey:2,fieldName:"endInSeconds",deprecated:!1,pointerRules:h},"non-negative","s"),3:C.create({parent:this,fieldKey:3,fieldName:"fileName",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"transientMarkers",deprecated:!1,pointerRules:{accepts:[c.TransientMarkers],mandatory:!1}})}}};var ei=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontFileBox",pointerRules:{accepts:[c.SoundfontFile],mandatory:!0}}),i)}static ClassName="SoundfontFileBox";constructor(e){super(e)}accept(e){return _(e.visitSoundfontFileBox,this)}get fileName(){return this.getField(1)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"fileName",deprecated:!1,pointerRules:h})}}};var it=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioUnitBox",pointerRules:{accepts:[c.Selection,c.Automation,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioUnitBox";constructor(e){super(e)}accept(e){return _(e.visitAudioUnitBox,this)}get type(){return this.getField(1)}get collection(){return this.getField(2)}get editing(){return this.getField(3)}get index(){return this.getField(11)}get volume(){return this.getField(12)}get panning(){return this.getField(13)}get mute(){return this.getField(14)}get solo(){return this.getField(15)}get tracks(){return this.getField(20)}get midiEffects(){return this.getField(21)}get input(){return this.getField(22)}get audioEffects(){return this.getField(23)}get auxSends(){return this.getField(24)}get output(){return this.getField(25)}get capture(){return this.getField(26)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"type",deprecated:!1,pointerRules:h},"instrument"),2:B.create({parent:this,fieldKey:2,fieldName:"collection",deprecated:!1,pointerRules:h},c.AudioUnits,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1}}),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),12:b.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-96,mid:-9,max:6,scaling:"decibel"},"dB"),13:b.create({parent:this,fieldKey:13,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),15:$.create({parent:this,fieldKey:15,fieldName:"solo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),20:W.hook({parent:this,fieldKey:20,fieldName:"tracks",deprecated:!1,pointerRules:{accepts:[c.TrackCollection],mandatory:!1}}),21:W.hook({parent:this,fieldKey:21,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MidiEffectHost],mandatory:!1}}),22:W.hook({parent:this,fieldKey:22,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.InstrumentHost,c.AudioOutput],mandatory:!1}}),23:W.hook({parent:this,fieldKey:23,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1}}),24:W.hook({parent:this,fieldKey:24,fieldName:"auxSends",deprecated:!1,pointerRules:{accepts:[c.AuxSend],mandatory:!1}}),25:B.create({parent:this,fieldKey:25,fieldName:"output",deprecated:!1,pointerRules:h},c.AudioOutput,!1),26:B.create({parent:this,fieldKey:26,fieldName:"capture",deprecated:!1,pointerRules:h},c.Capture,!1)}}};var Ro=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureAudioBox",pointerRules:{accepts:[c.Capture],mandatory:!0}}),i)}static ClassName="CaptureAudioBox";constructor(e){super(e)}accept(e){return _(e.visitCaptureAudioBox,this)}get deviceId(){return this.getField(1)}get recordMode(){return this.getField(2)}get requestChannels(){return this.getField(10)}get gainDb(){return this.getField(11)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"deviceId",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:h},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"requestChannels",deprecated:!1,pointerRules:h},"any","",1),11:b.create({parent:this,fieldKey:11,fieldName:"gainDb",deprecated:!1,pointerRules:h},"decibel","dB",0)}}};var Oo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureMidiBox",pointerRules:{accepts:[c.Capture],mandatory:!0}}),i)}static ClassName="CaptureMidiBox";constructor(e){super(e)}accept(e){return _(e.visitCaptureMidiBox,this)}get deviceId(){return this.getField(1)}get recordMode(){return this.getField(2)}get channel(){return this.getField(10)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"deviceId",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:h},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"channel",deprecated:!1,pointerRules:h},"any","",-1)}}};var Ti=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioBusBox",pointerRules:h}),i)}static ClassName="AudioBusBox";constructor(e){super(e)}accept(e){return _(e.visitAudioBusBox,this)}get collection(){return this.getField(1)}get output(){return this.getField(2)}get input(){return this.getField(3)}get enabled(){return this.getField(4)}get icon(){return this.getField(5)}get label(){return this.getField(6)}get color(){return this.getField(7)}get minimized(){return this.getField(8)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.AudioBusses,!0),2:B.create({parent:this,fieldKey:2,fieldName:"output",deprecated:!1,pointerRules:h},c.AudioOutput,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!1}}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:C.create({parent:this,fieldKey:5,fieldName:"icon",deprecated:!1,pointerRules:h}),6:C.create({parent:this,fieldKey:6,fieldName:"label",deprecated:!1,pointerRules:h}),7:C.create({parent:this,fieldKey:7,fieldName:"color",deprecated:!1,pointerRules:h},"red"),8:$.create({parent:this,fieldKey:8,fieldName:"minimized",deprecated:!1,pointerRules:h})}}};var qa=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AuxSendBox",pointerRules:h}),i)}static ClassName="AuxSendBox";constructor(e){super(e)}accept(e){return _(e.visitAuxSendBox,this)}get audioUnit(){return this.getField(1)}get targetBus(){return this.getField(2)}get index(){return this.getField(3)}get routing(){return this.getField(4)}get sendGain(){return this.getField(5)}get sendPan(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"audioUnit",deprecated:!1,pointerRules:h},c.AuxSend,!0),2:B.create({parent:this,fieldKey:2,fieldName:"targetBus",deprecated:!1,pointerRules:h},c.AudioOutput,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:E.create({parent:this,fieldKey:4,fieldName:"routing",deprecated:!1,pointerRules:h},{values:[0,1]},"",1),5:b.create({parent:this,fieldKey:5,fieldName:"sendGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB"),6:b.create({parent:this,fieldKey:6,fieldName:"sendPan",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","")}}};var _l=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"GrooveShuffleBox",pointerRules:{accepts:[c.Groove],mandatory:!0}}),i)}static ClassName="GrooveShuffleBox";constructor(e){super(e)}accept(e){return _(e.visitGrooveShuffleBox,this)}get label(){return this.getField(1)}get amount(){return this.getField(10)}get duration(){return this.getField(11)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"label",deprecated:!1,pointerRules:h}),10:b.create({parent:this,fieldKey:10,fieldName:"amount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.6),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"non-negative","ppqn",480)}}};var Ef=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownAudioEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="UnknownAudioEffectDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitUnknownAudioEffectDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get comment(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:h})}}};var Bf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownMidiEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="UnknownMidiEffectDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitUnknownMidiEffectDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get comment(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:h})}}};var Ff=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceInterfaceKnobBox",pointerRules:h}),i)}static ClassName="DeviceInterfaceKnobBox";constructor(e){super(e)}accept(e){return _(e.visitDeviceInterfaceKnobBox,this)}get userInterface(){return this.getField(1)}get parameter(){return this.getField(2)}get index(){return this.getField(3)}get anchor(){return this.getField(10)}get color(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"userInterface",deprecated:!1,pointerRules:h},c.DeviceUserInterface,!0),2:B.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:h},c.ParameterController,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),10:b.create({parent:this,fieldKey:10,fieldName:"anchor",deprecated:!1,pointerRules:h},"unipolar","%"),11:C.create({parent:this,fieldKey:11,fieldName:"color",deprecated:!1,pointerRules:h})}}};var Xf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get elements(){return this.getField(1)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"elements",deprecated:!1,pointerRules:{accepts:[c.DeviceUserInterface],mandatory:!1}})}}};var Nf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ModularDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitModularDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modularSetup(){return this.getField(10)}get userInterface(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"modularSetup",deprecated:!1,pointerRules:h},c.ModularSetup,!0),11:Xf.create({parent:this,fieldKey:11,fieldName:"userInterface",deprecated:!1,pointerRules:h})}}};var kf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"StereoToolDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="StereoToolDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitStereoToolDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get panning(){return this.getField(11)}get stereo(){return this.getField(12)}get invertL(){return this.getField(13)}get invertR(){return this.getField(14)}get swap(){return this.getField(15)}get panningMixing(){return this.getField(20)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-72,mid:0,max:12,scaling:"decibel"},"dB",0),11:b.create({parent:this,fieldKey:11,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),12:b.create({parent:this,fieldKey:12,fieldName:"stereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),13:$.create({parent:this,fieldKey:13,fieldName:"invertL",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),14:$.create({parent:this,fieldKey:14,fieldName:"invertR",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),15:$.create({parent:this,fieldKey:15,fieldName:"swap",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),20:E.create({parent:this,fieldKey:20,fieldName:"panningMixing",deprecated:!1,pointerRules:h},{values:[0,1]},"",1)}}};var Pl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CompressorDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="CompressorDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitCompressorDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get lookahead(){return this.getField(10)}get automakeup(){return this.getField(11)}get autoattack(){return this.getField(12)}get autorelease(){return this.getField(13)}get inputgain(){return this.getField(14)}get threshold(){return this.getField(15)}get ratio(){return this.getField(16)}get knee(){return this.getField(17)}get attack(){return this.getField(18)}get release(){return this.getField(19)}get makeup(){return this.getField(20)}get mix(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:$.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),11:$.create({parent:this,fieldKey:11,fieldName:"automakeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!0),12:$.create({parent:this,fieldKey:12,fieldName:"autoattack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),13:$.create({parent:this,fieldKey:13,fieldName:"autorelease",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),14:b.create({parent:this,fieldKey:14,fieldName:"inputgain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-30,max:30,scaling:"linear"},"dB",0),15:b.create({parent:this,fieldKey:15,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-60,max:0,scaling:"linear"},"dB",-10),16:b.create({parent:this,fieldKey:16,fieldName:"ratio",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:24,scaling:"exponential"},"",2),17:b.create({parent:this,fieldKey:17,fieldName:"knee",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:24,scaling:"linear"},"dB",0),18:b.create({parent:this,fieldKey:18,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:100,scaling:"linear"},"ms",0),19:b.create({parent:this,fieldKey:19,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:5,max:1500,scaling:"linear"},"ms",5),20:b.create({parent:this,fieldKey:20,fieldName:"makeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-40,max:40,scaling:"linear"},"dB",0),21:b.create({parent:this,fieldKey:21,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var $f=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DelayDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="DelayDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitDelayDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get delay(){return this.getField(10)}get feedback(){return this.getField(11)}get cross(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"delay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","",4),11:b.create({parent:this,fieldKey:11,fieldName:"feedback",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),12:b.create({parent:this,fieldKey:12,fieldName:"cross",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),13:b.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),14:b.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),15:b.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var Mf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CrusherDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="CrusherDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitCrusherDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get crush(){return this.getField(10)}get bits(){return this.getField(11)}get boost(){return this.getField(12)}get mix(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"crush",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),11:E.create({parent:this,fieldKey:11,fieldName:"bits",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:16},"bits",16),12:b.create({parent:this,fieldKey:12,fieldName:"boost",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:24,scaling:"linear"},"dB",0),13:b.create({parent:this,fieldKey:13,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var Df=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DattorroReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="DattorroReverbDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitDattorroReverbDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get preDelay(){return this.getField(10)}get bandwidth(){return this.getField(11)}get inputDiffusion1(){return this.getField(12)}get inputDiffusion2(){return this.getField(13)}get decay(){return this.getField(14)}get decayDiffusion1(){return this.getField(15)}get decayDiffusion2(){return this.getField(16)}get damping(){return this.getField(17)}get excursionRate(){return this.getField(18)}get excursionDepth(){return this.getField(19)}get wet(){return this.getField(20)}get dry(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),11:b.create({parent:this,fieldKey:11,fieldName:"bandwidth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.9999),12:b.create({parent:this,fieldKey:12,fieldName:"inputDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.75),13:b.create({parent:this,fieldKey:13,fieldName:"inputDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.625),14:b.create({parent:this,fieldKey:14,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),15:b.create({parent:this,fieldKey:15,fieldName:"decayDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.7),16:b.create({parent:this,fieldKey:16,fieldName:"decayDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),17:b.create({parent:this,fieldKey:17,fieldName:"damping",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.005),18:b.create({parent:this,fieldKey:18,fieldName:"excursionRate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),19:b.create({parent:this,fieldKey:19,fieldName:"excursionDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.7),20:b.create({parent:this,fieldKey:20,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),21:b.create({parent:this,fieldKey:21,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var If=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"VelocityDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="VelocityDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitVelocityDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get magnetPosition(){return this.getField(10)}get magnetStrength(){return this.getField(11)}get randomSeed(){return this.getField(12)}get randomAmount(){return this.getField(13)}get offset(){return this.getField(14)}get mix(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"magnetPosition",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),11:b.create({parent:this,fieldKey:11,fieldName:"magnetStrength",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),12:E.create({parent:this,fieldKey:12,fieldName:"randomSeed",deprecated:!1,pointerRules:h},"any","",2048),13:b.create({parent:this,fieldKey:13,fieldName:"randomAmount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),14:b.create({parent:this,fieldKey:14,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),15:b.create({parent:this,fieldKey:15,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var Cf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"FoldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="FoldDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitFoldDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get drive(){return this.getField(10)}get overSampling(){return this.getField(11)}get volume(){return this.getField(12)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"drive",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:30,scaling:"linear"},"dB",0),11:E.create({parent:this,fieldKey:11,fieldName:"overSampling",deprecated:!1,pointerRules:h},{length:3},"",0),12:b.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-18,max:0,scaling:"linear"},"dB",0)}}};var Tf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TidalDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="TidalDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitTidalDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get slope(){return this.getField(10)}get symmetry(){return this.getField(11)}get rate(){return this.getField(20)}get depth(){return this.getField(21)}get offset(){return this.getField(22)}get channelOffset(){return this.getField(23)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"slope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",-.25),11:b.create({parent:this,fieldKey:11,fieldName:"symmetry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),20:b.create({parent:this,fieldKey:20,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",3),21:b.create({parent:this,fieldKey:21,fieldName:"depth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","",1),22:b.create({parent:this,fieldKey:22,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0),23:b.create({parent:this,fieldKey:23,fieldName:"channelOffset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0)}}};var Yu=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get order(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:E.create({parent:this,fieldKey:11,fieldName:"order",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:4},""),12:b.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var Xu=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:b.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-24,max:24,scaling:"linear"},"dB")}}};var $l=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:b.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-24,max:24,scaling:"linear"},"dB"),12:b.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var Rf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RevampDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="RevampDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitRevampDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get highPass(){return this.getField(10)}get lowShelf(){return this.getField(11)}get lowBell(){return this.getField(12)}get midBell(){return this.getField(13)}get highBell(){return this.getField(14)}get highShelf(){return this.getField(15)}get lowPass(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:Yu.create({parent:this,fieldKey:10,fieldName:"highPass",deprecated:!1,pointerRules:h}),11:Xu.create({parent:this,fieldKey:11,fieldName:"lowShelf",deprecated:!1,pointerRules:h}),12:$l.create({parent:this,fieldKey:12,fieldName:"lowBell",deprecated:!1,pointerRules:h}),13:$l.create({parent:this,fieldKey:13,fieldName:"midBell",deprecated:!1,pointerRules:h}),14:$l.create({parent:this,fieldKey:14,fieldName:"highBell",deprecated:!1,pointerRules:h}),15:Xu.create({parent:this,fieldKey:15,fieldName:"highShelf",deprecated:!1,pointerRules:h}),16:Yu.create({parent:this,fieldKey:16,fieldName:"lowPass",deprecated:!1,pointerRules:h}),17:b.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-18,max:18,scaling:"linear"},"db")}}};var Of=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ReverbDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitReverbDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get decay(){return this.getField(10)}get preDelay(){return this.getField(11)}get damp(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),11:b.create({parent:this,fieldKey:11,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:.5,scaling:"exponential"},"s",0),12:b.create({parent:this,fieldKey:12,fieldName:"damp",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),13:b.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),14:b.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-3),15:b.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var em=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get waveform(){return this.getField(1)}get volume(){return this.getField(2)}get octave(){return this.getField(3)}get tune(){return this.getField(4)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"waveform",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1,2,3]},""),2:b.create({parent:this,fieldKey:2,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","db",-1/0),3:E.create({parent:this,fieldKey:3,fieldName:"octave",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-3,max:3},"oct",0),4:b.create({parent:this,fieldKey:4,fieldName:"tune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-1200,max:1200,scaling:"linear"},"ct")}}};var tm=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get waveform(){return this.getField(1)}get rate(){return this.getField(2)}get sync(){return this.getField(3)}get targetTune(){return this.getField(10)}get targetCutoff(){return this.getField(11)}get targetVolume(){return this.getField(12)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"waveform",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1,2,3]},""),2:b.create({parent:this,fieldKey:2,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1e-4,max:30,scaling:"exponential"},"Hz",1e-4),3:$.create({parent:this,fieldKey:3,fieldName:"sync",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),10:b.create({parent:this,fieldKey:10,fieldName:"targetTune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),11:b.create({parent:this,fieldKey:11,fieldName:"targetCutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),12:b.create({parent:this,fieldKey:12,fieldName:"targetVolume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%")}}};var rm=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get attack(){return this.getField(1)}get hold(){return this.getField(2)}get release(){return this.getField(3)}get volume(){return this.getField(4)}initializeFields(){return{1:b.create({parent:this,fieldKey:1,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),2:b.create({parent:this,fieldKey:2,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),3:b.create({parent:this,fieldKey:3,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),4:b.create({parent:this,fieldKey:4,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","db",.001)}}};var Sl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"VaporisateurDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="VaporisateurDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitVaporisateurDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get octave(){return this.getField(11)}get tune(){return this.getField(12)}get waveform(){return this.getField(13)}get cutoff(){return this.getField(14)}get resonance(){return this.getField(15)}get attack(){return this.getField(16)}get release(){return this.getField(17)}get filterEnvelope(){return this.getField(18)}get decay(){return this.getField(19)}get sustain(){return this.getField(20)}get glideTime(){return this.getField(21)}get voicingMode(){return this.getField(22)}get unisonCount(){return this.getField(23)}get unisonDetune(){return this.getField(24)}get unisonStereo(){return this.getField(25)}get filterOrder(){return this.getField(26)}get filterKeyboard(){return this.getField(27)}get lfo(){return this.getField(30)}get oscillators(){return this.getField(40)}get noise(){return this.getField(50)}get version(){return this.getField(99)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),11:E.create({parent:this,fieldKey:11,fieldName:"octave",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","oct"),12:b.create({parent:this,fieldKey:12,fieldName:"tune",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","ct"),13:E.create({parent:this,fieldKey:13,fieldName:"waveform",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any",""),14:b.create({parent:this,fieldKey:14,fieldName:"cutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),15:b.create({parent:this,fieldKey:15,fieldName:"resonance",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"q"),16:b.create({parent:this,fieldKey:16,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s"),17:b.create({parent:this,fieldKey:17,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s"),18:b.create({parent:this,fieldKey:18,fieldName:"filterEnvelope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),19:b.create({parent:this,fieldKey:19,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),20:b.create({parent:this,fieldKey:20,fieldName:"sustain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),21:b.create({parent:this,fieldKey:21,fieldName:"glideTime",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),22:E.create({parent:this,fieldKey:22,fieldName:"voicingMode",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1]},"",1),23:E.create({parent:this,fieldKey:23,fieldName:"unisonCount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[1,3,5]},"",1),24:b.create({parent:this,fieldKey:24,fieldName:"unisonDetune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:1200,scaling:"exponential"},"ct",30),25:b.create({parent:this,fieldKey:25,fieldName:"unisonStereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),26:E.create({parent:this,fieldKey:26,fieldName:"filterOrder",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[1,2,3,4]},"",1),27:b.create({parent:this,fieldKey:27,fieldName:"filterKeyboard",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),30:tm.create({parent:this,fieldKey:30,fieldName:"lfo",deprecated:!1,pointerRules:h}),40:ff.create({parent:this,fieldKey:40,fieldName:"oscillators",deprecated:!1,pointerRules:h},e=>em.create(e),2),50:rm.create({parent:this,fieldKey:50,fieldName:"noise",deprecated:!1,pointerRules:h}),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:h},"any","")}}};var im=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get id(){return this.getField(1)}get label(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"id",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h})}}};var El=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="MIDIOutputDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get deprecatedDevice(){return this.getField(10)}get channel(){return this.getField(11)}get deprecatedDelay(){return this.getField(12)}get parameters(){return this.getField(13)}get device(){return this.getField(14)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:im.create({parent:this,fieldKey:10,fieldName:"deprecatedDevice",deprecated:!0,pointerRules:h}),11:E.create({parent:this,fieldKey:11,fieldName:"channel",deprecated:!1,pointerRules:h},{min:0,max:15},"ch"),12:E.create({parent:this,fieldKey:12,fieldName:"deprecatedDelay",deprecated:!0,pointerRules:h},"any","ms",10),13:W.hook({parent:this,fieldKey:13,fieldName:"parameters",deprecated:!1,pointerRules:{accepts:[c.Parameter],mandatory:!1}}),14:B.create({parent:this,fieldKey:14,fieldName:"device",deprecated:!1,pointerRules:h},c.MIDIDevice,!1)}}};var Ri=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputBox",pointerRules:h}),i)}static ClassName="MIDIOutputBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputBox,this)}get root(){return this.getField(1)}get device(){return this.getField(2)}get id(){return this.getField(3)}get label(){return this.getField(4)}get delayInMs(){return this.getField(5)}get sendTransportMessages(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:h},c.MIDIDevice,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!0}}),3:C.create({parent:this,fieldKey:3,fieldName:"id",deprecated:!1,pointerRules:h}),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:h}),5:E.create({parent:this,fieldKey:5,fieldName:"delayInMs",deprecated:!1,pointerRules:h},{min:0,max:500},"ms",10),6:$.create({parent:this,fieldKey:6,fieldName:"sendTransportMessages",deprecated:!1,pointerRules:h},!0)}}};var Oi=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputParameterBox",pointerRules:h}),i)}static ClassName="MIDIOutputParameterBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputParameterBox,this)}get owner(){return this.getField(1)}get label(){return this.getField(2)}get controller(){return this.getField(3)}get value(){return this.getField(4)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.Parameter,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h},""),3:E.create({parent:this,fieldKey:3,fieldName:"controller",deprecated:!1,pointerRules:h},{min:0,max:127},"#",64),4:b.create({parent:this,fieldKey:4,fieldName:"value",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!0}},"unipolar","%")}}};var Bl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="SoundfontDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitSoundfontDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get file(){return this.getField(10)}get presetIndex(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"file",deprecated:!1,pointerRules:h},c.SoundfontFile,!1),11:E.create({parent:this,fieldKey:11,fieldName:"presetIndex",deprecated:!1,pointerRules:h},{min:0,max:65535},"")}}};var Fl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NanoDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="NanoDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitNanoDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get file(){return this.getField(15)}get release(){return this.getField(20)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-3),15:B.create({parent:this,fieldKey:15,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!1),20:b.create({parent:this,fieldKey:20,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:8,scaling:"exponential"},"s",.1)}}};var Nl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="PlayfieldDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitPlayfieldDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get samples(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:W.hook({parent:this,fieldKey:10,fieldName:"samples",deprecated:!1,pointerRules:{accepts:[c.Sample],mandatory:!1}})}}};var Vo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldSampleBox",pointerRules:{accepts:[c.Editing],mandatory:!1}}),i)}static ClassName="PlayfieldSampleBox";constructor(e){super(e)}accept(e){return _(e.visitPlayfieldSampleBox,this)}get device(){return this.getField(10)}get file(){return this.getField(11)}get midiEffects(){return this.getField(12)}get audioEffects(){return this.getField(13)}get index(){return this.getField(15)}get label(){return this.getField(20)}get icon(){return this.getField(21)}get enabled(){return this.getField(22)}get minimized(){return this.getField(23)}get mute(){return this.getField(40)}get solo(){return this.getField(41)}get exclude(){return this.getField(42)}get polyphone(){return this.getField(43)}get gate(){return this.getField(44)}get pitch(){return this.getField(45)}get sampleStart(){return this.getField(46)}get sampleEnd(){return this.getField(47)}get attack(){return this.getField(48)}get release(){return this.getField(49)}initializeFields(){return{10:B.create({parent:this,fieldKey:10,fieldName:"device",deprecated:!1,pointerRules:h},c.Sample,!0),11:B.create({parent:this,fieldKey:11,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),12:W.hook({parent:this,fieldKey:12,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MidiEffectHost],mandatory:!1}}),13:W.hook({parent:this,fieldKey:13,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1}}),15:E.create({parent:this,fieldKey:15,fieldName:"index",deprecated:!1,pointerRules:h},{min:0,max:127},"",60),20:C.create({parent:this,fieldKey:20,fieldName:"label",deprecated:!1,pointerRules:h}),21:C.create({parent:this,fieldKey:21,fieldName:"icon",deprecated:!1,pointerRules:h}),22:$.create({parent:this,fieldKey:22,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),23:$.create({parent:this,fieldKey:23,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),40:$.create({parent:this,fieldKey:40,fieldName:"mute",deprecated:!1,pointerRules:h}),41:$.create({parent:this,fieldKey:41,fieldName:"solo",deprecated:!1,pointerRules:h}),42:$.create({parent:this,fieldKey:42,fieldName:"exclude",deprecated:!1,pointerRules:h}),43:$.create({parent:this,fieldKey:43,fieldName:"polyphone",deprecated:!1,pointerRules:h}),44:E.create({parent:this,fieldKey:44,fieldName:"gate",deprecated:!1,pointerRules:h},{length:3},"",0),45:b.create({parent:this,fieldKey:45,fieldName:"pitch",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-1200,max:1200,scaling:"linear"},"ct"),46:b.create({parent:this,fieldKey:46,fieldName:"sampleStart",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),47:b.create({parent:this,fieldKey:47,fieldName:"sampleEnd",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),48:b.create({parent:this,fieldKey:48,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),49:b.create({parent:this,fieldKey:49,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.02)}}};var kl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TapeDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.Automation],mandatory:!1}}),i)}static ClassName="TapeDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitTapeDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get flutter(){return this.getField(10)}get wow(){return this.getField(11)}get noise(){return this.getField(12)}get saturation(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"flutter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),11:b.create({parent:this,fieldKey:11,fieldName:"wow",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),12:b.create({parent:this,fieldKey:12,fieldName:"noise",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),13:b.create({parent:this,fieldKey:13,fieldName:"saturation",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%")}}};var Vf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ArpeggioDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ArpeggioDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitArpeggioDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modeIndex(){return this.getField(10)}get numOctaves(){return this.getField(11)}get rateIndex(){return this.getField(12)}get gate(){return this.getField(13)}get repeat(){return this.getField(14)}get velocity(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:E.create({parent:this,fieldKey:10,fieldName:"modeIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:3},"",0),11:E.create({parent:this,fieldKey:11,fieldName:"numOctaves",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:5},"oct",1),12:E.create({parent:this,fieldKey:12,fieldName:"rateIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:17},"",9),13:b.create({parent:this,fieldKey:13,fieldName:"gate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:2,scaling:"linear"},"",1),14:E.create({parent:this,fieldKey:14,fieldName:"repeat",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:16},"",1),15:b.create({parent:this,fieldKey:15,fieldName:"velocity",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","",0)}}};var zf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PitchDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="PitchDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitPitchDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get semiTones(){return this.getField(10)}get cents(){return this.getField(11)}get octaves(){return this.getField(12)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:E.create({parent:this,fieldKey:10,fieldName:"semiTones",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-36,max:36},"st",0),11:b.create({parent:this,fieldKey:11,fieldName:"cents",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-50,max:50,scaling:"linear"},"ct",0),12:E.create({parent:this,fieldKey:12,fieldName:"octaves",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-7,max:7},"oct",0)}}};var Uf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ZeitgeistDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ZeitgeistDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitZeitgeistDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get groove(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"groove",deprecated:!1,pointerRules:h},c.Groove,!0)}}};var jf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularBox",pointerRules:h}),i)}static ClassName="ModularBox";constructor(e){super(e)}accept(e){return _(e.visitModularBox,this)}get collection(){return this.getField(1)}get device(){return this.getField(2)}get editing(){return this.getField(3)}get modules(){return this.getField(11)}get connections(){return this.getField(12)}get label(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ModularSetup,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!0}}),3:W.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"modules",deprecated:!1,pointerRules:{accepts:[c.ModuleCollection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"connections",deprecated:!1,pointerRules:{accepts:[c.ConnectionCollection],mandatory:!1}}),13:C.create({parent:this,fieldKey:13,fieldName:"label",deprecated:!1,pointerRules:h})}}};var Lf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleConnectionBox",pointerRules:h}),i)}static ClassName="ModuleConnectionBox";constructor(e){super(e)}accept(e){return _(e.visitModuleConnectionBox,this)}get collection(){return this.getField(1)}get source(){return this.getField(2)}get target(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ConnectionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"source",deprecated:!1,pointerRules:h},c.VoltageConnection,!0),3:B.create({parent:this,fieldKey:3,fieldName:"target",deprecated:!1,pointerRules:h},c.VoltageConnection,!0)}}};var ti=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get collection(){return this.getField(1)}get label(){return this.getField(2)}get x(){return this.getField(3)}get y(){return this.getField(4)}get collapsed(){return this.getField(5)}get removable(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ModuleCollection,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:E.create({parent:this,fieldKey:3,fieldName:"x",deprecated:!1,pointerRules:h},"any","x"),4:E.create({parent:this,fieldKey:4,fieldName:"y",deprecated:!1,pointerRules:h},"any","y"),5:$.create({parent:this,fieldKey:5,fieldName:"collapsed",deprecated:!1,pointerRules:h},!1),6:$.create({parent:this,fieldKey:6,fieldName:"removable",deprecated:!1,pointerRules:h},!0)}}};var Kf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioInputBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModularAudioInputBox";constructor(e){super(e)}accept(e){return _(e.visitModularAudioInputBox,this)}get attributes(){return this.getField(1)}get output(){return this.getField(10)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"output",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}})}}};var Wf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioOutputBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModularAudioOutputBox";constructor(e){super(e)}accept(e){return _(e.visitModularAudioOutputBox,this)}get attributes(){return this.getField(1)}get input(){return this.getField(10)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}})}}};var Zf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleDelayBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleDelayBox";constructor(e){super(e)}accept(e){return _(e.visitModuleDelayBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(11)}get time(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"time",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1}},{min:1,max:1e3,scaling:"exponential"},"ms",500)}}};var Gf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleMultiplierBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleMultiplierBox";constructor(e){super(e)}accept(e){return _(e.visitModuleMultiplierBox,this)}get attributes(){return this.getField(1)}get voltageInputX(){return this.getField(10)}get voltageInputY(){return this.getField(11)}get voltageOutput(){return this.getField(12)}get multiplier(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInputX",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"voltageInputY",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"multiplier",deprecated:!1,pointerRules:h},"unipolar","%")}}};var qf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleGainBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleGainBox";constructor(e){super(e)}accept(e){return _(e.visitModuleGainBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(12)}get gain(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1}},"decibel","dB")}}};var fn;(function(r){r.write=(e,t)=>{if(t.type==="none")e.disconnect(),e.setValue(0);else if(t.type==="linear")e.disconnect(),e.setValue(1);else if(t.type==="curve"){e.setValue(0);let i=e.pointerHub.filter(c.ValueInterpolation).at(0)?.box;Z(i)?(Ax(i,Io),i.slope.setValue(t.slope)):Io.create(e.box.graph,w.generate(),n=>{n.slope.setValue(t.slope),n.event.refer(e)})}},r.read=e=>{let t=e.pointerHub.incoming().at(0)?.box;return Z(t)?(Ax(t,Io),{type:"curve",slope:t.slope.getValue()}):e.getValue()===0?Fo.None:e.getValue()===1?Fo.Linear:F("Unknown Interpolation value")}})(fn||(fn={}));var Uo=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ce=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ed,Ml,ut,td,jo,rd,eo=class r{constructor(e,t){this.type="value-event",ed.set(this,new U),Ml.set(this,void 0),ut.set(this,void 0),td.set(this,void 0),jo.set(this,void 0),rd.set(this,!1),Uo(this,Ml,e,"f"),Uo(this,ut,t,"f"),Uo(this,td,Ce(this,ed,"f").own(new Zh(()=>fn.read(Ce(this,ut,"f").interpolation))),"f");let i=()=>{Ce(this,td,"f").invalidate(),this.collection.ifSome(n=>n.onEventPropertyChanged())};Ce(this,ed,"f").ownAll(Ce(this,ut,"f").subscribe(ke.Children,n=>{if(!this.collection.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let o=this.collection.unwrap(),a=n.address.fieldKeys,s=R.equals(Ce(this,ut,"f").index.address.fieldKeys,a),l=R.equals(Ce(this,ut,"f").position.address.fieldKeys,a);s||l?o.requestSorting():o.onEventPropertyChanged()}}),Ce(this,ut,"f").interpolation.subscribe(i),Ce(this,ut,"f").interpolation.pointerHub.subscribe({onAdded:({box:n})=>{Ce(this,jo,"f").terminate(),Uo(this,jo,n.subscribe(ke.Children,i),"f"),i()},onRemoved:()=>{Ce(this,jo,"f").terminate(),Uo(this,jo,K.Empty,"f"),i()}})),Uo(this,jo,Ce(this,ut,"f").interpolation.pointerHub.filter(c.ValueInterpolation).at(0)?.box.subscribe(ke.Children,i)??K.Empty,"f")}onSelected(){Uo(this,rd,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Uo(this,rd,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Ce(this,jo,"f").terminate(),Ce(this,ed,"f").terminate()}get box(){return Ce(this,ut,"f")}get uuid(){return Ce(this,ut,"f").address.uuid}get address(){return Ce(this,ut,"f").address}get position(){return Ce(this,ut,"f").position.getValue()}get index(){return Ce(this,ut,"f").index.getValue()}set interpolation(e){fn.write(Ce(this,ut,"f").interpolation,e)}get interpolation(){return Ce(this,td,"f").get()}get value(){return Ce(this,ut,"f").value.getValue()}get isSelected(){return Ce(this,rd,"f")}get collection(){return Ce(this,ut,"f").events.targetVertex.map(e=>Ce(this,Ml,"f").boxAdapters.adapterFor(e.box,cr))}copyTo(e){let t=Do.create(Ce(this,Ml,"f").boxGraph,w.generate(),i=>{i.position.setValue(e?.position??this.position),i.index.setValue(e?.index??this.index),i.events.refer(e?.events??this.collection.unwrap().box.events),i.value.setValue(e?.value??this.value)});return fn.write(t.interpolation,e?.interpolation??this.interpolation),Ce(this,Ml,"f").boxAdapters.adapterFor(t,r)}copyFrom(e){return Ce(this,ut,"f").position.setValue(e?.position??this.position),Ce(this,ut,"f").index.setValue(e?.index??this.index),Ce(this,ut,"f").events.refer(e?.events??this.collection.unwrap().box.events),Ce(this,ut,"f").value.setValue(e?.value??this.value),fn.write(Ce(this,ut,"f").interpolation,e?.interpolation??this.interpolation),this}toString(){return`{ValueEventBoxAdapter position: ${this.position} index: ${this.index}}`}};ed=new WeakMap,Ml=new WeakMap,ut=new WeakMap,td=new WeakMap,jo=new WeakMap,rd=new WeakMap;eo.Comparator=(r,e)=>{let t=r.position-e.position;if(t!==0)return t;let i=r.index-e.index;if(i!==0)return i;throw new Error(`${r} and ${e} are identical in terms of comparison`)};var id=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Te=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},nd,od,Lo,ri,Ha,ad,to,nm,cr=class r{constructor(e,t){nd.add(this),od.set(this,new U),Lo.set(this,void 0),ri.set(this,void 0),Ha.set(this,void 0),ad.set(this,void 0),to.set(this,void 0),id(this,Lo,e,"f"),id(this,ri,t,"f"),id(this,Ha,new re,"f"),id(this,ad,w.newSet(n=>n.uuid),"f"),id(this,to,xr.create(eo.Comparator),"f");let i=n=>{let o=ee(n.accept({visitValueEventBox:a=>Te(this,Lo,"f").boxAdapters.adapterFor(a,eo)}),`Could not find adapter for ${n}`);Te(this,ad,"f").add(o)&&(Te(this,to,"f").add(o),Te(this,nd,"m",nm).call(this))};Te(this,ri,"f").events.pointerHub.incoming().forEach(({box:n})=>i(n)),Te(this,od,"f").own(Te(this,ri,"f").events.pointerHub.subscribe({onAdded:({box:n})=>i(n),onRemoved:({box:{address:{uuid:n}}})=>{Te(this,to,"f").remove(Te(this,ad,"f").removeByKey(n)),Te(this,nd,"m",nm).call(this)}})),Te(this,od,"f").own(Te(this,ri,"f").owners.pointerHub.subscribe({onAdded:()=>Te(this,Ha,"f").notify(this),onRemoved:()=>Te(this,Ha,"f").notify(this)}))}valueAt(e,t){return pf.valueAt(Te(this,to,"f"),e,t)}copy(){let e=Te(this,Lo,"f").boxGraph,t=Xn.create(e,w.generate());return Te(this,to,"f").asArray().forEach(i=>i.copyTo({events:t.events})),Te(this,Lo,"f").boxAdapters.adapterFor(t,r)}cut(e){let t=this.events.lowerEqual(e),i=this.events.greaterEqual(e);if(i===null)return t===null?g.None:g.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t===null)return g.wrap(this.createEvent({position:e,value:i.value,index:i.index,interpolation:i.interpolation}));if(t.position===e)return g.wrap(t);if(t.interpolation.type==="none")return g.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t.interpolation.type==="linear"){let{position:n,value:o}=t,{position:a,value:s}=i;return g.wrap(this.createEvent({position:e,value:Gh(o,s,(e-n)/(a-n)),index:0,interpolation:t.interpolation}))}if(t.interpolation.type==="curve"){let{position:n,value:o}=t,{position:a,value:s}=i,l=a-n,u=e-n,p=Yr.byHalf(l,o,Yr.valueAt({slope:t.interpolation.slope,steps:l,y0:o,y1:s},l*.5),s),d=Yr.valueAt(p,u),f=Yr.slopeByHalf(o,Yr.valueAt(p,u*.5),d);return fn.write(t.box.interpolation,Fo.Curve(f)),g.wrap(this.createEvent({position:e,value:d,index:0,interpolation:Fo.Curve(Yr.slopeByHalf(d,Yr.valueAt(p,(u+l)*.5),s))}))}return F("Unknown interpolation type")}subscribeChange(e){return Te(this,Ha,"f").subscribe(e)}createEvent({position:e,index:t,value:i,interpolation:n}){let o=Do.create(Te(this,Lo,"f").boxGraph,w.generate(),a=>{a.position.setValue(e),a.index.setValue(t),a.value.setValue(i),a.events.refer(Te(this,ri,"f").events)});return fn.write(o.interpolation,n),Te(this,Lo,"f").boxAdapters.adapterFor(o,eo)}requestSorting(){Te(this,to,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Te(this,nd,"m",nm).call(this)}terminate(){Te(this,od,"f").terminate()}get box(){return Te(this,ri,"f")}get uuid(){return Te(this,ri,"f").address.uuid}get address(){return Te(this,ri,"f").address}get numOwners(){return Te(this,ri,"f").owners.pointerHub.filter(c.ValueEventCollection).length}get events(){return Te(this,to,"f")}toString(){return`{ValueEventCollectionBox ${w.toString(Te(this,ri,"f").address.uuid)}}`}};od=new WeakMap,Lo=new WeakMap,ri=new WeakMap,Ha=new WeakMap,ad=new WeakMap,to=new WeakMap,nd=new WeakSet,nm=function(){Te(this,Ha,"f").notify(this)};var Ja=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},_e=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Qa,Ko,Ya,Et,Xa,cd,sd,ld,Dl,Wo=class{constructor(e,t){Qa.add(this),this.type="value-clip",Ko.set(this,new U),Ya.set(this,void 0),Et.set(this,void 0),Xa.set(this,void 0),cd.set(this,void 0),sd.set(this,void 0),ld.set(this,K.Empty),Ja(this,Ya,e,"f"),Ja(this,Et,t,"f"),Ja(this,sd,!0,"f"),Ja(this,Xa,_e(this,Ko,"f").own(new Cr(!1)),"f"),Ja(this,cd,_e(this,Ko,"f").own(new re),"f"),_e(this,Ko,"f").own(_e(this,Et,"f").pointerHub.subscribe({onAdded:()=>_e(this,Qa,"m",Dl).call(this),onRemoved:()=>_e(this,Qa,"m",Dl).call(this)})),_e(this,Ko,"f").own(_e(this,Et,"f").subscribe(ke.Children,i=>_e(this,Qa,"m",Dl).call(this))),_e(this,Ko,"f").own(_e(this,Et,"f").events.catchupAndSubscribe(({targetVertex:i})=>{_e(this,ld,"f").terminate(),Ja(this,ld,i.match({none:()=>K.Empty,some:({box:n})=>_e(this,Ya,"f").boxAdapters.adapterFor(n,cr).subscribeChange(()=>_e(this,Qa,"m",Dl).call(this))}),"f"),_e(this,Qa,"m",Dl).call(this)})),Ja(this,sd,!1,"f")}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(e%this.duration,t)}catchupAndSubscribeSelected(e){return _e(this,Xa,"f").catchupAndSubscribe(e)}subscribeChange(e){return _e(this,cd,"f").subscribe(e)}accept(e){return _(e.visitValueClipBoxAdapter,this)}consolidate(){this.isMirrowed&&_e(this,Et,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:_e(this,Et,"f").events.targetVertex.unwrap();yl.create(_e(this,Ya,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(_e(this,Et,"f").clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){_e(this,Xa,"f").setValue(!0)}onDeselected(){_e(this,Xa,"f").setValue(!1)}get isSelected(){return _e(this,Xa,"f").getValue()}terminate(){_e(this,ld,"f").terminate(),_e(this,Ko,"f").terminate()}get box(){return _e(this,Et,"f")}get uuid(){return _e(this,Et,"f").address.uuid}get address(){return _e(this,Et,"f").address}get indexField(){return _e(this,Et,"f").index}get duration(){return _e(this,Et,"f").duration.getValue()}get mute(){return _e(this,Et,"f").mute.getValue()}get hue(){return _e(this,Et,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return _e(this,Et,"f").events.targetVertex.map(e=>_e(this,Ya,"f").boxAdapters.adapterFor(e.box,cr))}get label(){return _e(this,Et,"f").label.getValue()}get trackBoxAdapter(){return _e(this,sd,"f")?g.None:_e(this,Et,"f").clips.targetVertex.map(e=>_e(this,Ya,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{ValueClipBoxAdapter ${w.toString(_e(this,Et,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Ko=new WeakMap,Ya=new WeakMap,Et=new WeakMap,Xa=new WeakMap,cd=new WeakMap,sd=new WeakMap,ld=new WeakMap,Qa=new WeakSet,Dl=function(){_e(this,cd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var OP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Il=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Zx,es,om,Cl=class{constructor(e){this.type="transient-marker",Zx.set(this,new U),es.set(this,void 0),om.set(this,void 0),OP(this,es,e,"f"),OP(this,om,new re,"f")}get box(){return Il(this,es,"f")}get uuid(){return Il(this,es,"f").address.uuid}get address(){return Il(this,es,"f").address}get position(){return Il(this,es,"f").position.getValue()}subscribe(e){return Il(this,om,"f").subscribe(e)}terminate(){Il(this,Zx,"f").terminate()}};Zx=new WeakMap,es=new WeakMap,om=new WeakMap;var ud=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Kt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},am,dd,mn,pd,Tl,sm,Vi=class r{constructor(e,t){am.set(this,new U),dd.set(this,void 0),mn.set(this,void 0),pd.set(this,void 0),Tl.set(this,void 0),sm.set(this,void 0),ud(this,dd,e,"f"),ud(this,mn,t,"f"),ud(this,pd,w.newSet(({uuid:i})=>i),"f"),ud(this,Tl,xr.create(r.Comparator),"f"),ud(this,sm,yf.memoizeAsync(async()=>{if(this.data.nonEmpty())return this.data.unwrap();let{promise:i,resolve:n,reject:o}=Promise.withResolvers(),a=this.getOrCreateLoader(),s=a.subscribe(l=>{l.type==="loaded"?(s.terminate(),n(a.data.unwrap("State mismatch"))):l.type==="error"&&(s.terminate(),o(l.reason))});return i}),"f"),Kt(this,am,"f").own(t.transientMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Kt(this,dd,"f").boxAdapters.adapterFor(i.box,Cl);Kt(this,pd,"f").add(n)&&Kt(this,Tl,"f").add(n)},onRemoved:({box:{address:{uuid:i}}})=>{Kt(this,Tl,"f").remove(Kt(this,pd,"f").removeByKey(i))}}))}get box(){return Kt(this,mn,"f")}get uuid(){return Kt(this,mn,"f").address.uuid}get address(){return Kt(this,mn,"f").address}get startInSeconds(){return Kt(this,mn,"f").startInSeconds.getValue()}get endInSeconds(){return Kt(this,mn,"f").endInSeconds.getValue()}get transients(){return Kt(this,Tl,"f")}get fileName(){return Kt(this,mn,"f").fileName.getValue()}get data(){return this.getOrCreateLoader().data}get peaks(){return this.getOrCreateLoader().peaks}get audioData(){return Kt(this,sm,"f").call(this)}getOrCreateLoader(){return Kt(this,dd,"f").sampleManager.getOrCreate(Kt(this,mn,"f").address.uuid)}terminate(){Kt(this,am,"f").terminate()}};am=new WeakMap,dd=new WeakMap,mn=new WeakMap,pd=new WeakMap,Tl=new WeakMap,sm=new WeakMap;Vi.Comparator=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),F("Events at the same position: "+r.position+", "+e.position)):t};var hd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ur=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fd,lm,cm,ro,gd,md,um,Zo=class{constructor(e,t){fd.add(this),this.type="warp-marker",lm.set(this,new U),cm.set(this,void 0),ro.set(this,void 0),gd.set(this,void 0),md.set(this,!1),hd(this,cm,e,"f"),hd(this,ro,t,"f"),hd(this,gd,new re,"f"),ur(this,lm,"f").own(t.subscribe(ke.Children,()=>ur(this,fd,"m",um).call(this)))}onSelected(){hd(this,md,!0,"f"),this.optWarping.ifSome(e=>e.onChanged()),ur(this,fd,"m",um).call(this)}onDeselected(){hd(this,md,!1,"f"),ur(this,fd,"m",um).call(this)}get box(){return ur(this,ro,"f")}get uuid(){return ur(this,ro,"f").address.uuid}get address(){return ur(this,ro,"f").address}get position(){return ur(this,ro,"f").position.getValue()}get seconds(){return ur(this,ro,"f").seconds.getValue()}get isSelected(){return ur(this,md,"f")}get optWarping(){return ur(this,ro,"f").owner.targetVertex.map(e=>ur(this,cm,"f").boxAdapters.adapterFor(e.box,gn.isAudioPlayMode))}get isAnchor(){return this.optWarping.mapOr(({warpMarkers:e})=>this===e.optAt(0)||this===e.optAt(e.length()-1),!1)}subscribe(e){return ur(this,gd,"f").subscribe(e)}terminate(){ur(this,lm,"f").terminate()}};lm=new WeakMap,cm=new WeakMap,ro=new WeakMap,gd=new WeakMap,md=new WeakMap,fd=new WeakSet,um=function(){ur(this,gd,"f").notify(),this.optWarping.ifSome(e=>e.onChanged())};var dm=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),F("Events at the same position: "+r.position+", "+e.position)):t};var vd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Jt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pm,hm,ts,rs,yd,Rl,vn=class{constructor(e,t){pm.set(this,new U),hm.set(this,void 0),ts.set(this,void 0),rs.set(this,void 0),yd.set(this,void 0),Rl.set(this,void 0),vd(this,hm,e,"f"),vd(this,ts,t,"f"),vd(this,rs,new re,"f"),vd(this,yd,w.newSet(({uuid:i})=>i),"f"),vd(this,Rl,xr.create(dm),"f"),Jt(this,pm,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Jt(this,hm,"f").boxAdapters.adapterFor(i.box,Zo);Jt(this,yd,"f").add(n)&&(Jt(this,Rl,"f").add(n),Jt(this,rs,"f").notify())},onRemoved:({box:{address:{uuid:i}}})=>{Jt(this,Rl,"f").remove(Jt(this,yd,"f").removeByKey(i)),Jt(this,rs,"f").notify()}}))}get box(){return Jt(this,ts,"f")}get uuid(){return Jt(this,ts,"f").address.uuid}get address(){return Jt(this,ts,"f").address}get warpMarkers(){return Jt(this,Rl,"f")}clone(){let e=wl.create(Jt(this,ts,"f").graph,w.generate());return this.warpMarkers.asArray().forEach(t=>To.create(e.graph,w.generate(),i=>{i.position.setValue(t.position),i.seconds.setValue(t.seconds),i.owner.refer(e.warpMarkers)})),e}subscribe(e){return Jt(this,rs,"f").subscribe(e)}onChanged(){Jt(this,rs,"f").notify()}terminate(){Jt(this,pm,"f").terminate()}};pm=new WeakMap,hm=new WeakMap,ts=new WeakMap,rs=new WeakMap,yd=new WeakMap,Rl=new WeakMap;var xd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Bt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fm,mm,zi,is,wd,Ol,yn=class{constructor(e,t){fm.set(this,new U),mm.set(this,void 0),zi.set(this,void 0),is.set(this,void 0),wd.set(this,void 0),Ol.set(this,void 0),xd(this,mm,e,"f"),xd(this,zi,t,"f"),xd(this,is,new re,"f"),xd(this,wd,w.newSet(({uuid:i})=>i),"f"),xd(this,Ol,xr.create(dm),"f"),Bt(this,fm,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Bt(this,mm,"f").boxAdapters.adapterFor(i.box,Zo);Bt(this,wd,"f").add(n)&&(Bt(this,Ol,"f").add(n),Bt(this,is,"f").notify())},onRemoved:({box:{address:{uuid:i}}})=>{Bt(this,Ol,"f").remove(Bt(this,wd,"f").removeByKey(i)),Bt(this,is,"f").notify()}}))}get box(){return Bt(this,zi,"f")}get uuid(){return Bt(this,zi,"f").address.uuid}get address(){return Bt(this,zi,"f").address}get warpMarkers(){return Bt(this,Ol,"f")}get playbackRate(){return Bt(this,zi,"f").playbackRate.getValue()}get cents(){return Math.log2(Bt(this,zi,"f").playbackRate.getValue())*1200}set cents(e){Bt(this,zi,"f").playbackRate.setValue(le(2**(e/1200),.5,2))}get transientPlayMode(){return Jr(Bt(this,zi,"f").transientPlayMode.getValue(),ko)}clone(){let e=bl.create(Bt(this,zi,"f").graph,w.generate(),t=>{t.transientPlayMode.setValue(this.transientPlayMode),t.playbackRate.setValue(this.playbackRate),t.warpMarkers});return this.warpMarkers.asArray().forEach(t=>To.create(e.graph,w.generate(),i=>{i.position.setValue(t.position),i.seconds.setValue(t.seconds),i.owner.refer(e.warpMarkers)})),e}subscribe(e){return Bt(this,is,"f").subscribe(e)}onChanged(){Bt(this,is,"f").notify()}terminate(){Bt(this,fm,"f").terminate()}};fm=new WeakMap,mm=new WeakMap,zi=new WeakMap,is=new WeakMap,wd=new WeakMap,Ol=new WeakMap;var gn;(function(r){r.isAudioPlayMode=e=>e instanceof vn||e instanceof yn})(gn||(gn={}));var Rr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},oe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ns,Vl,os,dt,as,ss,bd,_d,Ad,ls,zl,Ul,jl,io=class r{constructor(e,t){ns.add(this),this.type="audio-clip",Vl.set(this,new U),os.set(this,void 0),dt.set(this,void 0),as.set(this,void 0),ss.set(this,void 0),bd.set(this,void 0),_d.set(this,void 0),Ad.set(this,void 0),ls.set(this,g.None),zl.set(this,g.None),Ul.set(this,K.Empty),Rr(this,os,e,"f"),Rr(this,dt,t,"f"),Rr(this,Ad,!0,"f"),Rr(this,as,new Xr,"f"),Rr(this,ss,oe(this,Vl,"f").own(new Cr(!1)),"f"),Rr(this,bd,Bo.aware(e.tempoMap,t.timeBase,r.STATIC_POSITION,t.duration),"f"),Rr(this,_d,oe(this,Vl,"f").own(new re),"f"),oe(this,Vl,"f").ownAll(oe(this,dt,"f").pointerHub.subscribe({onAdded:()=>oe(this,ns,"m",jl).call(this),onRemoved:()=>oe(this,ns,"m",jl).call(this)}),oe(this,dt,"f").playMode.catchupAndSubscribe(({targetVertex:i})=>{oe(this,Ul,"f").terminate(),i.match({none:()=>oe(this,as,"f").clear(),some:({box:n})=>{let o=oe(this,os,"f").boxAdapters.adapterFor(n,gn.isAudioPlayMode);Rr(this,Ul,o.subscribe(()=>oe(this,ns,"m",jl).call(this)),"f"),oe(this,as,"f").wrap(o)}})}),oe(this,dt,"f").file.catchupAndSubscribe(i=>{Rr(this,ls,i.targetVertex.map(n=>oe(this,os,"f").boxAdapters.adapterFor(n.box,Vi)),"f"),oe(this,zl,"f").ifSome(n=>n.terminate()),Rr(this,zl,oe(this,ls,"f").map(n=>n.getOrCreateLoader().subscribe(()=>oe(this,ns,"m",jl).call(this))),"f")}),oe(this,dt,"f").subscribe(ke.Children,i=>oe(this,ns,"m",jl).call(this))),Rr(this,Ad,!1,"f")}catchupAndSubscribeSelected(e){return oe(this,ss,"f").catchupAndSubscribe(e)}subscribeChange(e){return oe(this,_d,"f").subscribe(e)}accept(e){return _(e.visitAudioClipBoxAdapter,this)}consolidate(){}clone(e){let t=this.observableOptPlayMode.map(i=>i.clone());xl.create(oe(this,os,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.gain.setValue(this.gain.getValue()),i.timeBase.setValue(this.timeBase),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(oe(this,dt,"f").clips.targetVertex.unwrap()),i.file.refer(oe(this,dt,"f").file.targetVertex.unwrap()),i.events.refer(oe(this,dt,"f").events.targetVertex.unwrap()),t.ifSome(n=>i.playMode.refer(n))})}onSelected(){oe(this,ss,"f").setValue(!0)}onDeselected(){oe(this,ss,"f").setValue(!1)}get isSelected(){return oe(this,ss,"f").getValue()}get box(){return oe(this,dt,"f")}get uuid(){return oe(this,dt,"f").address.uuid}get address(){return oe(this,dt,"f").address}get indexField(){return oe(this,dt,"f").index}get duration(){return oe(this,bd,"f").toPPQN()}set duration(e){oe(this,bd,"f").fromPPQN(e)}get mute(){return oe(this,dt,"f").mute.getValue()}get hue(){return oe(this,dt,"f").hue.getValue()}get gain(){return oe(this,dt,"f").gain}get file(){return oe(this,ls,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return oe(this,as,"f")}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return g.None}get timeBase(){return Jr(oe(this,dt,"f").timeBase.getValue(),sr)}get waveformOffset(){return oe(this,dt,"f").waveformOffset}get isPlayModeNoStretch(){return oe(this,dt,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>Ie(e,vn)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>Ie(e,yn)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>gn.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(oe(this,ls,"f").isEmpty())return"No Audio File";let e=oe(this,ls,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):oe(this,dt,"f").label.getValue()}get trackBoxAdapter(){return oe(this,Ad,"f")?g.None:oe(this,dt,"f").clips.targetVertex.map(e=>oe(this,os,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return!1}get canMirror(){return!1}get canResize(){return oe(this,as,"f").nonEmpty()}terminate(){oe(this,zl,"f").ifSome(e=>e.terminate()),Rr(this,zl,g.None,"f"),oe(this,Ul,"f").terminate(),Rr(this,Ul,K.Empty,"f"),oe(this,Vl,"f").terminate()}toString(){return`{AudioClipBoxAdapter ${w.toString(oe(this,dt,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Vl=new WeakMap,os=new WeakMap,dt=new WeakMap,as=new WeakMap,ss=new WeakMap,bd=new WeakMap,_d=new WeakMap,Ad=new WeakMap,ls=new WeakMap,zl=new WeakMap,Ul=new WeakMap,ns=new WeakSet,jl=function(){oe(this,_d,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};io.STATIC_POSITION={getValue:()=>0};var Pd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},yt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ll,Dt,gm,Sd,cs=class r{constructor(e,t){this.type="note-event",Ll.set(this,void 0),Dt.set(this,void 0),gm.set(this,void 0),Sd.set(this,!1),Pd(this,Ll,e,"f"),Pd(this,Dt,t,"f"),Pd(this,gm,yt(this,Dt,"f").subscribe(ke.Children,i=>{if(!this.collection.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.collection.unwrap(),o=i.address.fieldKeys,a=R.equals(yt(this,Dt,"f").pitch.address.fieldKeys,o),s=R.equals(yt(this,Dt,"f").position.address.fieldKeys,o);a||s?n.requestSorting():n.onEventPropertyChanged()}}),"f")}onSelected(){Pd(this,Sd,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Pd(this,Sd,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){yt(this,gm,"f").terminate()}get box(){return yt(this,Dt,"f")}get uuid(){return yt(this,Dt,"f").address.uuid}get address(){return yt(this,Dt,"f").address}get position(){return yt(this,Dt,"f").position.getValue()}get duration(){return yt(this,Dt,"f").duration.getValue()}get complete(){return this.position+this.duration}get velocity(){return yt(this,Dt,"f").velocity.getValue()}get pitch(){return yt(this,Dt,"f").pitch.getValue()}get cent(){return yt(this,Dt,"f").cent.getValue()}get chance(){return yt(this,Dt,"f").chance.getValue()}get playCount(){return yt(this,Dt,"f").playCount.getValue()}get playCurve(){return yt(this,Dt,"f").playCurve.getValue()}get isSelected(){return yt(this,Sd,"f")}get collection(){return yt(this,Dt,"f").events.targetVertex.map(e=>yt(this,Ll,"f").boxAdapters.adapterFor(e.box,ii))}normalizedPitch(){if(this.collection.isEmpty())return .5;let{minPitch:e,maxPitch:t}=this.collection.unwrap();return e===t?.5:1-(this.pitch-e)/(t-e)}copyAsNoteEvent(){return{type:"note-event",position:this.position,duration:this.duration,pitch:this.pitch,cent:this.cent,velocity:this.velocity}}copyTo(e){return yt(this,Ll,"f").boxAdapters.adapterFor(Mo.create(yt(this,Ll,"f").boxGraph,w.generate(),t=>{t.position.setValue(e?.position??this.position),t.duration.setValue(e?.duration??this.duration),t.pitch.setValue(e?.pitch??this.pitch),t.playCount.setValue(e?.playCount??this.playCount),t.events.refer(e?.events??this.collection.unwrap().box.events),t.velocity.setValue(this.velocity),t.cent.setValue(this.cent),t.chance.setValue(this.chance)}),r)}computeCurveValue(e){return ar.curveFunc(e,this.playCurve)}canConsolidate(){return this.playCount>1}consolidate(){let e=this.playCount,t=this.collection.unwrap().box.events,i=R.create(n=>{let o=Math.floor(this.computeCurveValue(n/e)*this.duration),a=Math.floor(this.computeCurveValue((n+1)/e)*this.duration);return this.copyTo({position:Math.floor(this.position+o),duration:Math.max(1,a-o),playCount:1,events:t})},e);return yt(this,Dt,"f").delete(),i}};Ll=new WeakMap,Dt=new WeakMap,gm=new WeakMap,Sd=new WeakMap;var xn=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},me=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},no,Ed,Go,Ui,us,Bd,ni,ym,xm,wm,qo,vm,Fd,ii=class r{constructor(e,t){no.add(this),Ed.set(this,new U),Go.set(this,void 0),Ui.set(this,void 0),us.set(this,void 0),Bd.set(this,void 0),ni.set(this,void 0),ym.set(this,60),xm.set(this,60),wm.set(this,0),qo.set(this,!1),xn(this,Go,e,"f"),xn(this,Ui,t,"f"),xn(this,us,new re,"f"),xn(this,Bd,w.newSet(i=>i.uuid),"f"),xn(this,ni,xr.create(ar.Comparator),"f"),me(this,Ed,"f").own(me(this,Ui,"f").events.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{let n=me(this,Go,"f").boxAdapters.adapterFor(i,cs);me(this,Bd,"f").add(n)&&(me(this,ni,"f").add(n),me(this,no,"m",vm).call(this))},onRemoved:({box:{address:{uuid:i}}})=>{me(this,ni,"f").remove(me(this,Bd,"f").removeByKey(i)),me(this,no,"m",vm).call(this)}})),me(this,Ed,"f").own(me(this,Ui,"f").owners.pointerHub.subscribe({onAdded:()=>me(this,us,"f").notify(this),onRemoved:()=>me(this,us,"f").notify(this)}))}copy(){let e=me(this,Go,"f").boxGraph,t=Yn.create(e,w.generate());return me(this,ni,"f").asArray().forEach(i=>i.copyTo({events:t.events})),me(this,Go,"f").boxAdapters.adapterFor(t,r)}createEvent({position:e,duration:t,velocity:i,pitch:n,chance:o,playCount:a,cent:s}){return me(this,Go,"f").boxAdapters.adapterFor(Mo.create(me(this,Go,"f").boxGraph,w.generate(),l=>{l.position.setValue(e),l.duration.setValue(t),l.velocity.setValue(i),l.pitch.setValue(n),l.chance.setValue(o),l.playCount.setValue(a),l.cent.setValue(s),l.events.refer(me(this,Ui,"f").events)}),cs)}subscribeChange(e){return me(this,us,"f").subscribe(e)}selectable(){return me(this,ni,"f").asArray()}selectableAt(e){for(let t of me(this,ni,"f").asArray())if(t.position<=e.u&&e.u<t.complete&&t.pitch===e.v)return Xe.one(t);return Xe.empty()}selectablesBetween(e,t){let i=[];for(let n of me(this,ni,"f").asArray())Ru.intersect1D(n.position,n.complete,e.u,t.u)&&Ru.intersect1D(n.pitch,n.pitch,e.v,t.v)&&i.push(n);return i}requestSorting(){me(this,ni,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){me(this,no,"m",vm).call(this)}terminate(){me(this,Ed,"f").terminate()}get box(){return me(this,Ui,"f")}get uuid(){return me(this,Ui,"f").address.uuid}get address(){return me(this,Ui,"f").address}get numOwners(){return me(this,Ui,"f").owners.pointerHub.filter(c.NoteEventCollection).length}get events(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,ni,"f")}get minPitch(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,ym,"f")}get maxPitch(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,xm,"f")}get maxDuration(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,wm,"f")}toString(){return`{NoteEventCollectionBox ${w.toString(me(this,Ui,"f").address.uuid)}}`}};Ed=new WeakMap,Go=new WeakMap,Ui=new WeakMap,us=new WeakMap,Bd=new WeakMap,ni=new WeakMap,ym=new WeakMap,xm=new WeakMap,wm=new WeakMap,qo=new WeakMap,no=new WeakSet,vm=function(){xn(this,qo,!1,"f"),me(this,us,"f").notify(this)},Fd=function(){let e=127,t=0,i=0;me(this,ni,"f").asArray().forEach(({pitch:n,duration:o})=>{e=Math.min(e,n),t=Math.max(t,n),i=Math.max(i,o)}),xn(this,ym,e,"f"),xn(this,xm,t,"f"),xn(this,wm,i,"f"),xn(this,qo,!0,"f")};var ds=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ee=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ps,Kl,hs,Ft,fs,$d,Nd,kd,Wl,Zl=class{constructor(e,t){ps.add(this),this.type="note-clip",Kl.set(this,new U),hs.set(this,void 0),Ft.set(this,void 0),fs.set(this,void 0),$d.set(this,void 0),Nd.set(this,void 0),kd.set(this,K.Empty),ds(this,hs,e,"f"),ds(this,Ft,t,"f"),ds(this,Nd,!0,"f"),ds(this,fs,Ee(this,Kl,"f").own(new Cr(!1)),"f"),ds(this,$d,Ee(this,Kl,"f").own(new re),"f"),Ee(this,Kl,"f").ownAll(Ee(this,Ft,"f").pointerHub.subscribe({onAdded:()=>Ee(this,ps,"m",Wl).call(this),onRemoved:()=>Ee(this,ps,"m",Wl).call(this)}),Ee(this,Ft,"f").subscribe(ke.Children,i=>Ee(this,ps,"m",Wl).call(this)),Ee(this,Ft,"f").events.catchupAndSubscribe(({targetVertex:i})=>{Ee(this,kd,"f").terminate(),ds(this,kd,i.match({none:()=>K.Empty,some:({box:n})=>Ee(this,hs,"f").boxAdapters.adapterFor(n,ii).subscribeChange(()=>Ee(this,ps,"m",Wl).call(this))}),"f"),Ee(this,ps,"m",Wl).call(this)})),ds(this,Nd,!1,"f")}catchupAndSubscribeSelected(e){return Ee(this,fs,"f").catchupAndSubscribe(e)}subscribeChange(e){return Ee(this,$d,"f").subscribe(e)}accept(e){return _(e.visitNoteClipBoxAdapter,this)}consolidate(){this.isMirrowed&&Ee(this,Ft,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:Ee(this,Ft,"f").events.targetVertex.unwrap();vl.create(Ee(this,hs,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(Ee(this,Ft,"f").clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){Ee(this,fs,"f").setValue(!0)}onDeselected(){Ee(this,fs,"f").setValue(!1)}get isSelected(){return Ee(this,fs,"f").getValue()}terminate(){Ee(this,kd,"f").terminate(),Ee(this,Kl,"f").terminate()}get box(){return Ee(this,Ft,"f")}get uuid(){return Ee(this,Ft,"f").address.uuid}get address(){return Ee(this,Ft,"f").address}get indexField(){return Ee(this,Ft,"f").index}get duration(){return Ee(this,Ft,"f").duration.getValue()}get mute(){return Ee(this,Ft,"f").mute.getValue()}get hue(){return Ee(this,Ft,"f").hue.getValue()}get events(){return this.optCollection.map(e=>e.events)}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return Ee(this,Ft,"f").events.targetVertex.map(e=>Ee(this,hs,"f").boxAdapters.adapterFor(e.box,ii))}get label(){return Ee(this,Ft,"f").label.getValue()}get trackBoxAdapter(){return Ee(this,Nd,"f")?g.None:Ee(this,Ft,"f").clips.targetVertex.map(e=>Ee(this,hs,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{NoteClipBoxAdapter ${w.toString(Ee(this,Ft,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Kl=new WeakMap,hs=new WeakMap,Ft=new WeakMap,fs=new WeakMap,$d=new WeakMap,Nd=new WeakMap,kd=new WeakMap,ps=new WeakSet,Wl=function(){Ee(this,$d,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var bm={for:(r,e)=>ee(e.accept({visitNoteClipBox:t=>r.adapterFor(t,Zl),visitValueClipBox:t=>r.adapterFor(t,Wo),visitAudioClipBox:t=>r.adapterFor(t,io)}),"")};var Am=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ho=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_m,Gl,Md,Dd,Pm=class{constructor(e,t){_m.set(this,void 0),Gl.set(this,void 0),Md.set(this,void 0),Dd.set(this,void 0),Am(this,_m,e,"f"),Am(this,Gl,new U,"f"),Am(this,Md,Ho(this,Gl,"f").own(new re),"f"),Am(this,Dd,Ho(this,Gl,"f").own(Lt.create(e.box.clips,i=>bm.for(t,i),c.ClipCollection)),"f"),Ho(this,Dd,"f").subscribe({onAdd:()=>this.dispatchChange(),onRemove:()=>this.dispatchChange(),onReorder:()=>this.dispatchChange()})}get trackBoxAdapter(){return Ho(this,_m,"f")}get collection(){return Ho(this,Dd,"f")}dispatchChange(){Ho(this,Md,"f").notify()}subscribeChanges(e){return Ho(this,Md,"f").subscribe(e)}terminate(){Ho(this,Gl,"f").terminate()}};_m=new WeakMap,Gl=new WeakMap,Md=new WeakMap,Dd=new WeakMap;var gt=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},G=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Or,Id,wn,Ke,Cd,Td,Rd,oo,Od,Vd,ms,ql,Hl,Jl,Ql,Yl,oi,Jo=class r{constructor(e,t){Or.add(this),this.type="audio-region",Id.set(this,void 0),wn.set(this,void 0),Ke.set(this,void 0),Cd.set(this,void 0),Td.set(this,void 0),Rd.set(this,void 0),oo.set(this,void 0),Od.set(this,void 0),Vd.set(this,void 0),ms.set(this,g.None),ql.set(this,K.Empty),Hl.set(this,K.Empty),Jl.set(this,K.Empty),Ql.set(this,K.Empty),Yl.set(this,void 0),gt(this,wn,e,"f"),gt(this,Ke,t,"f"),gt(this,Id,new U,"f");let{timeBase:i,position:n,duration:o,loopOffset:a,loopDuration:s}=t;gt(this,Cd,Bo.aware(e.tempoMap,i,n,o),"f"),gt(this,Td,Bo.aware(e.tempoMap,i,n,a),"f"),gt(this,Rd,Bo.aware(e.tempoMap,i,n,s),"f"),gt(this,oo,new Xr,"f"),gt(this,Od,new re,"f"),gt(this,Yl,!1,"f"),gt(this,Vd,!0,"f"),G(this,Id,"f").ownAll(G(this,Ke,"f").pointerHub.subscribe({onAdded:()=>G(this,Or,"m",oi).call(this),onRemoved:()=>G(this,Or,"m",oi).call(this)}),G(this,Ke,"f").file.catchupAndSubscribe(l=>{gt(this,ms,l.targetVertex.map(u=>G(this,wn,"f").boxAdapters.adapterFor(u.box,Vi)),"f"),G(this,ql,"f").terminate(),gt(this,ql,G(this,ms,"f").mapOr(u=>u.getOrCreateLoader().subscribe(()=>G(this,Or,"m",oi).call(this)),K.Empty),"f")}),G(this,Ke,"f").playMode.catchupAndSubscribe(({targetVertex:l})=>{G(this,Hl,"f").terminate(),l.match({none:()=>G(this,oo,"f").clear(),some:({box:u})=>{let p=G(this,wn,"f").boxAdapters.adapterFor(u,gn.isAudioPlayMode);gt(this,Hl,p.subscribe(()=>G(this,Or,"m",oi).call(this)),"f"),G(this,oo,"f").wrap(p)}})}),G(this,Ke,"f").timeBase.catchupAndSubscribe(l=>{G(this,Jl,"f").terminate(),Jr(l.getValue(),sr)===sr.Seconds&&gt(this,Jl,e.tempoMap.subscribe(()=>G(this,Or,"m",oi).call(this)),"f")}),G(this,Ke,"f").subscribe(ke.Children,l=>{if(!this.trackBoxAdapter.isEmpty()&&(l.type==="primitive"||l.type==="pointer")){let u=this.trackBoxAdapter.unwrap();G(this,Ke,"f").position.address.equals(l.address)?(u.regions.onIndexingChanged(),G(this,Or,"m",oi).call(this)):G(this,Or,"m",oi).call(this)}}),G(this,Ke,"f").events.catchupAndSubscribe(({targetVertex:l})=>{G(this,Ql,"f").terminate(),gt(this,Ql,l.match({none:()=>K.Empty,some:({box:u})=>G(this,wn,"f").boxAdapters.adapterFor(u,cr).subscribeChange(()=>G(this,Or,"m",oi).call(this))}),"f"),G(this,Or,"m",oi).call(this)})),gt(this,Vd,!1,"f")}subscribeChange(e){return G(this,Od,"f").subscribe(e)}accept(e){return _(e.visitAudioRegionBoxAdapter,this)}onSelected(){gt(this,Yl,!0,"f"),G(this,Or,"m",oi).call(this)}onDeselected(){gt(this,Yl,!1,"f"),G(this,Or,"m",oi).call(this)}get isSelected(){return G(this,Yl,"f")}get box(){return G(this,Ke,"f")}get uuid(){return G(this,Ke,"f").address.uuid}get address(){return G(this,Ke,"f").address}get position(){return G(this,Ke,"f").position.getValue()}get duration(){return G(this,Cd,"f").toPPQN()}get complete(){return this.position+this.duration}get loopOffset(){return G(this,Td,"f").toPPQN()}get loopDuration(){return G(this,Rd,"f").toPPQN()}get offset(){return this.position-this.loopOffset}get mute(){return G(this,Ke,"f").mute.getValue()}get hue(){return G(this,Ke,"f").hue.getValue()}get gain(){return G(this,Ke,"f").gain}get file(){return G(this,ms,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return G(this,oo,"f")}get timeBase(){return Jr(G(this,Ke,"f").timeBase.getValue(),sr)}get waveformOffset(){return G(this,Ke,"f").waveformOffset}get isPlayModeNoStretch(){return G(this,Ke,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>Ie(e,vn)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>Ie(e,yn)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>gn.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(G(this,ms,"f").isEmpty())return"No Audio File";let e=G(this,ms,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):G(this,Ke,"f").label.getValue()}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return G(this,oo,"f").nonEmpty()}get trackBoxAdapter(){return G(this,Ke,"f").regions.targetVertex.map(e=>G(this,wn,"f").boxAdapters.adapterFor(e.box,mt))}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return G(this,Ke,"f").events.targetVertex.map(e=>G(this,wn,"f").boxAdapters.adapterFor(e.box,cr))}set position(e){G(this,Ke,"f").position.setValue(e)}set duration(e){G(this,oo,"f").nonEmpty()&&G(this,Cd,"f").fromPPQN(e)}set loopOffset(e){G(this,Td,"f").fromPPQN(e)}set loopDuration(e){G(this,oo,"f").nonEmpty()&&G(this,Rd,"f").fromPPQN(e)}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners,n=this.observableOptPlayMode.map(a=>a.clone()),o=G(this,wn,"f").boxAdapters.adapterFor(Co.create(G(this,wn,"f").boxGraph,w.generate(),a=>{a.timeBase.setValue(G(this,Ke,"f").timeBase.getValue()),a.position.setValue(e?.position??G(this,Ke,"f").position.getValue()),a.regions.refer(e?.track??G(this,Ke,"f").regions.targetVertex.unwrap()),a.file.refer(G(this,Ke,"f").file.targetVertex.unwrap()),a.events.refer(i),a.mute.setValue(this.mute),a.hue.setValue(this.hue),a.label.setValue(this.label),a.gain.setValue(this.gain.getValue()),a.waveformOffset.setValue(this.waveformOffset.getValue()),n.ifSome(s=>a.playMode.refer(s))}),r);return o.duration=e?.duration??this.duration,o.loopOffset=e?.loopOffset??this.loopOffset,o.loopDuration=e?.loopDuration??this.loopDuration,o}consolidate(){}canFlatten(e){return!1}flatten(e){return g.None}terminate(){G(this,ql,"f").terminate(),gt(this,ql,K.Empty,"f"),G(this,Jl,"f").terminate(),gt(this,Jl,K.Empty,"f"),G(this,Hl,"f").terminate(),gt(this,Hl,K.Empty,"f"),G(this,Ql,"f").terminate(),gt(this,Ql,K.Empty,"f"),G(this,Id,"f").terminate()}toString(){return`{AudioRegionBoxAdapter ${w.toString(G(this,Ke,"f").address.uuid)}}`}};Id=new WeakMap,wn=new WeakMap,Ke=new WeakMap,Cd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,oo=new WeakMap,Od=new WeakMap,Vd=new WeakMap,ms=new WeakMap,ql=new WeakMap,Hl=new WeakMap,Jl=new WeakMap,Ql=new WeakMap,Yl=new WeakMap,Or=new WeakSet,oi=function(){G(this,Vd,"f")||(G(this,Od,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange())};var ao=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},de=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},bn,Sm,An,et,jd,zd,Xl,Ud,so,Qo=class r{constructor(e,t){bn.add(this),this.type="note-region",Sm.set(this,new U),An.set(this,void 0),et.set(this,void 0),jd.set(this,void 0),zd.set(this,void 0),Xl.set(this,void 0),Ud.set(this,K.Empty),ao(this,An,e,"f"),ao(this,et,t,"f"),ao(this,jd,new re,"f"),ao(this,Xl,!1,"f"),ao(this,zd,!0,"f"),de(this,Sm,"f").ownAll(de(this,et,"f").pointerHub.subscribe({onAdded:()=>de(this,bn,"m",so).call(this),onRemoved:()=>de(this,bn,"m",so).call(this)}),de(this,et,"f").subscribe(ke.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackBoxAdapter.unwrap();de(this,et,"f").position.address.equals(i.address)?(n.regions.onIndexingChanged(),de(this,bn,"m",so).call(this)):de(this,bn,"m",so).call(this)}}),de(this,et,"f").events.catchupAndSubscribe(({targetVertex:i})=>{de(this,Ud,"f").terminate(),ao(this,Ud,i.match({none:()=>K.Empty,some:({box:n})=>de(this,An,"f").boxAdapters.adapterFor(n,ii).subscribeChange(()=>de(this,bn,"m",so).call(this))}),"f"),de(this,bn,"m",so).call(this)})),ao(this,zd,!1,"f")}set position(e){de(this,et,"f").position.setValue(e)}set duration(e){de(this,et,"f").duration.setValue(e)}set loopOffset(e){de(this,et,"f").loopOffset.setValue(e)}set loopDuration(e){de(this,et,"f").loopDuration.setValue(e)}subscribeChange(e){return de(this,jd,"f").subscribe(e)}accept(e){return _(e.visitNoteRegionBoxAdapter,this)}onSelected(){ao(this,Xl,!0,"f"),de(this,bn,"m",so).call(this)}onDeselected(){ao(this,Xl,!1,"f"),de(this,bn,"m",so).call(this)}get isSelected(){return de(this,Xl,"f")}*iterateActiveNotesAt(e){let t=this.optCollection;if(t.isEmpty())return;let i=t.unwrap(),n=qt.globalToLocal(this,e);for(let o of i.events.iterateFrom(n-i.maxDuration)){if(n<o.position)return;n<o.complete&&(yield o.copyAsNoteEvent())}}terminate(){de(this,Ud,"f").terminate(),de(this,Sm,"f").terminate()}get box(){return de(this,et,"f")}get uuid(){return de(this,et,"f").address.uuid}get address(){return de(this,et,"f").address}get position(){return de(this,et,"f").position.getValue()}get duration(){return de(this,et,"f").duration.getValue()}get loopOffset(){return de(this,et,"f").loopOffset.getValue()}get loopDuration(){return de(this,et,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return de(this,et,"f").mute.getValue()}get hue(){return de(this,et,"f").hue.getValue()}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return de(this,et,"f").events.targetVertex.map(e=>de(this,An,"f").boxAdapters.adapterFor(e.box,ii))}get label(){return de(this,et,"f").label.getValue()}get trackBoxAdapter(){return de(this,zd,"f")?g.None:de(this,et,"f").regions.targetVertex.map(e=>de(this,An,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return de(this,An,"f").boxAdapters.adapterFor(Za.create(de(this,An,"f").boxGraph,w.generate(),n=>{n.position.setValue(e?.position??this.position),n.duration.setValue(e?.duration??this.duration),n.loopOffset.setValue(e?.loopOffset??this.loopOffset),n.loopDuration.setValue(e?.loopDuration??this.loopDuration),n.hue.setValue(this.hue),n.label.setValue(this.label),n.mute.setValue(this.mute),n.events.refer(i),n.regions.refer(e?.track??de(this,et,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.optCollection.ifSome(e=>{let t=de(this,An,"f").boxGraph,i=Yn.create(t,w.generate());e.events.asArray().forEach(n=>n.copyTo({events:i.events})),de(this,et,"f").events.refer(i.owners)})}canFlatten(e){return e.length>0&&R.satisfy(e,(t,i)=>t.trackBoxAdapter.contains(i.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return g.None;let t=de(this,An,"f").boxGraph,i=e.toSorted(Eo.Comparator),n=R.getFirst(i,"Internal error (no first)"),o=R.getLast(i,"Internal error (no last)"),a=n.position,s=o.position+o.duration,l=n.trackBoxAdapter.unwrap(),u=Yn.create(t,w.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let f=d;for(let{resultStart:v,resultEnd:m,rawStart:y}of qt.locateLoops(f,f.position,f.complete)){let x=Math.floor(v-y),D=Math.floor(m-y);for(let M of f.optCollection.unwrap().events.iterateRange(x,D))M.copyTo({position:M.position+y-n.position,events:u.events})}}),p.forEach(({box:d})=>d.delete()),g.wrap(Za.create(t,w.generate(),d=>{d.position.setValue(a),d.duration.setValue(s-a),d.loopDuration.setValue(s-a),d.loopOffset.setValue(0),d.hue.setValue(this.hue),d.mute.setValue(this.mute),d.label.setValue(this.label),d.events.refer(u.owners),d.regions.refer(l.box.regions)}))}toString(){return`{NoteRegionBoxAdapter ${w.toString(de(this,et,"f").address.uuid)} p: ${Q.toString(this.position)}, c: ${Q.toString(this.complete)}}`}};Sm=new WeakMap,An=new WeakMap,et=new WeakMap,jd=new WeakMap,zd=new WeakMap,Xl=new WeakMap,Ud=new WeakMap,bn=new WeakSet,so=function(){de(this,jd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var lo=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ce=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ji,ec,_n,tt,Wd,tc,Ld,Kd,Pn,co=class r{constructor(e,t){ji.add(this),this.type="value-region",ec.set(this,new U),_n.set(this,void 0),tt.set(this,void 0),Wd.set(this,void 0),tc.set(this,void 0),Ld.set(this,void 0),Kd.set(this,K.Empty),lo(this,_n,e,"f"),lo(this,tt,t,"f"),lo(this,Ld,!0,"f"),lo(this,Wd,new re,"f"),lo(this,tc,!1,"f"),ce(this,ec,"f").own(ce(this,tt,"f").pointerHub.subscribe({onAdded:()=>ce(this,ji,"m",Pn).call(this),onRemoved:()=>ce(this,ji,"m",Pn).call(this)})),ce(this,ec,"f").own(ce(this,tt,"f").subscribe(ke.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackBoxAdapter.unwrap();ce(this,tt,"f").position.address.equals(i.address)?(n.regions.onIndexingChanged(),ce(this,ji,"m",Pn).call(this)):ce(this,ji,"m",Pn).call(this)}})),ce(this,ec,"f").own(ce(this,tt,"f").events.catchupAndSubscribe(({targetVertex:i})=>{ce(this,Kd,"f").terminate(),lo(this,Kd,i.match({none:()=>K.Empty,some:({box:n})=>ce(this,_n,"f").boxAdapters.adapterFor(n,cr).subscribeChange(()=>ce(this,ji,"m",Pn).call(this))}),"f"),ce(this,ji,"m",Pn).call(this)})),lo(this,Ld,!1,"f")}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(qt.globalToLocal(this,e),t)}incomingValue(e){return this.valueAt(this.position,e)}outgoingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let i=t.unwrap();return(this.complete-this.offset)%this.loopDuration===0?i.valueAt(this.loopDuration,e):i.valueAt(qt.globalToLocal(this,this.complete),e)}subscribeChange(e){return ce(this,Wd,"f").subscribe(e)}accept(e){return _(e.visitValueRegionBoxAdapter,this)}onSelected(){lo(this,tc,!0,"f"),ce(this,ji,"m",Pn).call(this)}onDeselected(){lo(this,tc,!1,"f"),ce(this,ji,"m",Pn).call(this)}get isSelected(){return ce(this,tc,"f")}onValuesPropertyChanged(){ce(this,ji,"m",Pn).call(this)}onValuesSortingChanged(){this.onValuesPropertyChanged()}terminate(){ce(this,Kd,"f").terminate(),ce(this,ec,"f").terminate()}get box(){return ce(this,tt,"f")}get uuid(){return ce(this,tt,"f").address.uuid}get address(){return ce(this,tt,"f").address}get position(){return ce(this,tt,"f").position.getValue()}get duration(){return ce(this,tt,"f").duration.getValue()}get loopOffset(){return ce(this,tt,"f").loopOffset.getValue()}get loopDuration(){return ce(this,tt,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return ce(this,tt,"f").mute.getValue()}get hue(){return ce(this,tt,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return ce(this,tt,"f").events.targetVertex.map(e=>ce(this,_n,"f").boxAdapters.adapterFor(e.box,cr))}get label(){return ce(this,tt,"f").label.getValue()}get trackBoxAdapter(){return ce(this,Ld,"f")?g.None:ce(this,tt,"f").regions.targetVertex.map(e=>ce(this,_n,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}set position(e){ce(this,tt,"f").position.setValue(e)}set duration(e){ce(this,tt,"f").duration.setValue(e)}set loopOffset(e){ce(this,tt,"f").loopOffset.setValue(e)}set loopDuration(e){ce(this,tt,"f").loopDuration.setValue(e)}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return ce(this,_n,"f").boxAdapters.adapterFor(Ga.create(ce(this,_n,"f").boxGraph,w.generate(),n=>{n.position.setValue(e?.position??this.position),n.duration.setValue(e?.duration??this.duration),n.loopOffset.setValue(e?.loopOffset??this.loopOffset),n.loopDuration.setValue(e?.loopDuration??this.loopDuration),n.hue.setValue(this.hue),n.label.setValue(this.label),n.mute.setValue(this.mute),n.events.refer(i),n.regions.refer(e?.track??ce(this,tt,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.events.ifSome(e=>{let t=ce(this,_n,"f").boxGraph,i=Xn.create(t,w.generate());e.asArray().forEach(n=>n.copyTo({events:i.events})),ce(this,tt,"f").events.refer(i.owners)})}canFlatten(e){return!1}flatten(e){if(!this.canFlatten(e))return g.None;let t=ce(this,_n,"f").boxGraph,i=e.toSorted(Eo.Comparator),n=R.getFirst(i,"Internal error (no first)"),o=R.getLast(i,"Internal error (no last)"),a=n.position,s=o.position+o.duration,l=n.trackBoxAdapter.unwrap(),u=Xn.create(t,w.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let f=d;for(let{resultStart:v,resultEnd:m,rawStart:y}of qt.locateLoops(f,f.position,f.complete)){let x=Math.floor(v-y),D=Math.floor(m-y);for(let M of f.events.unwrap().iterateRange(x,D));}}),p.forEach(({box:d})=>d.delete()),g.wrap(Ga.create(t,w.generate(),d=>{d.position.setValue(a),d.duration.setValue(s-a),d.loopDuration.setValue(s-a),d.loopOffset.setValue(0),d.hue.setValue(this.hue),d.mute.setValue(this.mute),d.label.setValue(this.label),d.events.refer(u.owners),d.regions.refer(l.box.regions)}))}toString(){return`{ValueRegionBoxAdapter ${w.toString(ce(this,tt,"f").address.uuid)} p: ${Q.toString(this.position)}, c: ${Q.toString(this.complete)}}`}};ec=new WeakMap,_n=new WeakMap,tt=new WeakMap,Wd=new WeakMap,tc=new WeakMap,Ld=new WeakMap,Kd=new WeakMap,ji=new WeakSet,Pn=function(){ce(this,Wd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var VP=(r,e)=>r.position-e.position,zP={for:(r,e)=>ee(e.accept({visitNoteRegionBox:t=>r.adapterFor(t,Qo),visitAudioRegionBox:t=>r.adapterFor(t,Jo),visitValueRegionBox:t=>r.adapterFor(t,co)}),"")};var rc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ut=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Zd,gs,Gd,ic,vs,nc,Em=class{constructor(e,t){Zd.set(this,void 0),gs.set(this,void 0),Gd.set(this,void 0),ic.set(this,void 0),vs.set(this,void 0),nc.set(this,void 0),rc(this,Zd,e,"f"),rc(this,gs,new U,"f"),rc(this,Gd,Ut(this,gs,"f").own(new re),"f"),rc(this,ic,Ut(this,gs,"f").own(new Mt),"f"),rc(this,vs,Eo.create(VP),"f"),rc(this,nc,w.newSet(i=>i.uuid),"f"),Ut(this,gs,"f").ownAll(Ut(this,Zd,"f").box.regions.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{let n=zP.for(t,i),o=Ut(this,nc,"f").add(n);I(o,`Cannot add ${i}`),Ut(this,vs,"f").add(n),Ut(this,ic,"f").forEach(a=>a.onAdded(n)),this.dispatchChange()},onRemoved:({box:{address:{uuid:i}}})=>{let n=Ut(this,nc,"f").removeByKey(i);Ut(this,vs,"f").remove(n),Ut(this,ic,"f").forEach(o=>o.onRemoved(n)),this.dispatchChange()}},c.RegionCollection))}get trackBoxAdapter(){return Ut(this,Zd,"f")}get collection(){return Ut(this,vs,"f")}get adapters(){return Ut(this,nc,"f")}onIndexingChanged(){Ut(this,vs,"f").onIndexingChanged(),this.dispatchChange()}catchupAndSubscribe(e){return this.collection.asArray().forEach(e.onAdded),Ut(this,ic,"f").subscribe(e)}subscribeChanges(e){return Ut(this,Gd,"f").subscribe(e)}dispatchChange(){Ut(this,Gd,"f").notify()}terminate(){Ut(this,gs,"f").terminate()}};Zd=new WeakMap,gs=new WeakMap,Gd=new WeakMap,ic=new WeakMap,vs=new WeakMap,nc=new WeakMap;var ie;(function(r){r[r.Undefined=0]="Undefined",r[r.Notes=1]="Notes",r[r.Audio=2]="Audio",r[r.Value=3]="Value"})(ie||(ie={}));(function(r){r.toLabelString=e=>{switch(e){case r.Audio:return"Audio";case r.Notes:return"Notes";case r.Value:return"Automation";case r.Undefined:default:return"N/A"}},r.toIconSymbol=e=>{switch(e){case r.Audio:return Me.Waveform;case r.Notes:return Me.Piano;case r.Value:return Me.Automation;case r.Undefined:return Me.AudioBus;default:return Me.Unknown}}})(ie||(ie={}));var Bm;(function(r){r.isDeviceBox=e=>"host"in e&&Ie(e.host,B)&&"label"in e&&Ie(e.label,C)&&"enabled"in e&&Ie(e.enabled,$)&&"minimized"in e&&Ie(e.minimized,$),r.isInstrumentDeviceBox=e=>r.isDeviceBox(e)&&e.host.pointerType===c.InstrumentHost,r.isEffectDeviceBox=e=>r.isDeviceBox(e)&&"index"in e&&Ie(e.index,E)&&(e.host.pointerType===c.MidiEffectHost||e.host.pointerType===c.AudioEffectHost),r.lookupHostField=e=>Z(e)&&"host"in e&&Ie(e.host,B)?e.host:F(`Could not find 'host' field in '${e?.name}'`),r.lookupLabelField=e=>Z(e)&&"label"in e&&Ie(e.label,C)?e.label:F(`Could not find 'label' field in '${e?.name}'`),r.lookupEnabledField=e=>Z(e)&&"enabled"in e&&Ie(e.enabled,$)?e.enabled:F(`Could not find 'enabled' field in '${e?.name}'`),r.lookupMinimizedField=e=>Z(e)&&"minimized"in e&&Ie(e.minimized,$)?e.minimized:F(`Could not find 'minimized' field in '${e?.name}'`),r.lookupIndexField=e=>Z(e)&&"index"in e&&Ie(e.index,E)?e.index:F(`Could not find 'index' field in '${e?.name}'`)})(Bm||(Bm={}));var UP;(function(r){r.toTrackType=e=>{switch(e){case"midi":return ie.Notes;case"audio":return ie.Audio;default:return F()}}})(UP||(UP={}));var ne;(function(r){r.isAny=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="bus"||e.type==="instrument"||e.type==="audio-effect"),r.isEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="audio-effect"),r.isInstrument=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="instrument",r.isMidiEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="midi-effect",r.isAudioEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="audio-effect",r.isHost=e=>e!==null&&typeof e=="object"&&"class"in e&&e.class==="device-host",r.deleteEffectDevices=e=>{if(e.length===0)return;I(R.satisfy(e,(n,o)=>n.deviceHost().address.equals(o.deviceHost().address)),"Devices are not connected to the same host");let t=e[0];(t.accepts==="audio"?t.deviceHost().audioEffects.field().pointerHub.filter(c.AudioEffectHost):t.accepts==="midi"?t.deviceHost().midiEffects.field().pointerHub.filter(c.MidiEffectHost):F("unknown type")).map(({box:n})=>Bm.lookupIndexField(n)).filter(n=>e.some(o=>w.Comparator(o.uuid,n.address.uuid)!==0)).sort((n,o)=>n.getValue()-o.getValue()).forEach((n,o)=>n.setValue(o)),e.forEach(n=>n.box.delete())}})(ne||(ne={}));var Fm=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Wt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},qd,Nm,Li,ys,km,$m=class{constructor(e,t){qd.set(this,void 0),Nm.set(this,new re),Li.set(this,void 0),ys.set(this,void 0),km.set(this,void 0),Fm(this,qd,e,"f"),Fm(this,Li,Lt.create(e.box.tracks,i=>t.adapterFor(i,mt),c.TrackCollection),"f"),Fm(this,ys,w.newSet(({uuid:i})=>i),"f"),Fm(this,km,Wt(this,Li,"f").catchupAndSubscribe({onAdd:i=>Wt(this,ys,"f").add({uuid:i.uuid,subscription:i.regions.subscribeChanges(()=>Wt(this,Nm,"f").notify())}),onRemove:({uuid:i})=>Wt(this,ys,"f").removeByKey(i).subscription.terminate(),onReorder:i=>{}}),"f")}create(e,t,i){let n=Wt(this,qd,"f").box.graph,o=Wt(this,qd,"f").box.tracks;lr.create(n,w.generate(),a=>{a.index.setValue(i??Wt(this,Li,"f").getMinFreeIndex()),a.type.setValue(e),a.tracks.refer(o),a.target.refer(t)})}controls(e){return g.wrap(Wt(this,Li,"f").adapters().find(t=>t.target.targetVertex.contains(e),!1))}delete(e){let t=Wt(this,Li,"f").adapters(),i=t.indexOf(e);if(i===-1)return F(`Cannot delete ${e}. Does not exist.`);for(let n=i+1;n<t.length;n++)t[n].indexField.setValue(n-1);e.box.delete()}get collection(){return Wt(this,Li,"f")}values(){return Wt(this,Li,"f").adapters()}catchupAndSubscribe(e){return Wt(this,Li,"f").catchupAndSubscribe(e)}subscribeAnyChange(e){return Wt(this,Nm,"f").subscribe(e)}terminate(){Wt(this,Li,"f").terminate(),Wt(this,km,"f").terminate(),Wt(this,ys,"f").forEach(({subscription:e})=>e.terminate()),Wt(this,ys,"f").clear()}};qd=new WeakMap,Nm=new WeakMap,Li=new WeakMap,ys=new WeakMap,km=new WeakMap;var jP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ki=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mm,Vr,dr=class{constructor(e,t){this.type="bus",this.accepts="audio",Mm.set(this,void 0),Vr.set(this,void 0),jP(this,Mm,e,"f"),jP(this,Vr,t,"f")}catchupAndSubscribe(e){return e(this),Ki(this,Vr,"f").subscribe(ke.Children,()=>e(this))}get uuid(){return Ki(this,Vr,"f").address.uuid}get address(){return Ki(this,Vr,"f").address}get box(){return Ki(this,Vr,"f")}get enabledField(){return Ki(this,Vr,"f").enabled}get minimizedField(){return Ki(this,Vr,"f").minimized}get iconField(){return Ki(this,Vr,"f").icon}get labelField(){return Ki(this,Vr,"f").label}get colorField(){return Ki(this,Vr,"f").color}get iconSymbol(){return Me.fromName(this.iconField.getValue()??"audio-bus")}deviceHost(){return Ki(this,Mm,"f").boxAdapters.adapterFor(Ki(this,Vr,"f").output.targetVertex.unwrap("No AudioUnitBox found").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}toString(){return`{${this.constructor.name}}`}};Mm=new WeakMap,Vr=new WeakMap;var Hd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},pt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},uo,oc,ac,ai,Jd,Dm=class{constructor(e,t){uo.set(this,void 0),oc.set(this,void 0),ac.set(this,void 0),ai.set(this,void 0),Jd.set(this,K.Empty),Hd(this,uo,new U,"f"),Hd(this,oc,pt(this,uo,"f").own(new re),"f"),Hd(this,ac,pt(this,uo,"f").own(new Cr(Me.Unknown)),"f"),Hd(this,ai,pt(this,uo,"f").own(new Cr(g.None)),"f"),pt(this,uo,"f").own(pt(this,ai,"f").subscribe(i=>{pt(this,Jd,"f").terminate(),Hd(this,Jd,i.getValue().match({none:()=>(pt(this,oc,"f").notify(g.None),K.Empty),some:({labelField:n,iconField:o})=>K.many(o.catchupAndSubscribe(a=>pt(this,ac,"f").setValue(Me.fromName(a.getValue()))),n.catchupAndSubscribe(a=>pt(this,oc,"f").notify(g.wrap(a.getValue()))))}),"f")})),pt(this,uo,"f").own(e.catchupAndSubscribe({onAdded:({box:i})=>{I(pt(this,ai,"f").getValue().isEmpty(),"Already set");let n=i instanceof Ti?t.adapterFor(i,dr):t.adapterFor(i,ne.isInstrument);pt(this,ai,"f").getValue().unwrapOrNull()!==n&&pt(this,ai,"f").setValue(g.wrap(n))},onRemoved:({box:i})=>{I(pt(this,ai,"f").getValue().unwrap("Cannot remove").box.address.equals(i.address),"Unexpected value to remove"),pt(this,ai,"f").setValue(g.None)}},c.InstrumentHost,c.AudioOutput))}getValue(){return pt(this,ai,"f").getValue()}subscribe(e){return pt(this,ai,"f").subscribe(e)}catchupAndSubscribe(e){return e(pt(this,ai,"f")),this.subscribe(e)}catchupAndSubscribeLabelChange(e){return e(this.label),pt(this,oc,"f").subscribe(e)}catchupAndSubscribeIconChange(e){return pt(this,ac,"f").catchupAndSubscribe(e)}set label(e){this.getValue().ifSome(t=>t.labelField.setValue(e))}get label(){return this.getValue().map(e=>e.labelField.getValue())}set icon(e){this.getValue().ifSome(t=>t.iconField.setValue(Me.toName(e)))}get icon(){return this.getValue().match({none:()=>Me.Unknown,some:e=>Me.fromName(e.iconField.getValue())})}get iconValue(){return pt(this,ac,"f")}terminate(){pt(this,uo,"f").terminate(),pt(this,Jd,"f").terminate()}};uo=new WeakMap,oc=new WeakMap,ac=new WeakMap,ai=new WeakMap,Jd=new WeakMap;var LP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},xs=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Im,po,pe=class{constructor(e){Im.set(this,void 0),po.set(this,void 0),LP(this,Im,e,"f"),LP(this,po,Ae.newSet(t=>t.address),"f")}terminate(){xs(this,po,"f").forEach(e=>e.terminate()),xs(this,po,"f").clear()}parameters(){return xs(this,po,"f").values()}parameterAt(e){return xs(this,po,"f").getOrThrow(e,()=>new Error(`No ParameterAdapter found at [${e.toString()}]`))}createParameter(e,t,i,n,o){let a=new ws(xs(this,Im,"f"),e,t,i,n,o),s=xs(this,po,"f").add(a);return I(s,`Could not add adapter for ${e}`),a}removeParameter(e){return xs(this,po,"f").removeByKey(e)}};Im=new WeakMap,po=new WeakMap;var bs=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},As,si,Yo,sc,Cm,Tm,Qd,lc=class{constructor(e,t){As.set(this,void 0),si.set(this,void 0),Yo.set(this,void 0),sc.set(this,void 0),Cm.set(this,void 0),Tm.set(this,void 0),Qd.set(this,K.Empty),bs(this,As,e,"f"),bs(this,si,t,"f"),bs(this,Yo,new U,"f"),bs(this,sc,nt(this,Yo,"f").own(new re),"f"),nt(this,Yo,"f").own(t.targetBus.catchupAndSubscribe(()=>{nt(this,Qd,"f").terminate(),bs(this,Qd,this.optTargetBus.match({none:()=>(nt(this,sc,"f").notify(g.None),K.Empty),some:i=>i.catchupAndSubscribe(n=>nt(this,sc,"f").notify(g.wrap(n)))}),"f")})),bs(this,Cm,nt(this,Yo,"f").own(new ws(nt(this,As,"f"),nt(this,si,"f").sendPan,S.bipolar(),P.percent({unit:"%",fractionDigits:0}),"panning")),"f"),bs(this,Tm,nt(this,Yo,"f").own(new ws(nt(this,As,"f"),nt(this,si,"f").sendGain,S.DefaultDecibel,P.numeric({unit:"dB",fractionDigits:1}),"gain")),"f")}catchupAndSubscribeBusChanges(e){return e(this.optTargetBus),nt(this,sc,"f").subscribe(e)}get uuid(){return nt(this,si,"f").address.uuid}get address(){return nt(this,si,"f").address}get box(){return nt(this,si,"f")}get indexField(){return nt(this,si,"f").index}get sendPan(){return nt(this,Cm,"f")}get sendGain(){return nt(this,Tm,"f")}get targetBus(){return nt(this,As,"f").boxAdapters.adapterFor(nt(this,si,"f").targetBus.targetVertex.unwrap("no audioUnit").box,dr)}get optTargetBus(){return nt(this,si,"f").targetBus.targetVertex.flatMap(e=>g.wrap(e.box.accept({visitAudioBusBox:t=>nt(this,As,"f").boxAdapters.adapterFor(t,dr)})))}delete(){nt(this,si,"f").delete()}terminate(){nt(this,Yo,"f").terminate(),nt(this,Qd,"f").terminate()}};As=new WeakMap,si=new WeakMap,Yo=new WeakMap,sc=new WeakMap,Cm=new WeakMap,Tm=new WeakMap,Qd=new WeakMap;var Yd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Sn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rm,Om,cc,uc,Xd,Vm=class{constructor(e,t){Rm.set(this,void 0),Om.set(this,void 0),cc.set(this,void 0),uc.set(this,void 0),Xd.set(this,K.Empty),Yd(this,Rm,e,"f"),Yd(this,Om,t,"f"),Yd(this,cc,new U,"f"),Yd(this,uc,Sn(this,cc,"f").own(new re),"f"),Sn(this,cc,"f").own(e.catchupAndSubscribe(()=>{Sn(this,Xd,"f").terminate(),Yd(this,Xd,this.adapter.match({none:()=>(Sn(this,uc,"f").notify(g.None),K.Empty),some:i=>i.catchupAndSubscribe(n=>Sn(this,uc,"f").notify(g.wrap(n)))}),"f")}))}subscribe(e){return Sn(this,uc,"f").subscribe(e)}catchupAndSubscribe(e){return e(this.adapter),this.subscribe(e)}get adapter(){return Sn(this,Rm,"f").targetVertex.flatMap(e=>g.wrap(e.box.accept({visitAudioBusBox:t=>Sn(this,Om,"f").adapterFor(t,dr)})))}terminate(){Sn(this,cc,"f").terminate(),Sn(this,Xd,"f").terminate()}};Rm=new WeakMap,Om=new WeakMap,cc=new WeakMap,uc=new WeakMap,Xd=new WeakMap;var ho=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ae=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},zm,KP,En,zr,vt,Ps,dc,_s,Um,jm,Lm,Km,WP,ZP,li=class{constructor(e,t){zm.add(this),this.class="device-host",En.set(this,new U),zr.set(this,void 0),vt.set(this,void 0),Ps.set(this,void 0),dc.set(this,void 0),_s.set(this,void 0),Um.set(this,void 0),jm.set(this,void 0),Lm.set(this,void 0),Km.set(this,void 0),ho(this,zr,e,"f"),ho(this,vt,t,"f"),ho(this,Ps,ae(this,En,"f").own(new pe(ae(this,zr,"f"))),"f"),ho(this,dc,ae(this,En,"f").own(new $m(this,ae(this,zr,"f").boxAdapters)),"f"),ho(this,_s,ae(this,En,"f").own(new Dm(ae(this,vt,"f").input.pointerHub,ae(this,zr,"f").boxAdapters)),"f"),ho(this,Um,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").midiEffects,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,ne.isMidiEffect),c.MidiEffectHost)),"f"),ho(this,jm,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").audioEffects,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,ne.isAudioEffect),c.AudioEffectHost)),"f"),ho(this,Lm,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").auxSends,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,lc),c.AuxSend)),"f"),ho(this,Km,ae(this,En,"f").own(new Vm(ae(this,vt,"f").output,ae(this,zr,"f").boxAdapters)),"f"),this.namedParameter=ae(this,zm,"m",WP).call(this,t),ae(this,zm,"m",ZP).call(this)}get box(){return ae(this,vt,"f")}get uuid(){return ae(this,vt,"f").address.uuid}get address(){return ae(this,vt,"f").address}get indexField(){return ae(this,vt,"f").index}get type(){return ae(this,vt,"f").type.getValue()}get captureBox(){return ae(this,vt,"f").capture.targetVertex}get tracks(){return ae(this,dc,"f")}get input(){return ae(this,_s,"f")}get midiEffects(){return ae(this,Um,"f")}get audioEffects(){return ae(this,jm,"f")}get inputAdapter(){return ae(this,_s,"f").getValue()}get auxSends(){return ae(this,Lm,"f")}get output(){return ae(this,Km,"f")}get isBus(){return this.input.getValue().mapOr(e=>e.type==="bus",!1)}get isInstrument(){return this.input.getValue().mapOr(e=>e.type==="instrument",!1)}get isOutput(){return ae(this,vt,"f").output.targetVertex.mapOr(e=>e.box.address.equals(ae(this,zr,"f").rootBoxAdapter.address),!1)}get midiEffectsField(){return ae(this,vt,"f").midiEffects}get inputField(){return ae(this,vt,"f").input}get audioEffectsField(){return ae(this,vt,"f").audioEffects}get tracksField(){return ae(this,vt,"f").tracks}get minimizedField(){return ae(this,_s,"f").getValue().unwrap().minimizedField}get isAudioUnit(){return!0}get label(){return ae(this,_s,"f").getValue().mapOr(e=>e.labelField.getValue(),"")}audioUnitBoxAdapter(){return this}indicesLimit(){let e=ae(this,zr,"f").rootBoxAdapter.audioUnits.adapters(),t=this.indexField.getValue(),i=this.type,n=t,o=t;for(;n>0&&e[n-1].type===i;)n--;for(;o<e.length-1&&e[o+1].type===i;)o++;return[n,o+1]}move(e){ae(this,zr,"f").rootBoxAdapter.audioUnits.move(this,e)}moveTrack(e,t){ae(this,dc,"f").collection.move(e,t)}deleteTrack(e){ae(this,dc,"f").delete(e)}toString(){return`{${this.constructor.name}}`}terminate(){ae(this,En,"f").terminate()}};KP=li,En=new WeakMap,zr=new WeakMap,vt=new WeakMap,Ps=new WeakMap,dc=new WeakMap,_s=new WeakMap,Um=new WeakMap,jm=new WeakMap,Lm=new WeakMap,Km=new WeakMap,zm=new WeakSet,WP=function(e){return{volume:ae(this,Ps,"f").createParameter(e.volume,KP.VolumeMapper,P.decible,"volume"),panning:ae(this,Ps,"f").createParameter(e.panning,S.bipolar(),P.panning,"panning",.5),mute:ae(this,Ps,"f").createParameter(e.mute,S.bool,P.bool,"mute"),solo:ae(this,Ps,"f").createParameter(e.solo,S.bool,P.bool,"solo")}},ZP=function(){let e=this.address.toString(),t=ae(this,vt,"f").capture.targetAddress.unwrapOrUndefined(),i=()=>`AudioUnit '${e}' must have a capture. AudioUnit is typed ${this.type} and has input ${ae(this,vt,"f").input.pointerHub.incoming().at(0)?.box.name}, but capture is ${t}`;I(this.type!==St.Instrument||ae(this,vt,"f").capture.targetAddress.nonEmpty(),i)};li.VolumeMapper=S.decibel(-96,-9,6);var pc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},qe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Wm,Xo,pr,Ss,Zm,Gm,ep,GP,qP,mt=class{constructor(e,t){Wm.add(this),Xo.set(this,void 0),pr.set(this,void 0),Ss.set(this,void 0),Zm.set(this,void 0),Gm.set(this,void 0),ep.set(this,void 0),pc(this,Xo,e,"f"),pc(this,pr,t,"f"),pc(this,Ss,new U,"f"),pc(this,Zm,qe(this,Ss,"f").own(new Pm(this,e.boxAdapters)),"f"),pc(this,Gm,qe(this,Ss,"f").own(new Em(this,e.boxAdapters)),"f"),pc(this,ep,qe(this,Ss,"f").own(new Cr(-1)),"f")}catchupAndSubscribePath(e){let t=[g.None,g.None],i=()=>{t.every(n=>n.nonEmpty())?e(g.wrap(t.map(n=>n.unwrap()))):e(g.None)};return K.many(qe(this,Wm,"m",GP).call(this,n=>{t[0].equals(n)||(t[0]=n,i())}),qe(this,Wm,"m",qP).call(this,n=>{t[1].equals(n)||(t[1]=n,i())}))}set targetDeviceName(e){qe(this,pr,"f").target.targetVertex.ifSome(t=>{let i=t.box;if(i instanceof it)return qe(this,Xo,"f").boxAdapters.adapterFor(i,li).input.getValue().ifSome(({labelField:o})=>o.setValue(e));if("label"in i&&i.label instanceof C)return i.label.setValue(e)})}get targetDeviceName(){return qe(this,pr,"f").target.targetVertex.flatMap(e=>{let t=e.box;return t instanceof it?qe(this,Xo,"f").boxAdapters.adapterFor(t,li).input.label:"label"in t&&t.label instanceof C?g.wrap(t.label.getValue()):g.wrap(t.name)})}terminate(){qe(this,Ss,"f").terminate()}get audioUnit(){return Ne(qe(this,pr,"f").tracks.targetVertex.unwrap().box,it)}get target(){return qe(this,pr,"f").target}get clips(){return qe(this,Zm,"f")}get regions(){return qe(this,Gm,"f")}get enabled(){return qe(this,pr,"f").enabled}get indexField(){return qe(this,pr,"f").index}get type(){return qe(this,pr,"f").type.getValue()}get box(){return qe(this,pr,"f")}get uuid(){return qe(this,pr,"f").address.uuid}get address(){return qe(this,pr,"f").address}get listIndex(){return qe(this,ep,"f").getValue()}set listIndex(e){qe(this,ep,"f").setValue(e)}accepts(e){switch(e.type){case"audio-clip":return this.type===ie.Audio;case"note-clip":return this.type===ie.Notes;case"value-clip":return this.type===ie.Value;case"audio-region":return this.type===ie.Audio;case"note-region":return this.type===ie.Notes;case"value-region":return this.type===ie.Value}}valueAt(e,t){if(!this.enabled.getValue())return t;let i=t,n=qe(this,Xo,"f").clipSequencing.iterate(this.uuid,e,e+df);for(let{optClip:o,sectionFrom:a}of n)i=o.match({none:()=>{let s=this.regions.collection.lowerEqual(e,l=>!l.mute);if(s===null){let l=this.regions.collection.optAt(0);return Ie(l,co)?l.incomingValue(t):t}else if(Ie(s,co))return e<s.complete?s.valueAt(e,t):s.outgoingValue(t);return t},some:s=>a===e&&Ie(s,Wo)?s.valueAt(e,t):t});return i}};Xo=new WeakMap,pr=new WeakMap,Ss=new WeakMap,Zm=new WeakMap,Gm=new WeakMap,ep=new WeakMap,Wm=new WeakSet,GP=function(e){let t=qe(this,pr,"f").target.targetVertex;if(t.nonEmpty()){let i=t.unwrap().box;return i instanceof it?qe(this,Xo,"f").boxAdapters.adapterFor(i,li).input.catchupAndSubscribeLabelChange(o=>e(o)):"label"in i&&i.label instanceof C?i.label.catchupAndSubscribe(n=>e(g.wrap(n.getValue()))):(e(g.wrap(i.name)),K.Empty)}return e(g.None),K.Empty},qP=function(e){let t=this.type;switch(t){case ie.Audio:case ie.Notes:return e(g.wrap(ie[t])),K.Empty;case ie.Value:{let i=qe(this,pr,"f").target.targetVertex.unwrap();if(i.isField())e(qe(this,Xo,"f").parameterFieldAdapters.opt(i.address).map(n=>n.name));else if(i.isBox())e(g.wrap(i.name));else return F("Illegal State. Vertex is not a field nor box.");return K.Empty}case ie.Undefined:return e(g.wrap("")),K.Empty;default:return e(g.None),K.Empty}};var Zt=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ue=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ea,Ur,ta,Es,qm,Hm,Bs,Fs,ra,ia,Ns,hc,tp,HP=[c.Automation,c.Modulation,c.MidiControl,c.ParameterController],ws=class{constructor(e,t,i,n,o,a){ea.set(this,void 0),Ur.set(this,void 0),ta.set(this,void 0),Es.set(this,void 0),qm.set(this,void 0),Hm.set(this,void 0),Bs.set(this,new U),Fs.set(this,void 0),ra.set(this,void 0),ia.set(this,g.None),Ns.set(this,g.None),hc.set(this,null),tp.set(this,!1),Zt(this,ea,e,"f"),Zt(this,Ur,t,"f"),Zt(this,ta,i,"f"),Zt(this,Es,n,"f"),Zt(this,qm,o,"f"),Zt(this,Hm,a??0,"f"),ue(this,Bs,"f").own(ue(this,ea,"f").parameterFieldAdapters.register(this)),Zt(this,Fs,ue(this,Bs,"f").own(new re),"f"),Zt(this,ra,new Mt,"f"),ue(this,Bs,"f").own(ue(this,Ur,"f").subscribe(()=>ue(this,Fs,"f").notify(this))),ue(this,Bs,"f").own(ue(this,Ur,"f").pointerHub.catchupAndSubscribe({onAdded:s=>{ue(this,ra,"f").proxy.onControlSourceAdd(Gx(s.pointerType)),s.box.accept({visitTrackBox:l=>{I(ue(this,ia,"f").isEmpty(),"Already assigned");let u=ue(this,ea,"f").boxAdapters.adapterFor(l,mt);Zt(this,ia,g.wrap(u),"f"),ue(this,ea,"f").isMainThread&&Zt(this,Ns,g.wrap(ue(this,ea,"f").liveStreamReceiver.subscribeFloat(ue(this,Ur,"f").address,p=>{ue(this,hc,"f")!==p&&(Zt(this,hc,p,"f"),ue(this,Fs,"f").notify(this))})),"f")}})},onRemoved:s=>{ue(this,ra,"f").proxy.onControlSourceRemove(Gx(s.pointerType)),s.box.accept({visitTrackBox:l=>{I(ue(this,ia,"f").unwrapOrNull()?.address?.equals(l.address)===!0,`Unknown ${l}`),Zt(this,ia,g.None,"f"),ue(this,ea,"f").isMainThread&&(ue(this,Ns,"f").ifSome(u=>u.terminate()),Zt(this,Ns,g.None,"f"),Zt(this,hc,null,"f"),ue(this,Fs,"f").notify(this))}})}},...HP)),t.getValue()!==i.clamp(t.getValue())&&console.warn(`${o} (${t.getValue()}) is out of bounds`,"constraints"in t?t.constraints:"no constraints",i,t.address.fieldKeys.join(", "),t.box.name)}registerMidiControl(){return ue(this,ra,"f").proxy.onControlSourceAdd("midi"),Zt(this,tp,!0,"f"),{terminate:()=>{Zt(this,tp,!1,"f"),ue(this,ra,"f").proxy.onControlSourceRemove("midi")}}}get field(){return ue(this,Ur,"f")}get valueMapping(){return ue(this,ta,"f")}get stringMapping(){return ue(this,Es,"f")}get name(){return ue(this,qm,"f")}get anchor(){return ue(this,Hm,"f")}get type(){return ue(this,Ur,"f").type}get address(){return ue(this,Ur,"f").address}get track(){return ue(this,ia,"f")}valueAt(e){let t=ue(this,ia,"f");if(t.nonEmpty()){let i=t.unwrap();if(i.enabled)return this.valueMapping.y(i.valueAt(e,this.getUnitValue()))}return this.getValue()}subscribe(e){return ue(this,Fs,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}catchupAndSubscribeControlSources(e){return ue(this,tp,"f")&&e.onControlSourceAdd("midi"),ue(this,Ur,"f").pointerHub.filter(...HP).forEach(t=>e.onControlSourceAdd(Gx(t.pointerType))),ue(this,ra,"f").subscribe(e)}getValue(){return ue(this,Ur,"f").getValue()}setValue(e){ue(this,Ur,"f").setValue(e)}setUnitValue(e){this.setValue(ue(this,ta,"f").y(e))}getUnitValue(){return ue(this,ta,"f").x(this.getValue())}getControlledValue(){return ue(this,ta,"f").y(this.getControlledUnitValue())}getControlledUnitValue(){return ue(this,hc,"f")??this.getUnitValue()}getControlledPrintValue(){return ue(this,Es,"f").x(this.getControlledValue())}getPrintValue(){return ue(this,Es,"f").x(this.getValue())}setPrintValue(e){let t=ue(this,Es,"f").y(e);t.type==="unitValue"?this.setUnitValue(le(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(ue(this,ta,"f").clamp(ue(this,Ur,"f").initValue))}terminate(){ue(this,Ns,"f").ifSome(e=>e.terminate()),Zt(this,Ns,g.None,"f"),ue(this,Bs,"f").terminate()}};ea=new WeakMap,Ur=new WeakMap,ta=new WeakMap,Es=new WeakMap,qm=new WeakMap,Hm=new WeakMap,Bs=new WeakMap,Fs=new WeakMap,ra=new WeakMap,ia=new WeakMap,Ns=new WeakMap,hc=new WeakMap,tp=new WeakMap;var Gx=r=>{switch(r){case c.Automation:return"automated";case c.Modulation:return"modulated";case c.MidiControl:return"midi";case c.ParameterController:return"external";default:return F(`${r.toString()} is an unknown pointer type`)}};var qx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Wi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fo,ks,Jm,Qm=class{constructor(e,t,i){fo.set(this,void 0),ks.set(this,void 0),Jm.set(this,void 0),qx(this,fo,w.newSet(n=>n.uuid),"f"),qx(this,ks,new Mt,"f"),qx(this,Jm,e.catchupAndSubscribe({onAdded:n=>{let o=t(n.box),a=Wi(this,fo,"f").add(o);I(a,`Could not add ${o}`),Wi(this,ks,"f").proxy.onAdd(o)},onRemoved:n=>{let o=n.box.address.uuid;Wi(this,ks,"f").proxy.onRemove(Wi(this,fo,"f").removeByKey(o))}},i),"f")}subscribe(e){return Wi(this,ks,"f").subscribe(e)}catchupAndSubscribe(e){return Wi(this,fo,"f").forEach(t=>e.onAdd(t)),this.subscribe(e)}adapters(){return Wi(this,fo,"f").values()}size(){return Wi(this,fo,"f").size()}isEmpty(){return this.size()===0}terminate(){Wi(this,fo,"f").clear(),Wi(this,ks,"f").terminate(),Wi(this,Jm,"f").terminate()}};fo=new WeakMap,ks=new WeakMap,Jm=new WeakMap;var Hx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},It=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Jx,Ym,rp,ci,Bn,JP,ui=class{constructor(e,t){Jx.add(this),this.type="audio-effect",this.accepts="audio",rp.set(this,void 0),ci.set(this,void 0),Bn.set(this,void 0),Hx(this,rp,e,"f"),Hx(this,ci,t,"f"),Hx(this,Bn,new pe(It(this,rp,"f")),"f"),this.namedParameter=It(this,Jx,"m",JP).call(this,t)}get box(){return It(this,ci,"f")}get uuid(){return It(this,ci,"f").address.uuid}get address(){return It(this,ci,"f").address}get indexField(){return It(this,ci,"f").index}get labelField(){return It(this,ci,"f").label}get enabledField(){return It(this,ci,"f").enabled}get minimizedField(){return It(this,ci,"f").minimized}get host(){return It(this,ci,"f").host}deviceHost(){return It(this,rp,"f").boxAdapters.adapterFor(It(this,ci,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){It(this,Bn,"f").terminate()}};Ym=ui,rp=new WeakMap,ci=new WeakMap,Bn=new WeakMap,Jx=new WeakSet,JP=function(e){return{delay:It(this,Bn,"f").createParameter(e.delay,S.linearInteger(0,Ym.OffsetFractions.length-1),Ym.OffsetStringMapping,"delay"),feedback:It(this,Bn,"f").createParameter(e.feedback,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"feedback"),cross:It(this,Bn,"f").createParameter(e.cross,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"cross"),filter:It(this,Bn,"f").createParameter(e.filter,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"filter",.5),dry:It(this,Bn,"f").createParameter(e.dry,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"dry"),wet:It(this,Bn,"f").createParameter(e.wet,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"wet")}};ui.OffsetFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();ui.OffsetStringMapping=P.indices("",Ym.OffsetFractions.map(([r,e])=>`${r}/${e}`));var Qx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ct=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Yx,ip,di,Fn,QP,fc=class{constructor(e,t){Yx.add(this),this.type="audio-effect",this.accepts="audio",ip.set(this,void 0),di.set(this,void 0),Fn.set(this,void 0),Qx(this,ip,e,"f"),Qx(this,di,t,"f"),Qx(this,Fn,new pe(Ct(this,ip,"f")),"f"),this.namedParameter=Ct(this,Yx,"m",QP).call(this,t)}get box(){return Ct(this,di,"f")}get uuid(){return Ct(this,di,"f").address.uuid}get address(){return Ct(this,di,"f").address}get indexField(){return Ct(this,di,"f").index}get labelField(){return Ct(this,di,"f").label}get enabledField(){return Ct(this,di,"f").enabled}get minimizedField(){return Ct(this,di,"f").minimized}get host(){return Ct(this,di,"f").host}deviceHost(){return Ct(this,ip,"f").boxAdapters.adapterFor(Ct(this,di,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Ct(this,Fn,"f").terminate()}};ip=new WeakMap,di=new WeakMap,Fn=new WeakMap,Yx=new WeakSet,QP=function(e){return{decay:Ct(this,Fn,"f").createParameter(e.decay,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"Room-Size"),preDelay:Ct(this,Fn,"f").createParameter(e.preDelay,S.exponential(.001,.5),P.numeric({unit:"s",fractionDigits:1,unitPrefix:!0}),"Pre-Delay"),damp:Ct(this,Fn,"f").createParameter(e.damp,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"damping"),filter:Ct(this,Fn,"f").createParameter(e.filter,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"filter"),dry:Ct(this,Fn,"f").createParameter(e.dry,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"dry"),wet:Ct(this,Fn,"f").createParameter(e.wet,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"wet")}};var Xx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},xt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},tw,np,jr,Zi,e1,mc=class{constructor(e,t){tw.add(this),this.type="audio-effect",this.accepts="audio",np.set(this,void 0),jr.set(this,void 0),Zi.set(this,void 0),Xx(this,np,e,"f"),Xx(this,jr,t,"f"),Xx(this,Zi,new pe(xt(this,np,"f")),"f"),this.namedParameter=xt(this,tw,"m",e1).call(this,t)}get box(){return xt(this,jr,"f")}get uuid(){return xt(this,jr,"f").address.uuid}get address(){return xt(this,jr,"f").address}get indexField(){return xt(this,jr,"f").index}get labelField(){return xt(this,jr,"f").label}get enabledField(){return xt(this,jr,"f").enabled}get minimizedField(){return xt(this,jr,"f").minimized}get host(){return xt(this,jr,"f").host}get spectrum(){return xt(this,jr,"f").address.append(4095)}deviceHost(){return xt(this,np,"f").boxAdapters.adapterFor(xt(this,jr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){xt(this,Zi,"f").terminate()}};np=new WeakMap,jr=new WeakMap,Zi=new WeakMap,tw=new WeakSet,e1=function(e){return{highPass:YP(xt(this,Zi,"f"),e.highPass,"High-Pass"),lowShelf:XP(xt(this,Zi,"f"),e.lowShelf,"Low-Shelf"),lowBell:ew(xt(this,Zi,"f"),e.lowBell,"Low-Bell"),midBell:ew(xt(this,Zi,"f"),e.midBell,"Mid-Bell"),highBell:ew(xt(this,Zi,"f"),e.highBell,"High-Bell"),highShelf:XP(xt(this,Zi,"f"),e.highShelf,"High-Shelf"),lowPass:YP(xt(this,Zi,"f"),e.lowPass,"Low-Pass")}};var rw=S.exponential(20,2e4),t1=S.linear(-24,24),r1=S.exponential(.01,10),YP=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),order:r.createParameter(e.order,S.linearInteger(0,3),P.indices("db",["12","24","36","48"]),`${t} Order`),q:r.createParameter(e.q,r1,P.numeric({fractionDigits:3}),`${t} Q`)}),XP=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,t1,P.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5)}),ew=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,t1,P.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5),q:r.createParameter(e.q,r1,P.numeric({fractionDigits:3}),`${t} Q`)});var i1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},wr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Xm,eg,br,na=class{constructor(e,t){this.type="marker-event",Xm.set(this,new U),eg.set(this,void 0),br.set(this,void 0),i1(this,eg,e,"f"),i1(this,br,t,"f"),wr(this,Xm,"f").own(wr(this,br,"f").subscribe(ke.Children,i=>{if(!this.trackAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackAdapter.unwrap();wr(this,br,"f").position.address.equals(i.address)?n.onSortingChanged():n.dispatchChange()}}))}get box(){return wr(this,br,"f")}get uuid(){return wr(this,br,"f").address.uuid}get address(){return wr(this,br,"f").address}get position(){return wr(this,br,"f").position.getValue()}get plays(){return wr(this,br,"f").plays.getValue()}get hue(){return wr(this,br,"f").hue.getValue()}get label(){return wr(this,br,"f").label.getValue()}get trackAdapter(){return wr(this,br,"f").track.targetVertex.map(e=>wr(this,eg,"f").boxAdapters.adapterFor(e.box,Nn).markerTrack)}terminate(){wr(this,Xm,"f").terminate()}toString(){return`{MarkerBoxAdapter ${w.toString(wr(this,br,"f").address.uuid).substring(0,4)}, plays: ${this.plays}`}};Xm=new WeakMap,eg=new WeakMap,br=new WeakMap;na.Comparator=(r,e)=>r.position-e.position;var op=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},pi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ap,gc,sp,$s,tg,rg=class{constructor(e,t){ap.set(this,void 0),gc.set(this,void 0),sp.set(this,void 0),$s.set(this,void 0),tg.set(this,void 0),op(this,ap,e,"f"),op(this,gc,t,"f"),this.changeNotifier=new re,op(this,sp,w.newSet(i=>i.uuid),"f"),op(this,$s,xr.create(na.Comparator),"f"),op(this,tg,pi(this,gc,"f").markers.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{if(i instanceof Al){let n=pi(this,ap,"f").boxAdapters.adapterFor(i,na),o=pi(this,sp,"f").add(n);I(o,"Could not add adapter"),pi(this,$s,"f").add(n),this.dispatchChange()}},onRemoved:({box:{address:{uuid:i}}})=>{pi(this,$s,"f").remove(pi(this,sp,"f").removeByKey(i)),this.dispatchChange()}}),"f")}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return pi(this,ap,"f")}get enabled(){return pi(this,gc,"f").enabled.getValue()}get events(){return pi(this,$s,"f")}get object(){return pi(this,gc,"f")}dispatchChange(){this.changeNotifier.notify()}onSortingChanged(){pi(this,$s,"f").onIndexingChanged(),this.dispatchChange()}terminate(){pi(this,tg,"f").terminate()}};ap=new WeakMap,gc=new WeakMap,sp=new WeakMap,$s=new WeakMap,tg=new WeakMap;var n1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mo=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Gi,ig,Nn=class{constructor(e,t){Gi.set(this,void 0),ig.set(this,void 0),n1(this,Gi,t,"f"),n1(this,ig,new rg(e,mo(this,Gi,"f").markerTrack),"f")}terminate(){}get box(){return mo(this,Gi,"f")}get uuid(){return mo(this,Gi,"f").address.uuid}get address(){return mo(this,Gi,"f").address}get markerTrack(){return mo(this,ig,"f")}get signature(){return[mo(this,Gi,"f").signature.nominator.getValue(),mo(this,Gi,"f").signature.denominator.getValue()]}get signatureDuration(){let{nominator:e,denominator:t}=mo(this,Gi,"f").signature;return Q.fromSignature(e.getValue(),t.getValue())}catchupAndSubscribeSignature(e){return e(this.signature),mo(this,Gi,"f").signature.subscribe(()=>e(this.signature))}};Gi=new WeakMap,ig=new WeakMap;var EB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},lp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},oa,aa=class{constructor(e,t){oa.set(this,void 0),EB(this,oa,t,"f")}get box(){return lp(this,oa,"f")}get uuid(){return lp(this,oa,"f").address.uuid}get address(){return lp(this,oa,"f").address}get source(){return lp(this,oa,"f").source.targetVertex.unwrap("Insufficient Vertex")}get target(){return lp(this,oa,"f").target.targetVertex.unwrap("Insufficient Vertex")}terminate(){}};oa=new WeakMap;var Ms=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},hi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ng,Ds,Is,og,ag,cp,fi=class{constructor(e,t){ng.set(this,void 0),Ds.set(this,void 0),Is.set(this,void 0),og.set(this,void 0),ag.set(this,void 0),cp.set(this,!1),Ms(this,ng,e,"f"),Ms(this,Ds,t,"f"),Ms(this,Is,new U,"f"),Ms(this,og,t.attributes,"f"),Ms(this,ag,hi(this,Is,"f").own(new pe(e)),"f")}get inputs(){throw new Error("Method not implemented.")}get outputs(){throw new Error("Method not implemented.")}own(e){return hi(this,Is,"f").own(e)}ownAll(...e){hi(this,Is,"f").ownAll(...e)}onSelected(){Ms(this,cp,!0,"f")}onDeselected(){Ms(this,cp,!1,"f")}isSelected(){return hi(this,cp,"f")}get box(){return hi(this,Ds,"f")}get attributes(){return hi(this,og,"f")}get uuid(){return hi(this,Ds,"f").address.uuid}get address(){return hi(this,Ds,"f").address}get parameters(){return hi(this,ag,"f")}get modular(){return hi(this,ng,"f").boxAdapters.adapterFor(hi(this,Ds,"f").attributes.collection.targetVertex.unwrap().box,sa)}terminate(){hi(this,Is,"f").terminate()}};ng=new WeakMap,Ds=new WeakMap,Is=new WeakMap,og=new WeakMap,ag=new WeakMap,cp=new WeakMap;var sg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},go=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},lg,la,up,cg,Qt;(function(r){r.Input="input",r.Output="output"})(Qt||(Qt={}));var Yt=class r{static create(e,t,i,n){return new r(e,t,i,n??t.fieldName)}constructor(e,t,i,n){lg.set(this,void 0),la.set(this,void 0),up.set(this,void 0),cg.set(this,void 0),sg(this,lg,e,"f"),sg(this,la,t,"f"),sg(this,up,i,"f"),sg(this,cg,n,"f")}matches(e){return this.direction!==e.direction&&this.field.pointerRules.accepts.some(t=>e.field.pointerRules.accepts.some(i=>i===t))}get connections(){return go(this,la,"f").pointerHub.isEmpty()?R.empty():go(this,la,"f").pointerHub.filter(c.VoltageConnection).map(({box:e})=>go(this,lg,"f").adapterFor(e,aa))}get field(){return go(this,la,"f")}get address(){return go(this,la,"f").address}get direction(){return go(this,up,"f")}get name(){return go(this,cg,"f")}toString(){return`{ModuleConnectorAdapter address: ${go(this,la,"f").address.toString()}, direction: ${go(this,up,"f")}}`}};lg=new WeakMap,la=new WeakMap,up=new WeakMap,cg=new WeakMap;var iw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},dp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ug,pp,hp,vc=class extends fi{constructor(e,t){super(e,t),ug.set(this,void 0),pp.set(this,void 0),hp.set(this,void 0),iw(this,ug,this.parameters.createParameter(t.time,S.exponential(1,1e4),P.numeric({unit:"ms"}),"Time"),"f"),iw(this,pp,Yt.create(e.boxAdapters,t.voltageInput,Qt.Input,"Input"),"f"),iw(this,hp,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Output"),"f")}get parameterTime(){return dp(this,ug,"f")}get voltageInput(){return dp(this,pp,"f")}get voltageOutput(){return dp(this,hp,"f")}get inputs(){return[dp(this,pp,"f")]}get outputs(){return[dp(this,hp,"f")]}};ug=new WeakMap,pp=new WeakMap,hp=new WeakMap;var BB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},o1=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fp,yc=class extends fi{constructor(e,t){super(e,t),fp.set(this,void 0),BB(this,fp,Yt.create(e.boxAdapters,t.input,Qt.Input,"Input"),"f")}get voltageInput(){return o1(this,fp,"f")}get inputs(){return[o1(this,fp,"f")]}get outputs(){return R.empty()}};fp=new WeakMap;var nw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dg,gp,vp,xc=class extends fi{constructor(e,t){super(e,t),dg.set(this,void 0),gp.set(this,void 0),vp.set(this,void 0),nw(this,dg,this.parameters.createParameter(t.gain,S.DefaultDecibel,P.numeric({unit:"db"}),"Gain"),"f"),nw(this,gp,Yt.create(e.boxAdapters,t.voltageInput,Qt.Input,"Input"),"f"),nw(this,vp,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Output"),"f")}get parameterGain(){return mp(this,dg,"f")}get voltageInput(){return mp(this,gp,"f")}get voltageOutput(){return mp(this,vp,"f")}get inputs(){return[mp(this,gp,"f")]}get outputs(){return[mp(this,vp,"f")]}};dg=new WeakMap,gp=new WeakMap,vp=new WeakMap;var ow=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},aw=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pg,hg,fg,wc=class extends fi{constructor(e,t){super(e,t),pg.set(this,void 0),hg.set(this,void 0),fg.set(this,void 0),ow(this,pg,Yt.create(e.boxAdapters,t.voltageInputX,Qt.Input,"X"),"f"),ow(this,hg,Yt.create(e.boxAdapters,t.voltageInputY,Qt.Input,"Y"),"f"),ow(this,fg,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Result"),"f")}get inputs(){return[aw(this,pg,"f"),aw(this,hg,"f")]}get outputs(){return[aw(this,fg,"f")]}};pg=new WeakMap,hg=new WeakMap,fg=new WeakMap;var FB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},a1=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},yp,bc=class extends fi{constructor(e,t){super(e,t),yp.set(this,void 0),FB(this,yp,Yt.create(e.boxAdapters,t.output,Qt.Output,"Output"),"f")}get voltageOutput(){return a1(this,yp,"f")}get inputs(){return R.empty()}get outputs(){return[a1(this,yp,"f")]}};yp=new WeakMap;var Ac;(function(r){r.isVertexOfModule=e=>e.box.accept({visitModuleGainBox:()=>!0,visitModuleDelayBox:()=>!0,visitModuleMultiplierBox:()=>!0,visitModularAudioInputBox:()=>!0,visitModularAudioOutputBox:()=>!0})??!1,r.adapterFor=(e,t)=>ee(t.accept({visitModuleGainBox:i=>e.adapterFor(i,xc),visitModuleDelayBox:i=>e.adapterFor(i,vc),visitModuleMultiplierBox:i=>e.adapterFor(i,wc),visitModularAudioInputBox:i=>e.adapterFor(i,bc),visitModularAudioOutputBox:i=>e.adapterFor(i,yc)}),`Could not find ModuleAdapter for ${t.name}`)})(Ac||(Ac={}));var s1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Cs=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mg,gg,Ts,sw,_c=class{constructor(e,t){mg.add(this),gg.set(this,void 0),Ts.set(this,void 0),s1(this,gg,e,"f"),s1(this,Ts,t,"f")}get box(){return Cs(this,Ts,"f")}get uuid(){return Cs(this,Ts,"f").address.uuid}get address(){return Cs(this,Ts,"f").address}get moduleAdapter(){return Ac.adapterFor(Cs(this,gg,"f").boxAdapters,Cs(this,mg,"a",sw).box)}get parameterAdapter(){return this.moduleAdapter.parameters.parameterAt(Cs(this,mg,"a",sw).address)}terminate(){}};gg=new WeakMap,Ts=new WeakMap,mg=new WeakSet,sw=function(){return Cs(this,Ts,"f").parameter.targetVertex.unwrap("Parameter not assigned")};var l1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ar=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Pc,_r,ca=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",Pc.set(this,void 0),_r.set(this,void 0),l1(this,Pc,e,"f"),l1(this,_r,t,"f")}get box(){return Ar(this,_r,"f")}get uuid(){return Ar(this,_r,"f").address.uuid}get address(){return Ar(this,_r,"f").address}get indexField(){return Ar(this,_r,"f").index}get labelField(){return Ar(this,_r,"f").label}get enabledField(){return Ar(this,_r,"f").enabled}get minimizedField(){return Ar(this,_r,"f").minimized}get host(){return Ar(this,_r,"f").host}parameterAt(e){return F("Not yet implemented")}deviceHost(){return Ar(this,Pc,"f").boxAdapters.adapterFor(Ar(this,_r,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}modular(){return Ar(this,Pc,"f").boxAdapters.adapterFor(Ar(this,_r,"f").modularSetup.targetVertex.unwrap("No Modular found").box,sa)}elements(){return Ar(this,_r,"f").userInterface.elements.pointerHub.filter(c.DeviceUserInterface).map(e=>Ar(this,Pc,"f").boxAdapters.adapterFor(e.box,_c))}terminate(){}};Pc=new WeakMap,_r=new WeakMap;var xp=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ue=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Sc,ua,Ec,Lr,Rs,Os,sa=class{constructor(e,t){Sc.set(this,new U),ua.set(this,void 0),Ec.set(this,void 0),Lr.set(this,void 0),Rs.set(this,void 0),Os.set(this,void 0),xp(this,Ec,e,"f"),xp(this,Lr,t,"f"),xp(this,ua,Ue(this,Sc,"f").own(new Mt),"f"),xp(this,Rs,w.newSet(s=>s.uuid),"f"),xp(this,Os,w.newSet(s=>s.uuid),"f");let i=s=>{let l=Ac.adapterFor(Ue(this,Ec,"f").boxAdapters,s.box);Ue(this,Rs,"f").add(l)&&Ue(this,ua,"f").proxy.onModuleAdded(l)},n=s=>Ue(this,ua,"f").proxy.onModuleRemoved(Ue(this,Rs,"f").removeByKey(s.address.uuid)),o=s=>{let l=Ue(this,Ec,"f").boxAdapters.adapterFor(s.box,aa);Ue(this,Os,"f").add(l)&&Ue(this,ua,"f").proxy.onConnectionAdded(l)},a=s=>Ue(this,ua,"f").proxy.onConnectionRemoved(Ue(this,Os,"f").removeByKey(s.address.uuid));Ue(this,Lr,"f").modules.pointerHub.filter(c.ModuleCollection).forEach(i),Ue(this,Lr,"f").connections.pointerHub.filter(c.ConnectionCollection).forEach(o),Ue(this,Sc,"f").own(Ue(this,Lr,"f").modules.pointerHub.subscribe({onAdded:i,onRemoved:n},c.ModuleCollection)),Ue(this,Sc,"f").own(Ue(this,Lr,"f").connections.pointerHub.subscribe({onAdded:o,onRemoved:a},c.ConnectionCollection))}catchupAndSubscribe(e){return bx(e.onModuleAdded,t=>Ue(this,Rs,"f").forEach(i=>t(i))),bx(e.onConnectionAdded,t=>Ue(this,Os,"f").forEach(i=>t(i))),Ue(this,ua,"f").subscribe(e)}get box(){return Ue(this,Lr,"f")}get address(){return Ue(this,Lr,"f").address}get uuid(){return Ue(this,Lr,"f").address.uuid}get editingField(){return Ue(this,Lr,"f").editing}get labelField(){return Ue(this,Lr,"f").label}get modules(){return Ue(this,Rs,"f").values()}get connections(){return Ue(this,Os,"f").values()}get device(){return Ue(this,Ec,"f").boxAdapters.adapterFor(ee(Ue(this,Lr,"f").device.pointerHub.incoming().at(0),"No device found").box,ca)}terminate(){console.debug(`terminate ${this}`),Ue(this,Sc,"f").terminate()}};Sc=new WeakMap,ua=new WeakMap,Ec=new WeakMap,Lr=new WeakMap,Rs=new WeakMap,Os=new WeakMap;var wp=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},hr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},lw,Fc,bp,vg,Bc,_p,yg,Ap,xg,c1,kn=class{constructor(e,t){lw.add(this),this.type="groove-adapter",bp.set(this,new U),vg.set(this,void 0),Bc.set(this,void 0),_p.set(this,void 0),yg.set(this,new nf({duration:()=>hr(this,xg,"f"),fx:i=>Sx(i,hr(this,Ap,"f")),fy:i=>Sx(i,1-hr(this,Ap,"f"))})),Ap.set(this,0),xg.set(this,Q.SemiQuaver*2),wp(this,vg,e,"f"),wp(this,Bc,t,"f"),wp(this,_p,hr(this,bp,"f").own(new pe(hr(this,vg,"f"))),"f"),this.namedParameter=hr(this,lw,"m",c1).call(this,t),hr(this,bp,"f").ownAll(this.namedParameter.duration.catchupAndSubscribe(i=>wp(this,xg,i.getValue(),"f")),this.namedParameter.amount.catchupAndSubscribe(i=>wp(this,Ap,yP(i.getValue(),.01),"f")))}unwarp(e){return hr(this,yg,"f").unwarp(e)}warp(e){return hr(this,yg,"f").warp(e)}get box(){return hr(this,Bc,"f")}get uuid(){return hr(this,Bc,"f").address.uuid}get address(){return hr(this,Bc,"f").address}terminate(){hr(this,bp,"f").terminate()}};Fc=kn,bp=new WeakMap,vg=new WeakMap,Bc=new WeakMap,_p=new WeakMap,yg=new WeakMap,Ap=new WeakMap,xg=new WeakMap,lw=new WeakSet,c1=function(e){return{duration:hr(this,_p,"f").createParameter(e.duration,S.values(Fc.DurationPPQNs),P.values("",Fc.DurationPPQNs,Fc.DurationStrings),"duration"),amount:hr(this,_p,"f").createParameter(e.amount,S.unipolar(),P.percent({fractionDigits:0}),"amount")}};kn.Durations=[[1,8],[1,4],[1,4],[1,2],[1,1],[2,1],[4,1],[8,1],[16,1]];kn.DurationPPQNs=Fc.Durations.map(([r,e])=>Q.fromSignature(r,e));kn.DurationStrings=Fc.Durations.map(([r,e])=>`${r}/${e}`);var Nc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ht=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},$n,da,kc,wg,bg,Pp,Sp,cw,pa=class{constructor(e,t,i,n,o){$n.set(this,void 0),da.set(this,void 0),kc.set(this,void 0),wg.set(this,void 0),bg.set(this,void 0),Pp.set(this,new U),Sp.set(this,void 0),cw.set(this,g.None),Nc(this,$n,e,"f"),Nc(this,da,t,"f"),Nc(this,kc,i,"f"),Nc(this,wg,n,"f"),Nc(this,bg,o??0,"f"),Nc(this,Sp,ht(this,Pp,"f").own(new re),"f"),ht(this,Pp,"f").own(ht(this,$n,"f").subscribe(()=>ht(this,Sp,"f").notify(this))),e.getValue()!==t.clamp(e.getValue())&&console.warn(`${n} (${e.getValue()}) is out of bounds`,t)}get field(){return ht(this,$n,"f")}get valueMapping(){return ht(this,da,"f")}get stringMapping(){return ht(this,kc,"f")}get name(){return ht(this,wg,"f")}get anchor(){return ht(this,bg,"f")}get type(){return ht(this,$n,"f").type}get address(){return ht(this,$n,"f").address}get track(){return ht(this,cw,"f")}subscribe(e){return ht(this,Sp,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}getValue(){return ht(this,$n,"f").getValue()}setValue(e){ht(this,$n,"f").setValue(ht(this,da,"f").clamp(e))}setUnitValue(e){this.setValue(ht(this,da,"f").y(e))}getUnitValue(){return ht(this,da,"f").x(this.getValue())}getPrintValue(){return ht(this,kc,"f").x(this.getValue())}setPrintValue(e){let t=ht(this,kc,"f").y(e);t.type==="unitValue"?this.setUnitValue(le(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(ht(this,da,"f").clamp(ht(this,$n,"f").initValue))}terminate(){ht(this,Pp,"f").terminate()}};$n=new WeakMap,da=new WeakMap,kc=new WeakMap,wg=new WeakMap,bg=new WeakMap,Pp=new WeakMap,Sp=new WeakMap,cw=new WeakMap;var $c=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mn,Ag,_g,Pg,Sg,Eg,Bg=class{constructor(e){Mn.set(this,void 0),Ag.set(this,void 0),_g.set(this,void 0),Pg.set(this,void 0),Sg.set(this,void 0),Eg.set(this,void 0),$c(this,Mn,e,"f"),$c(this,Ag,new pa(mi(this,Mn,"f").keyboard,S.values([88,76,61,49]),P.numeric({fractionDigits:1}),"Keyboard Type"),"f"),$c(this,_g,new pa(mi(this,Mn,"f").timeRangeInQuarters,S.exponential(1,64),P.numeric({fractionDigits:1}),"Time-Range"),"f"),$c(this,Pg,new pa(mi(this,Mn,"f").noteScale,S.exponential(.5,2),P.numeric({fractionDigits:1}),"Note Scale"),"f"),$c(this,Sg,new pa(mi(this,Mn,"f").noteLabels,S.bool,P.bool,"Note Labels"),"f"),$c(this,Eg,new pa(mi(this,Mn,"f").transpose,S.linearInteger(-48,48),P.numeric({fractionDigits:0}),"Transpose"),"f")}subscribe(e){return mi(this,Mn,"f").box.subscribe(ke.Children,()=>e(this))}get object(){return mi(this,Mn,"f")}get keyboard(){return mi(this,Ag,"f")}get timeRangeInQuarters(){return mi(this,_g,"f")}get noteScale(){return mi(this,Pg,"f")}get noteLabels(){return mi(this,Sg,"f")}get transpose(){return mi(this,Eg,"f")}};Mn=new WeakMap,Ag=new WeakMap,_g=new WeakMap,Pg=new WeakMap,Sg=new WeakMap,Eg=new WeakMap;var Ep=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Tt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Vs,Kr,Mc,Fg,Ng,Dc=class{constructor(e,t){Vs.set(this,void 0),Kr.set(this,void 0),Mc.set(this,void 0),Fg.set(this,void 0),Ng.set(this,void 0),Ep(this,Vs,e,"f"),Ep(this,Kr,t,"f"),Ep(this,Mc,Lt.create(Tt(this,Kr,"f").audioUnits,i=>Tt(this,Vs,"f").boxAdapters.adapterFor(i,li),c.AudioUnits),"f"),Ep(this,Fg,new Qm(Tt(this,Kr,"f").audioBusses.pointerHub,i=>Tt(this,Vs,"f").boxAdapters.adapterFor(i,dr),c.AudioBusses),"f"),Ep(this,Ng,new Bg(Tt(this,Kr,"f").pianoMode),"f")}get uuid(){return Tt(this,Kr,"f").address.uuid}get address(){return Tt(this,Kr,"f").address}get box(){return Tt(this,Kr,"f")}get audioBusses(){return Tt(this,Fg,"f")}get audioUnits(){return Tt(this,Mc,"f")}get clips(){return Tt(this,Mc,"f").adapters().flatMap(e=>e.tracks.collection.adapters()).flatMap(e=>e.clips.collection.adapters())}get groove(){return Tt(this,Vs,"f").boxAdapters.adapterFor(Tt(this,Kr,"f").groove.targetVertex.unwrap("no groove").box,kn)}get timeline(){return Tt(this,Vs,"f").boxAdapters.adapterFor(Tt(this,Kr,"f").timeline.targetVertex.unwrap("no timeline").box,Nn)}get pianoMode(){return Tt(this,Ng,"f")}get created(){return new Date(Tt(this,Kr,"f").created.getValue())}get midiOutputDevices(){return Tt(this,Kr,"f").outputMidiDevices.pointerHub.incoming().map(({box:e})=>Ne(e,Ri))}terminate(){Tt(this,Mc,"f").terminate()}};Vs=new WeakMap,Kr=new WeakMap,Mc=new WeakMap,Fg=new WeakMap,Ng=new WeakMap;var uw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Xt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dw,Bp,qi,ha,u1,Ic=class{constructor(e,t){dw.add(this),this.type="instrument",this.accepts="audio",Bp.set(this,void 0),qi.set(this,void 0),ha.set(this,void 0),uw(this,Bp,e,"f"),uw(this,qi,t,"f"),uw(this,ha,new pe(Xt(this,Bp,"f")),"f"),this.namedParameter=Xt(this,dw,"m",u1).call(this,t)}get box(){return Xt(this,qi,"f")}get uuid(){return Xt(this,qi,"f").address.uuid}get address(){return Xt(this,qi,"f").address}get labelField(){return Xt(this,qi,"f").label}get iconField(){return Xt(this,qi,"f").icon}get defaultTrackType(){return ie.Audio}get enabledField(){return Xt(this,qi,"f").enabled}get minimizedField(){return Xt(this,qi,"f").minimized}get acceptsMidiEvents(){return!1}deviceHost(){return Xt(this,Bp,"f").boxAdapters.adapterFor(Xt(this,qi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Xt(this,ha,"f").terminate()}};Bp=new WeakMap,qi=new WeakMap,ha=new WeakMap,dw=new WeakSet,u1=function(e){return{flutter:Xt(this,ha,"f").createParameter(e.flutter,S.unipolar(),P.percent(),"flutter"),wow:Xt(this,ha,"f").createParameter(e.wow,S.unipolar(),P.percent(),"wow"),noise:Xt(this,ha,"f").createParameter(e.noise,S.unipolar(),P.percent(),"noise"),saturation:Xt(this,ha,"f").createParameter(e.saturation,S.unipolar(),P.percent(),"saturation")}};var Dn=(()=>{let t=[1,2,3,4],i=["12","24","36","48"],n=[Le.sine,Le.triangle,Le.saw,Le.square],o=["Sine","Triangle","Saw","Square"];return{MIN_CUTOFF:20,MAX_CUTOFF:2e4,CUTOFF_VALUE_MAPPING:S.exponential(20,2e4),CUTOFF_STRING_MAPPING:P.numeric({unit:"Hz"}),FILTER_ORDER_VALUES:t,FILTER_ORDER_STRINGS:i,FILTER_ORDER_VALUE_MAPPING:S.values(t),FILTER_ORDER_STRING_MAPPING:P.values("db",t,i),LFO_WAVEFORM_VALUES:n,LFO_WAVEFORM_STRINGS:o,LFO_WAVEFORM_VALUE_MAPPING:S.values(n),LFO_WAVEFORM_STRING_MAPPING:P.values("",n,o)}})();var pw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},hw,Fp,Hi,Ve,d1,Cc=class{constructor(e,t){hw.add(this),this.type="instrument",this.accepts="midi",Fp.set(this,void 0),Hi.set(this,void 0),Ve.set(this,void 0),pw(this,Fp,e,"f"),pw(this,Hi,t,"f"),pw(this,Ve,new pe(Be(this,Fp,"f")),"f"),this.namedParameter=Be(this,hw,"m",d1).call(this,t)}get box(){return Be(this,Hi,"f")}get uuid(){return Be(this,Hi,"f").address.uuid}get address(){return Be(this,Hi,"f").address}get labelField(){return Be(this,Hi,"f").label}get iconField(){return Be(this,Hi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Be(this,Hi,"f").enabled}get minimizedField(){return Be(this,Hi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Be(this,Fp,"f").boxAdapters.adapterFor(Be(this,Hi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Be(this,Ve,"f").terminate()}};Fp=new WeakMap,Hi=new WeakMap,Ve=new WeakMap,hw=new WeakSet,d1=function(e){let t=[pn.Monophonic,pn.Polyphonic];return{oscillators:e.oscillators.fields().map(i=>({waveform:Be(this,Ve,"f").createParameter(i.waveform,S.linearInteger(0,3),P.indices("",["Sine","Triangle","Sawtooth","Square"]),"Waveform"),volume:Be(this,Ve,"f").createParameter(i.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"Volume"),octave:Be(this,Ve,"f").createParameter(i.octave,S.linearInteger(-3,3),P.numeric({unit:"oct"}),"Octave",.5),tune:Be(this,Ve,"f").createParameter(i.tune,S.linear(-1200,1200),P.numeric({unit:"ct",fractionDigits:0}),"Tune",.5)})),noise:{volume:Be(this,Ve,"f").createParameter(e.noise.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"Volume"),attack:Be(this,Ve,"f").createParameter(e.noise.attack,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Attack"),hold:Be(this,Ve,"f").createParameter(e.noise.hold,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Hold"),release:Be(this,Ve,"f").createParameter(e.noise.release,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Release")},filterOrder:Be(this,Ve,"f").createParameter(e.filterOrder,Dn.FILTER_ORDER_VALUE_MAPPING,Dn.FILTER_ORDER_STRING_MAPPING,"Flt. Order"),cutoff:Be(this,Ve,"f").createParameter(e.cutoff,Dn.CUTOFF_VALUE_MAPPING,Dn.CUTOFF_STRING_MAPPING,"Flt. Cutoff"),resonance:Be(this,Ve,"f").createParameter(e.resonance,S.exponential(.01,10),P.numeric({unit:"q",fractionDigits:3}),"Flt. Q"),attack:Be(this,Ve,"f").createParameter(e.attack,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Attack"),decay:Be(this,Ve,"f").createParameter(e.decay,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Decay"),sustain:Be(this,Ve,"f").createParameter(e.sustain,S.unipolar(),P.percent({fractionDigits:1}),"Sustain"),release:Be(this,Ve,"f").createParameter(e.release,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Release"),filterEnvelope:Be(this,Ve,"f").createParameter(e.filterEnvelope,S.bipolar(),P.percent({fractionDigits:1}),"Flt. Env.",.5),filterKeyboard:Be(this,Ve,"f").createParameter(e.filterKeyboard,S.bipolar(),P.percent({fractionDigits:1}),"Flt. Kbd.",.5),voicingMode:Be(this,Ve,"f").createParameter(e.voicingMode,S.values(t),P.values("",t,["mono","poly"]),"Play Mode",.5),glideTime:Be(this,Ve,"f").createParameter(e.glideTime,S.unipolar(),P.percent({fractionDigits:1}),"Glide time",0),unisonCount:Be(this,Ve,"f").createParameter(e.unisonCount,S.values([1,3,5]),P.values("#",[1,3,5],[1,3,5].map(i=>String(i))),"Unisono",0),unisonDetune:Be(this,Ve,"f").createParameter(e.unisonDetune,S.exponential(1,1200),P.numeric({unit:"ct",fractionDigits:0}),"Detune",0),unisonStereo:Be(this,Ve,"f").createParameter(e.unisonStereo,S.unipolar(),P.percent({fractionDigits:0}),"Stereo",0),lfoWaveform:Be(this,Ve,"f").createParameter(e.lfo.waveform,Dn.LFO_WAVEFORM_VALUE_MAPPING,Dn.LFO_WAVEFORM_STRING_MAPPING,"LFO Shape",0),lfoRate:Be(this,Ve,"f").createParameter(e.lfo.rate,S.exponential(1e-4,30),P.numeric({unit:"Hz",fractionDigits:1,unitPrefix:!0}),"Rate",0),lfoTargetTune:Be(this,Ve,"f").createParameter(e.lfo.targetTune,S.bipolar(),P.percent({fractionDigits:1}),"Vibrato \u29BF",.5),lfoTargetVolume:Be(this,Ve,"f").createParameter(e.lfo.targetVolume,S.bipolar(),P.percent({fractionDigits:1}),"Tremolo \u29BF",.5),lfoTargetCutoff:Be(this,Ve,"f").createParameter(e.lfo.targetCutoff,S.bipolar(),P.percent({fractionDigits:1}),"Cutoff \u29BF",.5)}};var fw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Rt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mw,kg,Np,gi,In,p1,Ji=class{constructor(e,t){mw.add(this),this.type="midi-effect",this.accepts="midi",Np.set(this,void 0),gi.set(this,void 0),In.set(this,void 0),fw(this,Np,e,"f"),fw(this,gi,t,"f"),fw(this,In,new pe(Rt(this,Np,"f")),"f"),this.namedParameter=Rt(this,mw,"m",p1).call(this,t)}get box(){return Rt(this,gi,"f")}get uuid(){return Rt(this,gi,"f").address.uuid}get address(){return Rt(this,gi,"f").address}get indexField(){return Rt(this,gi,"f").index}get labelField(){return Rt(this,gi,"f").label}get enabledField(){return Rt(this,gi,"f").enabled}get minimizedField(){return Rt(this,gi,"f").minimized}get host(){return Rt(this,gi,"f").host}deviceHost(){return Rt(this,Np,"f").boxAdapters.adapterFor(Rt(this,gi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Rt(this,In,"f").terminate()}};kg=Ji,Np=new WeakMap,gi=new WeakMap,In=new WeakMap,mw=new WeakSet,p1=function(e){return{modeIndex:Rt(this,In,"f").createParameter(e.modeIndex,S.linearInteger(0,2),P.indices("",["Up","Down","UpDown"]),"mode"),numOctaves:Rt(this,In,"f").createParameter(e.numOctaves,S.linearInteger(1,5),P.numeric({unit:"",fractionDigits:0}),"Octaves"),rate:Rt(this,In,"f").createParameter(e.rateIndex,S.linearInteger(0,kg.RateFractions.length-1),kg.RateStringMapping,"Rate"),gate:Rt(this,In,"f").createParameter(e.gate,S.linear(0,2),P.percent({fractionDigits:0}),"Gate"),repeat:Rt(this,In,"f").createParameter(e.repeat,S.linearInteger(1,16),P.numeric({fractionDigits:0}),"Repeat"),velocity:Rt(this,In,"f").createParameter(e.velocity,S.bipolar(),P.percent({fractionDigits:0,bipolar:!1}),"Velocity")}};Ji.RateFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();Ji.RateStringMapping=P.indices("",kg.RateFractions.map(([r,e])=>`${r}/${e}`));var gw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},er=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},vw,kp,vi,zs,h1,Tc=class{constructor(e,t){vw.add(this),this.type="midi-effect",this.accepts="midi",kp.set(this,void 0),vi.set(this,void 0),zs.set(this,void 0),gw(this,kp,e,"f"),gw(this,vi,t,"f"),gw(this,zs,new pe(er(this,kp,"f")),"f"),this.namedParameter=er(this,vw,"m",h1).call(this,t)}get box(){return er(this,vi,"f")}get uuid(){return er(this,vi,"f").address.uuid}get address(){return er(this,vi,"f").address}get indexField(){return er(this,vi,"f").index}get labelField(){return er(this,vi,"f").label}get enabledField(){return er(this,vi,"f").enabled}get minimizedField(){return er(this,vi,"f").minimized}get host(){return er(this,vi,"f").host}deviceHost(){return er(this,kp,"f").boxAdapters.adapterFor(er(this,vi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){er(this,zs,"f").terminate()}};kp=new WeakMap,vi=new WeakMap,zs=new WeakMap,vw=new WeakSet,h1=function(e){return{octaves:er(this,zs,"f").createParameter(e.octaves,S.linearInteger(-7,7),P.numeric({unit:"oct",fractionDigits:0}),"octaves"),semiTones:er(this,zs,"f").createParameter(e.semiTones,S.linearInteger(-36,36),P.numeric({unit:"st",fractionDigits:0}),"semi-tones"),cent:er(this,zs,"f").createParameter(e.cents,S.linear(-50,50),P.numeric({unit:"cents",fractionDigits:1}),"cents")}};var yw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Pr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},xw,$p,Qi,Rc,f1,Oc=class{constructor(e,t){xw.add(this),this.type="instrument",this.accepts="midi",$p.set(this,void 0),Qi.set(this,void 0),Rc.set(this,void 0),yw(this,$p,e,"f"),yw(this,Qi,t,"f"),yw(this,Rc,new pe(Pr(this,$p,"f")),"f"),this.namedParameter=Pr(this,xw,"m",f1).call(this,t)}get box(){return Pr(this,Qi,"f")}get uuid(){return Pr(this,Qi,"f").address.uuid}get address(){return Pr(this,Qi,"f").address}get labelField(){return Pr(this,Qi,"f").label}get iconField(){return Pr(this,Qi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Pr(this,Qi,"f").enabled}get minimizedField(){return Pr(this,Qi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Pr(this,$p,"f").boxAdapters.adapterFor(Pr(this,Qi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Pr(this,Rc,"f").terminate()}};$p=new WeakMap,Qi=new WeakMap,Rc=new WeakMap,xw=new WeakSet,f1=function(e){return{volume:Pr(this,Rc,"f").createParameter(e.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"volume"),release:Pr(this,Rc,"f").createParameter(e.release,S.exponential(.001,8),P.numeric({unit:"s",fractionDigits:3}),"release")}};var Vc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},H=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ww,Us,fa,we,$g,Mg,Wr,zc,m1,Uc=class{constructor(e,t){ww.add(this),this.class="device-host",this.accepts=!1,this.type="instrument",Us.set(this,new U),fa.set(this,void 0),we.set(this,void 0),$g.set(this,void 0),Mg.set(this,void 0),Wr.set(this,void 0),zc.set(this,g.None),Vc(this,fa,e,"f"),Vc(this,we,t,"f"),Vc(this,$g,H(this,Us,"f").own(Lt.create(H(this,we,"f").midiEffects,i=>H(this,fa,"f").boxAdapters.adapterFor(i,ne.isMidiEffect),c.MidiEffectHost)),"f"),Vc(this,Mg,H(this,Us,"f").own(Lt.create(H(this,we,"f").audioEffects,i=>H(this,fa,"f").boxAdapters.adapterFor(i,ne.isAudioEffect),c.AudioEffectHost)),"f"),Vc(this,Wr,H(this,Us,"f").own(new pe(H(this,fa,"f"))),"f"),this.namedParameter=H(this,ww,"m",m1).call(this,t),H(this,Us,"f").own(H(this,we,"f").file.catchupAndSubscribe(i=>{Vc(this,zc,i.targetVertex.map(({box:n})=>H(this,fa,"f").boxAdapters.adapterFor(n,Vi)),"f"),H(this,zc,"f").unwrapOrNull()?.getOrCreateLoader()}))}get box(){return H(this,we,"f")}get uuid(){return H(this,we,"f").address.uuid}get address(){return H(this,we,"f").address}get peakAddress(){return H(this,we,"f").address.append(1001)}get indexField(){return H(this,we,"f").index}get gate(){return H(this,we,"f").gate.getValue()}get exclude(){return H(this,we,"f").exclude.getValue()}get label(){return`${this.device().labelField.getValue()} > ${H(this,zc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get iconField(){return H(this,we,"f").icon}get defaultTrackType(){return ie.Notes}get acceptsMidiEvents(){return!0}get midiEffectsField(){return H(this,we,"f").midiEffects}get inputField(){return this.audioUnitBoxAdapter().box.input}get audioEffectsField(){return H(this,we,"f").audioEffects}get tracksField(){return this.audioUnitBoxAdapter().box.tracks}get isAudioUnit(){return!1}file(){return H(this,zc,"f")}fileUUID(){return H(this,we,"f").file.targetAddress.unwrap().uuid}resetParameters(){H(this,we,"f").mute.reset(),H(this,we,"f").solo.reset(),H(this,we,"f").exclude.reset(),H(this,we,"f").polyphone.reset(),H(this,we,"f").pitch.reset(),H(this,we,"f").attack.reset(),H(this,we,"f").release.reset(),H(this,we,"f").sampleStart.reset(),H(this,we,"f").sampleEnd.reset(),H(this,we,"f").gate.reset()}copyToIndex(e){Vo.create(H(this,we,"f").graph,w.generate(),t=>{t.file.refer(H(this,we,"f").file.targetVertex.unwrap()),t.device.refer(H(this,we,"f").device.targetVertex.unwrap()),t.index.setValue(e),t.mute.setValue(H(this,we,"f").mute.getValue()),t.solo.setValue(H(this,we,"f").solo.getValue()),t.sampleStart.setValue(H(this,we,"f").sampleStart.getValue()),t.sampleEnd.setValue(H(this,we,"f").sampleEnd.getValue()),t.attack.setValue(H(this,we,"f").attack.getValue()),t.release.setValue(H(this,we,"f").release.getValue()),t.pitch.setValue(H(this,we,"f").pitch.getValue()),t.exclude.setValue(H(this,we,"f").exclude.getValue()),t.gate.setValue(H(this,we,"f").gate.getValue())})}get midiEffects(){return H(this,$g,"f")}get inputAdapter(){return g.wrap(this)}get audioEffects(){return H(this,Mg,"f")}get labelField(){return H(this,we,"f").label}get enabledField(){return H(this,we,"f").enabled}get minimizedField(){return H(this,we,"f").minimized}device(){return H(this,fa,"f").boxAdapters.adapterFor(H(this,we,"f").device.targetVertex.unwrap().box,ma)}deviceHost(){return this.device().deviceHost()}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){H(this,Us,"f").terminate()}};Us=new WeakMap,fa=new WeakMap,we=new WeakMap,$g=new WeakMap,Mg=new WeakMap,Wr=new WeakMap,zc=new WeakMap,ww=new WeakSet,m1=function(e){return{gate:H(this,Wr,"f").createParameter(e.gate,S.linearInteger(0,2),P.indices("",["Off","On","Loop"]),"Gate"),mute:H(this,Wr,"f").createParameter(e.mute,S.bool,P.bool,"Mute"),solo:H(this,Wr,"f").createParameter(e.solo,S.bool,P.bool,"Solo"),polyphone:H(this,Wr,"f").createParameter(e.polyphone,S.bool,P.bool,"Polyphone"),exclude:H(this,Wr,"f").createParameter(e.exclude,S.bool,P.bool,"Exclude"),pitch:H(this,Wr,"f").createParameter(e.pitch,S.linear(-1200,1200),P.numeric({unit:"cents",bipolar:!0,fractionDigits:0}),"Pitch",0),sampleStart:H(this,Wr,"f").createParameter(e.sampleStart,S.unipolar(),P.percent(),"Start",0),sampleEnd:H(this,Wr,"f").createParameter(e.sampleEnd,S.unipolar(),P.percent(),"End",1),attack:H(this,Wr,"f").createParameter(e.attack,S.exponential(.001,5),P.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Attack"),release:H(this,Wr,"f").createParameter(e.release,S.exponential(.001,5),P.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Release")}};var Dg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Sr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},jc,Yi,Mp,Ig,ma=class{constructor(e,t){this.type="instrument",this.accepts="midi",jc.set(this,void 0),Yi.set(this,void 0),Mp.set(this,void 0),Ig.set(this,void 0),Dg(this,jc,e,"f"),Dg(this,Yi,t,"f"),Dg(this,Mp,Lt.create(t.samples,i=>e.boxAdapters.adapterFor(i,Uc),c.Sample),"f"),Dg(this,Ig,new pe(Sr(this,jc,"f")),"f")}reset(){Sr(this,Mp,"f").adapters().forEach(e=>e.box.delete())}get box(){return Sr(this,Yi,"f")}get uuid(){return Sr(this,Yi,"f").address.uuid}get address(){return Sr(this,Yi,"f").address}get labelField(){return Sr(this,Yi,"f").label}get iconField(){return Sr(this,Yi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Sr(this,Yi,"f").enabled}get minimizedField(){return Sr(this,Yi,"f").minimized}get acceptsMidiEvents(){return!0}get samples(){return Sr(this,Mp,"f")}get context(){return Sr(this,jc,"f")}deviceHost(){return Sr(this,jc,"f").boxAdapters.adapterFor(Sr(this,Yi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Sr(this,Ig,"f").terminate()}};jc=new WeakMap,Yi=new WeakMap,Mp=new WeakMap,Ig=new WeakMap;var bw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ot=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Aw,Dp,yi,Cn,g1,Lc=class{constructor(e,t){Aw.add(this),this.type="audio-effect",this.accepts="audio",Dp.set(this,void 0),yi.set(this,void 0),Cn.set(this,void 0),bw(this,Dp,e,"f"),bw(this,yi,t,"f"),bw(this,Cn,new pe(Ot(this,Dp,"f")),"f"),this.namedParameter=Ot(this,Aw,"m",g1).call(this,t)}get box(){return Ot(this,yi,"f")}get uuid(){return Ot(this,yi,"f").address.uuid}get address(){return Ot(this,yi,"f").address}get indexField(){return Ot(this,yi,"f").index}get labelField(){return Ot(this,yi,"f").label}get enabledField(){return Ot(this,yi,"f").enabled}get minimizedField(){return Ot(this,yi,"f").minimized}get host(){return Ot(this,yi,"f").host}deviceHost(){return Ot(this,Dp,"f").boxAdapters.adapterFor(Ot(this,yi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Ot(this,Cn,"f").terminate()}};Dp=new WeakMap,yi=new WeakMap,Cn=new WeakMap,Aw=new WeakSet,g1=function(e){return{volume:Ot(this,Cn,"f").createParameter(e.volume,S.decibel(-72,0,12),P.numeric({unit:"db",fractionDigits:1}),"Volume"),panning:Ot(this,Cn,"f").createParameter(e.panning,S.bipolar(),P.panning,"Panning",.5),stereo:Ot(this,Cn,"f").createParameter(e.stereo,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"stereo",.5),invertL:Ot(this,Cn,"f").createParameter(e.invertL,S.bool,P.bool,"Invert Left"),invertR:Ot(this,Cn,"f").createParameter(e.invertR,S.bool,P.bool,"Invert Right"),swap:Ot(this,Cn,"f").createParameter(e.swap,S.bool,P.bool,"Swap")}};var js;(function(r){r.checkType=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="groove-adapter"})(js||(js={}));var v1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Er=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Kc,Br,Wc=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",Kc.set(this,void 0),Br.set(this,void 0),v1(this,Kc,e,"f"),v1(this,Br,t,"f"),this.groove()}get box(){return Er(this,Br,"f")}get uuid(){return Er(this,Br,"f").address.uuid}get address(){return Er(this,Br,"f").address}get indexField(){return Er(this,Br,"f").index}get labelField(){return Er(this,Br,"f").label}get enabledField(){return Er(this,Br,"f").enabled}get minimizedField(){return Er(this,Br,"f").minimized}get host(){return Er(this,Br,"f").host}deviceHost(){return Er(this,Kc,"f").boxAdapters.adapterFor(Er(this,Br,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}groove(){return Er(this,Kc,"f").boxAdapters.adapterFor(Er(this,Br,"f").groove.targetVertex.unwrap("no groove").box,js.checkType)}catchupAndSubscribeGroove(e){return Er(this,Br,"f").groove.catchupAndSubscribe(t=>e(Er(this,Kc,"f").boxAdapters.adapterFor(t.targetVertex.unwrap("No groove found").box,js.checkType)))}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Kc=new WeakMap,Br=new WeakMap;var y1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Xi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Cg,Zr,Zc=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",Cg.set(this,void 0),Zr.set(this,void 0),y1(this,Cg,e,"f"),y1(this,Zr,t,"f")}get box(){return Xi(this,Zr,"f")}get uuid(){return Xi(this,Zr,"f").address.uuid}get address(){return Xi(this,Zr,"f").address}get indexField(){return Xi(this,Zr,"f").index}get labelField(){return Xi(this,Zr,"f").label}get enabledField(){return Xi(this,Zr,"f").enabled}get minimizedField(){return Xi(this,Zr,"f").minimized}get host(){return Xi(this,Zr,"f").host}get commentField(){return Xi(this,Zr,"f").comment}deviceHost(){return Xi(this,Cg,"f").boxAdapters.adapterFor(Xi(this,Zr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Cg=new WeakMap,Zr=new WeakMap;var x1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},en=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Tg,Gr,Gc=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",Tg.set(this,void 0),Gr.set(this,void 0),x1(this,Tg,e,"f"),x1(this,Gr,t,"f")}get box(){return en(this,Gr,"f")}get uuid(){return en(this,Gr,"f").address.uuid}get address(){return en(this,Gr,"f").address}get indexField(){return en(this,Gr,"f").index}get labelField(){return en(this,Gr,"f").label}get enabledField(){return en(this,Gr,"f").enabled}get minimizedField(){return en(this,Gr,"f").minimized}get host(){return en(this,Gr,"f").host}get commentField(){return en(this,Gr,"f").comment}deviceHost(){return en(this,Tg,"f").boxAdapters.adapterFor(en(this,Gr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Tg=new WeakMap,Gr=new WeakMap;var ga=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_w,Pw,Ip,Fr,Rg,qc,tn,xi,Hc,w1,Sw,Jc=class{constructor(e,t){_w.add(this),this.type="instrument",this.accepts="midi",Pw.set(this,new U),Ip.set(this,void 0),Fr.set(this,void 0),Rg.set(this,void 0),qc.set(this,void 0),tn.set(this,void 0),xi.set(this,void 0),Hc.set(this,K.Empty),Sw.set(this,i=>i.match({none:()=>{Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear()},some:n=>n.soundfont.match({none:()=>{Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear(),Fe(this,Hc,"f").terminate(),ga(this,Hc,n.subscribe(o=>{if(o.type==="loaded"){let a=n.soundfont.unwrap();Fe(this,xi,"f").wrap(a.presets[this.presetIndex]??a.presets[0]),Fe(this,tn,"f").wrap(a)}else o.type==="error"?(Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear()):o.type==="idle"&&(Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear())}),"f")},some:o=>{Fe(this,tn,"f").wrap(o),Fe(this,xi,"f").wrap(o.presets[this.presetIndex]??o.presets[0])}})})),ga(this,Ip,e,"f"),ga(this,Fr,t,"f"),ga(this,Rg,new pe(Fe(this,Ip,"f")),"f"),this.namedParameter=Fe(this,_w,"m",w1).call(this,t),ga(this,qc,new Xr,"f"),ga(this,tn,new Xr,"f"),ga(this,xi,new Xr,"f"),Fe(this,Pw,"f").ownAll(Fe(this,qc,"f").subscribe(Fe(this,Sw,"f")),Fe(this,Fr,"f").file.catchupAndSubscribe(({targetVertex:i})=>Fe(this,qc,"f").wrapOption(i.map(({box:n})=>e.soundfontManager.getOrCreate(n.address.uuid)))),Fe(this,Fr,"f").presetIndex.catchupAndSubscribe(i=>Fe(this,tn,"f").match({none:()=>Fe(this,xi,"f").clear(),some:n=>Fe(this,xi,"f").wrap(n.presets[i.getValue()]??n.presets[0])})))}get loader(){return Fe(this,qc,"f")}get soundfont(){return Fe(this,tn,"f")}get preset(){return Fe(this,xi,"f")}get presetIndex(){return Fe(this,Fr,"f").presetIndex.getValue()}get box(){return Fe(this,Fr,"f")}get uuid(){return Fe(this,Fr,"f").address.uuid}get address(){return Fe(this,Fr,"f").address}get labelField(){return Fe(this,Fr,"f").label}get iconField(){return Fe(this,Fr,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Fe(this,Fr,"f").enabled}get minimizedField(){return Fe(this,Fr,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Fe(this,Ip,"f").boxAdapters.adapterFor(Fe(this,Fr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Fe(this,Hc,"f").terminate(),ga(this,Hc,K.Empty,"f"),Fe(this,Rg,"f").terminate()}};Pw=new WeakMap,Ip=new WeakMap,Fr=new WeakMap,Rg=new WeakMap,qc=new WeakMap,tn=new WeakMap,xi=new WeakMap,Hc=new WeakMap,Sw=new WeakMap,_w=new WeakSet,w1=function(e){return{}};var b1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Cp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Og,Ls,Vg=class{constructor(e,t){Og.set(this,void 0),Ls.set(this,void 0),b1(this,Og,e,"f"),b1(this,Ls,t,"f")}get box(){return Cp(this,Ls,"f")}get uuid(){return Cp(this,Ls,"f").address.uuid}get address(){return Cp(this,Ls,"f").address}get soundfont(){return this.getOrCreateLoader().soundfont}getOrCreateLoader(){return Cp(this,Og,"f").soundfontManager.getOrCreate(Cp(this,Ls,"f").address.uuid)}terminate(){}};Og=new WeakMap,Ls=new WeakMap;var Ew=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ot=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Bw,Tp,wi,tr,A1,Qc=class{constructor(e,t){Bw.add(this),this.type="audio-effect",this.accepts="audio",Tp.set(this,void 0),wi.set(this,void 0),tr.set(this,void 0),Ew(this,Tp,e,"f"),Ew(this,wi,t,"f"),Ew(this,tr,new pe(ot(this,Tp,"f")),"f"),this.namedParameter=ot(this,Bw,"m",A1).call(this,t)}get box(){return ot(this,wi,"f")}get uuid(){return ot(this,wi,"f").address.uuid}get address(){return ot(this,wi,"f").address}get indexField(){return ot(this,wi,"f").index}get labelField(){return ot(this,wi,"f").label}get enabledField(){return ot(this,wi,"f").enabled}get minimizedField(){return ot(this,wi,"f").minimized}get host(){return ot(this,wi,"f").host}deviceHost(){return ot(this,Tp,"f").boxAdapters.adapterFor(ot(this,wi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){ot(this,tr,"f").terminate()}};Tp=new WeakMap,wi=new WeakMap,tr=new WeakMap,Bw=new WeakSet,A1=function(e){return{lookahead:ot(this,tr,"f").createParameter(e.lookahead,S.bool,P.bool,"Lookahead"),automakeup:ot(this,tr,"f").createParameter(e.automakeup,S.bool,P.bool,"Auto Makeup"),autoattack:ot(this,tr,"f").createParameter(e.autoattack,S.bool,P.bool,"Auto Attack"),autorelease:ot(this,tr,"f").createParameter(e.autorelease,S.bool,P.bool,"Auto Release"),inputgain:ot(this,tr,"f").createParameter(e.inputgain,S.linear(-30,30),P.decible,"Input Gain"),threshold:ot(this,tr,"f").createParameter(e.threshold,S.linear(-60,0),P.decible,"Threshold"),ratio:ot(this,tr,"f").createParameter(e.ratio,S.exponential(1,24),P.numeric({fractionDigits:1}),"Ratio"),knee:ot(this,tr,"f").createParameter(e.knee,S.linear(0,24),P.decible,"Knee"),attack:ot(this,tr,"f").createParameter(e.attack,S.linear(0,100),P.numeric({unit:"ms",fractionDigits:1}),"Attack Time"),release:ot(this,tr,"f").createParameter(e.release,S.linear(5,1500),P.numeric({unit:"ms",fractionDigits:1}),"Release Time"),makeup:ot(this,tr,"f").createParameter(e.makeup,S.linear(-40,40),P.decible,"Makeup Gain"),mix:ot(this,tr,"f").createParameter(e.mix,S.unipolar(),P.percent(),"Dry/Wet")}};var Fw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Gt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Nw,Rp,bi,va,_1,Yc=class{constructor(e,t){Nw.add(this),this.type="audio-effect",this.accepts="audio",Rp.set(this,void 0),bi.set(this,void 0),va.set(this,void 0),Fw(this,Rp,e,"f"),Fw(this,bi,t,"f"),Fw(this,va,new pe(Gt(this,Rp,"f")),"f"),this.namedParameter=Gt(this,Nw,"m",_1).call(this,t)}get box(){return Gt(this,bi,"f")}get uuid(){return Gt(this,bi,"f").address.uuid}get address(){return Gt(this,bi,"f").address}get indexField(){return Gt(this,bi,"f").index}get labelField(){return Gt(this,bi,"f").label}get enabledField(){return Gt(this,bi,"f").enabled}get minimizedField(){return Gt(this,bi,"f").minimized}get host(){return Gt(this,bi,"f").host}deviceHost(){return Gt(this,Rp,"f").boxAdapters.adapterFor(Gt(this,bi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Gt(this,va,"f").terminate()}};Rp=new WeakMap,bi=new WeakMap,va=new WeakMap,Nw=new WeakSet,_1=function(e){return{crush:Gt(this,va,"f").createParameter(e.crush,S.unipolar(),P.percent(),"Crush"),bits:Gt(this,va,"f").createParameter(e.bits,S.linearInteger(1,16),P.numeric(),"Bits"),boost:Gt(this,va,"f").createParameter(e.boost,S.linear(0,24),P.decible,"Boost"),mix:Gt(this,va,"f").createParameter(e.mix,S.exponential(.001,1),P.percent(),"Mix")}};var kw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},fr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},$w,Op,Ai,Xc,P1,eu=class{constructor(e,t){$w.add(this),this.type="audio-effect",this.accepts="audio",Op.set(this,void 0),Ai.set(this,void 0),Xc.set(this,void 0),kw(this,Op,e,"f"),kw(this,Ai,t,"f"),kw(this,Xc,new pe(fr(this,Op,"f")),"f"),this.namedParameter=fr(this,$w,"m",P1).call(this,t)}get box(){return fr(this,Ai,"f")}get uuid(){return fr(this,Ai,"f").address.uuid}get address(){return fr(this,Ai,"f").address}get indexField(){return fr(this,Ai,"f").index}get labelField(){return fr(this,Ai,"f").label}get enabledField(){return fr(this,Ai,"f").enabled}get minimizedField(){return fr(this,Ai,"f").minimized}get host(){return fr(this,Ai,"f").host}deviceHost(){return fr(this,Op,"f").boxAdapters.adapterFor(fr(this,Ai,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){fr(this,Xc,"f").terminate()}};Op=new WeakMap,Ai=new WeakMap,Xc=new WeakMap,$w=new WeakSet,P1=function(e){return{drive:fr(this,Xc,"f").createParameter(e.drive,S.linear(0,30),P.decible,"Drive"),volume:fr(this,Xc,"f").createParameter(e.volume,S.linear(-18,0),P.decible,"Volume")}};var zg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Vp,zp,_i,tu,ru,iu=class{constructor(e,t){Vp.set(this,new U),this.type="instrument",this.accepts="midi",zp.set(this,void 0),_i.set(this,void 0),tu.set(this,void 0),ru.set(this,void 0),zg(this,zp,e,"f"),zg(this,_i,t,"f"),zg(this,tu,new Xr,"f"),zg(this,ru,Nt(this,Vp,"f").own(new pe(Nt(this,zp,"f"))),"f"),Nt(this,Vp,"f").ownAll(t.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>Nt(this,ru,"f").createParameter(Ne(i,Oi).value,S.unipolar(),P.percent({fractionDigits:1}),"",0),onRemoved:({box:i})=>Nt(this,ru,"f").removeParameter(Ne(i,Oi).value.address)}),Nt(this,_i,"f").device.catchupAndSubscribe(({targetVertex:i})=>i.match({none:()=>Nt(this,tu,"f").clear(),some:({box:n})=>Nt(this,tu,"f").wrap(Ne(n,Ri))})))}get box(){return Nt(this,_i,"f")}get uuid(){return Nt(this,_i,"f").address.uuid}get address(){return Nt(this,_i,"f").address}get labelField(){return Nt(this,_i,"f").label}get iconField(){return Nt(this,_i,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Nt(this,_i,"f").enabled}get minimizedField(){return Nt(this,_i,"f").minimized}get acceptsMidiEvents(){return!0}get parameters(){return Nt(this,ru,"f")}get midiDevice(){return Nt(this,tu,"f")}deviceHost(){return Nt(this,zp,"f").boxAdapters.adapterFor(Nt(this,_i,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Nt(this,Vp,"f").terminate()}};Vp=new WeakMap,zp=new WeakMap,_i=new WeakMap,tu=new WeakMap,ru=new WeakMap;var Ug=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},wt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mw,Up,Pi,Tn,jp,S1,nu=class{constructor(e,t){Mw.add(this),this.type="midi-effect",this.accepts="midi",Up.set(this,void 0),Pi.set(this,void 0),Tn.set(this,void 0),jp.set(this,void 0),Ug(this,Up,e,"f"),Ug(this,Pi,t,"f"),Ug(this,Tn,new pe(wt(this,Up,"f")),"f"),Ug(this,jp,nl.create(),"f"),this.namedParameter=wt(this,Mw,"m",S1).call(this,t)}computeVelocity(e,t){let{magnetPosition:i,magnetStrength:n,randomSeed:o,randomAmount:a,offset:s,mix:l}=this.namedParameter;wt(this,jp,"f").setSeed(o.valueAt(e)+e);let u=t+(i.valueAt(e)-t)*n.valueAt(e),p=(wt(this,jp,"f").uniform()*2-1)*a.valueAt(e),d=s.valueAt(e),f=l.valueAt(e);return t*(1-f)+Qr(u+p+d)*f}get box(){return wt(this,Pi,"f")}get uuid(){return wt(this,Pi,"f").address.uuid}get address(){return wt(this,Pi,"f").address}get indexField(){return wt(this,Pi,"f").index}get labelField(){return wt(this,Pi,"f").label}get enabledField(){return wt(this,Pi,"f").enabled}get minimizedField(){return wt(this,Pi,"f").minimized}get host(){return wt(this,Pi,"f").host}deviceHost(){return wt(this,Up,"f").boxAdapters.adapterFor(wt(this,Pi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){wt(this,Tn,"f").terminate()}};Up=new WeakMap,Pi=new WeakMap,Tn=new WeakMap,jp=new WeakMap,Mw=new WeakSet,S1=function(e){return{magnetPosition:wt(this,Tn,"f").createParameter(e.magnetPosition,S.unipolar(),P.percent(),"Position"),magnetStrength:wt(this,Tn,"f").createParameter(e.magnetStrength,S.unipolar(),P.percent(),"Strength"),randomSeed:wt(this,Tn,"f").createParameter(e.randomSeed,S.linearInteger(0,65535),P.numeric({unit:"",fractionDigits:0}),"Seed"),randomAmount:wt(this,Tn,"f").createParameter(e.randomAmount,S.unipolar(),P.percent(),"Amount"),offset:wt(this,Tn,"f").createParameter(e.offset,S.bipolar(),P.percent(),"Offset"),mix:wt(this,Tn,"f").createParameter(e.mix,S.unipolar(),P.percent(),"Mix")}};var Dw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Vt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Iw,Cw,Lp,Si,Rn,E1,rn=class{constructor(e,t){Iw.add(this),this.type="audio-effect",this.accepts="audio",Lp.set(this,void 0),Si.set(this,void 0),Rn.set(this,void 0),Dw(this,Lp,e,"f"),Dw(this,Si,t,"f"),Dw(this,Rn,new pe(Vt(this,Lp,"f")),"f"),this.namedParameter=Vt(this,Iw,"m",E1).call(this,t)}get box(){return Vt(this,Si,"f")}get uuid(){return Vt(this,Si,"f").address.uuid}get address(){return Vt(this,Si,"f").address}get indexField(){return Vt(this,Si,"f").index}get labelField(){return Vt(this,Si,"f").label}get enabledField(){return Vt(this,Si,"f").enabled}get minimizedField(){return Vt(this,Si,"f").minimized}get host(){return Vt(this,Si,"f").host}deviceHost(){return Vt(this,Lp,"f").boxAdapters.adapterFor(Vt(this,Si,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Vt(this,Rn,"f").terminate()}};Cw=rn,Lp=new WeakMap,Si=new WeakMap,Rn=new WeakMap,Iw=new WeakSet,E1=function(e){let{RateFractions:t,RateStringMapping:i}=Cw;return{slope:Vt(this,Rn,"f").createParameter(e.slope,S.bipolar(),P.percent({fractionDigits:1}),"Slope",.5),symmetry:Vt(this,Rn,"f").createParameter(e.symmetry,S.unipolar(),P.percent({fractionDigits:1,bipolar:!0}),"Symmetry",.5),rate:Vt(this,Rn,"f").createParameter(e.rate,S.values(t.map((n,o)=>o)),i,"Rate",0),depth:Vt(this,Rn,"f").createParameter(e.depth,S.unipolar(),P.percent({fractionDigits:1}),"Depth",0),offset:Vt(this,Rn,"f").createParameter(e.offset,S.linear(-180,180),P.numeric({unit:"\xB0",fractionDigits:0}),"Offset",.5),channelOffset:Vt(this,Rn,"f").createParameter(e.channelOffset,S.linear(-180,180),P.numeric({unit:"\xB0",fractionDigits:0}),"Ch. Offset",.5)}};rn.RateFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();rn.RateStringMapping=P.indices("",Cw.RateFractions.map(([r,e])=>`${r}/${e}`));var Tw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},at=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rw,Kp,Ei,rr,B1,ou=class{constructor(e,t){Rw.add(this),this.type="audio-effect",this.accepts="audio",Kp.set(this,void 0),Ei.set(this,void 0),rr.set(this,void 0),Tw(this,Kp,e,"f"),Tw(this,Ei,t,"f"),Tw(this,rr,new pe(at(this,Kp,"f")),"f"),this.namedParameter=at(this,Rw,"m",B1).call(this,t)}get box(){return at(this,Ei,"f")}get uuid(){return at(this,Ei,"f").address.uuid}get address(){return at(this,Ei,"f").address}get indexField(){return at(this,Ei,"f").index}get labelField(){return at(this,Ei,"f").label}get enabledField(){return at(this,Ei,"f").enabled}get minimizedField(){return at(this,Ei,"f").minimized}get host(){return at(this,Ei,"f").host}deviceHost(){return at(this,Kp,"f").boxAdapters.adapterFor(at(this,Ei,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){at(this,rr,"f").terminate()}};Kp=new WeakMap,Ei=new WeakMap,rr=new WeakMap,Rw=new WeakSet,B1=function(e){return{preDelay:at(this,rr,"f").createParameter(e.preDelay,S.linear(0,1e3),P.numeric({unit:e.preDelay.unit}),"Pre-Delay"),bandwidth:at(this,rr,"f").createParameter(e.bandwidth,S.unipolar(),P.percent(),"Bandwidth"),inputDiffusion1:at(this,rr,"f").createParameter(e.inputDiffusion1,S.unipolar(),P.percent(),"Tank 1"),inputDiffusion2:at(this,rr,"f").createParameter(e.inputDiffusion2,S.unipolar(),P.percent(),"Tank 2"),decay:at(this,rr,"f").createParameter(e.decay,S.unipolar(),P.percent(),"Decay"),decayDiffusion1:at(this,rr,"f").createParameter(e.decayDiffusion1,S.unipolar(),P.percent(),"Tank 1"),decayDiffusion2:at(this,rr,"f").createParameter(e.decayDiffusion2,S.unipolar(),P.percent(),"Tank 2"),damping:at(this,rr,"f").createParameter(e.damping,S.unipolar(),P.percent(),"Damping"),excursionRate:at(this,rr,"f").createParameter(e.excursionRate,S.unipolar(),P.numeric({unit:e.excursionRate.unit}),"Rate"),excursionDepth:at(this,rr,"f").createParameter(e.excursionDepth,S.unipolar(),P.numeric({unit:e.excursionDepth.unit}),"Depth"),wet:at(this,rr,"f").createParameter(e.wet,S.DefaultDecibel,P.decible,"Wet"),dry:at(this,rr,"f").createParameter(e.dry,S.DefaultDecibel,P.decible,"Dry")}};var jg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},J=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ow,X,vo,Wp,Lg,F1,Kg=class{constructor(e){Ow.add(this),X.set(this,void 0),vo.set(this,void 0),Wp.set(this,void 0),Lg.set(this,void 0),jg(this,X,e,"f"),jg(this,vo,w.newSet(t=>t.uuid),"f"),jg(this,Wp,new Set,"f"),jg(this,Lg,J(this,X,"f").boxGraph.subscribeToAllUpdates({onUpdate:t=>{if(t.type==="delete"){let i=J(this,vo,"f").getOrNull(t.uuid);Z(i)&&(J(this,Wp,"f").add(i.box),J(this,vo,"f").removeByValue(i).terminate())}}}),"f")}terminate(){J(this,vo,"f").values().forEach(e=>e.terminate()),J(this,vo,"f").clear(),J(this,Lg,"f").terminate()}adapterFor(e,t){if(J(this,Wp,"f").has(e))return F(`Cannot resolve adapter for already deleted box: ${e}`);let i=J(this,vo,"f").getOrNull(e.address.uuid);if(i===null){i=J(this,Ow,"m",F1).call(this,e);let n=J(this,vo,"f").add(i);I(n,`Could not add adapter for ${e}`)}return typeof t=="function"?Object.hasOwn(t,"prototype")?i instanceof t?i:F(`${i} is not instance of ${t}`):t(i)?i:F(`${i} did not pass custom type guard`):F("Unknown checkType method")}};X=new WeakMap,vo=new WeakMap,Wp=new WeakMap,Lg=new WeakMap,Ow=new WeakSet,F1=function(e){return ee(e.accept({visitArpeggioDeviceBox:t=>new Ji(J(this,X,"f"),t),visitAudioBusBox:t=>new dr(J(this,X,"f"),t),visitAudioClipBox:t=>new io(J(this,X,"f"),t),visitAudioFileBox:t=>new Vi(J(this,X,"f"),t),visitAudioTimeStretchBox:t=>new yn(J(this,X,"f"),t),visitAudioPitchStretchBox:t=>new vn(J(this,X,"f"),t),visitTransientMarkerBox:t=>new Cl(t),visitWarpMarkerBox:t=>new Zo(J(this,X,"f"),t),visitAudioRegionBox:t=>new Jo(J(this,X,"f"),t),visitAudioUnitBox:t=>new li(J(this,X,"f"),t),visitAuxSendBox:t=>new lc(J(this,X,"f"),t),visitCompressorDeviceBox:t=>new Qc(J(this,X,"f"),t),visitCrusherDeviceBox:t=>new Yc(J(this,X,"f"),t),visitDattorroReverbDeviceBox:t=>new ou(J(this,X,"f"),t),visitDelayDeviceBox:t=>new ui(J(this,X,"f"),t),visitDeviceInterfaceKnobBox:t=>new _c(J(this,X,"f"),t),visitTidalDeviceBox:t=>new rn(J(this,X,"f"),t),visitFoldDeviceBox:t=>new eu(J(this,X,"f"),t),visitGrooveShuffleBox:t=>new kn(J(this,X,"f"),t),visitMarkerBox:t=>new na(J(this,X,"f"),t),visitMIDIOutputDeviceBox:t=>new iu(J(this,X,"f"),t),visitModularAudioInputBox:t=>new bc(J(this,X,"f"),t),visitModularAudioOutputBox:t=>new yc(J(this,X,"f"),t),visitModularBox:t=>new sa(J(this,X,"f"),t),visitModularDeviceBox:t=>new ca(J(this,X,"f"),t),visitModuleConnectionBox:t=>new aa(J(this,X,"f"),t),visitModuleDelayBox:t=>new vc(J(this,X,"f"),t),visitModuleGainBox:t=>new xc(J(this,X,"f"),t),visitModuleMultiplierBox:t=>new wc(J(this,X,"f"),t),visitNanoDeviceBox:t=>new Oc(J(this,X,"f"),t),visitNoteClipBox:t=>new Zl(J(this,X,"f"),t),visitNoteEventBox:t=>new cs(J(this,X,"f"),t),visitNoteEventCollectionBox:t=>new ii(J(this,X,"f"),t),visitNoteRegionBox:t=>new Qo(J(this,X,"f"),t),visitPitchDeviceBox:t=>new Tc(J(this,X,"f"),t),visitPlayfieldDeviceBox:t=>new ma(J(this,X,"f"),t),visitPlayfieldSampleBox:t=>new Uc(J(this,X,"f"),t),visitRevampDeviceBox:t=>new mc(J(this,X,"f"),t),visitReverbDeviceBox:t=>new fc(J(this,X,"f"),t),visitRootBox:t=>new Dc(J(this,X,"f"),t),visitSoundfontDeviceBox:t=>new Jc(J(this,X,"f"),t),visitSoundfontFileBox:t=>new Vg(J(this,X,"f"),t),visitStereoToolDeviceBox:t=>new Lc(J(this,X,"f"),t),visitTapeDeviceBox:t=>new Ic(J(this,X,"f"),t),visitTimelineBox:t=>new Nn(J(this,X,"f"),t),visitTrackBox:t=>new mt(J(this,X,"f"),t),visitUnknownAudioEffectDeviceBox:t=>new Zc(J(this,X,"f"),t),visitUnknownMidiEffectDeviceBox:t=>new Gc(J(this,X,"f"),t),visitValueClipBox:t=>new Wo(J(this,X,"f"),t),visitValueEventBox:t=>new eo(J(this,X,"f"),t),visitValueEventCollectionBox:t=>new cr(J(this,X,"f"),t),visitValueRegionBox:t=>new co(J(this,X,"f"),t),visitVaporisateurDeviceBox:t=>new Cc(J(this,X,"f"),t),visitVelocityDeviceBox:t=>new nu(J(this,X,"f"),t),visitZeitgeistDeviceBox:t=>new Wc(J(this,X,"f"),t)}),`Could not find factory for ${e}`)};var au;(function(r){r.PEAKS=Ae.compose(w.Lowest).append(0),r.SPECTRUM=Ae.compose(w.Lowest).append(1),r.WAVEFORM=Ae.compose(w.Lowest).append(2)})(au||(au={}));var N1;(function(r){r.countStems=e=>e.match({none:()=>1,some:t=>Object.keys(t).length}),r.sanitizeFileName=e=>e.replace(/[<>:"/\\|?*\x00-\x1F]/g,"_").trim(),r.sanitizeExportNamesInPlace=e=>{let t=new Map,i=n=>{let o=t.get(n)??0,a=n;for(;t.has(a);)o++,a=`${n} ${o}`;return t.set(n,o),t.set(a,1),a};Object.keys(e).forEach(n=>{let o=e[n];o.fileName=i(r.sanitizeFileName(o.fileName))})}})(N1||(N1={}));var k1=yr.createBuilder({position:yr.float,playbackTimestamp:yr.float,countInBeatsRemaining:yr.float,isPlaying:yr.bool,isCountingIn:yr.bool,isRecording:yr.bool});var $1;(function(r){r.store=(e,t,i)=>{if(i==="")return F("MetaData.store: origin must be unique to your app.");let n=e.pointerHub.filter(c.MetaData).map(({box:a})=>a).find(a=>a instanceof Qn&&a.origin.getValue()===i),o=a=>{a.target.refer(e),a.origin.setValue(i),a.value.setValue(JSON.stringify(t))};Ca(n)?o(n):Qn.create(e.graph,w.generate(),o)},r.read=(e,t)=>{if(t==="")return F("MetaData.read: origin must be unique to your app.");let i=e.pointerHub.filter(c.MetaData).map(({box:n})=>n).find(n=>n instanceof Qn&&n.origin.getValue()===t);if(Ca(i)){let{status:n,value:o,error:a}=jn(()=>JSON.parse(i.value.getValue()));if(n==="success")return o;console.warn(a)}return null},r.clear=(e,t)=>{if(t==="")return F("MetaData.clear: origin must be unique to your app.");e.pointerHub.filter(c.MetaData).map(({box:i})=>i).filter(i=>i instanceof Qn&&i.origin.getValue()===t).forEach(i=>i.delete())}})($1||($1={}));var Vw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ya=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Wg,Zg,Gg,Ks,Bi=class{constructor(e,t){Wg.set(this,new U),Zg.set(this,void 0),Gg.set(this,void 0),Ks.set(this,void 0),Vw(this,Zg,e,"f"),Vw(this,Gg,t,"f"),Vw(this,Ks,new rt(128),"f"),ya(this,Wg,"f").own(ya(this,Zg,"f").broadcastIntegers(ya(this,Gg,"f"),new Int32Array(ya(this,Ks,"f").buffer),Mi))}noteOn(e){e>=0&&e<128&&ya(this,Ks,"f").setBit(e,!0)}noteOff(e){e>=0&&e<128&&ya(this,Ks,"f").setBit(e,!1)}reset(){}clear(){ya(this,Ks,"f").clear()}terminate(){ya(this,Wg,"f").terminate()}toString(){return`{${this.constructor.name}}`}};Wg=new WeakMap,Zg=new WeakMap,Gg=new WeakMap,Ks=new WeakMap;var st;(function(r){let e;(function(t){t[t.NoteOn=144]="NoteOn",t[t.NoteOff=128]="NoteOff",t[t.PitchBend=224]="PitchBend",t[t.Controller=176]="Controller",t[t.Start=250]="Start",t[t.Continue=251]="Continue",t[t.Stop=252]="Stop",t[t.Clock=248]="Clock",t[t.Position=242]="Position"})(e=r.Command||(r.Command={})),r.readCommand=t=>t[0]&240,r.readChannel=t=>t[0]&15,r.readParam1=t=>t.length>1?t[1]&255:0,r.readParam2=t=>t.length>2?t[2]&255:0,r.readPitch=t=>t[1],r.readVelocity=t=>t[2]/127,r.isNoteOn=t=>r.readCommand(t)===e.NoteOn&&r.readVelocity(t)>0,r.isNoteOff=t=>r.readCommand(t)===e.NoteOff||r.readCommand(t)===e.NoteOn&&r.readVelocity(t)===0,r.isPitchWheel=t=>r.readCommand(t)===e.PitchBend,r.isController=t=>r.readCommand(t)===e.Controller,r.isClock=t=>t[0]===e.Clock,r.isStart=t=>t[0]===e.Start,r.isContinue=t=>t[0]===e.Continue,r.isStop=t=>t[0]===e.Stop,r.isPosition=t=>t[0]===e.Position,r.asPitchBend=t=>{let i=r.readParam1(t)&127,n=r.readParam2(t)&127,o=i|n<<7;return 8192>=o?o/8192-1:(o-8191)/8192},r.asValue=t=>{let i=r.readParam2(t);return i>64?.5+(i-63)/128:i<64?i/128:.5},r.Clock=new Uint8Array([e.Clock]),r.Start=new Uint8Array([e.Start]),r.Continue=new Uint8Array([e.Continue]),r.Stop=new Uint8Array([e.Stop]),r.noteOn=(t,i,n)=>new Uint8Array([e.NoteOn|t,i,n]),r.noteOff=(t,i)=>new Uint8Array([e.NoteOff|t,i,0]),r.control=(t,i,n)=>new Uint8Array([e.Controller|t,i&127,n&127]),r.position=(t,i)=>new Uint8Array([e.Position,t&127,i&127]),r.positionInPPQN=t=>{let i=Math.floor(t/96),n=i&127,o=i>>7&127;return new Uint8Array([e.Position,n,o])},r.accept=(t,i)=>{Ia(t)||(r.isNoteOn(t)?_(i.noteOn,r.readPitch(t),r.readVelocity(t)):r.isNoteOff(t)?_(i.noteOff,r.readPitch(t)):r.isPitchWheel(t)?_(i.pitchBend,r.asPitchBend(t)):r.isController(t)?_(i.controller,r.readParam1(t),r.readParam2(t)/127):r.isClock(t)?_(i.clock):r.isStart(t)?_(i.start):r.isContinue(t)?_(i.continue):r.isStop(t)?_(i.stop):r.isPosition(t)&&_(i.songPos,r.readParam1(t)|r.readParam2(t)<<7))},r.debug=t=>t===null?"null":r.isNoteOn(t)?`NoteOn #${r.readChannel(t)} ${r.readPitch(t)} : ${r.readVelocity(t).toFixed(2)}`:r.isNoteOff(t)?`NoteOff #${r.readChannel(t)} ${r.readPitch(t)}`:r.isPitchWheel(t)?`PitchWheel #${r.readChannel(t)} ${r.asPitchBend(t)}`:r.isController(t)?`Control #${r.readChannel(t)} ${r.asValue(t)}`:r.isClock(t)?"Clock":r.isStart(t)?"Start":r.isContinue(t)?"Continue":r.isStop(t)?"Stop":r.isPosition(t)?`SongPosition ${r.readParam1(t)|r.readParam2(t)<<7}`:"Unknown"})(st||(st={}));var xa;(function(r){r.on=(e,t,i)=>({type:"note-on",uuid:e,pitch:t,velocity:i}),r.off=(e,t)=>({type:"note-off",uuid:e,pitch:t}),r.isOn=e=>e.type==="note-on",r.isOff=e=>e.type==="note-off",r.fromEvent=(e,t)=>{let i=e.data;if(st.isNoteOn(i)){let n=st.readPitch(i),o=st.readVelocity(i);return{type:"note-on",uuid:t,pitch:n,velocity:o}}else if(st.isNoteOff(i)){let n=st.readPitch(i);return{type:"note-off",uuid:t,pitch:n}}return F("Unknown MIDI event")}})(xa||(xa={}));var M1;(function(r){r.start=(e,t,i,n=1)=>{let o=!0;return e(xa.on(t,i,n)),{terminate:()=>{o&&(e(xa.off(t,i)),o=!1)}}}})(M1||(M1={}));var NB,kB,$B,MB,DB;NB=new WeakMap,kB=new WeakMap,$B=new WeakMap,MB=new WeakMap,DB=new WeakMap;var IB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},qg=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ws,Hg=class{constructor(){Ws.set(this,void 0),IB(this,Ws,Ae.newSet(e=>e.field.address),"f")}register(e){return qg(this,Ws,"f").add(e),{terminate:()=>qg(this,Ws,"f").removeByValue(e)}}get(e){return qg(this,Ws,"f").get(e)}opt(e){return qg(this,Ws,"f").opt(e)}};Ws=new WeakMap;var wa={isClipBox:r=>r.accept({visitNoteClipBox:e=>!0,visitAudioClipBox:e=>!0,visitValueClipBox:e=>!0})??!1,isRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1,asRegionBox:r=>r.accept({visitNoteRegionBox:e=>e,visitAudioRegionBox:e=>e,visitValueRegionBox:e=>e})??F("Could not cast to AnyRegionBox"),isLoopableRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1};var Jg;(function(r){r.isTimeSignatureValid=(e,t)=>!Number.isInteger(e)||e<1||e>31?Ln.err("Numerator needs to be a interger between 1 and 31"):!Number.isInteger(t)||t<1||t>32||t&t-1?Ln.err("Denominator must be a power of two between 1 and 32"):Ln.ok([e,t]),r.MIN_BPM=30,r.MAX_BPM=1e3,r.clampBpm=e=>Number.isFinite(e)?le(e,r.MIN_BPM,r.MAX_BPM):120,r.hasOverlappingRegions=e=>e.boxes().some(t=>t.accept({visitTrackBox:i=>{for(let[n,o]of R.iterateAdjacent(i.regions.pointerHub.incoming().map(({box:a})=>wa.asRegionBox(a)).sort(({position:a},{position:s})=>a.getValue()-s.getValue()))){if(n instanceof Co&&n.timeBase.getValue()===sr.Seconds)return!1;if(n.position.getValue()+n.duration.getValue()>o.position.getValue())return!0}return!1}})??!1)})(Jg||(Jg={}));var D1;(function(r){r.parseTimeSignature=e=>{let[t,i]=e.split("/"),n=parseInt(t,10),o=parseInt(i,10);return Jg.isTimeSignatureValid(n,o)}})(D1||(D1={}));var Qg;(function(r){r.reader=({sab:e,numChunks:t,numberOfChannels:i,bufferSize:n},o)=>{let a=!0,s=new Int32Array(e,0,2),l=new Float32Array(e,8),u=new Float32Array(i*n),p=typeof document>"u",d=()=>{if(!a)return;let f=Atomics.load(s,1),v=Atomics.load(s,0);if(f===v){if(p)Atomics.wait(s,0,v);else{setTimeout(d,1);return}v=Atomics.load(s,0)}for(;f!==v;){let m=f*i*n;u.set(l.subarray(m,m+i*n));let y=[];for(let x=0;x<i;x++){let D=x*n,M=D+n;y.push(u.slice(D,M))}if(f=(f+1)%t,Atomics.store(s,1,f),!a)return;o(y)}d()};return d(),{stop:()=>a=!1}},r.writer=({sab:e,numChunks:t,numberOfChannels:i,bufferSize:n})=>{let o=new Int32Array(e,0,2),a=new Float32Array(e,8);return Object.freeze({write:s=>{if(s.length!==i)return;for(let p of s)if(p.length!==n)return F("Each channel buffer must contain 'bufferSize' samples");let l=Atomics.load(o,0),u=l*i*n;s.forEach((p,d)=>a.set(p,u+d*n)),Atomics.store(o,0,(l+1)%t),Atomics.notify(o,0)}})}})(Qg||(Qg={}));var zw={isRegion:r=>wa.isRegionBox(r.box),isLoopableRegion:r=>wa.isLoopableRegionBox(r.box)};var On;(function(r){r[r.Off=0]="Off",r[r.On=1]="On",r[r.Loop=2]="Loop"})(On||(On={}));var CB,TB,RB,OB;CB=new WeakMap,TB=new WeakMap,RB=new WeakMap,OB=new WeakMap;var VB,zB,UB,jB;VB=new WeakMap,zB=new WeakMap,UB=new WeakMap,jB=new WeakMap;var su={[St.Instrument]:0,[St.Aux]:1,[St.Bus]:2,[St.Output]:3};var Yg;(function(r){r.create=({boxGraph:e,mandatoryBoxes:{rootBox:t,primaryAudioBus:i}},n,o,a)=>{let s=a??r.orderAndGetIndex(t,n);return console.debug(`createAudioUnit type: ${n}, insertIndex: ${s}`),it.create(e,w.generate(),l=>{l.collection.refer(t.audioUnits),l.output.refer(i.input),l.index.setValue(s),l.type.setValue(n),o.ifSome(u=>l.capture.refer(u))})},r.orderAndGetIndex=(e,t)=>{let i=fl.collectIndexedBoxes(e.audioUnits,it),n=su[t],o=0;for(;o<i.length&&!(su[i[o].type.getValue()]>n);o++);let a=o;for(;o<i.length;)i[o].index.setValue(++o);return a},r.trackTypeToCapture=(e,t)=>{switch(t){case ie.Audio:return g.wrap(Ro.create(e,w.generate()));case ie.Notes:return g.wrap(Oo.create(e,w.generate()));default:return g.None}}})(Yg||(Yg={}));var I1;(function(r){r.create=(e,t,i,n,o)=>{console.debug(`createAudioBus '${t}', type: ${n}, color: ${o}`);let{boxGraph:a,mandatoryBoxes:{rootBox:s}}=e;I(s.isAttached(),"rootBox not attached");let l=w.generate(),u=Ti.create(a,l,d=>{d.collection.refer(s.audioBusses),d.label.setValue(t),d.icon.setValue(Me.toName(i)),d.color.setValue(o.toString())}),p=Yg.create(e,n,g.None);return lr.create(a,w.generate(),d=>{d.tracks.refer(p.tracks),d.target.refer(p),d.index.setValue(0),d.type.setValue(ie.Undefined)}),u.output.refer(p.input),u}})(I1||(I1={}));var C1;(function(r){r.forAudioType=e=>{switch(e){case St.Output:return ml.blue;case St.Aux:return ml.purple;case St.Bus:return ml.orange;case St.Instrument:return ml.green;default:return ml.dark}},r.forTrackType=e=>{switch(e){case ie.Audio:return 200;case ie.Notes:return 45;case ie.Value:return 156;default:return 0}}})(C1||(C1={}));var T1;(function(r){r.Tape={defaultName:"Tape",defaultIcon:Me.Tape,description:"Plays audio regions & clips",trackType:ie.Audio,create:(i,n,o,a,s)=>kl.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.flutter.setValue(.2),l.wow.setValue(.05),l.noise.setValue(.02),l.saturation.setValue(.5),l.host.refer(n)})},r.Nano={defaultName:"Nano",defaultIcon:Me.NanoWave,description:"Simple sampler",trackType:ie.Notes,create:(i,n,o,a,s)=>{let l;if(Z(s))l=s;else{let u=w.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3"),p=5.34;l=i.findBox(u).unwrapOrElse(()=>Tr.create(i,u,d=>{d.fileName.setValue("Rhode"),d.endInSeconds.setValue(p)}))}return Fl.create(i,w.generate(),u=>{u.label.setValue(o),u.icon.setValue(Me.toName(a)),u.file.refer(l),u.host.refer(n)})}},r.Playfield={defaultName:"Playfield",defaultIcon:Me.Playfield,description:"Drum computer",trackType:ie.Notes,create:(i,n,o,a,s)=>{let l=Nl.create(i,w.generate(),u=>{u.label.setValue(o),u.icon.setValue(Me.toName(a)),u.host.refer(n)});return Z(s)&&s.filter(({note:u,uuid:p,name:d,durationInSeconds:f,exclude:v})=>{let m=e(i,p,d,f);Vo.create(i,w.generate(),y=>{y.device.refer(l.samples),y.file.refer(m),y.index.setValue(u),y.exclude.setValue(v)})}),l}},r.Vaporisateur={defaultName:"Vaporisateur",defaultIcon:Me.Piano,description:"Classic subtractive synthesizer",trackType:ie.Notes,create:(i,n,o,a,s)=>Sl.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.tune.setInitValue(0),l.cutoff.setInitValue(8e3),l.resonance.setInitValue(.1),l.attack.setInitValue(.005),l.decay.setInitValue(.1),l.sustain.setInitValue(.5),l.release.setInitValue(.5),l.voicingMode.setInitValue(pn.Polyphonic),l.lfo.rate.setInitValue(1),l.oscillators.fields()[0].waveform.setInitValue(Le.saw),l.oscillators.fields()[0].volume.setInitValue(-6),l.oscillators.fields()[1].volume.setInitValue(Number.NEGATIVE_INFINITY),l.oscillators.fields()[1].waveform.setInitValue(Le.square),l.host.refer(n),l.version.setValue(2)})},r.MIDIOutput={defaultName:"MIDIOutput",defaultIcon:Me.Midi,description:"MIDI Output",trackType:ie.Notes,create:(i,n,o,a,s)=>El.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.host.refer(n)})},r.Soundfont={defaultName:"Soundfont",defaultIcon:Me.SoundFont,description:"Soundfont Player",trackType:ie.Notes,create:(i,n,o,a,s)=>{s??(s={uuid:"d9f51577-2096-4671-9067-27ca2e12b329",name:"Upright Piano KW"});let l=s.uuid,u=w.parse(l),p=t(i,u,s.name);return Bl.create(i,w.generate(),d=>{d.label.setValue(o),d.icon.setValue(Me.toName(a)),d.host.refer(n),d.file.refer(p)})}},r.Named={Vaporisateur:r.Vaporisateur,Playfield:r.Playfield,Nano:r.Nano,Tape:r.Tape,Soundfont:r.Soundfont,MIDIOutput:r.MIDIOutput};let e=(i,n,o,a)=>i.findBox(n).unwrapOrElse(()=>Tr.create(i,n,s=>{s.fileName.setValue(o),s.endInSeconds.setValue(a)})),t=(i,n,o)=>i.findBox(n).unwrapOrElse(()=>ei.create(i,n,a=>a.fileName.setValue(o)))})(T1||(T1={}));var ba;(function(r){r.empty=i=>{let n=new ja(g.wrap(La.create)),o=new Date().toISOString();console.debug(`New Project created on ${o}`),n.beginTransaction();let a=_l.create(n,w.generate(),f=>{f.label.setValue("Groove Shuffle")}),s=gl.create(n,w.generate(),f=>{f.groove.refer(a),f.created.setValue(o)}),l=Ti.create(n,w.generate(),f=>{f.collection.refer(s.audioBusses),f.label.setValue("Output"),f.icon.setValue(Me.toName(Me.SpeakerHeadphone)),f.color.setValue("hsl(189, 100%, 65%)")}),u=it.create(n,w.generate(),f=>{f.type.setValue(St.Output),f.collection.refer(s.audioUnits),f.output.refer(s.outputDevice),f.index.setValue(0)});i.createOutputCompressor&&Pl.create(n,w.generate(),f=>{f.label.setValue("Compressor"),f.index.setValue(0),f.host.refer(u.audioEffects),f.threshold.setValue(0),f.ratio.setValue(24)});let p=Wa.create(n,w.generate());s.timeline.refer(p.root),l.output.refer(u.input);let d=[];if(i.createDefaultUser){let f=Ka.create(n,w.generate());f.root.refer(s.users),d.push(f)}return n.endTransaction(),{boxGraph:n,mandatoryBoxes:{rootBox:s,primaryAudioBus:l,primaryAudioOutputUnit:u,timelineBox:p,userInterfaceBoxes:d}}},r.encode=i=>{let n=$t.create();n.writeInt(1330660686),n.writeInt(2);let o=i.toArrayBuffer();return n.writeInt(o.byteLength),n.writeBytes(new Int8Array(o)),n.toArrayBuffer()},r.decode=i=>{let n=new lt(i);I(n.readInt()===1330660686,"Corrupt header. Probably not an openDAW project file."),I(n.readInt()===2,"Deprecated Format");let o=n.readInt(),a=new Int8Array(o);n.readBytes(a);let s=new ja(g.wrap(La.create));return s.fromArrayBuffer(a.buffer),{boxGraph:s,mandatoryBoxes:r.findMandatoryBoxes(s)}},r.findMandatoryBoxes=i=>{let n=i.boxes().find(o=>o.accept({visitRootBox:()=>!0}));if(Z(n)){let o=Ne(n.outputDevice.pointerHub.incoming().at(0)?.box,it),a=Ne(o.input.pointerHub.incoming().at(0)?.box,Ti),s=Ne(n.timeline.targetVertex.unwrap("TimelineBox not found").box,Wa),l=n.users.pointerHub.incoming().map(({box:u})=>Ne(u,Ka));return{rootBox:n,primaryAudioBus:a,primaryAudioOutputUnit:o,timelineBox:s,userInterfaceBoxes:l}}return F("Could not find mandatory boxes")}})(ba||(ba={}));var lu;(function(r){let e=({graph:s},{graph:l})=>s===l,t=(s,l)=>s.index.getValue()-l.index.getValue(),i=s=>s.accept({visitTrackBox:l=>!0})===!0;r.extractAudioUnits=(s,{boxGraph:l,mandatoryBoxes:{primaryAudioBus:u,rootBox:p}},d={})=>{I(R.satisfy(s,e),"AudioUnits must share the same BoxGraph"),I(!d.includeAux&&!d.includeBus,"Options are not yet implemented");let f=d?.excludeTimeline===!0?i:Po.alwaysFalse,v=s.flatMap(y=>Array.from(y.graph.dependenciesOf(y,{alwaysFollowMandatory:!0,excludeBox:f}).boxes)).filter(y=>y.name!==hn.ClassName&&y.name!==qa.ClassName),m=n(s,v,p.audioUnits.address.uuid,u.address.uuid);return o(m,l,s,v),a(m,s,p),console.debug("inTransaction",l.inTransaction()),s.map(y=>Ne(p.graph.findBox(m.get(y.address.uuid).target).unwrap("Target Track has not been copied"),it))},r.extractRegions=(s,{boxGraph:l,mandatoryBoxes:{primaryAudioBus:u,rootBox:p}},d=0)=>{I(R.satisfy(s,e),"Region smust be from the same BoxGraph");let f=new Set(s),v=new Set,m=new il;s.forEach(V=>{let Y=Ne(V.regions.targetVertex.unwrap().box,lr);v.add(Y);let te=Ne(Y.tracks.targetVertex.unwrap().box,it);m.add(te,Y)}),console.debug(`Found ${m.keyCount()} audioUnits`),console.debug(`Found ${v.size} tracks`);let y=[...m.keys()],x=V=>Ie(V,lr)&&!v.has(V)||wa.isRegionBox(V)&&!f.has(V),D=y.flatMap(V=>Array.from(V.graph.dependenciesOf(V,{excludeBox:x,alwaysFollowMandatory:!0}).boxes)).filter(V=>V.name!==hn.ClassName&&V.name!==qa.ClassName),M=n(y,D,p.audioUnits.address.uuid,u.address.uuid);o(M,l,y,D),a(M,y,p),m.forEach((V,Y)=>[...Y].sort(t).forEach((te,q)=>{let ge=l.findBox(M.get(te.address.uuid).target).unwrap("Target Track has not been copied");Ne(ge,lr).index.setValue(q)}));let O=s.reduce((V,Y)=>Math.min(V,Y.position.getValue()),Number.MAX_VALUE),T=d-O;s.forEach(V=>{let Y=l.findBox(M.get(V.address.uuid).target).unwrap("Target Track has not been copied"),te=wa.asRegionBox(Y).position;te.setValue(te.getValue()+T)})};let n=(s,l,u,p)=>{let d=w.newSet(({source:f})=>f);return d.addMany([...s.filter(({output:{targetAddress:f}})=>f.nonEmpty()).map(f=>({source:f.output.targetAddress.unwrap().uuid,target:p})),...s.map(f=>({source:f.collection.targetAddress.unwrap("AudioUnitBox was not connected to a RootBox").uuid,target:u})),...s.map(f=>({source:f.address.uuid,target:w.generate()})),...l.map(({address:{uuid:f},name:v})=>({source:f,target:v===Tr.ClassName||v===ei.ClassName?f:w.generate()}))]),d},o=(s,l,u,p)=>{B.decodeWith({map:(d,f)=>f.map(v=>s.opt(v.uuid).match({none:()=>v,some:({target:m})=>v.moveTo(m)}))},()=>{u.forEach(d=>{let f=new lt(d.toArrayBuffer()),v=d.name,m=s.get(d.address.uuid).target;l.createBox(v,m,y=>y.read(f))}),p.forEach(d=>{let f=new lt(d.toArrayBuffer()),v=d.name,m=s.get(d.address.uuid).target;if((d instanceof Tr||d instanceof ei)&&l.findBox(d.address.uuid).nonEmpty()){d.read(f);return}l.createBox(v,m,y=>y.read(f))})})},a=(s,l,u)=>l.toSorted(t).map(p=>Ne(u.graph.findBox(s.get(p.address.uuid).target).unwrap("Target Track has not been copied"),it)).forEach(p=>fl.collectIndexedBoxes(u.audioUnits,it).toSorted((d,f)=>{let v=su[d.type.getValue()],m=su[f.type.getValue()],y=v-m;return y===0?f===p?-1:1:y}).forEach((d,f)=>d.index.setValue(f)))})(lu||(lu={}));var Aa;(function(r){r.MAGIC_HEADER_OPEN=1330664005,r.FORMAT_VERSION=1})(Aa||(Aa={}));var R1;(function(r){r.decode=(e,t)=>{let i=new lt(e.slice(0,8));if(i.readInt()!==Aa.MAGIC_HEADER_OPEN){al.info({headline:"Could Not Import Preset",message:"Invalid preset file"}).then();return}if(i.readInt()!==Aa.FORMAT_VERSION){al.info({headline:"Could Not Import Preset",message:"Invalid preset version"}).then();return}let n=new ja(g.wrap(La.create));try{n.fromArrayBuffer(e.slice(8))}catch(a){al.info({headline:"Could Not Import Preset",message:String(a)}).then();return}let o=n.boxes().filter(a=>Ie(a,it)).filter(a=>a.type.getValue()!==St.Output);lu.extractAudioUnits(o,t,{excludeTimeline:!0}).filter(a=>a.type.getValue()!==St.Output).forEach(a=>{let s=a.input.pointerHub.incoming().at(0)?.box;Z(s)&&a.capture.targetVertex.ifSome(({box:l})=>{l instanceof Oo?lr.create(t.boxGraph,w.generate(),u=>{u.index.setValue(0),u.type.setValue(ie.Notes),u.target.refer(a),u.tracks.refer(a.tracks)}):l instanceof Ro&&lr.create(t.boxGraph,w.generate(),u=>{u.index.setValue(0),u.type.setValue(ie.Audio),u.target.refer(a),u.tracks.refer(a.tracks)})})})},r.replaceAudioUnit=(e,t,i)=>{console.debug("ReplaceAudioUnit with preset...");let n=ba.empty({createDefaultUser:!1,createOutputCompressor:!1}),o=n.boxGraph,a=t.graph;o.beginTransaction(),r.decode(e,n),o.endTransaction();let s=ee(n.mandatoryBoxes.rootBox.audioUnits.pointerHub.incoming().map(({box:y})=>Ne(y,it)).find(y=>y.type.getValue()!==St.Output),"Source has no audioUnitBox"),l=s.capture.targetVertex.mapOr(({box:y})=>y.name,""),u=t.capture.targetVertex.mapOr(({box:y})=>y.name,"");if(l!==u)return Ln.err("Cannot replace incompatible instruments");let p=i?.keepMIDIEffects!==!0,d=i?.keepAudioEffects!==!0;console.debug("replaceMIDIEffects",p),console.debug("replaceAudioEffects",d),ee(t.input.pointerHub.incoming().at(0)?.box,"Target has no input").delete(),p?t.midiEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()):(o.beginTransaction(),s.midiEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()),o.endTransaction()),d?t.audioEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()):(o.beginTransaction(),s.audioEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()),o.endTransaction());let f=y=>y.accept({visitTrackBox:x=>!0,visitCaptureMidiBox:x=>!0,visitCaptureAudioBox:x=>!0})===!0,v=w.newSet(({source:y})=>y),m=Array.from(o.dependenciesOf(s,{excludeBox:f,alwaysFollowMandatory:!1}).boxes);return v.addMany([{source:s.address.uuid,target:t.address.uuid},...m.map(({address:{uuid:y},name:x})=>({source:y,target:x===Tr.ClassName||x===ei.ClassName?y:w.generate()}))]),B.decodeWith({map:(y,x)=>x.map(D=>v.opt(D.uuid).match({none:()=>D,some:({target:M})=>D.moveTo(M)}))},()=>{m.forEach(y=>{let x=new lt(y.toArrayBuffer()),D=y.name,M=v.get(y.address.uuid).target;if((y instanceof Tr||y instanceof ei)&&a.findBox(y.address.uuid).nonEmpty()){y.read(x);return}a.createBox(D,M,O=>O.read(x))})}),Ln.Ok}})(R1||(R1={}));var O1;(function(r){r.encode=e=>{let t=$t.create();t.writeInt(Aa.MAGIC_HEADER_OPEN),t.writeInt(Aa.FORMAT_VERSION);let i=ba.empty({createOutputCompressor:!1,createDefaultUser:!1});return i.boxGraph.beginTransaction(),lu.extractAudioUnits([e],i,{excludeTimeline:!0}),i.boxGraph.endTransaction(),console.debug("SAVING..."),i.boxGraph.debugBoxes(),R.concatArrayBuffers(t.toArrayBuffer(),i.boxGraph.toArrayBuffer())}})(O1||(O1={}));var V1;(function(r){r.existingInstrumentNames=e=>e.audioUnits.pointerHub.incoming().map(({box:t})=>{let i=ee(Ne(t,it).input.pointerHub.incoming().at(0)).box;return"label"in i&&i.label instanceof C?i.label.getValue():"N/A"})})(V1||(V1={}));var kt={};Da(kt,{$brand:()=>Xg,$input:()=>aA,$output:()=>oA,NEVER:()=>Uw,TimePrecision:()=>uA,ZodAny:()=>vE,ZodArray:()=>bE,ZodBase64:()=>N_,ZodBase64URL:()=>k_,ZodBigInt:()=>$h,ZodBigIntFormat:()=>D_,ZodBoolean:()=>kh,ZodCIDRv4:()=>B_,ZodCIDRv6:()=>F_,ZodCUID:()=>w_,ZodCUID2:()=>b_,ZodCatch:()=>zE,ZodCodec:()=>L_,ZodCustom:()=>sy,ZodCustomStringFormat:()=>Fh,ZodDate:()=>ny,ZodDefault:()=>IE,ZodDiscriminatedUnion:()=>AE,ZodE164:()=>$_,ZodEmail:()=>v_,ZodEmoji:()=>y_,ZodEnum:()=>Eh,ZodError:()=>xk,ZodFile:()=>$E,ZodFirstPartyTypeKind:()=>K_,ZodFunction:()=>HE,ZodGUID:()=>Xv,ZodIPv4:()=>S_,ZodIPv6:()=>E_,ZodISODate:()=>Hv,ZodISODateTime:()=>qv,ZodISODuration:()=>Qv,ZodISOTime:()=>Jv,ZodIntersection:()=>_E,ZodIssueCode:()=>D$,ZodJWT:()=>M_,ZodKSUID:()=>P_,ZodLazy:()=>ZE,ZodLiteral:()=>kE,ZodMAC:()=>uE,ZodMap:()=>FE,ZodNaN:()=>jE,ZodNanoID:()=>x_,ZodNever:()=>xE,ZodNonOptional:()=>U_,ZodNull:()=>mE,ZodNullable:()=>DE,ZodNumber:()=>Nh,ZodNumberFormat:()=>_u,ZodObject:()=>ay,ZodOptional:()=>z_,ZodPipe:()=>j_,ZodPrefault:()=>TE,ZodPromise:()=>qE,ZodReadonly:()=>LE,ZodRealError:()=>$r,ZodRecord:()=>R_,ZodSet:()=>NE,ZodString:()=>Bh,ZodStringFormat:()=>Je,ZodSuccess:()=>VE,ZodSymbol:()=>hE,ZodTemplateLiteral:()=>WE,ZodTransform:()=>ME,ZodTuple:()=>SE,ZodType:()=>Pe,ZodULID:()=>A_,ZodURL:()=>iy,ZodUUID:()=>bo,ZodUndefined:()=>fE,ZodUnion:()=>C_,ZodUnknown:()=>yE,ZodVoid:()=>wE,ZodXID:()=>__,_ZodString:()=>g_,_default:()=>CE,_function:()=>P$,any:()=>n$,array:()=>oy,base64:()=>Uk,base64url:()=>jk,bigint:()=>Xk,boolean:()=>pE,catch:()=>UE,check:()=>S$,cidrv4:()=>Vk,cidrv6:()=>zk,clone:()=>mr,codec:()=>b$,coerce:()=>W_,config:()=>bt,core:()=>wo,cuid:()=>$k,cuid2:()=>Mk,custom:()=>E$,date:()=>a$,decode:()=>s_,decodeAsync:()=>c_,describe:()=>B$,discriminatedUnion:()=>d$,e164:()=>Lk,email:()=>bk,emoji:()=>Nk,encode:()=>a_,encodeAsync:()=>l_,endsWith:()=>yh,enum:()=>O_,file:()=>v$,flattenError:()=>eh,float32:()=>Hk,float64:()=>Jk,formatError:()=>th,function:()=>P$,getErrorMap:()=>C$,globalRegistry:()=>gr,gt:()=>xo,gte:()=>kr,guid:()=>Ak,hash:()=>qk,hex:()=>Gk,hostname:()=>Zk,httpUrl:()=>Fk,includes:()=>gh,instanceof:()=>N$,int:()=>m_,int32:()=>Qk,int64:()=>e$,intersection:()=>PE,ipv4:()=>Tk,ipv6:()=>Ok,iso:()=>Yv,json:()=>$$,jwt:()=>Kk,keyof:()=>s$,ksuid:()=>Ck,lazy:()=>GE,length:()=>wu,literal:()=>g$,locales:()=>ch,looseObject:()=>u$,lowercase:()=>fh,lt:()=>yo,lte:()=>ki,mac:()=>Rk,map:()=>h$,maxLength:()=>xu,maxSize:()=>yu,meta:()=>F$,mime:()=>xh,minLength:()=>Na,minSize:()=>Js,multipleOf:()=>Hs,nan:()=>w$,nanoid:()=>kk,nativeEnum:()=>m$,negative:()=>VA,never:()=>I_,nonnegative:()=>UA,nonoptional:()=>OE,nonpositive:()=>zA,normalize:()=>wh,null:()=>gE,nullable:()=>ty,nullish:()=>y$,number:()=>dE,object:()=>l$,optional:()=>ey,overwrite:()=>Vn,parse:()=>r_,parseAsync:()=>i_,partialRecord:()=>p$,pipe:()=>ry,positive:()=>OA,prefault:()=>RE,preprocess:()=>M$,prettifyError:()=>Xw,promise:()=>_$,property:()=>jA,readonly:()=>KE,record:()=>BE,refine:()=>JE,regex:()=>hh,regexes:()=>Ni,registry:()=>Bv,safeDecode:()=>d_,safeDecodeAsync:()=>h_,safeEncode:()=>u_,safeEncodeAsync:()=>p_,safeParse:()=>n_,safeParseAsync:()=>o_,set:()=>f$,setErrorMap:()=>I$,size:()=>ph,slugify:()=>Ph,startsWith:()=>vh,strictObject:()=>c$,string:()=>f_,stringFormat:()=>Wk,stringbool:()=>k$,success:()=>x$,superRefine:()=>QE,symbol:()=>r$,templateLiteral:()=>A$,toJSONSchema:()=>QA,toLowerCase:()=>Ah,toUpperCase:()=>_h,transform:()=>V_,treeifyError:()=>Yw,trim:()=>bh,tuple:()=>EE,uint32:()=>Yk,uint64:()=>t$,ulid:()=>Dk,undefined:()=>i$,union:()=>T_,unknown:()=>Au,uppercase:()=>mh,url:()=>Bk,util:()=>L,uuid:()=>_k,uuidv4:()=>Pk,uuidv6:()=>Sk,uuidv7:()=>Ek,void:()=>o$,xid:()=>Ik});var wo={};Da(wo,{$ZodAny:()=>F0,$ZodArray:()=>D0,$ZodAsyncError:()=>nn,$ZodBase64:()=>y0,$ZodBase64URL:()=>x0,$ZodBigInt:()=>bv,$ZodBigIntFormat:()=>P0,$ZodBoolean:()=>oh,$ZodCIDRv4:()=>m0,$ZodCIDRv6:()=>g0,$ZodCUID:()=>i0,$ZodCUID2:()=>n0,$ZodCatch:()=>J0,$ZodCheck:()=>He,$ZodCheckBigIntFormat:()=>Db,$ZodCheckEndsWith:()=>Wb,$ZodCheckGreaterThan:()=>fv,$ZodCheckIncludes:()=>Lb,$ZodCheckLengthEquals:()=>Vb,$ZodCheckLessThan:()=>hv,$ZodCheckLowerCase:()=>Ub,$ZodCheckMaxLength:()=>Rb,$ZodCheckMaxSize:()=>Ib,$ZodCheckMimeType:()=>Gb,$ZodCheckMinLength:()=>Ob,$ZodCheckMinSize:()=>Cb,$ZodCheckMultipleOf:()=>$b,$ZodCheckNumberFormat:()=>Mb,$ZodCheckOverwrite:()=>qb,$ZodCheckProperty:()=>Zb,$ZodCheckRegex:()=>zb,$ZodCheckSizeEquals:()=>Tb,$ZodCheckStartsWith:()=>Kb,$ZodCheckStringFormat:()=>gu,$ZodCheckUpperCase:()=>jb,$ZodCodec:()=>ah,$ZodCustom:()=>nA,$ZodCustomStringFormat:()=>A0,$ZodDate:()=>M0,$ZodDefault:()=>Z0,$ZodDiscriminatedUnion:()=>C0,$ZodE164:()=>w0,$ZodEmail:()=>Xb,$ZodEmoji:()=>t0,$ZodEncodeError:()=>_a,$ZodEnum:()=>z0,$ZodError:()=>Xp,$ZodFile:()=>j0,$ZodFunction:()=>tA,$ZodGUID:()=>Qb,$ZodIPv4:()=>p0,$ZodIPv6:()=>h0,$ZodISODate:()=>c0,$ZodISODateTime:()=>l0,$ZodISODuration:()=>d0,$ZodISOTime:()=>u0,$ZodIntersection:()=>T0,$ZodJWT:()=>b0,$ZodKSUID:()=>s0,$ZodLazy:()=>iA,$ZodLiteral:()=>U0,$ZodMAC:()=>f0,$ZodMap:()=>O0,$ZodNaN:()=>Q0,$ZodNanoID:()=>r0,$ZodNever:()=>k0,$ZodNonOptional:()=>q0,$ZodNull:()=>B0,$ZodNullable:()=>W0,$ZodNumber:()=>wv,$ZodNumberFormat:()=>_0,$ZodObject:()=>dS,$ZodObjectJIT:()=>I0,$ZodOptional:()=>K0,$ZodPipe:()=>Y0,$ZodPrefault:()=>G0,$ZodPromise:()=>rA,$ZodReadonly:()=>X0,$ZodRealError:()=>Nr,$ZodRecord:()=>R0,$ZodRegistry:()=>vu,$ZodSet:()=>V0,$ZodString:()=>qs,$ZodStringFormat:()=>We,$ZodSuccess:()=>H0,$ZodSymbol:()=>S0,$ZodTemplateLiteral:()=>eA,$ZodTransform:()=>L0,$ZodTuple:()=>_v,$ZodType:()=>he,$ZodULID:()=>o0,$ZodURL:()=>e0,$ZodUUID:()=>Yb,$ZodUndefined:()=>E0,$ZodUnion:()=>Av,$ZodUnknown:()=>N0,$ZodVoid:()=>$0,$ZodXID:()=>a0,$brand:()=>Xg,$constructor:()=>A,$input:()=>aA,$output:()=>oA,Doc:()=>nh,JSONSchema:()=>sE,JSONSchemaGenerator:()=>Sh,NEVER:()=>Uw,TimePrecision:()=>uA,_any:()=>$A,_array:()=>LA,_base64:()=>Kv,_base64url:()=>Wv,_bigint:()=>PA,_boolean:()=>AA,_catch:()=>pk,_check:()=>aE,_cidrv4:()=>jv,_cidrv6:()=>Lv,_coercedBigint:()=>SA,_coercedBoolean:()=>_A,_coercedDate:()=>TA,_coercedNumber:()=>gA,_coercedString:()=>lA,_cuid:()=>Cv,_cuid2:()=>Tv,_custom:()=>WA,_date:()=>CA,_decode:()=>ov,_decodeAsync:()=>sv,_default:()=>ck,_discriminatedUnion:()=>QN,_e164:()=>Zv,_email:()=>Fv,_emoji:()=>Dv,_encode:()=>nv,_encodeAsync:()=>av,_endsWith:()=>yh,_enum:()=>ik,_file:()=>KA,_float32:()=>yA,_float64:()=>xA,_gt:()=>xo,_gte:()=>kr,_guid:()=>uh,_includes:()=>gh,_int:()=>vA,_int32:()=>wA,_int64:()=>EA,_intersection:()=>YN,_ipv4:()=>zv,_ipv6:()=>Uv,_isoDate:()=>pA,_isoDateTime:()=>dA,_isoDuration:()=>fA,_isoTime:()=>hA,_jwt:()=>Gv,_ksuid:()=>Vv,_lazy:()=>gk,_length:()=>wu,_literal:()=>ok,_lowercase:()=>fh,_lt:()=>yo,_lte:()=>ki,_mac:()=>cA,_map:()=>tk,_max:()=>ki,_maxLength:()=>xu,_maxSize:()=>yu,_mime:()=>xh,_min:()=>kr,_minLength:()=>Na,_minSize:()=>Js,_multipleOf:()=>Hs,_nan:()=>RA,_nanoid:()=>Iv,_nativeEnum:()=>nk,_negative:()=>VA,_never:()=>DA,_nonnegative:()=>UA,_nonoptional:()=>uk,_nonpositive:()=>zA,_normalize:()=>wh,_null:()=>kA,_nullable:()=>lk,_number:()=>mA,_optional:()=>sk,_overwrite:()=>Vn,_parse:()=>pu,_parseAsync:()=>hu,_pipe:()=>hk,_positive:()=>OA,_promise:()=>vk,_property:()=>jA,_readonly:()=>fk,_record:()=>ek,_refine:()=>ZA,_regex:()=>hh,_safeDecode:()=>cv,_safeDecodeAsync:()=>dv,_safeEncode:()=>lv,_safeEncodeAsync:()=>uv,_safeParse:()=>fu,_safeParseAsync:()=>mu,_set:()=>rk,_size:()=>ph,_slugify:()=>Ph,_startsWith:()=>vh,_string:()=>sA,_stringFormat:()=>bu,_stringbool:()=>JA,_success:()=>dk,_superRefine:()=>GA,_symbol:()=>FA,_templateLiteral:()=>mk,_toLowerCase:()=>Ah,_toUpperCase:()=>_h,_transform:()=>ak,_trim:()=>bh,_tuple:()=>XN,_uint32:()=>bA,_uint64:()=>BA,_ulid:()=>Rv,_undefined:()=>NA,_union:()=>JN,_unknown:()=>MA,_uppercase:()=>mh,_url:()=>dh,_uuid:()=>Nv,_uuidv4:()=>kv,_uuidv6:()=>$v,_uuidv7:()=>Mv,_void:()=>IA,_xid:()=>Ov,clone:()=>mr,config:()=>bt,decode:()=>gF,decodeAsync:()=>yF,describe:()=>qA,encode:()=>mF,encodeAsync:()=>vF,flattenError:()=>eh,formatError:()=>th,globalConfig:()=>Zp,globalRegistry:()=>gr,isValidBase64:()=>v0,isValidBase64URL:()=>sS,isValidJWT:()=>lS,locales:()=>ch,meta:()=>HA,parse:()=>rv,parseAsync:()=>iv,prettifyError:()=>Xw,regexes:()=>Ni,registry:()=>Bv,safeDecode:()=>wF,safeDecodeAsync:()=>AF,safeEncode:()=>xF,safeEncodeAsync:()=>bF,safeParse:()=>eb,safeParseAsync:()=>tb,toDotPath:()=>K1,toJSONSchema:()=>QA,treeifyError:()=>Yw,util:()=>L,version:()=>Hb});var Uw=Object.freeze({status:"aborted"});function A(r,e,t){function i(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(r))return;s._zod.traits.add(r),e(s,l);let u=a.prototype,p=Object.keys(u);for(let d=0;d<p.length;d++){let f=p[d];f in s||(s[f]=u[f].bind(s))}}let n=t?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:r});function a(s){var l;let u=t?.Parent?new o:this;i(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let p of u._zod.deferred)p();return u}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>t?.Parent&&s instanceof t.Parent?!0:s?._zod?.traits?.has(r)}),Object.defineProperty(a,"name",{value:r}),a}var Xg=Symbol("zod_brand"),nn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_a=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Zp={};function bt(r){return r&&Object.assign(Zp,r),Zp}var L={};Da(L,{BIGINT_FORMAT_RANGES:()=>Qw,Class:()=>Lw,NUMBER_FORMAT_RANGES:()=>Jw,aborted:()=>Fa,allowsEval:()=>Zw,assert:()=>GB,assertEqual:()=>LB,assertIs:()=>WB,assertNever:()=>ZB,assertNotEqual:()=>KB,assignProp:()=>Sa,base64ToUint8Array:()=>U1,base64urlToUint8Array:()=>uF,cached:()=>uu,captureStackTrace:()=>tv,cleanEnum:()=>cF,cleanRegex:()=>Hp,clone:()=>mr,cloneDef:()=>HB,createTransparentProxy:()=>tF,defineLazy:()=>$e,esc:()=>ev,escapeRegex:()=>Fi,extend:()=>nF,finalizeIssue:()=>Hr,floatSafeRemainder:()=>Kw,getElementAtPath:()=>JB,getEnumValues:()=>qp,getLengthableOrigin:()=>Yp,getParsedType:()=>eF,getSizableOrigin:()=>Qp,hexToUint8Array:()=>pF,isObject:()=>Zs,isPlainObject:()=>Ba,issue:()=>du,joinValues:()=>k,jsonStringifyReplacer:()=>cu,merge:()=>aF,mergeDefs:()=>Ea,normalizeParams:()=>j,nullish:()=>Pa,numKeys:()=>XB,objectClone:()=>qB,omit:()=>iF,optionalKeys:()=>Hw,partial:()=>sF,pick:()=>rF,prefixIssues:()=>qr,primitiveTypes:()=>qw,promiseAllObject:()=>QB,propertyKeyTypes:()=>Jp,randomString:()=>YB,required:()=>lF,safeExtend:()=>oF,shallowClone:()=>Gw,slugify:()=>Ww,stringifyPrimitive:()=>z,uint8ArrayToBase64:()=>j1,uint8ArrayToBase64url:()=>dF,uint8ArrayToHex:()=>hF,unwrapMessage:()=>Gp});function LB(r){return r}function KB(r){return r}function WB(r){}function ZB(r){throw new Error}function GB(r){}function qp(r){let e=Object.values(r).filter(i=>typeof i=="number");return Object.entries(r).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function k(r,e="|"){return r.map(t=>z(t)).join(e)}function cu(r,e){return typeof e=="bigint"?e.toString():e}function uu(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function Pa(r){return r==null}function Hp(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}function Kw(r,e){let t=(r.toString().split(".")[1]||"").length,i=e.toString(),n=(i.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(i)){let l=i.match(/\d?e-(\d?)/);l?.[1]&&(n=Number.parseInt(l[1]))}let o=t>n?t:n,a=Number.parseInt(r.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var z1=Symbol("evaluating");function $e(r,e,t){let i;Object.defineProperty(r,e,{get(){if(i!==z1)return i===void 0&&(i=z1,i=t()),i},set(n){Object.defineProperty(r,e,{value:n})},configurable:!0})}function qB(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function Sa(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Ea(...r){let e={};for(let t of r){let i=Object.getOwnPropertyDescriptors(t);Object.assign(e,i)}return Object.defineProperties({},e)}function HB(r){return Ea(r._zod.def)}function JB(r,e){return e?e.reduce((t,i)=>t?.[i],r):r}function QB(r){let e=Object.keys(r),t=e.map(i=>r[i]);return Promise.all(t).then(i=>{let n={};for(let o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function YB(r=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let i=0;i<r;i++)t+=e[Math.floor(Math.random()*e.length)];return t}function ev(r){return JSON.stringify(r)}function Ww(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var tv="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function Zs(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var Zw=uu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function Ba(r){if(Zs(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(Zs(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Gw(r){return Ba(r)?{...r}:Array.isArray(r)?[...r]:r}function XB(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}var eF=r=>{let e=typeof r;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(r)?"array":r===null?"null":r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?"promise":typeof Map<"u"&&r instanceof Map?"map":typeof Set<"u"&&r instanceof Set?"set":typeof Date<"u"&&r instanceof Date?"date":typeof File<"u"&&r instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Jp=new Set(["string","number","symbol"]),qw=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Fi(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mr(r,e,t){let i=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(i._zod.parent=r),i}function j(r){let e=r;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function tF(r){let e;return new Proxy({},{get(t,i,n){return e??(e=r()),Reflect.get(e,i,n)},set(t,i,n,o){return e??(e=r()),Reflect.set(e,i,n,o)},has(t,i){return e??(e=r()),Reflect.has(e,i)},deleteProperty(t,i){return e??(e=r()),Reflect.deleteProperty(e,i)},ownKeys(t){return e??(e=r()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(t,i){return e??(e=r()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(t,i,n){return e??(e=r()),Reflect.defineProperty(e,i,n)}})}function z(r){return typeof r=="bigint"?r.toString()+"n":typeof r=="string"?`"${r}"`:`${r}`}function Hw(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}var Jw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Qw={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function rF(r,e){let t=r._zod.def,i=Ea(r._zod.def,{get shape(){let n={};for(let o in e){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(n[o]=t.shape[o])}return Sa(this,"shape",n),n},checks:[]});return mr(r,i)}function iF(r,e){let t=r._zod.def,i=Ea(r._zod.def,{get shape(){let n={...r._zod.def.shape};for(let o in e){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete n[o]}return Sa(this,"shape",n),n},checks:[]});return mr(r,i)}function nF(r,e){if(!Ba(e))throw new Error("Invalid input to extend: expected a plain object");let t=r._zod.def.checks;if(t&&t.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let n=Ea(r._zod.def,{get shape(){let o={...r._zod.def.shape,...e};return Sa(this,"shape",o),o},checks:[]});return mr(r,n)}function oF(r,e){if(!Ba(e))throw new Error("Invalid input to safeExtend: expected a plain object");let t={...r._zod.def,get shape(){let i={...r._zod.def.shape,...e};return Sa(this,"shape",i),i},checks:r._zod.def.checks};return mr(r,t)}function aF(r,e){let t=Ea(r._zod.def,{get shape(){let i={...r._zod.def.shape,...e._zod.def.shape};return Sa(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:[]});return mr(r,t)}function sF(r,e,t){let i=Ea(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(t)for(let a in t){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=r?new r({type:"optional",innerType:n[a]}):n[a])}else for(let a in n)o[a]=r?new r({type:"optional",innerType:n[a]}):n[a];return Sa(this,"shape",o),o},checks:[]});return mr(e,i)}function lF(r,e,t){let i=Ea(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(t)for(let a in t){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=new r({type:"nonoptional",innerType:n[a]}))}else for(let a in n)o[a]=new r({type:"nonoptional",innerType:n[a]});return Sa(this,"shape",o),o},checks:[]});return mr(e,i)}function Fa(r,e=0){if(r.aborted===!0)return!0;for(let t=e;t<r.issues.length;t++)if(r.issues[t]?.continue!==!0)return!0;return!1}function qr(r,e){return e.map(t=>{var i;return(i=t).path??(i.path=[]),t.path.unshift(r),t})}function Gp(r){return typeof r=="string"?r:r?.message}function Hr(r,e,t){let i={...r,path:r.path??[]};if(!r.message){let n=Gp(r.inst?._zod.def?.error?.(r))??Gp(e?.error?.(r))??Gp(t.customError?.(r))??Gp(t.localeError?.(r))??"Invalid input";i.message=n}return delete i.inst,delete i.continue,e?.reportInput||delete i.input,i}function Qp(r){return r instanceof Set?"set":r instanceof Map?"map":r instanceof File?"file":"unknown"}function Yp(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}function du(...r){let[e,t,i]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:i}:{...e}}function cF(r){return Object.entries(r).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function U1(r){let e=atob(r),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function j1(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function uF(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return U1(e+t)}function dF(r){return j1(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pF(r){let e=r.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let t=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)t[i/2]=Number.parseInt(e.slice(i,i+2),16);return t}function hF(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}var Lw=class{constructor(...e){}};var L1=(r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),r.message=JSON.stringify(e,cu,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},Xp=A("$ZodError",L1),Nr=A("$ZodError",L1,{Parent:Error});function eh(r,e=t=>t.message){let t={},i=[];for(let n of r.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}function th(r,e=t=>t.message){let t={_errors:[]},i=n=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)t._errors.push(e(o));else{let a=t,s=0;for(;s<o.path.length;){let l=o.path[s];s===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(e(o))):a[l]=a[l]||{_errors:[]},a=a[l],s++}}};return i(r),t}function Yw(r,e=t=>t.message){let t={errors:[]},i=(n,o=[])=>{var a,s;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>i({issues:u},l.path));else if(l.code==="invalid_key")i({issues:l.issues},l.path);else if(l.code==="invalid_element")i({issues:l.issues},l.path);else{let u=[...o,...l.path];if(u.length===0){t.errors.push(e(l));continue}let p=t,d=0;for(;d<u.length;){let f=u[d],v=d===u.length-1;typeof f=="string"?(p.properties??(p.properties={}),(a=p.properties)[f]??(a[f]={errors:[]}),p=p.properties[f]):(p.items??(p.items=[]),(s=p.items)[f]??(s[f]={errors:[]}),p=p.items[f]),v&&p.errors.push(e(l)),d++}}};return i(r),t}function K1(r){let e=[],t=r.map(i=>typeof i=="object"?i.key:i);for(let i of t)typeof i=="number"?e.push(`[${i}]`):typeof i=="symbol"?e.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?e.push(`[${JSON.stringify(i)}]`):(e.length&&e.push("."),e.push(i));return e.join("")}function Xw(r){let e=[],t=[...r.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of t)e.push(`\u2716 ${i.message}`),i.path?.length&&e.push(` \u2192 at ${K1(i.path)}`);return e.join(`
3
+ `),this));for(let i of t)i.defer();for(let i of e)i.unstage();this.unstage()}unstage(){this.graph.unstageBox(this)}isValid(){if(this.#i.mandatory&&this.pointerHub.incoming().length===0)return!1;let e=t=>t.every(i=>i.accept({visitPointerField:n=>!n.mandatory||n.nonEmpty(),visitArrayField:n=>e(n.fields()),visitObjectField:n=>e(n.fields()),visitPrimitiveField:n=>!0,visitField:n=>!0})??!0);return e(this.fields())}toString(){return`${this.constructor.name} ${this.address.toString()}`}};PB([rl,kP("design:type",dn),kP("design:paramtypes",[])],N.prototype,"pointerHub",null);var Zu;(function(r){r.clampInt32=(e,t)=>t,r.clampFloat32=(e,t)=>t})(Zu||(Zu={}));var ke;(function(r){r[r.This=0]="This",r[r.Parent=1]="Parent",r[r.Children=2]="Children"})(ke||(ke={}));var mf;(function(r){r.create=()=>new zx})(mf||(mf={}));var zx=class{#e=new Gu(Va.equals);#t=new Gu(Va.startsWith);#r=new Gu(Va.endsWith);#i=[];#n=0;#o=!1;subscribe(e,t,i){let n=new Ux(t,e,this.#n++,i);if(this.#o){let o=new jx(n,e);return this.#i.push(o),o}else return this.subscribeMonitor(n,e)}dispatch(e){this.#o=!0,[...this.#e.filter(e),...this.#t.filter(e),...this.#r.filter(e)].sort(({order:i},{order:n})=>i-n).forEach(i=>i.procedure(e)),this.#o=!1,this.#i.forEach(i=>i.subscribe(this)),this.#i.length=0}subscribeMonitor(e,t){switch(t){case ke.This:return this.#e.subscribe(e);case ke.Parent:return this.#t.subscribe(e);case ke.Children:return this.#r.subscribe(e);default:return Wh(t)}}countStations(){return this.#e.count()+this.#t.count()+this.#r.count()}},Ux=class{address;propagation;order;procedure;constructor(e,t,i,n){this.address=e,this.propagation=t,this.order=i,this.procedure=n}toString(){return`{ Monitor address: ${this.address}, propagation: ${ke[this.propagation]}, order: ${this.order} }`}},Gu=class{filterStrategy;#e=[];#t=!0;constructor(e){this.filterStrategy=e}subscribe(e){return this.#e.push(e),this.#t=this.#e.length<2,{terminate:()=>{let t=this.#e.length;for(;--t>=0;)this.#e[t]===e&&this.#e.splice(t,1)}}}stations(){return this.#t||(this.#e.sort(Va.Comparator),this.#t=!0),this.#e}filter(e){return this.filterStrategy(e.address,this.stations())}count(){return this.#e.length}},jx=class{monitor;propagation;#e=new U;#t=!1;constructor(e,t){this.monitor=e,this.propagation=t}subscribe(e){this.#t||(this.#e.terminate(),this.#e.own(e.subscribeMonitor(this.monitor,this.propagation)))}terminate(){this.#t=!0,this.#e.terminate()}};var ft;(function(r){r.Boolean="boolean",r.Float32="float32",r.Int32="int32",r.String="string",r.Bytes="bytes"})(ft||(ft={}));var Ua={[ft.Boolean]:{type:ft.Boolean,encode:(r,e)=>r.writeBoolean(e),decode:r=>r.readBoolean()},[ft.Float32]:{type:ft.Float32,encode:(r,e)=>r.writeFloat(e),decode:r=>r.readFloat()},[ft.Int32]:{type:ft.Int32,encode:(r,e)=>r.writeInt(e),decode:r=>r.readInt()},[ft.String]:{type:ft.String,encode:(r,e)=>r.writeString(e),decode:r=>r.readString()},[ft.Bytes]:{type:ft.Bytes,encode:(r,e)=>{r.writeInt(e.length),r.writeBytes(e)},decode:r=>{let e=new Int8Array(r.readInt());return r.readBytes(e),e}}},za=class extends W{#e;#t;#r;constructor(e,t,i){super(e),this.#e=t,this.#t=i,this.#r=this.#t}accept(e){return _(e.visitPrimitiveField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(ke.This,this.address,()=>e(this))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}get type(){return this.#e}get initValue(){return this.#t}setInitValue(e){I(this.graph.constructingBox(),"Cannot change initial value at runtime"),this.setValue(this.#t=this.clamp(e))}getValue(){return this.#r}setValue(e){let t=this.#r,i=this.clamp(e);this.equals(i)||(this.#r=i,this.graph.onPrimitiveValueUpdate(this,t,i))}writeValue(e,t){I(!this.deprecated,"PrimitiveField.write: deprecated field"),this.serialization().encode(e,t)}readValue(e){return this.serialization().decode(e)}toJSON(){if(this.deprecated)return;let e=this.getValue();return ArrayBuffer.isView(e)?F("not implemented"):e}fromJSON(e){return F("Type mismatch")}reset(){this.setValue(this.#t)}},$=class r extends za{static create(e,t=!1){return new r(e,t)}constructor(e,t){super(e,ft.Boolean,t)}toggle(){this.setValue(!this.getValue())}serialization(){return Ua[ft.Boolean]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readBoolean())}write(e){I(!this.deprecated,"BooleanField.write: deprecated field"),e.writeBoolean(this.getValue())}fromJSON(e){this.deprecated||(typeof e=="boolean"?this.setValue(e):console.warn("BooleanField Type mismatch",e,this.address.toString()))}},b=class r extends za{static create(e,t,i,n=0){return new r(e,t,i,n)}#e;#t;constructor(e,t,i,n){super(e,ft.Float32,n),this.#e=t,this.#t=i}serialization(){return Ua[ft.Float32]}equals(e){return this.getValue()===e}clamp(e){return Zu.clampFloat32(this.#e,Wn.toFloat32(e))}read(e){this.setValue(e.readFloat())}write(e){I(!this.deprecated,"FLoat32Field.write: deprecated field"),e.writeFloat(this.getValue())}get unit(){return this.#t}get constraints(){return this.#e}fromJSON(e){this.deprecated||(typeof e=="number"?this.setValue(e):console.warn("Float32Field Type mismatch",e,this.address.toString()))}},E=class r extends za{static create(e,t,i,n=0){return new r(e,t,i,n)}#e;#t;constructor(e,t,i,n){super(e,ft.Int32,n),this.#e=t,this.#t=i}serialization(){return Ua[ft.Int32]}equals(e){return this.getValue()===e}clamp(e){return Zu.clampInt32(this.#e,nr.toInt(e))}read(e){this.setValue(e.readInt())}write(e){I(!this.deprecated,"Int32Field.write: deprecated field"),e.writeInt(this.getValue())}get unit(){return this.#t}get constraints(){return this.#e}fromJSON(e){this.deprecated||(typeof e=="number"&&e===Math.floor(e)&&e>=nr.MIN_VALUE&&e<=nr.MAX_VALUE?this.setValue(e):console.warn("Int32Field Type mismatch",e,this.address.toString()))}},C=class r extends za{static create(e,t=""){return new r(e,t)}constructor(e,t){super(e,ft.String,t)}serialization(){return Ua[ft.String]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readString())}write(e){I(!this.deprecated,"StringField.write: deprecated field"),e.writeString(this.getValue())}fromJSON(e){this.deprecated||(typeof e=="string"?this.setValue(e):console.warn("StringField Type mismatch",e,this.address.toString()))}},$P=class r extends za{static create(e,t=this.#e){return new r(e,t)}static#e=Object.freeze(new Int8Array(0));constructor(e,t){super(e,ft.Bytes,t)}serialization(){return Ua[ft.Bytes]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){let t=new Int8Array(e.readInt());e.readBytes(t),this.setValue(t)}write(e){I(!this.deprecated,"ByteArrayField.write: deprecated field");let t=this.getValue();e.writeInt(t.length),e.writeBytes(t)}toJSON(){if(!this.deprecated)return Array.from(this.getValue().values())}fromJSON(e){this.deprecated||(Array.isArray(e)&&e.every(t=>typeof t=="number")?this.setValue(new Int8Array(e)):console.warn("ByteArrayField Type mismatch",e,this.address.toString()))}};var MP;(function(r){r.decode=e=>{let t=e.readInt();return R.create(()=>{switch(e.readString()){case"new":{let n=w.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new qu(n,o,a.buffer)}case"pointer":{let n=Ae.read(e),o=e.readBoolean()?g.wrap(Ae.read(e)):g.None,a=e.readBoolean()?g.wrap(Ae.read(e)):g.None;return new Ju(n,o,a)}case"primitive":{let n=Ae.read(e),o=e.readString(),a=Ua[o],s=a.decode(e),l=a.decode(e);return new Hu(n,a,s,l)}case"delete":{let n=w.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new Qu(n,o,a.buffer)}}},t)}})(MP||(MP={}));var qu=class{type="new";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.createBox(this.#t,this.#e,t=>t.read(new lt(this.#r)))}inverse(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}write(e){e.writeString(this.type),w.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{NewUpdate uuid: ${w.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}toDebugString(e){return this.toString()}},Hu=class{type="primitive";#e;#t;#r;#i;constructor(e,t,i,n){this.#e=e,this.#t=t,this.#r=i,this.#i=n}get address(){return this.#e}get oldValue(){return this.#r}get newValue(){return this.#i}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).setValue(this.#r)}forward(e){this.field(e).setValue(this.#i)}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PrimitiveField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),e.writeString(this.#t.type),this.#t.encode(e,this.#r),this.#t.encode(e,this.#i)}toString(){return`{PrimitiveUpdate oldValue: ${this.#r}, newValue: ${this.#i}`}},Ju=class{type="pointer";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get address(){return this.#e}get oldAddress(){return this.#t}get newAddress(){return this.#r}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).targetAddress=this.#t}forward(e){this.field(e).targetAddress=this.#r}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PointerField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),this.#t.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}}),this.#r.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}toString(){return`{PointerUpdate oldValue: ${this.#t.unwrapOrNull()}, newValue: ${this.#r.unwrapOrNull()}`}},Qu=class{type="delete";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}inverse(e){e.createBox(this.#t,this.#e,t=>t.read(new lt(this.#r)))}write(e){e.writeString(this.type),w.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{DeleteUpdate uuid: ${w.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}};var eT=Symbol("Unreferenceable"),B=class r extends W{static create(e,t,i){return new r(e,t,i)}static encodeWith(e,t){I(this.#e.isEmpty(),"SerializationEncoder already in use"),this.#e=g.wrap(e);let i=jn(t);if(this.#e=g.None,i.status==="failure")throw i.error;return i.value}static decodeWith(e,t){I(this.#t.isEmpty(),"SerializationDecoder already in use"),this.#t=g.wrap(e);let i=jn(t);if(this.#t=g.None,i.status==="failure")throw i.error;return i.value}static#e=g.None;static#t=g.None;#r;#i;#n=g.None;#o=g.None;constructor(e,t,i){super(e),this.#r=t,this.#i=i,i&&this.graph.edges().watchVertex(this)}get pointerHub(){return F(`${this} cannot be pointed to`)}get pointerType(){return this.#r}get mandatory(){return this.#i}accept(e){return _(e.visitPointerField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(ke.This,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}refer(e){this.targetVertex=g.wrap(e)}defer(){this.targetVertex=g.None}get targetVertex(){return this.graph.inTransaction()?this.#o.flatMap(e=>this.graph.findVertex(e)):this.#n}set targetVertex(e){if(e.nonEmpty()){let t=dn.validate(this,e.unwrap());t.nonEmpty()&&F(t.unwrap())}this.targetAddress=e.map(t=>t.address)}get targetAddress(){return this.#o}set targetAddress(e){let t=this.#o;t.isEmpty()&&e.isEmpty()||(e.nonEmpty()&&t.unwrapOrNull()?.equals(e.unwrap()))===!0||(this.#o=e,this.graph.onPointerAddressUpdated(this,t,e))}isEmpty(){return this.targetAddress.isEmpty()}nonEmpty(){return this.targetAddress.nonEmpty()}ifVertex(e){this.targetVertex.nonEmpty()&&e(this.targetVertex.unwrap())}resolvedTo(e){this.#n=e}read(e){let t=e.readBoolean()?g.wrap(Ae.read(e)):g.None;this.targetAddress=r.#t.match({none:()=>t,some:i=>i.map(this,t)})}write(e){I(!this.deprecated,"PointerField.write: deprecated field"),r.#e.match({none:()=>this.#o,some:t=>t.map(this)}).match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}toJSON(){if(!this.deprecated)return r.#e.match({none:()=>this.#o,some:e=>e.map(this)}).match({none:()=>null,some:e=>e.toString()})}fromJSON(e){if(!this.deprecated)if(Ia(e)||typeof e=="string"){let t=g.wrap(Ia(e)?null:Ae.decode(e));this.targetAddress=r.#t.match({none:()=>t,some:i=>i.map(this,t)})}else return F(`Pointer: Type mismatch. value (${typeof e}) must be a string.`)}};var gf=class{#e;#t;#r;#i;constructor(){this.#e=Ae.newSet(e=>e.address),this.#t=Ae.newSet(e=>e.address),this.#r=Ae.newSet(([e])=>e),this.#i=Ae.newSet(([e])=>e.address)}watchVertex(e){if(Ie(e,B)){if(!e.mandatory)return F("watchVertex called but has no edge requirement");this.#e.add(e)}else{if(!e.pointerRules.mandatory)return F("watchVertex called but has no edge requirement");this.#t.add(e)}}unwatchVerticesOf(...e){let t=({box:{address:{uuid:i}}})=>i;for(let{address:{uuid:i}}of e)this.#o(this.#e,i,t),this.#o(this.#t,i,t);for(let i of e){let n=this.outgoingEdgesOf(i);if(n.length>0)return F(`${i} has outgoing edges: ${n.map(([a,s])=>`[${a.toString()}, ${s.toString()}]`)}`);let o=this.incomingEdgesOf(i);if(o.length>0)return F(`${i} has incoming edges from: ${o.map(a=>a.toString())}`)}}connect(e,t){this.#i.add([e,t]),this.#r.opt(t).match({none:()=>this.#r.add([t,[e]]),some:([,i])=>i.push(e)})}disconnect(e){let[,t]=this.#i.removeByKey(e.address),[,i]=this.#r.get(t);R.remove(i,e),i.length===0&&this.#r.removeByKey(t)}isConnected(e,t){return this.#i.opt(e.address).mapOr(([,i])=>i.equals(t),!1)}outgoingEdgesOf(e){return this.#n(this.#i,e.address.uuid,([{box:{address:{uuid:t}}}])=>t)}incomingEdgesOf(e){return e.isBox()?this.#n(this.#r,e.address.uuid,([{uuid:t}])=>t).flatMap(([t,i])=>i):this.#r.opt(e.address).mapOr(([t,i])=>i,R.empty())}validateRequirements(){this.#e.forEach(e=>{if(e.isEmpty())return e.mandatory?F(`Pointer ${e.toString()} requires an edge.`):F(`Illegal state: ${e} has no edge requirements.`)}),this.#t.forEach(e=>{if(e.pointerHub.isEmpty())return e.pointerRules.mandatory?F(`Target ${e.toString()} requires an edge.`):F(`Illegal state: ${e} has no edge requirements.`)})}#n(e,t,i){let n=Ae.boxRange(e,t,i);return Z(n)?e.values().slice(n[0],n[1]):R.empty()}#o(e,t,i){let n=Ae.boxRange(e,t,i);Z(n)&&e.removeRange(n[0],n[1])}};var ja=class{#e;#t;#r;#i;#n;#o;#a;#c;#s;#l;#u=!1;#d=!1;constructor(e=g.None){this.#e=e,this.#t=w.newSet(t=>t.address.uuid),this.#r=[],this.#a=mf.create(),this.#i=new Mt,this.#n=new Mt,this.#o=new Mt,this.#c=new gf,this.#s=Ae.newSet(({pointer:t})=>t.address),this.#l=[]}beginTransaction(){I(!this.#u,"Transaction already in progress"),this.#u=!0,this.#o.proxy.onBeginTransaction()}endTransaction(){for(I(this.#u,"No transaction in progress"),this.#r.length>0&&(this.#r.forEach(({pointerField:e,update:t})=>this.#p(e,t)),this.#r.length=0),this.#s.values().toSorted((e,t)=>e.index-t.index).forEach(({pointer:e,initial:t,final:i})=>{t.equals(i)||(t.ifSome(n=>this.findVertex(n).unwrapOrUndefined()?.pointerHub.onRemoved(e)),i.ifSome(n=>this.findVertex(n).unwrapOrUndefined()?.pointerHub.onAdded(e)))}),this.#s.clear(),this.#u=!1;this.#l.length>0;)this.#l.splice(0).forEach(e=>e()),this.#l.length>0&&console.debug(`${this.#l.length} new observers while notifying`);this.#o.proxy.onEndTransaction()}inTransaction(){return this.#u}constructingBox(){return this.#d}createBox(e,t,i){return this.#e.unwrap("No box-factory installed")(e,this,t,i)}stageBox(e,t){this.#h(),I(!this.#d,"Cannot construct box while other box is constructing"),Z(t)&&(this.#d=!0,t(e),this.#d=!1);let i=this.#t.add(e);I(i,`${e} already staged`);let n=new qu(e.address.uuid,e.name,e.toArrayBuffer());return this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n),e}subscribeTransaction(e){return this.#o.subscribe(e)}subscribeToAllUpdates(e){return this.#i.subscribe(e)}subscribeToAllUpdatesImmediate(e){return this.#n.subscribe(e)}subscribeVertexUpdates(e,t,i){return this.#a.subscribe(e,t,i)}subscribeEndTransaction(e){this.#l.push(e)}unstageBox(e){this.#h();let t=this.#t.removeByKey(e.address.uuid);I(t===e,`${e} could not be found to unstage`),this.#c.unwatchVerticesOf(e);let i=new Qu(e.address.uuid,e.name,e.toArrayBuffer());this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i)}findBox(e){return this.#t.opt(e)}findVertex(e){return this.#t.opt(e.uuid).flatMap(t=>t.searchVertex(e.fieldKeys))}boxes(){return this.#t.values()}edges(){return this.#c}checksum(){let e=new Hh;return this.boxes().forEach(t=>t.write(e)),e.result()}onPrimitiveValueUpdate(e,t,i){if(this.#h(),e.isAttached()&&!this.#d){let n=new Hu(e.address,e.serialization(),t,i);this.#a.dispatch(n),this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n)}}onPointerAddressUpdated(e,t,i){this.#h(),t.nonEmpty()&&this.#c.disconnect(e),i.nonEmpty()&&this.#c.connect(e,i.unwrap());let n=new Ju(e.address,t,i);this.#d?this.#r.push({pointerField:e,update:n}):(this.#p(e,n),this.#n.proxy.onUpdate(n))}#p(e,t){let{oldAddress:i,newAddress:n}=t;e.resolvedTo(n.flatMap(a=>this.findVertex(a))),this.#s.opt(e.address).match({none:()=>this.#s.add({pointer:e,initial:i,final:n,index:this.#s.size()}),some:a=>a.final=n}),this.#a.dispatch(t),this.#i.proxy.onUpdate(t)}dependenciesOf(e,t={}){let i=Z(t.excludeBox)?t.excludeBox:Po.alwaysFalse,n=Z(t.alwaysFollowMandatory)?t.alwaysFollowMandatory:!1,o=new Set,a=new Set,s=l=>{o.has(l)||i(l)||(o.add(l),l.outgoingEdges().filter(([u])=>!a.has(u)).forEach(([u,p])=>{let d=this.findVertex(p).unwrap(`Could not find target of ${u.toString()}`);if(a.add(u),d.pointerRules.mandatory&&(n||d.pointerHub.incoming().every(f=>a.has(f))))return s(d.box)}),l.incomingEdges().forEach(u=>{a.add(u),u.mandatory&&s(u.box)}))};return s(e),o.delete(e),{boxes:o,pointers:Array.from(a).reverse()}}verifyPointers(){this.#c.validateRequirements();let e=0,t=i=>{for(let n of i.fields())n.accept({visitPointerField:o=>{if(o.targetAddress.nonEmpty()){let a=o.targetVertex.nonEmpty(),s=this.findVertex(o.targetAddress.unwrap()).nonEmpty();I(a,`pointer ${o.address} is broken`),I(s,`Cannot find target for pointer ${o.address}`),e++}},visitObjectField:o=>t(o)})};return this.#t.forEach(i=>t(i)),console.debug("verification complete."),{count:e}}debugBoxes(){console.table(this.#t.values().reduce((e,t)=>(e[w.toString(t.address.uuid)]={class:t.name,"incoming links":t.incomingEdges().length,"outgoing links":t.outgoingEdges().length,"est. memory (bytes)":t.estimateMemory()},e),{}))}debugDependencies(){console.debug("Dependencies:"),this.boxes().forEach(e=>{console.debug(` ${e}`);for(let t of this.dependenciesOf(e).boxes)console.debug(` ${t}`)})}addressToDebugPath(e){return e.flatMap(t=>t.isBox()?this.findBox(t.uuid).map(i=>i.name):this.findBox(t.uuid).flatMap(i=>i.searchVertex(t.fieldKeys).map(n=>n.isField()?n.debugPath:F("Unknown address"))))}toArrayBuffer(){let e=$t.create(),t=this.#t.values();return e.writeInt(t.length),t.forEach(i=>{let n=i.serialize();e.writeInt(n.byteLength),e.writeBytes(new Int8Array(n))}),e.toArrayBuffer()}fromArrayBuffer(e){I(this.#t.isEmpty(),"Cannot call fromArrayBuffer if boxes is not empty");let t=new lt(e),i=t.readInt();this.beginTransaction();let n=[];for(let o=0;o<i;o++){let a=t.readInt(),s=new Int8Array(a);t.readBytes(s);let l=new lt(s.buffer),u=l.readInt(),p=l.readString(),d=w.fromDataInput(l);n.push({creationIndex:u,name:p,uuid:d,boxStream:l})}n.sort((o,a)=>o.creationIndex-a.creationIndex).forEach(({name:o,uuid:a,boxStream:s})=>this.createBox(o,a,l=>l.read(s))),this.endTransaction()}toJSON(){return this.#t.values().map(e=>({name:e.name,uuid:e.address.toString(),fields:ee(e.toJSON())}))}#h(){I(this.#u,()=>"Modification only prohibited in transaction mode.")}};var fl;(function(r){r.insertOrder=(e,t=Number.MAX_SAFE_INTEGER)=>{let i=r.collectIndexedBoxes(e),n=le(t,0,i.length);if(n<i.length)for(let o=n;o<i.length;o++)i[o].index.setValue(o+1);return n},r.removeOrder=(e,t)=>{let i=r.collectIndexedBoxes(e);if(t<i.length)for(let n=t+1;n<i.length;n++)i[n].index.setValue(n-1)},r.moveIndex=(e,t,i)=>{let n=r.collectIndexedBoxes(e),o=n[t];if(i<0){let a=le(t+i,0,n.length-1);for(let s=a;s<t;s++)n[s].index.setValue(s+1);o.index.setValue(a)}else if(i>1){let a=le(t+(i-1),0,n.length-1);for(let s=t;s<a;s++)n[s+1].index.setValue(s);o.index.setValue(a)}else console.warn(`moveIndex had no effect: startIndex: ${t}, delta: ${i}`)},r.isIndexedBox=e=>"index"in e&&e.index instanceof E,r.collectIndexedBoxes=(e,t)=>e.pointerHub.incoming().map(({box:i})=>r.isIndexedBox(i)&&(t===void 0||i instanceof t)?i:F(`${i} has no index field`)).sort((i,n)=>i.index.getValue()-n.index.getValue())})(fl||(fl={}));var ze=class extends W{#e;constructor(e){super(e),this.#e=this.initializeFields()}accept(e){return _(e.visitObjectField,this)}fields(){return Object.values(this.#e)}record(){return this.#e}getField(e){return ee(this.#e[e])}optField(e){return g.wrap(this.#e[e])}subscribe(e){return this.graph.subscribeVertexUpdates(ke.Children,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}read(e){No.readFields(e,this.#e)}write(e){No.writeFields(e,this.#e)}toJSON(){if(!this.deprecated)return Object.entries(this.#e).reduce((e,[t,i])=>(e[t]=i.toJSON(),e),{})}fromJSON(e){if(!this.deprecated)if(Kh(e))Object.entries(e).forEach(([t,i])=>{let n=this.#e[parseInt(t)];Z(i)&&n.fromJSON(i)});else return F("Type mismatch")}};var qn;(function(r){r.sender=(n,o)=>o(new t(n)),r.executor=(n,o)=>new i(n,o);let e=n=>{let o=[];for(let a of n)a instanceof MessagePort&&o.push(a),typeof ImageBitmap<"u"&&a instanceof ImageBitmap&&o.push(a),typeof OffscreenCanvas<"u"&&a instanceof OffscreenCanvas&&o.push(a);return o};class t{#e;#t=new Map;#r;#i=0;constructor(o){this.#e=o,this.#r=o.subscribe(this.#n)}terminate(){this.#r.terminate()}dispatchAndForget=(o,...a)=>{let s=e(a);this.#e.send({type:"send",returnId:!1,func:o.name,args:Array.from(Xe.map(a,l=>({value:l})))},s)};dispatchAndReturn=(o,...a)=>new Promise((s,l)=>{let u=Xe.reduce(a,(d,f,v)=>(typeof f=="function"&&d.push([v,f]),d),[]);this.#t.set(this.#i,{executorTuple:{resolve:s,reject:l},callbacks:new Map(u)});let p=e(a);this.#e.send({type:"send",returnId:this.#i,func:o.name,args:Array.from(Xe.map(a,(d,f)=>typeof d=="function"?{callback:f}:{value:d}))},p),this.#i++});#n=o=>{let a=this.#t.get(o.returnId);Z(a)?o.type==="resolve"?(a.executorTuple.resolve(o.resolve),this.#t.delete(o.returnId)):o.type==="reject"?(a.executorTuple.reject(o.reject),this.#t.delete(o.returnId)):o.type==="callback"&&a.callbacks?.get(o.funcAt).apply(this,o.args):F(`Promise has already been resolved. ${JSON.stringify(o)}`)}}class i{#e;#t;#r;constructor(o,a){this.#e=o,this.#t=a,this.#r=o.subscribe(this.#i)}terminate(){this.#r.terminate()}#i=o=>{I(o.type==="send",()=>"Message type must be 'send'");let a=Object.getPrototypeOf(this.#t)===Object.getPrototypeOf({})?this.#t:Object.getPrototypeOf(this.#t),s=ee(a[o.func],`${o.func.toString()} does not exists on ${this.#t}`),l=o.returnId;if(l===!1)s.apply(this.#t,o.args.map(u=>"value"in u?u.value:F(`${o.func.toString()} has no promise.`)));else try{s.apply(this.#t,o.args.map(p=>"callback"in p?(...d)=>this.#a(l,p.callback,d):p.value)).then(p=>{try{this.#n(l,p)}catch(d){this.#o(l,d)}},p=>this.#o(l,p))}catch(u){this.#o(l,u)}};#n=(o,a)=>this.#e.send({type:"resolve",returnId:o,resolve:a});#o=(o,a)=>this.#e.send({type:"reject",returnId:o,reject:a});#a=(o,a,s)=>this.#e.send({type:"callback",returnId:o,funcAt:a,args:s})}r.Executor=i})(qn||(qn={}));var DP={for:r=>new Lx(r)},SB=[],Lx=class{#e;#t=new re;constructor(e){if(this.#e=e,Z(e.onmessage)||Z(e.onmessageerror))throw console.error(e),new Error(`${e} is already wrapped.`);e.onmessage=t=>this.#t.notify(t.data),e.onmessageerror=t=>{throw new Error(t.type)}}send(e,t){this.#e.postMessage(e,t??SB)}channel(e){return new Kx(this,e)}subscribe(e){return this.#t.subscribe(e)}terminate(){this.#t.terminate(),this.#e.onmessage=null,this.#e.onmessageerror=null}},Kx=class r{#e;#t;#r=new re;#i;constructor(e,t){this.#e=e,this.#t=t,this.#i=e.subscribe(i=>{"__id__"in i&&i.__id__==="42"&&"message"in i&&"channel"in i&&i.channel===t&&this.#r.notify(i.message)})}send(e,t){this.#e.send({__id__:"42",channel:this.#t,message:e},t)}channel(e){return new r(this,e)}subscribe(e){return this.#r.subscribe(e)}terminate(){this.#i.terminate(),this.#r.terminate()}};var vf;(function(r){r.frame=()=>new Promise(e=>requestAnimationFrame(()=>e())),r.frames=e=>new Promise(t=>{let i=e,n=()=>{--i<=0?t():requestAnimationFrame(n)};requestAnimationFrame(n)}),r.timeSpan=(e,...t)=>new Promise(i=>setTimeout(i,e.millis(),...t)),r.event=(e,t)=>new Promise(i=>e.addEventListener(t,i,{once:!0})),r.observable=e=>new Promise(t=>{let i=e.subscribe(()=>{i.terminate(),t()})}),r.complete=e=>new Promise((t,i)=>{let n=setInterval(()=>{let{status:o,value:a,error:s}=jn(()=>e.next());if(o==="success"){let{done:l,value:u}=a;l&&(clearInterval(n),t(u))}else clearInterval(n),i(s)},0)})})(vf||(vf={}));var Wx=class{maxRetry;timeSpan;#e=0;constructor(e,t){this.maxRetry=e,this.timeSpan=t}retry(e,t){return++this.#e===this.maxRetry?!1:(console.debug(`${e} > will retry in ${this.timeSpan.toString()}`),setTimeout(t,this.timeSpan.millis()),!0)}},yf;(function(r){class e{value;status="resolved";constructor(s){this.value=s}error=Ta("Cannot access error when promise is resolved")}r.ResolveResult=e;class t{error;status="rejected";constructor(s){this.error=s}value=Ta("Cannot access value when promise is rejected")}r.RejectedResult=t,r.makeAbortable=async(a,s)=>{let l=!0;return a.own(K.create(()=>l=!1)),new Promise((u,p)=>s.then(d=>{l&&u(d)},d=>{l&&p(d)}))},r.tryCatch=a=>a.then(s=>new e(s),s=>new t(s));let i=new Wx(3,Vu.seconds(3));r.retry=(a,s=i)=>a().catch(l=>new Promise((u,p)=>{let d=f=>{s.retry(f,()=>a().then(v=>u(v),d))||p(f)};d(l)})),r.guardedRetry=(a,s)=>{let l=async(u=0)=>{try{return await a()}catch(p){if(s(p,++u))return console.debug("retrying after failure:",p),await vf.timeSpan(Vu.seconds(1)),l(u);throw new Error(`Failed after ${u} retries: ${p}`)}};return l()},r.approvedRetry=(a,s)=>{let l=async()=>{try{return await a()}catch(u){if(await al.approve(s(u)))return l();throw u}};return l()},r.fail=(a,s)=>{let l=()=>new Promise((u,p)=>setTimeout(()=>p("fails first"),a.millis()));return()=>{let u=l();return l=s,u}},r.timeout=(a,s,l)=>new Promise((u,p)=>{let d=!0,f=setTimeout(()=>{d=!1,p(new Error(l??"timeout"))},s.millis());a.then(v=>{d&&u(v)},v=>{d&&p(v)}).finally(()=>clearTimeout(f))}),r.sequentialAll=a=>a.reduce((s,l)=>s.then(async u=>[...u,await l()]),Promise.resolve([])),r.sequentialize=a=>{let s=Promise.resolve();return l=>{let u=()=>a(l),p=s.then(u,u);return s=p.catch(()=>{}),p}},r.memoizeAsync=(a,s)=>{let l=null,u=Date.now();return()=>{let p=Date.now();return(Ia(l)||Z(s)&&p-u>s.millis())&&(u=p,l=a(),l.catch(d=>(l=null,d))),l}},r.allWithLimit=async(a,s=1)=>{let l=new Array(a.length),u=0,p=!1,d=async()=>{for(;u<a.length&&!p;){let f=u++;try{let v=await a[f]();p||(l[f]=v)}catch(v){throw p=!0,v}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},d)),l},r.allSettledWithLimit=async(a,s=1)=>{let l=new Array(a.length),u=0,p=async()=>{for(;u<a.length;){let d=u++;try{let f=await a[d]();l[d]={status:"fulfilled",value:f}}catch(f){l[d]={status:"rejected",reason:f}}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},p)),l};class n{max;#e;#t=0;constructor(s=1){this.max=s,this.#e=[]}async add(s){if(this.#t<this.max)return this.#t++,s().finally(()=>this.#r());{let l=Promise.withResolvers();return this.#e.push([s,l]),l.promise.finally(()=>this.#r())}}#r(){if(I(this.#t>0,"Internal Error in Promises.Limit"),--this.#t<this.max&&this.#e.length>0){let[s,{resolve:l,reject:u}]=this.#e.shift();this.#t++,s().then(l,u)}}}r.Limit=n;class o{#e;#t;#r;#i=g.None;constructor(s,l,u){this.#e=s,this.#t=l,this.#r=u}update(s){this.#i=g.wrap(s),s.then(l=>{this.#i.contains(s)&&this.#e(l)}).catch(l=>{this.#i.contains(s)&&this.#t(l)}).finally(()=>{this.#i.contains(s)&&(this.terminate(),_(this.#r))})}terminate(){this.#i=g.None}}r.Latest=o})(yf||(yf={}));var IP=(r,e)=>qn.executor(e,new class{sendUpdates(t){r.beginTransaction(),t.forEach(i=>{let n=i.type;n==="new"?r.createBox(i.name,i.uuid,o=>o.read(new lt(i.buffer))):n==="update-primitive"?r.findVertex(Ae.reconstruct(i.address)).unwrap(()=>`Could not find primitive field ${i.address}`).setValue(i.value):n==="update-pointer"?r.findVertex(Ae.reconstruct(i.address)).unwrap(()=>`Could not find pointer field ${i.address}`).targetAddress=Z(i.target)?g.wrap(Ae.reconstruct(i.target)):g.None:i.type==="delete"&&r.unstageBox(r.findBox(i.uuid).unwrap(()=>`Could not find box ${w.toString(i.uuid)}`))}),r.endTransaction()}checksum(t){return R.equals(r.checksum(),t)?Promise.resolve():Promise.reject("Checksum mismatch")}});var xf=class{#e=0;#t=!1;#r=!1;isRecording=!1;isCountingIn=!1;metronomeEnabled=!1;getLeapStateAndReset(){let e=this.#r;return this.#r=!1,e}get position(){return this.#e}set position(e){this.#e=e,this.#r=!0}get transporting(){return this.#t}set transporting(e){this.#t!==e&&(this.#t=e)}pause(){this.#t=!1,this.isRecording=!1,this.isCountingIn=!1}advanceTo(e){this.#e=e}};var CP;(function(r){r.NoSync="nosync",r.Pitch="pitch",r.Timestretch="timestretch",r.AudioFit="audiofit"})(CP||(CP={}));var TP;(function(r){r[r.Pre=0]="Pre",r[r.Post=1]="Post"})(TP||(TP={}));var St;(function(r){r.Instrument="instrument",r.Bus="bus",r.Aux="aux",r.Output="output"})(St||(St={}));var ml={white:new _t(0,0,100),blue:new _t(189,100,65),green:new _t(150,77,69),yellow:new _t(60,100,84),cream:new _t(65,20,83),orange:new _t(31,100,73),red:new _t(354,100,65),purple:new _t(314,100,78),bright:new _t(197,0,100),gray:new _t(197,31,85),dark:new _t(197,15,62),shadow:new _t(197,10,42),black:new _t(197,10,14),background:new _t(197,6,5),panelBackground:new _t(197,14,7),panelBackgroundBright:new _t(197,14,10),panelBackgroundDark:new _t(197,14,6)};var Me;(function(r){r[r.Add=0]="Add",r[r.Adsr=1]="Adsr",r[r.ArrayDown=2]="ArrayDown",r[r.AudioBus=3]="AudioBus",r[r.AudioDevice=4]="AudioDevice",r[r.AudioFile=5]="AudioFile",r[r.AutoGain=6]="AutoGain",r[r.Automation=7]="Automation",r[r.BassGuitar=8]="BassGuitar",r[r.Book=9]="Book",r[r.Box=10]="Box",r[r.Bug=11]="Bug",r[r.Fold=12]="Fold",r[r.Checkbox=13]="Checkbox",r[r.Clips=14]="Clips",r[r.Close=15]="Close",r[r.CloudFolder=16]="CloudFolder",r[r.CollapseDown=17]="CollapseDown",r[r.Compressor=18]="Compressor",r[r.Connected=19]="Connected",r[r.Cube=20]="Cube",r[r.Cursor=21]="Cursor",r[r.Curve=22]="Curve",r[r.Dattorro=23]="Dattorro",r[r.Delete=24]="Delete",r[r.Dial=25]="Dial",r[r.DinSlot=26]="DinSlot",r[r.Disconnected=27]="Disconnected",r[r.Divide=28]="Divide",r[r.DragConnections=29]="DragConnections",r[r.Dropdown=30]="Dropdown",r[r.Dropbox=31]="Dropbox",r[r.DrumSet=32]="DrumSet",r[r.Tidal=33]="Tidal",r[r.Duration=34]="Duration",r[r.EditBox=35]="EditBox",r[r.Effects=36]="Effects",r[r.Embed=37]="Embed",r[r.EQ=38]="EQ",r[r.Eraser=39]="Eraser",r[r.Exclude=40]="Exclude",r[r.Exit=41]="Exit",r[r.ExpandWidth=42]="ExpandWidth",r[r.FileList=43]="FileList",r[r.Flask=44]="Flask",r[r.Focus=45]="Focus",r[r.Generator=46]="Generator",r[r.GoogleDrive=47]="GoogleDrive",r[r.Groove=48]="Groove",r[r.Guitar=49]="Guitar",r[r.GuitarTab=50]="GuitarTab",r[r.Headphone=51]="Headphone",r[r.Heart=52]="Heart",r[r.Help=53]="Help",r[r.HighPass=54]="HighPass",r[r.HighShelf=55]="HighShelf",r[r.Insert=56]="Insert",r[r.Invert=57]="Invert",r[r.Loop=58]="Loop",r[r.LowPass=59]="LowPass",r[r.LowShelf=60]="LowShelf",r[r.Magnet=61]="Magnet",r[r.MainMenu=62]="MainMenu",r[r.Maximized=63]="Maximized",r[r.Menu=64]="Menu",r[r.Merge=65]="Merge",r[r.Metronome=66]="Metronome",r[r.Microphone=67]="Microphone",r[r.Midi=68]="Midi",r[r.Minimized=69]="Minimized",r[r.Mix=70]="Mix",r[r.Mixing=71]="Mixing",r[r.Mute=72]="Mute",r[r.NanoWave=73]="NanoWave",r[r.New=74]="New",r[r.NoAudio=75]="NoAudio",r[r.Note=76]="Note",r[r.NotePad=77]="NotePad",r[r.OpenDAW=78]="OpenDAW",r[r.Panel=79]="Panel",r[r.Peak=80]="Peak",r[r.Pencil=81]="Pencil",r[r.Piano=82]="Piano",r[r.Play=83]="Play",r[r.Playfield=84]="Playfield",r[r.PlayOnce=85]="PlayOnce",r[r.PlayRepeat=86]="PlayRepeat",r[r.PlayAlternate=87]="PlayAlternate",r[r.Pointer=88]="Pointer",r[r.Popout=89]="Popout",r[r.Primary=90]="Primary",r[r.Random=91]="Random",r[r.Record=92]="Record",r[r.Rectangle=93]="Rectangle",r[r.Region=94]="Region",r[r.Robot=95]="Robot",r[r.RoundDown=96]="RoundDown",r[r.RoundUp=97]="RoundUp",r[r.Run=98]="Run",r[r.Sawtooth=99]="Sawtooth",r[r.Saxophone=100]="Saxophone",r[r.Scissors=101]="Scissors",r[r.Search=102]="Search",r[r.Shadertoy=103]="Shadertoy",r[r.Sine=104]="Sine",r[r.Solo=105]="Solo",r[r.SoundFont=106]="SoundFont",r[r.SpeakerHeadphone=107]="SpeakerHeadphone",r[r.Square=108]="Square",r[r.Stack=109]="Stack",r[r.Start=110]="Start",r[r.Stereo=111]="Stereo",r[r.Stop=112]="Stop",r[r.Subtract=113]="Subtract",r[r.Sun=114]="Sun",r[r.Swap=115]="Swap",r[r.System=116]="System",r[r.Table=117]="Table",r[r.Tape=118]="Tape",r[r.TapeReel=119]="TapeReel",r[r.Time=120]="Time",r[r.Timeline=121]="Timeline",r[r.Tool=122]="Tool",r[r.Triangle=123]="Triangle",r[r.Unknown=124]="Unknown",r[r.UserFolder=125]="UserFolder",r[r.Velocity=126]="Velocity",r[r.Vinyl=127]="Vinyl",r[r.VUMeter=128]="VUMeter",r[r.Waveform=129]="Waveform",r[r.Zeitgeist=130]="Zeitgeist"})(Me||(Me={}));(function(r){r.toName=e=>r[e],r.fromName=e=>r[e]??r.Rectangle})(Me||(Me={}));var c;(function(r){r[r.Deprecated=NaN]="Deprecated",r[r.MetaData=0]="MetaData",r[r.AudioBusses=1]="AudioBusses",r[r.AudioConnection=2]="AudioConnection",r[r.AudioEffectHost=3]="AudioEffectHost",r[r.AudioFile=4]="AudioFile",r[r.AudioOutput=5]="AudioOutput",r[r.AudioPlayMode=6]="AudioPlayMode",r[r.AudioUnit=7]="AudioUnit",r[r.AudioUnits=8]="AudioUnits",r[r.Automation=9]="Automation",r[r.AuxSend=10]="AuxSend",r[r.Capture=11]="Capture",r[r.ClipCollection=12]="ClipCollection",r[r.ConnectionCollection=13]="ConnectionCollection",r[r.Device=14]="Device",r[r.DeviceUserInterface=15]="DeviceUserInterface",r[r.Editing=16]="Editing",r[r.FileUploadState=17]="FileUploadState",r[r.Groove=18]="Groove",r[r.InstrumentHost=19]="InstrumentHost",r[r.MarkerEvents=20]="MarkerEvents",r[r.MarkerTrack=21]="MarkerTrack",r[r.MidiControl=22]="MidiControl",r[r.MIDIDevice=23]="MIDIDevice",r[r.MidiEffectHost=24]="MidiEffectHost",r[r.ModularSetup=25]="ModularSetup",r[r.Modulation=26]="Modulation",r[r.ModuleCollection=27]="ModuleCollection",r[r.NoteEventCollection=28]="NoteEventCollection",r[r.NoteEventFeature=29]="NoteEventFeature",r[r.NoteEvents=30]="NoteEvents",r[r.NotesConnection=31]="NotesConnection",r[r.Parameter=32]="Parameter",r[r.ParameterController=33]="ParameterController",r[r.PianoMode=34]="PianoMode",r[r.RegionCollection=35]="RegionCollection",r[r.Sample=36]="Sample",r[r.Selection=37]="Selection",r[r.Shadertoy=38]="Shadertoy",r[r.SoundfontFile=39]="SoundfontFile",r[r.StepAutomation=40]="StepAutomation",r[r.Timeline=41]="Timeline",r[r.TrackCollection=42]="TrackCollection",r[r.TransientMarkers=43]="TransientMarkers",r[r.User=44]="User",r[r.ValueEventCollection=45]="ValueEventCollection",r[r.ValueEvents=46]="ValueEvents",r[r.ValueInterpolation=47]="ValueInterpolation",r[r.VoltageConnection=48]="VoltageConnection",r[r.WarpMarkers=49]="WarpMarkers"})(c||(c={}));var ko;(function(r){r[r.Once=0]="Once",r[r.Repeat=1]="Repeat",r[r.Pingpong=2]="Pingpong"})(ko||(ko={}));var pn;(function(r){r[r.Monophonic=0]="Monophonic",r[r.Polyphonic=1]="Polyphonic"})(pn||(pn={}));var RP=(r,e)=>{if(r===e)return 0;let t=r-e;return t===0?F(`Indices cannot be equal (${r}, ${e})`):t};var Hn=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},jt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},wf,Ci,$o,bf,Jn,Lt=class r{static create(e,t,i){return new r(e,t,i)}constructor(e,t,i){wf.set(this,void 0),Ci.set(this,void 0),$o.set(this,void 0),bf.set(this,void 0),Jn.set(this,null),Hn(this,wf,e,"f"),Hn(this,Ci,w.newSet(n=>n.adapter.uuid),"f"),Hn(this,$o,new Mt,"f"),Hn(this,bf,e.pointerHub.catchupAndSubscribe({onAdded:n=>{Hn(this,Jn,null,"f");let o=t(n.box),a=o.indexField.subscribe(()=>{Hn(this,Jn,null,"f"),jt(this,$o,"f").proxy.onReorder(o)}),s=jt(this,Ci,"f").add({adapter:o,subscription:a});I(s,`Could not add ${o}`),jt(this,$o,"f").proxy.onAdd(o)},onRemoved:n=>{Hn(this,Jn,null,"f");let o=n.box.address.uuid,{adapter:a,subscription:s}=jt(this,Ci,"f").removeByKey(o);s.terminate(),jt(this,$o,"f").proxy.onRemove(a)}},i),"f")}field(){return jt(this,wf,"f")}subscribe(e){return jt(this,$o,"f").subscribe(e)}catchupAndSubscribe(e){return jt(this,Ci,"f").forEach(({adapter:t})=>e.onAdd(t)),this.subscribe(e)}getAdapterByIndex(e){let t=Ye.exactMapped(this.adapters(),e,RP,i=>i.indexField.getValue());return t===-1?g.None:g.wrap(this.adapters()[t])}getAdapterById(e){return jt(this,Ci,"f").opt(e).map(({adapter:t})=>t)}getMinFreeIndex(){let e=this.adapters();for(let t=0;t<e.length;t++)if(e[t].indexField.getValue()>t)return t;return e.length}adapters(){return jt(this,Jn,"f")===null&&Hn(this,Jn,jt(this,Ci,"f").values().map(({adapter:e})=>e).sort((e,t)=>e.indexField.getValue()-t.indexField.getValue()),"f"),jt(this,Jn,"f")}move(e,t){this.moveIndex(e.indexField.getValue(),t)}moveIndex(e,t){let i=this.adapters(),n=i[e];if(t<0){let o=le(e+t,0,i.length-1);for(let a=o;a<e;a++)i[a].indexField.setValue(a+1);n.indexField.setValue(o)}else if(t>1){let o=le(e+(t-1),0,i.length-1);for(let a=e;a<o;a++)i[a+1].indexField.setValue(a);n.indexField.setValue(o)}else console.warn(`moveIndex had no effect: startIndex: ${e}, delta: ${t}`)}size(){return jt(this,Ci,"f").size()}isEmpty(){return this.size()===0}terminate(){Hn(this,Jn,null,"f"),jt(this,Ci,"f").forEach(({subscription:e})=>e.terminate()),jt(this,Ci,"f").clear(),jt(this,$o,"f").terminate(),jt(this,bf,"f").terminate()}};wf=new WeakMap,Ci=new WeakMap,$o=new WeakMap,bf=new WeakMap,Jn=new WeakMap;var La;(function(r){r.create=(e,t,i,n)=>{switch(e){case"MetaDataBox":return Qn.create(t,i,n);case"RootBox":return gl.create(t,i,n);case"SelectionBox":return hn.create(t,i,n);case"UserInterfaceBox":return Ka.create(t,i,n);case"UploadFileBox":return Af.create(t,i,n);case"ShadertoyBox":return _f.create(t,i,n);case"TimelineBox":return Wa.create(t,i,n);case"TrackBox":return lr.create(t,i,n);case"NoteEventBox":return Mo.create(t,i,n);case"NoteEventRepeatBox":return Pf.create(t,i,n);case"NoteEventCollectionBox":return Yn.create(t,i,n);case"NoteRegionBox":return Za.create(t,i,n);case"NoteClipBox":return vl.create(t,i,n);case"ValueEventBox":return Do.create(t,i,n);case"ValueEventCollectionBox":return Xn.create(t,i,n);case"ValueEventCurveBox":return Io.create(t,i,n);case"ValueRegionBox":return Ga.create(t,i,n);case"ValueClipBox":return yl.create(t,i,n);case"AudioRegionBox":return Co.create(t,i,n);case"AudioClipBox":return xl.create(t,i,n);case"AudioPitchStretchBox":return wl.create(t,i,n);case"AudioTimeStretchBox":return bl.create(t,i,n);case"TransientMarkerBox":return Sf.create(t,i,n);case"WarpMarkerBox":return To.create(t,i,n);case"MarkerBox":return Al.create(t,i,n);case"AudioFileBox":return Tr.create(t,i,n);case"SoundfontFileBox":return ei.create(t,i,n);case"AudioUnitBox":return it.create(t,i,n);case"CaptureAudioBox":return Ro.create(t,i,n);case"CaptureMidiBox":return Oo.create(t,i,n);case"AudioBusBox":return Ti.create(t,i,n);case"AuxSendBox":return qa.create(t,i,n);case"GrooveShuffleBox":return _l.create(t,i,n);case"UnknownAudioEffectDeviceBox":return Ef.create(t,i,n);case"UnknownMidiEffectDeviceBox":return Bf.create(t,i,n);case"DeviceInterfaceKnobBox":return Ff.create(t,i,n);case"ModularDeviceBox":return Nf.create(t,i,n);case"StereoToolDeviceBox":return kf.create(t,i,n);case"CompressorDeviceBox":return Pl.create(t,i,n);case"DelayDeviceBox":return $f.create(t,i,n);case"CrusherDeviceBox":return Mf.create(t,i,n);case"DattorroReverbDeviceBox":return Df.create(t,i,n);case"VelocityDeviceBox":return If.create(t,i,n);case"FoldDeviceBox":return Cf.create(t,i,n);case"TidalDeviceBox":return Tf.create(t,i,n);case"RevampDeviceBox":return Rf.create(t,i,n);case"ReverbDeviceBox":return Of.create(t,i,n);case"VaporisateurDeviceBox":return Sl.create(t,i,n);case"MIDIOutputDeviceBox":return El.create(t,i,n);case"MIDIOutputBox":return Ri.create(t,i,n);case"MIDIOutputParameterBox":return Oi.create(t,i,n);case"SoundfontDeviceBox":return Bl.create(t,i,n);case"NanoDeviceBox":return Fl.create(t,i,n);case"PlayfieldDeviceBox":return Nl.create(t,i,n);case"PlayfieldSampleBox":return Vo.create(t,i,n);case"TapeDeviceBox":return kl.create(t,i,n);case"ArpeggioDeviceBox":return Vf.create(t,i,n);case"PitchDeviceBox":return zf.create(t,i,n);case"ZeitgeistDeviceBox":return Uf.create(t,i,n);case"ModularBox":return jf.create(t,i,n);case"ModuleConnectionBox":return Lf.create(t,i,n);case"ModularAudioInputBox":return Kf.create(t,i,n);case"ModularAudioOutputBox":return Wf.create(t,i,n);case"ModuleDelayBox":return Zf.create(t,i,n);case"ModuleMultiplierBox":return Gf.create(t,i,n);case"ModuleGainBox":return qf.create(t,i,n);default:return F(`Unknown box class '${e}'`)}},r.deserialize=(e,t)=>{let i=new lt(t),n=i.readString(),o=w.fromDataInput(i),a=r.create(n,e,o);return a.read(i),a}})(La||(La={}));var Qn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MetaDataBox",pointerRules:h}),i)}static ClassName="MetaDataBox";constructor(e){super(e)}accept(e){return _(e.visitMetaDataBox,this)}get target(){return this.getField(1)}get origin(){return this.getField(2)}get value(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"target",deprecated:!1,pointerRules:h},c.MetaData,!0),2:C.create({parent:this,fieldKey:2,fieldName:"origin",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"value",deprecated:!1,pointerRules:h})}}};var Hf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get keyboard(){return this.getField(1)}get timeRangeInQuarters(){return this.getField(2)}get noteScale(){return this.getField(3)}get noteLabels(){return this.getField(4)}get transpose(){return this.getField(5)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"keyboard",deprecated:!1,pointerRules:h},{length:4},"",0),2:b.create({parent:this,fieldKey:2,fieldName:"timeRangeInQuarters",deprecated:!1,pointerRules:h},{min:1,max:64,scaling:"linear"},"",8),3:b.create({parent:this,fieldKey:3,fieldName:"noteScale",deprecated:!1,pointerRules:h},{min:.5,max:2,scaling:"linear"},"",1),4:$.create({parent:this,fieldKey:4,fieldName:"noteLabels",deprecated:!1,pointerRules:h},!1),5:E.create({parent:this,fieldKey:5,fieldName:"transpose",deprecated:!1,pointerRules:h},{min:-48,max:48},"st",0)}}};var gl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RootBox",pointerRules:h}),i)}static ClassName="RootBox";constructor(e){super(e)}accept(e){return _(e.visitRootBox,this)}get timeline(){return this.getField(1)}get users(){return this.getField(2)}get created(){return this.getField(3)}get groove(){return this.getField(4)}get modularSetups(){return this.getField(10)}get audioUnits(){return this.getField(20)}get audioBusses(){return this.getField(21)}get outputDevice(){return this.getField(30)}get outputMidiDevices(){return this.getField(35)}get pianoMode(){return this.getField(40)}get shadertoy(){return this.getField(100)}get editingChannel(){return this.getField(111)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"timeline",deprecated:!1,pointerRules:h},c.Timeline,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"users",deprecated:!1,pointerRules:{accepts:[c.User],mandatory:!0}}),3:C.create({parent:this,fieldKey:3,fieldName:"created",deprecated:!1,pointerRules:h}),4:B.create({parent:this,fieldKey:4,fieldName:"groove",deprecated:!1,pointerRules:h},c.Groove,!0),10:W.hook({parent:this,fieldKey:10,fieldName:"modularSetups",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!1}}),20:W.hook({parent:this,fieldKey:20,fieldName:"audioUnits",deprecated:!1,pointerRules:{accepts:[c.AudioUnits],mandatory:!1}}),21:W.hook({parent:this,fieldKey:21,fieldName:"audioBusses",deprecated:!1,pointerRules:{accepts:[c.AudioBusses],mandatory:!1}}),30:W.hook({parent:this,fieldKey:30,fieldName:"outputDevice",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!0}}),35:W.hook({parent:this,fieldKey:35,fieldName:"outputMidiDevices",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!1}}),40:Hf.create({parent:this,fieldKey:40,fieldName:"pianoMode",deprecated:!1,pointerRules:h}),100:B.create({parent:this,fieldKey:100,fieldName:"shadertoy",deprecated:!1,pointerRules:h},c.Shadertoy,!1),111:B.create({parent:this,fieldKey:111,fieldName:"editingChannel",deprecated:!1,pointerRules:h},c.Editing,!1)}}};var hn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SelectionBox",pointerRules:h}),i)}static ClassName="SelectionBox";constructor(e){super(e)}accept(e){return _(e.visitSelectionBox,this)}get selection(){return this.getField(1)}get selectable(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"selection",deprecated:!1,pointerRules:h},c.Selection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"selectable",deprecated:!1,pointerRules:h},c.Selection,!0)}}};var Ka=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UserInterfaceBox",pointerRules:{accepts:[c.MetaData],mandatory:!1}}),i)}static ClassName="UserInterfaceBox";constructor(e){super(e)}accept(e){return _(e.visitUserInterfaceBox,this)}get root(){return this.getField(1)}get selection(){return this.getField(10)}get uploadStates(){return this.getField(11)}get editingDeviceChain(){return this.getField(21)}get editingTimelineRegion(){return this.getField(22)}get editingModularSystem(){return this.getField(23)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:h},c.User,!0),10:W.hook({parent:this,fieldKey:10,fieldName:"selection",deprecated:!1,pointerRules:{accepts:[c.Selection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"uploadStates",deprecated:!1,pointerRules:{accepts:[c.FileUploadState],mandatory:!1}}),21:B.create({parent:this,fieldKey:21,fieldName:"editingDeviceChain",deprecated:!1,pointerRules:h},c.Editing,!1),22:B.create({parent:this,fieldKey:22,fieldName:"editingTimelineRegion",deprecated:!1,pointerRules:h},c.Editing,!1),23:B.create({parent:this,fieldKey:23,fieldName:"editingModularSystem",deprecated:!1,pointerRules:h},c.Editing,!1)}}};var Af=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UploadFileBox",pointerRules:h}),i)}static ClassName="UploadFileBox";constructor(e){super(e)}accept(e){return _(e.visitUploadFileBox,this)}get user(){return this.getField(1)}get file(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"user",deprecated:!1,pointerRules:h},c.FileUploadState,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.FileUploadState,!0)}}};var _f=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ShadertoyBox",pointerRules:{accepts:[c.Shadertoy],mandatory:!0}}),i)}static ClassName="ShadertoyBox";constructor(e){super(e)}accept(e){return _(e.visitShadertoyBox,this)}get shaderCode(){return this.getField(1)}get highres(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"shaderCode",deprecated:!1,pointerRules:h}),2:$.create({parent:this,fieldKey:2,fieldName:"highres",deprecated:!1,pointerRules:h},!0)}}};var Jf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get nominator(){return this.getField(1)}get denominator(){return this.getField(2)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"nominator",deprecated:!1,pointerRules:h},{min:1,max:32},"",4),2:E.create({parent:this,fieldKey:2,fieldName:"denominator",deprecated:!1,pointerRules:h},{min:1,max:32},"",4)}}};var Qf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get from(){return this.getField(2)}get to(){return this.getField(3)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),2:E.create({parent:this,fieldKey:2,fieldName:"from",deprecated:!1,pointerRules:h},"any","ppqn",0),3:E.create({parent:this,fieldKey:3,fieldName:"to",deprecated:!1,pointerRules:h},"any","ppqn",15360)}}};var Yf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get markers(){return this.getField(1)}get index(){return this.getField(10)}get enabled(){return this.getField(20)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"markers",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),20:$.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:h},!0)}}};var Wa=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TimelineBox",pointerRules:h}),i)}static ClassName="TimelineBox";constructor(e){super(e)}accept(e){return _(e.visitTimelineBox,this)}get root(){return this.getField(1)}get signature(){return this.getField(10)}get loopArea(){return this.getField(11)}get deprecatedMarkerTrack(){return this.getField(20)}get markerTrack(){return this.getField(21)}get durationInPulses(){return this.getField(30)}get bpm(){return this.getField(31)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:{accepts:[c.Timeline],mandatory:!0}}),10:Jf.create({parent:this,fieldKey:10,fieldName:"signature",deprecated:!1,pointerRules:h}),11:Qf.create({parent:this,fieldKey:11,fieldName:"loopArea",deprecated:!1,pointerRules:h}),20:W.hook({parent:this,fieldKey:20,fieldName:"deprecatedMarkerTrack",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1}}),21:Yf.create({parent:this,fieldKey:21,fieldName:"markerTrack",deprecated:!1,pointerRules:h}),30:E.create({parent:this,fieldKey:30,fieldName:"durationInPulses",deprecated:!1,pointerRules:h},"positive","ppqn",491520),31:b.create({parent:this,fieldKey:31,fieldName:"bpm",deprecated:!1,pointerRules:h},{min:30,max:999,scaling:"exponential"},"bpm",120)}}};var lr=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TrackBox",pointerRules:{accepts:[c.Selection,c.PianoMode,c.MetaData],mandatory:!1}}),i)}static ClassName="TrackBox";constructor(e){super(e)}accept(e){return _(e.visitTrackBox,this)}get tracks(){return this.getField(1)}get target(){return this.getField(2)}get regions(){return this.getField(3)}get clips(){return this.getField(4)}get index(){return this.getField(10)}get type(){return this.getField(11)}get enabled(){return this.getField(20)}get excludePianoMode(){return this.getField(30)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"tracks",deprecated:!1,pointerRules:h},c.TrackCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"target",deprecated:!1,pointerRules:h},c.Automation,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"regions",deprecated:!1,pointerRules:{accepts:[c.RegionCollection],mandatory:!1}}),4:W.hook({parent:this,fieldKey:4,fieldName:"clips",deprecated:!1,pointerRules:{accepts:[c.ClipCollection],mandatory:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),11:E.create({parent:this,fieldKey:11,fieldName:"type",deprecated:!1,pointerRules:h},{values:[0,1,2,3]},""),20:$.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),30:$.create({parent:this,fieldKey:30,fieldName:"excludePianoMode",deprecated:!1,pointerRules:h},!1)}}};var Mo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventBox",pointerRules:{accepts:[c.Selection,c.NoteEventFeature],mandatory:!1}}),i)}static ClassName="NoteEventBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get pitch(){return this.getField(20)}get velocity(){return this.getField(21)}get playCount(){return this.getField(22)}get playCurve(){return this.getField(23)}get cent(){return this.getField(24)}get chance(){return this.getField(25)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn",240),20:E.create({parent:this,fieldKey:20,fieldName:"pitch",deprecated:!1,pointerRules:h},{min:0,max:127},"",60),21:b.create({parent:this,fieldKey:21,fieldName:"velocity",deprecated:!1,pointerRules:h},"unipolar","%",.7874015748031497),22:E.create({parent:this,fieldKey:22,fieldName:"playCount",deprecated:!1,pointerRules:h},{min:1,max:128},"",1),23:b.create({parent:this,fieldKey:23,fieldName:"playCurve",deprecated:!1,pointerRules:h},"bipolar","%",0),24:b.create({parent:this,fieldKey:24,fieldName:"cent",deprecated:!1,pointerRules:h},{min:-50,max:50,scaling:"linear"},"ct",0),25:E.create({parent:this,fieldKey:25,fieldName:"chance",deprecated:!1,pointerRules:h},{min:0,max:100},"",100)}}};var Pf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventRepeatBox",pointerRules:h}),i)}static ClassName="NoteEventRepeatBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventRepeatBox,this)}get event(){return this.getField(1)}get count(){return this.getField(2)}get curve(){return this.getField(3)}get length(){return this.getField(4)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:h},c.NoteEventFeature,!0),2:E.create({parent:this,fieldKey:2,fieldName:"count",deprecated:!1,pointerRules:h},{min:1,max:128},"",1),3:b.create({parent:this,fieldKey:3,fieldName:"curve",deprecated:!1,pointerRules:h},"bipolar","%",0),4:b.create({parent:this,fieldKey:4,fieldName:"length",deprecated:!1,pointerRules:h},"unipolar","%",1)}}};var Yn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="NoteEventCollectionBox";constructor(e){super(e)}accept(e){return _(e.visitNoteEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.NoteEvents],mandatory:!1}}),2:W.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.NoteEventCollection],mandatory:!0}})}}};var Za=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="NoteRegionBox";constructor(e){super(e)}accept(e){return _(e.visitNoteRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get eventOffset(){return this.getField(14)}get mute(){return this.getField(15)}get label(){return this.getField(16)}get hue(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"positive","ppqn"),14:E.create({parent:this,fieldKey:14,fieldName:"eventOffset",deprecated:!1,pointerRules:h},"any","ppqn"),15:$.create({parent:this,fieldKey:15,fieldName:"mute",deprecated:!1,pointerRules:h}),16:C.create({parent:this,fieldKey:16,fieldName:"label",deprecated:!1,pointerRules:h}),17:E.create({parent:this,fieldKey:17,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var zo=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get loop(){return this.getField(1)}get reverse(){return this.getField(2)}get mute(){return this.getField(3)}get speed(){return this.getField(4)}get quantise(){return this.getField(5)}get trigger(){return this.getField(6)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"loop",deprecated:!1,pointerRules:h},!0),2:$.create({parent:this,fieldKey:2,fieldName:"reverse",deprecated:!1,pointerRules:h}),3:$.create({parent:this,fieldKey:3,fieldName:"mute",deprecated:!0,pointerRules:h}),4:E.create({parent:this,fieldKey:4,fieldName:"speed",deprecated:!1,pointerRules:h},"non-negative",""),5:E.create({parent:this,fieldKey:5,fieldName:"quantise",deprecated:!1,pointerRules:h},"non-negative",""),6:E.create({parent:this,fieldKey:6,fieldName:"trigger",deprecated:!1,pointerRules:h},"non-negative","")}}};var vl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="NoteClipBox";constructor(e){super(e)}accept(e){return _(e.visitNoteClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.NoteEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Do=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ValueEventBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get index(){return this.getField(11)}get interpolation(){return this.getField(12)}get value(){return this.getField(13)}get slope(){return this.getField(14)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),12:E.create({parent:this,fieldKey:12,fieldName:"interpolation",deprecated:!1,pointerRules:{accepts:[c.ValueInterpolation],mandatory:!1}},{values:[0,1]},"",1),13:b.create({parent:this,fieldKey:13,fieldName:"value",deprecated:!1,pointerRules:h},"unipolar","%"),14:b.create({parent:this,fieldKey:14,fieldName:"slope",deprecated:!0,pointerRules:h},"any","",NaN)}}};var Xn=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ValueEventCollectionBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.ValueEvents],mandatory:!1}}),2:W.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.ValueEventCollection],mandatory:!0}})}}};var Io=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCurveBox",pointerRules:h}),i)}static ClassName="ValueEventCurveBox";constructor(e){super(e)}accept(e){return _(e.visitValueEventCurveBox,this)}get event(){return this.getField(1)}get slope(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:h},c.ValueInterpolation,!0),2:b.create({parent:this,fieldKey:2,fieldName:"slope",deprecated:!1,pointerRules:h},"unipolar","%",.5)}}};var Ga=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="ValueRegionBox";constructor(e){super(e)}accept(e){return _(e.visitValueRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"positive","ppqn"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:h}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:h}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var yl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="ValueClipBox";constructor(e){super(e)}accept(e){return _(e.visitValueClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"positive","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Co=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioRegionBox";constructor(e){super(e)}accept(e){return _(e.visitAudioRegionBox,this)}get regions(){return this.getField(1)}get file(){return this.getField(2)}get playback(){return this.getField(3)}get timeBase(){return this.getField(4)}get events(){return this.getField(5)}get warping(){return this.getField(6)}get waveformOffset(){return this.getField(7)}get playMode(){return this.getField(8)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:h},c.RegionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),3:C.create({parent:this,fieldKey:3,fieldName:"playback",deprecated:!0,pointerRules:h}),4:C.create({parent:this,fieldKey:4,fieldName:"timeBase",deprecated:!1,pointerRules:h},"musical"),5:B.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),6:B.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:h},c.Deprecated,!1),7:b.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:h},"any","seconds"),8:B.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:h},c.AudioPlayMode,!1),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),11:b.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:h},"any","mixed"),12:b.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:h},"any","mixed"),13:b.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:h},"any","mixed"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:h}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:h}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0"),17:b.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!1,pointerRules:h},"decibel","db")}}};var xl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioClipBox";constructor(e){super(e)}accept(e){return _(e.visitAudioClipBox,this)}get clips(){return this.getField(1)}get file(){return this.getField(2)}get index(){return this.getField(3)}get triggerMode(){return this.getField(4)}get events(){return this.getField(5)}get warping(){return this.getField(6)}get waveformOffset(){return this.getField(7)}get playMode(){return this.getField(8)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}get gain(){return this.getField(14)}get playback(){return this.getField(20)}get timeBase(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:h},c.ClipCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:zo.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:h}),5:B.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:h},c.ValueEventCollection,!0),6:B.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:h},c.Deprecated,!1),7:b.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:h},"any","seconds"),8:B.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:h},c.AudioPlayMode,!1),10:b.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:h},"any","ppqn"),11:$.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:h}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:h}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0"),14:b.create({parent:this,fieldKey:14,fieldName:"gain",deprecated:!1,pointerRules:h},"decibel","db"),20:C.create({parent:this,fieldKey:20,fieldName:"playback",deprecated:!0,pointerRules:h}),21:C.create({parent:this,fieldKey:21,fieldName:"timeBase",deprecated:!1,pointerRules:h},"musical")}}};var wl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioPitchStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0}}),i)}static ClassName="AudioPitchStretchBox";constructor(e){super(e)}accept(e){return _(e.visitAudioPitchStretchBox,this)}get warpMarkers(){return this.getField(1)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0}})}}};var bl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioTimeStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0}}),i)}static ClassName="AudioTimeStretchBox";constructor(e){super(e)}accept(e){return _(e.visitAudioTimeStretchBox,this)}get warpMarkers(){return this.getField(1)}get transientPlayMode(){return this.getField(2)}get playbackRate(){return this.getField(3)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0}}),2:E.create({parent:this,fieldKey:2,fieldName:"transientPlayMode",deprecated:!1,pointerRules:h},"positive","enum",2),3:b.create({parent:this,fieldKey:3,fieldName:"playbackRate",deprecated:!1,pointerRules:h},"positive","ratio",1)}}};var Sf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TransientMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="TransientMarkerBox";constructor(e){super(e)}accept(e){return _(e.visitTransientMarkerBox,this)}get owner(){return this.getField(1)}get position(){return this.getField(2)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.TransientMarkers,!0),2:b.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"non-negative","seconds")}}};var To=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"WarpMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="WarpMarkerBox";constructor(e){super(e)}accept(e){return _(e.visitWarpMarkerBox,this)}get owner(){return this.getField(1)}get position(){return this.getField(2)}get seconds(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.WarpMarkers,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),3:b.create({parent:this,fieldKey:3,fieldName:"seconds",deprecated:!1,pointerRules:h},"non-negative","seconds")}}};var Al=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MarkerBox",pointerRules:{accepts:[c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="MarkerBox";constructor(e){super(e)}accept(e){return _(e.visitMarkerBox,this)}get track(){return this.getField(1)}get position(){return this.getField(2)}get plays(){return this.getField(3)}get label(){return this.getField(4)}get hue(){return this.getField(5)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"track",deprecated:!1,pointerRules:h},c.MarkerTrack,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:h},"any","ppqn"),3:E.create({parent:this,fieldKey:3,fieldName:"plays",deprecated:!1,pointerRules:h},"non-negative","",1),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:h}),5:E.create({parent:this,fieldKey:5,fieldName:"hue",deprecated:!1,pointerRules:h},{min:0,max:360},"\xB0")}}};var Tr=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioFileBox",pointerRules:{accepts:[c.AudioFile,c.FileUploadState,c.MetaData],mandatory:!0}}),i)}static ClassName="AudioFileBox";constructor(e){super(e)}accept(e){return _(e.visitAudioFileBox,this)}get startInSeconds(){return this.getField(1)}get endInSeconds(){return this.getField(2)}get fileName(){return this.getField(3)}get transientMarkers(){return this.getField(10)}initializeFields(){return{1:b.create({parent:this,fieldKey:1,fieldName:"startInSeconds",deprecated:!1,pointerRules:h},"non-negative","s"),2:b.create({parent:this,fieldKey:2,fieldName:"endInSeconds",deprecated:!1,pointerRules:h},"non-negative","s"),3:C.create({parent:this,fieldKey:3,fieldName:"fileName",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"transientMarkers",deprecated:!1,pointerRules:{accepts:[c.TransientMarkers],mandatory:!1}})}}};var ei=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontFileBox",pointerRules:{accepts:[c.SoundfontFile],mandatory:!0}}),i)}static ClassName="SoundfontFileBox";constructor(e){super(e)}accept(e){return _(e.visitSoundfontFileBox,this)}get fileName(){return this.getField(1)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"fileName",deprecated:!1,pointerRules:h})}}};var it=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioUnitBox",pointerRules:{accepts:[c.Selection,c.Automation,c.MetaData],mandatory:!1}}),i)}static ClassName="AudioUnitBox";constructor(e){super(e)}accept(e){return _(e.visitAudioUnitBox,this)}get type(){return this.getField(1)}get collection(){return this.getField(2)}get editing(){return this.getField(3)}get index(){return this.getField(11)}get volume(){return this.getField(12)}get panning(){return this.getField(13)}get mute(){return this.getField(14)}get solo(){return this.getField(15)}get tracks(){return this.getField(20)}get midiEffects(){return this.getField(21)}get input(){return this.getField(22)}get audioEffects(){return this.getField(23)}get auxSends(){return this.getField(24)}get output(){return this.getField(25)}get capture(){return this.getField(26)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"type",deprecated:!1,pointerRules:h},"instrument"),2:B.create({parent:this,fieldKey:2,fieldName:"collection",deprecated:!1,pointerRules:h},c.AudioUnits,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1}}),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),12:b.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-96,mid:-9,max:6,scaling:"decibel"},"dB"),13:b.create({parent:this,fieldKey:13,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),14:$.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),15:$.create({parent:this,fieldKey:15,fieldName:"solo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),20:W.hook({parent:this,fieldKey:20,fieldName:"tracks",deprecated:!1,pointerRules:{accepts:[c.TrackCollection],mandatory:!1}}),21:W.hook({parent:this,fieldKey:21,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MidiEffectHost],mandatory:!1}}),22:W.hook({parent:this,fieldKey:22,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.InstrumentHost,c.AudioOutput],mandatory:!1}}),23:W.hook({parent:this,fieldKey:23,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1}}),24:W.hook({parent:this,fieldKey:24,fieldName:"auxSends",deprecated:!1,pointerRules:{accepts:[c.AuxSend],mandatory:!1}}),25:B.create({parent:this,fieldKey:25,fieldName:"output",deprecated:!1,pointerRules:h},c.AudioOutput,!1),26:B.create({parent:this,fieldKey:26,fieldName:"capture",deprecated:!1,pointerRules:h},c.Capture,!1)}}};var Ro=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureAudioBox",pointerRules:{accepts:[c.Capture],mandatory:!0}}),i)}static ClassName="CaptureAudioBox";constructor(e){super(e)}accept(e){return _(e.visitCaptureAudioBox,this)}get deviceId(){return this.getField(1)}get recordMode(){return this.getField(2)}get requestChannels(){return this.getField(10)}get gainDb(){return this.getField(11)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"deviceId",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:h},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"requestChannels",deprecated:!1,pointerRules:h},"any","",1),11:b.create({parent:this,fieldKey:11,fieldName:"gainDb",deprecated:!1,pointerRules:h},"decibel","dB",0)}}};var Oo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureMidiBox",pointerRules:{accepts:[c.Capture],mandatory:!0}}),i)}static ClassName="CaptureMidiBox";constructor(e){super(e)}accept(e){return _(e.visitCaptureMidiBox,this)}get deviceId(){return this.getField(1)}get recordMode(){return this.getField(2)}get channel(){return this.getField(10)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"deviceId",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:h},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"channel",deprecated:!1,pointerRules:h},"any","",-1)}}};var Ti=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioBusBox",pointerRules:h}),i)}static ClassName="AudioBusBox";constructor(e){super(e)}accept(e){return _(e.visitAudioBusBox,this)}get collection(){return this.getField(1)}get output(){return this.getField(2)}get input(){return this.getField(3)}get enabled(){return this.getField(4)}get icon(){return this.getField(5)}get label(){return this.getField(6)}get color(){return this.getField(7)}get minimized(){return this.getField(8)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.AudioBusses,!0),2:B.create({parent:this,fieldKey:2,fieldName:"output",deprecated:!1,pointerRules:h},c.AudioOutput,!0),3:W.hook({parent:this,fieldKey:3,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!1}}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:C.create({parent:this,fieldKey:5,fieldName:"icon",deprecated:!1,pointerRules:h}),6:C.create({parent:this,fieldKey:6,fieldName:"label",deprecated:!1,pointerRules:h}),7:C.create({parent:this,fieldKey:7,fieldName:"color",deprecated:!1,pointerRules:h},"red"),8:$.create({parent:this,fieldKey:8,fieldName:"minimized",deprecated:!1,pointerRules:h})}}};var qa=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AuxSendBox",pointerRules:h}),i)}static ClassName="AuxSendBox";constructor(e){super(e)}accept(e){return _(e.visitAuxSendBox,this)}get audioUnit(){return this.getField(1)}get targetBus(){return this.getField(2)}get index(){return this.getField(3)}get routing(){return this.getField(4)}get sendGain(){return this.getField(5)}get sendPan(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"audioUnit",deprecated:!1,pointerRules:h},c.AuxSend,!0),2:B.create({parent:this,fieldKey:2,fieldName:"targetBus",deprecated:!1,pointerRules:h},c.AudioOutput,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),4:E.create({parent:this,fieldKey:4,fieldName:"routing",deprecated:!1,pointerRules:h},{values:[0,1]},"",1),5:b.create({parent:this,fieldKey:5,fieldName:"sendGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB"),6:b.create({parent:this,fieldKey:6,fieldName:"sendPan",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","")}}};var _l=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"GrooveShuffleBox",pointerRules:{accepts:[c.Groove],mandatory:!0}}),i)}static ClassName="GrooveShuffleBox";constructor(e){super(e)}accept(e){return _(e.visitGrooveShuffleBox,this)}get label(){return this.getField(1)}get amount(){return this.getField(10)}get duration(){return this.getField(11)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"label",deprecated:!1,pointerRules:h}),10:b.create({parent:this,fieldKey:10,fieldName:"amount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.6),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"non-negative","ppqn",480)}}};var Ef=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownAudioEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="UnknownAudioEffectDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitUnknownAudioEffectDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get comment(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:h})}}};var Bf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownMidiEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="UnknownMidiEffectDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitUnknownMidiEffectDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get comment(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:h})}}};var Ff=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceInterfaceKnobBox",pointerRules:h}),i)}static ClassName="DeviceInterfaceKnobBox";constructor(e){super(e)}accept(e){return _(e.visitDeviceInterfaceKnobBox,this)}get userInterface(){return this.getField(1)}get parameter(){return this.getField(2)}get index(){return this.getField(3)}get anchor(){return this.getField(10)}get color(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"userInterface",deprecated:!1,pointerRules:h},c.DeviceUserInterface,!0),2:B.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:h},c.ParameterController,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),10:b.create({parent:this,fieldKey:10,fieldName:"anchor",deprecated:!1,pointerRules:h},"unipolar","%"),11:C.create({parent:this,fieldKey:11,fieldName:"color",deprecated:!1,pointerRules:h})}}};var Xf=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get elements(){return this.getField(1)}initializeFields(){return{1:W.hook({parent:this,fieldKey:1,fieldName:"elements",deprecated:!1,pointerRules:{accepts:[c.DeviceUserInterface],mandatory:!1}})}}};var Nf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ModularDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitModularDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modularSetup(){return this.getField(10)}get userInterface(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"modularSetup",deprecated:!1,pointerRules:h},c.ModularSetup,!0),11:Xf.create({parent:this,fieldKey:11,fieldName:"userInterface",deprecated:!1,pointerRules:h})}}};var kf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"StereoToolDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="StereoToolDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitStereoToolDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get panning(){return this.getField(11)}get stereo(){return this.getField(12)}get invertL(){return this.getField(13)}get invertR(){return this.getField(14)}get swap(){return this.getField(15)}get panningMixing(){return this.getField(20)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-72,mid:0,max:12,scaling:"decibel"},"dB",0),11:b.create({parent:this,fieldKey:11,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),12:b.create({parent:this,fieldKey:12,fieldName:"stereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),13:$.create({parent:this,fieldKey:13,fieldName:"invertL",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),14:$.create({parent:this,fieldKey:14,fieldName:"invertR",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),15:$.create({parent:this,fieldKey:15,fieldName:"swap",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),20:E.create({parent:this,fieldKey:20,fieldName:"panningMixing",deprecated:!1,pointerRules:h},{values:[0,1]},"",1)}}};var Pl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CompressorDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="CompressorDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitCompressorDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get lookahead(){return this.getField(10)}get automakeup(){return this.getField(11)}get autoattack(){return this.getField(12)}get autorelease(){return this.getField(13)}get inputgain(){return this.getField(14)}get threshold(){return this.getField(15)}get ratio(){return this.getField(16)}get knee(){return this.getField(17)}get attack(){return this.getField(18)}get release(){return this.getField(19)}get makeup(){return this.getField(20)}get mix(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:$.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),11:$.create({parent:this,fieldKey:11,fieldName:"automakeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!0),12:$.create({parent:this,fieldKey:12,fieldName:"autoattack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),13:$.create({parent:this,fieldKey:13,fieldName:"autorelease",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),14:b.create({parent:this,fieldKey:14,fieldName:"inputgain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-30,max:30,scaling:"linear"},"dB",0),15:b.create({parent:this,fieldKey:15,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-60,max:0,scaling:"linear"},"dB",-10),16:b.create({parent:this,fieldKey:16,fieldName:"ratio",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:24,scaling:"exponential"},"",2),17:b.create({parent:this,fieldKey:17,fieldName:"knee",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:24,scaling:"linear"},"dB",0),18:b.create({parent:this,fieldKey:18,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:100,scaling:"linear"},"ms",0),19:b.create({parent:this,fieldKey:19,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:5,max:1500,scaling:"linear"},"ms",5),20:b.create({parent:this,fieldKey:20,fieldName:"makeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-40,max:40,scaling:"linear"},"dB",0),21:b.create({parent:this,fieldKey:21,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var $f=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DelayDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="DelayDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitDelayDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get delay(){return this.getField(10)}get feedback(){return this.getField(11)}get cross(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"delay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","",4),11:b.create({parent:this,fieldKey:11,fieldName:"feedback",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),12:b.create({parent:this,fieldKey:12,fieldName:"cross",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),13:b.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),14:b.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),15:b.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var Mf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"CrusherDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="CrusherDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitCrusherDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get crush(){return this.getField(10)}get bits(){return this.getField(11)}get boost(){return this.getField(12)}get mix(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"crush",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),11:E.create({parent:this,fieldKey:11,fieldName:"bits",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:16},"bits",16),12:b.create({parent:this,fieldKey:12,fieldName:"boost",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:24,scaling:"linear"},"dB",0),13:b.create({parent:this,fieldKey:13,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var Df=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DattorroReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="DattorroReverbDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitDattorroReverbDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get preDelay(){return this.getField(10)}get bandwidth(){return this.getField(11)}get inputDiffusion1(){return this.getField(12)}get inputDiffusion2(){return this.getField(13)}get decay(){return this.getField(14)}get decayDiffusion1(){return this.getField(15)}get decayDiffusion2(){return this.getField(16)}get damping(){return this.getField(17)}get excursionRate(){return this.getField(18)}get excursionDepth(){return this.getField(19)}get wet(){return this.getField(20)}get dry(){return this.getField(21)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),11:b.create({parent:this,fieldKey:11,fieldName:"bandwidth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.9999),12:b.create({parent:this,fieldKey:12,fieldName:"inputDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.75),13:b.create({parent:this,fieldKey:13,fieldName:"inputDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.625),14:b.create({parent:this,fieldKey:14,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),15:b.create({parent:this,fieldKey:15,fieldName:"decayDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.7),16:b.create({parent:this,fieldKey:16,fieldName:"decayDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),17:b.create({parent:this,fieldKey:17,fieldName:"damping",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.005),18:b.create({parent:this,fieldKey:18,fieldName:"excursionRate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),19:b.create({parent:this,fieldKey:19,fieldName:"excursionDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.7),20:b.create({parent:this,fieldKey:20,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),21:b.create({parent:this,fieldKey:21,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var If=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"VelocityDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="VelocityDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitVelocityDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get magnetPosition(){return this.getField(10)}get magnetStrength(){return this.getField(11)}get randomSeed(){return this.getField(12)}get randomAmount(){return this.getField(13)}get offset(){return this.getField(14)}get mix(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"magnetPosition",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),11:b.create({parent:this,fieldKey:11,fieldName:"magnetStrength",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),12:E.create({parent:this,fieldKey:12,fieldName:"randomSeed",deprecated:!1,pointerRules:h},"any","",2048),13:b.create({parent:this,fieldKey:13,fieldName:"randomAmount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),14:b.create({parent:this,fieldKey:14,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),15:b.create({parent:this,fieldKey:15,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1)}}};var Cf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"FoldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="FoldDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitFoldDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get drive(){return this.getField(10)}get overSampling(){return this.getField(11)}get volume(){return this.getField(12)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"drive",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:30,scaling:"linear"},"dB",0),11:E.create({parent:this,fieldKey:11,fieldName:"overSampling",deprecated:!1,pointerRules:h},{length:3},"",0),12:b.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-18,max:0,scaling:"linear"},"dB",0)}}};var Tf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TidalDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="TidalDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitTidalDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get slope(){return this.getField(10)}get symmetry(){return this.getField(11)}get rate(){return this.getField(20)}get depth(){return this.getField(21)}get offset(){return this.getField(22)}get channelOffset(){return this.getField(23)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"slope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",-.25),11:b.create({parent:this,fieldKey:11,fieldName:"symmetry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),20:b.create({parent:this,fieldKey:20,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",3),21:b.create({parent:this,fieldKey:21,fieldName:"depth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","",1),22:b.create({parent:this,fieldKey:22,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0),23:b.create({parent:this,fieldKey:23,fieldName:"channelOffset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0)}}};var Yu=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get order(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:E.create({parent:this,fieldKey:11,fieldName:"order",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:4},""),12:b.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var Xu=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:b.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-24,max:24,scaling:"linear"},"dB")}}};var $l=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:$.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}}),10:b.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:b.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-24,max:24,scaling:"linear"},"dB"),12:b.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var Rf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RevampDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="RevampDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitRevampDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get highPass(){return this.getField(10)}get lowShelf(){return this.getField(11)}get lowBell(){return this.getField(12)}get midBell(){return this.getField(13)}get highBell(){return this.getField(14)}get highShelf(){return this.getField(15)}get lowPass(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:Yu.create({parent:this,fieldKey:10,fieldName:"highPass",deprecated:!1,pointerRules:h}),11:Xu.create({parent:this,fieldKey:11,fieldName:"lowShelf",deprecated:!1,pointerRules:h}),12:$l.create({parent:this,fieldKey:12,fieldName:"lowBell",deprecated:!1,pointerRules:h}),13:$l.create({parent:this,fieldKey:13,fieldName:"midBell",deprecated:!1,pointerRules:h}),14:$l.create({parent:this,fieldKey:14,fieldName:"highBell",deprecated:!1,pointerRules:h}),15:Xu.create({parent:this,fieldKey:15,fieldName:"highShelf",deprecated:!1,pointerRules:h}),16:Yu.create({parent:this,fieldKey:16,fieldName:"lowPass",deprecated:!1,pointerRules:h}),17:b.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-18,max:18,scaling:"linear"},"db")}}};var Of=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ReverbDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitReverbDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get decay(){return this.getField(10)}get preDelay(){return this.getField(11)}get damp(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),11:b.create({parent:this,fieldKey:11,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:.5,scaling:"exponential"},"s",0),12:b.create({parent:this,fieldKey:12,fieldName:"damp",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",.5),13:b.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%",0),14:b.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-3),15:b.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",0)}}};var em=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get waveform(){return this.getField(1)}get volume(){return this.getField(2)}get octave(){return this.getField(3)}get tune(){return this.getField(4)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"waveform",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1,2,3]},""),2:b.create({parent:this,fieldKey:2,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","db",-1/0),3:E.create({parent:this,fieldKey:3,fieldName:"octave",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-3,max:3},"oct",0),4:b.create({parent:this,fieldKey:4,fieldName:"tune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-1200,max:1200,scaling:"linear"},"ct")}}};var tm=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get waveform(){return this.getField(1)}get rate(){return this.getField(2)}get sync(){return this.getField(3)}get targetTune(){return this.getField(10)}get targetCutoff(){return this.getField(11)}get targetVolume(){return this.getField(12)}initializeFields(){return{1:E.create({parent:this,fieldKey:1,fieldName:"waveform",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1,2,3]},""),2:b.create({parent:this,fieldKey:2,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1e-4,max:30,scaling:"exponential"},"Hz",1e-4),3:$.create({parent:this,fieldKey:3,fieldName:"sync",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},!1),10:b.create({parent:this,fieldKey:10,fieldName:"targetTune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),11:b.create({parent:this,fieldKey:11,fieldName:"targetCutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),12:b.create({parent:this,fieldKey:12,fieldName:"targetVolume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%")}}};var rm=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get attack(){return this.getField(1)}get hold(){return this.getField(2)}get release(){return this.getField(3)}get volume(){return this.getField(4)}initializeFields(){return{1:b.create({parent:this,fieldKey:1,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),2:b.create({parent:this,fieldKey:2,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),3:b.create({parent:this,fieldKey:3,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),4:b.create({parent:this,fieldKey:4,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","db",.001)}}};var Sl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"VaporisateurDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="VaporisateurDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitVaporisateurDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get octave(){return this.getField(11)}get tune(){return this.getField(12)}get waveform(){return this.getField(13)}get cutoff(){return this.getField(14)}get resonance(){return this.getField(15)}get attack(){return this.getField(16)}get release(){return this.getField(17)}get filterEnvelope(){return this.getField(18)}get decay(){return this.getField(19)}get sustain(){return this.getField(20)}get glideTime(){return this.getField(21)}get voicingMode(){return this.getField(22)}get unisonCount(){return this.getField(23)}get unisonDetune(){return this.getField(24)}get unisonStereo(){return this.getField(25)}get filterOrder(){return this.getField(26)}get filterKeyboard(){return this.getField(27)}get lfo(){return this.getField(30)}get oscillators(){return this.getField(40)}get noise(){return this.getField(50)}get version(){return this.getField(99)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-6),11:E.create({parent:this,fieldKey:11,fieldName:"octave",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","oct"),12:b.create({parent:this,fieldKey:12,fieldName:"tune",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any","ct"),13:E.create({parent:this,fieldKey:13,fieldName:"waveform",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"any",""),14:b.create({parent:this,fieldKey:14,fieldName:"cutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),15:b.create({parent:this,fieldKey:15,fieldName:"resonance",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.01,max:10,scaling:"exponential"},"q"),16:b.create({parent:this,fieldKey:16,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s"),17:b.create({parent:this,fieldKey:17,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s"),18:b.create({parent:this,fieldKey:18,fieldName:"filterEnvelope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),19:b.create({parent:this,fieldKey:19,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),20:b.create({parent:this,fieldKey:20,fieldName:"sustain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),21:b.create({parent:this,fieldKey:21,fieldName:"glideTime",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),22:E.create({parent:this,fieldKey:22,fieldName:"voicingMode",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[0,1]},"",1),23:E.create({parent:this,fieldKey:23,fieldName:"unisonCount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[1,3,5]},"",1),24:b.create({parent:this,fieldKey:24,fieldName:"unisonDetune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:1200,scaling:"exponential"},"ct",30),25:b.create({parent:this,fieldKey:25,fieldName:"unisonStereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),26:E.create({parent:this,fieldKey:26,fieldName:"filterOrder",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{values:[1,2,3,4]},"",1),27:b.create({parent:this,fieldKey:27,fieldName:"filterKeyboard",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","%"),30:tm.create({parent:this,fieldKey:30,fieldName:"lfo",deprecated:!1,pointerRules:h}),40:ff.create({parent:this,fieldKey:40,fieldName:"oscillators",deprecated:!1,pointerRules:h},e=>em.create(e),2),50:rm.create({parent:this,fieldKey:50,fieldName:"noise",deprecated:!1,pointerRules:h}),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:h},"any","")}}};var im=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get id(){return this.getField(1)}get label(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"id",deprecated:!1,pointerRules:h}),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h})}}};var El=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="MIDIOutputDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get deprecatedDevice(){return this.getField(10)}get channel(){return this.getField(11)}get deprecatedDelay(){return this.getField(12)}get parameters(){return this.getField(13)}get device(){return this.getField(14)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:im.create({parent:this,fieldKey:10,fieldName:"deprecatedDevice",deprecated:!0,pointerRules:h}),11:E.create({parent:this,fieldKey:11,fieldName:"channel",deprecated:!1,pointerRules:h},{min:0,max:15},"ch"),12:E.create({parent:this,fieldKey:12,fieldName:"deprecatedDelay",deprecated:!0,pointerRules:h},"any","ms",10),13:W.hook({parent:this,fieldKey:13,fieldName:"parameters",deprecated:!1,pointerRules:{accepts:[c.Parameter],mandatory:!1}}),14:B.create({parent:this,fieldKey:14,fieldName:"device",deprecated:!1,pointerRules:h},c.MIDIDevice,!1)}}};var Ri=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputBox",pointerRules:h}),i)}static ClassName="MIDIOutputBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputBox,this)}get root(){return this.getField(1)}get device(){return this.getField(2)}get id(){return this.getField(3)}get label(){return this.getField(4)}get delayInMs(){return this.getField(5)}get sendTransportMessages(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:h},c.MIDIDevice,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!0}}),3:C.create({parent:this,fieldKey:3,fieldName:"id",deprecated:!1,pointerRules:h}),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:h}),5:E.create({parent:this,fieldKey:5,fieldName:"delayInMs",deprecated:!1,pointerRules:h},{min:0,max:500},"ms",10),6:$.create({parent:this,fieldKey:6,fieldName:"sendTransportMessages",deprecated:!1,pointerRules:h},!0)}}};var Oi=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputParameterBox",pointerRules:h}),i)}static ClassName="MIDIOutputParameterBox";constructor(e){super(e)}accept(e){return _(e.visitMIDIOutputParameterBox,this)}get owner(){return this.getField(1)}get label(){return this.getField(2)}get controller(){return this.getField(3)}get value(){return this.getField(4)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:h},c.Parameter,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h},""),3:E.create({parent:this,fieldKey:3,fieldName:"controller",deprecated:!1,pointerRules:h},{min:0,max:127},"#",64),4:b.create({parent:this,fieldKey:4,fieldName:"value",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!0}},"unipolar","%")}}};var Bl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="SoundfontDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitSoundfontDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get file(){return this.getField(10)}get presetIndex(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"file",deprecated:!1,pointerRules:h},c.SoundfontFile,!1),11:E.create({parent:this,fieldKey:11,fieldName:"presetIndex",deprecated:!1,pointerRules:h},{min:0,max:65535},"")}}};var Fl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NanoDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="NanoDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitNanoDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get file(){return this.getField(15)}get release(){return this.getField(20)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"decibel","dB",-3),15:B.create({parent:this,fieldKey:15,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!1),20:b.create({parent:this,fieldKey:20,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:8,scaling:"exponential"},"s",.1)}}};var Nl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="PlayfieldDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitPlayfieldDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get samples(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:W.hook({parent:this,fieldKey:10,fieldName:"samples",deprecated:!1,pointerRules:{accepts:[c.Sample],mandatory:!1}})}}};var Vo=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldSampleBox",pointerRules:{accepts:[c.Editing],mandatory:!1}}),i)}static ClassName="PlayfieldSampleBox";constructor(e){super(e)}accept(e){return _(e.visitPlayfieldSampleBox,this)}get device(){return this.getField(10)}get file(){return this.getField(11)}get midiEffects(){return this.getField(12)}get audioEffects(){return this.getField(13)}get index(){return this.getField(15)}get label(){return this.getField(20)}get icon(){return this.getField(21)}get enabled(){return this.getField(22)}get minimized(){return this.getField(23)}get mute(){return this.getField(40)}get solo(){return this.getField(41)}get exclude(){return this.getField(42)}get polyphone(){return this.getField(43)}get gate(){return this.getField(44)}get pitch(){return this.getField(45)}get sampleStart(){return this.getField(46)}get sampleEnd(){return this.getField(47)}get attack(){return this.getField(48)}get release(){return this.getField(49)}initializeFields(){return{10:B.create({parent:this,fieldKey:10,fieldName:"device",deprecated:!1,pointerRules:h},c.Sample,!0),11:B.create({parent:this,fieldKey:11,fieldName:"file",deprecated:!1,pointerRules:h},c.AudioFile,!0),12:W.hook({parent:this,fieldKey:12,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MidiEffectHost],mandatory:!1}}),13:W.hook({parent:this,fieldKey:13,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1}}),15:E.create({parent:this,fieldKey:15,fieldName:"index",deprecated:!1,pointerRules:h},{min:0,max:127},"",60),20:C.create({parent:this,fieldKey:20,fieldName:"label",deprecated:!1,pointerRules:h}),21:C.create({parent:this,fieldKey:21,fieldName:"icon",deprecated:!1,pointerRules:h}),22:$.create({parent:this,fieldKey:22,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),23:$.create({parent:this,fieldKey:23,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),40:$.create({parent:this,fieldKey:40,fieldName:"mute",deprecated:!1,pointerRules:h}),41:$.create({parent:this,fieldKey:41,fieldName:"solo",deprecated:!1,pointerRules:h}),42:$.create({parent:this,fieldKey:42,fieldName:"exclude",deprecated:!1,pointerRules:h}),43:$.create({parent:this,fieldKey:43,fieldName:"polyphone",deprecated:!1,pointerRules:h}),44:E.create({parent:this,fieldKey:44,fieldName:"gate",deprecated:!1,pointerRules:h},{length:3},"",0),45:b.create({parent:this,fieldKey:45,fieldName:"pitch",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-1200,max:1200,scaling:"linear"},"ct"),46:b.create({parent:this,fieldKey:46,fieldName:"sampleStart",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",0),47:b.create({parent:this,fieldKey:47,fieldName:"sampleEnd",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%",1),48:b.create({parent:this,fieldKey:48,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),49:b.create({parent:this,fieldKey:49,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:.001,max:5,scaling:"exponential"},"s",.02)}}};var kl=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TapeDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.Automation],mandatory:!1}}),i)}static ClassName="TapeDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitTapeDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get flutter(){return this.getField(10)}get wow(){return this.getField(11)}get noise(){return this.getField(12)}get saturation(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:b.create({parent:this,fieldKey:10,fieldName:"flutter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),11:b.create({parent:this,fieldKey:11,fieldName:"wow",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),12:b.create({parent:this,fieldKey:12,fieldName:"noise",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%"),13:b.create({parent:this,fieldKey:13,fieldName:"saturation",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"unipolar","%")}}};var Vf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ArpeggioDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ArpeggioDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitArpeggioDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modeIndex(){return this.getField(10)}get numOctaves(){return this.getField(11)}get rateIndex(){return this.getField(12)}get gate(){return this.getField(13)}get repeat(){return this.getField(14)}get velocity(){return this.getField(15)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:E.create({parent:this,fieldKey:10,fieldName:"modeIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:3},"",0),11:E.create({parent:this,fieldKey:11,fieldName:"numOctaves",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:5},"oct",1),12:E.create({parent:this,fieldKey:12,fieldName:"rateIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{length:17},"",9),13:b.create({parent:this,fieldKey:13,fieldName:"gate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:0,max:2,scaling:"linear"},"",1),14:E.create({parent:this,fieldKey:14,fieldName:"repeat",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:1,max:16},"",1),15:b.create({parent:this,fieldKey:15,fieldName:"velocity",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},"bipolar","",0)}}};var zf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PitchDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="PitchDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitPitchDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get semiTones(){return this.getField(10)}get cents(){return this.getField(11)}get octaves(){return this.getField(12)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:E.create({parent:this,fieldKey:10,fieldName:"semiTones",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-36,max:36},"st",0),11:b.create({parent:this,fieldKey:11,fieldName:"cents",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-50,max:50,scaling:"linear"},"ct",0),12:E.create({parent:this,fieldKey:12,fieldName:"octaves",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MidiControl],mandatory:!1}},{min:-7,max:7},"oct",0)}}};var Uf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ZeitgeistDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1}}),i)}static ClassName="ZeitgeistDeviceBox";constructor(e){super(e)}accept(e){return _(e.visitZeitgeistDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get groove(){return this.getField(10)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:h},c.MidiEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:h},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:h}),4:$.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:h},!0),5:$.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:h},!1),10:B.create({parent:this,fieldKey:10,fieldName:"groove",deprecated:!1,pointerRules:h},c.Groove,!0)}}};var jf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularBox",pointerRules:h}),i)}static ClassName="ModularBox";constructor(e){super(e)}accept(e){return _(e.visitModularBox,this)}get collection(){return this.getField(1)}get device(){return this.getField(2)}get editing(){return this.getField(3)}get modules(){return this.getField(11)}get connections(){return this.getField(12)}get label(){return this.getField(13)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ModularSetup,!0),2:W.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!0}}),3:W.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"modules",deprecated:!1,pointerRules:{accepts:[c.ModuleCollection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"connections",deprecated:!1,pointerRules:{accepts:[c.ConnectionCollection],mandatory:!1}}),13:C.create({parent:this,fieldKey:13,fieldName:"label",deprecated:!1,pointerRules:h})}}};var Lf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleConnectionBox",pointerRules:h}),i)}static ClassName="ModuleConnectionBox";constructor(e){super(e)}accept(e){return _(e.visitModuleConnectionBox,this)}get collection(){return this.getField(1)}get source(){return this.getField(2)}get target(){return this.getField(3)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ConnectionCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"source",deprecated:!1,pointerRules:h},c.VoltageConnection,!0),3:B.create({parent:this,fieldKey:3,fieldName:"target",deprecated:!1,pointerRules:h},c.VoltageConnection,!0)}}};var ti=class r extends ze{static create(e){return new r(e)}constructor(e){super(e)}get collection(){return this.getField(1)}get label(){return this.getField(2)}get x(){return this.getField(3)}get y(){return this.getField(4)}get collapsed(){return this.getField(5)}get removable(){return this.getField(6)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:h},c.ModuleCollection,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:h}),3:E.create({parent:this,fieldKey:3,fieldName:"x",deprecated:!1,pointerRules:h},"any","x"),4:E.create({parent:this,fieldKey:4,fieldName:"y",deprecated:!1,pointerRules:h},"any","y"),5:$.create({parent:this,fieldKey:5,fieldName:"collapsed",deprecated:!1,pointerRules:h},!1),6:$.create({parent:this,fieldKey:6,fieldName:"removable",deprecated:!1,pointerRules:h},!0)}}};var Kf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioInputBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModularAudioInputBox";constructor(e){super(e)}accept(e){return _(e.visitModularAudioInputBox,this)}get attributes(){return this.getField(1)}get output(){return this.getField(10)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"output",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}})}}};var Wf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioOutputBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModularAudioOutputBox";constructor(e){super(e)}accept(e){return _(e.visitModularAudioOutputBox,this)}get attributes(){return this.getField(1)}get input(){return this.getField(10)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}})}}};var Zf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleDelayBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleDelayBox";constructor(e){super(e)}accept(e){return _(e.visitModuleDelayBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(11)}get time(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"time",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1}},{min:1,max:1e3,scaling:"exponential"},"ms",500)}}};var Gf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleMultiplierBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleMultiplierBox";constructor(e){super(e)}accept(e){return _(e.visitModuleMultiplierBox,this)}get attributes(){return this.getField(1)}get voltageInputX(){return this.getField(10)}get voltageInputY(){return this.getField(11)}get voltageOutput(){return this.getField(12)}get multiplier(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInputX",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),11:W.hook({parent:this,fieldKey:11,fieldName:"voltageInputY",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"multiplier",deprecated:!1,pointerRules:h},"unipolar","%")}}};var qf=class r extends N{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleGainBox",pointerRules:{accepts:[c.Selection],mandatory:!1}}),i)}static ClassName="ModuleGainBox";constructor(e){super(e)}accept(e){return _(e.visitModuleGainBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(12)}get gain(){return this.getField(20)}initializeFields(){return{1:ti.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:h}),10:W.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),12:W.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1}}),20:b.create({parent:this,fieldKey:20,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1}},"decibel","dB")}}};var fn;(function(r){r.write=(e,t)=>{if(t.type==="none")e.disconnect(),e.setValue(0);else if(t.type==="linear")e.disconnect(),e.setValue(1);else if(t.type==="curve"){e.setValue(0);let i=e.pointerHub.filter(c.ValueInterpolation).at(0)?.box;Z(i)?(Ax(i,Io),i.slope.setValue(t.slope)):Io.create(e.box.graph,w.generate(),n=>{n.slope.setValue(t.slope),n.event.refer(e)})}},r.read=e=>{let t=e.pointerHub.incoming().at(0)?.box;return Z(t)?(Ax(t,Io),{type:"curve",slope:t.slope.getValue()}):e.getValue()===0?Fo.None:e.getValue()===1?Fo.Linear:F("Unknown Interpolation value")}})(fn||(fn={}));var Uo=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ce=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ed,Ml,ut,td,jo,rd,eo=class r{constructor(e,t){this.type="value-event",ed.set(this,new U),Ml.set(this,void 0),ut.set(this,void 0),td.set(this,void 0),jo.set(this,void 0),rd.set(this,!1),Uo(this,Ml,e,"f"),Uo(this,ut,t,"f"),Uo(this,td,Ce(this,ed,"f").own(new Zh(()=>fn.read(Ce(this,ut,"f").interpolation))),"f");let i=()=>{Ce(this,td,"f").invalidate(),this.collection.ifSome(n=>n.onEventPropertyChanged())};Ce(this,ed,"f").ownAll(Ce(this,ut,"f").subscribe(ke.Children,n=>{if(!this.collection.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let o=this.collection.unwrap(),a=n.address.fieldKeys,s=R.equals(Ce(this,ut,"f").index.address.fieldKeys,a),l=R.equals(Ce(this,ut,"f").position.address.fieldKeys,a);s||l?o.requestSorting():o.onEventPropertyChanged()}}),Ce(this,ut,"f").interpolation.subscribe(i),Ce(this,ut,"f").interpolation.pointerHub.subscribe({onAdded:({box:n})=>{Ce(this,jo,"f").terminate(),Uo(this,jo,n.subscribe(ke.Children,i),"f"),i()},onRemoved:()=>{Ce(this,jo,"f").terminate(),Uo(this,jo,K.Empty,"f"),i()}})),Uo(this,jo,Ce(this,ut,"f").interpolation.pointerHub.filter(c.ValueInterpolation).at(0)?.box.subscribe(ke.Children,i)??K.Empty,"f")}onSelected(){Uo(this,rd,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Uo(this,rd,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Ce(this,jo,"f").terminate(),Ce(this,ed,"f").terminate()}get box(){return Ce(this,ut,"f")}get uuid(){return Ce(this,ut,"f").address.uuid}get address(){return Ce(this,ut,"f").address}get position(){return Ce(this,ut,"f").position.getValue()}get index(){return Ce(this,ut,"f").index.getValue()}set interpolation(e){fn.write(Ce(this,ut,"f").interpolation,e)}get interpolation(){return Ce(this,td,"f").get()}get value(){return Ce(this,ut,"f").value.getValue()}get isSelected(){return Ce(this,rd,"f")}get collection(){return Ce(this,ut,"f").events.targetVertex.map(e=>Ce(this,Ml,"f").boxAdapters.adapterFor(e.box,cr))}copyTo(e){let t=Do.create(Ce(this,Ml,"f").boxGraph,w.generate(),i=>{i.position.setValue(e?.position??this.position),i.index.setValue(e?.index??this.index),i.events.refer(e?.events??this.collection.unwrap().box.events),i.value.setValue(e?.value??this.value)});return fn.write(t.interpolation,e?.interpolation??this.interpolation),Ce(this,Ml,"f").boxAdapters.adapterFor(t,r)}copyFrom(e){return Ce(this,ut,"f").position.setValue(e?.position??this.position),Ce(this,ut,"f").index.setValue(e?.index??this.index),Ce(this,ut,"f").events.refer(e?.events??this.collection.unwrap().box.events),Ce(this,ut,"f").value.setValue(e?.value??this.value),fn.write(Ce(this,ut,"f").interpolation,e?.interpolation??this.interpolation),this}toString(){return`{ValueEventBoxAdapter position: ${this.position} index: ${this.index}}`}};ed=new WeakMap,Ml=new WeakMap,ut=new WeakMap,td=new WeakMap,jo=new WeakMap,rd=new WeakMap;eo.Comparator=(r,e)=>{let t=r.position-e.position;if(t!==0)return t;let i=r.index-e.index;if(i!==0)return i;throw new Error(`${r} and ${e} are identical in terms of comparison`)};var id=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Te=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},nd,od,Lo,ri,Ha,ad,to,nm,cr=class r{constructor(e,t){nd.add(this),od.set(this,new U),Lo.set(this,void 0),ri.set(this,void 0),Ha.set(this,void 0),ad.set(this,void 0),to.set(this,void 0),id(this,Lo,e,"f"),id(this,ri,t,"f"),id(this,Ha,new re,"f"),id(this,ad,w.newSet(n=>n.uuid),"f"),id(this,to,xr.create(eo.Comparator),"f");let i=n=>{let o=ee(n.accept({visitValueEventBox:a=>Te(this,Lo,"f").boxAdapters.adapterFor(a,eo)}),`Could not find adapter for ${n}`);Te(this,ad,"f").add(o)&&(Te(this,to,"f").add(o),Te(this,nd,"m",nm).call(this))};Te(this,ri,"f").events.pointerHub.incoming().forEach(({box:n})=>i(n)),Te(this,od,"f").own(Te(this,ri,"f").events.pointerHub.subscribe({onAdded:({box:n})=>i(n),onRemoved:({box:{address:{uuid:n}}})=>{Te(this,to,"f").remove(Te(this,ad,"f").removeByKey(n)),Te(this,nd,"m",nm).call(this)}})),Te(this,od,"f").own(Te(this,ri,"f").owners.pointerHub.subscribe({onAdded:()=>Te(this,Ha,"f").notify(this),onRemoved:()=>Te(this,Ha,"f").notify(this)}))}valueAt(e,t){return pf.valueAt(Te(this,to,"f"),e,t)}copy(){let e=Te(this,Lo,"f").boxGraph,t=Xn.create(e,w.generate());return Te(this,to,"f").asArray().forEach(i=>i.copyTo({events:t.events})),Te(this,Lo,"f").boxAdapters.adapterFor(t,r)}cut(e){let t=this.events.lowerEqual(e),i=this.events.greaterEqual(e);if(i===null)return t===null?g.None:g.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t===null)return g.wrap(this.createEvent({position:e,value:i.value,index:i.index,interpolation:i.interpolation}));if(t.position===e)return g.wrap(t);if(t.interpolation.type==="none")return g.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t.interpolation.type==="linear"){let{position:n,value:o}=t,{position:a,value:s}=i;return g.wrap(this.createEvent({position:e,value:Gh(o,s,(e-n)/(a-n)),index:0,interpolation:t.interpolation}))}if(t.interpolation.type==="curve"){let{position:n,value:o}=t,{position:a,value:s}=i,l=a-n,u=e-n,p=Yr.byHalf(l,o,Yr.valueAt({slope:t.interpolation.slope,steps:l,y0:o,y1:s},l*.5),s),d=Yr.valueAt(p,u),f=Yr.slopeByHalf(o,Yr.valueAt(p,u*.5),d);return fn.write(t.box.interpolation,Fo.Curve(f)),g.wrap(this.createEvent({position:e,value:d,index:0,interpolation:Fo.Curve(Yr.slopeByHalf(d,Yr.valueAt(p,(u+l)*.5),s))}))}return F("Unknown interpolation type")}subscribeChange(e){return Te(this,Ha,"f").subscribe(e)}createEvent({position:e,index:t,value:i,interpolation:n}){let o=Do.create(Te(this,Lo,"f").boxGraph,w.generate(),a=>{a.position.setValue(e),a.index.setValue(t),a.value.setValue(i),a.events.refer(Te(this,ri,"f").events)});return fn.write(o.interpolation,n),Te(this,Lo,"f").boxAdapters.adapterFor(o,eo)}requestSorting(){Te(this,to,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Te(this,nd,"m",nm).call(this)}terminate(){Te(this,od,"f").terminate()}get box(){return Te(this,ri,"f")}get uuid(){return Te(this,ri,"f").address.uuid}get address(){return Te(this,ri,"f").address}get numOwners(){return Te(this,ri,"f").owners.pointerHub.filter(c.ValueEventCollection).length}get events(){return Te(this,to,"f")}toString(){return`{ValueEventCollectionBox ${w.toString(Te(this,ri,"f").address.uuid)}}`}};od=new WeakMap,Lo=new WeakMap,ri=new WeakMap,Ha=new WeakMap,ad=new WeakMap,to=new WeakMap,nd=new WeakSet,nm=function(){Te(this,Ha,"f").notify(this)};var Ja=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},_e=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Qa,Ko,Ya,Et,Xa,cd,sd,ld,Dl,Wo=class{constructor(e,t){Qa.add(this),this.type="value-clip",Ko.set(this,new U),Ya.set(this,void 0),Et.set(this,void 0),Xa.set(this,void 0),cd.set(this,void 0),sd.set(this,void 0),ld.set(this,K.Empty),Ja(this,Ya,e,"f"),Ja(this,Et,t,"f"),Ja(this,sd,!0,"f"),Ja(this,Xa,_e(this,Ko,"f").own(new Cr(!1)),"f"),Ja(this,cd,_e(this,Ko,"f").own(new re),"f"),_e(this,Ko,"f").own(_e(this,Et,"f").pointerHub.subscribe({onAdded:()=>_e(this,Qa,"m",Dl).call(this),onRemoved:()=>_e(this,Qa,"m",Dl).call(this)})),_e(this,Ko,"f").own(_e(this,Et,"f").subscribe(ke.Children,i=>_e(this,Qa,"m",Dl).call(this))),_e(this,Ko,"f").own(_e(this,Et,"f").events.catchupAndSubscribe(({targetVertex:i})=>{_e(this,ld,"f").terminate(),Ja(this,ld,i.match({none:()=>K.Empty,some:({box:n})=>_e(this,Ya,"f").boxAdapters.adapterFor(n,cr).subscribeChange(()=>_e(this,Qa,"m",Dl).call(this))}),"f"),_e(this,Qa,"m",Dl).call(this)})),Ja(this,sd,!1,"f")}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(e%this.duration,t)}catchupAndSubscribeSelected(e){return _e(this,Xa,"f").catchupAndSubscribe(e)}subscribeChange(e){return _e(this,cd,"f").subscribe(e)}accept(e){return _(e.visitValueClipBoxAdapter,this)}consolidate(){this.isMirrowed&&_e(this,Et,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:_e(this,Et,"f").events.targetVertex.unwrap();yl.create(_e(this,Ya,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(_e(this,Et,"f").clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){_e(this,Xa,"f").setValue(!0)}onDeselected(){_e(this,Xa,"f").setValue(!1)}get isSelected(){return _e(this,Xa,"f").getValue()}terminate(){_e(this,ld,"f").terminate(),_e(this,Ko,"f").terminate()}get box(){return _e(this,Et,"f")}get uuid(){return _e(this,Et,"f").address.uuid}get address(){return _e(this,Et,"f").address}get indexField(){return _e(this,Et,"f").index}get duration(){return _e(this,Et,"f").duration.getValue()}get mute(){return _e(this,Et,"f").mute.getValue()}get hue(){return _e(this,Et,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return _e(this,Et,"f").events.targetVertex.map(e=>_e(this,Ya,"f").boxAdapters.adapterFor(e.box,cr))}get label(){return _e(this,Et,"f").label.getValue()}get trackBoxAdapter(){return _e(this,sd,"f")?g.None:_e(this,Et,"f").clips.targetVertex.map(e=>_e(this,Ya,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{ValueClipBoxAdapter ${w.toString(_e(this,Et,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Ko=new WeakMap,Ya=new WeakMap,Et=new WeakMap,Xa=new WeakMap,cd=new WeakMap,sd=new WeakMap,ld=new WeakMap,Qa=new WeakSet,Dl=function(){_e(this,cd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var OP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Il=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Zx,es,om,Cl=class{constructor(e){this.type="transient-marker",Zx.set(this,new U),es.set(this,void 0),om.set(this,void 0),OP(this,es,e,"f"),OP(this,om,new re,"f")}get box(){return Il(this,es,"f")}get uuid(){return Il(this,es,"f").address.uuid}get address(){return Il(this,es,"f").address}get position(){return Il(this,es,"f").position.getValue()}subscribe(e){return Il(this,om,"f").subscribe(e)}terminate(){Il(this,Zx,"f").terminate()}};Zx=new WeakMap,es=new WeakMap,om=new WeakMap;var ud=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Kt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},am,dd,mn,pd,Tl,sm,Vi=class r{constructor(e,t){am.set(this,new U),dd.set(this,void 0),mn.set(this,void 0),pd.set(this,void 0),Tl.set(this,void 0),sm.set(this,void 0),ud(this,dd,e,"f"),ud(this,mn,t,"f"),ud(this,pd,w.newSet(({uuid:i})=>i),"f"),ud(this,Tl,xr.create(r.Comparator),"f"),ud(this,sm,yf.memoizeAsync(async()=>{if(this.data.nonEmpty())return this.data.unwrap();let{promise:i,resolve:n,reject:o}=Promise.withResolvers(),a=this.getOrCreateLoader(),s=a.subscribe(l=>{l.type==="loaded"?(s.terminate(),n(a.data.unwrap("State mismatch"))):l.type==="error"&&(s.terminate(),o(l.reason))});return i}),"f"),Kt(this,am,"f").own(t.transientMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Kt(this,dd,"f").boxAdapters.adapterFor(i.box,Cl);Kt(this,pd,"f").add(n)&&Kt(this,Tl,"f").add(n)},onRemoved:({box:{address:{uuid:i}}})=>{Kt(this,Tl,"f").remove(Kt(this,pd,"f").removeByKey(i))}}))}get box(){return Kt(this,mn,"f")}get uuid(){return Kt(this,mn,"f").address.uuid}get address(){return Kt(this,mn,"f").address}get startInSeconds(){return Kt(this,mn,"f").startInSeconds.getValue()}get endInSeconds(){return Kt(this,mn,"f").endInSeconds.getValue()}get transients(){return Kt(this,Tl,"f")}get fileName(){return Kt(this,mn,"f").fileName.getValue()}get data(){return this.getOrCreateLoader().data}get peaks(){return this.getOrCreateLoader().peaks}get audioData(){return Kt(this,sm,"f").call(this)}getOrCreateLoader(){return Kt(this,dd,"f").sampleManager.getOrCreate(Kt(this,mn,"f").address.uuid)}terminate(){Kt(this,am,"f").terminate()}};am=new WeakMap,dd=new WeakMap,mn=new WeakMap,pd=new WeakMap,Tl=new WeakMap,sm=new WeakMap;Vi.Comparator=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),F("Events at the same position: "+r.position+", "+e.position)):t};var hd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ur=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fd,lm,cm,ro,gd,md,um,Zo=class{constructor(e,t){fd.add(this),this.type="warp-marker",lm.set(this,new U),cm.set(this,void 0),ro.set(this,void 0),gd.set(this,void 0),md.set(this,!1),hd(this,cm,e,"f"),hd(this,ro,t,"f"),hd(this,gd,new re,"f"),ur(this,lm,"f").own(t.subscribe(ke.Children,()=>ur(this,fd,"m",um).call(this)))}onSelected(){hd(this,md,!0,"f"),this.optWarping.ifSome(e=>e.onChanged()),ur(this,fd,"m",um).call(this)}onDeselected(){hd(this,md,!1,"f"),ur(this,fd,"m",um).call(this)}get box(){return ur(this,ro,"f")}get uuid(){return ur(this,ro,"f").address.uuid}get address(){return ur(this,ro,"f").address}get position(){return ur(this,ro,"f").position.getValue()}get seconds(){return ur(this,ro,"f").seconds.getValue()}get isSelected(){return ur(this,md,"f")}get optWarping(){return ur(this,ro,"f").owner.targetVertex.map(e=>ur(this,cm,"f").boxAdapters.adapterFor(e.box,gn.isAudioPlayMode))}get isAnchor(){return this.optWarping.mapOr(({warpMarkers:e})=>this===e.optAt(0)||this===e.optAt(e.length()-1),!1)}subscribe(e){return ur(this,gd,"f").subscribe(e)}terminate(){ur(this,lm,"f").terminate()}};lm=new WeakMap,cm=new WeakMap,ro=new WeakMap,gd=new WeakMap,md=new WeakMap,fd=new WeakSet,um=function(){ur(this,gd,"f").notify(),this.optWarping.ifSome(e=>e.onChanged())};var dm=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),F("Events at the same position: "+r.position+", "+e.position)):t};var vd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Jt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pm,hm,ts,rs,yd,Rl,vn=class{constructor(e,t){pm.set(this,new U),hm.set(this,void 0),ts.set(this,void 0),rs.set(this,void 0),yd.set(this,void 0),Rl.set(this,void 0),vd(this,hm,e,"f"),vd(this,ts,t,"f"),vd(this,rs,new re,"f"),vd(this,yd,w.newSet(({uuid:i})=>i),"f"),vd(this,Rl,xr.create(dm),"f"),Jt(this,pm,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Jt(this,hm,"f").boxAdapters.adapterFor(i.box,Zo);Jt(this,yd,"f").add(n)&&(Jt(this,Rl,"f").add(n),Jt(this,rs,"f").notify())},onRemoved:({box:{address:{uuid:i}}})=>{Jt(this,Rl,"f").remove(Jt(this,yd,"f").removeByKey(i)),Jt(this,rs,"f").notify()}}))}get box(){return Jt(this,ts,"f")}get uuid(){return Jt(this,ts,"f").address.uuid}get address(){return Jt(this,ts,"f").address}get warpMarkers(){return Jt(this,Rl,"f")}clone(){let e=wl.create(Jt(this,ts,"f").graph,w.generate());return this.warpMarkers.asArray().forEach(t=>To.create(e.graph,w.generate(),i=>{i.position.setValue(t.position),i.seconds.setValue(t.seconds),i.owner.refer(e.warpMarkers)})),e}subscribe(e){return Jt(this,rs,"f").subscribe(e)}onChanged(){Jt(this,rs,"f").notify()}terminate(){Jt(this,pm,"f").terminate()}};pm=new WeakMap,hm=new WeakMap,ts=new WeakMap,rs=new WeakMap,yd=new WeakMap,Rl=new WeakMap;var xd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Bt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fm,mm,zi,is,wd,Ol,yn=class{constructor(e,t){fm.set(this,new U),mm.set(this,void 0),zi.set(this,void 0),is.set(this,void 0),wd.set(this,void 0),Ol.set(this,void 0),xd(this,mm,e,"f"),xd(this,zi,t,"f"),xd(this,is,new re,"f"),xd(this,wd,w.newSet(({uuid:i})=>i),"f"),xd(this,Ol,xr.create(dm),"f"),Bt(this,fm,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:i=>{let n=Bt(this,mm,"f").boxAdapters.adapterFor(i.box,Zo);Bt(this,wd,"f").add(n)&&(Bt(this,Ol,"f").add(n),Bt(this,is,"f").notify())},onRemoved:({box:{address:{uuid:i}}})=>{Bt(this,Ol,"f").remove(Bt(this,wd,"f").removeByKey(i)),Bt(this,is,"f").notify()}}))}get box(){return Bt(this,zi,"f")}get uuid(){return Bt(this,zi,"f").address.uuid}get address(){return Bt(this,zi,"f").address}get warpMarkers(){return Bt(this,Ol,"f")}get playbackRate(){return Bt(this,zi,"f").playbackRate.getValue()}get cents(){return Math.log2(Bt(this,zi,"f").playbackRate.getValue())*1200}set cents(e){Bt(this,zi,"f").playbackRate.setValue(le(2**(e/1200),.5,2))}get transientPlayMode(){return Jr(Bt(this,zi,"f").transientPlayMode.getValue(),ko)}clone(){let e=bl.create(Bt(this,zi,"f").graph,w.generate(),t=>{t.transientPlayMode.setValue(this.transientPlayMode),t.playbackRate.setValue(this.playbackRate),t.warpMarkers});return this.warpMarkers.asArray().forEach(t=>To.create(e.graph,w.generate(),i=>{i.position.setValue(t.position),i.seconds.setValue(t.seconds),i.owner.refer(e.warpMarkers)})),e}subscribe(e){return Bt(this,is,"f").subscribe(e)}onChanged(){Bt(this,is,"f").notify()}terminate(){Bt(this,fm,"f").terminate()}};fm=new WeakMap,mm=new WeakMap,zi=new WeakMap,is=new WeakMap,wd=new WeakMap,Ol=new WeakMap;var gn;(function(r){r.isAudioPlayMode=e=>e instanceof vn||e instanceof yn})(gn||(gn={}));var Rr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},oe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ns,Vl,os,dt,as,ss,bd,_d,Ad,ls,zl,Ul,jl,io=class r{constructor(e,t){ns.add(this),this.type="audio-clip",Vl.set(this,new U),os.set(this,void 0),dt.set(this,void 0),as.set(this,void 0),ss.set(this,void 0),bd.set(this,void 0),_d.set(this,void 0),Ad.set(this,void 0),ls.set(this,g.None),zl.set(this,g.None),Ul.set(this,K.Empty),Rr(this,os,e,"f"),Rr(this,dt,t,"f"),Rr(this,Ad,!0,"f"),Rr(this,as,new Xr,"f"),Rr(this,ss,oe(this,Vl,"f").own(new Cr(!1)),"f"),Rr(this,bd,Bo.aware(e.tempoMap,t.timeBase,r.STATIC_POSITION,t.duration),"f"),Rr(this,_d,oe(this,Vl,"f").own(new re),"f"),oe(this,Vl,"f").ownAll(oe(this,dt,"f").pointerHub.subscribe({onAdded:()=>oe(this,ns,"m",jl).call(this),onRemoved:()=>oe(this,ns,"m",jl).call(this)}),oe(this,dt,"f").playMode.catchupAndSubscribe(({targetVertex:i})=>{oe(this,Ul,"f").terminate(),i.match({none:()=>oe(this,as,"f").clear(),some:({box:n})=>{let o=oe(this,os,"f").boxAdapters.adapterFor(n,gn.isAudioPlayMode);Rr(this,Ul,o.subscribe(()=>oe(this,ns,"m",jl).call(this)),"f"),oe(this,as,"f").wrap(o)}})}),oe(this,dt,"f").file.catchupAndSubscribe(i=>{Rr(this,ls,i.targetVertex.map(n=>oe(this,os,"f").boxAdapters.adapterFor(n.box,Vi)),"f"),oe(this,zl,"f").ifSome(n=>n.terminate()),Rr(this,zl,oe(this,ls,"f").map(n=>n.getOrCreateLoader().subscribe(()=>oe(this,ns,"m",jl).call(this))),"f")}),oe(this,dt,"f").subscribe(ke.Children,i=>oe(this,ns,"m",jl).call(this))),Rr(this,Ad,!1,"f")}catchupAndSubscribeSelected(e){return oe(this,ss,"f").catchupAndSubscribe(e)}subscribeChange(e){return oe(this,_d,"f").subscribe(e)}accept(e){return _(e.visitAudioClipBoxAdapter,this)}consolidate(){}clone(e){let t=this.observableOptPlayMode.map(i=>i.clone());xl.create(oe(this,os,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.gain.setValue(this.gain.getValue()),i.timeBase.setValue(this.timeBase),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(oe(this,dt,"f").clips.targetVertex.unwrap()),i.file.refer(oe(this,dt,"f").file.targetVertex.unwrap()),i.events.refer(oe(this,dt,"f").events.targetVertex.unwrap()),t.ifSome(n=>i.playMode.refer(n))})}onSelected(){oe(this,ss,"f").setValue(!0)}onDeselected(){oe(this,ss,"f").setValue(!1)}get isSelected(){return oe(this,ss,"f").getValue()}get box(){return oe(this,dt,"f")}get uuid(){return oe(this,dt,"f").address.uuid}get address(){return oe(this,dt,"f").address}get indexField(){return oe(this,dt,"f").index}get duration(){return oe(this,bd,"f").toPPQN()}set duration(e){oe(this,bd,"f").fromPPQN(e)}get mute(){return oe(this,dt,"f").mute.getValue()}get hue(){return oe(this,dt,"f").hue.getValue()}get gain(){return oe(this,dt,"f").gain}get file(){return oe(this,ls,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return oe(this,as,"f")}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return g.None}get timeBase(){return Jr(oe(this,dt,"f").timeBase.getValue(),sr)}get waveformOffset(){return oe(this,dt,"f").waveformOffset}get isPlayModeNoStretch(){return oe(this,dt,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>Ie(e,vn)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>Ie(e,yn)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>gn.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(oe(this,ls,"f").isEmpty())return"No Audio File";let e=oe(this,ls,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):oe(this,dt,"f").label.getValue()}get trackBoxAdapter(){return oe(this,Ad,"f")?g.None:oe(this,dt,"f").clips.targetVertex.map(e=>oe(this,os,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return!1}get canMirror(){return!1}get canResize(){return oe(this,as,"f").nonEmpty()}terminate(){oe(this,zl,"f").ifSome(e=>e.terminate()),Rr(this,zl,g.None,"f"),oe(this,Ul,"f").terminate(),Rr(this,Ul,K.Empty,"f"),oe(this,Vl,"f").terminate()}toString(){return`{AudioClipBoxAdapter ${w.toString(oe(this,dt,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Vl=new WeakMap,os=new WeakMap,dt=new WeakMap,as=new WeakMap,ss=new WeakMap,bd=new WeakMap,_d=new WeakMap,Ad=new WeakMap,ls=new WeakMap,zl=new WeakMap,Ul=new WeakMap,ns=new WeakSet,jl=function(){oe(this,_d,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};io.STATIC_POSITION={getValue:()=>0};var Pd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},yt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ll,Dt,gm,Sd,cs=class r{constructor(e,t){this.type="note-event",Ll.set(this,void 0),Dt.set(this,void 0),gm.set(this,void 0),Sd.set(this,!1),Pd(this,Ll,e,"f"),Pd(this,Dt,t,"f"),Pd(this,gm,yt(this,Dt,"f").subscribe(ke.Children,i=>{if(!this.collection.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.collection.unwrap(),o=i.address.fieldKeys,a=R.equals(yt(this,Dt,"f").pitch.address.fieldKeys,o),s=R.equals(yt(this,Dt,"f").position.address.fieldKeys,o);a||s?n.requestSorting():n.onEventPropertyChanged()}}),"f")}onSelected(){Pd(this,Sd,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Pd(this,Sd,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){yt(this,gm,"f").terminate()}get box(){return yt(this,Dt,"f")}get uuid(){return yt(this,Dt,"f").address.uuid}get address(){return yt(this,Dt,"f").address}get position(){return yt(this,Dt,"f").position.getValue()}get duration(){return yt(this,Dt,"f").duration.getValue()}get complete(){return this.position+this.duration}get velocity(){return yt(this,Dt,"f").velocity.getValue()}get pitch(){return yt(this,Dt,"f").pitch.getValue()}get cent(){return yt(this,Dt,"f").cent.getValue()}get chance(){return yt(this,Dt,"f").chance.getValue()}get playCount(){return yt(this,Dt,"f").playCount.getValue()}get playCurve(){return yt(this,Dt,"f").playCurve.getValue()}get isSelected(){return yt(this,Sd,"f")}get collection(){return yt(this,Dt,"f").events.targetVertex.map(e=>yt(this,Ll,"f").boxAdapters.adapterFor(e.box,ii))}normalizedPitch(){if(this.collection.isEmpty())return .5;let{minPitch:e,maxPitch:t}=this.collection.unwrap();return e===t?.5:1-(this.pitch-e)/(t-e)}copyAsNoteEvent(){return{type:"note-event",position:this.position,duration:this.duration,pitch:this.pitch,cent:this.cent,velocity:this.velocity}}copyTo(e){return yt(this,Ll,"f").boxAdapters.adapterFor(Mo.create(yt(this,Ll,"f").boxGraph,w.generate(),t=>{t.position.setValue(e?.position??this.position),t.duration.setValue(e?.duration??this.duration),t.pitch.setValue(e?.pitch??this.pitch),t.playCount.setValue(e?.playCount??this.playCount),t.events.refer(e?.events??this.collection.unwrap().box.events),t.velocity.setValue(this.velocity),t.cent.setValue(this.cent),t.chance.setValue(this.chance)}),r)}computeCurveValue(e){return ar.curveFunc(e,this.playCurve)}canConsolidate(){return this.playCount>1}consolidate(){let e=this.playCount,t=this.collection.unwrap().box.events,i=R.create(n=>{let o=Math.floor(this.computeCurveValue(n/e)*this.duration),a=Math.floor(this.computeCurveValue((n+1)/e)*this.duration);return this.copyTo({position:Math.floor(this.position+o),duration:Math.max(1,a-o),playCount:1,events:t})},e);return yt(this,Dt,"f").delete(),i}};Ll=new WeakMap,Dt=new WeakMap,gm=new WeakMap,Sd=new WeakMap;var xn=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},me=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},no,Ed,Go,Ui,us,Bd,ni,ym,xm,wm,qo,vm,Fd,ii=class r{constructor(e,t){no.add(this),Ed.set(this,new U),Go.set(this,void 0),Ui.set(this,void 0),us.set(this,void 0),Bd.set(this,void 0),ni.set(this,void 0),ym.set(this,60),xm.set(this,60),wm.set(this,0),qo.set(this,!1),xn(this,Go,e,"f"),xn(this,Ui,t,"f"),xn(this,us,new re,"f"),xn(this,Bd,w.newSet(i=>i.uuid),"f"),xn(this,ni,xr.create(ar.Comparator),"f"),me(this,Ed,"f").own(me(this,Ui,"f").events.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{let n=me(this,Go,"f").boxAdapters.adapterFor(i,cs);me(this,Bd,"f").add(n)&&(me(this,ni,"f").add(n),me(this,no,"m",vm).call(this))},onRemoved:({box:{address:{uuid:i}}})=>{me(this,ni,"f").remove(me(this,Bd,"f").removeByKey(i)),me(this,no,"m",vm).call(this)}})),me(this,Ed,"f").own(me(this,Ui,"f").owners.pointerHub.subscribe({onAdded:()=>me(this,us,"f").notify(this),onRemoved:()=>me(this,us,"f").notify(this)}))}copy(){let e=me(this,Go,"f").boxGraph,t=Yn.create(e,w.generate());return me(this,ni,"f").asArray().forEach(i=>i.copyTo({events:t.events})),me(this,Go,"f").boxAdapters.adapterFor(t,r)}createEvent({position:e,duration:t,velocity:i,pitch:n,chance:o,playCount:a,cent:s}){return me(this,Go,"f").boxAdapters.adapterFor(Mo.create(me(this,Go,"f").boxGraph,w.generate(),l=>{l.position.setValue(e),l.duration.setValue(t),l.velocity.setValue(i),l.pitch.setValue(n),l.chance.setValue(o),l.playCount.setValue(a),l.cent.setValue(s),l.events.refer(me(this,Ui,"f").events)}),cs)}subscribeChange(e){return me(this,us,"f").subscribe(e)}selectable(){return me(this,ni,"f").asArray()}selectableAt(e){for(let t of me(this,ni,"f").asArray())if(t.position<=e.u&&e.u<t.complete&&t.pitch===e.v)return Xe.one(t);return Xe.empty()}selectablesBetween(e,t){let i=[];for(let n of me(this,ni,"f").asArray())Ru.intersect1D(n.position,n.complete,e.u,t.u)&&Ru.intersect1D(n.pitch,n.pitch,e.v,t.v)&&i.push(n);return i}requestSorting(){me(this,ni,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){me(this,no,"m",vm).call(this)}terminate(){me(this,Ed,"f").terminate()}get box(){return me(this,Ui,"f")}get uuid(){return me(this,Ui,"f").address.uuid}get address(){return me(this,Ui,"f").address}get numOwners(){return me(this,Ui,"f").owners.pointerHub.filter(c.NoteEventCollection).length}get events(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,ni,"f")}get minPitch(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,ym,"f")}get maxPitch(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,xm,"f")}get maxDuration(){return me(this,qo,"f")||me(this,no,"m",Fd).call(this),me(this,wm,"f")}toString(){return`{NoteEventCollectionBox ${w.toString(me(this,Ui,"f").address.uuid)}}`}};Ed=new WeakMap,Go=new WeakMap,Ui=new WeakMap,us=new WeakMap,Bd=new WeakMap,ni=new WeakMap,ym=new WeakMap,xm=new WeakMap,wm=new WeakMap,qo=new WeakMap,no=new WeakSet,vm=function(){xn(this,qo,!1,"f"),me(this,us,"f").notify(this)},Fd=function(){let e=127,t=0,i=0;me(this,ni,"f").asArray().forEach(({pitch:n,duration:o})=>{e=Math.min(e,n),t=Math.max(t,n),i=Math.max(i,o)}),xn(this,ym,e,"f"),xn(this,xm,t,"f"),xn(this,wm,i,"f"),xn(this,qo,!0,"f")};var ds=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ee=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ps,Kl,hs,Ft,fs,$d,Nd,kd,Wl,Zl=class{constructor(e,t){ps.add(this),this.type="note-clip",Kl.set(this,new U),hs.set(this,void 0),Ft.set(this,void 0),fs.set(this,void 0),$d.set(this,void 0),Nd.set(this,void 0),kd.set(this,K.Empty),ds(this,hs,e,"f"),ds(this,Ft,t,"f"),ds(this,Nd,!0,"f"),ds(this,fs,Ee(this,Kl,"f").own(new Cr(!1)),"f"),ds(this,$d,Ee(this,Kl,"f").own(new re),"f"),Ee(this,Kl,"f").ownAll(Ee(this,Ft,"f").pointerHub.subscribe({onAdded:()=>Ee(this,ps,"m",Wl).call(this),onRemoved:()=>Ee(this,ps,"m",Wl).call(this)}),Ee(this,Ft,"f").subscribe(ke.Children,i=>Ee(this,ps,"m",Wl).call(this)),Ee(this,Ft,"f").events.catchupAndSubscribe(({targetVertex:i})=>{Ee(this,kd,"f").terminate(),ds(this,kd,i.match({none:()=>K.Empty,some:({box:n})=>Ee(this,hs,"f").boxAdapters.adapterFor(n,ii).subscribeChange(()=>Ee(this,ps,"m",Wl).call(this))}),"f"),Ee(this,ps,"m",Wl).call(this)})),ds(this,Nd,!1,"f")}catchupAndSubscribeSelected(e){return Ee(this,fs,"f").catchupAndSubscribe(e)}subscribeChange(e){return Ee(this,$d,"f").subscribe(e)}accept(e){return _(e.visitNoteClipBoxAdapter,this)}consolidate(){this.isMirrowed&&Ee(this,Ft,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:Ee(this,Ft,"f").events.targetVertex.unwrap();vl.create(Ee(this,hs,"f").boxGraph,w.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(Ee(this,Ft,"f").clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){Ee(this,fs,"f").setValue(!0)}onDeselected(){Ee(this,fs,"f").setValue(!1)}get isSelected(){return Ee(this,fs,"f").getValue()}terminate(){Ee(this,kd,"f").terminate(),Ee(this,Kl,"f").terminate()}get box(){return Ee(this,Ft,"f")}get uuid(){return Ee(this,Ft,"f").address.uuid}get address(){return Ee(this,Ft,"f").address}get indexField(){return Ee(this,Ft,"f").index}get duration(){return Ee(this,Ft,"f").duration.getValue()}get mute(){return Ee(this,Ft,"f").mute.getValue()}get hue(){return Ee(this,Ft,"f").hue.getValue()}get events(){return this.optCollection.map(e=>e.events)}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return Ee(this,Ft,"f").events.targetVertex.map(e=>Ee(this,hs,"f").boxAdapters.adapterFor(e.box,ii))}get label(){return Ee(this,Ft,"f").label.getValue()}get trackBoxAdapter(){return Ee(this,Nd,"f")?g.None:Ee(this,Ft,"f").clips.targetVertex.map(e=>Ee(this,hs,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{NoteClipBoxAdapter ${w.toString(Ee(this,Ft,"f").address.uuid)} d: ${Q.toString(this.duration)}}`}};Kl=new WeakMap,hs=new WeakMap,Ft=new WeakMap,fs=new WeakMap,$d=new WeakMap,Nd=new WeakMap,kd=new WeakMap,ps=new WeakSet,Wl=function(){Ee(this,$d,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var bm={for:(r,e)=>ee(e.accept({visitNoteClipBox:t=>r.adapterFor(t,Zl),visitValueClipBox:t=>r.adapterFor(t,Wo),visitAudioClipBox:t=>r.adapterFor(t,io)}),"")};var Am=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ho=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_m,Gl,Md,Dd,Pm=class{constructor(e,t){_m.set(this,void 0),Gl.set(this,void 0),Md.set(this,void 0),Dd.set(this,void 0),Am(this,_m,e,"f"),Am(this,Gl,new U,"f"),Am(this,Md,Ho(this,Gl,"f").own(new re),"f"),Am(this,Dd,Ho(this,Gl,"f").own(Lt.create(e.box.clips,i=>bm.for(t,i),c.ClipCollection)),"f"),Ho(this,Dd,"f").subscribe({onAdd:()=>this.dispatchChange(),onRemove:()=>this.dispatchChange(),onReorder:()=>this.dispatchChange()})}get trackBoxAdapter(){return Ho(this,_m,"f")}get collection(){return Ho(this,Dd,"f")}dispatchChange(){Ho(this,Md,"f").notify()}subscribeChanges(e){return Ho(this,Md,"f").subscribe(e)}terminate(){Ho(this,Gl,"f").terminate()}};_m=new WeakMap,Gl=new WeakMap,Md=new WeakMap,Dd=new WeakMap;var gt=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},G=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Or,Id,wn,Ke,Cd,Td,Rd,oo,Od,Vd,ms,ql,Hl,Jl,Ql,Yl,oi,Jo=class r{constructor(e,t){Or.add(this),this.type="audio-region",Id.set(this,void 0),wn.set(this,void 0),Ke.set(this,void 0),Cd.set(this,void 0),Td.set(this,void 0),Rd.set(this,void 0),oo.set(this,void 0),Od.set(this,void 0),Vd.set(this,void 0),ms.set(this,g.None),ql.set(this,K.Empty),Hl.set(this,K.Empty),Jl.set(this,K.Empty),Ql.set(this,K.Empty),Yl.set(this,void 0),gt(this,wn,e,"f"),gt(this,Ke,t,"f"),gt(this,Id,new U,"f");let{timeBase:i,position:n,duration:o,loopOffset:a,loopDuration:s}=t;gt(this,Cd,Bo.aware(e.tempoMap,i,n,o),"f"),gt(this,Td,Bo.aware(e.tempoMap,i,n,a),"f"),gt(this,Rd,Bo.aware(e.tempoMap,i,n,s),"f"),gt(this,oo,new Xr,"f"),gt(this,Od,new re,"f"),gt(this,Yl,!1,"f"),gt(this,Vd,!0,"f"),G(this,Id,"f").ownAll(G(this,Ke,"f").pointerHub.subscribe({onAdded:()=>G(this,Or,"m",oi).call(this),onRemoved:()=>G(this,Or,"m",oi).call(this)}),G(this,Ke,"f").file.catchupAndSubscribe(l=>{gt(this,ms,l.targetVertex.map(u=>G(this,wn,"f").boxAdapters.adapterFor(u.box,Vi)),"f"),G(this,ql,"f").terminate(),gt(this,ql,G(this,ms,"f").mapOr(u=>u.getOrCreateLoader().subscribe(()=>G(this,Or,"m",oi).call(this)),K.Empty),"f")}),G(this,Ke,"f").playMode.catchupAndSubscribe(({targetVertex:l})=>{G(this,Hl,"f").terminate(),l.match({none:()=>G(this,oo,"f").clear(),some:({box:u})=>{let p=G(this,wn,"f").boxAdapters.adapterFor(u,gn.isAudioPlayMode);gt(this,Hl,p.subscribe(()=>G(this,Or,"m",oi).call(this)),"f"),G(this,oo,"f").wrap(p)}})}),G(this,Ke,"f").timeBase.catchupAndSubscribe(l=>{G(this,Jl,"f").terminate(),Jr(l.getValue(),sr)===sr.Seconds&&gt(this,Jl,e.tempoMap.subscribe(()=>G(this,Or,"m",oi).call(this)),"f")}),G(this,Ke,"f").subscribe(ke.Children,l=>{if(!this.trackBoxAdapter.isEmpty()&&(l.type==="primitive"||l.type==="pointer")){let u=this.trackBoxAdapter.unwrap();G(this,Ke,"f").position.address.equals(l.address)?(u.regions.onIndexingChanged(),G(this,Or,"m",oi).call(this)):G(this,Or,"m",oi).call(this)}}),G(this,Ke,"f").events.catchupAndSubscribe(({targetVertex:l})=>{G(this,Ql,"f").terminate(),gt(this,Ql,l.match({none:()=>K.Empty,some:({box:u})=>G(this,wn,"f").boxAdapters.adapterFor(u,cr).subscribeChange(()=>G(this,Or,"m",oi).call(this))}),"f"),G(this,Or,"m",oi).call(this)})),gt(this,Vd,!1,"f")}subscribeChange(e){return G(this,Od,"f").subscribe(e)}accept(e){return _(e.visitAudioRegionBoxAdapter,this)}onSelected(){gt(this,Yl,!0,"f"),G(this,Or,"m",oi).call(this)}onDeselected(){gt(this,Yl,!1,"f"),G(this,Or,"m",oi).call(this)}get isSelected(){return G(this,Yl,"f")}get box(){return G(this,Ke,"f")}get uuid(){return G(this,Ke,"f").address.uuid}get address(){return G(this,Ke,"f").address}get position(){return G(this,Ke,"f").position.getValue()}get duration(){return G(this,Cd,"f").toPPQN()}get complete(){return this.position+this.duration}get loopOffset(){return G(this,Td,"f").toPPQN()}get loopDuration(){return G(this,Rd,"f").toPPQN()}get offset(){return this.position-this.loopOffset}get mute(){return G(this,Ke,"f").mute.getValue()}get hue(){return G(this,Ke,"f").hue.getValue()}get gain(){return G(this,Ke,"f").gain}get file(){return G(this,ms,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return G(this,oo,"f")}get timeBase(){return Jr(G(this,Ke,"f").timeBase.getValue(),sr)}get waveformOffset(){return G(this,Ke,"f").waveformOffset}get isPlayModeNoStretch(){return G(this,Ke,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>Ie(e,vn)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>Ie(e,yn)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>gn.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(G(this,ms,"f").isEmpty())return"No Audio File";let e=G(this,ms,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):G(this,Ke,"f").label.getValue()}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return G(this,oo,"f").nonEmpty()}get trackBoxAdapter(){return G(this,Ke,"f").regions.targetVertex.map(e=>G(this,wn,"f").boxAdapters.adapterFor(e.box,mt))}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return G(this,Ke,"f").events.targetVertex.map(e=>G(this,wn,"f").boxAdapters.adapterFor(e.box,cr))}set position(e){G(this,Ke,"f").position.setValue(e)}set duration(e){G(this,oo,"f").nonEmpty()&&G(this,Cd,"f").fromPPQN(e)}set loopOffset(e){G(this,Td,"f").fromPPQN(e)}set loopDuration(e){G(this,oo,"f").nonEmpty()&&G(this,Rd,"f").fromPPQN(e)}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners,n=this.observableOptPlayMode.map(a=>a.clone()),o=G(this,wn,"f").boxAdapters.adapterFor(Co.create(G(this,wn,"f").boxGraph,w.generate(),a=>{a.timeBase.setValue(G(this,Ke,"f").timeBase.getValue()),a.position.setValue(e?.position??G(this,Ke,"f").position.getValue()),a.regions.refer(e?.track??G(this,Ke,"f").regions.targetVertex.unwrap()),a.file.refer(G(this,Ke,"f").file.targetVertex.unwrap()),a.events.refer(i),a.mute.setValue(this.mute),a.hue.setValue(this.hue),a.label.setValue(this.label),a.gain.setValue(this.gain.getValue()),a.waveformOffset.setValue(this.waveformOffset.getValue()),n.ifSome(s=>a.playMode.refer(s))}),r);return o.duration=e?.duration??this.duration,o.loopOffset=e?.loopOffset??this.loopOffset,o.loopDuration=e?.loopDuration??this.loopDuration,o}consolidate(){}canFlatten(e){return!1}flatten(e){return g.None}terminate(){G(this,ql,"f").terminate(),gt(this,ql,K.Empty,"f"),G(this,Jl,"f").terminate(),gt(this,Jl,K.Empty,"f"),G(this,Hl,"f").terminate(),gt(this,Hl,K.Empty,"f"),G(this,Ql,"f").terminate(),gt(this,Ql,K.Empty,"f"),G(this,Id,"f").terminate()}toString(){return`{AudioRegionBoxAdapter ${w.toString(G(this,Ke,"f").address.uuid)}}`}};Id=new WeakMap,wn=new WeakMap,Ke=new WeakMap,Cd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,oo=new WeakMap,Od=new WeakMap,Vd=new WeakMap,ms=new WeakMap,ql=new WeakMap,Hl=new WeakMap,Jl=new WeakMap,Ql=new WeakMap,Yl=new WeakMap,Or=new WeakSet,oi=function(){G(this,Vd,"f")||(G(this,Od,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange())};var ao=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},de=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},bn,Sm,An,et,jd,zd,Xl,Ud,so,Qo=class r{constructor(e,t){bn.add(this),this.type="note-region",Sm.set(this,new U),An.set(this,void 0),et.set(this,void 0),jd.set(this,void 0),zd.set(this,void 0),Xl.set(this,void 0),Ud.set(this,K.Empty),ao(this,An,e,"f"),ao(this,et,t,"f"),ao(this,jd,new re,"f"),ao(this,Xl,!1,"f"),ao(this,zd,!0,"f"),de(this,Sm,"f").ownAll(de(this,et,"f").pointerHub.subscribe({onAdded:()=>de(this,bn,"m",so).call(this),onRemoved:()=>de(this,bn,"m",so).call(this)}),de(this,et,"f").subscribe(ke.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackBoxAdapter.unwrap();de(this,et,"f").position.address.equals(i.address)?(n.regions.onIndexingChanged(),de(this,bn,"m",so).call(this)):de(this,bn,"m",so).call(this)}}),de(this,et,"f").events.catchupAndSubscribe(({targetVertex:i})=>{de(this,Ud,"f").terminate(),ao(this,Ud,i.match({none:()=>K.Empty,some:({box:n})=>de(this,An,"f").boxAdapters.adapterFor(n,ii).subscribeChange(()=>de(this,bn,"m",so).call(this))}),"f"),de(this,bn,"m",so).call(this)})),ao(this,zd,!1,"f")}set position(e){de(this,et,"f").position.setValue(e)}set duration(e){de(this,et,"f").duration.setValue(e)}set loopOffset(e){de(this,et,"f").loopOffset.setValue(e)}set loopDuration(e){de(this,et,"f").loopDuration.setValue(e)}subscribeChange(e){return de(this,jd,"f").subscribe(e)}accept(e){return _(e.visitNoteRegionBoxAdapter,this)}onSelected(){ao(this,Xl,!0,"f"),de(this,bn,"m",so).call(this)}onDeselected(){ao(this,Xl,!1,"f"),de(this,bn,"m",so).call(this)}get isSelected(){return de(this,Xl,"f")}*iterateActiveNotesAt(e){let t=this.optCollection;if(t.isEmpty())return;let i=t.unwrap(),n=qt.globalToLocal(this,e);for(let o of i.events.iterateFrom(n-i.maxDuration)){if(n<o.position)return;n<o.complete&&(yield o.copyAsNoteEvent())}}terminate(){de(this,Ud,"f").terminate(),de(this,Sm,"f").terminate()}get box(){return de(this,et,"f")}get uuid(){return de(this,et,"f").address.uuid}get address(){return de(this,et,"f").address}get position(){return de(this,et,"f").position.getValue()}get duration(){return de(this,et,"f").duration.getValue()}get loopOffset(){return de(this,et,"f").loopOffset.getValue()}get loopDuration(){return de(this,et,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return de(this,et,"f").mute.getValue()}get hue(){return de(this,et,"f").hue.getValue()}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return de(this,et,"f").events.targetVertex.map(e=>de(this,An,"f").boxAdapters.adapterFor(e.box,ii))}get label(){return de(this,et,"f").label.getValue()}get trackBoxAdapter(){return de(this,zd,"f")?g.None:de(this,et,"f").regions.targetVertex.map(e=>de(this,An,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return de(this,An,"f").boxAdapters.adapterFor(Za.create(de(this,An,"f").boxGraph,w.generate(),n=>{n.position.setValue(e?.position??this.position),n.duration.setValue(e?.duration??this.duration),n.loopOffset.setValue(e?.loopOffset??this.loopOffset),n.loopDuration.setValue(e?.loopDuration??this.loopDuration),n.hue.setValue(this.hue),n.label.setValue(this.label),n.mute.setValue(this.mute),n.events.refer(i),n.regions.refer(e?.track??de(this,et,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.optCollection.ifSome(e=>{let t=de(this,An,"f").boxGraph,i=Yn.create(t,w.generate());e.events.asArray().forEach(n=>n.copyTo({events:i.events})),de(this,et,"f").events.refer(i.owners)})}canFlatten(e){return e.length>0&&R.satisfy(e,(t,i)=>t.trackBoxAdapter.contains(i.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return g.None;let t=de(this,An,"f").boxGraph,i=e.toSorted(Eo.Comparator),n=R.getFirst(i,"Internal error (no first)"),o=R.getLast(i,"Internal error (no last)"),a=n.position,s=o.position+o.duration,l=n.trackBoxAdapter.unwrap(),u=Yn.create(t,w.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let f=d;for(let{resultStart:v,resultEnd:m,rawStart:y}of qt.locateLoops(f,f.position,f.complete)){let x=Math.floor(v-y),D=Math.floor(m-y);for(let M of f.optCollection.unwrap().events.iterateRange(x,D))M.copyTo({position:M.position+y-n.position,events:u.events})}}),p.forEach(({box:d})=>d.delete()),g.wrap(Za.create(t,w.generate(),d=>{d.position.setValue(a),d.duration.setValue(s-a),d.loopDuration.setValue(s-a),d.loopOffset.setValue(0),d.hue.setValue(this.hue),d.mute.setValue(this.mute),d.label.setValue(this.label),d.events.refer(u.owners),d.regions.refer(l.box.regions)}))}toString(){return`{NoteRegionBoxAdapter ${w.toString(de(this,et,"f").address.uuid)} p: ${Q.toString(this.position)}, c: ${Q.toString(this.complete)}}`}};Sm=new WeakMap,An=new WeakMap,et=new WeakMap,jd=new WeakMap,zd=new WeakMap,Xl=new WeakMap,Ud=new WeakMap,bn=new WeakSet,so=function(){de(this,jd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var lo=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ce=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ji,ec,_n,tt,Wd,tc,Ld,Kd,Pn,co=class r{constructor(e,t){ji.add(this),this.type="value-region",ec.set(this,new U),_n.set(this,void 0),tt.set(this,void 0),Wd.set(this,void 0),tc.set(this,void 0),Ld.set(this,void 0),Kd.set(this,K.Empty),lo(this,_n,e,"f"),lo(this,tt,t,"f"),lo(this,Ld,!0,"f"),lo(this,Wd,new re,"f"),lo(this,tc,!1,"f"),ce(this,ec,"f").own(ce(this,tt,"f").pointerHub.subscribe({onAdded:()=>ce(this,ji,"m",Pn).call(this),onRemoved:()=>ce(this,ji,"m",Pn).call(this)})),ce(this,ec,"f").own(ce(this,tt,"f").subscribe(ke.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackBoxAdapter.unwrap();ce(this,tt,"f").position.address.equals(i.address)?(n.regions.onIndexingChanged(),ce(this,ji,"m",Pn).call(this)):ce(this,ji,"m",Pn).call(this)}})),ce(this,ec,"f").own(ce(this,tt,"f").events.catchupAndSubscribe(({targetVertex:i})=>{ce(this,Kd,"f").terminate(),lo(this,Kd,i.match({none:()=>K.Empty,some:({box:n})=>ce(this,_n,"f").boxAdapters.adapterFor(n,cr).subscribeChange(()=>ce(this,ji,"m",Pn).call(this))}),"f"),ce(this,ji,"m",Pn).call(this)})),lo(this,Ld,!1,"f")}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(qt.globalToLocal(this,e),t)}incomingValue(e){return this.valueAt(this.position,e)}outgoingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let i=t.unwrap();return(this.complete-this.offset)%this.loopDuration===0?i.valueAt(this.loopDuration,e):i.valueAt(qt.globalToLocal(this,this.complete),e)}subscribeChange(e){return ce(this,Wd,"f").subscribe(e)}accept(e){return _(e.visitValueRegionBoxAdapter,this)}onSelected(){lo(this,tc,!0,"f"),ce(this,ji,"m",Pn).call(this)}onDeselected(){lo(this,tc,!1,"f"),ce(this,ji,"m",Pn).call(this)}get isSelected(){return ce(this,tc,"f")}onValuesPropertyChanged(){ce(this,ji,"m",Pn).call(this)}onValuesSortingChanged(){this.onValuesPropertyChanged()}terminate(){ce(this,Kd,"f").terminate(),ce(this,ec,"f").terminate()}get box(){return ce(this,tt,"f")}get uuid(){return ce(this,tt,"f").address.uuid}get address(){return ce(this,tt,"f").address}get position(){return ce(this,tt,"f").position.getValue()}get duration(){return ce(this,tt,"f").duration.getValue()}get loopOffset(){return ce(this,tt,"f").loopOffset.getValue()}get loopDuration(){return ce(this,tt,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return ce(this,tt,"f").mute.getValue()}get hue(){return ce(this,tt,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return ce(this,tt,"f").events.targetVertex.map(e=>ce(this,_n,"f").boxAdapters.adapterFor(e.box,cr))}get label(){return ce(this,tt,"f").label.getValue()}get trackBoxAdapter(){return ce(this,Ld,"f")?g.None:ce(this,tt,"f").regions.targetVertex.map(e=>ce(this,_n,"f").boxAdapters.adapterFor(e.box,mt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}set position(e){ce(this,tt,"f").position.setValue(e)}set duration(e){ce(this,tt,"f").duration.setValue(e)}set loopOffset(e){ce(this,tt,"f").loopOffset.setValue(e)}set loopDuration(e){ce(this,tt,"f").loopDuration.setValue(e)}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return ce(this,_n,"f").boxAdapters.adapterFor(Ga.create(ce(this,_n,"f").boxGraph,w.generate(),n=>{n.position.setValue(e?.position??this.position),n.duration.setValue(e?.duration??this.duration),n.loopOffset.setValue(e?.loopOffset??this.loopOffset),n.loopDuration.setValue(e?.loopDuration??this.loopDuration),n.hue.setValue(this.hue),n.label.setValue(this.label),n.mute.setValue(this.mute),n.events.refer(i),n.regions.refer(e?.track??ce(this,tt,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.events.ifSome(e=>{let t=ce(this,_n,"f").boxGraph,i=Xn.create(t,w.generate());e.asArray().forEach(n=>n.copyTo({events:i.events})),ce(this,tt,"f").events.refer(i.owners)})}canFlatten(e){return!1}flatten(e){if(!this.canFlatten(e))return g.None;let t=ce(this,_n,"f").boxGraph,i=e.toSorted(Eo.Comparator),n=R.getFirst(i,"Internal error (no first)"),o=R.getLast(i,"Internal error (no last)"),a=n.position,s=o.position+o.duration,l=n.trackBoxAdapter.unwrap(),u=Xn.create(t,w.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let f=d;for(let{resultStart:v,resultEnd:m,rawStart:y}of qt.locateLoops(f,f.position,f.complete)){let x=Math.floor(v-y),D=Math.floor(m-y);for(let M of f.events.unwrap().iterateRange(x,D));}}),p.forEach(({box:d})=>d.delete()),g.wrap(Ga.create(t,w.generate(),d=>{d.position.setValue(a),d.duration.setValue(s-a),d.loopDuration.setValue(s-a),d.loopOffset.setValue(0),d.hue.setValue(this.hue),d.mute.setValue(this.mute),d.label.setValue(this.label),d.events.refer(u.owners),d.regions.refer(l.box.regions)}))}toString(){return`{ValueRegionBoxAdapter ${w.toString(ce(this,tt,"f").address.uuid)} p: ${Q.toString(this.position)}, c: ${Q.toString(this.complete)}}`}};ec=new WeakMap,_n=new WeakMap,tt=new WeakMap,Wd=new WeakMap,tc=new WeakMap,Ld=new WeakMap,Kd=new WeakMap,ji=new WeakSet,Pn=function(){ce(this,Wd,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var VP=(r,e)=>r.position-e.position,zP={for:(r,e)=>ee(e.accept({visitNoteRegionBox:t=>r.adapterFor(t,Qo),visitAudioRegionBox:t=>r.adapterFor(t,Jo),visitValueRegionBox:t=>r.adapterFor(t,co)}),"")};var rc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ut=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Zd,gs,Gd,ic,vs,nc,Em=class{constructor(e,t){Zd.set(this,void 0),gs.set(this,void 0),Gd.set(this,void 0),ic.set(this,void 0),vs.set(this,void 0),nc.set(this,void 0),rc(this,Zd,e,"f"),rc(this,gs,new U,"f"),rc(this,Gd,Ut(this,gs,"f").own(new re),"f"),rc(this,ic,Ut(this,gs,"f").own(new Mt),"f"),rc(this,vs,Eo.create(VP),"f"),rc(this,nc,w.newSet(i=>i.uuid),"f"),Ut(this,gs,"f").ownAll(Ut(this,Zd,"f").box.regions.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{let n=zP.for(t,i),o=Ut(this,nc,"f").add(n);I(o,`Cannot add ${i}`),Ut(this,vs,"f").add(n),Ut(this,ic,"f").forEach(a=>a.onAdded(n)),this.dispatchChange()},onRemoved:({box:{address:{uuid:i}}})=>{let n=Ut(this,nc,"f").removeByKey(i);Ut(this,vs,"f").remove(n),Ut(this,ic,"f").forEach(o=>o.onRemoved(n)),this.dispatchChange()}},c.RegionCollection))}get trackBoxAdapter(){return Ut(this,Zd,"f")}get collection(){return Ut(this,vs,"f")}get adapters(){return Ut(this,nc,"f")}onIndexingChanged(){Ut(this,vs,"f").onIndexingChanged(),this.dispatchChange()}catchupAndSubscribe(e){return this.collection.asArray().forEach(e.onAdded),Ut(this,ic,"f").subscribe(e)}subscribeChanges(e){return Ut(this,Gd,"f").subscribe(e)}dispatchChange(){Ut(this,Gd,"f").notify()}terminate(){Ut(this,gs,"f").terminate()}};Zd=new WeakMap,gs=new WeakMap,Gd=new WeakMap,ic=new WeakMap,vs=new WeakMap,nc=new WeakMap;var ie;(function(r){r[r.Undefined=0]="Undefined",r[r.Notes=1]="Notes",r[r.Audio=2]="Audio",r[r.Value=3]="Value"})(ie||(ie={}));(function(r){r.toLabelString=e=>{switch(e){case r.Audio:return"Audio";case r.Notes:return"Notes";case r.Value:return"Automation";case r.Undefined:default:return"N/A"}},r.toIconSymbol=e=>{switch(e){case r.Audio:return Me.Waveform;case r.Notes:return Me.Piano;case r.Value:return Me.Automation;case r.Undefined:return Me.AudioBus;default:return Me.Unknown}}})(ie||(ie={}));var Bm;(function(r){r.isDeviceBox=e=>"host"in e&&Ie(e.host,B)&&"label"in e&&Ie(e.label,C)&&"enabled"in e&&Ie(e.enabled,$)&&"minimized"in e&&Ie(e.minimized,$),r.isInstrumentDeviceBox=e=>r.isDeviceBox(e)&&e.host.pointerType===c.InstrumentHost,r.isEffectDeviceBox=e=>r.isDeviceBox(e)&&"index"in e&&Ie(e.index,E)&&(e.host.pointerType===c.MidiEffectHost||e.host.pointerType===c.AudioEffectHost),r.lookupHostField=e=>Z(e)&&"host"in e&&Ie(e.host,B)?e.host:F(`Could not find 'host' field in '${e?.name}'`),r.lookupLabelField=e=>Z(e)&&"label"in e&&Ie(e.label,C)?e.label:F(`Could not find 'label' field in '${e?.name}'`),r.lookupEnabledField=e=>Z(e)&&"enabled"in e&&Ie(e.enabled,$)?e.enabled:F(`Could not find 'enabled' field in '${e?.name}'`),r.lookupMinimizedField=e=>Z(e)&&"minimized"in e&&Ie(e.minimized,$)?e.minimized:F(`Could not find 'minimized' field in '${e?.name}'`),r.lookupIndexField=e=>Z(e)&&"index"in e&&Ie(e.index,E)?e.index:F(`Could not find 'index' field in '${e?.name}'`)})(Bm||(Bm={}));var UP;(function(r){r.toTrackType=e=>{switch(e){case"midi":return ie.Notes;case"audio":return ie.Audio;default:return F()}}})(UP||(UP={}));var ne;(function(r){r.isAny=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="bus"||e.type==="instrument"||e.type==="audio-effect"),r.isEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="audio-effect"),r.isInstrument=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="instrument",r.isMidiEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="midi-effect",r.isAudioEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="audio-effect",r.isHost=e=>e!==null&&typeof e=="object"&&"class"in e&&e.class==="device-host",r.deleteEffectDevices=e=>{if(e.length===0)return;I(R.satisfy(e,(n,o)=>n.deviceHost().address.equals(o.deviceHost().address)),"Devices are not connected to the same host");let t=e[0];(t.accepts==="audio"?t.deviceHost().audioEffects.field().pointerHub.filter(c.AudioEffectHost):t.accepts==="midi"?t.deviceHost().midiEffects.field().pointerHub.filter(c.MidiEffectHost):F("unknown type")).map(({box:n})=>Bm.lookupIndexField(n)).filter(n=>e.some(o=>w.Comparator(o.uuid,n.address.uuid)!==0)).sort((n,o)=>n.getValue()-o.getValue()).forEach((n,o)=>n.setValue(o)),e.forEach(n=>n.box.delete())}})(ne||(ne={}));var Fm=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Wt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},qd,Nm,Li,ys,km,$m=class{constructor(e,t){qd.set(this,void 0),Nm.set(this,new re),Li.set(this,void 0),ys.set(this,void 0),km.set(this,void 0),Fm(this,qd,e,"f"),Fm(this,Li,Lt.create(e.box.tracks,i=>t.adapterFor(i,mt),c.TrackCollection),"f"),Fm(this,ys,w.newSet(({uuid:i})=>i),"f"),Fm(this,km,Wt(this,Li,"f").catchupAndSubscribe({onAdd:i=>Wt(this,ys,"f").add({uuid:i.uuid,subscription:i.regions.subscribeChanges(()=>Wt(this,Nm,"f").notify())}),onRemove:({uuid:i})=>Wt(this,ys,"f").removeByKey(i).subscription.terminate(),onReorder:i=>{}}),"f")}create(e,t,i){let n=Wt(this,qd,"f").box.graph,o=Wt(this,qd,"f").box.tracks;lr.create(n,w.generate(),a=>{a.index.setValue(i??Wt(this,Li,"f").getMinFreeIndex()),a.type.setValue(e),a.tracks.refer(o),a.target.refer(t)})}controls(e){return g.wrap(Wt(this,Li,"f").adapters().find(t=>t.target.targetVertex.contains(e),!1))}delete(e){let t=Wt(this,Li,"f").adapters(),i=t.indexOf(e);if(i===-1)return F(`Cannot delete ${e}. Does not exist.`);for(let n=i+1;n<t.length;n++)t[n].indexField.setValue(n-1);e.box.delete()}get collection(){return Wt(this,Li,"f")}values(){return Wt(this,Li,"f").adapters()}catchupAndSubscribe(e){return Wt(this,Li,"f").catchupAndSubscribe(e)}subscribeAnyChange(e){return Wt(this,Nm,"f").subscribe(e)}terminate(){Wt(this,Li,"f").terminate(),Wt(this,km,"f").terminate(),Wt(this,ys,"f").forEach(({subscription:e})=>e.terminate()),Wt(this,ys,"f").clear()}};qd=new WeakMap,Nm=new WeakMap,Li=new WeakMap,ys=new WeakMap,km=new WeakMap;var jP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ki=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mm,Vr,dr=class{constructor(e,t){this.type="bus",this.accepts="audio",Mm.set(this,void 0),Vr.set(this,void 0),jP(this,Mm,e,"f"),jP(this,Vr,t,"f")}catchupAndSubscribe(e){return e(this),Ki(this,Vr,"f").subscribe(ke.Children,()=>e(this))}get uuid(){return Ki(this,Vr,"f").address.uuid}get address(){return Ki(this,Vr,"f").address}get box(){return Ki(this,Vr,"f")}get enabledField(){return Ki(this,Vr,"f").enabled}get minimizedField(){return Ki(this,Vr,"f").minimized}get iconField(){return Ki(this,Vr,"f").icon}get labelField(){return Ki(this,Vr,"f").label}get colorField(){return Ki(this,Vr,"f").color}get iconSymbol(){return Me.fromName(this.iconField.getValue()??"audio-bus")}deviceHost(){return Ki(this,Mm,"f").boxAdapters.adapterFor(Ki(this,Vr,"f").output.targetVertex.unwrap("No AudioUnitBox found").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}toString(){return`{${this.constructor.name}}`}};Mm=new WeakMap,Vr=new WeakMap;var Hd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},pt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},uo,oc,ac,ai,Jd,Dm=class{constructor(e,t){uo.set(this,void 0),oc.set(this,void 0),ac.set(this,void 0),ai.set(this,void 0),Jd.set(this,K.Empty),Hd(this,uo,new U,"f"),Hd(this,oc,pt(this,uo,"f").own(new re),"f"),Hd(this,ac,pt(this,uo,"f").own(new Cr(Me.Unknown)),"f"),Hd(this,ai,pt(this,uo,"f").own(new Cr(g.None)),"f"),pt(this,uo,"f").own(pt(this,ai,"f").subscribe(i=>{pt(this,Jd,"f").terminate(),Hd(this,Jd,i.getValue().match({none:()=>(pt(this,oc,"f").notify(g.None),K.Empty),some:({labelField:n,iconField:o})=>K.many(o.catchupAndSubscribe(a=>pt(this,ac,"f").setValue(Me.fromName(a.getValue()))),n.catchupAndSubscribe(a=>pt(this,oc,"f").notify(g.wrap(a.getValue()))))}),"f")})),pt(this,uo,"f").own(e.catchupAndSubscribe({onAdded:({box:i})=>{I(pt(this,ai,"f").getValue().isEmpty(),"Already set");let n=i instanceof Ti?t.adapterFor(i,dr):t.adapterFor(i,ne.isInstrument);pt(this,ai,"f").getValue().unwrapOrNull()!==n&&pt(this,ai,"f").setValue(g.wrap(n))},onRemoved:({box:i})=>{I(pt(this,ai,"f").getValue().unwrap("Cannot remove").box.address.equals(i.address),"Unexpected value to remove"),pt(this,ai,"f").setValue(g.None)}},c.InstrumentHost,c.AudioOutput))}getValue(){return pt(this,ai,"f").getValue()}subscribe(e){return pt(this,ai,"f").subscribe(e)}catchupAndSubscribe(e){return e(pt(this,ai,"f")),this.subscribe(e)}catchupAndSubscribeLabelChange(e){return e(this.label),pt(this,oc,"f").subscribe(e)}catchupAndSubscribeIconChange(e){return pt(this,ac,"f").catchupAndSubscribe(e)}set label(e){this.getValue().ifSome(t=>t.labelField.setValue(e))}get label(){return this.getValue().map(e=>e.labelField.getValue())}set icon(e){this.getValue().ifSome(t=>t.iconField.setValue(Me.toName(e)))}get icon(){return this.getValue().match({none:()=>Me.Unknown,some:e=>Me.fromName(e.iconField.getValue())})}get iconValue(){return pt(this,ac,"f")}terminate(){pt(this,uo,"f").terminate(),pt(this,Jd,"f").terminate()}};uo=new WeakMap,oc=new WeakMap,ac=new WeakMap,ai=new WeakMap,Jd=new WeakMap;var LP=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},xs=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Im,po,pe=class{constructor(e){Im.set(this,void 0),po.set(this,void 0),LP(this,Im,e,"f"),LP(this,po,Ae.newSet(t=>t.address),"f")}terminate(){xs(this,po,"f").forEach(e=>e.terminate()),xs(this,po,"f").clear()}parameters(){return xs(this,po,"f").values()}parameterAt(e){return xs(this,po,"f").getOrThrow(e,()=>new Error(`No ParameterAdapter found at [${e.toString()}]`))}createParameter(e,t,i,n,o){let a=new ws(xs(this,Im,"f"),e,t,i,n,o),s=xs(this,po,"f").add(a);return I(s,`Could not add adapter for ${e}`),a}removeParameter(e){return xs(this,po,"f").removeByKey(e)}};Im=new WeakMap,po=new WeakMap;var bs=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},As,si,Yo,sc,Cm,Tm,Qd,lc=class{constructor(e,t){As.set(this,void 0),si.set(this,void 0),Yo.set(this,void 0),sc.set(this,void 0),Cm.set(this,void 0),Tm.set(this,void 0),Qd.set(this,K.Empty),bs(this,As,e,"f"),bs(this,si,t,"f"),bs(this,Yo,new U,"f"),bs(this,sc,nt(this,Yo,"f").own(new re),"f"),nt(this,Yo,"f").own(t.targetBus.catchupAndSubscribe(()=>{nt(this,Qd,"f").terminate(),bs(this,Qd,this.optTargetBus.match({none:()=>(nt(this,sc,"f").notify(g.None),K.Empty),some:i=>i.catchupAndSubscribe(n=>nt(this,sc,"f").notify(g.wrap(n)))}),"f")})),bs(this,Cm,nt(this,Yo,"f").own(new ws(nt(this,As,"f"),nt(this,si,"f").sendPan,S.bipolar(),P.percent({unit:"%",fractionDigits:0}),"panning")),"f"),bs(this,Tm,nt(this,Yo,"f").own(new ws(nt(this,As,"f"),nt(this,si,"f").sendGain,S.DefaultDecibel,P.numeric({unit:"dB",fractionDigits:1}),"gain")),"f")}catchupAndSubscribeBusChanges(e){return e(this.optTargetBus),nt(this,sc,"f").subscribe(e)}get uuid(){return nt(this,si,"f").address.uuid}get address(){return nt(this,si,"f").address}get box(){return nt(this,si,"f")}get indexField(){return nt(this,si,"f").index}get sendPan(){return nt(this,Cm,"f")}get sendGain(){return nt(this,Tm,"f")}get targetBus(){return nt(this,As,"f").boxAdapters.adapterFor(nt(this,si,"f").targetBus.targetVertex.unwrap("no audioUnit").box,dr)}get optTargetBus(){return nt(this,si,"f").targetBus.targetVertex.flatMap(e=>g.wrap(e.box.accept({visitAudioBusBox:t=>nt(this,As,"f").boxAdapters.adapterFor(t,dr)})))}delete(){nt(this,si,"f").delete()}terminate(){nt(this,Yo,"f").terminate(),nt(this,Qd,"f").terminate()}};As=new WeakMap,si=new WeakMap,Yo=new WeakMap,sc=new WeakMap,Cm=new WeakMap,Tm=new WeakMap,Qd=new WeakMap;var Yd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Sn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rm,Om,cc,uc,Xd,Vm=class{constructor(e,t){Rm.set(this,void 0),Om.set(this,void 0),cc.set(this,void 0),uc.set(this,void 0),Xd.set(this,K.Empty),Yd(this,Rm,e,"f"),Yd(this,Om,t,"f"),Yd(this,cc,new U,"f"),Yd(this,uc,Sn(this,cc,"f").own(new re),"f"),Sn(this,cc,"f").own(e.catchupAndSubscribe(()=>{Sn(this,Xd,"f").terminate(),Yd(this,Xd,this.adapter.match({none:()=>(Sn(this,uc,"f").notify(g.None),K.Empty),some:i=>i.catchupAndSubscribe(n=>Sn(this,uc,"f").notify(g.wrap(n)))}),"f")}))}subscribe(e){return Sn(this,uc,"f").subscribe(e)}catchupAndSubscribe(e){return e(this.adapter),this.subscribe(e)}get adapter(){return Sn(this,Rm,"f").targetVertex.flatMap(e=>g.wrap(e.box.accept({visitAudioBusBox:t=>Sn(this,Om,"f").adapterFor(t,dr)})))}terminate(){Sn(this,cc,"f").terminate(),Sn(this,Xd,"f").terminate()}};Rm=new WeakMap,Om=new WeakMap,cc=new WeakMap,uc=new WeakMap,Xd=new WeakMap;var ho=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ae=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},zm,KP,En,zr,vt,Ps,dc,_s,Um,jm,Lm,Km,WP,ZP,li=class{constructor(e,t){zm.add(this),this.class="device-host",En.set(this,new U),zr.set(this,void 0),vt.set(this,void 0),Ps.set(this,void 0),dc.set(this,void 0),_s.set(this,void 0),Um.set(this,void 0),jm.set(this,void 0),Lm.set(this,void 0),Km.set(this,void 0),ho(this,zr,e,"f"),ho(this,vt,t,"f"),ho(this,Ps,ae(this,En,"f").own(new pe(ae(this,zr,"f"))),"f"),ho(this,dc,ae(this,En,"f").own(new $m(this,ae(this,zr,"f").boxAdapters)),"f"),ho(this,_s,ae(this,En,"f").own(new Dm(ae(this,vt,"f").input.pointerHub,ae(this,zr,"f").boxAdapters)),"f"),ho(this,Um,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").midiEffects,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,ne.isMidiEffect),c.MidiEffectHost)),"f"),ho(this,jm,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").audioEffects,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,ne.isAudioEffect),c.AudioEffectHost)),"f"),ho(this,Lm,ae(this,En,"f").own(Lt.create(ae(this,vt,"f").auxSends,i=>ae(this,zr,"f").boxAdapters.adapterFor(i,lc),c.AuxSend)),"f"),ho(this,Km,ae(this,En,"f").own(new Vm(ae(this,vt,"f").output,ae(this,zr,"f").boxAdapters)),"f"),this.namedParameter=ae(this,zm,"m",WP).call(this,t),ae(this,zm,"m",ZP).call(this)}get box(){return ae(this,vt,"f")}get uuid(){return ae(this,vt,"f").address.uuid}get address(){return ae(this,vt,"f").address}get indexField(){return ae(this,vt,"f").index}get type(){return ae(this,vt,"f").type.getValue()}get captureBox(){return ae(this,vt,"f").capture.targetVertex}get tracks(){return ae(this,dc,"f")}get input(){return ae(this,_s,"f")}get midiEffects(){return ae(this,Um,"f")}get audioEffects(){return ae(this,jm,"f")}get inputAdapter(){return ae(this,_s,"f").getValue()}get auxSends(){return ae(this,Lm,"f")}get output(){return ae(this,Km,"f")}get isBus(){return this.input.getValue().mapOr(e=>e.type==="bus",!1)}get isInstrument(){return this.input.getValue().mapOr(e=>e.type==="instrument",!1)}get isOutput(){return ae(this,vt,"f").output.targetVertex.mapOr(e=>e.box.address.equals(ae(this,zr,"f").rootBoxAdapter.address),!1)}get midiEffectsField(){return ae(this,vt,"f").midiEffects}get inputField(){return ae(this,vt,"f").input}get audioEffectsField(){return ae(this,vt,"f").audioEffects}get tracksField(){return ae(this,vt,"f").tracks}get minimizedField(){return ae(this,_s,"f").getValue().unwrap().minimizedField}get isAudioUnit(){return!0}get label(){return ae(this,_s,"f").getValue().mapOr(e=>e.labelField.getValue(),"")}audioUnitBoxAdapter(){return this}indicesLimit(){let e=ae(this,zr,"f").rootBoxAdapter.audioUnits.adapters(),t=this.indexField.getValue(),i=this.type,n=t,o=t;for(;n>0&&e[n-1].type===i;)n--;for(;o<e.length-1&&e[o+1].type===i;)o++;return[n,o+1]}move(e){ae(this,zr,"f").rootBoxAdapter.audioUnits.move(this,e)}moveTrack(e,t){ae(this,dc,"f").collection.move(e,t)}deleteTrack(e){ae(this,dc,"f").delete(e)}toString(){return`{${this.constructor.name}}`}terminate(){ae(this,En,"f").terminate()}};KP=li,En=new WeakMap,zr=new WeakMap,vt=new WeakMap,Ps=new WeakMap,dc=new WeakMap,_s=new WeakMap,Um=new WeakMap,jm=new WeakMap,Lm=new WeakMap,Km=new WeakMap,zm=new WeakSet,WP=function(e){return{volume:ae(this,Ps,"f").createParameter(e.volume,KP.VolumeMapper,P.decible,"volume"),panning:ae(this,Ps,"f").createParameter(e.panning,S.bipolar(),P.panning,"panning",.5),mute:ae(this,Ps,"f").createParameter(e.mute,S.bool,P.bool,"mute"),solo:ae(this,Ps,"f").createParameter(e.solo,S.bool,P.bool,"solo")}},ZP=function(){let e=this.address.toString(),t=ae(this,vt,"f").capture.targetAddress.unwrapOrUndefined(),i=()=>`AudioUnit '${e}' must have a capture. AudioUnit is typed ${this.type} and has input ${ae(this,vt,"f").input.pointerHub.incoming().at(0)?.box.name}, but capture is ${t}`;I(this.type!==St.Instrument||ae(this,vt,"f").capture.targetAddress.nonEmpty(),i)};li.VolumeMapper=S.decibel(-96,-9,6);var pc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},qe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Wm,Xo,pr,Ss,Zm,Gm,ep,GP,qP,mt=class{constructor(e,t){Wm.add(this),Xo.set(this,void 0),pr.set(this,void 0),Ss.set(this,void 0),Zm.set(this,void 0),Gm.set(this,void 0),ep.set(this,void 0),pc(this,Xo,e,"f"),pc(this,pr,t,"f"),pc(this,Ss,new U,"f"),pc(this,Zm,qe(this,Ss,"f").own(new Pm(this,e.boxAdapters)),"f"),pc(this,Gm,qe(this,Ss,"f").own(new Em(this,e.boxAdapters)),"f"),pc(this,ep,qe(this,Ss,"f").own(new Cr(-1)),"f")}catchupAndSubscribePath(e){let t=[g.None,g.None],i=()=>{t.every(n=>n.nonEmpty())?e(g.wrap(t.map(n=>n.unwrap()))):e(g.None)};return K.many(qe(this,Wm,"m",GP).call(this,n=>{t[0].equals(n)||(t[0]=n,i())}),qe(this,Wm,"m",qP).call(this,n=>{t[1].equals(n)||(t[1]=n,i())}))}set targetDeviceName(e){qe(this,pr,"f").target.targetVertex.ifSome(t=>{let i=t.box;if(i instanceof it)return qe(this,Xo,"f").boxAdapters.adapterFor(i,li).input.getValue().ifSome(({labelField:o})=>o.setValue(e));if("label"in i&&i.label instanceof C)return i.label.setValue(e)})}get targetDeviceName(){return qe(this,pr,"f").target.targetVertex.flatMap(e=>{let t=e.box;return t instanceof it?qe(this,Xo,"f").boxAdapters.adapterFor(t,li).input.label:"label"in t&&t.label instanceof C?g.wrap(t.label.getValue()):g.wrap(t.name)})}terminate(){qe(this,Ss,"f").terminate()}get audioUnit(){return Ne(qe(this,pr,"f").tracks.targetVertex.unwrap().box,it)}get target(){return qe(this,pr,"f").target}get clips(){return qe(this,Zm,"f")}get regions(){return qe(this,Gm,"f")}get enabled(){return qe(this,pr,"f").enabled}get indexField(){return qe(this,pr,"f").index}get type(){return qe(this,pr,"f").type.getValue()}get box(){return qe(this,pr,"f")}get uuid(){return qe(this,pr,"f").address.uuid}get address(){return qe(this,pr,"f").address}get listIndex(){return qe(this,ep,"f").getValue()}set listIndex(e){qe(this,ep,"f").setValue(e)}accepts(e){switch(e.type){case"audio-clip":return this.type===ie.Audio;case"note-clip":return this.type===ie.Notes;case"value-clip":return this.type===ie.Value;case"audio-region":return this.type===ie.Audio;case"note-region":return this.type===ie.Notes;case"value-region":return this.type===ie.Value}}valueAt(e,t){if(!this.enabled.getValue())return t;let i=t,n=qe(this,Xo,"f").clipSequencing.iterate(this.uuid,e,e+df);for(let{optClip:o,sectionFrom:a}of n)i=o.match({none:()=>{let s=this.regions.collection.lowerEqual(e,l=>!l.mute);if(s===null){let l=this.regions.collection.optAt(0);return Ie(l,co)?l.incomingValue(t):t}else if(Ie(s,co))return e<s.complete?s.valueAt(e,t):s.outgoingValue(t);return t},some:s=>a===e&&Ie(s,Wo)?s.valueAt(e,t):t});return i}};Xo=new WeakMap,pr=new WeakMap,Ss=new WeakMap,Zm=new WeakMap,Gm=new WeakMap,ep=new WeakMap,Wm=new WeakSet,GP=function(e){let t=qe(this,pr,"f").target.targetVertex;if(t.nonEmpty()){let i=t.unwrap().box;return i instanceof it?qe(this,Xo,"f").boxAdapters.adapterFor(i,li).input.catchupAndSubscribeLabelChange(o=>e(o)):"label"in i&&i.label instanceof C?i.label.catchupAndSubscribe(n=>e(g.wrap(n.getValue()))):(e(g.wrap(i.name)),K.Empty)}return e(g.None),K.Empty},qP=function(e){let t=this.type;switch(t){case ie.Audio:case ie.Notes:return e(g.wrap(ie[t])),K.Empty;case ie.Value:{let i=qe(this,pr,"f").target.targetVertex.unwrap();if(i.isField())e(qe(this,Xo,"f").parameterFieldAdapters.opt(i.address).map(n=>n.name));else if(i.isBox())e(g.wrap(i.name));else return F("Illegal State. Vertex is not a field nor box.");return K.Empty}case ie.Undefined:return e(g.wrap("")),K.Empty;default:return e(g.None),K.Empty}};var Zt=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ue=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ea,Ur,ta,Es,qm,Hm,Bs,Fs,ra,ia,Ns,hc,tp,HP=[c.Automation,c.Modulation,c.MidiControl,c.ParameterController],ws=class{constructor(e,t,i,n,o,a){ea.set(this,void 0),Ur.set(this,void 0),ta.set(this,void 0),Es.set(this,void 0),qm.set(this,void 0),Hm.set(this,void 0),Bs.set(this,new U),Fs.set(this,void 0),ra.set(this,void 0),ia.set(this,g.None),Ns.set(this,g.None),hc.set(this,null),tp.set(this,!1),Zt(this,ea,e,"f"),Zt(this,Ur,t,"f"),Zt(this,ta,i,"f"),Zt(this,Es,n,"f"),Zt(this,qm,o,"f"),Zt(this,Hm,a??0,"f"),ue(this,Bs,"f").own(ue(this,ea,"f").parameterFieldAdapters.register(this)),Zt(this,Fs,ue(this,Bs,"f").own(new re),"f"),Zt(this,ra,new Mt,"f"),ue(this,Bs,"f").own(ue(this,Ur,"f").subscribe(()=>ue(this,Fs,"f").notify(this))),ue(this,Bs,"f").own(ue(this,Ur,"f").pointerHub.catchupAndSubscribe({onAdded:s=>{ue(this,ra,"f").proxy.onControlSourceAdd(Gx(s.pointerType)),s.box.accept({visitTrackBox:l=>{I(ue(this,ia,"f").isEmpty(),"Already assigned");let u=ue(this,ea,"f").boxAdapters.adapterFor(l,mt);Zt(this,ia,g.wrap(u),"f"),ue(this,ea,"f").isMainThread&&Zt(this,Ns,g.wrap(ue(this,ea,"f").liveStreamReceiver.subscribeFloat(ue(this,Ur,"f").address,p=>{ue(this,hc,"f")!==p&&(Zt(this,hc,p,"f"),ue(this,Fs,"f").notify(this))})),"f")}})},onRemoved:s=>{ue(this,ra,"f").proxy.onControlSourceRemove(Gx(s.pointerType)),s.box.accept({visitTrackBox:l=>{I(ue(this,ia,"f").unwrapOrNull()?.address?.equals(l.address)===!0,`Unknown ${l}`),Zt(this,ia,g.None,"f"),ue(this,ea,"f").isMainThread&&(ue(this,Ns,"f").ifSome(u=>u.terminate()),Zt(this,Ns,g.None,"f"),Zt(this,hc,null,"f"),ue(this,Fs,"f").notify(this))}})}},...HP)),t.getValue(),i.clamp(t.getValue())}registerMidiControl(){return ue(this,ra,"f").proxy.onControlSourceAdd("midi"),Zt(this,tp,!0,"f"),{terminate:()=>{Zt(this,tp,!1,"f"),ue(this,ra,"f").proxy.onControlSourceRemove("midi")}}}get field(){return ue(this,Ur,"f")}get valueMapping(){return ue(this,ta,"f")}get stringMapping(){return ue(this,Es,"f")}get name(){return ue(this,qm,"f")}get anchor(){return ue(this,Hm,"f")}get type(){return ue(this,Ur,"f").type}get address(){return ue(this,Ur,"f").address}get track(){return ue(this,ia,"f")}valueAt(e){let t=ue(this,ia,"f");if(t.nonEmpty()){let i=t.unwrap();if(i.enabled)return this.valueMapping.y(i.valueAt(e,this.getUnitValue()))}return this.getValue()}subscribe(e){return ue(this,Fs,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}catchupAndSubscribeControlSources(e){return ue(this,tp,"f")&&e.onControlSourceAdd("midi"),ue(this,Ur,"f").pointerHub.filter(...HP).forEach(t=>e.onControlSourceAdd(Gx(t.pointerType))),ue(this,ra,"f").subscribe(e)}getValue(){return ue(this,Ur,"f").getValue()}setValue(e){ue(this,Ur,"f").setValue(e)}setUnitValue(e){this.setValue(ue(this,ta,"f").y(e))}getUnitValue(){return ue(this,ta,"f").x(this.getValue())}getControlledValue(){return ue(this,ta,"f").y(this.getControlledUnitValue())}getControlledUnitValue(){return ue(this,hc,"f")??this.getUnitValue()}getControlledPrintValue(){return ue(this,Es,"f").x(this.getControlledValue())}getPrintValue(){return ue(this,Es,"f").x(this.getValue())}setPrintValue(e){let t=ue(this,Es,"f").y(e);t.type==="unitValue"?this.setUnitValue(le(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(ue(this,ta,"f").clamp(ue(this,Ur,"f").initValue))}terminate(){ue(this,Ns,"f").ifSome(e=>e.terminate()),Zt(this,Ns,g.None,"f"),ue(this,Bs,"f").terminate()}};ea=new WeakMap,Ur=new WeakMap,ta=new WeakMap,Es=new WeakMap,qm=new WeakMap,Hm=new WeakMap,Bs=new WeakMap,Fs=new WeakMap,ra=new WeakMap,ia=new WeakMap,Ns=new WeakMap,hc=new WeakMap,tp=new WeakMap;var Gx=r=>{switch(r){case c.Automation:return"automated";case c.Modulation:return"modulated";case c.MidiControl:return"midi";case c.ParameterController:return"external";default:return F(`${r.toString()} is an unknown pointer type`)}};var qx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Wi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fo,ks,Jm,Qm=class{constructor(e,t,i){fo.set(this,void 0),ks.set(this,void 0),Jm.set(this,void 0),qx(this,fo,w.newSet(n=>n.uuid),"f"),qx(this,ks,new Mt,"f"),qx(this,Jm,e.catchupAndSubscribe({onAdded:n=>{let o=t(n.box),a=Wi(this,fo,"f").add(o);I(a,`Could not add ${o}`),Wi(this,ks,"f").proxy.onAdd(o)},onRemoved:n=>{let o=n.box.address.uuid;Wi(this,ks,"f").proxy.onRemove(Wi(this,fo,"f").removeByKey(o))}},i),"f")}subscribe(e){return Wi(this,ks,"f").subscribe(e)}catchupAndSubscribe(e){return Wi(this,fo,"f").forEach(t=>e.onAdd(t)),this.subscribe(e)}adapters(){return Wi(this,fo,"f").values()}size(){return Wi(this,fo,"f").size()}isEmpty(){return this.size()===0}terminate(){Wi(this,fo,"f").clear(),Wi(this,ks,"f").terminate(),Wi(this,Jm,"f").terminate()}};fo=new WeakMap,ks=new WeakMap,Jm=new WeakMap;var Hx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},It=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Jx,Ym,rp,ci,Bn,JP,ui=class{constructor(e,t){Jx.add(this),this.type="audio-effect",this.accepts="audio",rp.set(this,void 0),ci.set(this,void 0),Bn.set(this,void 0),Hx(this,rp,e,"f"),Hx(this,ci,t,"f"),Hx(this,Bn,new pe(It(this,rp,"f")),"f"),this.namedParameter=It(this,Jx,"m",JP).call(this,t)}get box(){return It(this,ci,"f")}get uuid(){return It(this,ci,"f").address.uuid}get address(){return It(this,ci,"f").address}get indexField(){return It(this,ci,"f").index}get labelField(){return It(this,ci,"f").label}get enabledField(){return It(this,ci,"f").enabled}get minimizedField(){return It(this,ci,"f").minimized}get host(){return It(this,ci,"f").host}deviceHost(){return It(this,rp,"f").boxAdapters.adapterFor(It(this,ci,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){It(this,Bn,"f").terminate()}};Ym=ui,rp=new WeakMap,ci=new WeakMap,Bn=new WeakMap,Jx=new WeakSet,JP=function(e){return{delay:It(this,Bn,"f").createParameter(e.delay,S.linearInteger(0,Ym.OffsetFractions.length-1),Ym.OffsetStringMapping,"delay"),feedback:It(this,Bn,"f").createParameter(e.feedback,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"feedback"),cross:It(this,Bn,"f").createParameter(e.cross,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"cross"),filter:It(this,Bn,"f").createParameter(e.filter,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"filter",.5),dry:It(this,Bn,"f").createParameter(e.dry,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"dry"),wet:It(this,Bn,"f").createParameter(e.wet,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"wet")}};ui.OffsetFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();ui.OffsetStringMapping=P.indices("",Ym.OffsetFractions.map(([r,e])=>`${r}/${e}`));var Qx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ct=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Yx,ip,di,Fn,QP,fc=class{constructor(e,t){Yx.add(this),this.type="audio-effect",this.accepts="audio",ip.set(this,void 0),di.set(this,void 0),Fn.set(this,void 0),Qx(this,ip,e,"f"),Qx(this,di,t,"f"),Qx(this,Fn,new pe(Ct(this,ip,"f")),"f"),this.namedParameter=Ct(this,Yx,"m",QP).call(this,t)}get box(){return Ct(this,di,"f")}get uuid(){return Ct(this,di,"f").address.uuid}get address(){return Ct(this,di,"f").address}get indexField(){return Ct(this,di,"f").index}get labelField(){return Ct(this,di,"f").label}get enabledField(){return Ct(this,di,"f").enabled}get minimizedField(){return Ct(this,di,"f").minimized}get host(){return Ct(this,di,"f").host}deviceHost(){return Ct(this,ip,"f").boxAdapters.adapterFor(Ct(this,di,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Ct(this,Fn,"f").terminate()}};ip=new WeakMap,di=new WeakMap,Fn=new WeakMap,Yx=new WeakSet,QP=function(e){return{decay:Ct(this,Fn,"f").createParameter(e.decay,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"Room-Size"),preDelay:Ct(this,Fn,"f").createParameter(e.preDelay,S.exponential(.001,.5),P.numeric({unit:"s",fractionDigits:1,unitPrefix:!0}),"Pre-Delay"),damp:Ct(this,Fn,"f").createParameter(e.damp,S.unipolar(),P.numeric({unit:"%",fractionDigits:0}),"damping"),filter:Ct(this,Fn,"f").createParameter(e.filter,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"filter"),dry:Ct(this,Fn,"f").createParameter(e.dry,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"dry"),wet:Ct(this,Fn,"f").createParameter(e.wet,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"wet")}};var Xx=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},xt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},tw,np,jr,Zi,e1,mc=class{constructor(e,t){tw.add(this),this.type="audio-effect",this.accepts="audio",np.set(this,void 0),jr.set(this,void 0),Zi.set(this,void 0),Xx(this,np,e,"f"),Xx(this,jr,t,"f"),Xx(this,Zi,new pe(xt(this,np,"f")),"f"),this.namedParameter=xt(this,tw,"m",e1).call(this,t)}get box(){return xt(this,jr,"f")}get uuid(){return xt(this,jr,"f").address.uuid}get address(){return xt(this,jr,"f").address}get indexField(){return xt(this,jr,"f").index}get labelField(){return xt(this,jr,"f").label}get enabledField(){return xt(this,jr,"f").enabled}get minimizedField(){return xt(this,jr,"f").minimized}get host(){return xt(this,jr,"f").host}get spectrum(){return xt(this,jr,"f").address.append(4095)}deviceHost(){return xt(this,np,"f").boxAdapters.adapterFor(xt(this,jr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){xt(this,Zi,"f").terminate()}};np=new WeakMap,jr=new WeakMap,Zi=new WeakMap,tw=new WeakSet,e1=function(e){return{highPass:YP(xt(this,Zi,"f"),e.highPass,"High-Pass"),lowShelf:XP(xt(this,Zi,"f"),e.lowShelf,"Low-Shelf"),lowBell:ew(xt(this,Zi,"f"),e.lowBell,"Low-Bell"),midBell:ew(xt(this,Zi,"f"),e.midBell,"Mid-Bell"),highBell:ew(xt(this,Zi,"f"),e.highBell,"High-Bell"),highShelf:XP(xt(this,Zi,"f"),e.highShelf,"High-Shelf"),lowPass:YP(xt(this,Zi,"f"),e.lowPass,"Low-Pass")}};var rw=S.exponential(20,2e4),t1=S.linear(-24,24),r1=S.exponential(.01,10),YP=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),order:r.createParameter(e.order,S.linearInteger(0,3),P.indices("db",["12","24","36","48"]),`${t} Order`),q:r.createParameter(e.q,r1,P.numeric({fractionDigits:3}),`${t} Q`)}),XP=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,t1,P.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5)}),ew=(r,e,t)=>({enabled:r.createParameter(e.enabled,S.bool,P.bool,"enabled"),frequency:r.createParameter(e.frequency,rw,P.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,t1,P.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5),q:r.createParameter(e.q,r1,P.numeric({fractionDigits:3}),`${t} Q`)});var i1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},wr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Xm,eg,br,na=class{constructor(e,t){this.type="marker-event",Xm.set(this,new U),eg.set(this,void 0),br.set(this,void 0),i1(this,eg,e,"f"),i1(this,br,t,"f"),wr(this,Xm,"f").own(wr(this,br,"f").subscribe(ke.Children,i=>{if(!this.trackAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let n=this.trackAdapter.unwrap();wr(this,br,"f").position.address.equals(i.address)?n.onSortingChanged():n.dispatchChange()}}))}get box(){return wr(this,br,"f")}get uuid(){return wr(this,br,"f").address.uuid}get address(){return wr(this,br,"f").address}get position(){return wr(this,br,"f").position.getValue()}get plays(){return wr(this,br,"f").plays.getValue()}get hue(){return wr(this,br,"f").hue.getValue()}get label(){return wr(this,br,"f").label.getValue()}get trackAdapter(){return wr(this,br,"f").track.targetVertex.map(e=>wr(this,eg,"f").boxAdapters.adapterFor(e.box,Nn).markerTrack)}terminate(){wr(this,Xm,"f").terminate()}toString(){return`{MarkerBoxAdapter ${w.toString(wr(this,br,"f").address.uuid).substring(0,4)}, plays: ${this.plays}`}};Xm=new WeakMap,eg=new WeakMap,br=new WeakMap;na.Comparator=(r,e)=>r.position-e.position;var op=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},pi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ap,gc,sp,$s,tg,rg=class{constructor(e,t){ap.set(this,void 0),gc.set(this,void 0),sp.set(this,void 0),$s.set(this,void 0),tg.set(this,void 0),op(this,ap,e,"f"),op(this,gc,t,"f"),this.changeNotifier=new re,op(this,sp,w.newSet(i=>i.uuid),"f"),op(this,$s,xr.create(na.Comparator),"f"),op(this,tg,pi(this,gc,"f").markers.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>{if(i instanceof Al){let n=pi(this,ap,"f").boxAdapters.adapterFor(i,na),o=pi(this,sp,"f").add(n);I(o,"Could not add adapter"),pi(this,$s,"f").add(n),this.dispatchChange()}},onRemoved:({box:{address:{uuid:i}}})=>{pi(this,$s,"f").remove(pi(this,sp,"f").removeByKey(i)),this.dispatchChange()}}),"f")}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return pi(this,ap,"f")}get enabled(){return pi(this,gc,"f").enabled.getValue()}get events(){return pi(this,$s,"f")}get object(){return pi(this,gc,"f")}dispatchChange(){this.changeNotifier.notify()}onSortingChanged(){pi(this,$s,"f").onIndexingChanged(),this.dispatchChange()}terminate(){pi(this,tg,"f").terminate()}};ap=new WeakMap,gc=new WeakMap,sp=new WeakMap,$s=new WeakMap,tg=new WeakMap;var n1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mo=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Gi,ig,Nn=class{constructor(e,t){Gi.set(this,void 0),ig.set(this,void 0),n1(this,Gi,t,"f"),n1(this,ig,new rg(e,mo(this,Gi,"f").markerTrack),"f")}terminate(){}get box(){return mo(this,Gi,"f")}get uuid(){return mo(this,Gi,"f").address.uuid}get address(){return mo(this,Gi,"f").address}get markerTrack(){return mo(this,ig,"f")}get signature(){return[mo(this,Gi,"f").signature.nominator.getValue(),mo(this,Gi,"f").signature.denominator.getValue()]}get signatureDuration(){let{nominator:e,denominator:t}=mo(this,Gi,"f").signature;return Q.fromSignature(e.getValue(),t.getValue())}catchupAndSubscribeSignature(e){return e(this.signature),mo(this,Gi,"f").signature.subscribe(()=>e(this.signature))}};Gi=new WeakMap,ig=new WeakMap;var EB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},lp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},oa,aa=class{constructor(e,t){oa.set(this,void 0),EB(this,oa,t,"f")}get box(){return lp(this,oa,"f")}get uuid(){return lp(this,oa,"f").address.uuid}get address(){return lp(this,oa,"f").address}get source(){return lp(this,oa,"f").source.targetVertex.unwrap("Insufficient Vertex")}get target(){return lp(this,oa,"f").target.targetVertex.unwrap("Insufficient Vertex")}terminate(){}};oa=new WeakMap;var Ms=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},hi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ng,Ds,Is,og,ag,cp,fi=class{constructor(e,t){ng.set(this,void 0),Ds.set(this,void 0),Is.set(this,void 0),og.set(this,void 0),ag.set(this,void 0),cp.set(this,!1),Ms(this,ng,e,"f"),Ms(this,Ds,t,"f"),Ms(this,Is,new U,"f"),Ms(this,og,t.attributes,"f"),Ms(this,ag,hi(this,Is,"f").own(new pe(e)),"f")}get inputs(){throw new Error("Method not implemented.")}get outputs(){throw new Error("Method not implemented.")}own(e){return hi(this,Is,"f").own(e)}ownAll(...e){hi(this,Is,"f").ownAll(...e)}onSelected(){Ms(this,cp,!0,"f")}onDeselected(){Ms(this,cp,!1,"f")}isSelected(){return hi(this,cp,"f")}get box(){return hi(this,Ds,"f")}get attributes(){return hi(this,og,"f")}get uuid(){return hi(this,Ds,"f").address.uuid}get address(){return hi(this,Ds,"f").address}get parameters(){return hi(this,ag,"f")}get modular(){return hi(this,ng,"f").boxAdapters.adapterFor(hi(this,Ds,"f").attributes.collection.targetVertex.unwrap().box,sa)}terminate(){hi(this,Is,"f").terminate()}};ng=new WeakMap,Ds=new WeakMap,Is=new WeakMap,og=new WeakMap,ag=new WeakMap,cp=new WeakMap;var sg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},go=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},lg,la,up,cg,Qt;(function(r){r.Input="input",r.Output="output"})(Qt||(Qt={}));var Yt=class r{static create(e,t,i,n){return new r(e,t,i,n??t.fieldName)}constructor(e,t,i,n){lg.set(this,void 0),la.set(this,void 0),up.set(this,void 0),cg.set(this,void 0),sg(this,lg,e,"f"),sg(this,la,t,"f"),sg(this,up,i,"f"),sg(this,cg,n,"f")}matches(e){return this.direction!==e.direction&&this.field.pointerRules.accepts.some(t=>e.field.pointerRules.accepts.some(i=>i===t))}get connections(){return go(this,la,"f").pointerHub.isEmpty()?R.empty():go(this,la,"f").pointerHub.filter(c.VoltageConnection).map(({box:e})=>go(this,lg,"f").adapterFor(e,aa))}get field(){return go(this,la,"f")}get address(){return go(this,la,"f").address}get direction(){return go(this,up,"f")}get name(){return go(this,cg,"f")}toString(){return`{ModuleConnectorAdapter address: ${go(this,la,"f").address.toString()}, direction: ${go(this,up,"f")}}`}};lg=new WeakMap,la=new WeakMap,up=new WeakMap,cg=new WeakMap;var iw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},dp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ug,pp,hp,vc=class extends fi{constructor(e,t){super(e,t),ug.set(this,void 0),pp.set(this,void 0),hp.set(this,void 0),iw(this,ug,this.parameters.createParameter(t.time,S.exponential(1,1e4),P.numeric({unit:"ms"}),"Time"),"f"),iw(this,pp,Yt.create(e.boxAdapters,t.voltageInput,Qt.Input,"Input"),"f"),iw(this,hp,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Output"),"f")}get parameterTime(){return dp(this,ug,"f")}get voltageInput(){return dp(this,pp,"f")}get voltageOutput(){return dp(this,hp,"f")}get inputs(){return[dp(this,pp,"f")]}get outputs(){return[dp(this,hp,"f")]}};ug=new WeakMap,pp=new WeakMap,hp=new WeakMap;var BB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},o1=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},fp,yc=class extends fi{constructor(e,t){super(e,t),fp.set(this,void 0),BB(this,fp,Yt.create(e.boxAdapters,t.input,Qt.Input,"Input"),"f")}get voltageInput(){return o1(this,fp,"f")}get inputs(){return[o1(this,fp,"f")]}get outputs(){return R.empty()}};fp=new WeakMap;var nw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dg,gp,vp,xc=class extends fi{constructor(e,t){super(e,t),dg.set(this,void 0),gp.set(this,void 0),vp.set(this,void 0),nw(this,dg,this.parameters.createParameter(t.gain,S.DefaultDecibel,P.numeric({unit:"db"}),"Gain"),"f"),nw(this,gp,Yt.create(e.boxAdapters,t.voltageInput,Qt.Input,"Input"),"f"),nw(this,vp,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Output"),"f")}get parameterGain(){return mp(this,dg,"f")}get voltageInput(){return mp(this,gp,"f")}get voltageOutput(){return mp(this,vp,"f")}get inputs(){return[mp(this,gp,"f")]}get outputs(){return[mp(this,vp,"f")]}};dg=new WeakMap,gp=new WeakMap,vp=new WeakMap;var ow=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},aw=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pg,hg,fg,wc=class extends fi{constructor(e,t){super(e,t),pg.set(this,void 0),hg.set(this,void 0),fg.set(this,void 0),ow(this,pg,Yt.create(e.boxAdapters,t.voltageInputX,Qt.Input,"X"),"f"),ow(this,hg,Yt.create(e.boxAdapters,t.voltageInputY,Qt.Input,"Y"),"f"),ow(this,fg,Yt.create(e.boxAdapters,t.voltageOutput,Qt.Output,"Result"),"f")}get inputs(){return[aw(this,pg,"f"),aw(this,hg,"f")]}get outputs(){return[aw(this,fg,"f")]}};pg=new WeakMap,hg=new WeakMap,fg=new WeakMap;var FB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},a1=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},yp,bc=class extends fi{constructor(e,t){super(e,t),yp.set(this,void 0),FB(this,yp,Yt.create(e.boxAdapters,t.output,Qt.Output,"Output"),"f")}get voltageOutput(){return a1(this,yp,"f")}get inputs(){return R.empty()}get outputs(){return[a1(this,yp,"f")]}};yp=new WeakMap;var Ac;(function(r){r.isVertexOfModule=e=>e.box.accept({visitModuleGainBox:()=>!0,visitModuleDelayBox:()=>!0,visitModuleMultiplierBox:()=>!0,visitModularAudioInputBox:()=>!0,visitModularAudioOutputBox:()=>!0})??!1,r.adapterFor=(e,t)=>ee(t.accept({visitModuleGainBox:i=>e.adapterFor(i,xc),visitModuleDelayBox:i=>e.adapterFor(i,vc),visitModuleMultiplierBox:i=>e.adapterFor(i,wc),visitModularAudioInputBox:i=>e.adapterFor(i,bc),visitModularAudioOutputBox:i=>e.adapterFor(i,yc)}),`Could not find ModuleAdapter for ${t.name}`)})(Ac||(Ac={}));var s1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Cs=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mg,gg,Ts,sw,_c=class{constructor(e,t){mg.add(this),gg.set(this,void 0),Ts.set(this,void 0),s1(this,gg,e,"f"),s1(this,Ts,t,"f")}get box(){return Cs(this,Ts,"f")}get uuid(){return Cs(this,Ts,"f").address.uuid}get address(){return Cs(this,Ts,"f").address}get moduleAdapter(){return Ac.adapterFor(Cs(this,gg,"f").boxAdapters,Cs(this,mg,"a",sw).box)}get parameterAdapter(){return this.moduleAdapter.parameters.parameterAt(Cs(this,mg,"a",sw).address)}terminate(){}};gg=new WeakMap,Ts=new WeakMap,mg=new WeakSet,sw=function(){return Cs(this,Ts,"f").parameter.targetVertex.unwrap("Parameter not assigned")};var l1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ar=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Pc,_r,ca=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",Pc.set(this,void 0),_r.set(this,void 0),l1(this,Pc,e,"f"),l1(this,_r,t,"f")}get box(){return Ar(this,_r,"f")}get uuid(){return Ar(this,_r,"f").address.uuid}get address(){return Ar(this,_r,"f").address}get indexField(){return Ar(this,_r,"f").index}get labelField(){return Ar(this,_r,"f").label}get enabledField(){return Ar(this,_r,"f").enabled}get minimizedField(){return Ar(this,_r,"f").minimized}get host(){return Ar(this,_r,"f").host}parameterAt(e){return F("Not yet implemented")}deviceHost(){return Ar(this,Pc,"f").boxAdapters.adapterFor(Ar(this,_r,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}modular(){return Ar(this,Pc,"f").boxAdapters.adapterFor(Ar(this,_r,"f").modularSetup.targetVertex.unwrap("No Modular found").box,sa)}elements(){return Ar(this,_r,"f").userInterface.elements.pointerHub.filter(c.DeviceUserInterface).map(e=>Ar(this,Pc,"f").boxAdapters.adapterFor(e.box,_c))}terminate(){}};Pc=new WeakMap,_r=new WeakMap;var xp=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ue=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Sc,ua,Ec,Lr,Rs,Os,sa=class{constructor(e,t){Sc.set(this,new U),ua.set(this,void 0),Ec.set(this,void 0),Lr.set(this,void 0),Rs.set(this,void 0),Os.set(this,void 0),xp(this,Ec,e,"f"),xp(this,Lr,t,"f"),xp(this,ua,Ue(this,Sc,"f").own(new Mt),"f"),xp(this,Rs,w.newSet(s=>s.uuid),"f"),xp(this,Os,w.newSet(s=>s.uuid),"f");let i=s=>{let l=Ac.adapterFor(Ue(this,Ec,"f").boxAdapters,s.box);Ue(this,Rs,"f").add(l)&&Ue(this,ua,"f").proxy.onModuleAdded(l)},n=s=>Ue(this,ua,"f").proxy.onModuleRemoved(Ue(this,Rs,"f").removeByKey(s.address.uuid)),o=s=>{let l=Ue(this,Ec,"f").boxAdapters.adapterFor(s.box,aa);Ue(this,Os,"f").add(l)&&Ue(this,ua,"f").proxy.onConnectionAdded(l)},a=s=>Ue(this,ua,"f").proxy.onConnectionRemoved(Ue(this,Os,"f").removeByKey(s.address.uuid));Ue(this,Lr,"f").modules.pointerHub.filter(c.ModuleCollection).forEach(i),Ue(this,Lr,"f").connections.pointerHub.filter(c.ConnectionCollection).forEach(o),Ue(this,Sc,"f").own(Ue(this,Lr,"f").modules.pointerHub.subscribe({onAdded:i,onRemoved:n},c.ModuleCollection)),Ue(this,Sc,"f").own(Ue(this,Lr,"f").connections.pointerHub.subscribe({onAdded:o,onRemoved:a},c.ConnectionCollection))}catchupAndSubscribe(e){return bx(e.onModuleAdded,t=>Ue(this,Rs,"f").forEach(i=>t(i))),bx(e.onConnectionAdded,t=>Ue(this,Os,"f").forEach(i=>t(i))),Ue(this,ua,"f").subscribe(e)}get box(){return Ue(this,Lr,"f")}get address(){return Ue(this,Lr,"f").address}get uuid(){return Ue(this,Lr,"f").address.uuid}get editingField(){return Ue(this,Lr,"f").editing}get labelField(){return Ue(this,Lr,"f").label}get modules(){return Ue(this,Rs,"f").values()}get connections(){return Ue(this,Os,"f").values()}get device(){return Ue(this,Ec,"f").boxAdapters.adapterFor(ee(Ue(this,Lr,"f").device.pointerHub.incoming().at(0),"No device found").box,ca)}terminate(){console.debug(`terminate ${this}`),Ue(this,Sc,"f").terminate()}};Sc=new WeakMap,ua=new WeakMap,Ec=new WeakMap,Lr=new WeakMap,Rs=new WeakMap,Os=new WeakMap;var wp=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},hr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},lw,Fc,bp,vg,Bc,_p,yg,Ap,xg,c1,kn=class{constructor(e,t){lw.add(this),this.type="groove-adapter",bp.set(this,new U),vg.set(this,void 0),Bc.set(this,void 0),_p.set(this,void 0),yg.set(this,new nf({duration:()=>hr(this,xg,"f"),fx:i=>Sx(i,hr(this,Ap,"f")),fy:i=>Sx(i,1-hr(this,Ap,"f"))})),Ap.set(this,0),xg.set(this,Q.SemiQuaver*2),wp(this,vg,e,"f"),wp(this,Bc,t,"f"),wp(this,_p,hr(this,bp,"f").own(new pe(hr(this,vg,"f"))),"f"),this.namedParameter=hr(this,lw,"m",c1).call(this,t),hr(this,bp,"f").ownAll(this.namedParameter.duration.catchupAndSubscribe(i=>wp(this,xg,i.getValue(),"f")),this.namedParameter.amount.catchupAndSubscribe(i=>wp(this,Ap,yP(i.getValue(),.01),"f")))}unwarp(e){return hr(this,yg,"f").unwarp(e)}warp(e){return hr(this,yg,"f").warp(e)}get box(){return hr(this,Bc,"f")}get uuid(){return hr(this,Bc,"f").address.uuid}get address(){return hr(this,Bc,"f").address}terminate(){hr(this,bp,"f").terminate()}};Fc=kn,bp=new WeakMap,vg=new WeakMap,Bc=new WeakMap,_p=new WeakMap,yg=new WeakMap,Ap=new WeakMap,xg=new WeakMap,lw=new WeakSet,c1=function(e){return{duration:hr(this,_p,"f").createParameter(e.duration,S.values(Fc.DurationPPQNs),P.values("",Fc.DurationPPQNs,Fc.DurationStrings),"duration"),amount:hr(this,_p,"f").createParameter(e.amount,S.unipolar(),P.percent({fractionDigits:0}),"amount")}};kn.Durations=[[1,8],[1,4],[1,4],[1,2],[1,1],[2,1],[4,1],[8,1],[16,1]];kn.DurationPPQNs=Fc.Durations.map(([r,e])=>Q.fromSignature(r,e));kn.DurationStrings=Fc.Durations.map(([r,e])=>`${r}/${e}`);var Nc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ht=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},$n,da,kc,wg,bg,Pp,Sp,cw,pa=class{constructor(e,t,i,n,o){$n.set(this,void 0),da.set(this,void 0),kc.set(this,void 0),wg.set(this,void 0),bg.set(this,void 0),Pp.set(this,new U),Sp.set(this,void 0),cw.set(this,g.None),Nc(this,$n,e,"f"),Nc(this,da,t,"f"),Nc(this,kc,i,"f"),Nc(this,wg,n,"f"),Nc(this,bg,o??0,"f"),Nc(this,Sp,ht(this,Pp,"f").own(new re),"f"),ht(this,Pp,"f").own(ht(this,$n,"f").subscribe(()=>ht(this,Sp,"f").notify(this))),e.getValue(),t.clamp(e.getValue())}get field(){return ht(this,$n,"f")}get valueMapping(){return ht(this,da,"f")}get stringMapping(){return ht(this,kc,"f")}get name(){return ht(this,wg,"f")}get anchor(){return ht(this,bg,"f")}get type(){return ht(this,$n,"f").type}get address(){return ht(this,$n,"f").address}get track(){return ht(this,cw,"f")}subscribe(e){return ht(this,Sp,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}getValue(){return ht(this,$n,"f").getValue()}setValue(e){ht(this,$n,"f").setValue(ht(this,da,"f").clamp(e))}setUnitValue(e){this.setValue(ht(this,da,"f").y(e))}getUnitValue(){return ht(this,da,"f").x(this.getValue())}getPrintValue(){return ht(this,kc,"f").x(this.getValue())}setPrintValue(e){let t=ht(this,kc,"f").y(e);t.type==="unitValue"?this.setUnitValue(le(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(ht(this,da,"f").clamp(ht(this,$n,"f").initValue))}terminate(){ht(this,Pp,"f").terminate()}};$n=new WeakMap,da=new WeakMap,kc=new WeakMap,wg=new WeakMap,bg=new WeakMap,Pp=new WeakMap,Sp=new WeakMap,cw=new WeakMap;var $c=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},mi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mn,Ag,_g,Pg,Sg,Eg,Bg=class{constructor(e){Mn.set(this,void 0),Ag.set(this,void 0),_g.set(this,void 0),Pg.set(this,void 0),Sg.set(this,void 0),Eg.set(this,void 0),$c(this,Mn,e,"f"),$c(this,Ag,new pa(mi(this,Mn,"f").keyboard,S.values([88,76,61,49]),P.numeric({fractionDigits:1}),"Keyboard Type"),"f"),$c(this,_g,new pa(mi(this,Mn,"f").timeRangeInQuarters,S.exponential(1,64),P.numeric({fractionDigits:1}),"Time-Range"),"f"),$c(this,Pg,new pa(mi(this,Mn,"f").noteScale,S.exponential(.5,2),P.numeric({fractionDigits:1}),"Note Scale"),"f"),$c(this,Sg,new pa(mi(this,Mn,"f").noteLabels,S.bool,P.bool,"Note Labels"),"f"),$c(this,Eg,new pa(mi(this,Mn,"f").transpose,S.linearInteger(-48,48),P.numeric({fractionDigits:0}),"Transpose"),"f")}subscribe(e){return mi(this,Mn,"f").box.subscribe(ke.Children,()=>e(this))}get object(){return mi(this,Mn,"f")}get keyboard(){return mi(this,Ag,"f")}get timeRangeInQuarters(){return mi(this,_g,"f")}get noteScale(){return mi(this,Pg,"f")}get noteLabels(){return mi(this,Sg,"f")}get transpose(){return mi(this,Eg,"f")}};Mn=new WeakMap,Ag=new WeakMap,_g=new WeakMap,Pg=new WeakMap,Sg=new WeakMap,Eg=new WeakMap;var Ep=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Tt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Vs,Kr,Mc,Fg,Ng,Dc=class{constructor(e,t){Vs.set(this,void 0),Kr.set(this,void 0),Mc.set(this,void 0),Fg.set(this,void 0),Ng.set(this,void 0),Ep(this,Vs,e,"f"),Ep(this,Kr,t,"f"),Ep(this,Mc,Lt.create(Tt(this,Kr,"f").audioUnits,i=>Tt(this,Vs,"f").boxAdapters.adapterFor(i,li),c.AudioUnits),"f"),Ep(this,Fg,new Qm(Tt(this,Kr,"f").audioBusses.pointerHub,i=>Tt(this,Vs,"f").boxAdapters.adapterFor(i,dr),c.AudioBusses),"f"),Ep(this,Ng,new Bg(Tt(this,Kr,"f").pianoMode),"f")}get uuid(){return Tt(this,Kr,"f").address.uuid}get address(){return Tt(this,Kr,"f").address}get box(){return Tt(this,Kr,"f")}get audioBusses(){return Tt(this,Fg,"f")}get audioUnits(){return Tt(this,Mc,"f")}get clips(){return Tt(this,Mc,"f").adapters().flatMap(e=>e.tracks.collection.adapters()).flatMap(e=>e.clips.collection.adapters())}get groove(){return Tt(this,Vs,"f").boxAdapters.adapterFor(Tt(this,Kr,"f").groove.targetVertex.unwrap("no groove").box,kn)}get timeline(){return Tt(this,Vs,"f").boxAdapters.adapterFor(Tt(this,Kr,"f").timeline.targetVertex.unwrap("no timeline").box,Nn)}get pianoMode(){return Tt(this,Ng,"f")}get created(){return new Date(Tt(this,Kr,"f").created.getValue())}get midiOutputDevices(){return Tt(this,Kr,"f").outputMidiDevices.pointerHub.incoming().map(({box:e})=>Ne(e,Ri))}terminate(){Tt(this,Mc,"f").terminate()}};Vs=new WeakMap,Kr=new WeakMap,Mc=new WeakMap,Fg=new WeakMap,Ng=new WeakMap;var uw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Xt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dw,Bp,qi,ha,u1,Ic=class{constructor(e,t){dw.add(this),this.type="instrument",this.accepts="audio",Bp.set(this,void 0),qi.set(this,void 0),ha.set(this,void 0),uw(this,Bp,e,"f"),uw(this,qi,t,"f"),uw(this,ha,new pe(Xt(this,Bp,"f")),"f"),this.namedParameter=Xt(this,dw,"m",u1).call(this,t)}get box(){return Xt(this,qi,"f")}get uuid(){return Xt(this,qi,"f").address.uuid}get address(){return Xt(this,qi,"f").address}get labelField(){return Xt(this,qi,"f").label}get iconField(){return Xt(this,qi,"f").icon}get defaultTrackType(){return ie.Audio}get enabledField(){return Xt(this,qi,"f").enabled}get minimizedField(){return Xt(this,qi,"f").minimized}get acceptsMidiEvents(){return!1}deviceHost(){return Xt(this,Bp,"f").boxAdapters.adapterFor(Xt(this,qi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Xt(this,ha,"f").terminate()}};Bp=new WeakMap,qi=new WeakMap,ha=new WeakMap,dw=new WeakSet,u1=function(e){return{flutter:Xt(this,ha,"f").createParameter(e.flutter,S.unipolar(),P.percent(),"flutter"),wow:Xt(this,ha,"f").createParameter(e.wow,S.unipolar(),P.percent(),"wow"),noise:Xt(this,ha,"f").createParameter(e.noise,S.unipolar(),P.percent(),"noise"),saturation:Xt(this,ha,"f").createParameter(e.saturation,S.unipolar(),P.percent(),"saturation")}};var Dn=(()=>{let t=[1,2,3,4],i=["12","24","36","48"],n=[Le.sine,Le.triangle,Le.saw,Le.square],o=["Sine","Triangle","Saw","Square"];return{MIN_CUTOFF:20,MAX_CUTOFF:2e4,CUTOFF_VALUE_MAPPING:S.exponential(20,2e4),CUTOFF_STRING_MAPPING:P.numeric({unit:"Hz"}),FILTER_ORDER_VALUES:t,FILTER_ORDER_STRINGS:i,FILTER_ORDER_VALUE_MAPPING:S.values(t),FILTER_ORDER_STRING_MAPPING:P.values("db",t,i),LFO_WAVEFORM_VALUES:n,LFO_WAVEFORM_STRINGS:o,LFO_WAVEFORM_VALUE_MAPPING:S.values(n),LFO_WAVEFORM_STRING_MAPPING:P.values("",n,o)}})();var pw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},hw,Fp,Hi,Ve,d1,Cc=class{constructor(e,t){hw.add(this),this.type="instrument",this.accepts="midi",Fp.set(this,void 0),Hi.set(this,void 0),Ve.set(this,void 0),pw(this,Fp,e,"f"),pw(this,Hi,t,"f"),pw(this,Ve,new pe(Be(this,Fp,"f")),"f"),this.namedParameter=Be(this,hw,"m",d1).call(this,t)}get box(){return Be(this,Hi,"f")}get uuid(){return Be(this,Hi,"f").address.uuid}get address(){return Be(this,Hi,"f").address}get labelField(){return Be(this,Hi,"f").label}get iconField(){return Be(this,Hi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Be(this,Hi,"f").enabled}get minimizedField(){return Be(this,Hi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Be(this,Fp,"f").boxAdapters.adapterFor(Be(this,Hi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Be(this,Ve,"f").terminate()}};Fp=new WeakMap,Hi=new WeakMap,Ve=new WeakMap,hw=new WeakSet,d1=function(e){let t=[pn.Monophonic,pn.Polyphonic];return{oscillators:e.oscillators.fields().map(i=>({waveform:Be(this,Ve,"f").createParameter(i.waveform,S.linearInteger(0,3),P.indices("",["Sine","Triangle","Sawtooth","Square"]),"Waveform"),volume:Be(this,Ve,"f").createParameter(i.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"Volume"),octave:Be(this,Ve,"f").createParameter(i.octave,S.linearInteger(-3,3),P.numeric({unit:"oct"}),"Octave",.5),tune:Be(this,Ve,"f").createParameter(i.tune,S.linear(-1200,1200),P.numeric({unit:"ct",fractionDigits:0}),"Tune",.5)})),noise:{volume:Be(this,Ve,"f").createParameter(e.noise.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"Volume"),attack:Be(this,Ve,"f").createParameter(e.noise.attack,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Attack"),hold:Be(this,Ve,"f").createParameter(e.noise.hold,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Hold"),release:Be(this,Ve,"f").createParameter(e.noise.release,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Release")},filterOrder:Be(this,Ve,"f").createParameter(e.filterOrder,Dn.FILTER_ORDER_VALUE_MAPPING,Dn.FILTER_ORDER_STRING_MAPPING,"Flt. Order"),cutoff:Be(this,Ve,"f").createParameter(e.cutoff,Dn.CUTOFF_VALUE_MAPPING,Dn.CUTOFF_STRING_MAPPING,"Flt. Cutoff"),resonance:Be(this,Ve,"f").createParameter(e.resonance,S.exponential(.01,10),P.numeric({unit:"q",fractionDigits:3}),"Flt. Q"),attack:Be(this,Ve,"f").createParameter(e.attack,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Attack"),decay:Be(this,Ve,"f").createParameter(e.decay,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Decay"),sustain:Be(this,Ve,"f").createParameter(e.sustain,S.unipolar(),P.percent({fractionDigits:1}),"Sustain"),release:Be(this,Ve,"f").createParameter(e.release,S.exponential(.001,5),P.numeric({unit:"s",fractionDigits:3}),"Release"),filterEnvelope:Be(this,Ve,"f").createParameter(e.filterEnvelope,S.bipolar(),P.percent({fractionDigits:1}),"Flt. Env.",.5),filterKeyboard:Be(this,Ve,"f").createParameter(e.filterKeyboard,S.bipolar(),P.percent({fractionDigits:1}),"Flt. Kbd.",.5),voicingMode:Be(this,Ve,"f").createParameter(e.voicingMode,S.values(t),P.values("",t,["mono","poly"]),"Play Mode",.5),glideTime:Be(this,Ve,"f").createParameter(e.glideTime,S.unipolar(),P.percent({fractionDigits:1}),"Glide time",0),unisonCount:Be(this,Ve,"f").createParameter(e.unisonCount,S.values([1,3,5]),P.values("#",[1,3,5],[1,3,5].map(i=>String(i))),"Unisono",0),unisonDetune:Be(this,Ve,"f").createParameter(e.unisonDetune,S.exponential(1,1200),P.numeric({unit:"ct",fractionDigits:0}),"Detune",0),unisonStereo:Be(this,Ve,"f").createParameter(e.unisonStereo,S.unipolar(),P.percent({fractionDigits:0}),"Stereo",0),lfoWaveform:Be(this,Ve,"f").createParameter(e.lfo.waveform,Dn.LFO_WAVEFORM_VALUE_MAPPING,Dn.LFO_WAVEFORM_STRING_MAPPING,"LFO Shape",0),lfoRate:Be(this,Ve,"f").createParameter(e.lfo.rate,S.exponential(1e-4,30),P.numeric({unit:"Hz",fractionDigits:1,unitPrefix:!0}),"Rate",0),lfoTargetTune:Be(this,Ve,"f").createParameter(e.lfo.targetTune,S.bipolar(),P.percent({fractionDigits:1}),"Vibrato \u29BF",.5),lfoTargetVolume:Be(this,Ve,"f").createParameter(e.lfo.targetVolume,S.bipolar(),P.percent({fractionDigits:1}),"Tremolo \u29BF",.5),lfoTargetCutoff:Be(this,Ve,"f").createParameter(e.lfo.targetCutoff,S.bipolar(),P.percent({fractionDigits:1}),"Cutoff \u29BF",.5)}};var fw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Rt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mw,kg,Np,gi,In,p1,Ji=class{constructor(e,t){mw.add(this),this.type="midi-effect",this.accepts="midi",Np.set(this,void 0),gi.set(this,void 0),In.set(this,void 0),fw(this,Np,e,"f"),fw(this,gi,t,"f"),fw(this,In,new pe(Rt(this,Np,"f")),"f"),this.namedParameter=Rt(this,mw,"m",p1).call(this,t)}get box(){return Rt(this,gi,"f")}get uuid(){return Rt(this,gi,"f").address.uuid}get address(){return Rt(this,gi,"f").address}get indexField(){return Rt(this,gi,"f").index}get labelField(){return Rt(this,gi,"f").label}get enabledField(){return Rt(this,gi,"f").enabled}get minimizedField(){return Rt(this,gi,"f").minimized}get host(){return Rt(this,gi,"f").host}deviceHost(){return Rt(this,Np,"f").boxAdapters.adapterFor(Rt(this,gi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Rt(this,In,"f").terminate()}};kg=Ji,Np=new WeakMap,gi=new WeakMap,In=new WeakMap,mw=new WeakSet,p1=function(e){return{modeIndex:Rt(this,In,"f").createParameter(e.modeIndex,S.linearInteger(0,2),P.indices("",["Up","Down","UpDown"]),"mode"),numOctaves:Rt(this,In,"f").createParameter(e.numOctaves,S.linearInteger(1,5),P.numeric({unit:"",fractionDigits:0}),"Octaves"),rate:Rt(this,In,"f").createParameter(e.rateIndex,S.linearInteger(0,kg.RateFractions.length-1),kg.RateStringMapping,"Rate"),gate:Rt(this,In,"f").createParameter(e.gate,S.linear(0,2),P.percent({fractionDigits:0}),"Gate"),repeat:Rt(this,In,"f").createParameter(e.repeat,S.linearInteger(1,16),P.numeric({fractionDigits:0}),"Repeat"),velocity:Rt(this,In,"f").createParameter(e.velocity,S.bipolar(),P.percent({fractionDigits:0,bipolar:!1}),"Velocity")}};Ji.RateFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();Ji.RateStringMapping=P.indices("",kg.RateFractions.map(([r,e])=>`${r}/${e}`));var gw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},er=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},vw,kp,vi,zs,h1,Tc=class{constructor(e,t){vw.add(this),this.type="midi-effect",this.accepts="midi",kp.set(this,void 0),vi.set(this,void 0),zs.set(this,void 0),gw(this,kp,e,"f"),gw(this,vi,t,"f"),gw(this,zs,new pe(er(this,kp,"f")),"f"),this.namedParameter=er(this,vw,"m",h1).call(this,t)}get box(){return er(this,vi,"f")}get uuid(){return er(this,vi,"f").address.uuid}get address(){return er(this,vi,"f").address}get indexField(){return er(this,vi,"f").index}get labelField(){return er(this,vi,"f").label}get enabledField(){return er(this,vi,"f").enabled}get minimizedField(){return er(this,vi,"f").minimized}get host(){return er(this,vi,"f").host}deviceHost(){return er(this,kp,"f").boxAdapters.adapterFor(er(this,vi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){er(this,zs,"f").terminate()}};kp=new WeakMap,vi=new WeakMap,zs=new WeakMap,vw=new WeakSet,h1=function(e){return{octaves:er(this,zs,"f").createParameter(e.octaves,S.linearInteger(-7,7),P.numeric({unit:"oct",fractionDigits:0}),"octaves"),semiTones:er(this,zs,"f").createParameter(e.semiTones,S.linearInteger(-36,36),P.numeric({unit:"st",fractionDigits:0}),"semi-tones"),cent:er(this,zs,"f").createParameter(e.cents,S.linear(-50,50),P.numeric({unit:"cents",fractionDigits:1}),"cents")}};var yw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Pr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},xw,$p,Qi,Rc,f1,Oc=class{constructor(e,t){xw.add(this),this.type="instrument",this.accepts="midi",$p.set(this,void 0),Qi.set(this,void 0),Rc.set(this,void 0),yw(this,$p,e,"f"),yw(this,Qi,t,"f"),yw(this,Rc,new pe(Pr(this,$p,"f")),"f"),this.namedParameter=Pr(this,xw,"m",f1).call(this,t)}get box(){return Pr(this,Qi,"f")}get uuid(){return Pr(this,Qi,"f").address.uuid}get address(){return Pr(this,Qi,"f").address}get labelField(){return Pr(this,Qi,"f").label}get iconField(){return Pr(this,Qi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Pr(this,Qi,"f").enabled}get minimizedField(){return Pr(this,Qi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Pr(this,$p,"f").boxAdapters.adapterFor(Pr(this,Qi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Pr(this,Rc,"f").terminate()}};$p=new WeakMap,Qi=new WeakMap,Rc=new WeakMap,xw=new WeakSet,f1=function(e){return{volume:Pr(this,Rc,"f").createParameter(e.volume,S.DefaultDecibel,P.numeric({unit:"db",fractionDigits:1}),"volume"),release:Pr(this,Rc,"f").createParameter(e.release,S.exponential(.001,8),P.numeric({unit:"s",fractionDigits:3}),"release")}};var Vc=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},H=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ww,Us,fa,we,$g,Mg,Wr,zc,m1,Uc=class{constructor(e,t){ww.add(this),this.class="device-host",this.accepts=!1,this.type="instrument",Us.set(this,new U),fa.set(this,void 0),we.set(this,void 0),$g.set(this,void 0),Mg.set(this,void 0),Wr.set(this,void 0),zc.set(this,g.None),Vc(this,fa,e,"f"),Vc(this,we,t,"f"),Vc(this,$g,H(this,Us,"f").own(Lt.create(H(this,we,"f").midiEffects,i=>H(this,fa,"f").boxAdapters.adapterFor(i,ne.isMidiEffect),c.MidiEffectHost)),"f"),Vc(this,Mg,H(this,Us,"f").own(Lt.create(H(this,we,"f").audioEffects,i=>H(this,fa,"f").boxAdapters.adapterFor(i,ne.isAudioEffect),c.AudioEffectHost)),"f"),Vc(this,Wr,H(this,Us,"f").own(new pe(H(this,fa,"f"))),"f"),this.namedParameter=H(this,ww,"m",m1).call(this,t),H(this,Us,"f").own(H(this,we,"f").file.catchupAndSubscribe(i=>{Vc(this,zc,i.targetVertex.map(({box:n})=>H(this,fa,"f").boxAdapters.adapterFor(n,Vi)),"f"),H(this,zc,"f").unwrapOrNull()?.getOrCreateLoader()}))}get box(){return H(this,we,"f")}get uuid(){return H(this,we,"f").address.uuid}get address(){return H(this,we,"f").address}get peakAddress(){return H(this,we,"f").address.append(1001)}get indexField(){return H(this,we,"f").index}get gate(){return H(this,we,"f").gate.getValue()}get exclude(){return H(this,we,"f").exclude.getValue()}get label(){return`${this.device().labelField.getValue()} > ${H(this,zc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get iconField(){return H(this,we,"f").icon}get defaultTrackType(){return ie.Notes}get acceptsMidiEvents(){return!0}get midiEffectsField(){return H(this,we,"f").midiEffects}get inputField(){return this.audioUnitBoxAdapter().box.input}get audioEffectsField(){return H(this,we,"f").audioEffects}get tracksField(){return this.audioUnitBoxAdapter().box.tracks}get isAudioUnit(){return!1}file(){return H(this,zc,"f")}fileUUID(){return H(this,we,"f").file.targetAddress.unwrap().uuid}resetParameters(){H(this,we,"f").mute.reset(),H(this,we,"f").solo.reset(),H(this,we,"f").exclude.reset(),H(this,we,"f").polyphone.reset(),H(this,we,"f").pitch.reset(),H(this,we,"f").attack.reset(),H(this,we,"f").release.reset(),H(this,we,"f").sampleStart.reset(),H(this,we,"f").sampleEnd.reset(),H(this,we,"f").gate.reset()}copyToIndex(e){Vo.create(H(this,we,"f").graph,w.generate(),t=>{t.file.refer(H(this,we,"f").file.targetVertex.unwrap()),t.device.refer(H(this,we,"f").device.targetVertex.unwrap()),t.index.setValue(e),t.mute.setValue(H(this,we,"f").mute.getValue()),t.solo.setValue(H(this,we,"f").solo.getValue()),t.sampleStart.setValue(H(this,we,"f").sampleStart.getValue()),t.sampleEnd.setValue(H(this,we,"f").sampleEnd.getValue()),t.attack.setValue(H(this,we,"f").attack.getValue()),t.release.setValue(H(this,we,"f").release.getValue()),t.pitch.setValue(H(this,we,"f").pitch.getValue()),t.exclude.setValue(H(this,we,"f").exclude.getValue()),t.gate.setValue(H(this,we,"f").gate.getValue())})}get midiEffects(){return H(this,$g,"f")}get inputAdapter(){return g.wrap(this)}get audioEffects(){return H(this,Mg,"f")}get labelField(){return H(this,we,"f").label}get enabledField(){return H(this,we,"f").enabled}get minimizedField(){return H(this,we,"f").minimized}device(){return H(this,fa,"f").boxAdapters.adapterFor(H(this,we,"f").device.targetVertex.unwrap().box,ma)}deviceHost(){return this.device().deviceHost()}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){H(this,Us,"f").terminate()}};Us=new WeakMap,fa=new WeakMap,we=new WeakMap,$g=new WeakMap,Mg=new WeakMap,Wr=new WeakMap,zc=new WeakMap,ww=new WeakSet,m1=function(e){return{gate:H(this,Wr,"f").createParameter(e.gate,S.linearInteger(0,2),P.indices("",["Off","On","Loop"]),"Gate"),mute:H(this,Wr,"f").createParameter(e.mute,S.bool,P.bool,"Mute"),solo:H(this,Wr,"f").createParameter(e.solo,S.bool,P.bool,"Solo"),polyphone:H(this,Wr,"f").createParameter(e.polyphone,S.bool,P.bool,"Polyphone"),exclude:H(this,Wr,"f").createParameter(e.exclude,S.bool,P.bool,"Exclude"),pitch:H(this,Wr,"f").createParameter(e.pitch,S.linear(-1200,1200),P.numeric({unit:"cents",bipolar:!0,fractionDigits:0}),"Pitch",0),sampleStart:H(this,Wr,"f").createParameter(e.sampleStart,S.unipolar(),P.percent(),"Start",0),sampleEnd:H(this,Wr,"f").createParameter(e.sampleEnd,S.unipolar(),P.percent(),"End",1),attack:H(this,Wr,"f").createParameter(e.attack,S.exponential(.001,5),P.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Attack"),release:H(this,Wr,"f").createParameter(e.release,S.exponential(.001,5),P.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Release")}};var Dg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Sr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},jc,Yi,Mp,Ig,ma=class{constructor(e,t){this.type="instrument",this.accepts="midi",jc.set(this,void 0),Yi.set(this,void 0),Mp.set(this,void 0),Ig.set(this,void 0),Dg(this,jc,e,"f"),Dg(this,Yi,t,"f"),Dg(this,Mp,Lt.create(t.samples,i=>e.boxAdapters.adapterFor(i,Uc),c.Sample),"f"),Dg(this,Ig,new pe(Sr(this,jc,"f")),"f")}reset(){Sr(this,Mp,"f").adapters().forEach(e=>e.box.delete())}get box(){return Sr(this,Yi,"f")}get uuid(){return Sr(this,Yi,"f").address.uuid}get address(){return Sr(this,Yi,"f").address}get labelField(){return Sr(this,Yi,"f").label}get iconField(){return Sr(this,Yi,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Sr(this,Yi,"f").enabled}get minimizedField(){return Sr(this,Yi,"f").minimized}get acceptsMidiEvents(){return!0}get samples(){return Sr(this,Mp,"f")}get context(){return Sr(this,jc,"f")}deviceHost(){return Sr(this,jc,"f").boxAdapters.adapterFor(Sr(this,Yi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Sr(this,Ig,"f").terminate()}};jc=new WeakMap,Yi=new WeakMap,Mp=new WeakMap,Ig=new WeakMap;var bw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ot=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Aw,Dp,yi,Cn,g1,Lc=class{constructor(e,t){Aw.add(this),this.type="audio-effect",this.accepts="audio",Dp.set(this,void 0),yi.set(this,void 0),Cn.set(this,void 0),bw(this,Dp,e,"f"),bw(this,yi,t,"f"),bw(this,Cn,new pe(Ot(this,Dp,"f")),"f"),this.namedParameter=Ot(this,Aw,"m",g1).call(this,t)}get box(){return Ot(this,yi,"f")}get uuid(){return Ot(this,yi,"f").address.uuid}get address(){return Ot(this,yi,"f").address}get indexField(){return Ot(this,yi,"f").index}get labelField(){return Ot(this,yi,"f").label}get enabledField(){return Ot(this,yi,"f").enabled}get minimizedField(){return Ot(this,yi,"f").minimized}get host(){return Ot(this,yi,"f").host}deviceHost(){return Ot(this,Dp,"f").boxAdapters.adapterFor(Ot(this,yi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Ot(this,Cn,"f").terminate()}};Dp=new WeakMap,yi=new WeakMap,Cn=new WeakMap,Aw=new WeakSet,g1=function(e){return{volume:Ot(this,Cn,"f").createParameter(e.volume,S.decibel(-72,0,12),P.numeric({unit:"db",fractionDigits:1}),"Volume"),panning:Ot(this,Cn,"f").createParameter(e.panning,S.bipolar(),P.panning,"Panning",.5),stereo:Ot(this,Cn,"f").createParameter(e.stereo,S.bipolar(),P.numeric({unit:"%",fractionDigits:0}),"stereo",.5),invertL:Ot(this,Cn,"f").createParameter(e.invertL,S.bool,P.bool,"Invert Left"),invertR:Ot(this,Cn,"f").createParameter(e.invertR,S.bool,P.bool,"Invert Right"),swap:Ot(this,Cn,"f").createParameter(e.swap,S.bool,P.bool,"Swap")}};var js;(function(r){r.checkType=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="groove-adapter"})(js||(js={}));var v1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Er=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Kc,Br,Wc=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",Kc.set(this,void 0),Br.set(this,void 0),v1(this,Kc,e,"f"),v1(this,Br,t,"f"),this.groove()}get box(){return Er(this,Br,"f")}get uuid(){return Er(this,Br,"f").address.uuid}get address(){return Er(this,Br,"f").address}get indexField(){return Er(this,Br,"f").index}get labelField(){return Er(this,Br,"f").label}get enabledField(){return Er(this,Br,"f").enabled}get minimizedField(){return Er(this,Br,"f").minimized}get host(){return Er(this,Br,"f").host}deviceHost(){return Er(this,Kc,"f").boxAdapters.adapterFor(Er(this,Br,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}groove(){return Er(this,Kc,"f").boxAdapters.adapterFor(Er(this,Br,"f").groove.targetVertex.unwrap("no groove").box,js.checkType)}catchupAndSubscribeGroove(e){return Er(this,Br,"f").groove.catchupAndSubscribe(t=>e(Er(this,Kc,"f").boxAdapters.adapterFor(t.targetVertex.unwrap("No groove found").box,js.checkType)))}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Kc=new WeakMap,Br=new WeakMap;var y1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Xi=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Cg,Zr,Zc=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",Cg.set(this,void 0),Zr.set(this,void 0),y1(this,Cg,e,"f"),y1(this,Zr,t,"f")}get box(){return Xi(this,Zr,"f")}get uuid(){return Xi(this,Zr,"f").address.uuid}get address(){return Xi(this,Zr,"f").address}get indexField(){return Xi(this,Zr,"f").index}get labelField(){return Xi(this,Zr,"f").label}get enabledField(){return Xi(this,Zr,"f").enabled}get minimizedField(){return Xi(this,Zr,"f").minimized}get host(){return Xi(this,Zr,"f").host}get commentField(){return Xi(this,Zr,"f").comment}deviceHost(){return Xi(this,Cg,"f").boxAdapters.adapterFor(Xi(this,Zr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Cg=new WeakMap,Zr=new WeakMap;var x1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},en=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Tg,Gr,Gc=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",Tg.set(this,void 0),Gr.set(this,void 0),x1(this,Tg,e,"f"),x1(this,Gr,t,"f")}get box(){return en(this,Gr,"f")}get uuid(){return en(this,Gr,"f").address.uuid}get address(){return en(this,Gr,"f").address}get indexField(){return en(this,Gr,"f").index}get labelField(){return en(this,Gr,"f").label}get enabledField(){return en(this,Gr,"f").enabled}get minimizedField(){return en(this,Gr,"f").minimized}get host(){return en(this,Gr,"f").host}get commentField(){return en(this,Gr,"f").comment}deviceHost(){return en(this,Tg,"f").boxAdapters.adapterFor(en(this,Gr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Tg=new WeakMap,Gr=new WeakMap;var ga=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_w,Pw,Ip,Fr,Rg,qc,tn,xi,Hc,w1,Sw,Jc=class{constructor(e,t){_w.add(this),this.type="instrument",this.accepts="midi",Pw.set(this,new U),Ip.set(this,void 0),Fr.set(this,void 0),Rg.set(this,void 0),qc.set(this,void 0),tn.set(this,void 0),xi.set(this,void 0),Hc.set(this,K.Empty),Sw.set(this,i=>i.match({none:()=>{Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear()},some:n=>n.soundfont.match({none:()=>{Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear(),Fe(this,Hc,"f").terminate(),ga(this,Hc,n.subscribe(o=>{if(o.type==="loaded"){let a=n.soundfont.unwrap();Fe(this,xi,"f").wrap(a.presets[this.presetIndex]??a.presets[0]),Fe(this,tn,"f").wrap(a)}else o.type==="error"?(Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear()):o.type==="idle"&&(Fe(this,xi,"f").clear(),Fe(this,tn,"f").clear())}),"f")},some:o=>{Fe(this,tn,"f").wrap(o),Fe(this,xi,"f").wrap(o.presets[this.presetIndex]??o.presets[0])}})})),ga(this,Ip,e,"f"),ga(this,Fr,t,"f"),ga(this,Rg,new pe(Fe(this,Ip,"f")),"f"),this.namedParameter=Fe(this,_w,"m",w1).call(this,t),ga(this,qc,new Xr,"f"),ga(this,tn,new Xr,"f"),ga(this,xi,new Xr,"f"),Fe(this,Pw,"f").ownAll(Fe(this,qc,"f").subscribe(Fe(this,Sw,"f")),Fe(this,Fr,"f").file.catchupAndSubscribe(({targetVertex:i})=>Fe(this,qc,"f").wrapOption(i.map(({box:n})=>e.soundfontManager.getOrCreate(n.address.uuid)))),Fe(this,Fr,"f").presetIndex.catchupAndSubscribe(i=>Fe(this,tn,"f").match({none:()=>Fe(this,xi,"f").clear(),some:n=>Fe(this,xi,"f").wrap(n.presets[i.getValue()]??n.presets[0])})))}get loader(){return Fe(this,qc,"f")}get soundfont(){return Fe(this,tn,"f")}get preset(){return Fe(this,xi,"f")}get presetIndex(){return Fe(this,Fr,"f").presetIndex.getValue()}get box(){return Fe(this,Fr,"f")}get uuid(){return Fe(this,Fr,"f").address.uuid}get address(){return Fe(this,Fr,"f").address}get labelField(){return Fe(this,Fr,"f").label}get iconField(){return Fe(this,Fr,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Fe(this,Fr,"f").enabled}get minimizedField(){return Fe(this,Fr,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Fe(this,Ip,"f").boxAdapters.adapterFor(Fe(this,Fr,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Fe(this,Hc,"f").terminate(),ga(this,Hc,K.Empty,"f"),Fe(this,Rg,"f").terminate()}};Pw=new WeakMap,Ip=new WeakMap,Fr=new WeakMap,Rg=new WeakMap,qc=new WeakMap,tn=new WeakMap,xi=new WeakMap,Hc=new WeakMap,Sw=new WeakMap,_w=new WeakSet,w1=function(e){return{}};var b1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Cp=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Og,Ls,Vg=class{constructor(e,t){Og.set(this,void 0),Ls.set(this,void 0),b1(this,Og,e,"f"),b1(this,Ls,t,"f")}get box(){return Cp(this,Ls,"f")}get uuid(){return Cp(this,Ls,"f").address.uuid}get address(){return Cp(this,Ls,"f").address}get soundfont(){return this.getOrCreateLoader().soundfont}getOrCreateLoader(){return Cp(this,Og,"f").soundfontManager.getOrCreate(Cp(this,Ls,"f").address.uuid)}terminate(){}};Og=new WeakMap,Ls=new WeakMap;var Ew=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ot=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Bw,Tp,wi,tr,A1,Qc=class{constructor(e,t){Bw.add(this),this.type="audio-effect",this.accepts="audio",Tp.set(this,void 0),wi.set(this,void 0),tr.set(this,void 0),Ew(this,Tp,e,"f"),Ew(this,wi,t,"f"),Ew(this,tr,new pe(ot(this,Tp,"f")),"f"),this.namedParameter=ot(this,Bw,"m",A1).call(this,t)}get box(){return ot(this,wi,"f")}get uuid(){return ot(this,wi,"f").address.uuid}get address(){return ot(this,wi,"f").address}get indexField(){return ot(this,wi,"f").index}get labelField(){return ot(this,wi,"f").label}get enabledField(){return ot(this,wi,"f").enabled}get minimizedField(){return ot(this,wi,"f").minimized}get host(){return ot(this,wi,"f").host}deviceHost(){return ot(this,Tp,"f").boxAdapters.adapterFor(ot(this,wi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){ot(this,tr,"f").terminate()}};Tp=new WeakMap,wi=new WeakMap,tr=new WeakMap,Bw=new WeakSet,A1=function(e){return{lookahead:ot(this,tr,"f").createParameter(e.lookahead,S.bool,P.bool,"Lookahead"),automakeup:ot(this,tr,"f").createParameter(e.automakeup,S.bool,P.bool,"Auto Makeup"),autoattack:ot(this,tr,"f").createParameter(e.autoattack,S.bool,P.bool,"Auto Attack"),autorelease:ot(this,tr,"f").createParameter(e.autorelease,S.bool,P.bool,"Auto Release"),inputgain:ot(this,tr,"f").createParameter(e.inputgain,S.linear(-30,30),P.decible,"Input Gain"),threshold:ot(this,tr,"f").createParameter(e.threshold,S.linear(-60,0),P.decible,"Threshold"),ratio:ot(this,tr,"f").createParameter(e.ratio,S.exponential(1,24),P.numeric({fractionDigits:1}),"Ratio"),knee:ot(this,tr,"f").createParameter(e.knee,S.linear(0,24),P.decible,"Knee"),attack:ot(this,tr,"f").createParameter(e.attack,S.linear(0,100),P.numeric({unit:"ms",fractionDigits:1}),"Attack Time"),release:ot(this,tr,"f").createParameter(e.release,S.linear(5,1500),P.numeric({unit:"ms",fractionDigits:1}),"Release Time"),makeup:ot(this,tr,"f").createParameter(e.makeup,S.linear(-40,40),P.decible,"Makeup Gain"),mix:ot(this,tr,"f").createParameter(e.mix,S.unipolar(),P.percent(),"Dry/Wet")}};var Fw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Gt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Nw,Rp,bi,va,_1,Yc=class{constructor(e,t){Nw.add(this),this.type="audio-effect",this.accepts="audio",Rp.set(this,void 0),bi.set(this,void 0),va.set(this,void 0),Fw(this,Rp,e,"f"),Fw(this,bi,t,"f"),Fw(this,va,new pe(Gt(this,Rp,"f")),"f"),this.namedParameter=Gt(this,Nw,"m",_1).call(this,t)}get box(){return Gt(this,bi,"f")}get uuid(){return Gt(this,bi,"f").address.uuid}get address(){return Gt(this,bi,"f").address}get indexField(){return Gt(this,bi,"f").index}get labelField(){return Gt(this,bi,"f").label}get enabledField(){return Gt(this,bi,"f").enabled}get minimizedField(){return Gt(this,bi,"f").minimized}get host(){return Gt(this,bi,"f").host}deviceHost(){return Gt(this,Rp,"f").boxAdapters.adapterFor(Gt(this,bi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Gt(this,va,"f").terminate()}};Rp=new WeakMap,bi=new WeakMap,va=new WeakMap,Nw=new WeakSet,_1=function(e){return{crush:Gt(this,va,"f").createParameter(e.crush,S.unipolar(),P.percent(),"Crush"),bits:Gt(this,va,"f").createParameter(e.bits,S.linearInteger(1,16),P.numeric(),"Bits"),boost:Gt(this,va,"f").createParameter(e.boost,S.linear(0,24),P.decible,"Boost"),mix:Gt(this,va,"f").createParameter(e.mix,S.exponential(.001,1),P.percent(),"Mix")}};var kw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},fr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},$w,Op,Ai,Xc,P1,eu=class{constructor(e,t){$w.add(this),this.type="audio-effect",this.accepts="audio",Op.set(this,void 0),Ai.set(this,void 0),Xc.set(this,void 0),kw(this,Op,e,"f"),kw(this,Ai,t,"f"),kw(this,Xc,new pe(fr(this,Op,"f")),"f"),this.namedParameter=fr(this,$w,"m",P1).call(this,t)}get box(){return fr(this,Ai,"f")}get uuid(){return fr(this,Ai,"f").address.uuid}get address(){return fr(this,Ai,"f").address}get indexField(){return fr(this,Ai,"f").index}get labelField(){return fr(this,Ai,"f").label}get enabledField(){return fr(this,Ai,"f").enabled}get minimizedField(){return fr(this,Ai,"f").minimized}get host(){return fr(this,Ai,"f").host}deviceHost(){return fr(this,Op,"f").boxAdapters.adapterFor(fr(this,Ai,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){fr(this,Xc,"f").terminate()}};Op=new WeakMap,Ai=new WeakMap,Xc=new WeakMap,$w=new WeakSet,P1=function(e){return{drive:fr(this,Xc,"f").createParameter(e.drive,S.linear(0,30),P.decible,"Drive"),volume:fr(this,Xc,"f").createParameter(e.volume,S.linear(-18,0),P.decible,"Volume")}};var zg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Vp,zp,_i,tu,ru,iu=class{constructor(e,t){Vp.set(this,new U),this.type="instrument",this.accepts="midi",zp.set(this,void 0),_i.set(this,void 0),tu.set(this,void 0),ru.set(this,void 0),zg(this,zp,e,"f"),zg(this,_i,t,"f"),zg(this,tu,new Xr,"f"),zg(this,ru,Nt(this,Vp,"f").own(new pe(Nt(this,zp,"f"))),"f"),Nt(this,Vp,"f").ownAll(t.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:i})=>Nt(this,ru,"f").createParameter(Ne(i,Oi).value,S.unipolar(),P.percent({fractionDigits:1}),"",0),onRemoved:({box:i})=>Nt(this,ru,"f").removeParameter(Ne(i,Oi).value.address)}),Nt(this,_i,"f").device.catchupAndSubscribe(({targetVertex:i})=>i.match({none:()=>Nt(this,tu,"f").clear(),some:({box:n})=>Nt(this,tu,"f").wrap(Ne(n,Ri))})))}get box(){return Nt(this,_i,"f")}get uuid(){return Nt(this,_i,"f").address.uuid}get address(){return Nt(this,_i,"f").address}get labelField(){return Nt(this,_i,"f").label}get iconField(){return Nt(this,_i,"f").icon}get defaultTrackType(){return ie.Notes}get enabledField(){return Nt(this,_i,"f").enabled}get minimizedField(){return Nt(this,_i,"f").minimized}get acceptsMidiEvents(){return!0}get parameters(){return Nt(this,ru,"f")}get midiDevice(){return Nt(this,tu,"f")}deviceHost(){return Nt(this,zp,"f").boxAdapters.adapterFor(Nt(this,_i,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Nt(this,Vp,"f").terminate()}};Vp=new WeakMap,zp=new WeakMap,_i=new WeakMap,tu=new WeakMap,ru=new WeakMap;var Ug=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},wt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Mw,Up,Pi,Tn,jp,S1,nu=class{constructor(e,t){Mw.add(this),this.type="midi-effect",this.accepts="midi",Up.set(this,void 0),Pi.set(this,void 0),Tn.set(this,void 0),jp.set(this,void 0),Ug(this,Up,e,"f"),Ug(this,Pi,t,"f"),Ug(this,Tn,new pe(wt(this,Up,"f")),"f"),Ug(this,jp,nl.create(),"f"),this.namedParameter=wt(this,Mw,"m",S1).call(this,t)}computeVelocity(e,t){let{magnetPosition:i,magnetStrength:n,randomSeed:o,randomAmount:a,offset:s,mix:l}=this.namedParameter;wt(this,jp,"f").setSeed(o.valueAt(e)+e);let u=t+(i.valueAt(e)-t)*n.valueAt(e),p=(wt(this,jp,"f").uniform()*2-1)*a.valueAt(e),d=s.valueAt(e),f=l.valueAt(e);return t*(1-f)+Qr(u+p+d)*f}get box(){return wt(this,Pi,"f")}get uuid(){return wt(this,Pi,"f").address.uuid}get address(){return wt(this,Pi,"f").address}get indexField(){return wt(this,Pi,"f").index}get labelField(){return wt(this,Pi,"f").label}get enabledField(){return wt(this,Pi,"f").enabled}get minimizedField(){return wt(this,Pi,"f").minimized}get host(){return wt(this,Pi,"f").host}deviceHost(){return wt(this,Up,"f").boxAdapters.adapterFor(wt(this,Pi,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){wt(this,Tn,"f").terminate()}};Up=new WeakMap,Pi=new WeakMap,Tn=new WeakMap,jp=new WeakMap,Mw=new WeakSet,S1=function(e){return{magnetPosition:wt(this,Tn,"f").createParameter(e.magnetPosition,S.unipolar(),P.percent(),"Position"),magnetStrength:wt(this,Tn,"f").createParameter(e.magnetStrength,S.unipolar(),P.percent(),"Strength"),randomSeed:wt(this,Tn,"f").createParameter(e.randomSeed,S.linearInteger(0,65535),P.numeric({unit:"",fractionDigits:0}),"Seed"),randomAmount:wt(this,Tn,"f").createParameter(e.randomAmount,S.unipolar(),P.percent(),"Amount"),offset:wt(this,Tn,"f").createParameter(e.offset,S.bipolar(),P.percent(),"Offset"),mix:wt(this,Tn,"f").createParameter(e.mix,S.unipolar(),P.percent(),"Mix")}};var Dw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Vt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Iw,Cw,Lp,Si,Rn,E1,rn=class{constructor(e,t){Iw.add(this),this.type="audio-effect",this.accepts="audio",Lp.set(this,void 0),Si.set(this,void 0),Rn.set(this,void 0),Dw(this,Lp,e,"f"),Dw(this,Si,t,"f"),Dw(this,Rn,new pe(Vt(this,Lp,"f")),"f"),this.namedParameter=Vt(this,Iw,"m",E1).call(this,t)}get box(){return Vt(this,Si,"f")}get uuid(){return Vt(this,Si,"f").address.uuid}get address(){return Vt(this,Si,"f").address}get indexField(){return Vt(this,Si,"f").index}get labelField(){return Vt(this,Si,"f").label}get enabledField(){return Vt(this,Si,"f").enabled}get minimizedField(){return Vt(this,Si,"f").minimized}get host(){return Vt(this,Si,"f").host}deviceHost(){return Vt(this,Lp,"f").boxAdapters.adapterFor(Vt(this,Si,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Vt(this,Rn,"f").terminate()}};Cw=rn,Lp=new WeakMap,Si=new WeakMap,Rn=new WeakMap,Iw=new WeakSet,E1=function(e){let{RateFractions:t,RateStringMapping:i}=Cw;return{slope:Vt(this,Rn,"f").createParameter(e.slope,S.bipolar(),P.percent({fractionDigits:1}),"Slope",.5),symmetry:Vt(this,Rn,"f").createParameter(e.symmetry,S.unipolar(),P.percent({fractionDigits:1,bipolar:!0}),"Symmetry",.5),rate:Vt(this,Rn,"f").createParameter(e.rate,S.values(t.map((n,o)=>o)),i,"Rate",0),depth:Vt(this,Rn,"f").createParameter(e.depth,S.unipolar(),P.percent({fractionDigits:1}),"Depth",0),offset:Vt(this,Rn,"f").createParameter(e.offset,S.linear(-180,180),P.numeric({unit:"\xB0",fractionDigits:0}),"Offset",.5),channelOffset:Vt(this,Rn,"f").createParameter(e.channelOffset,S.linear(-180,180),P.numeric({unit:"\xB0",fractionDigits:0}),"Ch. Offset",.5)}};rn.RateFractions=or.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();rn.RateStringMapping=P.indices("",Cw.RateFractions.map(([r,e])=>`${r}/${e}`));var Tw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},at=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rw,Kp,Ei,rr,B1,ou=class{constructor(e,t){Rw.add(this),this.type="audio-effect",this.accepts="audio",Kp.set(this,void 0),Ei.set(this,void 0),rr.set(this,void 0),Tw(this,Kp,e,"f"),Tw(this,Ei,t,"f"),Tw(this,rr,new pe(at(this,Kp,"f")),"f"),this.namedParameter=at(this,Rw,"m",B1).call(this,t)}get box(){return at(this,Ei,"f")}get uuid(){return at(this,Ei,"f").address.uuid}get address(){return at(this,Ei,"f").address}get indexField(){return at(this,Ei,"f").index}get labelField(){return at(this,Ei,"f").label}get enabledField(){return at(this,Ei,"f").enabled}get minimizedField(){return at(this,Ei,"f").minimized}get host(){return at(this,Ei,"f").host}deviceHost(){return at(this,Kp,"f").boxAdapters.adapterFor(at(this,Ei,"f").host.targetVertex.unwrap("no device-host").box,ne.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){at(this,rr,"f").terminate()}};Kp=new WeakMap,Ei=new WeakMap,rr=new WeakMap,Rw=new WeakSet,B1=function(e){return{preDelay:at(this,rr,"f").createParameter(e.preDelay,S.linear(0,1e3),P.numeric({unit:e.preDelay.unit}),"Pre-Delay"),bandwidth:at(this,rr,"f").createParameter(e.bandwidth,S.unipolar(),P.percent(),"Bandwidth"),inputDiffusion1:at(this,rr,"f").createParameter(e.inputDiffusion1,S.unipolar(),P.percent(),"Tank 1"),inputDiffusion2:at(this,rr,"f").createParameter(e.inputDiffusion2,S.unipolar(),P.percent(),"Tank 2"),decay:at(this,rr,"f").createParameter(e.decay,S.unipolar(),P.percent(),"Decay"),decayDiffusion1:at(this,rr,"f").createParameter(e.decayDiffusion1,S.unipolar(),P.percent(),"Tank 1"),decayDiffusion2:at(this,rr,"f").createParameter(e.decayDiffusion2,S.unipolar(),P.percent(),"Tank 2"),damping:at(this,rr,"f").createParameter(e.damping,S.unipolar(),P.percent(),"Damping"),excursionRate:at(this,rr,"f").createParameter(e.excursionRate,S.unipolar(),P.numeric({unit:e.excursionRate.unit}),"Rate"),excursionDepth:at(this,rr,"f").createParameter(e.excursionDepth,S.unipolar(),P.numeric({unit:e.excursionDepth.unit}),"Depth"),wet:at(this,rr,"f").createParameter(e.wet,S.DefaultDecibel,P.decible,"Wet"),dry:at(this,rr,"f").createParameter(e.dry,S.DefaultDecibel,P.decible,"Dry")}};var jg=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},J=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ow,X,vo,Wp,Lg,F1,Kg=class{constructor(e){Ow.add(this),X.set(this,void 0),vo.set(this,void 0),Wp.set(this,void 0),Lg.set(this,void 0),jg(this,X,e,"f"),jg(this,vo,w.newSet(t=>t.uuid),"f"),jg(this,Wp,new Set,"f"),jg(this,Lg,J(this,X,"f").boxGraph.subscribeToAllUpdates({onUpdate:t=>{if(t.type==="delete"){let i=J(this,vo,"f").getOrNull(t.uuid);Z(i)&&(J(this,Wp,"f").add(i.box),J(this,vo,"f").removeByValue(i).terminate())}}}),"f")}terminate(){J(this,vo,"f").values().forEach(e=>e.terminate()),J(this,vo,"f").clear(),J(this,Lg,"f").terminate()}adapterFor(e,t){if(J(this,Wp,"f").has(e))return F(`Cannot resolve adapter for already deleted box: ${e}`);let i=J(this,vo,"f").getOrNull(e.address.uuid);if(i===null){i=J(this,Ow,"m",F1).call(this,e);let n=J(this,vo,"f").add(i);I(n,`Could not add adapter for ${e}`)}return typeof t=="function"?Object.hasOwn(t,"prototype")?i instanceof t?i:F(`${i} is not instance of ${t}`):t(i)?i:F(`${i} did not pass custom type guard`):F("Unknown checkType method")}};X=new WeakMap,vo=new WeakMap,Wp=new WeakMap,Lg=new WeakMap,Ow=new WeakSet,F1=function(e){return ee(e.accept({visitArpeggioDeviceBox:t=>new Ji(J(this,X,"f"),t),visitAudioBusBox:t=>new dr(J(this,X,"f"),t),visitAudioClipBox:t=>new io(J(this,X,"f"),t),visitAudioFileBox:t=>new Vi(J(this,X,"f"),t),visitAudioTimeStretchBox:t=>new yn(J(this,X,"f"),t),visitAudioPitchStretchBox:t=>new vn(J(this,X,"f"),t),visitTransientMarkerBox:t=>new Cl(t),visitWarpMarkerBox:t=>new Zo(J(this,X,"f"),t),visitAudioRegionBox:t=>new Jo(J(this,X,"f"),t),visitAudioUnitBox:t=>new li(J(this,X,"f"),t),visitAuxSendBox:t=>new lc(J(this,X,"f"),t),visitCompressorDeviceBox:t=>new Qc(J(this,X,"f"),t),visitCrusherDeviceBox:t=>new Yc(J(this,X,"f"),t),visitDattorroReverbDeviceBox:t=>new ou(J(this,X,"f"),t),visitDelayDeviceBox:t=>new ui(J(this,X,"f"),t),visitDeviceInterfaceKnobBox:t=>new _c(J(this,X,"f"),t),visitTidalDeviceBox:t=>new rn(J(this,X,"f"),t),visitFoldDeviceBox:t=>new eu(J(this,X,"f"),t),visitGrooveShuffleBox:t=>new kn(J(this,X,"f"),t),visitMarkerBox:t=>new na(J(this,X,"f"),t),visitMIDIOutputDeviceBox:t=>new iu(J(this,X,"f"),t),visitModularAudioInputBox:t=>new bc(J(this,X,"f"),t),visitModularAudioOutputBox:t=>new yc(J(this,X,"f"),t),visitModularBox:t=>new sa(J(this,X,"f"),t),visitModularDeviceBox:t=>new ca(J(this,X,"f"),t),visitModuleConnectionBox:t=>new aa(J(this,X,"f"),t),visitModuleDelayBox:t=>new vc(J(this,X,"f"),t),visitModuleGainBox:t=>new xc(J(this,X,"f"),t),visitModuleMultiplierBox:t=>new wc(J(this,X,"f"),t),visitNanoDeviceBox:t=>new Oc(J(this,X,"f"),t),visitNoteClipBox:t=>new Zl(J(this,X,"f"),t),visitNoteEventBox:t=>new cs(J(this,X,"f"),t),visitNoteEventCollectionBox:t=>new ii(J(this,X,"f"),t),visitNoteRegionBox:t=>new Qo(J(this,X,"f"),t),visitPitchDeviceBox:t=>new Tc(J(this,X,"f"),t),visitPlayfieldDeviceBox:t=>new ma(J(this,X,"f"),t),visitPlayfieldSampleBox:t=>new Uc(J(this,X,"f"),t),visitRevampDeviceBox:t=>new mc(J(this,X,"f"),t),visitReverbDeviceBox:t=>new fc(J(this,X,"f"),t),visitRootBox:t=>new Dc(J(this,X,"f"),t),visitSoundfontDeviceBox:t=>new Jc(J(this,X,"f"),t),visitSoundfontFileBox:t=>new Vg(J(this,X,"f"),t),visitStereoToolDeviceBox:t=>new Lc(J(this,X,"f"),t),visitTapeDeviceBox:t=>new Ic(J(this,X,"f"),t),visitTimelineBox:t=>new Nn(J(this,X,"f"),t),visitTrackBox:t=>new mt(J(this,X,"f"),t),visitUnknownAudioEffectDeviceBox:t=>new Zc(J(this,X,"f"),t),visitUnknownMidiEffectDeviceBox:t=>new Gc(J(this,X,"f"),t),visitValueClipBox:t=>new Wo(J(this,X,"f"),t),visitValueEventBox:t=>new eo(J(this,X,"f"),t),visitValueEventCollectionBox:t=>new cr(J(this,X,"f"),t),visitValueRegionBox:t=>new co(J(this,X,"f"),t),visitVaporisateurDeviceBox:t=>new Cc(J(this,X,"f"),t),visitVelocityDeviceBox:t=>new nu(J(this,X,"f"),t),visitZeitgeistDeviceBox:t=>new Wc(J(this,X,"f"),t)}),`Could not find factory for ${e}`)};var au;(function(r){r.PEAKS=Ae.compose(w.Lowest).append(0),r.SPECTRUM=Ae.compose(w.Lowest).append(1),r.WAVEFORM=Ae.compose(w.Lowest).append(2)})(au||(au={}));var N1;(function(r){r.countStems=e=>e.match({none:()=>1,some:t=>Object.keys(t).length}),r.sanitizeFileName=e=>e.replace(/[<>:"/\\|?*\x00-\x1F]/g,"_").trim(),r.sanitizeExportNamesInPlace=e=>{let t=new Map,i=n=>{let o=t.get(n)??0,a=n;for(;t.has(a);)o++,a=`${n} ${o}`;return t.set(n,o),t.set(a,1),a};Object.keys(e).forEach(n=>{let o=e[n];o.fileName=i(r.sanitizeFileName(o.fileName))})}})(N1||(N1={}));var k1=yr.createBuilder({position:yr.float,playbackTimestamp:yr.float,countInBeatsRemaining:yr.float,isPlaying:yr.bool,isCountingIn:yr.bool,isRecording:yr.bool});var $1;(function(r){r.store=(e,t,i)=>{if(i==="")return F("MetaData.store: origin must be unique to your app.");let n=e.pointerHub.filter(c.MetaData).map(({box:a})=>a).find(a=>a instanceof Qn&&a.origin.getValue()===i),o=a=>{a.target.refer(e),a.origin.setValue(i),a.value.setValue(JSON.stringify(t))};Ca(n)?o(n):Qn.create(e.graph,w.generate(),o)},r.read=(e,t)=>{if(t==="")return F("MetaData.read: origin must be unique to your app.");let i=e.pointerHub.filter(c.MetaData).map(({box:n})=>n).find(n=>n instanceof Qn&&n.origin.getValue()===t);if(Ca(i)){let{status:n,value:o,error:a}=jn(()=>JSON.parse(i.value.getValue()));if(n==="success")return o;console.warn(a)}return null},r.clear=(e,t)=>{if(t==="")return F("MetaData.clear: origin must be unique to your app.");e.pointerHub.filter(c.MetaData).map(({box:i})=>i).filter(i=>i instanceof Qn&&i.origin.getValue()===t).forEach(i=>i.delete())}})($1||($1={}));var Vw=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ya=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Wg,Zg,Gg,Ks,Bi=class{constructor(e,t){Wg.set(this,new U),Zg.set(this,void 0),Gg.set(this,void 0),Ks.set(this,void 0),Vw(this,Zg,e,"f"),Vw(this,Gg,t,"f"),Vw(this,Ks,new rt(128),"f"),ya(this,Wg,"f").own(ya(this,Zg,"f").broadcastIntegers(ya(this,Gg,"f"),new Int32Array(ya(this,Ks,"f").buffer),Mi))}noteOn(e){e>=0&&e<128&&ya(this,Ks,"f").setBit(e,!0)}noteOff(e){e>=0&&e<128&&ya(this,Ks,"f").setBit(e,!1)}reset(){}clear(){ya(this,Ks,"f").clear()}terminate(){ya(this,Wg,"f").terminate()}toString(){return`{${this.constructor.name}}`}};Wg=new WeakMap,Zg=new WeakMap,Gg=new WeakMap,Ks=new WeakMap;var st;(function(r){let e;(function(t){t[t.NoteOn=144]="NoteOn",t[t.NoteOff=128]="NoteOff",t[t.PitchBend=224]="PitchBend",t[t.Controller=176]="Controller",t[t.Start=250]="Start",t[t.Continue=251]="Continue",t[t.Stop=252]="Stop",t[t.Clock=248]="Clock",t[t.Position=242]="Position"})(e=r.Command||(r.Command={})),r.readCommand=t=>t[0]&240,r.readChannel=t=>t[0]&15,r.readParam1=t=>t.length>1?t[1]&255:0,r.readParam2=t=>t.length>2?t[2]&255:0,r.readPitch=t=>t[1],r.readVelocity=t=>t[2]/127,r.isNoteOn=t=>r.readCommand(t)===e.NoteOn&&r.readVelocity(t)>0,r.isNoteOff=t=>r.readCommand(t)===e.NoteOff||r.readCommand(t)===e.NoteOn&&r.readVelocity(t)===0,r.isPitchWheel=t=>r.readCommand(t)===e.PitchBend,r.isController=t=>r.readCommand(t)===e.Controller,r.isClock=t=>t[0]===e.Clock,r.isStart=t=>t[0]===e.Start,r.isContinue=t=>t[0]===e.Continue,r.isStop=t=>t[0]===e.Stop,r.isPosition=t=>t[0]===e.Position,r.asPitchBend=t=>{let i=r.readParam1(t)&127,n=r.readParam2(t)&127,o=i|n<<7;return 8192>=o?o/8192-1:(o-8191)/8192},r.asValue=t=>{let i=r.readParam2(t);return i>64?.5+(i-63)/128:i<64?i/128:.5},r.Clock=new Uint8Array([e.Clock]),r.Start=new Uint8Array([e.Start]),r.Continue=new Uint8Array([e.Continue]),r.Stop=new Uint8Array([e.Stop]),r.noteOn=(t,i,n)=>new Uint8Array([e.NoteOn|t,i,n]),r.noteOff=(t,i)=>new Uint8Array([e.NoteOff|t,i,0]),r.control=(t,i,n)=>new Uint8Array([e.Controller|t,i&127,n&127]),r.position=(t,i)=>new Uint8Array([e.Position,t&127,i&127]),r.positionInPPQN=t=>{let i=Math.floor(t/96),n=i&127,o=i>>7&127;return new Uint8Array([e.Position,n,o])},r.accept=(t,i)=>{Ia(t)||(r.isNoteOn(t)?_(i.noteOn,r.readPitch(t),r.readVelocity(t)):r.isNoteOff(t)?_(i.noteOff,r.readPitch(t)):r.isPitchWheel(t)?_(i.pitchBend,r.asPitchBend(t)):r.isController(t)?_(i.controller,r.readParam1(t),r.readParam2(t)/127):r.isClock(t)?_(i.clock):r.isStart(t)?_(i.start):r.isContinue(t)?_(i.continue):r.isStop(t)?_(i.stop):r.isPosition(t)&&_(i.songPos,r.readParam1(t)|r.readParam2(t)<<7))},r.debug=t=>t===null?"null":r.isNoteOn(t)?`NoteOn #${r.readChannel(t)} ${r.readPitch(t)} : ${r.readVelocity(t).toFixed(2)}`:r.isNoteOff(t)?`NoteOff #${r.readChannel(t)} ${r.readPitch(t)}`:r.isPitchWheel(t)?`PitchWheel #${r.readChannel(t)} ${r.asPitchBend(t)}`:r.isController(t)?`Control #${r.readChannel(t)} ${r.asValue(t)}`:r.isClock(t)?"Clock":r.isStart(t)?"Start":r.isContinue(t)?"Continue":r.isStop(t)?"Stop":r.isPosition(t)?`SongPosition ${r.readParam1(t)|r.readParam2(t)<<7}`:"Unknown"})(st||(st={}));var xa;(function(r){r.on=(e,t,i)=>({type:"note-on",uuid:e,pitch:t,velocity:i}),r.off=(e,t)=>({type:"note-off",uuid:e,pitch:t}),r.isOn=e=>e.type==="note-on",r.isOff=e=>e.type==="note-off",r.fromEvent=(e,t)=>{let i=e.data;if(st.isNoteOn(i)){let n=st.readPitch(i),o=st.readVelocity(i);return{type:"note-on",uuid:t,pitch:n,velocity:o}}else if(st.isNoteOff(i)){let n=st.readPitch(i);return{type:"note-off",uuid:t,pitch:n}}return F("Unknown MIDI event")}})(xa||(xa={}));var M1;(function(r){r.start=(e,t,i,n=1)=>{let o=!0;return e(xa.on(t,i,n)),{terminate:()=>{o&&(e(xa.off(t,i)),o=!1)}}}})(M1||(M1={}));var NB,kB,$B,MB,DB;NB=new WeakMap,kB=new WeakMap,$B=new WeakMap,MB=new WeakMap,DB=new WeakMap;var IB=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},qg=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ws,Hg=class{constructor(){Ws.set(this,void 0),IB(this,Ws,Ae.newSet(e=>e.field.address),"f")}register(e){return qg(this,Ws,"f").add(e),{terminate:()=>qg(this,Ws,"f").removeByValue(e)}}get(e){return qg(this,Ws,"f").get(e)}opt(e){return qg(this,Ws,"f").opt(e)}};Ws=new WeakMap;var wa={isClipBox:r=>r.accept({visitNoteClipBox:e=>!0,visitAudioClipBox:e=>!0,visitValueClipBox:e=>!0})??!1,isRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1,asRegionBox:r=>r.accept({visitNoteRegionBox:e=>e,visitAudioRegionBox:e=>e,visitValueRegionBox:e=>e})??F("Could not cast to AnyRegionBox"),isLoopableRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1};var Jg;(function(r){r.isTimeSignatureValid=(e,t)=>!Number.isInteger(e)||e<1||e>31?Ln.err("Numerator needs to be a interger between 1 and 31"):!Number.isInteger(t)||t<1||t>32||t&t-1?Ln.err("Denominator must be a power of two between 1 and 32"):Ln.ok([e,t]),r.MIN_BPM=30,r.MAX_BPM=1e3,r.clampBpm=e=>Number.isFinite(e)?le(e,r.MIN_BPM,r.MAX_BPM):120,r.hasOverlappingRegions=e=>e.boxes().some(t=>t.accept({visitTrackBox:i=>{for(let[n,o]of R.iterateAdjacent(i.regions.pointerHub.incoming().map(({box:a})=>wa.asRegionBox(a)).sort(({position:a},{position:s})=>a.getValue()-s.getValue()))){if(n instanceof Co&&n.timeBase.getValue()===sr.Seconds)return!1;if(n.position.getValue()+n.duration.getValue()>o.position.getValue())return!0}return!1}})??!1)})(Jg||(Jg={}));var D1;(function(r){r.parseTimeSignature=e=>{let[t,i]=e.split("/"),n=parseInt(t,10),o=parseInt(i,10);return Jg.isTimeSignatureValid(n,o)}})(D1||(D1={}));var Qg;(function(r){r.reader=({sab:e,numChunks:t,numberOfChannels:i,bufferSize:n},o)=>{let a=!0,s=new Int32Array(e,0,2),l=new Float32Array(e,8),u=new Float32Array(i*n),p=typeof document>"u",d=()=>{if(!a)return;let f=Atomics.load(s,1),v=Atomics.load(s,0);if(f===v){if(p)Atomics.wait(s,0,v);else{setTimeout(d,1);return}v=Atomics.load(s,0)}for(;f!==v;){let m=f*i*n;u.set(l.subarray(m,m+i*n));let y=[];for(let x=0;x<i;x++){let D=x*n,M=D+n;y.push(u.slice(D,M))}if(f=(f+1)%t,Atomics.store(s,1,f),!a)return;o(y)}d()};return d(),{stop:()=>a=!1}},r.writer=({sab:e,numChunks:t,numberOfChannels:i,bufferSize:n})=>{let o=new Int32Array(e,0,2),a=new Float32Array(e,8);return Object.freeze({write:s=>{if(s.length!==i)return;for(let p of s)if(p.length!==n)return F("Each channel buffer must contain 'bufferSize' samples");let l=Atomics.load(o,0),u=l*i*n;s.forEach((p,d)=>a.set(p,u+d*n)),Atomics.store(o,0,(l+1)%t),Atomics.notify(o,0)}})}})(Qg||(Qg={}));var zw={isRegion:r=>wa.isRegionBox(r.box),isLoopableRegion:r=>wa.isLoopableRegionBox(r.box)};var On;(function(r){r[r.Off=0]="Off",r[r.On=1]="On",r[r.Loop=2]="Loop"})(On||(On={}));var CB,TB,RB,OB;CB=new WeakMap,TB=new WeakMap,RB=new WeakMap,OB=new WeakMap;var VB,zB,UB,jB;VB=new WeakMap,zB=new WeakMap,UB=new WeakMap,jB=new WeakMap;var su={[St.Instrument]:0,[St.Aux]:1,[St.Bus]:2,[St.Output]:3};var Yg;(function(r){r.create=({boxGraph:e,mandatoryBoxes:{rootBox:t,primaryAudioBus:i}},n,o,a)=>{let s=a??r.orderAndGetIndex(t,n);return console.debug(`createAudioUnit type: ${n}, insertIndex: ${s}`),it.create(e,w.generate(),l=>{l.collection.refer(t.audioUnits),l.output.refer(i.input),l.index.setValue(s),l.type.setValue(n),o.ifSome(u=>l.capture.refer(u))})},r.orderAndGetIndex=(e,t)=>{let i=fl.collectIndexedBoxes(e.audioUnits,it),n=su[t],o=0;for(;o<i.length&&!(su[i[o].type.getValue()]>n);o++);let a=o;for(;o<i.length;)i[o].index.setValue(++o);return a},r.trackTypeToCapture=(e,t)=>{switch(t){case ie.Audio:return g.wrap(Ro.create(e,w.generate()));case ie.Notes:return g.wrap(Oo.create(e,w.generate()));default:return g.None}}})(Yg||(Yg={}));var I1;(function(r){r.create=(e,t,i,n,o)=>{console.debug(`createAudioBus '${t}', type: ${n}, color: ${o}`);let{boxGraph:a,mandatoryBoxes:{rootBox:s}}=e;I(s.isAttached(),"rootBox not attached");let l=w.generate(),u=Ti.create(a,l,d=>{d.collection.refer(s.audioBusses),d.label.setValue(t),d.icon.setValue(Me.toName(i)),d.color.setValue(o.toString())}),p=Yg.create(e,n,g.None);return lr.create(a,w.generate(),d=>{d.tracks.refer(p.tracks),d.target.refer(p),d.index.setValue(0),d.type.setValue(ie.Undefined)}),u.output.refer(p.input),u}})(I1||(I1={}));var C1;(function(r){r.forAudioType=e=>{switch(e){case St.Output:return ml.blue;case St.Aux:return ml.purple;case St.Bus:return ml.orange;case St.Instrument:return ml.green;default:return ml.dark}},r.forTrackType=e=>{switch(e){case ie.Audio:return 200;case ie.Notes:return 45;case ie.Value:return 156;default:return 0}}})(C1||(C1={}));var T1;(function(r){r.Tape={defaultName:"Tape",defaultIcon:Me.Tape,description:"Plays audio regions & clips",trackType:ie.Audio,create:(i,n,o,a,s)=>kl.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.flutter.setValue(.2),l.wow.setValue(.05),l.noise.setValue(.02),l.saturation.setValue(.5),l.host.refer(n)})},r.Nano={defaultName:"Nano",defaultIcon:Me.NanoWave,description:"Simple sampler",trackType:ie.Notes,create:(i,n,o,a,s)=>{let l;if(Z(s))l=s;else{let u=w.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3"),p=5.34;l=i.findBox(u).unwrapOrElse(()=>Tr.create(i,u,d=>{d.fileName.setValue("Rhode"),d.endInSeconds.setValue(p)}))}return Fl.create(i,w.generate(),u=>{u.label.setValue(o),u.icon.setValue(Me.toName(a)),u.file.refer(l),u.host.refer(n)})}},r.Playfield={defaultName:"Playfield",defaultIcon:Me.Playfield,description:"Drum computer",trackType:ie.Notes,create:(i,n,o,a,s)=>{let l=Nl.create(i,w.generate(),u=>{u.label.setValue(o),u.icon.setValue(Me.toName(a)),u.host.refer(n)});return Z(s)&&s.filter(({note:u,uuid:p,name:d,durationInSeconds:f,exclude:v})=>{let m=e(i,p,d,f);Vo.create(i,w.generate(),y=>{y.device.refer(l.samples),y.file.refer(m),y.index.setValue(u),y.exclude.setValue(v)})}),l}},r.Vaporisateur={defaultName:"Vaporisateur",defaultIcon:Me.Piano,description:"Classic subtractive synthesizer",trackType:ie.Notes,create:(i,n,o,a,s)=>Sl.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.tune.setInitValue(0),l.cutoff.setInitValue(8e3),l.resonance.setInitValue(.1),l.attack.setInitValue(.005),l.decay.setInitValue(.1),l.sustain.setInitValue(.5),l.release.setInitValue(.5),l.voicingMode.setInitValue(pn.Polyphonic),l.lfo.rate.setInitValue(1),l.oscillators.fields()[0].waveform.setInitValue(Le.saw),l.oscillators.fields()[0].volume.setInitValue(-6),l.oscillators.fields()[1].volume.setInitValue(Number.NEGATIVE_INFINITY),l.oscillators.fields()[1].waveform.setInitValue(Le.square),l.host.refer(n),l.version.setValue(2)})},r.MIDIOutput={defaultName:"MIDIOutput",defaultIcon:Me.Midi,description:"MIDI Output",trackType:ie.Notes,create:(i,n,o,a,s)=>El.create(i,w.generate(),l=>{l.label.setValue(o),l.icon.setValue(Me.toName(a)),l.host.refer(n)})},r.Soundfont={defaultName:"Soundfont",defaultIcon:Me.SoundFont,description:"Soundfont Player",trackType:ie.Notes,create:(i,n,o,a,s)=>{s??(s={uuid:"d9f51577-2096-4671-9067-27ca2e12b329",name:"Upright Piano KW"});let l=s.uuid,u=w.parse(l),p=t(i,u,s.name);return Bl.create(i,w.generate(),d=>{d.label.setValue(o),d.icon.setValue(Me.toName(a)),d.host.refer(n),d.file.refer(p)})}},r.Named={Vaporisateur:r.Vaporisateur,Playfield:r.Playfield,Nano:r.Nano,Tape:r.Tape,Soundfont:r.Soundfont,MIDIOutput:r.MIDIOutput};let e=(i,n,o,a)=>i.findBox(n).unwrapOrElse(()=>Tr.create(i,n,s=>{s.fileName.setValue(o),s.endInSeconds.setValue(a)})),t=(i,n,o)=>i.findBox(n).unwrapOrElse(()=>ei.create(i,n,a=>a.fileName.setValue(o)))})(T1||(T1={}));var ba;(function(r){r.empty=i=>{let n=new ja(g.wrap(La.create)),o=new Date().toISOString();console.debug(`New Project created on ${o}`),n.beginTransaction();let a=_l.create(n,w.generate(),f=>{f.label.setValue("Groove Shuffle")}),s=gl.create(n,w.generate(),f=>{f.groove.refer(a),f.created.setValue(o)}),l=Ti.create(n,w.generate(),f=>{f.collection.refer(s.audioBusses),f.label.setValue("Output"),f.icon.setValue(Me.toName(Me.SpeakerHeadphone)),f.color.setValue("hsl(189, 100%, 65%)")}),u=it.create(n,w.generate(),f=>{f.type.setValue(St.Output),f.collection.refer(s.audioUnits),f.output.refer(s.outputDevice),f.index.setValue(0)});i.createOutputCompressor&&Pl.create(n,w.generate(),f=>{f.label.setValue("Compressor"),f.index.setValue(0),f.host.refer(u.audioEffects),f.threshold.setValue(0),f.ratio.setValue(24)});let p=Wa.create(n,w.generate());s.timeline.refer(p.root),l.output.refer(u.input);let d=[];if(i.createDefaultUser){let f=Ka.create(n,w.generate());f.root.refer(s.users),d.push(f)}return n.endTransaction(),{boxGraph:n,mandatoryBoxes:{rootBox:s,primaryAudioBus:l,primaryAudioOutputUnit:u,timelineBox:p,userInterfaceBoxes:d}}},r.encode=i=>{let n=$t.create();n.writeInt(1330660686),n.writeInt(2);let o=i.toArrayBuffer();return n.writeInt(o.byteLength),n.writeBytes(new Int8Array(o)),n.toArrayBuffer()},r.decode=i=>{let n=new lt(i);I(n.readInt()===1330660686,"Corrupt header. Probably not an openDAW project file."),I(n.readInt()===2,"Deprecated Format");let o=n.readInt(),a=new Int8Array(o);n.readBytes(a);let s=new ja(g.wrap(La.create));return s.fromArrayBuffer(a.buffer),{boxGraph:s,mandatoryBoxes:r.findMandatoryBoxes(s)}},r.findMandatoryBoxes=i=>{let n=i.boxes().find(o=>o.accept({visitRootBox:()=>!0}));if(Z(n)){let o=Ne(n.outputDevice.pointerHub.incoming().at(0)?.box,it),a=Ne(o.input.pointerHub.incoming().at(0)?.box,Ti),s=Ne(n.timeline.targetVertex.unwrap("TimelineBox not found").box,Wa),l=n.users.pointerHub.incoming().map(({box:u})=>Ne(u,Ka));return{rootBox:n,primaryAudioBus:a,primaryAudioOutputUnit:o,timelineBox:s,userInterfaceBoxes:l}}return F("Could not find mandatory boxes")}})(ba||(ba={}));var lu;(function(r){let e=({graph:s},{graph:l})=>s===l,t=(s,l)=>s.index.getValue()-l.index.getValue(),i=s=>s.accept({visitTrackBox:l=>!0})===!0;r.extractAudioUnits=(s,{boxGraph:l,mandatoryBoxes:{primaryAudioBus:u,rootBox:p}},d={})=>{I(R.satisfy(s,e),"AudioUnits must share the same BoxGraph"),I(!d.includeAux&&!d.includeBus,"Options are not yet implemented");let f=d?.excludeTimeline===!0?i:Po.alwaysFalse,v=s.flatMap(y=>Array.from(y.graph.dependenciesOf(y,{alwaysFollowMandatory:!0,excludeBox:f}).boxes)).filter(y=>y.name!==hn.ClassName&&y.name!==qa.ClassName),m=n(s,v,p.audioUnits.address.uuid,u.address.uuid);return o(m,l,s,v),a(m,s,p),console.debug("inTransaction",l.inTransaction()),s.map(y=>Ne(p.graph.findBox(m.get(y.address.uuid).target).unwrap("Target Track has not been copied"),it))},r.extractRegions=(s,{boxGraph:l,mandatoryBoxes:{primaryAudioBus:u,rootBox:p}},d=0)=>{I(R.satisfy(s,e),"Region smust be from the same BoxGraph");let f=new Set(s),v=new Set,m=new il;s.forEach(V=>{let Y=Ne(V.regions.targetVertex.unwrap().box,lr);v.add(Y);let te=Ne(Y.tracks.targetVertex.unwrap().box,it);m.add(te,Y)}),console.debug(`Found ${m.keyCount()} audioUnits`),console.debug(`Found ${v.size} tracks`);let y=[...m.keys()],x=V=>Ie(V,lr)&&!v.has(V)||wa.isRegionBox(V)&&!f.has(V),D=y.flatMap(V=>Array.from(V.graph.dependenciesOf(V,{excludeBox:x,alwaysFollowMandatory:!0}).boxes)).filter(V=>V.name!==hn.ClassName&&V.name!==qa.ClassName),M=n(y,D,p.audioUnits.address.uuid,u.address.uuid);o(M,l,y,D),a(M,y,p),m.forEach((V,Y)=>[...Y].sort(t).forEach((te,q)=>{let ge=l.findBox(M.get(te.address.uuid).target).unwrap("Target Track has not been copied");Ne(ge,lr).index.setValue(q)}));let O=s.reduce((V,Y)=>Math.min(V,Y.position.getValue()),Number.MAX_VALUE),T=d-O;s.forEach(V=>{let Y=l.findBox(M.get(V.address.uuid).target).unwrap("Target Track has not been copied"),te=wa.asRegionBox(Y).position;te.setValue(te.getValue()+T)})};let n=(s,l,u,p)=>{let d=w.newSet(({source:f})=>f);return d.addMany([...s.filter(({output:{targetAddress:f}})=>f.nonEmpty()).map(f=>({source:f.output.targetAddress.unwrap().uuid,target:p})),...s.map(f=>({source:f.collection.targetAddress.unwrap("AudioUnitBox was not connected to a RootBox").uuid,target:u})),...s.map(f=>({source:f.address.uuid,target:w.generate()})),...l.map(({address:{uuid:f},name:v})=>({source:f,target:v===Tr.ClassName||v===ei.ClassName?f:w.generate()}))]),d},o=(s,l,u,p)=>{B.decodeWith({map:(d,f)=>f.map(v=>s.opt(v.uuid).match({none:()=>v,some:({target:m})=>v.moveTo(m)}))},()=>{u.forEach(d=>{let f=new lt(d.toArrayBuffer()),v=d.name,m=s.get(d.address.uuid).target;l.createBox(v,m,y=>y.read(f))}),p.forEach(d=>{let f=new lt(d.toArrayBuffer()),v=d.name,m=s.get(d.address.uuid).target;if((d instanceof Tr||d instanceof ei)&&l.findBox(d.address.uuid).nonEmpty()){d.read(f);return}l.createBox(v,m,y=>y.read(f))})})},a=(s,l,u)=>l.toSorted(t).map(p=>Ne(u.graph.findBox(s.get(p.address.uuid).target).unwrap("Target Track has not been copied"),it)).forEach(p=>fl.collectIndexedBoxes(u.audioUnits,it).toSorted((d,f)=>{let v=su[d.type.getValue()],m=su[f.type.getValue()],y=v-m;return y===0?f===p?-1:1:y}).forEach((d,f)=>d.index.setValue(f)))})(lu||(lu={}));var Aa;(function(r){r.MAGIC_HEADER_OPEN=1330664005,r.FORMAT_VERSION=1})(Aa||(Aa={}));var R1;(function(r){r.decode=(e,t)=>{let i=new lt(e.slice(0,8));if(i.readInt()!==Aa.MAGIC_HEADER_OPEN){al.info({headline:"Could Not Import Preset",message:"Invalid preset file"}).then();return}if(i.readInt()!==Aa.FORMAT_VERSION){al.info({headline:"Could Not Import Preset",message:"Invalid preset version"}).then();return}let n=new ja(g.wrap(La.create));try{n.fromArrayBuffer(e.slice(8))}catch(a){al.info({headline:"Could Not Import Preset",message:String(a)}).then();return}let o=n.boxes().filter(a=>Ie(a,it)).filter(a=>a.type.getValue()!==St.Output);lu.extractAudioUnits(o,t,{excludeTimeline:!0}).filter(a=>a.type.getValue()!==St.Output).forEach(a=>{let s=a.input.pointerHub.incoming().at(0)?.box;Z(s)&&a.capture.targetVertex.ifSome(({box:l})=>{l instanceof Oo?lr.create(t.boxGraph,w.generate(),u=>{u.index.setValue(0),u.type.setValue(ie.Notes),u.target.refer(a),u.tracks.refer(a.tracks)}):l instanceof Ro&&lr.create(t.boxGraph,w.generate(),u=>{u.index.setValue(0),u.type.setValue(ie.Audio),u.target.refer(a),u.tracks.refer(a.tracks)})})})},r.replaceAudioUnit=(e,t,i)=>{console.debug("ReplaceAudioUnit with preset...");let n=ba.empty({createDefaultUser:!1,createOutputCompressor:!1}),o=n.boxGraph,a=t.graph;o.beginTransaction(),r.decode(e,n),o.endTransaction();let s=ee(n.mandatoryBoxes.rootBox.audioUnits.pointerHub.incoming().map(({box:y})=>Ne(y,it)).find(y=>y.type.getValue()!==St.Output),"Source has no audioUnitBox"),l=s.capture.targetVertex.mapOr(({box:y})=>y.name,""),u=t.capture.targetVertex.mapOr(({box:y})=>y.name,"");if(l!==u)return Ln.err("Cannot replace incompatible instruments");let p=i?.keepMIDIEffects!==!0,d=i?.keepAudioEffects!==!0;console.debug("replaceMIDIEffects",p),console.debug("replaceAudioEffects",d),ee(t.input.pointerHub.incoming().at(0)?.box,"Target has no input").delete(),p?t.midiEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()):(o.beginTransaction(),s.midiEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()),o.endTransaction()),d?t.audioEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()):(o.beginTransaction(),s.audioEffects.pointerHub.incoming().forEach(({box:y})=>y.delete()),o.endTransaction());let f=y=>y.accept({visitTrackBox:x=>!0,visitCaptureMidiBox:x=>!0,visitCaptureAudioBox:x=>!0})===!0,v=w.newSet(({source:y})=>y),m=Array.from(o.dependenciesOf(s,{excludeBox:f,alwaysFollowMandatory:!1}).boxes);return v.addMany([{source:s.address.uuid,target:t.address.uuid},...m.map(({address:{uuid:y},name:x})=>({source:y,target:x===Tr.ClassName||x===ei.ClassName?y:w.generate()}))]),B.decodeWith({map:(y,x)=>x.map(D=>v.opt(D.uuid).match({none:()=>D,some:({target:M})=>D.moveTo(M)}))},()=>{m.forEach(y=>{let x=new lt(y.toArrayBuffer()),D=y.name,M=v.get(y.address.uuid).target;if((y instanceof Tr||y instanceof ei)&&a.findBox(y.address.uuid).nonEmpty()){y.read(x);return}a.createBox(D,M,O=>O.read(x))})}),Ln.Ok}})(R1||(R1={}));var O1;(function(r){r.encode=e=>{let t=$t.create();t.writeInt(Aa.MAGIC_HEADER_OPEN),t.writeInt(Aa.FORMAT_VERSION);let i=ba.empty({createOutputCompressor:!1,createDefaultUser:!1});return i.boxGraph.beginTransaction(),lu.extractAudioUnits([e],i,{excludeTimeline:!0}),i.boxGraph.endTransaction(),console.debug("SAVING..."),i.boxGraph.debugBoxes(),R.concatArrayBuffers(t.toArrayBuffer(),i.boxGraph.toArrayBuffer())}})(O1||(O1={}));var V1;(function(r){r.existingInstrumentNames=e=>e.audioUnits.pointerHub.incoming().map(({box:t})=>{let i=ee(Ne(t,it).input.pointerHub.incoming().at(0)).box;return"label"in i&&i.label instanceof C?i.label.getValue():"N/A"})})(V1||(V1={}));var kt={};Da(kt,{$brand:()=>Xg,$input:()=>aA,$output:()=>oA,NEVER:()=>Uw,TimePrecision:()=>uA,ZodAny:()=>vE,ZodArray:()=>bE,ZodBase64:()=>N_,ZodBase64URL:()=>k_,ZodBigInt:()=>$h,ZodBigIntFormat:()=>D_,ZodBoolean:()=>kh,ZodCIDRv4:()=>B_,ZodCIDRv6:()=>F_,ZodCUID:()=>w_,ZodCUID2:()=>b_,ZodCatch:()=>zE,ZodCodec:()=>L_,ZodCustom:()=>sy,ZodCustomStringFormat:()=>Fh,ZodDate:()=>ny,ZodDefault:()=>IE,ZodDiscriminatedUnion:()=>AE,ZodE164:()=>$_,ZodEmail:()=>v_,ZodEmoji:()=>y_,ZodEnum:()=>Eh,ZodError:()=>xk,ZodFile:()=>$E,ZodFirstPartyTypeKind:()=>K_,ZodFunction:()=>HE,ZodGUID:()=>Xv,ZodIPv4:()=>S_,ZodIPv6:()=>E_,ZodISODate:()=>Hv,ZodISODateTime:()=>qv,ZodISODuration:()=>Qv,ZodISOTime:()=>Jv,ZodIntersection:()=>_E,ZodIssueCode:()=>D$,ZodJWT:()=>M_,ZodKSUID:()=>P_,ZodLazy:()=>ZE,ZodLiteral:()=>kE,ZodMAC:()=>uE,ZodMap:()=>FE,ZodNaN:()=>jE,ZodNanoID:()=>x_,ZodNever:()=>xE,ZodNonOptional:()=>U_,ZodNull:()=>mE,ZodNullable:()=>DE,ZodNumber:()=>Nh,ZodNumberFormat:()=>_u,ZodObject:()=>ay,ZodOptional:()=>z_,ZodPipe:()=>j_,ZodPrefault:()=>TE,ZodPromise:()=>qE,ZodReadonly:()=>LE,ZodRealError:()=>$r,ZodRecord:()=>R_,ZodSet:()=>NE,ZodString:()=>Bh,ZodStringFormat:()=>Je,ZodSuccess:()=>VE,ZodSymbol:()=>hE,ZodTemplateLiteral:()=>WE,ZodTransform:()=>ME,ZodTuple:()=>SE,ZodType:()=>Pe,ZodULID:()=>A_,ZodURL:()=>iy,ZodUUID:()=>bo,ZodUndefined:()=>fE,ZodUnion:()=>C_,ZodUnknown:()=>yE,ZodVoid:()=>wE,ZodXID:()=>__,_ZodString:()=>g_,_default:()=>CE,_function:()=>P$,any:()=>n$,array:()=>oy,base64:()=>Uk,base64url:()=>jk,bigint:()=>Xk,boolean:()=>pE,catch:()=>UE,check:()=>S$,cidrv4:()=>Vk,cidrv6:()=>zk,clone:()=>mr,codec:()=>b$,coerce:()=>W_,config:()=>bt,core:()=>wo,cuid:()=>$k,cuid2:()=>Mk,custom:()=>E$,date:()=>a$,decode:()=>s_,decodeAsync:()=>c_,describe:()=>B$,discriminatedUnion:()=>d$,e164:()=>Lk,email:()=>bk,emoji:()=>Nk,encode:()=>a_,encodeAsync:()=>l_,endsWith:()=>yh,enum:()=>O_,file:()=>v$,flattenError:()=>eh,float32:()=>Hk,float64:()=>Jk,formatError:()=>th,function:()=>P$,getErrorMap:()=>C$,globalRegistry:()=>gr,gt:()=>xo,gte:()=>kr,guid:()=>Ak,hash:()=>qk,hex:()=>Gk,hostname:()=>Zk,httpUrl:()=>Fk,includes:()=>gh,instanceof:()=>N$,int:()=>m_,int32:()=>Qk,int64:()=>e$,intersection:()=>PE,ipv4:()=>Tk,ipv6:()=>Ok,iso:()=>Yv,json:()=>$$,jwt:()=>Kk,keyof:()=>s$,ksuid:()=>Ck,lazy:()=>GE,length:()=>wu,literal:()=>g$,locales:()=>ch,looseObject:()=>u$,lowercase:()=>fh,lt:()=>yo,lte:()=>ki,mac:()=>Rk,map:()=>h$,maxLength:()=>xu,maxSize:()=>yu,meta:()=>F$,mime:()=>xh,minLength:()=>Na,minSize:()=>Js,multipleOf:()=>Hs,nan:()=>w$,nanoid:()=>kk,nativeEnum:()=>m$,negative:()=>VA,never:()=>I_,nonnegative:()=>UA,nonoptional:()=>OE,nonpositive:()=>zA,normalize:()=>wh,null:()=>gE,nullable:()=>ty,nullish:()=>y$,number:()=>dE,object:()=>l$,optional:()=>ey,overwrite:()=>Vn,parse:()=>r_,parseAsync:()=>i_,partialRecord:()=>p$,pipe:()=>ry,positive:()=>OA,prefault:()=>RE,preprocess:()=>M$,prettifyError:()=>Xw,promise:()=>_$,property:()=>jA,readonly:()=>KE,record:()=>BE,refine:()=>JE,regex:()=>hh,regexes:()=>Ni,registry:()=>Bv,safeDecode:()=>d_,safeDecodeAsync:()=>h_,safeEncode:()=>u_,safeEncodeAsync:()=>p_,safeParse:()=>n_,safeParseAsync:()=>o_,set:()=>f$,setErrorMap:()=>I$,size:()=>ph,slugify:()=>Ph,startsWith:()=>vh,strictObject:()=>c$,string:()=>f_,stringFormat:()=>Wk,stringbool:()=>k$,success:()=>x$,superRefine:()=>QE,symbol:()=>r$,templateLiteral:()=>A$,toJSONSchema:()=>QA,toLowerCase:()=>Ah,toUpperCase:()=>_h,transform:()=>V_,treeifyError:()=>Yw,trim:()=>bh,tuple:()=>EE,uint32:()=>Yk,uint64:()=>t$,ulid:()=>Dk,undefined:()=>i$,union:()=>T_,unknown:()=>Au,uppercase:()=>mh,url:()=>Bk,util:()=>L,uuid:()=>_k,uuidv4:()=>Pk,uuidv6:()=>Sk,uuidv7:()=>Ek,void:()=>o$,xid:()=>Ik});var wo={};Da(wo,{$ZodAny:()=>F0,$ZodArray:()=>D0,$ZodAsyncError:()=>nn,$ZodBase64:()=>y0,$ZodBase64URL:()=>x0,$ZodBigInt:()=>bv,$ZodBigIntFormat:()=>P0,$ZodBoolean:()=>oh,$ZodCIDRv4:()=>m0,$ZodCIDRv6:()=>g0,$ZodCUID:()=>i0,$ZodCUID2:()=>n0,$ZodCatch:()=>J0,$ZodCheck:()=>He,$ZodCheckBigIntFormat:()=>Db,$ZodCheckEndsWith:()=>Wb,$ZodCheckGreaterThan:()=>fv,$ZodCheckIncludes:()=>Lb,$ZodCheckLengthEquals:()=>Vb,$ZodCheckLessThan:()=>hv,$ZodCheckLowerCase:()=>Ub,$ZodCheckMaxLength:()=>Rb,$ZodCheckMaxSize:()=>Ib,$ZodCheckMimeType:()=>Gb,$ZodCheckMinLength:()=>Ob,$ZodCheckMinSize:()=>Cb,$ZodCheckMultipleOf:()=>$b,$ZodCheckNumberFormat:()=>Mb,$ZodCheckOverwrite:()=>qb,$ZodCheckProperty:()=>Zb,$ZodCheckRegex:()=>zb,$ZodCheckSizeEquals:()=>Tb,$ZodCheckStartsWith:()=>Kb,$ZodCheckStringFormat:()=>gu,$ZodCheckUpperCase:()=>jb,$ZodCodec:()=>ah,$ZodCustom:()=>nA,$ZodCustomStringFormat:()=>A0,$ZodDate:()=>M0,$ZodDefault:()=>Z0,$ZodDiscriminatedUnion:()=>C0,$ZodE164:()=>w0,$ZodEmail:()=>Xb,$ZodEmoji:()=>t0,$ZodEncodeError:()=>_a,$ZodEnum:()=>z0,$ZodError:()=>Xp,$ZodFile:()=>j0,$ZodFunction:()=>tA,$ZodGUID:()=>Qb,$ZodIPv4:()=>p0,$ZodIPv6:()=>h0,$ZodISODate:()=>c0,$ZodISODateTime:()=>l0,$ZodISODuration:()=>d0,$ZodISOTime:()=>u0,$ZodIntersection:()=>T0,$ZodJWT:()=>b0,$ZodKSUID:()=>s0,$ZodLazy:()=>iA,$ZodLiteral:()=>U0,$ZodMAC:()=>f0,$ZodMap:()=>O0,$ZodNaN:()=>Q0,$ZodNanoID:()=>r0,$ZodNever:()=>k0,$ZodNonOptional:()=>q0,$ZodNull:()=>B0,$ZodNullable:()=>W0,$ZodNumber:()=>wv,$ZodNumberFormat:()=>_0,$ZodObject:()=>dS,$ZodObjectJIT:()=>I0,$ZodOptional:()=>K0,$ZodPipe:()=>Y0,$ZodPrefault:()=>G0,$ZodPromise:()=>rA,$ZodReadonly:()=>X0,$ZodRealError:()=>Nr,$ZodRecord:()=>R0,$ZodRegistry:()=>vu,$ZodSet:()=>V0,$ZodString:()=>qs,$ZodStringFormat:()=>We,$ZodSuccess:()=>H0,$ZodSymbol:()=>S0,$ZodTemplateLiteral:()=>eA,$ZodTransform:()=>L0,$ZodTuple:()=>_v,$ZodType:()=>he,$ZodULID:()=>o0,$ZodURL:()=>e0,$ZodUUID:()=>Yb,$ZodUndefined:()=>E0,$ZodUnion:()=>Av,$ZodUnknown:()=>N0,$ZodVoid:()=>$0,$ZodXID:()=>a0,$brand:()=>Xg,$constructor:()=>A,$input:()=>aA,$output:()=>oA,Doc:()=>nh,JSONSchema:()=>sE,JSONSchemaGenerator:()=>Sh,NEVER:()=>Uw,TimePrecision:()=>uA,_any:()=>$A,_array:()=>LA,_base64:()=>Kv,_base64url:()=>Wv,_bigint:()=>PA,_boolean:()=>AA,_catch:()=>pk,_check:()=>aE,_cidrv4:()=>jv,_cidrv6:()=>Lv,_coercedBigint:()=>SA,_coercedBoolean:()=>_A,_coercedDate:()=>TA,_coercedNumber:()=>gA,_coercedString:()=>lA,_cuid:()=>Cv,_cuid2:()=>Tv,_custom:()=>WA,_date:()=>CA,_decode:()=>ov,_decodeAsync:()=>sv,_default:()=>ck,_discriminatedUnion:()=>QN,_e164:()=>Zv,_email:()=>Fv,_emoji:()=>Dv,_encode:()=>nv,_encodeAsync:()=>av,_endsWith:()=>yh,_enum:()=>ik,_file:()=>KA,_float32:()=>yA,_float64:()=>xA,_gt:()=>xo,_gte:()=>kr,_guid:()=>uh,_includes:()=>gh,_int:()=>vA,_int32:()=>wA,_int64:()=>EA,_intersection:()=>YN,_ipv4:()=>zv,_ipv6:()=>Uv,_isoDate:()=>pA,_isoDateTime:()=>dA,_isoDuration:()=>fA,_isoTime:()=>hA,_jwt:()=>Gv,_ksuid:()=>Vv,_lazy:()=>gk,_length:()=>wu,_literal:()=>ok,_lowercase:()=>fh,_lt:()=>yo,_lte:()=>ki,_mac:()=>cA,_map:()=>tk,_max:()=>ki,_maxLength:()=>xu,_maxSize:()=>yu,_mime:()=>xh,_min:()=>kr,_minLength:()=>Na,_minSize:()=>Js,_multipleOf:()=>Hs,_nan:()=>RA,_nanoid:()=>Iv,_nativeEnum:()=>nk,_negative:()=>VA,_never:()=>DA,_nonnegative:()=>UA,_nonoptional:()=>uk,_nonpositive:()=>zA,_normalize:()=>wh,_null:()=>kA,_nullable:()=>lk,_number:()=>mA,_optional:()=>sk,_overwrite:()=>Vn,_parse:()=>pu,_parseAsync:()=>hu,_pipe:()=>hk,_positive:()=>OA,_promise:()=>vk,_property:()=>jA,_readonly:()=>fk,_record:()=>ek,_refine:()=>ZA,_regex:()=>hh,_safeDecode:()=>cv,_safeDecodeAsync:()=>dv,_safeEncode:()=>lv,_safeEncodeAsync:()=>uv,_safeParse:()=>fu,_safeParseAsync:()=>mu,_set:()=>rk,_size:()=>ph,_slugify:()=>Ph,_startsWith:()=>vh,_string:()=>sA,_stringFormat:()=>bu,_stringbool:()=>JA,_success:()=>dk,_superRefine:()=>GA,_symbol:()=>FA,_templateLiteral:()=>mk,_toLowerCase:()=>Ah,_toUpperCase:()=>_h,_transform:()=>ak,_trim:()=>bh,_tuple:()=>XN,_uint32:()=>bA,_uint64:()=>BA,_ulid:()=>Rv,_undefined:()=>NA,_union:()=>JN,_unknown:()=>MA,_uppercase:()=>mh,_url:()=>dh,_uuid:()=>Nv,_uuidv4:()=>kv,_uuidv6:()=>$v,_uuidv7:()=>Mv,_void:()=>IA,_xid:()=>Ov,clone:()=>mr,config:()=>bt,decode:()=>gF,decodeAsync:()=>yF,describe:()=>qA,encode:()=>mF,encodeAsync:()=>vF,flattenError:()=>eh,formatError:()=>th,globalConfig:()=>Zp,globalRegistry:()=>gr,isValidBase64:()=>v0,isValidBase64URL:()=>sS,isValidJWT:()=>lS,locales:()=>ch,meta:()=>HA,parse:()=>rv,parseAsync:()=>iv,prettifyError:()=>Xw,regexes:()=>Ni,registry:()=>Bv,safeDecode:()=>wF,safeDecodeAsync:()=>AF,safeEncode:()=>xF,safeEncodeAsync:()=>bF,safeParse:()=>eb,safeParseAsync:()=>tb,toDotPath:()=>K1,toJSONSchema:()=>QA,treeifyError:()=>Yw,util:()=>L,version:()=>Hb});var Uw=Object.freeze({status:"aborted"});function A(r,e,t){function i(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(r))return;s._zod.traits.add(r),e(s,l);let u=a.prototype,p=Object.keys(u);for(let d=0;d<p.length;d++){let f=p[d];f in s||(s[f]=u[f].bind(s))}}let n=t?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:r});function a(s){var l;let u=t?.Parent?new o:this;i(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let p of u._zod.deferred)p();return u}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>t?.Parent&&s instanceof t.Parent?!0:s?._zod?.traits?.has(r)}),Object.defineProperty(a,"name",{value:r}),a}var Xg=Symbol("zod_brand"),nn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_a=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Zp={};function bt(r){return r&&Object.assign(Zp,r),Zp}var L={};Da(L,{BIGINT_FORMAT_RANGES:()=>Qw,Class:()=>Lw,NUMBER_FORMAT_RANGES:()=>Jw,aborted:()=>Fa,allowsEval:()=>Zw,assert:()=>GB,assertEqual:()=>LB,assertIs:()=>WB,assertNever:()=>ZB,assertNotEqual:()=>KB,assignProp:()=>Sa,base64ToUint8Array:()=>U1,base64urlToUint8Array:()=>uF,cached:()=>uu,captureStackTrace:()=>tv,cleanEnum:()=>cF,cleanRegex:()=>Hp,clone:()=>mr,cloneDef:()=>HB,createTransparentProxy:()=>tF,defineLazy:()=>$e,esc:()=>ev,escapeRegex:()=>Fi,extend:()=>nF,finalizeIssue:()=>Hr,floatSafeRemainder:()=>Kw,getElementAtPath:()=>JB,getEnumValues:()=>qp,getLengthableOrigin:()=>Yp,getParsedType:()=>eF,getSizableOrigin:()=>Qp,hexToUint8Array:()=>pF,isObject:()=>Zs,isPlainObject:()=>Ba,issue:()=>du,joinValues:()=>k,jsonStringifyReplacer:()=>cu,merge:()=>aF,mergeDefs:()=>Ea,normalizeParams:()=>j,nullish:()=>Pa,numKeys:()=>XB,objectClone:()=>qB,omit:()=>iF,optionalKeys:()=>Hw,partial:()=>sF,pick:()=>rF,prefixIssues:()=>qr,primitiveTypes:()=>qw,promiseAllObject:()=>QB,propertyKeyTypes:()=>Jp,randomString:()=>YB,required:()=>lF,safeExtend:()=>oF,shallowClone:()=>Gw,slugify:()=>Ww,stringifyPrimitive:()=>z,uint8ArrayToBase64:()=>j1,uint8ArrayToBase64url:()=>dF,uint8ArrayToHex:()=>hF,unwrapMessage:()=>Gp});function LB(r){return r}function KB(r){return r}function WB(r){}function ZB(r){throw new Error}function GB(r){}function qp(r){let e=Object.values(r).filter(i=>typeof i=="number");return Object.entries(r).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function k(r,e="|"){return r.map(t=>z(t)).join(e)}function cu(r,e){return typeof e=="bigint"?e.toString():e}function uu(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function Pa(r){return r==null}function Hp(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}function Kw(r,e){let t=(r.toString().split(".")[1]||"").length,i=e.toString(),n=(i.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(i)){let l=i.match(/\d?e-(\d?)/);l?.[1]&&(n=Number.parseInt(l[1]))}let o=t>n?t:n,a=Number.parseInt(r.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var z1=Symbol("evaluating");function $e(r,e,t){let i;Object.defineProperty(r,e,{get(){if(i!==z1)return i===void 0&&(i=z1,i=t()),i},set(n){Object.defineProperty(r,e,{value:n})},configurable:!0})}function qB(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function Sa(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Ea(...r){let e={};for(let t of r){let i=Object.getOwnPropertyDescriptors(t);Object.assign(e,i)}return Object.defineProperties({},e)}function HB(r){return Ea(r._zod.def)}function JB(r,e){return e?e.reduce((t,i)=>t?.[i],r):r}function QB(r){let e=Object.keys(r),t=e.map(i=>r[i]);return Promise.all(t).then(i=>{let n={};for(let o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function YB(r=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let i=0;i<r;i++)t+=e[Math.floor(Math.random()*e.length)];return t}function ev(r){return JSON.stringify(r)}function Ww(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var tv="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function Zs(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var Zw=uu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function Ba(r){if(Zs(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(Zs(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Gw(r){return Ba(r)?{...r}:Array.isArray(r)?[...r]:r}function XB(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}var eF=r=>{let e=typeof r;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(r)?"array":r===null?"null":r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?"promise":typeof Map<"u"&&r instanceof Map?"map":typeof Set<"u"&&r instanceof Set?"set":typeof Date<"u"&&r instanceof Date?"date":typeof File<"u"&&r instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Jp=new Set(["string","number","symbol"]),qw=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Fi(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mr(r,e,t){let i=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(i._zod.parent=r),i}function j(r){let e=r;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function tF(r){let e;return new Proxy({},{get(t,i,n){return e??(e=r()),Reflect.get(e,i,n)},set(t,i,n,o){return e??(e=r()),Reflect.set(e,i,n,o)},has(t,i){return e??(e=r()),Reflect.has(e,i)},deleteProperty(t,i){return e??(e=r()),Reflect.deleteProperty(e,i)},ownKeys(t){return e??(e=r()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(t,i){return e??(e=r()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(t,i,n){return e??(e=r()),Reflect.defineProperty(e,i,n)}})}function z(r){return typeof r=="bigint"?r.toString()+"n":typeof r=="string"?`"${r}"`:`${r}`}function Hw(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}var Jw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Qw={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function rF(r,e){let t=r._zod.def,i=Ea(r._zod.def,{get shape(){let n={};for(let o in e){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(n[o]=t.shape[o])}return Sa(this,"shape",n),n},checks:[]});return mr(r,i)}function iF(r,e){let t=r._zod.def,i=Ea(r._zod.def,{get shape(){let n={...r._zod.def.shape};for(let o in e){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete n[o]}return Sa(this,"shape",n),n},checks:[]});return mr(r,i)}function nF(r,e){if(!Ba(e))throw new Error("Invalid input to extend: expected a plain object");let t=r._zod.def.checks;if(t&&t.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let n=Ea(r._zod.def,{get shape(){let o={...r._zod.def.shape,...e};return Sa(this,"shape",o),o},checks:[]});return mr(r,n)}function oF(r,e){if(!Ba(e))throw new Error("Invalid input to safeExtend: expected a plain object");let t={...r._zod.def,get shape(){let i={...r._zod.def.shape,...e};return Sa(this,"shape",i),i},checks:r._zod.def.checks};return mr(r,t)}function aF(r,e){let t=Ea(r._zod.def,{get shape(){let i={...r._zod.def.shape,...e._zod.def.shape};return Sa(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:[]});return mr(r,t)}function sF(r,e,t){let i=Ea(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(t)for(let a in t){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=r?new r({type:"optional",innerType:n[a]}):n[a])}else for(let a in n)o[a]=r?new r({type:"optional",innerType:n[a]}):n[a];return Sa(this,"shape",o),o},checks:[]});return mr(e,i)}function lF(r,e,t){let i=Ea(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(t)for(let a in t){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=new r({type:"nonoptional",innerType:n[a]}))}else for(let a in n)o[a]=new r({type:"nonoptional",innerType:n[a]});return Sa(this,"shape",o),o},checks:[]});return mr(e,i)}function Fa(r,e=0){if(r.aborted===!0)return!0;for(let t=e;t<r.issues.length;t++)if(r.issues[t]?.continue!==!0)return!0;return!1}function qr(r,e){return e.map(t=>{var i;return(i=t).path??(i.path=[]),t.path.unshift(r),t})}function Gp(r){return typeof r=="string"?r:r?.message}function Hr(r,e,t){let i={...r,path:r.path??[]};if(!r.message){let n=Gp(r.inst?._zod.def?.error?.(r))??Gp(e?.error?.(r))??Gp(t.customError?.(r))??Gp(t.localeError?.(r))??"Invalid input";i.message=n}return delete i.inst,delete i.continue,e?.reportInput||delete i.input,i}function Qp(r){return r instanceof Set?"set":r instanceof Map?"map":r instanceof File?"file":"unknown"}function Yp(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}function du(...r){let[e,t,i]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:i}:{...e}}function cF(r){return Object.entries(r).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function U1(r){let e=atob(r),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function j1(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function uF(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return U1(e+t)}function dF(r){return j1(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pF(r){let e=r.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let t=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)t[i/2]=Number.parseInt(e.slice(i,i+2),16);return t}function hF(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}var Lw=class{constructor(...e){}};var L1=(r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),r.message=JSON.stringify(e,cu,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},Xp=A("$ZodError",L1),Nr=A("$ZodError",L1,{Parent:Error});function eh(r,e=t=>t.message){let t={},i=[];for(let n of r.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}function th(r,e=t=>t.message){let t={_errors:[]},i=n=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)t._errors.push(e(o));else{let a=t,s=0;for(;s<o.path.length;){let l=o.path[s];s===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(e(o))):a[l]=a[l]||{_errors:[]},a=a[l],s++}}};return i(r),t}function Yw(r,e=t=>t.message){let t={errors:[]},i=(n,o=[])=>{var a,s;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>i({issues:u},l.path));else if(l.code==="invalid_key")i({issues:l.issues},l.path);else if(l.code==="invalid_element")i({issues:l.issues},l.path);else{let u=[...o,...l.path];if(u.length===0){t.errors.push(e(l));continue}let p=t,d=0;for(;d<u.length;){let f=u[d],v=d===u.length-1;typeof f=="string"?(p.properties??(p.properties={}),(a=p.properties)[f]??(a[f]={errors:[]}),p=p.properties[f]):(p.items??(p.items=[]),(s=p.items)[f]??(s[f]={errors:[]}),p=p.items[f]),v&&p.errors.push(e(l)),d++}}};return i(r),t}function K1(r){let e=[],t=r.map(i=>typeof i=="object"?i.key:i);for(let i of t)typeof i=="number"?e.push(`[${i}]`):typeof i=="symbol"?e.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?e.push(`[${JSON.stringify(i)}]`):(e.length&&e.push("."),e.push(i));return e.join("")}function Xw(r){let e=[],t=[...r.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of t)e.push(`\u2716 ${i.message}`),i.path?.length&&e.push(` \u2192 at ${K1(i.path)}`);return e.join(`
4
4
  `)}var pu=r=>(e,t,i,n)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise)throw new nn;if(a.issues.length){let s=new(n?.Err??r)(a.issues.map(l=>Hr(l,o,bt())));throw tv(s,n?.callee),s}return a.value},rv=pu(Nr),hu=r=>async(e,t,i,n)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(n?.Err??r)(a.issues.map(l=>Hr(l,o,bt())));throw tv(s,n?.callee),s}return a.value},iv=hu(Nr),fu=r=>(e,t,i)=>{let n=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)throw new nn;return o.issues.length?{success:!1,error:new(r??Xp)(o.issues.map(a=>Hr(a,n,bt())))}:{success:!0,data:o.value}},eb=fu(Nr),mu=r=>async(e,t,i)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new r(o.issues.map(a=>Hr(a,n,bt())))}:{success:!0,data:o.value}},tb=mu(Nr),nv=r=>(e,t,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return pu(r)(e,t,n)},mF=nv(Nr),ov=r=>(e,t,i)=>pu(r)(e,t,i),gF=ov(Nr),av=r=>async(e,t,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return hu(r)(e,t,n)},vF=av(Nr),sv=r=>async(e,t,i)=>hu(r)(e,t,i),yF=sv(Nr),lv=r=>(e,t,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return fu(r)(e,t,n)},xF=lv(Nr),cv=r=>(e,t,i)=>fu(r)(e,t,i),wF=cv(Nr),uv=r=>async(e,t,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mu(r)(e,t,n)},bF=uv(Nr),dv=r=>async(e,t,i)=>mu(r)(e,t,i),AF=dv(Nr);var Ni={};Da(Ni,{base64:()=>vb,base64url:()=>pv,bigint:()=>_b,boolean:()=>Eb,browserEmail:()=>kF,cidrv4:()=>mb,cidrv6:()=>gb,cuid:()=>rb,cuid2:()=>ib,date:()=>xb,datetime:()=>bb,domain:()=>DF,duration:()=>lb,e164:()=>yb,email:()=>ub,emoji:()=>db,extendedDuration:()=>_F,guid:()=>cb,hex:()=>IF,hostname:()=>MF,html5Email:()=>BF,idnEmail:()=>NF,integer:()=>Pb,ipv4:()=>pb,ipv6:()=>hb,ksuid:()=>ab,lowercase:()=>Nb,mac:()=>fb,md5_base64:()=>TF,md5_base64url:()=>RF,md5_hex:()=>CF,nanoid:()=>sb,null:()=>Bb,number:()=>Sb,rfc5322Email:()=>FF,sha1_base64:()=>VF,sha1_base64url:()=>zF,sha1_hex:()=>OF,sha256_base64:()=>jF,sha256_base64url:()=>LF,sha256_hex:()=>UF,sha384_base64:()=>WF,sha384_base64url:()=>ZF,sha384_hex:()=>KF,sha512_base64:()=>qF,sha512_base64url:()=>HF,sha512_hex:()=>GF,string:()=>Ab,time:()=>wb,ulid:()=>nb,undefined:()=>Fb,unicodeEmail:()=>W1,uppercase:()=>kb,uuid:()=>Gs,uuid4:()=>PF,uuid6:()=>SF,uuid7:()=>EF,xid:()=>ob});var rb=/^[cC][^\s-]{8,}$/,ib=/^[0-9a-z]+$/,nb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ob=/^[0-9a-vA-V]{20}$/,ab=/^[A-Za-z0-9]{27}$/,sb=/^[a-zA-Z0-9_-]{21}$/,lb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_F=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Gs=r=>r?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${r}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,PF=Gs(4),SF=Gs(6),EF=Gs(7),ub=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,BF=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,FF=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,W1=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,NF=W1,kF=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$F="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function db(){return new RegExp($F,"u")}var pb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fb=r=>{let e=Fi(r??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},mb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pv=/^[A-Za-z0-9_-]*$/,MF=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,DF=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,yb=/^\+(?:[0-9]){6,14}[0-9]$/,Z1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",xb=new RegExp(`^${Z1}$`);function G1(r){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof r.precision=="number"?r.precision===-1?`${e}`:r.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${r.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wb(r){return new RegExp(`^${G1(r)}$`)}function bb(r){let e=G1({precision:r.precision}),t=["Z"];r.local&&t.push(""),r.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${e}(?:${t.join("|")})`;return new RegExp(`^${Z1}T(?:${i})$`)}var Ab=r=>{let e=r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_b=/^-?\d+n?$/,Pb=/^-?\d+$/,Sb=/^-?\d+(?:\.\d+)?/,Eb=/^(?:true|false)$/i,Bb=/^null$/i;var Fb=/^undefined$/i;var Nb=/^[^A-Z]*$/,kb=/^[^a-z]*$/,IF=/^[0-9a-fA-F]*$/;function rh(r,e){return new RegExp(`^[A-Za-z0-9+/]{${r}}${e}$`)}function ih(r){return new RegExp(`^[A-Za-z0-9_-]{${r}}$`)}var CF=/^[0-9a-fA-F]{32}$/,TF=rh(22,"=="),RF=ih(22),OF=/^[0-9a-fA-F]{40}$/,VF=rh(27,"="),zF=ih(27),UF=/^[0-9a-fA-F]{64}$/,jF=rh(43,"="),LF=ih(43),KF=/^[0-9a-fA-F]{96}$/,WF=rh(64,""),ZF=ih(64),GF=/^[0-9a-fA-F]{128}$/,qF=rh(86,"=="),HF=ih(86);var He=A("$ZodCheck",(r,e)=>{var t;r._zod??(r._zod={}),r._zod.def=e,(t=r._zod).onattach??(t.onattach=[])}),H1={number:"number",bigint:"bigint",object:"date"},hv=A("$ZodCheckLessThan",(r,e)=>{He.init(r,e);let t=H1[typeof e.value];r._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),r._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:t,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}}),fv=A("$ZodCheckGreaterThan",(r,e)=>{He.init(r,e);let t=H1[typeof e.value];r._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),r._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:t,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}}),$b=A("$ZodCheckMultipleOf",(r,e)=>{He.init(r,e),r._zod.onattach.push(t=>{var i;(i=t._zod.bag).multipleOf??(i.multipleOf=e.value)}),r._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):Kw(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:r,continue:!e.abort})}}),Mb=A("$ZodCheckNumberFormat",(r,e)=>{He.init(r,e),e.format=e.format||"float64";let t=e.format?.includes("int"),i=t?"int":"number",[n,o]=Jw[e.format];r._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=n,s.maximum=o,t&&(s.pattern=Pb)}),r._zod.check=a=>{let s=a.value;if(t){if(!Number.isInteger(s)){a.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:s,inst:r});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:i,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:i,continue:!e.abort});return}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:r,continue:!e.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:r})}}),Db=A("$ZodCheckBigIntFormat",(r,e)=>{He.init(r,e);let[t,i]=Qw[e.format];r._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,o.minimum=t,o.maximum=i}),r._zod.check=n=>{let o=n.value;o<t&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:t,inclusive:!0,inst:r,continue:!e.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:r})}}),Ib=A("$ZodCheckMaxSize",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.size!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),r._zod.check=i=>{let n=i.value;n.size<=e.maximum||i.issues.push({origin:Qp(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:r,continue:!e.abort})}}),Cb=A("$ZodCheckMinSize",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.size!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),r._zod.check=i=>{let n=i.value;n.size>=e.minimum||i.issues.push({origin:Qp(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:r,continue:!e.abort})}}),Tb=A("$ZodCheckSizeEquals",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.size!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.size,n.maximum=e.size,n.size=e.size}),r._zod.check=i=>{let n=i.value,o=n.size;if(o===e.size)return;let a=o>e.size;i.issues.push({origin:Qp(n),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:i.value,inst:r,continue:!e.abort})}}),Rb=A("$ZodCheckMaxLength",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.length!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),r._zod.check=i=>{let n=i.value;if(n.length<=e.maximum)return;let a=Yp(n);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:r,continue:!e.abort})}}),Ob=A("$ZodCheckMinLength",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.length!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),r._zod.check=i=>{let n=i.value;if(n.length>=e.minimum)return;let a=Yp(n);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:r,continue:!e.abort})}}),Vb=A("$ZodCheckLengthEquals",(r,e)=>{var t;He.init(r,e),(t=r._zod.def).when??(t.when=i=>{let n=i.value;return!Pa(n)&&n.length!==void 0}),r._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),r._zod.check=i=>{let n=i.value,o=n.length;if(o===e.length)return;let a=Yp(n),s=o>e.length;i.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:r,continue:!e.abort})}}),gu=A("$ZodCheckStringFormat",(r,e)=>{var t,i;He.init(r,e),r._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(t=r._zod).check??(t.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:r,continue:!e.abort})}):(i=r._zod).check??(i.check=()=>{})}),zb=A("$ZodCheckRegex",(r,e)=>{gu.init(r,e),r._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:r,continue:!e.abort})}}),Ub=A("$ZodCheckLowerCase",(r,e)=>{e.pattern??(e.pattern=Nb),gu.init(r,e)}),jb=A("$ZodCheckUpperCase",(r,e)=>{e.pattern??(e.pattern=kb),gu.init(r,e)}),Lb=A("$ZodCheckIncludes",(r,e)=>{He.init(r,e);let t=Fi(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=i,r._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),r._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:r,continue:!e.abort})}}),Kb=A("$ZodCheckStartsWith",(r,e)=>{He.init(r,e);let t=new RegExp(`^${Fi(e.prefix)}.*`);e.pattern??(e.pattern=t),r._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)}),r._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:r,continue:!e.abort})}}),Wb=A("$ZodCheckEndsWith",(r,e)=>{He.init(r,e);let t=new RegExp(`.*${Fi(e.suffix)}$`);e.pattern??(e.pattern=t),r._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)}),r._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:r,continue:!e.abort})}});function q1(r,e,t){r.issues.length&&e.issues.push(...qr(t,r.issues))}var Zb=A("$ZodCheckProperty",(r,e)=>{He.init(r,e),r._zod.check=t=>{let i=e.schema._zod.run({value:t.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>q1(n,t,e.property));q1(i,t,e.property)}}),Gb=A("$ZodCheckMimeType",(r,e)=>{He.init(r,e);let t=new Set(e.mime);r._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),r._zod.check=i=>{t.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,inst:r,continue:!e.abort})}}),qb=A("$ZodCheckOverwrite",(r,e)=>{He.init(r,e),r._zod.check=t=>{t.value=e.tx(t.value)}});var nh=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let i=e.split(`
5
5
  `).filter(a=>a),n=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...t,n.join(`
6
6
  `))}};var Hb={major:4,minor:1,patch:13};var he=A("$ZodType",(r,e)=>{var t;r??(r={}),r._zod.def=e,r._zod.bag=r._zod.bag||{},r._zod.version=Hb;let i=[...r._zod.def.checks??[]];r._zod.traits.has("$ZodCheck")&&i.unshift(r);for(let n of i)for(let o of n._zod.onattach)o(r);if(i.length===0)(t=r._zod).deferred??(t.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let n=(a,s,l)=>{let u=Fa(a),p;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,v=d._zod.check(a);if(v instanceof Promise&&l?.async===!1)throw new nn;if(p||v instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await v,a.issues.length!==f&&(u||(u=Fa(a,f)))});else{if(a.issues.length===f)continue;u||(u=Fa(a,f))}}return p?p.then(()=>a):a},o=(a,s,l)=>{if(Fa(a))return a.aborted=!0,a;let u=n(s,i,l);if(u instanceof Promise){if(l.async===!1)throw new nn;return u.then(p=>r._zod.parse(p,l))}return r._zod.parse(u,l)};r._zod.run=(a,s)=>{if(s.skipChecks)return r._zod.parse(a,s);if(s.direction==="backward"){let u=r._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(p=>o(p,a,s)):o(u,a,s)}let l=r._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new nn;return l.then(u=>n(u,i,s))}return n(l,i,s)}}r["~standard"]={validate:n=>{try{let o=eb(r,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return tb(r,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),qs=A("$ZodString",(r,e)=>{he.init(r,e),r._zod.pattern=[...r?._zod.bag?.patterns??[]].pop()??Ab(r._zod.bag),r._zod.parse=(t,i)=>{if(e.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:r}),t}}),We=A("$ZodStringFormat",(r,e)=>{gu.init(r,e),qs.init(r,e)}),Qb=A("$ZodGUID",(r,e)=>{e.pattern??(e.pattern=cb),We.init(r,e)}),Yb=A("$ZodUUID",(r,e)=>{if(e.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Gs(i))}else e.pattern??(e.pattern=Gs());We.init(r,e)}),Xb=A("$ZodEmail",(r,e)=>{e.pattern??(e.pattern=ub),We.init(r,e)}),e0=A("$ZodURL",(r,e)=>{We.init(r,e),r._zod.check=t=>{try{let i=t.value.trim(),n=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:r,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:r,continue:!e.abort})),e.normalize?t.value=n.href:t.value=i;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:r,continue:!e.abort})}}}),t0=A("$ZodEmoji",(r,e)=>{e.pattern??(e.pattern=db()),We.init(r,e)}),r0=A("$ZodNanoID",(r,e)=>{e.pattern??(e.pattern=sb),We.init(r,e)}),i0=A("$ZodCUID",(r,e)=>{e.pattern??(e.pattern=rb),We.init(r,e)}),n0=A("$ZodCUID2",(r,e)=>{e.pattern??(e.pattern=ib),We.init(r,e)}),o0=A("$ZodULID",(r,e)=>{e.pattern??(e.pattern=nb),We.init(r,e)}),a0=A("$ZodXID",(r,e)=>{e.pattern??(e.pattern=ob),We.init(r,e)}),s0=A("$ZodKSUID",(r,e)=>{e.pattern??(e.pattern=ab),We.init(r,e)}),l0=A("$ZodISODateTime",(r,e)=>{e.pattern??(e.pattern=bb(e)),We.init(r,e)}),c0=A("$ZodISODate",(r,e)=>{e.pattern??(e.pattern=xb),We.init(r,e)}),u0=A("$ZodISOTime",(r,e)=>{e.pattern??(e.pattern=wb(e)),We.init(r,e)}),d0=A("$ZodISODuration",(r,e)=>{e.pattern??(e.pattern=lb),We.init(r,e)}),p0=A("$ZodIPv4",(r,e)=>{e.pattern??(e.pattern=pb),We.init(r,e),r._zod.bag.format="ipv4"}),h0=A("$ZodIPv6",(r,e)=>{e.pattern??(e.pattern=hb),We.init(r,e),r._zod.bag.format="ipv6",r._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:r,continue:!e.abort})}}}),f0=A("$ZodMAC",(r,e)=>{e.pattern??(e.pattern=fb(e.delimiter)),We.init(r,e),r._zod.bag.format="mac"}),m0=A("$ZodCIDRv4",(r,e)=>{e.pattern??(e.pattern=mb),We.init(r,e)}),g0=A("$ZodCIDRv6",(r,e)=>{e.pattern??(e.pattern=gb),We.init(r,e),r._zod.check=t=>{let i=t.value.split("/");try{if(i.length!==2)throw new Error;let[n,o]=i;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:r,continue:!e.abort})}}});function v0(r){if(r==="")return!0;if(r.length%4!==0)return!1;try{return atob(r),!0}catch{return!1}}var y0=A("$ZodBase64",(r,e)=>{e.pattern??(e.pattern=vb),We.init(r,e),r._zod.bag.contentEncoding="base64",r._zod.check=t=>{v0(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:r,continue:!e.abort})}});function sS(r){if(!pv.test(r))return!1;let e=r.replace(/[-_]/g,i=>i==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return v0(t)}var x0=A("$ZodBase64URL",(r,e)=>{e.pattern??(e.pattern=pv),We.init(r,e),r._zod.bag.contentEncoding="base64url",r._zod.check=t=>{sS(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:r,continue:!e.abort})}}),w0=A("$ZodE164",(r,e)=>{e.pattern??(e.pattern=yb),We.init(r,e)});function lS(r,e=null){try{let t=r.split(".");if(t.length!==3)return!1;let[i]=t;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var b0=A("$ZodJWT",(r,e)=>{We.init(r,e),r._zod.check=t=>{lS(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:r,continue:!e.abort})}}),A0=A("$ZodCustomStringFormat",(r,e)=>{We.init(r,e),r._zod.check=t=>{e.fn(t.value)||t.issues.push({code:"invalid_format",format:e.format,input:t.value,inst:r,continue:!e.abort})}}),wv=A("$ZodNumber",(r,e)=>{he.init(r,e),r._zod.pattern=r._zod.bag.pattern??Sb,r._zod.parse=(t,i)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}let n=t.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return t;let o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:n,inst:r,...o?{received:o}:{}}),t}}),_0=A("$ZodNumberFormat",(r,e)=>{Mb.init(r,e),wv.init(r,e)}),oh=A("$ZodBoolean",(r,e)=>{he.init(r,e),r._zod.pattern=Eb,r._zod.parse=(t,i)=>{if(e.coerce)try{t.value=!!t.value}catch{}let n=t.value;return typeof n=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:r}),t}}),bv=A("$ZodBigInt",(r,e)=>{he.init(r,e),r._zod.pattern=_b,r._zod.parse=(t,i)=>{if(e.coerce)try{t.value=BigInt(t.value)}catch{}return typeof t.value=="bigint"||t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:r}),t}}),P0=A("$ZodBigIntFormat",(r,e)=>{Db.init(r,e),bv.init(r,e)}),S0=A("$ZodSymbol",(r,e)=>{he.init(r,e),r._zod.parse=(t,i)=>{let n=t.value;return typeof n=="symbol"||t.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:r}),t}}),E0=A("$ZodUndefined",(r,e)=>{he.init(r,e),r._zod.pattern=Fb,r._zod.values=new Set([void 0]),r._zod.optin="optional",r._zod.optout="optional",r._zod.parse=(t,i)=>{let n=t.value;return typeof n>"u"||t.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:r}),t}}),B0=A("$ZodNull",(r,e)=>{he.init(r,e),r._zod.pattern=Bb,r._zod.values=new Set([null]),r._zod.parse=(t,i)=>{let n=t.value;return n===null||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:r}),t}}),F0=A("$ZodAny",(r,e)=>{he.init(r,e),r._zod.parse=t=>t}),N0=A("$ZodUnknown",(r,e)=>{he.init(r,e),r._zod.parse=t=>t}),k0=A("$ZodNever",(r,e)=>{he.init(r,e),r._zod.parse=(t,i)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:r}),t)}),$0=A("$ZodVoid",(r,e)=>{he.init(r,e),r._zod.parse=(t,i)=>{let n=t.value;return typeof n>"u"||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:r}),t}}),M0=A("$ZodDate",(r,e)=>{he.init(r,e),r._zod.parse=(t,i)=>{if(e.coerce)try{t.value=new Date(t.value)}catch{}let n=t.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:r}),t}});function Q1(r,e,t){r.issues.length&&e.issues.push(...qr(t,r.issues)),e.value[t]=r.value}var D0=A("$ZodArray",(r,e)=>{he.init(r,e),r._zod.parse=(t,i)=>{let n=t.value;if(!Array.isArray(n))return t.issues.push({expected:"array",code:"invalid_type",input:n,inst:r}),t;t.value=Array(n.length);let o=[];for(let a=0;a<n.length;a++){let s=n[a],l=e.element._zod.run({value:s,issues:[]},i);l instanceof Promise?o.push(l.then(u=>Q1(u,t,a))):Q1(l,t,a)}return o.length?Promise.all(o).then(()=>t):t}});function xv(r,e,t,i){r.issues.length&&e.issues.push(...qr(t,r.issues)),r.value===void 0?t in i&&(e.value[t]=void 0):e.value[t]=r.value}function cS(r){let e=Object.keys(r.shape);for(let i of e)if(!r.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let t=Hw(r.shape);return{...r,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function uS(r,e,t,i,n,o){let a=[],s=n.keySet,l=n.catchall._zod,u=l.def.type;for(let p in e){if(s.has(p))continue;if(u==="never"){a.push(p);continue}let d=l.run({value:e[p],issues:[]},i);d instanceof Promise?r.push(d.then(f=>xv(f,t,p,e))):xv(d,t,p,e)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),r.length?Promise.all(r).then(()=>t):t}var dS=A("$ZodObject",(r,e)=>{if(he.init(r,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let l={...s};return Object.defineProperty(e,"shape",{value:l}),l}})}let i=uu(()=>cS(e));$e(r._zod,"propValues",()=>{let s=e.shape,l={};for(let u in s){let p=s[u]._zod;if(p.values){l[u]??(l[u]=new Set);for(let d of p.values)l[u].add(d)}}return l});let n=Zs,o=e.catchall,a;r._zod.parse=(s,l)=>{a??(a=i.value);let u=s.value;if(!n(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:r}),s;s.value={};let p=[],d=a.shape;for(let f of a.keys){let m=d[f]._zod.run({value:u[f],issues:[]},l);m instanceof Promise?p.push(m.then(y=>xv(y,s,f,u))):xv(m,s,f,u)}return o?uS(p,u,s,l,i.value,r):p.length?Promise.all(p).then(()=>s):s}}),I0=A("$ZodObjectJIT",(r,e)=>{dS.init(r,e);let t=r._zod.parse,i=uu(()=>cS(e)),n=f=>{let v=new nh(["shape","payload","ctx"]),m=i.value,y=O=>{let T=ev(O);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};v.write("const input = payload.value;");let x=Object.create(null),D=0;for(let O of m.keys)x[O]=`key_${D++}`;v.write("const newResult = {};");for(let O of m.keys){let T=x[O],V=ev(O);v.write(`const ${T} = ${y(O)};`),v.write(`