@opendaw/studio-core 0.0.107 → 0.0.108

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
- var vk=Object.defineProperty;var Xo=(r,e)=>{for(var t in e)vk(r,t,{get:e[t],enumerable:!0})};var ka=class r{static DEFAULT_SIZE=512;static DEFAULT_DECAY=.9;#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=0;decay=!1;constructor({size:e,decay:t}={}){e??=r.DEFAULT_SIZE,this.#l=t??r.DEFAULT_DECAY,this.#e=e<<1,this.#r=new ig(this.#e),this.#i=new Float32Array(this.#e),this.#n=new Float32Array(this.#e),this.#o=Vp.create(Vp.Type.Blackman,this.#e),this.#t=e,this.#a=new Float32Array(e),this.#s=new Float32Array(e)}clear(){this.#a.fill(0),this.#i.fill(0),this.#s.fill(0),this.#c=0}reset(){this.#c=0}numBins(){return this.#t}bins(){return this.#a}waveform(){return this.#s}process(e,t,n,i){for(let o=n;o<i;++o)this.#i[this.#c]=e[o]+t[o],++this.#c===this.#e&&this.#u()}#u(){for(let t=0;t<this.#t;++t)this.#s[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 n=this.#i[t],i=this.#n[t],o=Math.sqrt(n*n+i*i)*e;this.#a[t]<o?this.#a[t]=o:this.decay&&(this.#a[t]*=this.#l)}this.#c=0,this.#n.fill(0),this.decay=!1}};var zp=r=>r,q=r=>r!=null,uo=r=>r===null,Ct=r=>r!==null,Ic=r=>r===void 0,Zs=r=>r!==void 0,ng=r=>r==null,K0=(r,e)=>r!=null?e(r):void 0,he=(r,e="asDefined failed")=>r??D(po(e)),pt=(r,e)=>r instanceof e,Ce=(r,e)=>r instanceof e?r:D(`${r} is not instance of ${e}`),W0=(r,e)=>{r instanceof e||D(`${r} is not instance of ${e}`)};var po=r=>r instanceof Function?r():r;var P=(r,...e)=>r?.apply(null,e),og=r=>q(r)&&typeof r=="object";var ag=r=>{throw new Error(`Unhandled ${r}`)},D=r=>{throw typeof r=="string"?new Error(r):r},V=(r,e)=>r?void 0:D(po(e));var Gs=r=>new Proxy({},{get(){return D(r)}});var j0=class{value;status="success";constructor(e){this.value=e}error=Gs("Cannot access error when succeeded")},L0=class{error;status="failure";constructor(e){this.error=e}value=Gs("Cannot access value when failed")},ho=r=>{try{return new j0(r())}catch(e){return new L0(e)}};var Gi=(r,e)=>Object.keys(e).length===0?D("Empty enum object (are you using `const enum`?)"):Object.keys(e).filter(i=>isNaN(Number(i))).map(i=>e[i]).includes(r)?r:D(`Invalid enum value: ${String(r)}`),ea=()=>{};var Z0;(function(r){r[r.Ascending=1]="Ascending",r[r.Descending=-1]="Descending"})(Z0||(Z0={}));var U=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 n=0;n<e.length;)t(e[n])?e.splice(n,1):n++};static peekFirst=e=>e.at(0)??null;static peekLast=e=>e.at(-1)??null;static getFirst=(e,t)=>he(e.at(0),t);static getLast=(e,t)=>he(e.at(-1),t);static getPrev=(e,t)=>{let n=e.indexOf(t);return n===-1?D(`${t} not found in ${e}`):he(e.at((n-1)%e.length),"Internal Error")};static getNext=(e,t)=>{let n=e.indexOf(t);return n===-1?D(`${t} not found in ${e}`):he(e.at((n+1)%e.length),"Internal Error")};static removeLast=(e,t)=>he(e.pop(),t);static create=(e,t)=>{let n=new Array(t);for(let i=0;i<t;i++)n[i]=e(i);return n};static equals=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};static satisfy=(e,t)=>{if(e.length<2)return!0;let n=e[0];for(let i=1;i<e.length;i++)if(!t(n,e[i]))return!1;return!0};static remove=(e,t)=>{let n=e.indexOf(t);if(n===-1)return D(`${t} not found in ${e}`);e.splice(n,1)};static removeIf=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n])&&e.splice(n,1)};static removeOpt=(e,t)=>{let n=e.indexOf(t);return n===-1?!1:(e.splice(n,1),!0)};static hasDuplicates=e=>new Set(e).size<e.length;static removeDuplicates=e=>{let t=0,n=new Set;for(let i of e)n.has(i)||(n.add(i),e[t++]=i);return e.length=t,e};static removeDuplicateKeys=(e,t)=>{let n=0,i=new Set;for(let o of e){let a=o[t];i.has(a)||(i.add(a),e[n++]=o)}return e.length=n,e};static subtract(e,t,n){return e.filter(i=>!t.some(o=>n(i,o)))}static intersect(e,t,n){return e.filter(i=>t.some(o=>n(i,o)))}static merge(e,t,n){return[...e.filter(i=>!t.some(o=>n(i,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 n=0;n<=t;n++)yield{value:e[n],isFirst:n===0,isLast:n===t}}static*iterateAdjacent(e){if(!(e.length<=1))for(let t=1,n=e[0];t<e.length;t++){let i=e[t];yield[n,i],n=i}}static isSorted(e,t=Z0.Ascending){if(e.length<2)return!0;let n=e[0];for(let i=1;i<e.length;i++){let o=e[i];if(Math.sign(n-o)===t)return!1;n=o}return!0}static toRecord(e,t){return e.reduce((n,i)=>(n[t(i)]=i,n),{})}static concatArrayBuffers(e,t){let n=new ArrayBuffer(e.byteLength+t.byteLength),i=new Uint8Array(n);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),n}};var m;(function(r){r.wrap=t=>q(t)?new e(t):r.None,r.from=t=>r.wrap(t()),r.tryCatch=t=>{try{return r.wrap(t())}catch{return r.None}},r.execute=(t,...n)=>r.wrap(t?.apply(null,n)),r.async=t=>t.then(n=>r.wrap(n),()=>r.None);class e{#e;constructor(n){this.#e=he(n)}unwrap(){return this.#e}unwrapOrElse(n){return this.#e}unwrapOrNull(){return this.#e}unwrapOrUndefined(){return this.#e}contains(n){return n===this.#e}match(n){return n.some(this.#e)}ifSome(n){return n(this.#e)}ifAbsent(n){}isEmpty(){return!1}nonEmpty(){return!0}map(n){return r.wrap(n(this.#e))}mapOr(n,i){return n(this.#e)}flatMap(n){return n(this.#e)}equals(n){return this.unwrapOrNull()===n.unwrapOrNull()}assert(n){return this}toString(){return`{Option.Some(${this.#e})}`}get[Symbol.toStringTag](){return this.toString()}}r.Some=e,r.None=new class{unwrap=t=>D(q(t)?po(t):"unwrap failed");unwrapOrElse=t=>po(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,n)=>po(n);flatMap=t=>r.None;equals=t=>t.isEmpty();assert=t=>D(po(t)??"assert failed");toString=()=>"{Option.None}";get[Symbol.toStringTag](){return this.toString()}}})(m||(m={}));var fo;(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=()=>m.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(n){return r.err(n)}};mapOr=(t,n)=>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=()=>m.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=()=>m.None;failureReason=()=>this.reason;isFailure=()=>!0;isSuccess=()=>!1;result=()=>D(`'${this.reason}'`);map=()=>this;mapOr=(t,n)=>po(n);unwrapOrElse=t=>po(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)})(fo||(fo={}));var ct;(function(r){r.exact=(e,t,n)=>{let i=0,o=e.length-1;for(;i<=o;){let a=i+o>>>1,s=n(e[a],t);if(s===0)return a;s<0?i=a+1:o=a-1}return-1},r.exactMapped=(e,t,n,i)=>{let o=0,a=e.length-1;for(;o<=a;){let s=o+a>>>1,l=n(i(e[s]),t);if(l===0)return s;l<0?o=s+1:a=s-1}return-1},r.leftMost=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<0?i=a+1:o=a}return i},r.rightMost=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<=0?i=a+1:o=a}return o-1},r.stableInsert=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<0?i=a+1:o=a}for(;i<e.length&&n(e[i],t)===0;)i++;return i},r.leftMostMapped=(e,t,n,i)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;n(i(e[s]),t)<0?o=s+1:a=s}return o},r.rightMostMapped=(e,t,n,i)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;n(i(e[s]),t)<=0?o=s+1:a=s}return a-1},r.rangeMapped=(e,t,n,i)=>[r.leftMostMapped(e,t,n,i),r.rightMostMapped(e,t,n,i)]})(ct||(ct={}));var St=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,n=1<<e-(t<<5);return(this.#t[t]&n)!==0}setBit(e,t){let n=e>>>5,i=1<<e-(n<<5),o=this.#t[n],a=t?o|i:o&~i;return a===o?!1:(this.#t[n]=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),n=!1;for(let i=0;i<t.length;i++)this.#t[i]!==t[i]&&(this.#t[i]=t[i],n=!0);return n}toString(){let e="";for(let t of U.iterateReverse(this.#t))e+=t.toString(2).padStart(32,"0");return e.substring(e.length-this.#e)}clear(){this.#t.fill(0)}};var sg=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 Ht=class r{static parseCssRgbOrRgba(e){let t=e.match(/\(([^)]+)\)/)?.at(1)?.split(",")?.map(Number);if(q(t)&&t.every(n=>!isNaN(n))){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,n){let i=l=>(l+e/30)%12,o=t*Math.min(n,1-n),a=l=>n-o*Math.max(-1,Math.min(i(l)-3,Math.min(9-i(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,n=parseInt(t.slice(0,2),16)/255,i=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,a=Math.max(n,i,o),s=Math.min(n,i,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 n:u=((i-o)/d+(i<o?6:0))*60;break;case i:u=((o-n)/d+2)*60;break;case o:u=((n-i)/d+4)*60;break}}return{h:u,s:p,l}}static hslStringToHex(e){let[t,n,i]=e.match(/\d+(\.\d+)?/g).map(Number);return r.hslToHex(t,n/100,i/100)}#e;#t;#r;#i;constructor(e,t,n,i=1){this.#e=e,this.#t=t,this.#r=n,this.#i=i}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)),n=this.#r+(100-this.#r)*e**3;return new r(this.#e,t,n,this.#i)}toString(){return this.#i===1?`hsl(${this.#e}, ${this.#t}%, ${this.#r}%)`:`hsla(${this.#e}, ${this.#t}%, ${this.#r}%, ${this.#i})`}};var $a=(r,e)=>r-e;var Nn=Math.PI*2,vC=Math.PI/2,G0=Math.PI/4,yC=1/Math.sqrt(2),be=(r,e,t)=>Math.max(e,Math.min(r,t)),qi=r=>Math.max(0,Math.min(r,1)),HF=(r,e)=>e+(1-2*e)*Math.max(0,Math.min(r,1)),ta=(r,e)=>Math.floor(r/e)*e,Dc=(r,e)=>Math.ceil(r/e)*e;var lg=(r,e,t)=>r+(e-r)*t,JF=(r,e,t)=>r*Math.pow(e/r,t);var qs=(r,e)=>yk(r/e)*e,yk=r=>r-Math.floor(r),mo=r=>Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));var q0=(r,e)=>r*e/((2*e-1)*(r-1)+e);var vr;(function(r){r.valueAt=({slope:i,steps:o,y0:a,y1:s},l)=>r.normalizedAt(l/o,i)*(s-a)+a,r.normalizedAt=(i,o)=>{if(o>.499999&&o<.500001)return i;{let a=be(o,1e-15,.999999999999999);return a*a/(1-a*2)*(Math.pow((1-a)/a,2*i)-1)}},r.inverseAt=(i,o)=>{let a=be(o,1e-15,.999999999999999);return Math.log(i*(1-2*a)/(a*a)+1)/(2*Math.log((1-a)/a))},r.coefficients=i=>{let o=r.valueAt(i,1),s=(r.valueAt(i,2)-o)/(o-i.y0),l=o-s*i.y0;return{m:s,q:l}};function*t(i,o,a,s){let{m:l,q:u}=r.coefficients({slope:i,steps:o,y0:a,y1:s});for(let p=0,d=a;p<o;p++)yield d=l*d+u}r.walk=t,r.run=(i,o,a,s,l)=>{let{m:u,q:p}=r.coefficients({slope:i,steps:o,y0:a,y1:s});for(let d=0,h=a;d<o;d++)l(h=u*h+p)};function*n(i,o){let a=1/o,s=r.normalizedAt(a,i),u=(r.normalizedAt(2*a,i)-s)/s;for(let p=0,d=0;p<o;p++)yield d=u*d+s}r.walkNormalized=n,r.byHalf=(i,o,a,s)=>({slope:r.slopeByHalf(o,a,s),steps:i,y0:o,y1:s}),r.slopeByHalf=(i,o,a)=>Math.abs(a-i)<1e-6?.5:(o-i)/(a-i)})(vr||(vr={}));var go=new DataView(new ArrayBuffer(8)),yr;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647,r.toByte=e=>(go.setInt8(0,e),go.getInt8(0)),r.toShort=e=>(go.setInt16(0,e),go.getInt16(0)),r.toInt=e=>(go.setInt32(0,e),go.getInt32(0))})(yr||(yr={}));var ra;(function(r){let n=new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(n),o=new Int32Array(n);r.floatToIntBits=a=>{let s=r.floatToRawIntBits(a);return(s&2139095040)===2139095040&&s&8388607?2143289344:s},r.intBitsToFloat=a=>(o[0]=a,i[0]),r.floatToRawIntBits=a=>(i[0]=a,o[0]),r.toFloat32=a=>(go.setFloat32(0,a),go.getFloat32(0))})(ra||(ra={}));var QF;(function(r){r.floatToIntBits=e=>{let t=ra.floatToIntBits(e),n=t>>>16&32768,i=(t&2147483647)+4096;return i>=1199570944?(t&2147483647)>=1199570944?i<2139095040?n|31744:n|31744|(t&8388607)>>>13:n|31743:i>=947912704?n|i-939524096>>>13:i<855638016?n:(i=(t&2147483647)>>>23,n|(t&8388607|8388608)+(8388608>>>i-102)>>>126-i)},r.intBitsToFloat=e=>{let t=e&1023,n=e&31744;if(n===31744)n=261120;else if(n!==0){if(n+=114688,t===0&&n>115712)return ra.intBitsToFloat((e&32768)<<16|n<<13|1023)}else if(t!==0){n=115712;do t<<=1,n-=1024;while(!(t&1024));t&=1023}return ra.intBitsToFloat((e&32768)<<16|(n|t)<<13)}})(QF||(QF={}));var cg;(function(r){let e=9218868437227405312n,t=4503599627370495n,n=new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT),i=new Float64Array(n),o=new BigInt64Array(n);r.float64ToLongBits=a=>{let s=r.float64ToRawLongBits(a);return(s&e)===e&&(s&t)!==0n?0x7ff8000000000000n:s},r.longBitsToFloat64=a=>(o[0]=a,i[0]),r.float64ToRawLongBits=a=>(i[0]=a,o[0]),r.clamp=a=>(go.setFloat64(0,a),go.getFloat64(0))})(cg||(cg={}));var ht=class{static*empty(){}static one(e){return[e]}static count(e){let t=0;for(let n of e)t++;return t}static some(e,t){for(let n of e)if(t(n))return!0;return!1}static every(e,t){for(let n of e)if(!t(n))return!1;return!0}static reduce(e,t,n){let i=n,o=0;for(let a of e)i=t(i,a,o++);return i}static includes(e,t){for(let n of e)if(n===t)return!0;return!1}static forEach(e,t){for(let n of e)t(n)}static*map(e,t){let n=0;for(let i of e)yield t(i,n++)}static*take(e,t){let n=0;for(let i of e){if(n++>=t)return;yield i}}static filter(e,t){let n=[];for(let i of e)t(i)&&n.push(i);return n}static filterMap(e,t){let n=[];for(let i of e){let o=t(i);q(o)&&n.push(o)}return n}static reverse(e){let t=[];for(let n of e)t.push(n);return t.reverse()}static*pairWise(e){let t=e[Symbol.iterator](),{done:n,value:i}=t.next(),o=i;if(n!==!0)for(;;){let{done:a,value:s}=t.next();if(a===!0){yield[o,null];return}yield[o,s],o=s}}};var or=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?D(`position(${e}) cannot be negative.`):e>this.#e.byteLength?D(`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 n=0;n<t;n++)this.writeShort(e.charCodeAt(n))}toArrayBuffer(){return this.#e.buffer.slice(0,this.#t)}#r(e){let t=this.#e.byteLength;if(this.#t+e>t){let n=this.#e;this.#e=new DataView(new ArrayBuffer(mo(t+e)));for(let i=0;i<this.#t;i++)this.#e.setInt8(i,n.getInt8(i))}}},Mc=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}},ug=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,n)=>e.#e[n]===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(ra.floatToIntBits(e))}writeDouble(e){this.writeLong(cg.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(ht.map(this.#e.values(),e=>(e&255).toString(16).padStart(2,"0"))).join("")}},wt=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?D(`position(${e}) cannot be negative.`):e>this.#e.byteLength?D(`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 n=0;n<e;n++)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 xk=r=>q(r)?r.value!==void 0?"value":r.get!==void 0?"get":D(`Cannot resolve method key of ${r}`):D("Cannot resolve method key of undefined descriptor"),kc=(r,e,t)=>{if(!q(t))return function(o,a){if(a&&a.kind==="getter")return function(){let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),e);if(!q(s?.get))return D(`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 n=xk(t),i=he(t[n]);return{[n]:function(...o){if(o.length>0)return D("lazy accessory must not have any construction parameters");let a=i.apply(this);return Object.defineProperty(this,e,{value:n==="get"?a:()=>a,configurable:!1,writable:!1,enumerable:!1}),a}}};var ia;(function(r){function*e(){}r.empty=e;function*t(...n){for(let i of n)for(let o of i)yield o}r.flatten=t})(ia||(ia={}));var ar=class{#e=new Set;#t;constructor(){this.#t=new Proxy({},{get:(e,t)=>(...n)=>this.#e.forEach(i=>Object.getPrototypeOf(i)===Object.getPrototypeOf({})?P(i[t],...n):i[t]?.apply(i,n))})}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 YF=(r,...e)=>new Proxy([],{get(t,n){if(typeof n=="string"){let i=Number(n);if(!isNaN(i)&&i>=0&&Number.isInteger(i))return new r(...e)}return n===Symbol.iterator?function*(){for(;;)yield new r(...e)}:t[n]},has(t,n){if(typeof n=="string"){let i=Number(n);if(!isNaN(i)&&i>=0)return!0}return n in t}});var Hs=class{static createIfAbsent(e,t,n){let i=e.get(t);return i===void 0&&(i=n(t),e.set(t,i)),i}};var Up=class r{static#e=Object.freeze(new Set);static empty=()=>r.#e};var dg=class r{#e;#t;constructor(e,t){this.#e=new Map(e),this.#t=m.wrap(t),this.#t.ifSome(n=>Array.from(this.#e.values()).forEach(i=>i.sort(n)))}[Symbol.iterator](){return this.#e.entries()}clear(){this.#e.clear()}containsEntry(e,t){return ht.some(this.#e.entries(),n=>e===n[0]&&n[1].includes(t))}containsKey(e){return ht.includes(this.#e.keys(),e)}containsValue(e){return ht.some(this.#e.values(),t=>t.includes(e))}get(e){return this.#e.get(e)??U.empty()}isEmpty(){return this.keyCount()===0}add(e,t){let n=Hs.createIfAbsent(this.#e,e,()=>[]);if(this.#t.isEmpty())n.push(t);else{let i=ct.stableInsert(n,t,this.#t.unwrap());n.splice(i,0,t)}}addAll(e,t){let n=Hs.createIfAbsent(this.#e,e,()=>[]);n.push(...t),this.#t.nonEmpty()&&n.sort(this.#t.unwrap())}remove(e,t){let n=this.#e.get(e);if(n===void 0)return!1;{let i=n.indexOf(t);return i===-1?!1:(n.splice(i,1),n.length===0&&this.#e.delete(e),!0)}}removeFromKeyIf(e,t){let n=this.#e.get(e);if(n===void 0)return null;{let i=n.findIndex(t);if(i===-1)return null;{let o=n.splice(i,1)[0];return n.length===0&&this.#e.delete(e),o}}}removeValueIf(e){let t=[];for(let[n,i]of this.#e.entries())for(let o of i.filter(a=>e(a)))t.push([n,o]);for(let[n,i]of t)this.remove(n,i);return new Set(t.map(([,n])=>n))}removeKey(e){let t=this.#e.get(e);return this.#e.delete(e),t??U.empty()}forEach(e){ht.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(),n=Array.from(this.keys()).sort(e);this.#e.clear();for(let i of n)this.addAll(i,t.get(i));return this}clone(){let e=new r;return this.#e.forEach((t,n)=>{e.#e.set(n,t.map(i=>i))}),e}},$c=class r{map;constructor(e){this.map=new Map(e?.map(t=>{let n=t[0],i=t[1];return[n,new Set(i)]}))}clear(){this.map.clear()}containsEntry(e,t){return ht.some(this.map.entries(),n=>e===n[0]&&n[1].has(t))}containsKey(e){return ht.includes(this.map.keys(),e)}containsValue(e){return ht.some(this.map.values(),t=>t.has(e))}get(e){return this.map.get(e)??Up.empty()}isEmpty(){return this.keyCount()===0}add(e,t){Hs.createIfAbsent(this.map,e,()=>new Set).add(t)}addAll(e,t){let n=Hs.createIfAbsent(this.map,e,()=>new Set);for(let i of t)n.add(i)}remove(e,t){let n=this.map.get(e);return n===void 0?!1:n.delete(t)?(n.size===0&&this.map.delete(e),!0):!1}removeValueIf(e){let t=new Set;for(let[n,i]of this.map.entries()){for(let o of i)e(o)&&(i.delete(o),t.add(o));i.size===0&&this.map.delete(n)}return t}removeFromKeyIf(e,t){let n=this.map.get(e);if(n===void 0)return null;for(let i of n)if(t(i))return n.delete(i),n.size===0&&this.map.delete(e),i;return null}removeKey(e){let t=this.map.get(e);return this.map.delete(e),t??Up.empty()}forEach(e){ht.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(),n=Array.from(this.keys()).sort(e);this.map.clear();for(let i of n)this.addAll(i,t.get(i));return this}clone(){let e=new r;return this.map.forEach((t,n)=>{e.map.set(n,new Set(Array.from(t)))}),e}};var ee=Object.freeze({Empty:{terminate:ea},create:r=>({terminate:r}),many:(...r)=>({terminate:()=>{for(;r.length>0;)r.pop().terminate()}})}),j=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:()=>U.removeOpt(this.#e,e)}),this.own(e)}terminate(){for(;this.#e.length>0;)this.#e.pop().terminate()}};var ce=class{static subscribeMany(e,...t){return ee.many(...t.map(n=>n.subscribe(()=>e(n))))}#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 _i;(function(r){let e=Object.freeze({});r.empty=()=>e,r.mergeNoOverlap=(t,n)=>{let i=new Set(Object.keys(t));for(let o of Object.keys(n))if(i.has(o))return D(`'${o}' is an overlapping key`);return{...t,...n}},r.include=(t,...n)=>{let i={};for(let o of n)i[o]=t[o];return i},r.exclude=(t,...n)=>{let i=new Set(n);return Object.entries(t).reduce((o,[a,s])=>(i.has(a)||(o[a]=s),o),{})},r.overwrite=(t,n)=>Object.assign(t,n),r.entries=t=>Object.entries(t)})(_i||(_i={}));var XF;(function(r){r.seal=e=>new class{getValue(){return e}subscribe(t){return ee.Empty}catchupAndSubscribe(t){return t(this),ee.Empty}}})(XF||(XF={}));var eB;(function(r){r.False=new class{getValue(){return!1}setValue(e){}subscribe(e){return ee.Empty}catchupAndSubscribe(e){return e(this),ee.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)}}})(eB||(eB={}));var Mr=class{#e;#t=m.None;constructor(e){this.#e=new ce,this.wrap(e)}wrap(e){this.wrapOption(m.wrap(e))}wrapOption(e){this.#t.equals(e)||(this.#t=e,this.#e.notify(this))}clear(e){this.#t.isEmpty()||(q(e)&&e(this.#t.unwrap()),this.#t=m.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 Hi=class{#e;#t=m.None;#r;constructor(e,t){this.#e=new ce,this.#r=t?.guard(e)??e,this.#t=m.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 H0=class{#e;#t;constructor(e,t){V(e<t,"Linear is inverse"),this.#e=e,this.#t=t}x(e){return e<=this.#e?0:e>=this.#t?1:(e-this.#e)/(this.#t-this.#e)}y(e){return e<=0?this.#e:e>=1?this.#t:this.#e+e*(this.#t-this.#e)}clamp(e){return be(e,this.#e,this.#t)}floating(){return!0}},J0=class{#e;#t;#r;constructor(e,t){this.#e=be(Math.round(e),yr.MIN_VALUE,yr.MAX_VALUE),this.#t=be(Math.round(t),yr.MIN_VALUE,yr.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(be(e,0,1)*this.#r)}clamp(e){return be(Math.round(e),this.#e,this.#t)}floating(){return!1}},Q0=class{#e;#t;constructor(e,t){V(e<t,"Exponential is inverse"),this.#e=e,this.#t=t}x(e){return e<=this.#e?0:e>=this.#t?1:Math.log(e/this.#e)/Math.log(this.#t/this.#e)}y(e){return e<=0?this.#e:e>=1?this.#t:Math.exp(e*Math.log(this.#t/this.#e))*this.#e}clamp(e){return Math.min(this.#t,Math.max(this.#e,e))}floating(){return!0}},pg=class{#e;#t;#r;#i;constructor(e,t,n){V(t!==n,"Power min === max"),this.#e=e,this.#t=t,this.#r=n,this.#i=n-t}x(e){return e<=this.#t?0:e>=this.#r?1:Math.pow((e-this.#t)/this.#i,1/this.#e)}y(e){return e<=0?this.#t:e>=1?this.#r:this.#t+Math.pow(e,this.#e)*this.#i}clamp(e){return Math.min(this.#r,Math.max(this.#t,e))}floating(){return!0}},Y0=class{#e;constructor(e){this.#e=e}x(e){let t=this.#e.findIndex(n=>n===e);return t===-1?D(`Could not find index for ${e}`):t/(this.#e.length-1)}y(e){let t=Math.round(be(e,0,1)*(this.#e.length-1));return t>-1?he(this.#e.at(t),`Could not find value for ${e}`):D(`Index ${t} is out of box.`)}clamp(e){return e}floating(){return!1}},X0=class{#e;#t;#r;#i;#n;constructor(e,t,n){this.#e=e,this.#t=n;let i=e*e,o=n*n,a=t*t,s=e+n-2*t,l=n-t;this.#r=((2*n-t)*e-t*n)/s,this.#i=(l*i+(a-o)*e+t*o-a*n)/(i+(2*n-4*t)*e+o-4*t*n+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}},A;(function(r){r.linear=(o,a)=>new H0(o,a),r.linearInteger=(o,a)=>new J0(o,a),r.exponential=(o,a)=>new Q0(o,a),r.power=(o,a,s)=>new pg(o,a,s),r.powerByCenter=(o,a,s)=>{let l=Math.log((s-a)/(o-a))/Math.log(2);if(Number.isNaN(l))throw new Error(`powerByCenter: invalid center=${o}, min=${a}, max=${s}`);return new pg(l,a,s)},r.values=o=>new Y0(o),r.decibel=(o,a,s)=>new X0(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),n=r.linear(-1,1);r.bool=e;let i=r.decibel(-72,-12,0);r.unipolar=()=>t,r.bipolar=()=>n,r.DefaultDecibel=i})(A||(A={}));var _;(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?be(l/200+.5,0,1):be(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(q(d)){let h=t.indexOf(d);if(h>-1)return{type:"explicit",value:l*Math.pow(10,(h-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}=i(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"]),n=o=>Math.log(o)/Math.log(9.999999999999998),i=o=>{let a=Math.floor(n(o)/3),s=t[a+4];return q(s)?{value:o*Math.pow(10,a*-3),prefix:s}:{value:o,prefix:""}};r.decible=r.numeric({unit:"db",fractionDigits:2}),r.panning=r.percent({unit:"%",fractionDigits:0})})(_||(_={}));var Tc;(function(r){r.alwaysTrue=()=>!0,r.alwaysFalse=()=>!1,r.definedPredicate=e=>e!=null})(Tc||(Tc={}));var Rc;(function(r){r.create=(e=252854082)=>new eA(e),r.monotoneAscending=(e,t=128,n=r.create())=>{let i=e.length;if(i<2)return D("Array must have at least 2 elements");let o=0;for(let s=1;s<i;s++){let l=Math.floor(n.uniform()*(1+t))+1;e[s]=l,o+=l}let a=0;e[0]=0;for(let s=1;s<i;s++)a+=e[s],e[s]=a/o;return e}})(Rc||(Rc={}));var eA=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 xr;(function(r){class e{}r.createBuilder=n=>{let i=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]=i(l))}),a};return()=>new t(n,Object.seal(i(n)))},r.bool=new class extends e{read(n){return n.readByte()===1}write(n,i){n.writeByte(i?1:0)}initialValue(){return!1}},r.int8=new class extends e{read(n){return n.readByte()}write(n,i){n.writeByte(i)}initialValue(){return 0}},r.int16=new class extends e{read(n){return n.readShort()}write(n,i){n.writeShort(i)}initialValue(){return 0}},r.int32=new class extends e{read(n){return n.readInt()}write(n,i){n.writeInt(i)}initialValue(){return 0}},r.float=new class extends e{read(n){return n.readFloat()}write(n,i){n.writeFloat(i)}initialValue(){return 0}},r.double=new class extends e{read(n){return n.readDouble()}write(n,i){n.writeDouble(i)}initialValue(){return 0}},r.int64=new class extends e{read(n){return n.readLong()}write(n,i){n.writeLong(i)}initialValue(){return 0n}},r.floats=n=>new class extends e{read(i,o){for(let a=0;a<o.length;a++)o[a]=i.readFloat();return o}write(i,o){for(let a=0;a<o.length;a++)i.writeFloat(o[a])}initialValue(){return new Float32Array(n)}},r.doubles=n=>new class extends e{read(i,o){for(let a=0;a<o.length;a++)o[a]=i.readDouble();return o}write(i,o){for(let a=0;a<o.length;a++)i.writeDouble(o[a])}initialValue(){return new Float64Array(n)}};class t{#e;#t;#r;constructor(i,o){this.#e=i,this.#t=o,this.#r=this.#i()}get object(){return this.#t}get bytesTotal(){return this.#r}read(i){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?p[l]=u.read(i,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}write(i){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?u.write(i,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}#i(){let i=new Mc;return this.write(i),i.count}}})(xr||(xr={}));var Cc=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=[]}add(e,t=!1){let n=this.#e(e),i=ct.leftMostMapped(this.#r,n,this.#t,this.#e),o=this.#r[i];return q(o)&&this.#t(this.#e(o),n)===0?t?(this.#r.splice(i,1,e),!0):!1:(this.#r.splice(i,0,e),!0)}getOrCreate(e,t){let n=ct.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[n];if(q(i)&&this.#t(this.#e(i),e)===0)return i;let o=t(e);return this.#r.splice(n,0,o),o}addMany(e){for(let t of e)this.#r.push(t);try{return this.#r.sort((t,n)=>{let i=this.#t(this.#e(t),this.#e(n));if(i===0)throw"cancel";return i}),!0}catch(t){if(t==="cancel"){let n=new Map(this.entries());return this.#r.splice(0,this.#r.length,...n.values()),this.#r.sort((i,o)=>this.#t(this.#e(i),this.#e(o))),!1}return D(t)}}removeByValue(e){return this.removeByKey(this.#e(e))}removeByKey(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?(this.#r.splice(t,1),n):D(`Could not remove ${e}`)}removeByKeyIfExist(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?(this.#r.splice(t,1),n):null}removeRange(e,t){this.#r.splice(e,(t??this.#r.length)-e)}removeByPredicate(e){let t=0,n=this.#r.length;for(;--n>=0;)e(this.#r[n])&&(this.#r.splice(n,1),t++);return t}get(e){return he(this.#i(e),`Unknown key: ${e}`)}getOrThrow(e,t){let n=this.#i(e);if(q(n))return n;throw t()}opt(e){return m.wrap(this.#i(e))}getOrNull(e){return this.#i(e)??null}getByIndex(e){return this.#r[e]}hasKey(e){return q(this.#i(e))}hasValue(e){return q(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(){U.clear(this.#r)}[Symbol.iterator](){return this.#r.values()}#i(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?n:void 0}};var Oc=(()=>{let r=m.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:ea}),some:t=>t.progress(e)}),install:e=>{V(r.isEmpty(),"RuntimeNotification already installed"),r=m.wrap(e)}}})();var jp=class r{static createEstimator=()=>{let e=performance.now(),t=r.millis(Number.POSITIVE_INFINITY),n=0;return i=>{if(i===0)return r.POSITIVE_INFINITY;if(i>=1)return r.millis(0);let o=performance.now()-e;return o>n*1e3&&(t=r.millis(o/i-o),n++),t}};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 toHHMMSS=e=>((e/3600|0)+100).toString().slice(1)+":"+((e/60|0)%60+100).toString().slice(1)+":"+(e%60+100).toString().slice(1);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,n=Math.floor(Math.abs(this.#n)/1e3),i=Math.floor(n/60),o=Math.floor(i/60),a=Math.floor(o/24);return n<60?(e=n,t="second"):i<60?(e=i,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:n,s:i}=this.split();return e>0?[r.#o("d",e),r.#o("h",t),r.#o("m",n),r.#o("s",i)].join(", "):t>0?[r.#o("h",t),r.#o("m",n),r.#o("s",i)].join(", "):n>0?[r.#o("m",n),r.#o("s",i)].join(", "):i>0?r.#o("s",i):"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 ag(e)}}};var Vc;(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,n,i)=>{if(t.bytesTotal+1>n.byteLength)return D("Insufficient memory allocated.");let o=new Uint8Array(n),a=or.use(n,1);return Atomics.store(o,0,e.READ),{tryWrite:()=>Atomics.compareExchange(o,0,e.READ,e.WRITING)===e.WRITING?(i(t.object),a.position=0,t.write(a),Atomics.store(o,0,e.WRITTEN),!0):!1}},r.reader=(t,n)=>{let i=new SharedArrayBuffer(t.bytesTotal+1),o=new Uint8Array(i),a=new wt(i,1);return{buffer:i,tryRead:()=>Atomics.compareExchange(o,0,e.WRITTEN,e.READING)===e.READING?(a.position=0,t.read(a),n(t.object),Atomics.store(o,0,e.READ),!0):!1}}})(Vc||(Vc={}));var b;(function(r){r.length=16,r.generate=()=>e(crypto.getRandomValues(new Uint8Array(r.length))),r.sha256=async t=>{let n=typeof process<"u"&&process.env?.VITEST==="true";return crypto.subtle.digest("SHA-256",n?new Uint8Array(t.slice(0)):t).then(i=>e(new Uint8Array(i.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:D(`Invalid UUID format: ${t}`),r.fromDataInput=t=>{let n=new Uint8Array(r.length);return t.readBytes(new Int8Array(n.buffer)),n},r.toDataOutput=(t,n)=>t.writeBytes(new Int8Array(n.buffer)),r.toString=t=>{let n=U.create(i=>(i+256).toString(16).substring(1),256);return n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]},r.parse=t=>{let n=t.replace(/-/g,"").toLowerCase();if(n.length!==32)return D("Invalid UUID format");let i=new Uint8Array(r.length);for(let o=0,a=0;o<32;o+=2,a++)i[a]=parseInt(n.slice(o,o+2),16);return i},r.Comparator=(t,n)=>{if(t.length!==r.length||n.length!==r.length)return D("Unexpected array length for uuid(v4)");for(let i=0;i<r.length;i++){let o=t[i]-n[i];if(o!==0)return o}return 0},r.equals=(t,n)=>r.Comparator(t,n)===0,r.newSet=t=>new Cc(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 n=new Uint8Array(r.Lowest),i=new Uint8Array(new Uint32Array([t]).buffer);for(let o=0;o<4;o++)n[o]=i[o];return n},r.zType=t=>t.string().refine(n=>r.validateString(n),{message:"Invalid UUID format"}).transform(n=>n);let e=t=>(V(t.length===r.length,"UUID must be 16 bytes long"),t[6]=t[6]&15|64,t[8]=t[8]&63|128,t)})(b||(b={}));var hg=class{#e=new j;#t;#r;#i;constructor(e){this.#r=e,this.#t=this.#e.own(new ce),this.#i=this.#a(e,[])}get data(){return this.#r}get proxy(){return this.#i}subscribe(e,...t){let n=()=>t.reduce((i,o)=>i[o],this.#i);return this.#t.subscribe(i=>{this.#n(i,t)&&e(n())})}catchupAndSubscribe(e,...t){return e(t.reduce((i,o)=>i[o],this.#i)),this.subscribe(e,...t)}subscribeAll(e){return this.#t.subscribe(t=>e(t[0]))}createMutableObservableValue(...e){let t=this.#e.own(new j),n=t.own(new ce),i=()=>e.slice(0,-1).reduce((s,l)=>s[l],this.#i),o=e[e.length-1],a={getValue:()=>e.reduce((s,l)=>s[l],this.#i),setValue:s=>i()[o]=s,subscribe:s=>n.subscribe(s),catchupAndSubscribe:s=>(s(a),n.subscribe(s)),terminate:()=>t.terminate()};return t.own(this.subscribe(()=>n.notify(a),...e)),a}update(e){let t=new Set;this.#o(this.#r,e,t);for(let n of t)this.#t.notify([n])}terminate(){this.#e.terminate(),this.#t.terminate()}#n=(e,t)=>{let n=Math.min(e.length,t.length);for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0};#o=(e,t,n,i)=>{for(let o of Object.keys(t)){let a=i??o,s=t[o],l=e[o];s!==null&&typeof s=="object"&&!Array.isArray(s)?this.#o(e[o],s,n,a):l!==s&&(e[o]=s,n.add(a))}};#a=(e,t)=>new Proxy(e,{get:(n,i)=>{let o=n[i];return o!==null&&typeof o=="object"&&!Array.isArray(o)?this.#a(o,[...t,i]):o},set:(n,i,o)=>(n[i]=o,this.#t.notify([...t,i]),!0),preventExtensions:()=>!1})};var fg=class{#e=new Set;add(e){this.#e.add(new WeakRef(e))}forEach(e){for(let t of this.#e){let n=t.deref();n===void 0?this.#e.delete(t):e(n)}}count(){let e=0;for(let t of this.#e)t.deref()===void 0?this.#e.delete(t):e++;return e}clear(){this.#e.clear()}};var tA=(r,e)=>Math.floor(3840/e)*r,tB=(r,e=4,t=4)=>{let n=tA(1,t),i=Math.floor(r/n),o=Math.floor(i/e),s=(Math.floor(r)-tA(o*e,t))%n,l=Math.floor(s/240),u=s%240;return{bars:o,beats:i-o*e,semiquavers:l,ticks:u}},rB=(r,e)=>r*e/60*960,iB=(r,e)=>r*60/960/e,wk=(r,e)=>e*60/960/r,bk=(r,e,t)=>rB(r/t,e),Ak=(r,e,t)=>iB(r,e)*t,J={Bar:3840,Quarter:960,SemiQuaver:240,fromSignature:tA,toParts:tB,secondsToPulses:rB,pulsesToSeconds:iB,secondsToBpm:wk,samplesToPulses:bk,pulsesToSamples:Ak,toString:(r,e=4,t=4)=>{let{bars:n,beats:i,semiquavers:o,ticks:a}=tB(r|0,e,t);return`${n+1}.${i+1}.${o+1}:${a}`}};var fe=128,na=J.fromSignature(1,48),mg=1e-4;var Ae=class r{static Empty=new r(2);#e;constructor(e=2){this.#e=U.create(()=>new Float32Array(fe),e)}clear(e,t){this.#e.forEach(n=>n.fill(0,e,t))}numChannels(){return this.#e.length}getChannel(e){return e<this.numChannels()?this.#e[e]:this.#e[this.numChannels()-1]}assertSanity(){V(!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){V(e.length===2,"mixLayout: target.length must be 2"),V(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){V(e.length===2,"mixLayout: target.length must be 2"),V(this.#e.length===1||this.#e.length===2,"mixLayout: target.length must be 1 or 2");let[t,n]=e;if(this.#e.length===1){let[i]=this.#e;for(let o=0;o<fe;o++)t[o]+=i[o],n[o]+=i[o]}else{let[i,o]=this.#e;for(let a=0;a<fe;a++)t[a]+=i[a],n[a]+=o[a]}}};var kt;(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"})(kt||(kt={}));var zc=class{#e;#t=kt.Idle;#r=0;#i=0;#n=0;#o=0;#a=0;#s=0;#l=0;#c=0;#u=0;constructor(e){this.#e=1/e}get gate(){return this.#t!==kt.Idle&&this.#t!==kt.Release}get complete(){return this.#t===kt.Idle}get value(){return this.#r}get phase(){return this.#i}set(e,t,n,i){this.#n=e,this.#o=t,this.#a=n,this.#s=i,this.#p()}#p(){switch(this.#t){case kt.Attack:{let e=1-this.#r;this.#l=e*this.#e/Math.max(this.#n,1e-6);break}case kt.Decay:{let e=this.#r-this.#a;this.#c=e*this.#e/Math.max(this.#o,1e-6);break}case kt.Release:{let e=this.#r;this.#u=e*this.#e/Math.max(this.#s,1e-6);break}case kt.Sustain:case kt.Idle:{this.#l=this.#e/Math.max(this.#n,1e-6),this.#c=(1-this.#a)*this.#e/Math.max(this.#o,1e-6),this.#u=this.#a*this.#e/Math.max(this.#s,1e-6);break}}}gateOn(){this.#t=kt.Attack}gateOff(){this.#t!==kt.Idle&&(this.#t=kt.Release,this.#p())}forceStop(){this.#t=kt.Idle,this.#r=0}process(e,t,n){for(let i=t;i<n;)switch(this.#t){case kt.Attack:for(;i<n;){if(this.#r+=this.#l,this.#r>=1){this.#r=1,this.#i=1,e[i++]=this.#r,this.#t=kt.Decay,this.#p();break}e[i++]=this.#i=this.#r}break;case kt.Decay:for(;i<n;){if(this.#r-=this.#c,this.#r<=this.#a){this.#r=this.#a,this.#i=2,e[i++]=this.#r,this.#t=kt.Sustain,this.#p();break}this.#i=1+(1-this.#r)/(1-this.#a),e[i++]=this.#r}break;case kt.Sustain:e.fill(this.#a,i,n);return;case kt.Release:for(;i<n;){if(this.#r-=this.#u,this.#r<=0){this.#r=0,this.#i=0,e[i++]=this.#r,this.#t=kt.Idle,this.#p();break}this.#i=3+(1-this.#r/this.#a),e[i++]=this.#r}break;case kt.Idle:e.fill(0,i,n);return}}};var gg;(function(r){let e=new fg;r.count=()=>e.count(),r.create=(t,n,i)=>{let o=n*Float32Array.BYTES_PER_ELEMENT,a=o*i,s=new SharedArrayBuffer(a),l=U.create(u=>new Float32Array(s,u*o,n),i);return e.add(s),{sampleRate:t,numberOfFrames:n,numberOfChannels:i,frames:l}}})(gg||(gg={}));var vo=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=be(e,0,1),e>=.5)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=(1-o)/2,s=a,l=2*a,u=a,p=1+i,d=-2*o,h=1-i;this.setNormalizedCoefficients(s,l,u,p,d,h)}else this.setNormalizedCoefficients(0,0,0,1,0,0);return this}setHighpassParams(e,t=Math.SQRT1_2){if(e=be(e,0,1),e===1)this.setNormalizedCoefficients(0,0,0,1,0,0);else if(e>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=(1+o)/2,s=a,l=-2*a,u=a,p=1+i,d=-2*o,h=1-i;this.setNormalizedCoefficients(s,l,u,p,d,h)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setNormalizedCoefficients(e,t,n,i,o,a){let s=1/i;return this.b0=e*s,this.b1=t*s,this.b2=n*s,this.a1=o*s,this.a2=a*s,this}setLowShelfParams(e,t){e=be(e,0,1);let n=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(n*n,0,0,1,0,0);else if(e>0){let i=Nn*e,a=.5*Math.sin(i)*Math.sqrt((n+1/n)*(1/1-1)+2),s=Math.cos(i),l=2*Math.sqrt(n)*a,u=n+1,p=n-1,d=n*(u-p*s+l),h=2*n*(p-u*s),g=n*(u-p*s-l),v=u+p*s+l,y=-2*(p+u*s),x=u+p*s-l;this.setNormalizedCoefficients(d,h,g,v,y,x)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setHighShelfParams(e,t){e=be(e,0,1);let n=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let i=Nn*e,a=.5*Math.sin(i)*Math.sqrt((n+1/n)*(1/1-1)+2),s=Math.cos(i),l=2*Math.sqrt(n)*a,u=n+1,p=n-1,d=n*(u+p*s+l),h=-2*n*(p+u*s),g=n*(u+p*s-l),v=u-p*s+l,y=2*(p-u*s),x=u-p*s-l;this.setNormalizedCoefficients(d,h,g,v,y,x)}else this.setNormalizedCoefficients(n*n,0,0,1,0,0);return this}setPeakingParams(e,t,n){e=be(e,0,1),t=Math.max(0,t);let i=Math.pow(10,n/40);if(e>0&&e<1)if(t>0){let o=Nn*e,a=Math.sin(o)/(2*t),s=Math.cos(o),l=1+a*i,u=-2*s,p=1-a*i,d=1+a/i,h=-2*s,g=1-a/i;this.setNormalizedCoefficients(l,u,p,d,h,g)}else this.setNormalizedCoefficients(i*i,0,0,1,0,0);else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setAllpassParams(e,t){if(e=be(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=1-i,s=-2*o,l=1+i,u=1+i,p=-2*o,d=1-i;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=be(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=1,s=-2*o,l=1,u=1+i,p=-2*o,d=1-i;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 n=Nn*e;if(t>0){let i=Math.sin(n)/(2*t),o=Math.cos(n),a=i,s=0,l=-i,u=1+i,p=-2*o,d=1-i;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,n){V(e.length===t.length&&e.length===n.length,"Array lengths do not match");let i=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),h=Math.sin(p),g=i+((o+a*d)*d-a*h*h),v=(o+a*d)*h+a*h*d,y=1+((s+l*d)*d-l*h*h),x=(s+l*d)*h+l*h*d,B=y*y+x*x,I=(g*y+v*x)/B,O=(v*y-g*x)/B;t[u]=Math.sqrt(I*I+O*O),n[u]=Math.atan2(O,I)}}};var Jt=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:n,b1:i,b2:o},a,s,l,u){let p=this.#e,d=this.#t,h=this.#r,g=this.#i;for(let v=l;v<u;v++){let y=a[v],x=s[v]=n*y+i*p+o*d-e*h-t*g+1e-18-1e-18;d=p,p=y,g=h,h=x}this.#e=p,this.#t=d,this.#r=h,this.#i=g}processFrame({a1:e,a2:t,b0:n,b1:i,b2:o},a){let s=n*a+i*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}},Ta=class{#e;#t;constructor(e){this.#e=U.create(()=>new Jt,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,n,i,o){for(let a=0;a<this.#t;a++)this.#e[a].process(e,t,n,i,o),t=n}processFrame(e,t){for(let n=0;n<this.#t;n++)t=this.#e[n].processFrame(e,t);return t}},Lp=512,vg=class{#e;#t=new vo;#r;#i=-1;constructor(e,t,n){this.#r=new Ta(4),this.#e=new Float32Array(Lp+1);let i=Math.log(t/e),o=1/n;for(let a=0;a<=Lp;a++)this.#e[a]=e*Math.exp(a/Lp*i)*o}get order(){return this.#r.order}set order(e){this.#r.order=e}reset(){this.#r.reset()}process(e,t,n,i,o,a){let s=this.#e,l=this.#r,u=this.#t,p=i/l.order**1.25,d=o,h=this.#i;for(;d<a;){let g=Math.floor(qi(n[d])*Lp),v=d+1;for(;v<a&&Math.floor(qi(n[v])*Lp)===g;)++v;g!==h&&(h=g,u.setLowpassParams(s[g],p)),l.process(u,e,t,d,v),d=v}this.#i=h}};var nB=Math.log(10)/20,Kp=(r=60,e=440)=>e*Math.pow(2,(r+3)/12-6);var Pe=r=>Math.exp(r*nB),yo=r=>Math.log(r)/nB,Uc=r=>Pe(20*Math.log10(r));var _k=.02,oB=1e3,yg=class{#e;#t;#r;#i;#n;#o;#a=NaN;#s=NaN;#l=0;#c=0;#u=0;#p=8;#d=0;#f=1;#h=!1;constructor(e){this.#e=e,this.#t=Math.ceil(e*_k)|0,this.#r=new vo,this.#r.setLowpassParams(.5),this.#i=[new Jt,new Jt],this.#n=[new Float32Array(fe),new Float32Array(fe)],this.#o=new Float32Array(2)}process(e,t,n,i){let[o,a]=e,[s,l]=t,[u,p]=this.#n;this.#i[0].process(this.#r,o,u,n,i),this.#i[1].process(this.#r,a,p,n,i);let d=Pe(this.#d),h=Pe(-this.#d/2),g=this.#e/this.#a,v=Math.pow(2,this.#p)-1,y=1/v;for(let x=n;x<i;x++)this.#c>0&&(this.#a+=this.#l,--this.#c===0&&(this.#l=0,this.#a=this.#s),this.#r.setLowpassParams(Math.max(this.#a,oB)/this.#e)),this.#u+=1,this.#u>=g&&(this.#u-=g,this.#o[0]=be(Math.round(u[x]*d*v)*y,-1,1),this.#o[1]=be(Math.round(p[x]*d*v)*y,-1,1)),s[x]=(o[x]*(1-this.#f)+this.#o[0]*this.#f)*h,l[x]=(a[x]*(1-this.#f)+this.#o[1]*this.#f)*h;this.#h=!0}setCrush(e){let t=JF(20,this.#e*.5,e);this.#h&&isFinite(this.#a)?(this.#s=t,this.#l=(t-this.#a)/this.#t,this.#c=this.#t):(this.#a=t,this.#r.setLowpassParams(Math.max(this.#a,oB)/this.#e))}setBitDepth(e){this.#p=be(e,1,16)}setBoost(e){this.#d=e}setMix(e){this.#f=qi(e)}reset(){this.#h=!1,this.#s=NaN,this.#l=0,this.#c=0,this.#u=0,this.#o.fill(0),this.#i[0].reset(),this.#i[1].reset()}};var Wp=class{#e;#t;#r;#i;#n=0;#o=0;#a=0;#s=0;#l=0;#c=!1;#u=!1;constructor(e,t){let n=mo(e);this.#e=n,this.#t=n-1,this.#r=new Float32Array(n),this.#i=t}clear(){this.#n=0,this.#c&&(this.#r.fill(0),this.#c=!1),this.#p()}set offset(e){if(e<0||e>=this.#e)throw new Error(`MonoDelay offset ${e} out of bounds [0, ${this.#e})`);this.#a=e,this.#c?this.#d():this.#p()}get offset(){return this.#a}process(e,t,n,i){this.#u?this.#h(e,t,n,i):this.#f(e,t,n,i),this.#c=!0}#p(){this.#o=this.#a,this.#l=0,this.#u=!1}#d(){this.#a!==this.#o&&(this.#l=this.#i,this.#s=(this.#a-this.#o)/this.#l,this.#u=!0)}#f(e,t,n,i){let o=this.#r,a=this.#t,s=this.#n,l=s-Math.floor(this.#o);l<0&&(l+=this.#e);for(let u=n;u<i;++u)o[s]=t[u],e[u]=o[l],l=l+1&a,s=s+1&a;this.#n=s}#h(e,t,n,i){let o=this.#r,a=this.#t,s=this.#n;for(let l=n;l<i;++l){this.#l>0?(this.#o+=this.#s,this.#l--):(this.#o=this.#a,this.#u=!1),o[s]=t[l];let u=s-this.#o;u<0&&(u+=this.#e);let p=Math.floor(u),d=u-p,h=o[p];e[l]=h+d*(o[p+1&a]-h),s=s+1&a}this.#n=s}};var xg=class r{static#e=10;#t=1;#r=0;#i=0;#n=0;#o=0;#a=0;set(e,t,n){this.#t=e,this.#r=t*r.#e,this.#i=lg(1e-5,1-1e-5,n),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),n,i,o,a;return this.#r<0?(n=1-t,i=1-this.#i,o=this.#a,a=this.#o):(n=t,i=this.#i,o=this.#o,a=this.#a),n<=i?1-(1-n*o)**this.#n*this.#t:((1-n)*a)**this.#n*this.#t-this.#t+1}};var Zp;(function(r){r.Comparator=(e,t)=>e.position-t.position,r.PositionExtractor=e=>e.position})(Zp||(Zp={}));var Js;(function(r){r.complete=e=>e.position+e.duration,r.DescendingComparator=(e,t)=>r.complete(t)-r.complete(e)})(Js||(Js={}));var kr;(function(r){r.globalToLocal=(t,n)=>qs(n-t.position+t.loopOffset,t.loopDuration),r.locateLoop=({position:t,complete:n,loopOffset:i,loopDuration:o},a,s)=>{let l=t-i,u=l+o;if(l>=s||u<=a)return m.None;let p=Math.max(l,a),d=Math.min(u,s);return m.wrap({index:0,rawStart:l,rawEnd:u,regionStart:Math.max(l,t),regionEnd:Math.min(u,n),resultStart:p,resultEnd:d,resultStartValue:l<p?(p-l)/o:0,resultEndValue:u>d?(d-l)/o:1})};function*e({position:t,complete:n,loopOffset:i,loopDuration:o},a,s){let l=t-i,u=Math.max(t,a),p=Math.min(n,s),d=Math.floor((u-l)/o),h=l+d*o;for(;h<p;){let g=h+o,v=Math.max(h,t),y=Math.min(g,n),x=Math.max(h,u),B=Math.min(g,p),I=h<x?(x-h)/o:0,O=g>B?(B-h)/o:1;yield{index:d++,rawStart:h,rawEnd:g,regionStart:v,regionEnd:y,resultStart:x,resultEnd:B,resultStartValue:I,resultEndValue:O},h=g}}r.locateLoops=e})(kr||(kr={}));var ai=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 wg(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()?ia.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t,n){return this.#e.isEmpty()?ia.empty():this.#e.iterate(this.#e.ceilFirstIndex(e),t,n)}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()}},Ra=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 wg(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()?ia.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t){if(this.#e.isEmpty())return ia.empty();let n=Math.max(0,this.#e.floorLastIndex(e)),i=this.#e.optAt(n);if(i===null)return ia.empty();for(;i.position+i.duration<=e;)if(i=this.#e.optAt(++n),i===null||i.position>=t)return ia.empty();return this.#e.iterate(n,t)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}},Qs=class{#e;constructor(){this.#e=[]}addAndRetain(e){if(this.#e.length===0)this.#e.push(e);else{let t=ct.leftMost(this.#e,e,Js.DescendingComparator);this.#e.splice(t,0,e)}}*overlapping(e,t){let n=this.#e.filter(i=>i.position<=e&&e<i.position+i.duration);yield*q(t)?n.sort(t):n}*releaseLinearCompleted(e){if(this.#e.length!==0)for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t];if(Js.complete(n)<e)this.#e.splice(t,1),yield n;else return}}*release(e){if(this.#e.length!==0)for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t];e(n)&&(this.#e.splice(t,1),yield n)}}*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(){U.clear(this.#e)}},wg=class{comparator;#e=[];#t=!1;modCount=0;constructor(e){this.comparator=e}add(e){if(this.#e.includes(e))throw new Error(`Duplicate event added: ${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 n=e.position,i=ct.leftMostMapped(this.#e,n,$a,Zp.PositionExtractor);for(let o=i;o<this.#e.length;o++){let a=this.#e[o];if(a===e)return!0;if(a.position!==n)return!1}return!1}clear(){++this.modCount,U.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 n=this.floorLastIndex(e);for(;n>=0;){let i=this.#e[n--];if(t(i))return i}return null}greaterEqual(e,t){if(t===void 0)return this.optAt(this.ceilFirstIndex(e));let n=this.ceilFirstIndex(e);for(;n<this.#e.length;){let i=this.#e[n++];if(t(i))return i}return null}floorLastIndex(e){return this.#t&&this.#r(),ct.rightMostMapped(this.#e,e,$a,Zp.PositionExtractor)}ceilFirstIndex(e){return this.#t&&this.#r(),ct.leftMostMapped(this.#e,e,$a,Zp.PositionExtractor)}iterateFrom(e,t){let n=this.floorLastIndex(e),i=n;if(i<0)return this.iterate(0,yr.MAX_VALUE,t);for(;i>=0;){let o=this.optAt(i);if(o!==null&&t!==void 0&&t(o))return this.iterate(i,yr.MAX_VALUE,t);i--}return this.iterate(n,yr.MAX_VALUE,t)}length(){return this.#e.length}isEmpty(){return this.#e.length===0}onIndexingChanged(){this.#t=this.length()>1}*iterate(e,t,n=Tc.alwaysTrue){for(this.#t&&this.#r();e<this.#e.length;){let i=this.#e[e++];if(i.position>=t)return;n(i)&&(yield i)}}#r(){this.#e.sort(this.comparator),this.#t=!1}};var Ca;(function(r){r.hasFading=e=>e.in>0||e.out>0,r.gainAt=(e,t,n)=>{let{in:i,out:o,inSlope:a,outSlope:s}=n,l=1,u=1;i>0&&e<i&&(l=vr.normalizedAt(e/i,a));let p=t-o;if(o>0&&e>p){let d=(e-p)/o;u=1-vr.normalizedAt(d,s)}return Math.min(l,u)},r.fillGainBuffer=(e,t,n,i,o,a)=>{let{in:s,out:l,inSlope:u,outSlope:p}=a;if(e.fill(1,0,o),s<=0&&l<=0)return;let d=i-l;if(t>=s&&n<=d)return;let h=(n-t)/o;if(s>0&&t<s){let g=Math.min(n,s),v=Math.min(o,Math.ceil((g-t)/h));if(v>0){let y=t/s,x=g/s,B=vr.walk(u,v,y,x);for(let I=0;I<v;I++)e[I]=B.next().value}}if(l>0&&n>d){let g=Math.max(t,d),v=Math.max(0,Math.floor((g-t)/h)),y=o-v;if(y>0){let x=(g-d)/l,B=(n-d)/l,I=vr.walk(p,y,1-x,1-B);for(let O=v;O<o;O++)e[O]=Math.min(e[O],I.next().value)}}}})(Ca||(Ca={}));var ig=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 n=0;n<t;n++){let i=2*Math.PI*n/e;this.#r[n]=Math.cos(i),this.#i[n]=Math.sin(i)}}process(e,t){let n,i,o,a;for(let u=0;u<this.#e;++u)i=r.reverse(u)>>>this.#t,i>u&&(a=e[u],e[u]=e[i],e[i]=a,a=t[u],t[u]=t[i],t[i]=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(n=0;n<this.#e;n+=u){let h=n+p;for(i=n,o=0;i<h;i++,o=o+d|0){let g=i+p|0,v=s[o],y=l[o],x=e[g],B=t[g],I=x*v+B*y,O=B*v-x*y,z=e[i],$=t[i];e[g]=z-I,t[g]=$-O,e[i]=z+I,t[i]=$+O}}if(u===this.#e)break}}inverse(e,t){let n=this.#e;for(let o=0;o<n;o++)t[o]=-t[o];this.process(e,t);let i=1/n;for(let o=0;o<n;o++)e[o]*=i,t[o]=-t[o]*i}};var rA=r=>{let e=.25*r+.25;return 4*(Math.abs(e-Math.round(e))-.25)};var wr;(function(r){r.builder=()=>new e,r.toDouble=([t,n])=>t/n,r.toPPQN=([t,n])=>J.fromSignature(t,n);class e{#e=[];add(n){return this.#e.push(n),this}asArray(){return this.#e}asAscendingArray(){return this.#e.toSorted((n,i)=>r.toDouble(n)-r.toDouble(i))}asDescendingArray(){return this.#e.toSorted((n,i)=>r.toDouble(i)-r.toDouble(n))}}})(wr||(wr={}));var Oa=class{static*iterate(e,t,n){let i=Math.ceil(e/n),o=i*n;for(;o<t;)yield o,o=++i*n}static*iterateWithIndex(e,t,n){let i=Math.ceil(e/n),o=i*n;for(;o<t;)yield{position:o,index:i},o=++i*n}};var jc=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,n,i){if(isNaN(this.#r)){for(let o=n;o<i;o++)e[o]*=this.#e;this.#t=this.#e}else{let o=J.samplesToPulses(1,t,sampleRate);for(let a=n;a<i;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<i;s++)e[s]*=this.#e;break}e[a]*=this.#t=this.#e+(this.#r-this.#e)*this.#i}}}advance(e,t,n){if(isNaN(this.#r))this.#t=this.#e;else{let i=J.samplesToPulses(n-t,e,sampleRate);this.#i+=i/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 bg=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}addVertex(e){V(!this.#e.includes(e),"Vertex already exists"),this.#e.push(e),V(!this.#t.has(e),"Predecessor already exists"),this.#t.set(e,[])}removeVertex(e){U.remove(this.#e,e);let t=this.#t.delete(e);V(t,"Predecessor does not exists")}getPredecessors(e){return this.#t.get(e)??U.empty()}predecessors(){return this.#t}vertices(){return this.#e}addEdge([e,t]){he(this.#t.get(t),`[add] Edge has unannounced vertex. (${t})`).push(e)}removeEdge([e,t]){let n=he(this.#t.get(t),`[remove] Edge has unannounced vertex. (${t})`);V(n.includes(e),`${e} is not marked.`),U.remove(n,e)}isEmpty(){return this.#e.length===0}},Ag=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.#s();let e=new Map;for(let n of this.#e.vertices())this.#n.set(n,new Set),e.set(n,new Set);for(let n of this.#e.vertices())for(let i of this.#e.getPredecessors(n))he(this.#n.get(i),`Could not find Successor for ${i}`).add(n);let t;do{t=!1;for(let n of this.#e.vertices()){he(e.get(n)).clear();for(let i of he(this.#n.get(n)))for(let o of he(this.#n.get(i)))this.#n.get(n)?.has(o)||(t=!0,he(e.get(n)).add(o))}for(let n of this.#e.vertices()){let i=he(this.#n.get(n));he(e.get(n)).forEach(o=>i.add(o))}}while(t)}#a(e){if(!this.#r.has(e)){this.#r.add(e);for(let t of this.#e.getPredecessors(e)){if(he(this.#n.get(e)).has(t)){this.#i.add(e),this.#i.add(t);continue}this.#a(t)}this.#t.push(e)}}#s(){U.clear(this.#t),this.#r.clear(),this.#i.clear(),this.#n.clear()}};var Gp;(function(r){r.Identity={warp:e=>e,unwarp:e=>e}})(Gp||(Gp={}));var _g=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 n=this.#e.duration(),i=ta(t,n),o=(t-i)/n,a=e?this.#e.fx(o):this.#e.fy(o);return i+a*n}};var ut;(function(r){r[r.sine=0]="sine",r[r.triangle=1]="triangle",r[r.saw=2]="saw",r[r.square=3]="square"})(ut||(ut={}));var Pg=class{sampleRate;#e=0;constructor(e){this.sampleRate=e}fill(e,t,n,i,o){let a=n/this.sampleRate;switch(t){case ut.sine:{for(let s=i;s<o;s++)e[s]=Math.sin(this.#e*Math.PI*2),this.#e+=a,this.#e>=1&&(this.#e-=1);break}case ut.triangle:{for(let s=i;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 ut.saw:{for(let s=i;s<o;s++){let l=this.#e%1;e[s]=2*l-1,this.#e+=a,this.#e>=1&&(this.#e-=1)}break}case ut.square:{for(let s=i;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 xo;(function(r){r[r.Linear=0]="Linear",r[r.EqualPower=1]="EqualPower"})(xo||(xo={}));var Sg;(function(r){r.BlackKeyIndices=[1,3,6,8,10],r.BlackKeyBits=r.BlackKeyIndices.reduce((t,n)=>t|=1<<n,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,n)=>qi((t-60)*n);class e{#e;#t;constructor(n,...i){this.#e=n,this.#t=i.reduce((o,a)=>o|=1<<a,0)}get name(){return this.#e}get bits(){return this.#t}has(n){return(this.#t&1<<n%12)!==0}equals(n){return this.#t===n.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)]})(Sg||(Sg={}));var $r;(function(r){r.isOfType=e=>e.type==="note-event",r.Comparator=(e,t)=>{let n=e.position-t.position;if(n!==0)return n;let i=e.pitch-t.pitch;return i!==0?i: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 n=Js.complete(e)-Js.complete(t);return n!==0?n:e.pitch-t.pitch}})($r||($r={}));var qp=class{#e;#t=0;#r=0;constructor(e){this.#e=1/e}generate(e,t,n,i,o){let a=t*this.#e;switch(n){case ut.sine:this.#i(e,a,i,o);break;case ut.saw:this.#n(e,a,i,o);break;case ut.square:this.#o(e,a,i,o);break;case ut.triangle:this.#a(e,a,i,o);break}}generateFromFrequencies(e,t,n,i,o){switch(n){case ut.sine:this.#s(e,t,i,o);break;case ut.saw:this.#l(e,t,i,o);break;case ut.square:this.#c(e,t,i,o);break;case ut.triangle:this.#u(e,t,i,o);break}}#i(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++)e[a]=Math.sin(2*Math.PI*(o%1)),o+=t;this.#t=o}#n(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++){let s=o%1;e[a]=2*s-1-wo(s,t),o+=t}this.#t=o}#o(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++){let s=o%1;e[a]=(s<.5?1:-1)+wo(s,t)-wo((s+.5)%1,t),o+=t}this.#t=o}#a(e,t,n,i){let o=this.#t,a=this.#r,s=4*t;for(let l=n;l<i;l++){let u=o%1,p=(u<.5?1:-1)+wo(u,t)-wo((u+.5)%1,t);a=a*.9995+p*s,e[l]=a,o+=t}this.#t=o,this.#r=a}#s(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++)e[s]=Math.sin(2*Math.PI*(a%1)),a+=t[s]*o;this.#t=a}#l(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++){let l=t[s]*o,u=a%1;e[s]=2*u-1-wo(u,l),a+=l}this.#t=a}#c(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++){let l=t[s]*o,u=a%1;e[s]=(u<.5?1:-1)+wo(u,l)-wo((u+.5)%1,l),a+=l}this.#t=a}#u(e,t,n,i){let o=this.#e,a=this.#t,s=this.#r;for(let l=n;l<i;l++){let u=t[l]*o,p=a%1,d=(p<.5?1:-1)+wo(p,u)-wo((p+.5)%1,u);s=s*.9995+d*(4*u),e[l]=s,a+=u}this.#t=a,this.#r=s}},wo=(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 oa;(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:n,invertL:i,invertR:o,stereo:a,swap:s},l=xo.EqualPower)=>{let[u,p]=r.panningToGains(n,l),d=u*t,h=p*t;i&&(d*=-1),o&&(h*=-1);let g=Math.max(0,-a),v=Math.max(0,a),y=1-v,x=1+v,B=g*.5,I=1-g,O=(y+x)*.5,z=(y-x)*.5,$=(y-x)*.5,ie=(y+x)*.5,ne=d*(B+I)*O+h*B*z,le=d*(B+I)*$+h*B*ie,W=d*B*O+h*(B+I)*z,xe=d*B*$+h*(B+I)*ie;s?(e.ll=le,e.rl=ne,e.lr=xe,e.rr=W):(e.ll=ne,e.lr=W,e.rl=le,e.rr=xe)},r.panningToGains=(e,t)=>{let n=be(e,-1,1);switch(t){case xo.Linear:return[Math.min(1-n,1),Math.min(n+1,1)];case xo.EqualPower:return[Math.cos((n+1)*G0),Math.sin((n+1)*G0)]}},r.applyFrame=(e,t,n)=>[e.ll*t+e.rl*n,e.lr*t+e.rr*n],r.processFrames=(e,t,n,i,o)=>{let[a,s]=t,[l,u]=n;for(let p=i;p<o;p++){let d=a[p],h=s[p];l[p]=e.ll*d+e.rl*h,u[p]=e.lr*d+e.rr*h}},r.replaceFrames=(e,[t,n],i,o)=>{for(let a=i;a<o;a++){let s=t[a],l=n[a];t[a]=e.ll*s+e.rl*l,n[a]=e.lr*s+e.rr*l}}})(oa||(oa={}));var fr;(function(r){r.linear=(n,i=.005)=>new e(Math.ceil(n*i)|0),r.stereoMatrix=(n,i=.005)=>new t(Math.ceil(n*i)|0);class e{#e;#t=0;#r=0;#i=0;#n=0;constructor(i){this.#e=i}set(i,o){this.#t!==i&&(o===!0?(this.#r=i,this.#i=(i-this.#t)/this.#e,this.#n=this.#e):(this.#t=this.#r=i,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(i){return this.#t===i&&this.#n===0}isInterpolating(){return this.#n>0}}class t{#e;#t=oa.zero();#r=oa.zero();#i=oa.zero();#n=0;constructor(i){this.#e=i}update(i,o,a){oa.update(this.#r,i,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(i,o,a,s){let[l,u]=i,[p,d]=o;if(this.isInterpolating())for(let h=a;h<s;h++){let g=l[h],v=u[h],y=this.moveAndGet();p[h]=y.ll*g+y.rl*v,d[h]=y.lr*g+y.rr*v}else{let h=this.#r;for(let g=a;g<s;g++){let v=l[g],y=u[g];p[g]=h.ll*v+h.rl*y,d[g]=h.lr*v+h.rr*y}}}set(i,o){this.#o(i)||(o===!0?(this.#r.ll=i.ll,this.#r.lr=i.lr,this.#r.rl=i.rl,this.#r.rr=i.rr,this.#i.ll=(i.ll-this.#t.ll)/this.#e,this.#i.lr=(i.lr-this.#t.lr)/this.#e,this.#i.rl=(i.rl-this.#t.rl)/this.#e,this.#i.rr=(i.rr-this.#t.rr)/this.#e,this.#n=this.#e):(this.#t.ll=this.#r.ll=i.ll,this.#t.lr=this.#r.lr=i.lr,this.#t.rl=this.#r.rl=i.rl,this.#t.rr=this.#r.rr=i.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(i){return this.#o(i)&&this.#n===0}isInterpolating(){return this.#n>0}#o(i){return this.#t.ll===i.ll&&this.#t.lr===i.lr&&this.#t.rl===i.rl&&this.#t.rr===i.rr}}r.StereoMatrixRamp=t})(fr||(fr={}));var Hp=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]),iA=new Float32Array(12),aB=new Float32Array(11);for(let r=0,e=0,t=0;r<Hp.length;r++)r%2===0?iA[e++]=Hp[r]:aB[t++]=Hp[r];var nA=class{#e=new Float32Array(iA.length);#t=new Float32Array(Hp.length);#r=0;#i=0;reset(){this.#e.fill(0),this.#t.fill(0),this.#r=0,this.#i=0}upsample(e,t,n,i){let o=this.#e,a=iA,s=aB;for(let l=n;l<i;l++){let u=e[l],p=(l-n)*2;o[this.#r]=u;let d=0;for(let g=0;g<a.length;g++){let v=(this.#r-g+o.length)%o.length;d+=o[v]*a[g]}t[p]=d*2;let h=0;for(let g=0;g<s.length;g++){let v=(this.#r-g+o.length-1)%o.length;h+=o[v]*s[g]}t[p+1]=h*2,this.#r=(this.#r+1)%o.length}}downsample(e,t,n,i){let o=this.#t,a=Hp;for(let s=n;s<i;s++){let l=(s-n)*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}}},Eg=class{#e;#t;#r;constructor(e){this.#e=e;let t=e===2?1:e===4?2:3;this.#t=U.create(()=>new nA,t),this.#r=U.create(n=>new Float32Array(fe*(2<<n)),t-1)}reset(){this.#t.forEach(e=>e.reset())}upsample(e,t,n,i){let o=i-n,a=e,s=n,l=i;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,n,i){let o=i-n,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?n:0,h=u?i:s/2;this.#t[l].downsample(a,p,d,h),a=p,s=h}}},Fg=class{#e;#t;constructor(e){this.#e=new Eg(e),this.#t=new Eg(e)}reset(){this.#e.reset(),this.#t.reset()}upsample(e,t,n,i){this.#e.upsample(e[0],t[0],n,i),this.#t.upsample(e[1],t[1],n,i)}downsample(e,t,n,i){this.#e.downsample(e[0],t[0],n,i),this.#t.downsample(e[1],t[1],n,i)}};var Lc=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,n){let i=this.#e,o=i.length,a=this.#r,s=this.#i;for(let l=t;l<n;l++){let u=e[l]*e[l];s+=u-i[a],i[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 Bg=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,n){let i=this.#r,o=this.#i,[a,s]=e.channels(),l=this.#n;for(let u=t;u<n;++u){let p=a[u],d=s[u],h=Math.max(Math.abs(p),Math.abs(d));if(l=h>l?i*(l-h)+h:o*(l-h)+h,l>1){let g=1/l;a[u]=p*g,s[u]=d*g}}this.#n=l}};var Pi=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 Wr;(function(r){r.Musical="musical",r.Seconds="seconds"})(Wr||(Wr={}));var Ys;(function(r){function e(t,n,i){return new oA(t,n,i)}r.aware=e})(Ys||(Ys={}));var oA=class{#e;#t;#r;constructor(e,t,n){this.#r=n,this.#t=t,this.#e=e}toPPQN(e){let t=this.#r.getValue();if(this.getTimeBase()===Wr.Musical)return t;let n=this.#e.ppqnToSeconds(e),i=n+t;return this.#e.intervalToPPQN(n,i)}fromPPQN(e,t){if(this.getTimeBase()===Wr.Musical)this.#r.setValue(e);else{let n=this.#e.intervalToSeconds(t,t+e);this.#r.setValue(n)}}toSeconds(e){let t=this.#r.getValue();return this.getTimeBase()===Wr.Seconds?t:this.#e.intervalToSeconds(e,e+t)}toSamples(e,t){return this.toSeconds(e)*t}rawValue(){return this.#r.getValue()}getTimeBase(){return Gi(this.#t.getValue(),Wr)}};var Ng=J.fromSignature(1,384);var si={None:{type:"none"},Linear:{type:"linear"},Curve:r=>r===.5?si.Linear:{type:"curve",slope:r}},Ig;(function(r){r.Comparator=(i,o)=>{let a=i.position-o.position;if(a!==0)return a;let s=i.index-o.index;return s!==0?s:i===o?0:D(`${i} and ${o} are identical in terms of comparison`)};function*e(i,o,a){if(i.isEmpty())return ht.empty();for(let s of i.iterateFrom(o))if(yield s,s.position>=a)return}r.iterateWindow=e,r.nextEvent=(i,o)=>{let a=i.asArray(),s=ct.rightMost(a,o,r.Comparator);return s===-1?null:a[s+1]??null},r.valueAt=(i,o,a)=>{if(i.isEmpty())return a;let s=i.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 n(u,d,o);if(u.interpolation===si.None)return u.value}return u.value};function*t(i,o,a,s){if(i.isEmpty())return;let l=i.iterateFrom(o),{done:u,value:p}=l.next();if(u)return;let d=a/s,h=p;if(h.position>o){for(;o<h.position;)if(yield{position:o,value:h.value},o+=d,o>a)return;h.position<=a&&(yield h)}for(;o<=a;){let{done:g,value:v}=l.next();if(g)break;for(;o<v.position;){if(o>a)return;yield{position:o,value:n(h,v,o)},o+=d}v.position<a&&(h.interpolation===si.None&&(yield{position:v.position,value:h.value}),yield v),h=v}for(;o<=a;)yield{position:o,value:h.value},o+=d}r.quantise=t;let n=({value:i,position:o,interpolation:a},s,l)=>a.type==="none"?i:a.type==="linear"?i+(l-o)/(s.position-o)*(s.value-i):a.type==="curve"?vr.valueAt({slope:a.slope,steps:s.position-o,y0:i,y1:s.value},l-o):D("Unknown interpolation")})(Ig||(Ig={}));var Vp;(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,n)=>{let i=new Float32Array(n),o=Math.PI/(n-1);switch(t){case e.Bartlett:{let a=(n>>1)-1,s=0;for(;s<=a;++s)i[s]=2*s/(n-1);for(;s<n;++s)i[s]=2-2*s/(n-1);return i}case e.Blackman:{let a=2*o,s=4*o;for(let l=0;l<n;++l)i[l]=.42323-.49755*Math.cos(a*l)+.07922*Math.cos(s*l);return i}case e.BlackmanHarris:{let a=2*o,s=4*o,l=6*o;for(let u=0;u<n;++u)i[u]=.35875-.48829*Math.cos(a*u)+.14128*Math.cos(s*u)-.01168*Math.cos(l*u);return i}case e.Hamming:{let a=2*o;for(let s=0;s<n;++s)i[s]=.54-.46*Math.cos(a*s);return i}case e.Hanning:{let a=2*o;for(let s=0;s<n;++s)i[s]=.5-.5*Math.cos(a*s);return i}}}})(Vp||(Vp={}));var Dg=class extends AudioWorkletProcessor{#e;#t;#r;#i;#n;#o=0;constructor({processorOptions:{sab:e,numberOfChannels:t,rmsWindowInSeconds:n,valueDecay:i}}){super(),this.#e=t,this.#t=new Float32Array(t),this.#r=new Float32Array(t),this.#i=U.create(()=>new Lc(sampleRate*n),t);let o=xr.createBuilder({peak:xr.floats(t),rms:xr.floats(t)})();this.#n=Vc.writer(o,e,a=>{let s=Math.exp(-(128*this.#o)/(sampleRate*i));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 n=e[t];if(n===void 0)this.#t[t]=0,this.#r[t]=0;else{let i=this.#i[t],o=this.#t[t],a=this.#r[t];for(let s=0;s<fe;++s){let l=n[s];o=Math.max(o,Math.abs(l)),a=Math.max(a,i.pushPop(l*l))}this.#t[t]=o,this.#r[t]=a}}return this.#o++,this.#n.tryWrite(),!0}};var Me=class r{static newSet(e){return new Cc(e,r.Comparator)}static compose=(e,...t)=>{let n=t.length===0?this.#e:new Int16Array(t);return V(n.every((i,o)=>i===t[o]),`fieldKeys (${n.join(",")}) only allows i16`),new r(e,n)};static decode(e){let t=e.split("/");return V(t.length>0,"Unable to parse Address"),r.compose(b.parse(t[0]),...t.slice(1).map(n=>parseInt(n)))}static reconstruct(e){return this.compose(e[0],...e[1])}static boxRange(e,t,n){let i=e.values(),o=ct.leftMostMapped(i,t,b.Comparator,n),a=i.length;if(o<0||o>=a)return null;for(let s=o;s<a;s++)if(b.Comparator(n(i[s]),t)!==0)return o<s?[o,s]:null;return[o,a]}static Comparator=(e,t)=>{let n=b.Comparator(e.#t,t.#t);if(n!==0)return n;let i=Math.min(e.#r.length,t.#r.length);for(let o=0;o<i;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 n=b.Comparator(e.#t,t.#t);if(n!==0)return n;let i=Math.min(e.#r.length,t.#r.length);for(let o=0;o<i;o++){let a=e.#r[o]-t.#r[o];if(a!==0)return a}return 0};static LengthComparator=(e,t)=>{let n=b.Comparator(e.#t,t.#t);return n!==0?n: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 b.Comparator(e.#t,this.#t)===0&&e.#r.length<=this.#r.length&&e.#r.every((t,n)=>this.#r[n]===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(b.length+this.#r.length);return e.set(this.#t,0),e.set(this.#r,b.length),e.buffer}toString(){return[b.toString(this.#t),...this.#r].join("/")}static read(e){let t=b.fromDataInput(e),n=e.readByte();return r.compose(t,...U.create(()=>e.readShort(),n))}},Xs;(function(r){r.AddressReader=e=>e.address,r.Comparator=({address:e},{address:t})=>Me.Comparator(e,t),r.equals=(e,t)=>{let[n,i]=ct.rangeMapped(t,e,Me.Comparator,r.AddressReader);return t.slice(n,i+1)},r.startsWith=(e,t)=>{let[n,i]=ct.rangeMapped(t,e,Me.MinimalComparator,r.AddressReader);return t.slice(n,i+1).filter(o=>o.address.startsWith(e))},r.endsWith=(e,t)=>{let n=ct.leftMostMapped(t,e,Me.LengthComparator,r.AddressReader),i=ct.rightMostMapped(t,e,Me.MinimalComparator,r.AddressReader);return t.slice(n,i+1).filter(o=>e.startsWith(o.address))}})(Xs||(Xs={}));var bo=class r{static validate(e,t){if(e.address.equals(t.address))return m.wrap(`PointerField cannot point to itself: ${e}`);if(!t.pointerRules.accepts.some(n=>n===e.pointerType)){let n=t.pointerRules.accepts.join(", ");return m.wrap(`${String(e.pointerType)} does not satisfy any of the allowed types (${n}).`)}return m.None}#e;#t;constructor(e){this.#e=e,this.#t=new ar}subscribe(e,...t){return this.#r(this.#t,e,t)}catchupAndSubscribe(e,...t){let n=Me.newSet(i=>i.address);return n.addMany(this.filter(...t)),n.forEach(i=>e.onAdded(i)),this.subscribe({onAdded:i=>{n.add(i)&&e.onAdded(i)},onRemoved:i=>{n.removeByKey(i.address),e.onRemoved(i)}},...t)}filter(...e){return e.length===0?this.incoming():ht.filter(this.incoming().values(),t=>e.some(n=>n===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 D(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,n){return e.subscribe({onAdded:i=>{(n.length===0||n.some(o=>o===i.pointerType))&&t.onAdded(i)},onRemoved:i=>{(n.length===0||n.some(o=>o===i.pointerType))&&t.onRemoved(i)}})}};var aA=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Kc=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Y=class r{static hook(e){return new r(e)}#e;#t;#r;#i;#n;constructor({parent:e,fieldKey:t,fieldName:n,pointerRules:i,deprecated:o}){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=o,(i.mandatory||i.exclusive)&&this.graph.edges().watchVertex(this)}accept(e){return P(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 bo(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 U.empty()}record(){return _i.empty()}getField(e){return D()}optField(e){return m.None}read(e){}write(e){}toJSON(){}fromJSON(e){return D("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)&&(console.warn(`[Field.disconnect] Deleting ${t.box} because pointer.mandatory=${t.mandatory} or (field.mandatory=${this.pointerRules.mandatory} and lastPointer=${e.length===1})`),t.box.delete())})}toString(){return`{${this.box.constructor.name}:${this.constructor.name} (${this.fieldName}) ${this.address.toString()}`}};aA([kc,Kc("design:type",bo),Kc("design:paramtypes",[])],Y.prototype,"pointerHub",null);aA([kc,Kc("design:type",Me),Kc("design:paramtypes",[])],Y.prototype,"address",null);aA([kc,Kc("design:type",String),Kc("design:paramtypes",[])],Y.prototype,"debugPath",null);var f=Object.freeze({mandatory:!1,exclusive:!1,accepts:[]});var Mg=class r extends Y{static create(e,t,n){return new r(e,t,n)}#e;constructor(e,t,n){super(e),this.#e=U.create(i=>t({parent:this,fieldKey:i,fieldName:String(i),pointerRules:f,deprecated:e.deprecated}),n)}accept(e){return P(e.visitArrayField,this)}fields(){return this.#e}record(){return U.toRecord(this.#e,e=>String(e.fieldKey))}getField(e){return he(this.#e[e])}optField(e){return m.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,n)=>this.#e[n].fromJSON(t));else return D("Type mismatch")}};var Va;(function(r){r.writeFields=(t,n)=>{let i=Object.entries(n).filter(([o,a])=>!a.deprecated);t.writeInt(1179403347),t.writeShort(i.length),i.forEach(([o,a])=>{let s=or.create();a.write(s);let l=new Int8Array(s.toArrayBuffer());t.writeShort(Number(o)),t.writeInt(l.length),t.writeBytes(l)})},r.readFields=(t,n)=>{V(t.readInt()===1179403347,"Serializer header is corrupt");let i=t.readShort();for(let o=0;o<i;o++){let a=t.readShort();if(Ic(n[a]))continue;let s=t.readInt(),l=new Int8Array(s);t.readBytes(l);let{status:u,error:p}=ho(()=>n[a]?.read(new wt(l.buffer)));u==="failure"&&console.warn(n,p)}}})(Va||(Va={}));var Pk=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},sB=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},M=class r{static DEBUG_DELETION=!1;static Index=0;#e;#t;#r;#i;#n;#o;#a;#s=r.Index++;constructor({uuid:e,graph:t,name:n,pointerRules:i,resource:o,ephemeral:a}){this.#e=Me.compose(e),this.#t=t,this.#r=n,this.#i=i,this.#n=o,this.#o=a===!0,this.#a=this.initializeFields(),(i.mandatory||i.exclusive)&&this.graph.edges().watchVertex(this)}fields(){return Object.values(this.#a)}record(){return this.#a}getField(e){return he(this.#a[e],()=>`Field ${String(e)} not found in ${this.toString()}`)}optField(e){return m.wrap(this.#a[e])}subscribe(e,t){return this.graph.subscribeVertexUpdates(e,this.address,t)}subscribeDeletion(e){return this.graph.subscribeDeletion(this.address.uuid,e)}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 resource(){return this.#n}get ephemeral(){return this.#o}get creationIndex(){return this.#s}get pointerHub(){return new bo(this)}estimateMemory(){let e=new Mc;return this.write(e),e.count}isBox(){return!0}asBox(e){return Ce(this,e)}isField(){return!1}isAttached(){return this.#t.findBox(this.address.uuid).nonEmpty()}read(e){Va.readFields(e,this.#a)}write(e){Va.writeFields(e,this.#a)}serialize(){let e=or.create();return e.writeInt(this.#s),e.writeString(this.name),e.writeBytes(new Int8Array(this.address.uuid.buffer)),this.write(e),e.toArrayBuffer()}toArrayBuffer(){let e=or.create();return this.write(e),e.toArrayBuffer()}toJSON(){return Object.entries(this.#a).reduce((e,[t,n])=>{let i=n.toJSON();return q(i)&&(e[t]=i),e},{})}fromJSON(e){if(og(e))Object.entries(e).forEach(([t,n])=>{let i=this.#a[parseInt(t)];q(n)&&i.fromJSON(n)});else return D("Type mismatch")}incomingEdges(){return this.graph.edges().incomingEdgesOf(this)}outgoingEdges(){return this.graph.edges().outgoingEdgesOf(this)}mapFields(e,...t){if(t.length===0)return U.empty();let n=this.getField(t[0]),i=[e(n)];for(let o=1;o<t.length;o++)n=n.getField(t[o]),i.push(e(n));return i}searchVertex(e){if(e.length===0)return m.wrap(this);let t=this.optField(e[0]);if(t.isEmpty())return m.None;for(let n=1;n<e.length;n++)if(t=t.unwrap().optField(e[n]),t.isEmpty())return m.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(n=>n.toString()).join(`
1
+ var vk=Object.defineProperty;var Xo=(r,e)=>{for(var t in e)vk(r,t,{get:e[t],enumerable:!0})};var ka=class r{static DEFAULT_SIZE=512;static DEFAULT_DECAY=.9;#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=0;decay=!1;constructor({size:e,decay:t}={}){e??=r.DEFAULT_SIZE,this.#l=t??r.DEFAULT_DECAY,this.#e=e<<1,this.#r=new ig(this.#e),this.#i=new Float32Array(this.#e),this.#n=new Float32Array(this.#e),this.#o=Vp.create(Vp.Type.Blackman,this.#e),this.#t=e,this.#a=new Float32Array(e),this.#s=new Float32Array(e)}clear(){this.#a.fill(0),this.#i.fill(0),this.#s.fill(0),this.#c=0}reset(){this.#c=0}numBins(){return this.#t}bins(){return this.#a}waveform(){return this.#s}process(e,t,n,i){for(let o=n;o<i;++o)this.#i[this.#c]=e[o]+t[o],++this.#c===this.#e&&this.#u()}#u(){for(let t=0;t<this.#t;++t)this.#s[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 n=this.#i[t],i=this.#n[t],o=Math.sqrt(n*n+i*i)*e;this.#a[t]<o?this.#a[t]=o:this.decay&&(this.#a[t]*=this.#l)}this.#c=0,this.#n.fill(0),this.decay=!1}};var zp=r=>r,q=r=>r!=null,uo=r=>r===null,Ct=r=>r!==null,Ic=r=>r===void 0,Zs=r=>r!==void 0,ng=r=>r==null,K0=(r,e)=>r!=null?e(r):void 0,he=(r,e="asDefined failed")=>r??D(po(e)),pt=(r,e)=>r instanceof e,Ce=(r,e)=>r instanceof e?r:D(`${r} is not instance of ${e}`),W0=(r,e)=>{r instanceof e||D(`${r} is not instance of ${e}`)};var po=r=>r instanceof Function?r():r;var P=(r,...e)=>r?.apply(null,e),og=r=>q(r)&&typeof r=="object";var ag=r=>{throw new Error(`Unhandled ${r}`)},D=r=>{throw typeof r=="string"?new Error(r):r},V=(r,e)=>r?void 0:D(po(e));var Gs=r=>new Proxy({},{get(){return D(r)}});var j0=class{value;status="success";constructor(e){this.value=e}error=Gs("Cannot access error when succeeded")},L0=class{error;status="failure";constructor(e){this.error=e}value=Gs("Cannot access value when failed")},ho=r=>{try{return new j0(r())}catch(e){return new L0(e)}};var Gi=(r,e)=>Object.keys(e).length===0?D("Empty enum object (are you using `const enum`?)"):Object.keys(e).filter(i=>isNaN(Number(i))).map(i=>e[i]).includes(r)?r:D(`Invalid enum value: ${String(r)}`),ea=()=>{};var Z0;(function(r){r[r.Ascending=1]="Ascending",r[r.Descending=-1]="Descending"})(Z0||(Z0={}));var U=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 n=0;n<e.length;)t(e[n])?e.splice(n,1):n++};static peekFirst=e=>e.at(0)??null;static peekLast=e=>e.at(-1)??null;static getFirst=(e,t)=>he(e.at(0),t);static getLast=(e,t)=>he(e.at(-1),t);static getPrev=(e,t)=>{let n=e.indexOf(t);return n===-1?D(`${t} not found in ${e}`):he(e.at((n-1)%e.length),"Internal Error")};static getNext=(e,t)=>{let n=e.indexOf(t);return n===-1?D(`${t} not found in ${e}`):he(e.at((n+1)%e.length),"Internal Error")};static removeLast=(e,t)=>he(e.pop(),t);static create=(e,t)=>{let n=new Array(t);for(let i=0;i<t;i++)n[i]=e(i);return n};static equals=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};static satisfy=(e,t)=>{if(e.length<2)return!0;let n=e[0];for(let i=1;i<e.length;i++)if(!t(n,e[i]))return!1;return!0};static remove=(e,t)=>{let n=e.indexOf(t);if(n===-1)return D(`${t} not found in ${e}`);e.splice(n,1)};static removeIf=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n])&&e.splice(n,1)};static removeOpt=(e,t)=>{let n=e.indexOf(t);return n===-1?!1:(e.splice(n,1),!0)};static hasDuplicates=e=>new Set(e).size<e.length;static removeDuplicates=e=>{let t=0,n=new Set;for(let i of e)n.has(i)||(n.add(i),e[t++]=i);return e.length=t,e};static removeDuplicateKeys=(e,t)=>{let n=0,i=new Set;for(let o of e){let a=o[t];i.has(a)||(i.add(a),e[n++]=o)}return e.length=n,e};static subtract(e,t,n){return e.filter(i=>!t.some(o=>n(i,o)))}static intersect(e,t,n){return e.filter(i=>t.some(o=>n(i,o)))}static merge(e,t,n){return[...e.filter(i=>!t.some(o=>n(i,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 n=0;n<=t;n++)yield{value:e[n],isFirst:n===0,isLast:n===t}}static*iterateAdjacent(e){if(!(e.length<=1))for(let t=1,n=e[0];t<e.length;t++){let i=e[t];yield[n,i],n=i}}static isSorted(e,t=Z0.Ascending){if(e.length<2)return!0;let n=e[0];for(let i=1;i<e.length;i++){let o=e[i];if(Math.sign(n-o)===t)return!1;n=o}return!0}static toRecord(e,t){return e.reduce((n,i)=>(n[t(i)]=i,n),{})}static concatArrayBuffers(e,t){let n=new ArrayBuffer(e.byteLength+t.byteLength),i=new Uint8Array(n);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),n}};var m;(function(r){r.wrap=t=>q(t)?new e(t):r.None,r.from=t=>r.wrap(t()),r.tryCatch=t=>{try{return r.wrap(t())}catch{return r.None}},r.execute=(t,...n)=>r.wrap(t?.apply(null,n)),r.async=t=>t.then(n=>r.wrap(n),()=>r.None);class e{#e;constructor(n){this.#e=he(n)}unwrap(){return this.#e}unwrapOrElse(n){return this.#e}unwrapOrNull(){return this.#e}unwrapOrUndefined(){return this.#e}contains(n){return n===this.#e}match(n){return n.some(this.#e)}ifSome(n){return n(this.#e)}ifAbsent(n){}isEmpty(){return!1}nonEmpty(){return!0}map(n){return r.wrap(n(this.#e))}mapOr(n,i){return n(this.#e)}flatMap(n){return n(this.#e)}equals(n){return this.unwrapOrNull()===n.unwrapOrNull()}assert(n){return this}toString(){return`{Option.Some(${this.#e})}`}get[Symbol.toStringTag](){return this.toString()}}r.Some=e,r.None=new class{unwrap=t=>D(q(t)?po(t):"unwrap failed");unwrapOrElse=t=>po(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,n)=>po(n);flatMap=t=>r.None;equals=t=>t.isEmpty();assert=t=>D(po(t)??"assert failed");toString=()=>"{Option.None}";get[Symbol.toStringTag](){return this.toString()}}})(m||(m={}));var fo;(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=()=>m.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(n){return r.err(n)}};mapOr=(t,n)=>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=()=>m.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=()=>m.None;failureReason=()=>this.reason;isFailure=()=>!0;isSuccess=()=>!1;result=()=>D(`'${this.reason}'`);map=()=>this;mapOr=(t,n)=>po(n);unwrapOrElse=t=>po(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)})(fo||(fo={}));var ct;(function(r){r.exact=(e,t,n)=>{let i=0,o=e.length-1;for(;i<=o;){let a=i+o>>>1,s=n(e[a],t);if(s===0)return a;s<0?i=a+1:o=a-1}return-1},r.exactMapped=(e,t,n,i)=>{let o=0,a=e.length-1;for(;o<=a;){let s=o+a>>>1,l=n(i(e[s]),t);if(l===0)return s;l<0?o=s+1:a=s-1}return-1},r.leftMost=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<0?i=a+1:o=a}return i},r.rightMost=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<=0?i=a+1:o=a}return o-1},r.stableInsert=(e,t,n)=>{let i=0,o=e.length;for(;i<o;){let a=i+o>>>1;n(e[a],t)<0?i=a+1:o=a}for(;i<e.length&&n(e[i],t)===0;)i++;return i},r.leftMostMapped=(e,t,n,i)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;n(i(e[s]),t)<0?o=s+1:a=s}return o},r.rightMostMapped=(e,t,n,i)=>{let o=0,a=e.length;for(;o<a;){let s=o+a>>>1;n(i(e[s]),t)<=0?o=s+1:a=s}return a-1},r.rangeMapped=(e,t,n,i)=>[r.leftMostMapped(e,t,n,i),r.rightMostMapped(e,t,n,i)]})(ct||(ct={}));var St=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,n=1<<e-(t<<5);return(this.#t[t]&n)!==0}setBit(e,t){let n=e>>>5,i=1<<e-(n<<5),o=this.#t[n],a=t?o|i:o&~i;return a===o?!1:(this.#t[n]=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),n=!1;for(let i=0;i<t.length;i++)this.#t[i]!==t[i]&&(this.#t[i]=t[i],n=!0);return n}toString(){let e="";for(let t of U.iterateReverse(this.#t))e+=t.toString(2).padStart(32,"0");return e.substring(e.length-this.#e)}clear(){this.#t.fill(0)}};var sg=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 Ht=class r{static parseCssRgbOrRgba(e){let t=e.match(/\(([^)]+)\)/)?.at(1)?.split(",")?.map(Number);if(q(t)&&t.every(n=>!isNaN(n))){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,n){let i=l=>(l+e/30)%12,o=t*Math.min(n,1-n),a=l=>n-o*Math.max(-1,Math.min(i(l)-3,Math.min(9-i(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,n=parseInt(t.slice(0,2),16)/255,i=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,a=Math.max(n,i,o),s=Math.min(n,i,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 n:u=((i-o)/d+(i<o?6:0))*60;break;case i:u=((o-n)/d+2)*60;break;case o:u=((n-i)/d+4)*60;break}}return{h:u,s:p,l}}static hslStringToHex(e){let[t,n,i]=e.match(/\d+(\.\d+)?/g).map(Number);return r.hslToHex(t,n/100,i/100)}#e;#t;#r;#i;constructor(e,t,n,i=1){this.#e=e,this.#t=t,this.#r=n,this.#i=i}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)),n=this.#r+(100-this.#r)*e**3;return new r(this.#e,t,n,this.#i)}toString(){return this.#i===1?`hsl(${this.#e}, ${this.#t}%, ${this.#r}%)`:`hsla(${this.#e}, ${this.#t}%, ${this.#r}%, ${this.#i})`}};var $a=(r,e)=>r-e;var Nn=Math.PI*2,gC=Math.PI/2,G0=Math.PI/4,vC=1/Math.sqrt(2),be=(r,e,t)=>Math.max(e,Math.min(r,t)),qi=r=>Math.max(0,Math.min(r,1)),HF=(r,e)=>e+(1-2*e)*Math.max(0,Math.min(r,1)),ta=(r,e)=>Math.floor(r/e)*e,Dc=(r,e)=>Math.ceil(r/e)*e;var lg=(r,e,t)=>r+(e-r)*t,JF=(r,e,t)=>r*Math.pow(e/r,t);var qs=(r,e)=>yk(r/e)*e,yk=r=>r-Math.floor(r),mo=r=>Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));var q0=(r,e)=>r*e/((2*e-1)*(r-1)+e);var vr;(function(r){r.valueAt=({slope:i,steps:o,y0:a,y1:s},l)=>r.normalizedAt(l/o,i)*(s-a)+a,r.normalizedAt=(i,o)=>{if(o>.499999&&o<.500001)return i;{let a=be(o,1e-15,.999999999999999);return a*a/(1-a*2)*(Math.pow((1-a)/a,2*i)-1)}},r.inverseAt=(i,o)=>{let a=be(o,1e-15,.999999999999999);return Math.log(i*(1-2*a)/(a*a)+1)/(2*Math.log((1-a)/a))},r.coefficients=i=>{let o=r.valueAt(i,1),s=(r.valueAt(i,2)-o)/(o-i.y0),l=o-s*i.y0;return{m:s,q:l}};function*t(i,o,a,s){let{m:l,q:u}=r.coefficients({slope:i,steps:o,y0:a,y1:s});for(let p=0,d=a;p<o;p++)yield d=l*d+u}r.walk=t,r.run=(i,o,a,s,l)=>{let{m:u,q:p}=r.coefficients({slope:i,steps:o,y0:a,y1:s});for(let d=0,h=a;d<o;d++)l(h=u*h+p)};function*n(i,o){let a=1/o,s=r.normalizedAt(a,i),u=(r.normalizedAt(2*a,i)-s)/s;for(let p=0,d=0;p<o;p++)yield d=u*d+s}r.walkNormalized=n,r.byHalf=(i,o,a,s)=>({slope:r.slopeByHalf(o,a,s),steps:i,y0:o,y1:s}),r.slopeByHalf=(i,o,a)=>Math.abs(a-i)<1e-6?.5:(o-i)/(a-i)})(vr||(vr={}));var go=new DataView(new ArrayBuffer(8)),yr;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647,r.toByte=e=>(go.setInt8(0,e),go.getInt8(0)),r.toShort=e=>(go.setInt16(0,e),go.getInt16(0)),r.toInt=e=>(go.setInt32(0,e),go.getInt32(0))})(yr||(yr={}));var ra;(function(r){let n=new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(n),o=new Int32Array(n);r.floatToIntBits=a=>{let s=r.floatToRawIntBits(a);return(s&2139095040)===2139095040&&s&8388607?2143289344:s},r.intBitsToFloat=a=>(o[0]=a,i[0]),r.floatToRawIntBits=a=>(i[0]=a,o[0]),r.toFloat32=a=>(go.setFloat32(0,a),go.getFloat32(0))})(ra||(ra={}));var QF;(function(r){r.floatToIntBits=e=>{let t=ra.floatToIntBits(e),n=t>>>16&32768,i=(t&2147483647)+4096;return i>=1199570944?(t&2147483647)>=1199570944?i<2139095040?n|31744:n|31744|(t&8388607)>>>13:n|31743:i>=947912704?n|i-939524096>>>13:i<855638016?n:(i=(t&2147483647)>>>23,n|(t&8388607|8388608)+(8388608>>>i-102)>>>126-i)},r.intBitsToFloat=e=>{let t=e&1023,n=e&31744;if(n===31744)n=261120;else if(n!==0){if(n+=114688,t===0&&n>115712)return ra.intBitsToFloat((e&32768)<<16|n<<13|1023)}else if(t!==0){n=115712;do t<<=1,n-=1024;while(!(t&1024));t&=1023}return ra.intBitsToFloat((e&32768)<<16|(n|t)<<13)}})(QF||(QF={}));var cg;(function(r){let e=9218868437227405312n,t=4503599627370495n,n=new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT),i=new Float64Array(n),o=new BigInt64Array(n);r.float64ToLongBits=a=>{let s=r.float64ToRawLongBits(a);return(s&e)===e&&(s&t)!==0n?0x7ff8000000000000n:s},r.longBitsToFloat64=a=>(o[0]=a,i[0]),r.float64ToRawLongBits=a=>(i[0]=a,o[0]),r.clamp=a=>(go.setFloat64(0,a),go.getFloat64(0))})(cg||(cg={}));var ht=class{static*empty(){}static one(e){return[e]}static count(e){let t=0;for(let n of e)t++;return t}static some(e,t){for(let n of e)if(t(n))return!0;return!1}static every(e,t){for(let n of e)if(!t(n))return!1;return!0}static reduce(e,t,n){let i=n,o=0;for(let a of e)i=t(i,a,o++);return i}static includes(e,t){for(let n of e)if(n===t)return!0;return!1}static forEach(e,t){for(let n of e)t(n)}static*map(e,t){let n=0;for(let i of e)yield t(i,n++)}static*take(e,t){let n=0;for(let i of e){if(n++>=t)return;yield i}}static filter(e,t){let n=[];for(let i of e)t(i)&&n.push(i);return n}static filterMap(e,t){let n=[];for(let i of e){let o=t(i);q(o)&&n.push(o)}return n}static reverse(e){let t=[];for(let n of e)t.push(n);return t.reverse()}static*pairWise(e){let t=e[Symbol.iterator](),{done:n,value:i}=t.next(),o=i;if(n!==!0)for(;;){let{done:a,value:s}=t.next();if(a===!0){yield[o,null];return}yield[o,s],o=s}}};var or=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?D(`position(${e}) cannot be negative.`):e>this.#e.byteLength?D(`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 n=0;n<t;n++)this.writeShort(e.charCodeAt(n))}toArrayBuffer(){return this.#e.buffer.slice(0,this.#t)}#r(e){let t=this.#e.byteLength;if(this.#t+e>t){let n=this.#e;this.#e=new DataView(new ArrayBuffer(mo(t+e)));for(let i=0;i<this.#t;i++)this.#e.setInt8(i,n.getInt8(i))}}},Mc=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}},ug=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,n)=>e.#e[n]===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(ra.floatToIntBits(e))}writeDouble(e){this.writeLong(cg.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(ht.map(this.#e.values(),e=>(e&255).toString(16).padStart(2,"0"))).join("")}},wt=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?D(`position(${e}) cannot be negative.`):e>this.#e.byteLength?D(`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 n=0;n<e;n++)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 xk=r=>q(r)?r.value!==void 0?"value":r.get!==void 0?"get":D(`Cannot resolve method key of ${r}`):D("Cannot resolve method key of undefined descriptor"),kc=(r,e,t)=>{if(!q(t))return function(o,a){if(a&&a.kind==="getter")return function(){let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),e);if(!q(s?.get))return D(`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 n=xk(t),i=he(t[n]);return{[n]:function(...o){if(o.length>0)return D("lazy accessory must not have any construction parameters");let a=i.apply(this);return Object.defineProperty(this,e,{value:n==="get"?a:()=>a,configurable:!1,writable:!1,enumerable:!1}),a}}};var ia;(function(r){function*e(){}r.empty=e;function*t(...n){for(let i of n)for(let o of i)yield o}r.flatten=t})(ia||(ia={}));var ar=class{#e=new Set;#t;constructor(){this.#t=new Proxy({},{get:(e,t)=>(...n)=>this.#e.forEach(i=>Object.getPrototypeOf(i)===Object.getPrototypeOf({})?P(i[t],...n):i[t]?.apply(i,n))})}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 YF=(r,...e)=>new Proxy([],{get(t,n){if(typeof n=="string"){let i=Number(n);if(!isNaN(i)&&i>=0&&Number.isInteger(i))return new r(...e)}return n===Symbol.iterator?function*(){for(;;)yield new r(...e)}:t[n]},has(t,n){if(typeof n=="string"){let i=Number(n);if(!isNaN(i)&&i>=0)return!0}return n in t}});var Hs=class{static createIfAbsent(e,t,n){let i=e.get(t);return i===void 0&&(i=n(t),e.set(t,i)),i}};var Up=class r{static#e=Object.freeze(new Set);static empty=()=>r.#e};var dg=class r{#e;#t;constructor(e,t){this.#e=new Map(e),this.#t=m.wrap(t),this.#t.ifSome(n=>Array.from(this.#e.values()).forEach(i=>i.sort(n)))}[Symbol.iterator](){return this.#e.entries()}clear(){this.#e.clear()}containsEntry(e,t){return ht.some(this.#e.entries(),n=>e===n[0]&&n[1].includes(t))}containsKey(e){return ht.includes(this.#e.keys(),e)}containsValue(e){return ht.some(this.#e.values(),t=>t.includes(e))}get(e){return this.#e.get(e)??U.empty()}isEmpty(){return this.keyCount()===0}add(e,t){let n=Hs.createIfAbsent(this.#e,e,()=>[]);if(this.#t.isEmpty())n.push(t);else{let i=ct.stableInsert(n,t,this.#t.unwrap());n.splice(i,0,t)}}addAll(e,t){let n=Hs.createIfAbsent(this.#e,e,()=>[]);n.push(...t),this.#t.nonEmpty()&&n.sort(this.#t.unwrap())}remove(e,t){let n=this.#e.get(e);if(n===void 0)return!1;{let i=n.indexOf(t);return i===-1?!1:(n.splice(i,1),n.length===0&&this.#e.delete(e),!0)}}removeFromKeyIf(e,t){let n=this.#e.get(e);if(n===void 0)return null;{let i=n.findIndex(t);if(i===-1)return null;{let o=n.splice(i,1)[0];return n.length===0&&this.#e.delete(e),o}}}removeValueIf(e){let t=[];for(let[n,i]of this.#e.entries())for(let o of i.filter(a=>e(a)))t.push([n,o]);for(let[n,i]of t)this.remove(n,i);return new Set(t.map(([,n])=>n))}removeKey(e){let t=this.#e.get(e);return this.#e.delete(e),t??U.empty()}forEach(e){ht.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(),n=Array.from(this.keys()).sort(e);this.#e.clear();for(let i of n)this.addAll(i,t.get(i));return this}clone(){let e=new r;return this.#e.forEach((t,n)=>{e.#e.set(n,t.map(i=>i))}),e}},$c=class r{map;constructor(e){this.map=new Map(e?.map(t=>{let n=t[0],i=t[1];return[n,new Set(i)]}))}clear(){this.map.clear()}containsEntry(e,t){return ht.some(this.map.entries(),n=>e===n[0]&&n[1].has(t))}containsKey(e){return ht.includes(this.map.keys(),e)}containsValue(e){return ht.some(this.map.values(),t=>t.has(e))}get(e){return this.map.get(e)??Up.empty()}isEmpty(){return this.keyCount()===0}add(e,t){Hs.createIfAbsent(this.map,e,()=>new Set).add(t)}addAll(e,t){let n=Hs.createIfAbsent(this.map,e,()=>new Set);for(let i of t)n.add(i)}remove(e,t){let n=this.map.get(e);return n===void 0?!1:n.delete(t)?(n.size===0&&this.map.delete(e),!0):!1}removeValueIf(e){let t=new Set;for(let[n,i]of this.map.entries()){for(let o of i)e(o)&&(i.delete(o),t.add(o));i.size===0&&this.map.delete(n)}return t}removeFromKeyIf(e,t){let n=this.map.get(e);if(n===void 0)return null;for(let i of n)if(t(i))return n.delete(i),n.size===0&&this.map.delete(e),i;return null}removeKey(e){let t=this.map.get(e);return this.map.delete(e),t??Up.empty()}forEach(e){ht.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(),n=Array.from(this.keys()).sort(e);this.map.clear();for(let i of n)this.addAll(i,t.get(i));return this}clone(){let e=new r;return this.map.forEach((t,n)=>{e.map.set(n,new Set(Array.from(t)))}),e}};var ee=Object.freeze({Empty:{terminate:ea},create:r=>({terminate:r}),many:(...r)=>({terminate:()=>{for(;r.length>0;)r.pop().terminate()}})}),j=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:()=>U.removeOpt(this.#e,e)}),this.own(e)}terminate(){for(;this.#e.length>0;)this.#e.pop().terminate()}};var ce=class{static subscribeMany(e,...t){return ee.many(...t.map(n=>n.subscribe(()=>e(n))))}#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 _i;(function(r){let e=Object.freeze({});r.empty=()=>e,r.mergeNoOverlap=(t,n)=>{let i=new Set(Object.keys(t));for(let o of Object.keys(n))if(i.has(o))return D(`'${o}' is an overlapping key`);return{...t,...n}},r.include=(t,...n)=>{let i={};for(let o of n)i[o]=t[o];return i},r.exclude=(t,...n)=>{let i=new Set(n);return Object.entries(t).reduce((o,[a,s])=>(i.has(a)||(o[a]=s),o),{})},r.overwrite=(t,n)=>Object.assign(t,n),r.entries=t=>Object.entries(t)})(_i||(_i={}));var XF;(function(r){r.seal=e=>new class{getValue(){return e}subscribe(t){return ee.Empty}catchupAndSubscribe(t){return t(this),ee.Empty}}})(XF||(XF={}));var eB;(function(r){r.False=new class{getValue(){return!1}setValue(e){}subscribe(e){return ee.Empty}catchupAndSubscribe(e){return e(this),ee.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)}}})(eB||(eB={}));var Mr=class{#e;#t=m.None;constructor(e){this.#e=new ce,this.wrap(e)}wrap(e){this.wrapOption(m.wrap(e))}wrapOption(e){this.#t.equals(e)||(this.#t=e,this.#e.notify(this))}clear(e){this.#t.isEmpty()||(q(e)&&e(this.#t.unwrap()),this.#t=m.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 Hi=class{#e;#t=m.None;#r;constructor(e,t){this.#e=new ce,this.#r=t?.guard(e)??e,this.#t=m.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 H0=class{#e;#t;constructor(e,t){V(e<t,"Linear is inverse"),this.#e=e,this.#t=t}x(e){return e<=this.#e?0:e>=this.#t?1:(e-this.#e)/(this.#t-this.#e)}y(e){return e<=0?this.#e:e>=1?this.#t:this.#e+e*(this.#t-this.#e)}clamp(e){return be(e,this.#e,this.#t)}floating(){return!0}},J0=class{#e;#t;#r;constructor(e,t){this.#e=be(Math.round(e),yr.MIN_VALUE,yr.MAX_VALUE),this.#t=be(Math.round(t),yr.MIN_VALUE,yr.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(be(e,0,1)*this.#r)}clamp(e){return be(Math.round(e),this.#e,this.#t)}floating(){return!1}},Q0=class{#e;#t;constructor(e,t){V(e<t,"Exponential is inverse"),this.#e=e,this.#t=t}x(e){return e<=this.#e?0:e>=this.#t?1:Math.log(e/this.#e)/Math.log(this.#t/this.#e)}y(e){return e<=0?this.#e:e>=1?this.#t:Math.exp(e*Math.log(this.#t/this.#e))*this.#e}clamp(e){return Math.min(this.#t,Math.max(this.#e,e))}floating(){return!0}},pg=class{#e;#t;#r;#i;constructor(e,t,n){V(t!==n,"Power min === max"),this.#e=e,this.#t=t,this.#r=n,this.#i=n-t}x(e){return e<=this.#t?0:e>=this.#r?1:Math.pow((e-this.#t)/this.#i,1/this.#e)}y(e){return e<=0?this.#t:e>=1?this.#r:this.#t+Math.pow(e,this.#e)*this.#i}clamp(e){return Math.min(this.#r,Math.max(this.#t,e))}floating(){return!0}},Y0=class{#e;constructor(e){this.#e=e}x(e){let t=this.#e.findIndex(n=>n===e);return t===-1?D(`Could not find index for ${e}`):t/(this.#e.length-1)}y(e){let t=Math.round(be(e,0,1)*(this.#e.length-1));return t>-1?he(this.#e.at(t),`Could not find value for ${e}`):D(`Index ${t} is out of box.`)}clamp(e){return e}floating(){return!1}},X0=class{#e;#t;#r;#i;#n;constructor(e,t,n){this.#e=e,this.#t=n;let i=e*e,o=n*n,a=t*t,s=e+n-2*t,l=n-t;this.#r=((2*n-t)*e-t*n)/s,this.#i=(l*i+(a-o)*e+t*o-a*n)/(i+(2*n-4*t)*e+o-4*t*n+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}},A;(function(r){r.linear=(o,a)=>new H0(o,a),r.linearInteger=(o,a)=>new J0(o,a),r.exponential=(o,a)=>new Q0(o,a),r.power=(o,a,s)=>new pg(o,a,s),r.powerByCenter=(o,a,s)=>{let l=Math.log((s-a)/(o-a))/Math.log(2);if(Number.isNaN(l))throw new Error(`powerByCenter: invalid center=${o}, min=${a}, max=${s}`);return new pg(l,a,s)},r.values=o=>new Y0(o),r.decibel=(o,a,s)=>new X0(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),n=r.linear(-1,1);r.bool=e;let i=r.decibel(-72,-12,0);r.unipolar=()=>t,r.bipolar=()=>n,r.DefaultDecibel=i})(A||(A={}));var _;(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?be(l/200+.5,0,1):be(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(q(d)){let h=t.indexOf(d);if(h>-1)return{type:"explicit",value:l*Math.pow(10,(h-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}=i(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"]),n=o=>Math.log(o)/Math.log(9.999999999999998),i=o=>{let a=Math.floor(n(o)/3),s=t[a+4];return q(s)?{value:o*Math.pow(10,a*-3),prefix:s}:{value:o,prefix:""}};r.decible=r.numeric({unit:"db",fractionDigits:2}),r.panning=r.percent({unit:"%",fractionDigits:0})})(_||(_={}));var Tc;(function(r){r.alwaysTrue=()=>!0,r.alwaysFalse=()=>!1,r.definedPredicate=e=>e!=null})(Tc||(Tc={}));var Rc;(function(r){r.create=(e=252854082)=>new eA(e),r.monotoneAscending=(e,t=128,n=r.create())=>{let i=e.length;if(i<2)return D("Array must have at least 2 elements");let o=0;for(let s=1;s<i;s++){let l=Math.floor(n.uniform()*(1+t))+1;e[s]=l,o+=l}let a=0;e[0]=0;for(let s=1;s<i;s++)a+=e[s],e[s]=a/o;return e}})(Rc||(Rc={}));var eA=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 xr;(function(r){class e{}r.createBuilder=n=>{let i=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]=i(l))}),a};return()=>new t(n,Object.seal(i(n)))},r.bool=new class extends e{read(n){return n.readByte()===1}write(n,i){n.writeByte(i?1:0)}initialValue(){return!1}},r.int8=new class extends e{read(n){return n.readByte()}write(n,i){n.writeByte(i)}initialValue(){return 0}},r.int16=new class extends e{read(n){return n.readShort()}write(n,i){n.writeShort(i)}initialValue(){return 0}},r.int32=new class extends e{read(n){return n.readInt()}write(n,i){n.writeInt(i)}initialValue(){return 0}},r.float=new class extends e{read(n){return n.readFloat()}write(n,i){n.writeFloat(i)}initialValue(){return 0}},r.double=new class extends e{read(n){return n.readDouble()}write(n,i){n.writeDouble(i)}initialValue(){return 0}},r.int64=new class extends e{read(n){return n.readLong()}write(n,i){n.writeLong(i)}initialValue(){return 0n}},r.floats=n=>new class extends e{read(i,o){for(let a=0;a<o.length;a++)o[a]=i.readFloat();return o}write(i,o){for(let a=0;a<o.length;a++)i.writeFloat(o[a])}initialValue(){return new Float32Array(n)}},r.doubles=n=>new class extends e{read(i,o){for(let a=0;a<o.length;a++)o[a]=i.readDouble();return o}write(i,o){for(let a=0;a<o.length;a++)i.writeDouble(o[a])}initialValue(){return new Float64Array(n)}};class t{#e;#t;#r;constructor(i,o){this.#e=i,this.#t=o,this.#r=this.#i()}get object(){return this.#t}get bytesTotal(){return this.#r}read(i){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?p[l]=u.read(i,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}write(i){let o=(a,s)=>{Object.entries(a).forEach(([l,u])=>{let p=s;u instanceof e?u.write(i,p[l]):typeof u=="object"&&o(u,p[l])})};o(this.#e,this.#t)}#i(){let i=new Mc;return this.write(i),i.count}}})(xr||(xr={}));var Cc=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=[]}add(e,t=!1){let n=this.#e(e),i=ct.leftMostMapped(this.#r,n,this.#t,this.#e),o=this.#r[i];return q(o)&&this.#t(this.#e(o),n)===0?t?(this.#r.splice(i,1,e),!0):!1:(this.#r.splice(i,0,e),!0)}getOrCreate(e,t){let n=ct.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[n];if(q(i)&&this.#t(this.#e(i),e)===0)return i;let o=t(e);return this.#r.splice(n,0,o),o}addMany(e){for(let t of e)this.#r.push(t);try{return this.#r.sort((t,n)=>{let i=this.#t(this.#e(t),this.#e(n));if(i===0)throw"cancel";return i}),!0}catch(t){if(t==="cancel"){let n=new Map(this.entries());return this.#r.splice(0,this.#r.length,...n.values()),this.#r.sort((i,o)=>this.#t(this.#e(i),this.#e(o))),!1}return D(t)}}removeByValue(e){return this.removeByKey(this.#e(e))}removeByKey(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?(this.#r.splice(t,1),n):D(`Could not remove ${e}`)}removeByKeyIfExist(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?(this.#r.splice(t,1),n):null}removeRange(e,t){this.#r.splice(e,(t??this.#r.length)-e)}removeByPredicate(e){let t=0,n=this.#r.length;for(;--n>=0;)e(this.#r[n])&&(this.#r.splice(n,1),t++);return t}get(e){return he(this.#i(e),`Unknown key: ${e}`)}getOrThrow(e,t){let n=this.#i(e);if(q(n))return n;throw t()}opt(e){return m.wrap(this.#i(e))}getOrNull(e){return this.#i(e)??null}getByIndex(e){return this.#r[e]}hasKey(e){return q(this.#i(e))}hasValue(e){return q(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(){U.clear(this.#r)}[Symbol.iterator](){return this.#r.values()}#i(e){let t=ct.leftMostMapped(this.#r,e,this.#t,this.#e),n=this.#r[t];return q(n)&&this.#t(this.#e(n),e)===0?n:void 0}};var Oc=(()=>{let r=m.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:ea}),some:t=>t.progress(e)}),install:e=>{V(r.isEmpty(),"RuntimeNotification already installed"),r=m.wrap(e)}}})();var jp=class r{static createEstimator=()=>{let e=performance.now(),t=r.millis(Number.POSITIVE_INFINITY),n=0;return i=>{if(i===0)return r.POSITIVE_INFINITY;if(i>=1)return r.millis(0);let o=performance.now()-e;return o>n*1e3&&(t=r.millis(o/i-o),n++),t}};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 toHHMMSS=e=>((e/3600|0)+100).toString().slice(1)+":"+((e/60|0)%60+100).toString().slice(1)+":"+(e%60+100).toString().slice(1);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,n=Math.floor(Math.abs(this.#n)/1e3),i=Math.floor(n/60),o=Math.floor(i/60),a=Math.floor(o/24);return n<60?(e=n,t="second"):i<60?(e=i,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:n,s:i}=this.split();return e>0?[r.#o("d",e),r.#o("h",t),r.#o("m",n),r.#o("s",i)].join(", "):t>0?[r.#o("h",t),r.#o("m",n),r.#o("s",i)].join(", "):n>0?[r.#o("m",n),r.#o("s",i)].join(", "):i>0?r.#o("s",i):"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 ag(e)}}};var Vc;(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,n,i)=>{if(t.bytesTotal+1>n.byteLength)return D("Insufficient memory allocated.");let o=new Uint8Array(n),a=or.use(n,1);return Atomics.store(o,0,e.READ),{tryWrite:()=>Atomics.compareExchange(o,0,e.READ,e.WRITING)===e.WRITING?(i(t.object),a.position=0,t.write(a),Atomics.store(o,0,e.WRITTEN),!0):!1}},r.reader=(t,n)=>{let i=new SharedArrayBuffer(t.bytesTotal+1),o=new Uint8Array(i),a=new wt(i,1);return{buffer:i,tryRead:()=>Atomics.compareExchange(o,0,e.WRITTEN,e.READING)===e.READING?(a.position=0,t.read(a),n(t.object),Atomics.store(o,0,e.READ),!0):!1}}})(Vc||(Vc={}));var b;(function(r){r.length=16,r.generate=()=>e(crypto.getRandomValues(new Uint8Array(r.length))),r.sha256=async t=>{let n=typeof process<"u"&&process.env?.VITEST==="true";return crypto.subtle.digest("SHA-256",n?new Uint8Array(t.slice(0)):t).then(i=>e(new Uint8Array(i.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:D(`Invalid UUID format: ${t}`),r.fromDataInput=t=>{let n=new Uint8Array(r.length);return t.readBytes(new Int8Array(n.buffer)),n},r.toDataOutput=(t,n)=>t.writeBytes(new Int8Array(n.buffer)),r.toString=t=>{let n=U.create(i=>(i+256).toString(16).substring(1),256);return n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]},r.parse=t=>{let n=t.replace(/-/g,"").toLowerCase();if(n.length!==32)return D("Invalid UUID format");let i=new Uint8Array(r.length);for(let o=0,a=0;o<32;o+=2,a++)i[a]=parseInt(n.slice(o,o+2),16);return i},r.Comparator=(t,n)=>{if(t.length!==r.length||n.length!==r.length)return D("Unexpected array length for uuid(v4)");for(let i=0;i<r.length;i++){let o=t[i]-n[i];if(o!==0)return o}return 0},r.equals=(t,n)=>r.Comparator(t,n)===0,r.newSet=t=>new Cc(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 n=new Uint8Array(r.Lowest),i=new Uint8Array(new Uint32Array([t]).buffer);for(let o=0;o<4;o++)n[o]=i[o];return n},r.zType=t=>t.string().refine(n=>r.validateString(n),{message:"Invalid UUID format"}).transform(n=>n);let e=t=>(V(t.length===r.length,"UUID must be 16 bytes long"),t[6]=t[6]&15|64,t[8]=t[8]&63|128,t)})(b||(b={}));var hg=class{#e=new j;#t;#r;#i;constructor(e){this.#r=e,this.#t=this.#e.own(new ce),this.#i=this.#a(e,[])}get data(){return this.#r}get proxy(){return this.#i}subscribe(e,...t){let n=()=>t.reduce((i,o)=>i[o],this.#i);return this.#t.subscribe(i=>{this.#n(i,t)&&e(n())})}catchupAndSubscribe(e,...t){return e(t.reduce((i,o)=>i[o],this.#i)),this.subscribe(e,...t)}subscribeAll(e){return this.#t.subscribe(t=>e(t[0]))}createMutableObservableValue(...e){let t=this.#e.own(new j),n=t.own(new ce),i=()=>e.slice(0,-1).reduce((s,l)=>s[l],this.#i),o=e[e.length-1],a={getValue:()=>e.reduce((s,l)=>s[l],this.#i),setValue:s=>i()[o]=s,subscribe:s=>n.subscribe(s),catchupAndSubscribe:s=>(s(a),n.subscribe(s)),terminate:()=>t.terminate()};return t.own(this.subscribe(()=>n.notify(a),...e)),a}update(e){let t=new Set;this.#o(this.#r,e,t);for(let n of t)this.#t.notify([n])}terminate(){this.#e.terminate(),this.#t.terminate()}#n=(e,t)=>{let n=Math.min(e.length,t.length);for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0};#o=(e,t,n,i)=>{for(let o of Object.keys(t)){let a=i??o,s=t[o],l=e[o];s!==null&&typeof s=="object"&&!Array.isArray(s)?this.#o(e[o],s,n,a):l!==s&&(e[o]=s,n.add(a))}};#a=(e,t)=>new Proxy(e,{get:(n,i)=>{let o=n[i];return o!==null&&typeof o=="object"&&!Array.isArray(o)?this.#a(o,[...t,i]):o},set:(n,i,o)=>(n[i]=o,this.#t.notify([...t,i]),!0),preventExtensions:()=>!1})};var fg=class{#e=new Set;add(e){this.#e.add(new WeakRef(e))}forEach(e){for(let t of this.#e){let n=t.deref();n===void 0?this.#e.delete(t):e(n)}}count(){let e=0;for(let t of this.#e)t.deref()===void 0?this.#e.delete(t):e++;return e}clear(){this.#e.clear()}};var tA=(r,e)=>Math.floor(3840/e)*r,tB=(r,e=4,t=4)=>{let n=tA(1,t),i=Math.floor(r/n),o=Math.floor(i/e),s=(Math.floor(r)-tA(o*e,t))%n,l=Math.floor(s/240),u=s%240;return{bars:o,beats:i-o*e,semiquavers:l,ticks:u}},rB=(r,e)=>r*e/60*960,iB=(r,e)=>r*60/960/e,wk=(r,e)=>e*60/960/r,bk=(r,e,t)=>rB(r/t,e),Ak=(r,e,t)=>iB(r,e)*t,J={Bar:3840,Quarter:960,SemiQuaver:240,fromSignature:tA,toParts:tB,secondsToPulses:rB,pulsesToSeconds:iB,secondsToBpm:wk,samplesToPulses:bk,pulsesToSamples:Ak,toString:(r,e=4,t=4)=>{let{bars:n,beats:i,semiquavers:o,ticks:a}=tB(r|0,e,t);return`${n+1}.${i+1}.${o+1}:${a}`}};var fe=128,na=J.fromSignature(1,48),mg=1e-4;var Ae=class r{static Empty=new r(2);#e;constructor(e=2){this.#e=U.create(()=>new Float32Array(fe),e)}clear(e,t){this.#e.forEach(n=>n.fill(0,e,t))}numChannels(){return this.#e.length}getChannel(e){return e<this.numChannels()?this.#e[e]:this.#e[this.numChannels()-1]}assertSanity(){V(!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){V(e.length===2,"mixLayout: target.length must be 2"),V(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){V(e.length===2,"mixLayout: target.length must be 2"),V(this.#e.length===1||this.#e.length===2,"mixLayout: target.length must be 1 or 2");let[t,n]=e;if(this.#e.length===1){let[i]=this.#e;for(let o=0;o<fe;o++)t[o]+=i[o],n[o]+=i[o]}else{let[i,o]=this.#e;for(let a=0;a<fe;a++)t[a]+=i[a],n[a]+=o[a]}}};var kt;(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"})(kt||(kt={}));var zc=class{#e;#t=kt.Idle;#r=0;#i=0;#n=0;#o=0;#a=0;#s=0;#l=0;#c=0;#u=0;constructor(e){this.#e=1/e}get gate(){return this.#t!==kt.Idle&&this.#t!==kt.Release}get complete(){return this.#t===kt.Idle}get value(){return this.#r}get phase(){return this.#i}set(e,t,n,i){this.#n=e,this.#o=t,this.#a=n,this.#s=i,this.#p()}#p(){switch(this.#t){case kt.Attack:{let e=1-this.#r;this.#l=e*this.#e/Math.max(this.#n,1e-6);break}case kt.Decay:{let e=this.#r-this.#a;this.#c=e*this.#e/Math.max(this.#o,1e-6);break}case kt.Release:{let e=this.#r;this.#u=e*this.#e/Math.max(this.#s,1e-6);break}case kt.Sustain:case kt.Idle:{this.#l=this.#e/Math.max(this.#n,1e-6),this.#c=(1-this.#a)*this.#e/Math.max(this.#o,1e-6),this.#u=this.#a*this.#e/Math.max(this.#s,1e-6);break}}}gateOn(){this.#t=kt.Attack}gateOff(){this.#t!==kt.Idle&&(this.#t=kt.Release,this.#p())}forceStop(){this.#t=kt.Idle,this.#r=0}process(e,t,n){for(let i=t;i<n;)switch(this.#t){case kt.Attack:for(;i<n;){if(this.#r+=this.#l,this.#r>=1){this.#r=1,this.#i=1,e[i++]=this.#r,this.#t=kt.Decay,this.#p();break}e[i++]=this.#i=this.#r}break;case kt.Decay:for(;i<n;){if(this.#r-=this.#c,this.#r<=this.#a){this.#r=this.#a,this.#i=2,e[i++]=this.#r,this.#t=kt.Sustain,this.#p();break}this.#i=1+(1-this.#r)/(1-this.#a),e[i++]=this.#r}break;case kt.Sustain:e.fill(this.#a,i,n);return;case kt.Release:for(;i<n;){if(this.#r-=this.#u,this.#r<=0){this.#r=0,this.#i=0,e[i++]=this.#r,this.#t=kt.Idle,this.#p();break}this.#i=3+(1-this.#r/this.#a),e[i++]=this.#r}break;case kt.Idle:e.fill(0,i,n);return}}};var gg;(function(r){let e=new fg;r.count=()=>e.count(),r.create=(t,n,i)=>{let o=n*Float32Array.BYTES_PER_ELEMENT,a=o*i,s=new SharedArrayBuffer(a),l=U.create(u=>new Float32Array(s,u*o,n),i);return e.add(s),{sampleRate:t,numberOfFrames:n,numberOfChannels:i,frames:l}}})(gg||(gg={}));var vo=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=be(e,0,1),e>=.5)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=(1-o)/2,s=a,l=2*a,u=a,p=1+i,d=-2*o,h=1-i;this.setNormalizedCoefficients(s,l,u,p,d,h)}else this.setNormalizedCoefficients(0,0,0,1,0,0);return this}setHighpassParams(e,t=Math.SQRT1_2){if(e=be(e,0,1),e===1)this.setNormalizedCoefficients(0,0,0,1,0,0);else if(e>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=(1+o)/2,s=a,l=-2*a,u=a,p=1+i,d=-2*o,h=1-i;this.setNormalizedCoefficients(s,l,u,p,d,h)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setNormalizedCoefficients(e,t,n,i,o,a){let s=1/i;return this.b0=e*s,this.b1=t*s,this.b2=n*s,this.a1=o*s,this.a2=a*s,this}setLowShelfParams(e,t){e=be(e,0,1);let n=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(n*n,0,0,1,0,0);else if(e>0){let i=Nn*e,a=.5*Math.sin(i)*Math.sqrt((n+1/n)*(1/1-1)+2),s=Math.cos(i),l=2*Math.sqrt(n)*a,u=n+1,p=n-1,d=n*(u-p*s+l),h=2*n*(p-u*s),g=n*(u-p*s-l),v=u+p*s+l,y=-2*(p+u*s),x=u+p*s-l;this.setNormalizedCoefficients(d,h,g,v,y,x)}else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setHighShelfParams(e,t){e=be(e,0,1);let n=Math.pow(10,t/40);if(e===1)this.setNormalizedCoefficients(1,0,0,1,0,0);else if(e>0){let i=Nn*e,a=.5*Math.sin(i)*Math.sqrt((n+1/n)*(1/1-1)+2),s=Math.cos(i),l=2*Math.sqrt(n)*a,u=n+1,p=n-1,d=n*(u+p*s+l),h=-2*n*(p+u*s),g=n*(u+p*s-l),v=u-p*s+l,y=2*(p-u*s),x=u-p*s-l;this.setNormalizedCoefficients(d,h,g,v,y,x)}else this.setNormalizedCoefficients(n*n,0,0,1,0,0);return this}setPeakingParams(e,t,n){e=be(e,0,1),t=Math.max(0,t);let i=Math.pow(10,n/40);if(e>0&&e<1)if(t>0){let o=Nn*e,a=Math.sin(o)/(2*t),s=Math.cos(o),l=1+a*i,u=-2*s,p=1-a*i,d=1+a/i,h=-2*s,g=1-a/i;this.setNormalizedCoefficients(l,u,p,d,h,g)}else this.setNormalizedCoefficients(i*i,0,0,1,0,0);else this.setNormalizedCoefficients(1,0,0,1,0,0);return this}setAllpassParams(e,t){if(e=be(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=1-i,s=-2*o,l=1+i,u=1+i,p=-2*o,d=1-i;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=be(e,0,1),t=Math.max(0,t),e>0&&e<1)if(t>0){let n=Nn*e,i=Math.sin(n)/(2*t),o=Math.cos(n),a=1,s=-2*o,l=1,u=1+i,p=-2*o,d=1-i;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 n=Nn*e;if(t>0){let i=Math.sin(n)/(2*t),o=Math.cos(n),a=i,s=0,l=-i,u=1+i,p=-2*o,d=1-i;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,n){V(e.length===t.length&&e.length===n.length,"Array lengths do not match");let i=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),h=Math.sin(p),g=i+((o+a*d)*d-a*h*h),v=(o+a*d)*h+a*h*d,y=1+((s+l*d)*d-l*h*h),x=(s+l*d)*h+l*h*d,B=y*y+x*x,I=(g*y+v*x)/B,O=(v*y-g*x)/B;t[u]=Math.sqrt(I*I+O*O),n[u]=Math.atan2(O,I)}}};var Jt=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:n,b1:i,b2:o},a,s,l,u){let p=this.#e,d=this.#t,h=this.#r,g=this.#i;for(let v=l;v<u;v++){let y=a[v],x=s[v]=n*y+i*p+o*d-e*h-t*g+1e-18-1e-18;d=p,p=y,g=h,h=x}this.#e=p,this.#t=d,this.#r=h,this.#i=g}processFrame({a1:e,a2:t,b0:n,b1:i,b2:o},a){let s=n*a+i*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}},Ta=class{#e;#t;constructor(e){this.#e=U.create(()=>new Jt,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,n,i,o){for(let a=0;a<this.#t;a++)this.#e[a].process(e,t,n,i,o),t=n}processFrame(e,t){for(let n=0;n<this.#t;n++)t=this.#e[n].processFrame(e,t);return t}},Lp=512,vg=class{#e;#t=new vo;#r;#i=-1;constructor(e,t,n){this.#r=new Ta(4),this.#e=new Float32Array(Lp+1);let i=Math.log(t/e),o=1/n;for(let a=0;a<=Lp;a++)this.#e[a]=e*Math.exp(a/Lp*i)*o}get order(){return this.#r.order}set order(e){this.#r.order=e}reset(){this.#r.reset()}process(e,t,n,i,o,a){let s=this.#e,l=this.#r,u=this.#t,p=i/l.order**1.25,d=o,h=this.#i;for(;d<a;){let g=Math.floor(qi(n[d])*Lp),v=d+1;for(;v<a&&Math.floor(qi(n[v])*Lp)===g;)++v;g!==h&&(h=g,u.setLowpassParams(s[g],p)),l.process(u,e,t,d,v),d=v}this.#i=h}};var nB=Math.log(10)/20,Kp=(r=60,e=440)=>e*Math.pow(2,(r+3)/12-6);var Pe=r=>Math.exp(r*nB),yo=r=>Math.log(r)/nB,Uc=r=>Pe(20*Math.log10(r));var _k=.02,oB=1e3,yg=class{#e;#t;#r;#i;#n;#o;#a=NaN;#s=NaN;#l=0;#c=0;#u=0;#p=8;#d=0;#f=1;#h=!1;constructor(e){this.#e=e,this.#t=Math.ceil(e*_k)|0,this.#r=new vo,this.#r.setLowpassParams(.5),this.#i=[new Jt,new Jt],this.#n=[new Float32Array(fe),new Float32Array(fe)],this.#o=new Float32Array(2)}process(e,t,n,i){let[o,a]=e,[s,l]=t,[u,p]=this.#n;this.#i[0].process(this.#r,o,u,n,i),this.#i[1].process(this.#r,a,p,n,i);let d=Pe(this.#d),h=Pe(-this.#d/2),g=this.#e/this.#a,v=Math.pow(2,this.#p)-1,y=1/v;for(let x=n;x<i;x++)this.#c>0&&(this.#a+=this.#l,--this.#c===0&&(this.#l=0,this.#a=this.#s),this.#r.setLowpassParams(Math.max(this.#a,oB)/this.#e)),this.#u+=1,this.#u>=g&&(this.#u-=g,this.#o[0]=be(Math.round(u[x]*d*v)*y,-1,1),this.#o[1]=be(Math.round(p[x]*d*v)*y,-1,1)),s[x]=(o[x]*(1-this.#f)+this.#o[0]*this.#f)*h,l[x]=(a[x]*(1-this.#f)+this.#o[1]*this.#f)*h;this.#h=!0}setCrush(e){let t=JF(20,this.#e*.5,e);this.#h&&isFinite(this.#a)?(this.#s=t,this.#l=(t-this.#a)/this.#t,this.#c=this.#t):(this.#a=t,this.#r.setLowpassParams(Math.max(this.#a,oB)/this.#e))}setBitDepth(e){this.#p=be(e,1,16)}setBoost(e){this.#d=e}setMix(e){this.#f=qi(e)}reset(){this.#h=!1,this.#s=NaN,this.#l=0,this.#c=0,this.#u=0,this.#o.fill(0),this.#i[0].reset(),this.#i[1].reset()}};var Wp=class{#e;#t;#r;#i;#n=0;#o=0;#a=0;#s=0;#l=0;#c=!1;#u=!1;constructor(e,t){let n=mo(e);this.#e=n,this.#t=n-1,this.#r=new Float32Array(n),this.#i=t}clear(){this.#n=0,this.#c&&(this.#r.fill(0),this.#c=!1),this.#p()}set offset(e){if(e<0||e>=this.#e)throw new Error(`MonoDelay offset ${e} out of bounds [0, ${this.#e})`);this.#a=e,this.#c?this.#d():this.#p()}get offset(){return this.#a}process(e,t,n,i){this.#u?this.#h(e,t,n,i):this.#f(e,t,n,i),this.#c=!0}#p(){this.#o=this.#a,this.#l=0,this.#u=!1}#d(){this.#a!==this.#o&&(this.#l=this.#i,this.#s=(this.#a-this.#o)/this.#l,this.#u=!0)}#f(e,t,n,i){let o=this.#r,a=this.#t,s=this.#n,l=s-Math.floor(this.#o);l<0&&(l+=this.#e);for(let u=n;u<i;++u)o[s]=t[u],e[u]=o[l],l=l+1&a,s=s+1&a;this.#n=s}#h(e,t,n,i){let o=this.#r,a=this.#t,s=this.#n;for(let l=n;l<i;++l){this.#l>0?(this.#o+=this.#s,this.#l--):(this.#o=this.#a,this.#u=!1),o[s]=t[l];let u=s-this.#o;u<0&&(u+=this.#e);let p=Math.floor(u),d=u-p,h=o[p];e[l]=h+d*(o[p+1&a]-h),s=s+1&a}this.#n=s}};var xg=class r{static#e=10;#t=1;#r=0;#i=0;#n=0;#o=0;#a=0;set(e,t,n){this.#t=e,this.#r=t*r.#e,this.#i=lg(1e-5,1-1e-5,n),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),n,i,o,a;return this.#r<0?(n=1-t,i=1-this.#i,o=this.#a,a=this.#o):(n=t,i=this.#i,o=this.#o,a=this.#a),n<=i?1-(1-n*o)**this.#n*this.#t:((1-n)*a)**this.#n*this.#t-this.#t+1}};var Zp;(function(r){r.Comparator=(e,t)=>e.position-t.position,r.PositionExtractor=e=>e.position})(Zp||(Zp={}));var Js;(function(r){r.complete=e=>e.position+e.duration,r.DescendingComparator=(e,t)=>r.complete(t)-r.complete(e)})(Js||(Js={}));var kr;(function(r){r.globalToLocal=(t,n)=>qs(n-t.position+t.loopOffset,t.loopDuration),r.locateLoop=({position:t,complete:n,loopOffset:i,loopDuration:o},a,s)=>{let l=t-i,u=l+o;if(l>=s||u<=a)return m.None;let p=Math.max(l,a),d=Math.min(u,s);return m.wrap({index:0,rawStart:l,rawEnd:u,regionStart:Math.max(l,t),regionEnd:Math.min(u,n),resultStart:p,resultEnd:d,resultStartValue:l<p?(p-l)/o:0,resultEndValue:u>d?(d-l)/o:1})};function*e({position:t,complete:n,loopOffset:i,loopDuration:o},a,s){let l=t-i,u=Math.max(t,a),p=Math.min(n,s),d=Math.floor((u-l)/o),h=l+d*o;for(;h<p;){let g=h+o,v=Math.max(h,t),y=Math.min(g,n),x=Math.max(h,u),B=Math.min(g,p),I=h<x?(x-h)/o:0,O=g>B?(B-h)/o:1;yield{index:d++,rawStart:h,rawEnd:g,regionStart:v,regionEnd:y,resultStart:x,resultEnd:B,resultStartValue:I,resultEndValue:O},h=g}}r.locateLoops=e})(kr||(kr={}));var ai=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 wg(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()?ia.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t,n){return this.#e.isEmpty()?ia.empty():this.#e.iterate(this.#e.ceilFirstIndex(e),t,n)}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()}},Ra=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 wg(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()?ia.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t){if(this.#e.isEmpty())return ia.empty();let n=Math.max(0,this.#e.floorLastIndex(e)),i=this.#e.optAt(n);if(i===null)return ia.empty();for(;i.position+i.duration<=e;)if(i=this.#e.optAt(++n),i===null||i.position>=t)return ia.empty();return this.#e.iterate(n,t)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}},Qs=class{#e;constructor(){this.#e=[]}addAndRetain(e){if(this.#e.length===0)this.#e.push(e);else{let t=ct.leftMost(this.#e,e,Js.DescendingComparator);this.#e.splice(t,0,e)}}*overlapping(e,t){let n=this.#e.filter(i=>i.position<=e&&e<i.position+i.duration);yield*q(t)?n.sort(t):n}*releaseLinearCompleted(e){if(this.#e.length!==0)for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t];if(Js.complete(n)<e)this.#e.splice(t,1),yield n;else return}}*release(e){if(this.#e.length!==0)for(let t=this.#e.length-1;t>=0;t--){let n=this.#e[t];e(n)&&(this.#e.splice(t,1),yield n)}}*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(){U.clear(this.#e)}},wg=class{comparator;#e=[];#t=!1;modCount=0;constructor(e){this.comparator=e}add(e){if(this.#e.includes(e))throw new Error(`Duplicate event added: ${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 n=e.position,i=ct.leftMostMapped(this.#e,n,$a,Zp.PositionExtractor);for(let o=i;o<this.#e.length;o++){let a=this.#e[o];if(a===e)return!0;if(a.position!==n)return!1}return!1}clear(){++this.modCount,U.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 n=this.floorLastIndex(e);for(;n>=0;){let i=this.#e[n--];if(t(i))return i}return null}greaterEqual(e,t){if(t===void 0)return this.optAt(this.ceilFirstIndex(e));let n=this.ceilFirstIndex(e);for(;n<this.#e.length;){let i=this.#e[n++];if(t(i))return i}return null}floorLastIndex(e){return this.#t&&this.#r(),ct.rightMostMapped(this.#e,e,$a,Zp.PositionExtractor)}ceilFirstIndex(e){return this.#t&&this.#r(),ct.leftMostMapped(this.#e,e,$a,Zp.PositionExtractor)}iterateFrom(e,t){let n=this.floorLastIndex(e),i=n;if(i<0)return this.iterate(0,yr.MAX_VALUE,t);for(;i>=0;){let o=this.optAt(i);if(o!==null&&t!==void 0&&t(o))return this.iterate(i,yr.MAX_VALUE,t);i--}return this.iterate(n,yr.MAX_VALUE,t)}length(){return this.#e.length}isEmpty(){return this.#e.length===0}onIndexingChanged(){this.#t=this.length()>1}*iterate(e,t,n=Tc.alwaysTrue){for(this.#t&&this.#r();e<this.#e.length;){let i=this.#e[e++];if(i.position>=t)return;n(i)&&(yield i)}}#r(){this.#e.sort(this.comparator),this.#t=!1}};var Ca;(function(r){r.hasFading=e=>e.in>0||e.out>0,r.gainAt=(e,t,n)=>{let{in:i,out:o,inSlope:a,outSlope:s}=n,l=1,u=1;i>0&&e<i&&(l=vr.normalizedAt(e/i,a));let p=t-o;if(o>0&&e>p){let d=(e-p)/o;u=1-vr.normalizedAt(d,s)}return Math.min(l,u)},r.fillGainBuffer=(e,t,n,i,o,a)=>{let{in:s,out:l,inSlope:u,outSlope:p}=a;if(e.fill(1,0,o),s<=0&&l<=0)return;let d=i-l;if(t>=s&&n<=d)return;let h=(n-t)/o;if(s>0&&t<s){let g=Math.min(n,s),v=Math.min(o,Math.ceil((g-t)/h));if(v>0){let y=t/s,x=g/s,B=vr.walk(u,v,y,x);for(let I=0;I<v;I++)e[I]=B.next().value}}if(l>0&&n>d){let g=Math.max(t,d),v=Math.max(0,Math.floor((g-t)/h)),y=o-v;if(y>0){let x=(g-d)/l,B=(n-d)/l,I=vr.walk(p,y,1-x,1-B);for(let O=v;O<o;O++)e[O]=Math.min(e[O],I.next().value)}}}})(Ca||(Ca={}));var ig=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 n=0;n<t;n++){let i=2*Math.PI*n/e;this.#r[n]=Math.cos(i),this.#i[n]=Math.sin(i)}}process(e,t){let n,i,o,a;for(let u=0;u<this.#e;++u)i=r.reverse(u)>>>this.#t,i>u&&(a=e[u],e[u]=e[i],e[i]=a,a=t[u],t[u]=t[i],t[i]=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(n=0;n<this.#e;n+=u){let h=n+p;for(i=n,o=0;i<h;i++,o=o+d|0){let g=i+p|0,v=s[o],y=l[o],x=e[g],B=t[g],I=x*v+B*y,O=B*v-x*y,z=e[i],$=t[i];e[g]=z-I,t[g]=$-O,e[i]=z+I,t[i]=$+O}}if(u===this.#e)break}}inverse(e,t){let n=this.#e;for(let o=0;o<n;o++)t[o]=-t[o];this.process(e,t);let i=1/n;for(let o=0;o<n;o++)e[o]*=i,t[o]=-t[o]*i}};var rA=r=>{let e=.25*r+.25;return 4*(Math.abs(e-Math.round(e))-.25)};var wr;(function(r){r.builder=()=>new e,r.toDouble=([t,n])=>t/n,r.toPPQN=([t,n])=>J.fromSignature(t,n);class e{#e=[];add(n){return this.#e.push(n),this}asArray(){return this.#e}asAscendingArray(){return this.#e.toSorted((n,i)=>r.toDouble(n)-r.toDouble(i))}asDescendingArray(){return this.#e.toSorted((n,i)=>r.toDouble(i)-r.toDouble(n))}}})(wr||(wr={}));var Oa=class{static*iterate(e,t,n){let i=Math.ceil(e/n),o=i*n;for(;o<t;)yield o,o=++i*n}static*iterateWithIndex(e,t,n){let i=Math.ceil(e/n),o=i*n;for(;o<t;)yield{position:o,index:i},o=++i*n}};var jc=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,n,i){if(isNaN(this.#r)){for(let o=n;o<i;o++)e[o]*=this.#e;this.#t=this.#e}else{let o=J.samplesToPulses(1,t,sampleRate);for(let a=n;a<i;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<i;s++)e[s]*=this.#e;break}e[a]*=this.#t=this.#e+(this.#r-this.#e)*this.#i}}}advance(e,t,n){if(isNaN(this.#r))this.#t=this.#e;else{let i=J.samplesToPulses(n-t,e,sampleRate);this.#i+=i/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 bg=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}addVertex(e){V(!this.#e.includes(e),"Vertex already exists"),this.#e.push(e),V(!this.#t.has(e),"Predecessor already exists"),this.#t.set(e,[])}removeVertex(e){U.remove(this.#e,e);let t=this.#t.delete(e);V(t,"Predecessor does not exists")}getPredecessors(e){return this.#t.get(e)??U.empty()}predecessors(){return this.#t}vertices(){return this.#e}addEdge([e,t]){he(this.#t.get(t),`[add] Edge has unannounced vertex. (${t})`).push(e)}removeEdge([e,t]){let n=he(this.#t.get(t),`[remove] Edge has unannounced vertex. (${t})`);V(n.includes(e),`${e} is not marked.`),U.remove(n,e)}isEmpty(){return this.#e.length===0}},Ag=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.#s();let e=new Map;for(let n of this.#e.vertices())this.#n.set(n,new Set),e.set(n,new Set);for(let n of this.#e.vertices())for(let i of this.#e.getPredecessors(n))he(this.#n.get(i),`Could not find Successor for ${i}`).add(n);let t;do{t=!1;for(let n of this.#e.vertices()){he(e.get(n)).clear();for(let i of he(this.#n.get(n)))for(let o of he(this.#n.get(i)))this.#n.get(n)?.has(o)||(t=!0,he(e.get(n)).add(o))}for(let n of this.#e.vertices()){let i=he(this.#n.get(n));he(e.get(n)).forEach(o=>i.add(o))}}while(t)}#a(e){if(!this.#r.has(e)){this.#r.add(e);for(let t of this.#e.getPredecessors(e)){if(he(this.#n.get(e)).has(t)){this.#i.add(e),this.#i.add(t);continue}this.#a(t)}this.#t.push(e)}}#s(){U.clear(this.#t),this.#r.clear(),this.#i.clear(),this.#n.clear()}};var Gp;(function(r){r.Identity={warp:e=>e,unwarp:e=>e}})(Gp||(Gp={}));var _g=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 n=this.#e.duration(),i=ta(t,n),o=(t-i)/n,a=e?this.#e.fx(o):this.#e.fy(o);return i+a*n}};var ut;(function(r){r[r.sine=0]="sine",r[r.triangle=1]="triangle",r[r.saw=2]="saw",r[r.square=3]="square"})(ut||(ut={}));var Pg=class{sampleRate;#e=0;constructor(e){this.sampleRate=e}fill(e,t,n,i,o){let a=n/this.sampleRate;switch(t){case ut.sine:{for(let s=i;s<o;s++)e[s]=Math.sin(this.#e*Math.PI*2),this.#e+=a,this.#e>=1&&(this.#e-=1);break}case ut.triangle:{for(let s=i;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 ut.saw:{for(let s=i;s<o;s++){let l=this.#e%1;e[s]=2*l-1,this.#e+=a,this.#e>=1&&(this.#e-=1)}break}case ut.square:{for(let s=i;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 xo;(function(r){r[r.Linear=0]="Linear",r[r.EqualPower=1]="EqualPower"})(xo||(xo={}));var Sg;(function(r){r.BlackKeyIndices=[1,3,6,8,10],r.BlackKeyBits=r.BlackKeyIndices.reduce((t,n)=>t|=1<<n,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,n)=>qi((t-60)*n);class e{#e;#t;constructor(n,...i){this.#e=n,this.#t=i.reduce((o,a)=>o|=1<<a,0)}get name(){return this.#e}get bits(){return this.#t}has(n){return(this.#t&1<<n%12)!==0}equals(n){return this.#t===n.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)]})(Sg||(Sg={}));var $r;(function(r){r.isOfType=e=>e.type==="note-event",r.Comparator=(e,t)=>{let n=e.position-t.position;if(n!==0)return n;let i=e.pitch-t.pitch;return i!==0?i: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 n=Js.complete(e)-Js.complete(t);return n!==0?n:e.pitch-t.pitch}})($r||($r={}));var qp=class{#e;#t=0;#r=0;constructor(e){this.#e=1/e}generate(e,t,n,i,o){let a=t*this.#e;switch(n){case ut.sine:this.#i(e,a,i,o);break;case ut.saw:this.#n(e,a,i,o);break;case ut.square:this.#o(e,a,i,o);break;case ut.triangle:this.#a(e,a,i,o);break}}generateFromFrequencies(e,t,n,i,o){switch(n){case ut.sine:this.#s(e,t,i,o);break;case ut.saw:this.#l(e,t,i,o);break;case ut.square:this.#c(e,t,i,o);break;case ut.triangle:this.#u(e,t,i,o);break}}#i(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++)e[a]=Math.sin(2*Math.PI*(o%1)),o+=t;this.#t=o}#n(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++){let s=o%1;e[a]=2*s-1-wo(s,t),o+=t}this.#t=o}#o(e,t,n,i){let o=this.#t;for(let a=n;a<i;a++){let s=o%1;e[a]=(s<.5?1:-1)+wo(s,t)-wo((s+.5)%1,t),o+=t}this.#t=o}#a(e,t,n,i){let o=this.#t,a=this.#r,s=4*t;for(let l=n;l<i;l++){let u=o%1,p=(u<.5?1:-1)+wo(u,t)-wo((u+.5)%1,t);a=a*.9995+p*s,e[l]=a,o+=t}this.#t=o,this.#r=a}#s(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++)e[s]=Math.sin(2*Math.PI*(a%1)),a+=t[s]*o;this.#t=a}#l(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++){let l=t[s]*o,u=a%1;e[s]=2*u-1-wo(u,l),a+=l}this.#t=a}#c(e,t,n,i){let o=this.#e,a=this.#t;for(let s=n;s<i;s++){let l=t[s]*o,u=a%1;e[s]=(u<.5?1:-1)+wo(u,l)-wo((u+.5)%1,l),a+=l}this.#t=a}#u(e,t,n,i){let o=this.#e,a=this.#t,s=this.#r;for(let l=n;l<i;l++){let u=t[l]*o,p=a%1,d=(p<.5?1:-1)+wo(p,u)-wo((p+.5)%1,u);s=s*.9995+d*(4*u),e[l]=s,a+=u}this.#t=a,this.#r=s}},wo=(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 oa;(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:n,invertL:i,invertR:o,stereo:a,swap:s},l=xo.EqualPower)=>{let[u,p]=r.panningToGains(n,l),d=u*t,h=p*t;i&&(d*=-1),o&&(h*=-1);let g=Math.max(0,-a),v=Math.max(0,a),y=1-v,x=1+v,B=g*.5,I=1-g,O=(y+x)*.5,z=(y-x)*.5,$=(y-x)*.5,ie=(y+x)*.5,ne=d*(B+I)*O+h*B*z,le=d*(B+I)*$+h*B*ie,W=d*B*O+h*(B+I)*z,xe=d*B*$+h*(B+I)*ie;s?(e.ll=le,e.rl=ne,e.lr=xe,e.rr=W):(e.ll=ne,e.lr=W,e.rl=le,e.rr=xe)},r.panningToGains=(e,t)=>{let n=be(e,-1,1);switch(t){case xo.Linear:return[Math.min(1-n,1),Math.min(n+1,1)];case xo.EqualPower:return[Math.cos((n+1)*G0),Math.sin((n+1)*G0)]}},r.applyFrame=(e,t,n)=>[e.ll*t+e.rl*n,e.lr*t+e.rr*n],r.processFrames=(e,t,n,i,o)=>{let[a,s]=t,[l,u]=n;for(let p=i;p<o;p++){let d=a[p],h=s[p];l[p]=e.ll*d+e.rl*h,u[p]=e.lr*d+e.rr*h}},r.replaceFrames=(e,[t,n],i,o)=>{for(let a=i;a<o;a++){let s=t[a],l=n[a];t[a]=e.ll*s+e.rl*l,n[a]=e.lr*s+e.rr*l}}})(oa||(oa={}));var fr;(function(r){r.linear=(n,i=.005)=>new e(Math.ceil(n*i)|0),r.stereoMatrix=(n,i=.005)=>new t(Math.ceil(n*i)|0);class e{#e;#t=0;#r=0;#i=0;#n=0;constructor(i){this.#e=i}set(i,o){this.#t!==i&&(o===!0?(this.#r=i,this.#i=(i-this.#t)/this.#e,this.#n=this.#e):(this.#t=this.#r=i,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(i){return this.#t===i&&this.#n===0}isInterpolating(){return this.#n>0}}class t{#e;#t=oa.zero();#r=oa.zero();#i=oa.zero();#n=0;constructor(i){this.#e=i}update(i,o,a){oa.update(this.#r,i,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(i,o,a,s){let[l,u]=i,[p,d]=o;if(this.isInterpolating())for(let h=a;h<s;h++){let g=l[h],v=u[h],y=this.moveAndGet();p[h]=y.ll*g+y.rl*v,d[h]=y.lr*g+y.rr*v}else{let h=this.#r;for(let g=a;g<s;g++){let v=l[g],y=u[g];p[g]=h.ll*v+h.rl*y,d[g]=h.lr*v+h.rr*y}}}set(i,o){this.#o(i)||(o===!0?(this.#r.ll=i.ll,this.#r.lr=i.lr,this.#r.rl=i.rl,this.#r.rr=i.rr,this.#i.ll=(i.ll-this.#t.ll)/this.#e,this.#i.lr=(i.lr-this.#t.lr)/this.#e,this.#i.rl=(i.rl-this.#t.rl)/this.#e,this.#i.rr=(i.rr-this.#t.rr)/this.#e,this.#n=this.#e):(this.#t.ll=this.#r.ll=i.ll,this.#t.lr=this.#r.lr=i.lr,this.#t.rl=this.#r.rl=i.rl,this.#t.rr=this.#r.rr=i.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(i){return this.#o(i)&&this.#n===0}isInterpolating(){return this.#n>0}#o(i){return this.#t.ll===i.ll&&this.#t.lr===i.lr&&this.#t.rl===i.rl&&this.#t.rr===i.rr}}r.StereoMatrixRamp=t})(fr||(fr={}));var Hp=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]),iA=new Float32Array(12),aB=new Float32Array(11);for(let r=0,e=0,t=0;r<Hp.length;r++)r%2===0?iA[e++]=Hp[r]:aB[t++]=Hp[r];var nA=class{#e=new Float32Array(iA.length);#t=new Float32Array(Hp.length);#r=0;#i=0;reset(){this.#e.fill(0),this.#t.fill(0),this.#r=0,this.#i=0}upsample(e,t,n,i){let o=this.#e,a=iA,s=aB;for(let l=n;l<i;l++){let u=e[l],p=(l-n)*2;o[this.#r]=u;let d=0;for(let g=0;g<a.length;g++){let v=(this.#r-g+o.length)%o.length;d+=o[v]*a[g]}t[p]=d*2;let h=0;for(let g=0;g<s.length;g++){let v=(this.#r-g+o.length-1)%o.length;h+=o[v]*s[g]}t[p+1]=h*2,this.#r=(this.#r+1)%o.length}}downsample(e,t,n,i){let o=this.#t,a=Hp;for(let s=n;s<i;s++){let l=(s-n)*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}}},Eg=class{#e;#t;#r;constructor(e){this.#e=e;let t=e===2?1:e===4?2:3;this.#t=U.create(()=>new nA,t),this.#r=U.create(n=>new Float32Array(fe*(2<<n)),t-1)}reset(){this.#t.forEach(e=>e.reset())}upsample(e,t,n,i){let o=i-n,a=e,s=n,l=i;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,n,i){let o=i-n,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?n:0,h=u?i:s/2;this.#t[l].downsample(a,p,d,h),a=p,s=h}}},Fg=class{#e;#t;constructor(e){this.#e=new Eg(e),this.#t=new Eg(e)}reset(){this.#e.reset(),this.#t.reset()}upsample(e,t,n,i){this.#e.upsample(e[0],t[0],n,i),this.#t.upsample(e[1],t[1],n,i)}downsample(e,t,n,i){this.#e.downsample(e[0],t[0],n,i),this.#t.downsample(e[1],t[1],n,i)}};var Lc=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,n){let i=this.#e,o=i.length,a=this.#r,s=this.#i;for(let l=t;l<n;l++){let u=e[l]*e[l];s+=u-i[a],i[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 Bg=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,n){let i=this.#r,o=this.#i,[a,s]=e.channels(),l=this.#n;for(let u=t;u<n;++u){let p=a[u],d=s[u],h=Math.max(Math.abs(p),Math.abs(d));if(l=h>l?i*(l-h)+h:o*(l-h)+h,l>1){let g=1/l;a[u]=p*g,s[u]=d*g}}this.#n=l}};var Pi=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 Wr;(function(r){r.Musical="musical",r.Seconds="seconds"})(Wr||(Wr={}));var Ys;(function(r){function e(t,n,i){return new oA(t,n,i)}r.aware=e})(Ys||(Ys={}));var oA=class{#e;#t;#r;constructor(e,t,n){this.#r=n,this.#t=t,this.#e=e}toPPQN(e){let t=this.#r.getValue();if(this.getTimeBase()===Wr.Musical)return t;let n=this.#e.ppqnToSeconds(e),i=n+t;return this.#e.intervalToPPQN(n,i)}fromPPQN(e,t){if(this.getTimeBase()===Wr.Musical)this.#r.setValue(e);else{let n=this.#e.intervalToSeconds(t,t+e);this.#r.setValue(n)}}toSeconds(e){let t=this.#r.getValue();return this.getTimeBase()===Wr.Seconds?t:this.#e.intervalToSeconds(e,e+t)}toSamples(e,t){return this.toSeconds(e)*t}rawValue(){return this.#r.getValue()}getTimeBase(){return Gi(this.#t.getValue(),Wr)}};var Ng=J.fromSignature(1,384);var si={None:{type:"none"},Linear:{type:"linear"},Curve:r=>r===.5?si.Linear:{type:"curve",slope:r}},Ig;(function(r){r.Comparator=(i,o)=>{let a=i.position-o.position;if(a!==0)return a;let s=i.index-o.index;return s!==0?s:i===o?0:D(`${i} and ${o} are identical in terms of comparison`)};function*e(i,o,a){if(i.isEmpty())return ht.empty();for(let s of i.iterateFrom(o))if(yield s,s.position>=a)return}r.iterateWindow=e,r.nextEvent=(i,o)=>{let a=i.asArray(),s=ct.rightMost(a,o,r.Comparator);return s===-1?null:a[s+1]??null},r.valueAt=(i,o,a)=>{if(i.isEmpty())return a;let s=i.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 n(u,d,o);if(u.interpolation===si.None)return u.value}return u.value};function*t(i,o,a,s){if(i.isEmpty())return;let l=i.iterateFrom(o),{done:u,value:p}=l.next();if(u)return;let d=a/s,h=p;if(h.position>o){for(;o<h.position;)if(yield{position:o,value:h.value},o+=d,o>a)return;h.position<=a&&(yield h)}for(;o<=a;){let{done:g,value:v}=l.next();if(g)break;for(;o<v.position;){if(o>a)return;yield{position:o,value:n(h,v,o)},o+=d}v.position<a&&(h.interpolation===si.None&&(yield{position:v.position,value:h.value}),yield v),h=v}for(;o<=a;)yield{position:o,value:h.value},o+=d}r.quantise=t;let n=({value:i,position:o,interpolation:a},s,l)=>a.type==="none"?i:a.type==="linear"?i+(l-o)/(s.position-o)*(s.value-i):a.type==="curve"?vr.valueAt({slope:a.slope,steps:s.position-o,y0:i,y1:s.value},l-o):D("Unknown interpolation")})(Ig||(Ig={}));var Vp;(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,n)=>{let i=new Float32Array(n),o=Math.PI/(n-1);switch(t){case e.Bartlett:{let a=(n>>1)-1,s=0;for(;s<=a;++s)i[s]=2*s/(n-1);for(;s<n;++s)i[s]=2-2*s/(n-1);return i}case e.Blackman:{let a=2*o,s=4*o;for(let l=0;l<n;++l)i[l]=.42323-.49755*Math.cos(a*l)+.07922*Math.cos(s*l);return i}case e.BlackmanHarris:{let a=2*o,s=4*o,l=6*o;for(let u=0;u<n;++u)i[u]=.35875-.48829*Math.cos(a*u)+.14128*Math.cos(s*u)-.01168*Math.cos(l*u);return i}case e.Hamming:{let a=2*o;for(let s=0;s<n;++s)i[s]=.54-.46*Math.cos(a*s);return i}case e.Hanning:{let a=2*o;for(let s=0;s<n;++s)i[s]=.5-.5*Math.cos(a*s);return i}}}})(Vp||(Vp={}));var Dg=class extends AudioWorkletProcessor{#e;#t;#r;#i;#n;#o=0;constructor({processorOptions:{sab:e,numberOfChannels:t,rmsWindowInSeconds:n,valueDecay:i}}){super(),this.#e=t,this.#t=new Float32Array(t),this.#r=new Float32Array(t),this.#i=U.create(()=>new Lc(sampleRate*n),t);let o=xr.createBuilder({peak:xr.floats(t),rms:xr.floats(t)})();this.#n=Vc.writer(o,e,a=>{let s=Math.exp(-(128*this.#o)/(sampleRate*i));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 n=e[t];if(n===void 0)this.#t[t]=0,this.#r[t]=0;else{let i=this.#i[t],o=this.#t[t],a=this.#r[t];for(let s=0;s<fe;++s){let l=n[s];o=Math.max(o,Math.abs(l)),a=Math.max(a,i.pushPop(l*l))}this.#t[t]=o,this.#r[t]=a}}return this.#o++,this.#n.tryWrite(),!0}};var Me=class r{static newSet(e){return new Cc(e,r.Comparator)}static compose=(e,...t)=>{let n=t.length===0?this.#e:new Int16Array(t);return V(n.every((i,o)=>i===t[o]),`fieldKeys (${n.join(",")}) only allows i16`),new r(e,n)};static decode(e){let t=e.split("/");return V(t.length>0,"Unable to parse Address"),r.compose(b.parse(t[0]),...t.slice(1).map(n=>parseInt(n)))}static reconstruct(e){return this.compose(e[0],...e[1])}static boxRange(e,t,n){let i=e.values(),o=ct.leftMostMapped(i,t,b.Comparator,n),a=i.length;if(o<0||o>=a)return null;for(let s=o;s<a;s++)if(b.Comparator(n(i[s]),t)!==0)return o<s?[o,s]:null;return[o,a]}static Comparator=(e,t)=>{let n=b.Comparator(e.#t,t.#t);if(n!==0)return n;let i=Math.min(e.#r.length,t.#r.length);for(let o=0;o<i;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 n=b.Comparator(e.#t,t.#t);if(n!==0)return n;let i=Math.min(e.#r.length,t.#r.length);for(let o=0;o<i;o++){let a=e.#r[o]-t.#r[o];if(a!==0)return a}return 0};static LengthComparator=(e,t)=>{let n=b.Comparator(e.#t,t.#t);return n!==0?n: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 b.Comparator(e.#t,this.#t)===0&&e.#r.length<=this.#r.length&&e.#r.every((t,n)=>this.#r[n]===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(b.length+this.#r.length);return e.set(this.#t,0),e.set(this.#r,b.length),e.buffer}toString(){return[b.toString(this.#t),...this.#r].join("/")}static read(e){let t=b.fromDataInput(e),n=e.readByte();return r.compose(t,...U.create(()=>e.readShort(),n))}},Xs;(function(r){r.AddressReader=e=>e.address,r.Comparator=({address:e},{address:t})=>Me.Comparator(e,t),r.equals=(e,t)=>{let[n,i]=ct.rangeMapped(t,e,Me.Comparator,r.AddressReader);return t.slice(n,i+1)},r.startsWith=(e,t)=>{let[n,i]=ct.rangeMapped(t,e,Me.MinimalComparator,r.AddressReader);return t.slice(n,i+1).filter(o=>o.address.startsWith(e))},r.endsWith=(e,t)=>{let n=ct.leftMostMapped(t,e,Me.LengthComparator,r.AddressReader),i=ct.rightMostMapped(t,e,Me.MinimalComparator,r.AddressReader);return t.slice(n,i+1).filter(o=>e.startsWith(o.address))}})(Xs||(Xs={}));var bo=class r{static validate(e,t){if(e.address.equals(t.address))return m.wrap(`PointerField cannot point to itself: ${e}`);if(!t.pointerRules.accepts.some(n=>n===e.pointerType)){let n=t.pointerRules.accepts.join(", ");return m.wrap(`${String(e.pointerType)} does not satisfy any of the allowed types (${n}).`)}return m.None}#e;#t;constructor(e){this.#e=e,this.#t=new ar}subscribe(e,...t){return this.#r(this.#t,e,t)}catchupAndSubscribe(e,...t){let n=Me.newSet(i=>i.address);return n.addMany(this.filter(...t)),n.forEach(i=>e.onAdded(i)),this.subscribe({onAdded:i=>{n.add(i)&&e.onAdded(i)},onRemoved:i=>{n.removeByKey(i.address),e.onRemoved(i)}},...t)}filter(...e){return e.length===0?this.incoming():ht.filter(this.incoming().values(),t=>e.some(n=>n===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 D(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,n){return e.subscribe({onAdded:i=>{(n.length===0||n.some(o=>o===i.pointerType))&&t.onAdded(i)},onRemoved:i=>{(n.length===0||n.some(o=>o===i.pointerType))&&t.onRemoved(i)}})}};var aA=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Kc=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Y=class r{static hook(e){return new r(e)}#e;#t;#r;#i;#n;constructor({parent:e,fieldKey:t,fieldName:n,pointerRules:i,deprecated:o}){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=o,(i.mandatory||i.exclusive)&&this.graph.edges().watchVertex(this)}accept(e){return P(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 bo(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 U.empty()}record(){return _i.empty()}getField(e){return D()}optField(e){return m.None}read(e){}write(e){}toJSON(){}fromJSON(e){return D("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)&&(console.warn(`[Field.disconnect] Deleting ${t.box} because pointer.mandatory=${t.mandatory} or (field.mandatory=${this.pointerRules.mandatory} and lastPointer=${e.length===1})`),t.box.delete())})}toString(){return`{${this.box.constructor.name}:${this.constructor.name} (${this.fieldName}) ${this.address.toString()}`}};aA([kc,Kc("design:type",bo),Kc("design:paramtypes",[])],Y.prototype,"pointerHub",null);aA([kc,Kc("design:type",Me),Kc("design:paramtypes",[])],Y.prototype,"address",null);aA([kc,Kc("design:type",String),Kc("design:paramtypes",[])],Y.prototype,"debugPath",null);var f=Object.freeze({mandatory:!1,exclusive:!1,accepts:[]});var Mg=class r extends Y{static create(e,t,n){return new r(e,t,n)}#e;constructor(e,t,n){super(e),this.#e=U.create(i=>t({parent:this,fieldKey:i,fieldName:String(i),pointerRules:f,deprecated:e.deprecated}),n)}accept(e){return P(e.visitArrayField,this)}fields(){return this.#e}record(){return U.toRecord(this.#e,e=>String(e.fieldKey))}getField(e){return he(this.#e[e])}optField(e){return m.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,n)=>this.#e[n].fromJSON(t));else return D("Type mismatch")}};var Va;(function(r){r.writeFields=(t,n)=>{let i=Object.entries(n).filter(([o,a])=>!a.deprecated);t.writeInt(1179403347),t.writeShort(i.length),i.forEach(([o,a])=>{let s=or.create();a.write(s);let l=new Int8Array(s.toArrayBuffer());t.writeShort(Number(o)),t.writeInt(l.length),t.writeBytes(l)})},r.readFields=(t,n)=>{V(t.readInt()===1179403347,"Serializer header is corrupt");let i=t.readShort();for(let o=0;o<i;o++){let a=t.readShort();if(Ic(n[a]))continue;let s=t.readInt(),l=new Int8Array(s);t.readBytes(l);let{status:u,error:p}=ho(()=>n[a]?.read(new wt(l.buffer)));u==="failure"&&console.warn(n,p)}}})(Va||(Va={}));var Pk=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},sB=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},M=class r{static DEBUG_DELETION=!1;static Index=0;#e;#t;#r;#i;#n;#o;#a;#s=r.Index++;constructor({uuid:e,graph:t,name:n,pointerRules:i,resource:o,ephemeral:a}){this.#e=Me.compose(e),this.#t=t,this.#r=n,this.#i=i,this.#n=o,this.#o=a===!0,this.#a=this.initializeFields(),(i.mandatory||i.exclusive)&&this.graph.edges().watchVertex(this)}fields(){return Object.values(this.#a)}record(){return this.#a}getField(e){return he(this.#a[e],()=>`Field ${String(e)} not found in ${this.toString()}`)}optField(e){return m.wrap(this.#a[e])}subscribe(e,t){return this.graph.subscribeVertexUpdates(e,this.address,t)}subscribeDeletion(e){return this.graph.subscribeDeletion(this.address.uuid,e)}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 resource(){return this.#n}get ephemeral(){return this.#o}get creationIndex(){return this.#s}get pointerHub(){return new bo(this)}estimateMemory(){let e=new Mc;return this.write(e),e.count}isBox(){return!0}asBox(e){return Ce(this,e)}isField(){return!1}isAttached(){return this.#t.findBox(this.address.uuid).nonEmpty()}read(e){Va.readFields(e,this.#a)}write(e){Va.writeFields(e,this.#a)}serialize(){let e=or.create();return e.writeInt(this.#s),e.writeString(this.name),e.writeBytes(new Int8Array(this.address.uuid.buffer)),this.write(e),e.toArrayBuffer()}toArrayBuffer(){let e=or.create();return this.write(e),e.toArrayBuffer()}toJSON(){return Object.entries(this.#a).reduce((e,[t,n])=>{let i=n.toJSON();return q(i)&&(e[t]=i),e},{})}fromJSON(e){if(og(e))Object.entries(e).forEach(([t,n])=>{let i=this.#a[parseInt(t)];q(n)&&i.fromJSON(n)});else return D("Type mismatch")}incomingEdges(){return this.graph.edges().incomingEdgesOf(this)}outgoingEdges(){return this.graph.edges().outgoingEdgesOf(this)}mapFields(e,...t){if(t.length===0)return U.empty();let n=this.getField(t[0]),i=[e(n)];for(let o=1;o<t.length;o++)n=n.getField(t[o]),i.push(e(n));return i}searchVertex(e){if(e.length===0)return m.wrap(this);let t=this.optField(e[0]);if(t.isEmpty())return m.None;for(let n=1;n<e.length;n++)if(t=t.unwrap().optField(e[n]),t.isEmpty())return m.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(n=>n.toString()).join(`
2
2
  `)),console.debug(" unstages",[...e].map(n=>n.toString()).join(`
3
- `),this));for(let n of t)n.defer();for(let n of e)n.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(n=>n.accept({visitPointerField:i=>!i.mandatory||i.nonEmpty(),visitArrayField:i=>e(i.fields()),visitObjectField:i=>e(i.fields()),visitPrimitiveField:i=>!0,visitField:i=>!0})??!0);return e(this.fields())}toString(){return`${this.constructor.name} ${this.address.toString()}`}};Pk([kc,sB("design:type",bo),sB("design:paramtypes",[])],M.prototype,"pointerHub",null);var Jp;(function(r){r.clampInt32=(e,t)=>t,r.clampFloat32=(e,t)=>t})(Jp||(Jp={}));var Ue;(function(r){r[r.This=0]="This",r[r.Parent=1]="Parent",r[r.Children=2]="Children"})(Ue||(Ue={}));var kg;(function(r){r.create=()=>new sA})(kg||(kg={}));var sA=class{#e=new Qp(Xs.equals);#t=new Qp(Xs.startsWith);#r=new Qp(Xs.endsWith);#i=[];#n=0;#o=!1;subscribe(e,t,n){let i=new lA(t,e,this.#n++,n);if(this.#o){let o=new cA(i,e);return this.#i.push(o),o}else return this.subscribeMonitor(i,e)}dispatch(e){this.#o=!0,[...this.#e.filter(e),...this.#t.filter(e),...this.#r.filter(e)].sort(({order:n},{order:i})=>n-i).forEach(n=>n.procedure(e)),this.#o=!1,this.#i.forEach(n=>n.subscribe(this)),this.#i.length=0}subscribeMonitor(e,t){switch(t){case Ue.This:return this.#e.subscribe(e);case Ue.Parent:return this.#t.subscribe(e);case Ue.Children:return this.#r.subscribe(e);default:return ag(t)}}countStations(){return this.#e.count()+this.#t.count()+this.#r.count()}},lA=class{address;propagation;order;procedure;constructor(e,t,n,i){this.address=e,this.propagation=t,this.order=n,this.procedure=i}toString(){return`{ Monitor address: ${this.address}, propagation: ${Ue[this.propagation]}, order: ${this.order} }`}},Qp=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(Xs.Comparator),this.#t=!0),this.#e}filter(e){return this.filterStrategy(e.address,this.stations())}count(){return this.#e.length}},cA=class{monitor;propagation;#e=new j;#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 Ot;(function(r){r.Boolean="boolean",r.Float32="float32",r.Int32="int32",r.String="string",r.Bytes="bytes"})(Ot||(Ot={}));var tl={[Ot.Boolean]:{type:Ot.Boolean,encode:(r,e)=>r.writeBoolean(e),decode:r=>r.readBoolean()},[Ot.Float32]:{type:Ot.Float32,encode:(r,e)=>r.writeFloat(e),decode:r=>r.readFloat()},[Ot.Int32]:{type:Ot.Int32,encode:(r,e)=>r.writeInt(e),decode:r=>r.readInt()},[Ot.String]:{type:Ot.String,encode:(r,e)=>r.writeString(e),decode:r=>r.readString()},[Ot.Bytes]:{type:Ot.Bytes,encode:(r,e)=>{r.writeInt(e.length),r.writeBytes(e)},decode:r=>{let e=new Int8Array(r.readInt());return r.readBytes(e),e}}},el=class extends Y{#e;#t;#r;constructor(e,t,n){super(e),this.#e=t,this.#t=n,this.#r=this.#t}accept(e){return P(e.visitPrimitiveField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.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){V(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,n=this.clamp(e);this.equals(n)||(this.#r=n,this.graph.onPrimitiveValueUpdate(this,t,n))}writeValue(e,t){V(!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)?D("not implemented"):e}fromJSON(e){return D("Type mismatch")}reset(){this.setValue(this.#t)}},k=class r extends el{static create(e,t=!1){return new r(e,t)}constructor(e,t){super(e,Ot.Boolean,t)}toggle(){this.setValue(!this.getValue())}serialization(){return tl[Ot.Boolean]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readBoolean())}write(e){V(!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()))}},w=class r extends el{static create(e,t,n,i=0){return new r(e,t,n,i)}#e;#t;constructor(e,t,n,i){super(e,Ot.Float32,i),this.#e=t,this.#t=n}serialization(){return tl[Ot.Float32]}equals(e){return this.getValue()===e}clamp(e){return Jp.clampFloat32(this.#e,ra.toFloat32(e))}read(e){this.setValue(e.readFloat())}write(e){V(!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 el{static create(e,t,n,i=0){return new r(e,t,n,i)}#e;#t;constructor(e,t,n,i){super(e,Ot.Int32,i),this.#e=t,this.#t=n}serialization(){return tl[Ot.Int32]}equals(e){return this.getValue()===e}clamp(e){return Jp.clampInt32(this.#e,yr.toInt(e))}read(e){this.setValue(e.readInt())}write(e){V(!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>=yr.MIN_VALUE&&e<=yr.MAX_VALUE?this.setValue(e):console.warn("Int32Field Type mismatch",e,this.address.toString()))}},C=class r extends el{static create(e,t=""){return new r(e,t)}constructor(e,t){super(e,Ot.String,t)}serialization(){return tl[Ot.String]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readString())}write(e){V(!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()))}},lB=class r extends el{static create(e,t=this.#e){return new r(e,t)}static#e=Object.freeze(new Int8Array(0));constructor(e,t){super(e,Ot.Bytes,t)}serialization(){return tl[Ot.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){V(!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 cB;(function(r){r.decode=e=>{let t=e.readInt();return U.create(()=>{switch(e.readString()){case"new":{let i=b.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new rl(i,o,a.buffer)}case"pointer":{let i=Me.read(e),o=e.readBoolean()?m.wrap(Me.read(e)):m.None,a=e.readBoolean()?m.wrap(Me.read(e)):m.None;return new Xp(i,o,a)}case"primitive":{let i=Me.read(e),o=e.readString(),a=tl[o],s=a.decode(e),l=a.decode(e);return new Yp(i,a,s,l)}case"delete":{let i=b.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new il(i,o,a.buffer)}}},t)}})(cB||(cB={}));var rl=class{type="new";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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 wt(this.#r)))}inverse(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}write(e){e.writeString(this.type),b.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{NewUpdate uuid: ${b.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}toDebugString(e){return this.toString()}},Yp=class{type="primitive";#e;#t;#r;#i;constructor(e,t,n,i){this.#e=e,this.#t=t,this.#r=n,this.#i=i}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}`}},Xp=class{type="pointer";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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()}`}},il=class{type="delete";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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 wt(this.#r)))}write(e){e.writeString(this.type),b.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{DeleteUpdate uuid: ${b.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}};var rz=Symbol("Unreferenceable"),N=class r extends Y{static create(e,t,n){return new r(e,t,n)}static encodeWith(e,t){V(this.#e.isEmpty(),"SerializationEncoder already in use"),this.#e=m.wrap(e);let n=ho(t);if(this.#e=m.None,n.status==="failure")throw n.error;return n.value}static decodeWith(e,t){V(this.#t.isEmpty(),"SerializationDecoder already in use"),this.#t=m.wrap(e);let n=ho(t);if(this.#t=m.None,n.status==="failure")throw n.error;return n.value}static#e=m.None;static#t=m.None;#r;#i;#n=m.None;#o=m.None;constructor(e,t,n){super(e),this.#r=t,this.#i=n,n&&this.graph.edges().watchVertex(this)}get pointerHub(){return D(`${this} cannot be pointed to`)}get pointerType(){return this.#r}get mandatory(){return this.#i}accept(e){return P(e.visitPointerField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.This,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}refer(e){this.targetVertex=m.wrap(e)}defer(){this.targetVertex=m.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=bo.validate(this,e.unwrap());t.nonEmpty()&&D(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()?m.wrap(Me.read(e)):m.None;this.targetAddress=r.#t.match({none:()=>t,some:n=>n.map(this,t)})}write(e){V(!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(uo(e)||typeof e=="string"){let t=m.wrap(uo(e)?null:Me.decode(e));this.targetAddress=r.#t.match({none:()=>t,some:n=>n.map(this,t)})}else return D(`Pointer at (${this.address}) has type mismatch. value (${e}) must be a string, but is ${typeof e}.`)}};var $g=class{#e;#t;#r;#i;#n;constructor(){this.#e=Me.newSet(e=>e.address),this.#t=Me.newSet(e=>e.address),this.#r=Me.newSet(e=>e.address),this.#i=Me.newSet(([e])=>e),this.#n=Me.newSet(([e])=>e.address)}watchVertex(e){if(pt(e,N)){if(!e.mandatory)return D("watchVertex called but has no edge requirement");this.#e.add(e)}else{let{mandatory:t,exclusive:n}=e.pointerRules;if(!t&&!n)return D("watchVertex called but has no edge requirement");t&&this.#t.add(e),n&&this.#r.add(e)}}unwatchVerticesOf(...e){let t=({box:{address:{uuid:n}}})=>n;for(let{address:{uuid:n}}of e)this.#a(this.#e,n,t),this.#a(this.#t,n,t),this.#a(this.#r,n,t);for(let n of e){let i=this.outgoingEdgesOf(n);if(i.length>0)return D(`${n} has outgoing edges: ${i.map(([a,s])=>`[${a.toString()}, ${s.toString()}]`)}`);let o=this.incomingEdgesOf(n);if(o.length>0)return D(`${n} has incoming edges from: ${o.map(a=>a.toString())}`)}}connect(e,t){this.#n.add([e,t]),this.#i.opt(t).match({none:()=>this.#i.add([t,[e]]),some:([,n])=>n.push(e)})}disconnect(e){let[,t]=this.#n.removeByKey(e.address),[,n]=this.#i.get(t);U.remove(n,e),n.length===0&&this.#i.removeByKey(t)}isConnected(e,t){return this.#n.opt(e.address).mapOr(([,n])=>n.equals(t),!1)}outgoingEdgesOf(e){return this.#o(this.#n,e.address.uuid,([{box:{address:{uuid:t}}}])=>t)}incomingEdgesOf(e){return e.isBox()?this.#o(this.#i,e.address.uuid,([{uuid:t}])=>t).flatMap(([t,n])=>n):this.#i.opt(e.address).mapOr(([t,n])=>n,U.empty())}validateRequirements(){this.#e.forEach(e=>{if(e.isEmpty())return e.mandatory?(console.warn(`[GraphEdges] Validation failed: Pointer ${e.toString()} requires an edge.`),D(`Pointer ${e.toString()} requires an edge.`)):D(`Illegal state: ${e} has no edge requirements.`)}),this.#t.forEach(e=>{if(e.pointerHub.isEmpty())return e.pointerRules.mandatory?(console.warn(e),console.warn(`[GraphEdges] Validation failed: Target ${e.toString()} requires an edge.`),D(`Target ${e.toString()} requires an edge.`)):D(`Illegal state: ${e} has no edge requirements.`)}),this.#r.forEach(e=>{let t=e.pointerHub.size();if(t>1)return console.warn(`[GraphEdges] Validation failed: Target ${e.toString()} is exclusive but has ${t} incoming pointers.`),D(`Target ${e.toString()} is exclusive but has ${t} incoming pointers.`)})}#o(e,t,n){let i=Me.boxRange(e,t,n);return q(i)?e.values().slice(i[0],i[1]):U.empty()}#a(e,t,n){let i=Me.boxRange(e,t,n);q(i)&&e.removeRange(i[0],i[1])}};var nl=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p=!1;#d=!1;constructor(e=m.None){this.#e=e,this.#t=b.newSet(t=>t.address.uuid),this.#r=[],this.#a=kg.create(),this.#i=new ar,this.#n=new ar,this.#o=new ar,this.#s=new $g,this.#l=Me.newSet(({pointer:t})=>t.address),this.#c=[],this.#u=b.newSet(t=>t.uuid)}beginTransaction(){V(!this.#p,"Transaction already in progress"),this.#p=!0,this.#o.proxy.onBeginTransaction()}endTransaction(){for(V(this.#p,"No transaction in progress"),this.#r.length>0&&(this.#r.forEach(({pointerField:e,update:t})=>this.#f(e,t)),this.#r.length=0),this.#l.values().toSorted((e,t)=>e.index-t.index).forEach(({pointer:e,initial:t,final:n})=>{t.equals(n)||(t.ifSome(i=>this.findVertex(i).unwrapOrUndefined()?.pointerHub.onRemoved(e)),n.ifSome(i=>this.findVertex(i).unwrapOrUndefined()?.pointerHub.onAdded(e)))}),this.#l.clear(),this.#p=!1;this.#c.length>0;)this.#c.splice(0).forEach(e=>e()),this.#c.length>0&&console.debug(`${this.#c.length} new observers while notifying`);this.#o.proxy.onEndTransaction()}inTransaction(){return this.#p}constructingBox(){return this.#d}createBox(e,t,n){return this.#e.unwrap("No box-factory installed")(e,this,t,n)}stageBox(e,t){this.#g(),V(!this.#d,"Cannot construct box while other box is constructing"),q(t)&&(this.#d=!0,t(e),this.#d=!1);let n=this.#t.add(e);V(n,()=>`${e.name} ${e.address.toString()} already staged`);let i=new rl(e.address.uuid,e.name,e.toArrayBuffer());return this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i),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,n){return this.#a.subscribe(e,t,n)}subscribeEndTransaction(e){this.#c.push(e)}subscribeDeletion(e,t){let n=this.#u.getOrCreate(e,()=>({uuid:e,listeners:new Set}));return n.listeners.add(t),{terminate:()=>{n.listeners.delete(t),n.listeners.size===0&&this.#u.removeByKeyIfExist(e)}}}unstageBox(e){this.#g();let t=this.#t.removeByKey(e.address.uuid);V(t===e,`${e} could not be found to unstage`),this.#s.unwatchVerticesOf(e);let n=new il(e.address.uuid,e.name,e.toArrayBuffer());this.#u.removeByKeyIfExist(e.address.uuid)?.listeners.forEach(i=>i()),this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n)}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.#s}checksum(){let e=new ug;return this.boxes().forEach(t=>t.write(e)),e.result()}onPrimitiveValueUpdate(e,t,n){if(this.#g(),e.isAttached()&&!this.#d){let i=new Yp(e.address,e.serialization(),t,n);this.#a.dispatch(i),this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i)}}onPointerAddressUpdated(e,t,n){this.#g(),t.nonEmpty()&&this.#s.disconnect(e),n.nonEmpty()&&this.#s.connect(e,n.unwrap());let i=new Xp(e.address,t,n);this.#d?this.#r.push({pointerField:e,update:i}):(this.#f(e,i),this.#n.proxy.onUpdate(i))}#f(e,t){let{oldAddress:n,newAddress:i}=t;e.resolvedTo(i.flatMap(a=>this.findVertex(a))),this.#l.opt(e.address).match({none:()=>this.#l.add({pointer:e,initial:n,final:i,index:this.#l.size()}),some:a=>a.final=i}),this.#a.dispatch(t),this.#i.proxy.onUpdate(t)}findOrphans(e){let t=this.#h(e);return this.boxes().filter(n=>!t.has(n))}#h(e){let t=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!t.has(i)){t.add(i),this.#m(i).forEach(o=>{o.targetAddress.ifSome(a=>{this.findBox(a.uuid).ifSome(s=>{t.has(s)||n.push(s)})})});for(let o of i.incomingEdges())t.has(o.box)||n.push(o.box)}}return t}#m(e){let t=[],n=i=>{for(let o of i)o.accept({visitPointerField:a=>t.push(a),visitObjectField:a=>n(a.fields()),visitArrayField:a=>n(a.fields())})};return n(e.fields()),t}dependenciesOf(e,t={}){let n=q(t.excludeBox)?t.excludeBox:Tc.alwaysFalse,i=q(t.alwaysFollowMandatory)?t.alwaysFollowMandatory:!1,o=q(t.stopAtResources)?t.stopAtResources:!1,a=new Set,s=new Set,l=(p,d=!1)=>{if(!(a.has(p)||!d&&n(p))){if(a.add(p),o&&q(p.resource)){p.incomingEdges().forEach(h=>{s.add(h);let g=h.targetAddress.mapOr(v=>!v.isBox(),!1);if(h.mandatory&&g){if(p.resource==="shared"&&h.targetAddress.flatMap(y=>this.findVertex(y)).mapOr(y=>y.pointerRules.mandatory,!1))return;l(h.box)}});return}p.outgoingEdges().filter(([h])=>!s.has(h)).forEach(([h,g])=>{let v=this.findVertex(g).unwrap(`Could not find target of ${h.toString()}`);if(s.add(h),v.pointerRules.mandatory&&(i||v.pointerHub.incoming().filter(y=>y.targetAddress.mapOr(x=>x.equals(g),!1)).every(y=>s.has(y))))return l(v.box)}),p.incomingEdges().forEach(h=>{s.add(h),h.mandatory&&l(h.box)})}},u=Array.isArray(e)?e:[e];return u.forEach(p=>l(p,!0)),u.forEach(p=>a.delete(p)),{boxes:a,pointers:Array.from(s).reverse()}}verifyPointers(){this.#s.validateRequirements();let e=0,t=n=>{for(let i of n.fields())i.accept({visitPointerField:o=>{if(o.targetAddress.nonEmpty()){let a=o.targetVertex.nonEmpty(),s=this.findVertex(o.targetAddress.unwrap()).nonEmpty();V(a,`pointer ${o.address} is broken`),V(s,`Cannot find target for pointer ${o.address}`),e++}},visitObjectField:o=>t(o)})};return this.#t.forEach(n=>t(n)),console.debug("verification complete."),{count:e}}debugBoxes(){console.table(this.#t.values().reduce((e,t)=>(e[b.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(n=>n.name):this.findBox(t.uuid).flatMap(n=>n.searchVertex(t.fieldKeys).map(i=>i.isField()?i.debugPath:D("Unknown address"))))}toArrayBuffer(){let e=or.create(),t=this.#t.values();return e.writeInt(t.length),t.forEach(n=>{let i=n.serialize();e.writeInt(i.byteLength),e.writeBytes(new Int8Array(i))}),e.toArrayBuffer()}fromArrayBuffer(e){V(this.#t.isEmpty(),"Cannot call fromArrayBuffer if boxes is not empty");let t=new wt(e),n=t.readInt();this.beginTransaction();let i=[];for(let o=0;o<n;o++){let a=t.readInt(),s=new Int8Array(a);t.readBytes(s);let l=new wt(s.buffer),u=l.readInt(),p=l.readString(),d=b.fromDataInput(l);i.push({creationIndex:u,name:p,uuid:d,boxStream:l})}i.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(){let e={};for(let t of this.#t.values())e[t.address.toString()]={name:t.name,fields:he(t.toJSON())};return e}fromJSON(e){if(typeof e!="object"||e===null||Array.isArray(e))return D("Expected object");this.beginTransaction();let t=Object.entries(e);for(let[n,{name:i,fields:o}]of t)this.createBox(i,b.parse(n),a=>a.fromJSON(o));this.endTransaction()}#g(){V(this.#p,()=>"Modification only prohibited in transaction mode.")}};var Wc;(function(r){r.insertOrder=(e,t=Number.MAX_SAFE_INTEGER)=>{let n=r.collectIndexedBoxes(e),i=be(t,0,n.length);if(i<n.length)for(let o=i;o<n.length;o++)n[o].index.setValue(o+1);return i},r.removeOrder=(e,t)=>{let n=r.collectIndexedBoxes(e);if(t<n.length)for(let i=t+1;i<n.length;i++)n[i].index.setValue(i-1)},r.moveIndex=(e,t,n)=>{let i=r.collectIndexedBoxes(e),o=i[t];if(n<0){let a=be(t+n,0,i.length-1);for(let s=a;s<t;s++)i[s].index.setValue(s+1);o.index.setValue(a)}else if(n>1){let a=be(t+(n-1),0,i.length-1);for(let s=t;s<a;s++)i[s+1].index.setValue(s);o.index.setValue(a)}else console.warn(`moveIndex had no effect: startIndex: ${t}, delta: ${n}`)},r.isIndexedBox=e=>"index"in e&&e.index instanceof E,r.collectIndexedBoxes=(e,t)=>e.pointerHub.incoming().map(({box:n})=>r.isIndexedBox(n)&&(t===void 0||n instanceof t)?n:D(`${n} has no index field`)).sort((n,i)=>n.index.getValue()-i.index.getValue())})(Wc||(Wc={}));var qe=class extends Y{#e;constructor(e){super(e),this.#e=this.initializeFields()}accept(e){return P(e.visitObjectField,this)}fields(){return Object.values(this.#e)}record(){return this.#e}getField(e){return he(this.#e[e])}optField(e){return m.wrap(this.#e[e])}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.Children,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}read(e){Va.readFields(e,this.#e)}write(e){Va.writeFields(e,this.#e)}toJSON(){if(!this.deprecated)return Object.entries(this.#e).reduce((e,[t,n])=>(e[t]=n.toJSON(),e),{})}fromJSON(e){if(!this.deprecated)if(og(e))Object.entries(e).forEach(([t,n])=>{let i=this.#e[parseInt(t)];q(n)&&i.fromJSON(n)});else return D("Type mismatch")}};var In;(function(r){class e{value;constructor(s){this.value=s}}r.Transfer=e,r.makeTransferable=a=>new e(a),r.sender=(a,s)=>s(new i(a)),r.executor=(a,s)=>new o(a,s);let t=a=>{let s=[];for(let l of a)l instanceof e?s.push(l.value):(l instanceof MessagePort||typeof ImageBitmap<"u"&&l instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&l instanceof OffscreenCanvas)&&s.push(l);return s},n=a=>a instanceof e?a.value:a;class i{#e;#t=new Map;#r;#i=0;constructor(s){this.#e=s,this.#r=s.subscribe(this.#n)}terminate(){this.#r.terminate()}dispatchAndForget=(s,...l)=>{let u=t(l);this.#e.send({type:"send",returnId:!1,func:s.name,args:Array.from(ht.map(l,p=>({value:n(p)})))},u)};dispatchAndReturn=(s,...l)=>new Promise((u,p)=>{let d=ht.reduce(l,(g,v,y)=>(typeof v=="function"&&g.push([y,v]),g),[]);this.#t.set(this.#i,{executorTuple:{resolve:u,reject:p},callbacks:new Map(d)});let h=t(l);this.#e.send({type:"send",returnId:this.#i,func:s.name,args:Array.from(ht.map(l,(g,v)=>typeof g=="function"?{callback:v}:{value:n(g)}))},h),this.#i++});#n=s=>{let l=this.#t.get(s.returnId);q(l)?s.type==="resolve"?(l.executorTuple.resolve(s.resolve),this.#t.delete(s.returnId)):s.type==="reject"?(l.executorTuple.reject(s.reject),this.#t.delete(s.returnId)):s.type==="callback"&&l.callbacks?.get(s.funcAt).apply(this,s.args):D(`Promise has already been resolved. ${JSON.stringify(s)}`)}}class o{#e;#t;#r;constructor(s,l){this.#e=s,this.#t=l,this.#r=s.subscribe(this.#i)}terminate(){this.#r.terminate()}#i=s=>{V(s.type==="send",()=>"Message type must be 'send'");let l=Object.getPrototypeOf(this.#t)===Object.getPrototypeOf({})?this.#t:Object.getPrototypeOf(this.#t),u=he(l[s.func],`${s.func.toString()} does not exists on ${this.#t}`),p=s.returnId;if(p===!1)u.apply(this.#t,s.args.map(d=>"value"in d?d.value:D(`${s.func.toString()} has no promise.`)));else try{u.apply(this.#t,s.args.map(h=>"callback"in h?(...g)=>this.#a(p,h.callback,g):h.value)).then(h=>{try{this.#n(p,h)}catch(g){this.#o(p,g)}},h=>this.#o(p,h))}catch(d){this.#o(p,d)}};#n=(s,l)=>this.#e.send({type:"resolve",returnId:s,resolve:l});#o=(s,l)=>this.#e.send({type:"reject",returnId:s,reject:l});#a=(s,l,u)=>this.#e.send({type:"callback",returnId:s,funcAt:l,args:u})}r.Executor=o})(In||(In={}));var uB={for:r=>new uA(r)},Sk=[],uA=class{#e;#t=new ce;constructor(e){if(this.#e=e,q(e.onmessage)||q(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??Sk)}channel(e){return new dA(this,e)}subscribe(e){return this.#t.subscribe(e)}terminate(){this.#t.terminate(),this.#e.onmessage=null,this.#e.onmessageerror=null}},dA=class r{#e;#t;#r=new ce;#i;constructor(e,t){this.#e=e,this.#t=t,this.#i=e.subscribe(n=>{"__id__"in n&&n.__id__==="42"&&"message"in n&&"channel"in n&&n.channel===t&&this.#r.notify(n.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 eh;(function(r){r.frame=()=>new Promise(e=>requestAnimationFrame(()=>e())),r.frames=e=>new Promise(t=>{let n=e,i=()=>{--n<=0?t():requestAnimationFrame(i)};requestAnimationFrame(i)}),r.timeSpan=(e,...t)=>new Promise(n=>setTimeout(n,e.millis(),...t)),r.event=(e,t)=>new Promise(n=>e.addEventListener(t,n,{once:!0})),r.observable=e=>new Promise(t=>{let n=e.subscribe(()=>{n.terminate(),t()})}),r.complete=e=>new Promise((t,n)=>{let i=setInterval(()=>{let{status:o,value:a,error:s}=ho(()=>e.next());if(o==="success"){let{done:l,value:u}=a;l&&(clearInterval(i),t(u))}else clearInterval(i),n(s)},0)})})(eh||(eh={}));var pA=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)}},Tg;(function(r){class e{value;status="resolved";constructor(s){this.value=s}error=Gs("Cannot access error when promise is resolved")}r.ResolveResult=e;class t{error;status="rejected";constructor(s){this.error=s}value=Gs("Cannot access value when promise is rejected")}r.RejectedResult=t,r.makeAbortable=async(a,s)=>{let l=!0;return a.own(ee.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 n=new pA(3,jp.seconds(3));r.retry=(a,s=n)=>a().catch(l=>new Promise((u,p)=>{let d=h=>{s.retry(h,()=>a().then(g=>u(g),d))||p(h)};d(l)})),r.guardedRetry=(a,s)=>{let l=async(u=0)=>{try{return await a()}catch(p){if(s(p,++u))return console.debug(`retry after failure (online: ${navigator.onLine}):`,p),await eh.timeSpan(jp.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 Oc.approve(s(u)))return l();throw u}};return l()},r.delay=(a,s)=>Promise.all([a,eh.timeSpan(s)]).then(([l])=>l),r.fail=(a,s="fail")=>Promise.reject(s),r.timeout=(a,s,l)=>new Promise((u,p)=>{let d=!0,h=setTimeout(()=>{d=!1,p(new Error(l??"timeout"))},s.millis());a.then(g=>{d&&u(g)},g=>{d&&p(g)}).finally(()=>clearTimeout(h))}),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(uo(l)||q(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 h=u++;try{let g=await a[h]();p||(l[h]=g)}catch(g){throw p=!0,g}}};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 h=await a[d]();l[d]={status:"fulfilled",value:h}}catch(h){l[d]={status:"rejected",reason:h}}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},p)),l};class i{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(V(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=i;class o{#e;#t;#r;#i=m.None;constructor(s,l,u){this.#e=s,this.#t=l,this.#r=u}update(s){this.#i=m.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(),P(this.#r))})}terminate(){this.#i=m.None}}r.Latest=o})(Tg||(Tg={}));var dB=(r,e)=>In.executor(e,new class{sendUpdates(t){r.beginTransaction(),t.forEach(n=>{let i=n.type;i==="new"?r.createBox(n.name,n.uuid,o=>o.read(new wt(n.buffer))):i==="update-primitive"?r.findVertex(Me.reconstruct(n.address)).unwrap(()=>`Could not find primitive field ${n.address}`).setValue(n.value):i==="update-pointer"?r.findVertex(Me.reconstruct(n.address)).unwrap(()=>`Could not find pointer field ${n.address}`).targetAddress=q(n.target)?m.wrap(Me.reconstruct(n.target)):m.None:n.type==="delete"&&r.unstageBox(r.findBox(n.uuid).unwrap(()=>`Could not find box ${b.toString(n.uuid)}`))}),r.endTransaction()}checksum(t){return U.equals(r.checksum(),t)?Promise.resolve():Promise.reject("Checksum mismatch")}});var ol;(function(r){r.create=(e,t,n,i)=>{switch(e){case"MetaDataBox":return Dn.create(t,n,i);case"RootBox":return Zc.create(t,n,i);case"SelectionBox":return al.create(t,n,i);case"UserInterfaceBox":return sl.create(t,n,i);case"UploadFileBox":return Rg.create(t,n,i);case"ShadertoyBox":return Cg.create(t,n,i);case"MIDIControllerBox":return Og.create(t,n,i);case"TimelineBox":return ll.create(t,n,i);case"TrackBox":return Zr.create(t,n,i);case"NoteEventBox":return za.create(t,n,i);case"NoteEventRepeatBox":return Vg.create(t,n,i);case"NoteEventCollectionBox":return aa.create(t,n,i);case"NoteRegionBox":return cl.create(t,n,i);case"NoteClipBox":return Gc.create(t,n,i);case"ValueEventBox":return Mn.create(t,n,i);case"ValueEventCollectionBox":return kn.create(t,n,i);case"ValueEventCurveBox":return Ua.create(t,n,i);case"ValueRegionBox":return ul.create(t,n,i);case"ValueClipBox":return qc.create(t,n,i);case"SignatureEventBox":return Hc.create(t,n,i);case"AudioRegionBox":return ja.create(t,n,i);case"AudioClipBox":return Jc.create(t,n,i);case"AudioPitchStretchBox":return Qc.create(t,n,i);case"AudioTimeStretchBox":return Yc.create(t,n,i);case"TransientMarkerBox":return zg.create(t,n,i);case"WarpMarkerBox":return La.create(t,n,i);case"MarkerBox":return Xc.create(t,n,i);case"AudioFileBox":return br.create(t,n,i);case"SoundfontFileBox":return Ao.create(t,n,i);case"NeuralAmpModelBox":return Ug.create(t,n,i);case"AudioUnitBox":return yt.create(t,n,i);case"CaptureAudioBox":return Ka.create(t,n,i);case"CaptureMidiBox":return Wa.create(t,n,i);case"AudioBusBox":return $n.create(t,n,i);case"AuxSendBox":return eu.create(t,n,i);case"GrooveShuffleBox":return tu.create(t,n,i);case"UnknownAudioEffectDeviceBox":return jg.create(t,n,i);case"UnknownMidiEffectDeviceBox":return Lg.create(t,n,i);case"DeviceInterfaceKnobBox":return Kg.create(t,n,i);case"ModularDeviceBox":return Wg.create(t,n,i);case"StereoToolDeviceBox":return Zg.create(t,n,i);case"MaximizerDeviceBox":return Gg.create(t,n,i);case"CompressorDeviceBox":return ru.create(t,n,i);case"GateDeviceBox":return qg.create(t,n,i);case"DelayDeviceBox":return Hg.create(t,n,i);case"CrusherDeviceBox":return Jg.create(t,n,i);case"DattorroReverbDeviceBox":return Qg.create(t,n,i);case"VelocityDeviceBox":return Yg.create(t,n,i);case"FoldDeviceBox":return Xg.create(t,n,i);case"TidalDeviceBox":return ev.create(t,n,i);case"RevampDeviceBox":return tv.create(t,n,i);case"ReverbDeviceBox":return rv.create(t,n,i);case"VaporisateurDeviceBox":return iu.create(t,n,i);case"MIDIOutputDeviceBox":return nu.create(t,n,i);case"MIDIOutputBox":return Tn.create(t,n,i);case"MIDIOutputParameterBox":return Rn.create(t,n,i);case"SoundfontDeviceBox":return ou.create(t,n,i);case"NanoDeviceBox":return au.create(t,n,i);case"PlayfieldDeviceBox":return su.create(t,n,i);case"PlayfieldSampleBox":return Za.create(t,n,i);case"TapeDeviceBox":return lu.create(t,n,i);case"ArpeggioDeviceBox":return iv.create(t,n,i);case"PitchDeviceBox":return nv.create(t,n,i);case"ZeitgeistDeviceBox":return ov.create(t,n,i);case"NeuralAmpDeviceBox":return av.create(t,n,i);case"ModularBox":return sv.create(t,n,i);case"ModuleConnectionBox":return lv.create(t,n,i);case"ModularAudioInputBox":return cv.create(t,n,i);case"ModularAudioOutputBox":return uv.create(t,n,i);case"ModuleDelayBox":return dv.create(t,n,i);case"ModuleMultiplierBox":return pv.create(t,n,i);case"ModuleGainBox":return hv.create(t,n,i);default:return D(`Unknown box class '${e}'`)}},r.deserialize=(e,t)=>{let n=new wt(t),i=n.readString(),o=b.fromDataInput(n),a=r.create(i,e,o);return a.read(n),a}})(ol||(ol={}));var pB;(function(r){r.NoSync="nosync",r.Pitch="pitch",r.Timestretch="timestretch",r.AudioFit="audiofit"})(pB||(pB={}));var hB;(function(r){r[r.Pre=0]="Pre",r[r.Post=1]="Post"})(hB||(hB={}));var Qt;(function(r){r.Instrument="instrument",r.Bus="bus",r.Aux="aux",r.Output="output"})(Qt||(Qt={}));var Ga={white:new Ht(0,0,100),blue:new Ht(189,100,65),green:new Ht(150,77,69),yellow:new Ht(60,100,84),cream:new Ht(65,20,83),orange:new Ht(31,100,73),red:new Ht(354,100,65),purple:new Ht(314,100,78),bright:new Ht(197,5,95),gray:new Ht(197,31,80),dark:new Ht(197,15,60),shadow:new Ht(197,10,45),black:new Ht(197,10,16),background:new Ht(197,6,7),panelBackground:new Ht(197,14,10),panelBackgroundBright:new Ht(197,10,17),panelBackgroundDark:new Ht(197,14,9)};var He;(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.Browse=11]="Browse",r[r.Maximizer=12]="Maximizer",r[r.Bug=13]="Bug",r[r.Fold=14]="Fold",r[r.Checkbox=15]="Checkbox",r[r.Clips=16]="Clips",r[r.Close=17]="Close",r[r.CloudFolder=18]="CloudFolder",r[r.CollapseDown=19]="CollapseDown",r[r.Compressor=20]="Compressor",r[r.Connected=21]="Connected",r[r.Cube=22]="Cube",r[r.Cursor=23]="Cursor",r[r.Curve=24]="Curve",r[r.Dattorro=25]="Dattorro",r[r.Delete=26]="Delete",r[r.Dial=27]="Dial",r[r.DinSlot=28]="DinSlot",r[r.Disconnected=29]="Disconnected",r[r.Divide=30]="Divide",r[r.DragConnections=31]="DragConnections",r[r.Dropdown=32]="Dropdown",r[r.Dropbox=33]="Dropbox",r[r.DrumSet=34]="DrumSet",r[r.Tidal=35]="Tidal",r[r.Duration=36]="Duration",r[r.EditBox=37]="EditBox",r[r.Effects=38]="Effects",r[r.Embed=39]="Embed",r[r.EQ=40]="EQ",r[r.Eraser=41]="Eraser",r[r.Exclude=42]="Exclude",r[r.Exit=43]="Exit",r[r.ExpandWidth=44]="ExpandWidth",r[r.FileList=45]="FileList",r[r.Film=46]="Film",r[r.Flask=47]="Flask",r[r.Focus=48]="Focus",r[r.Gate=49]="Gate",r[r.Generator=50]="Generator",r[r.GoogleDrive=51]="GoogleDrive",r[r.Groove=52]="Groove",r[r.Guitar=53]="Guitar",r[r.GuitarTab=54]="GuitarTab",r[r.Headphone=55]="Headphone",r[r.Heart=56]="Heart",r[r.Help=57]="Help",r[r.HighPass=58]="HighPass",r[r.HighShelf=59]="HighShelf",r[r.Insert=60]="Insert",r[r.Invert=61]="Invert",r[r.Info=62]="Info",r[r.Loop=63]="Loop",r[r.LoopEnd=64]="LoopEnd",r[r.LoopStart=65]="LoopStart",r[r.LowPass=66]="LowPass",r[r.LowShelf=67]="LowShelf",r[r.Magnet=68]="Magnet",r[r.MainMenu=69]="MainMenu",r[r.Maximized=70]="Maximized",r[r.Menu=71]="Menu",r[r.Merge=72]="Merge",r[r.Metronome=73]="Metronome",r[r.Microphone=74]="Microphone",r[r.Midi=75]="Midi",r[r.Minimized=76]="Minimized",r[r.Mix=77]="Mix",r[r.Mixing=78]="Mixing",r[r.Mute=79]="Mute",r[r.NanoWave=80]="NanoWave",r[r.NeuralAmp=81]="NeuralAmp",r[r.New=82]="New",r[r.NoAudio=83]="NoAudio",r[r.Note=84]="Note",r[r.NotePad=85]="NotePad",r[r.OpenDAW=86]="OpenDAW",r[r.Panel=87]="Panel",r[r.Peak=88]="Peak",r[r.Pencil=89]="Pencil",r[r.Piano=90]="Piano",r[r.Play=91]="Play",r[r.Playfield=92]="Playfield",r[r.PlayOnce=93]="PlayOnce",r[r.PlayRepeat=94]="PlayRepeat",r[r.PlayAlternate=95]="PlayAlternate",r[r.Pointer=96]="Pointer",r[r.Popout=97]="Popout",r[r.Primary=98]="Primary",r[r.Random=99]="Random",r[r.Record=100]="Record",r[r.Rectangle=101]="Rectangle",r[r.Redo=102]="Redo",r[r.Region=103]="Region",r[r.Robot=104]="Robot",r[r.RoundDown=105]="RoundDown",r[r.RoundUp=106]="RoundUp",r[r.Run=107]="Run",r[r.Sawtooth=108]="Sawtooth",r[r.Saxophone=109]="Saxophone",r[r.Scissors=110]="Scissors",r[r.Search=111]="Search",r[r.Shadertoy=112]="Shadertoy",r[r.Shutdown=113]="Shutdown",r[r.Sine=114]="Sine",r[r.Solo=115]="Solo",r[r.SoundFont=116]="SoundFont",r[r.Speaker=117]="Speaker",r[r.SpeakerHeadphone=118]="SpeakerHeadphone",r[r.Square=119]="Square",r[r.Stack=120]="Stack",r[r.Start=121]="Start",r[r.Stereo=122]="Stereo",r[r.Stop=123]="Stop",r[r.Subtract=124]="Subtract",r[r.Sun=125]="Sun",r[r.Swap=126]="Swap",r[r.System=127]="System",r[r.Table=128]="Table",r[r.Tape=129]="Tape",r[r.TapeReel=130]="TapeReel",r[r.Time=131]="Time",r[r.Timeline=132]="Timeline",r[r.Tool=133]="Tool",r[r.Triangle=134]="Triangle",r[r.Undo=135]="Undo",r[r.Unknown=136]="Unknown",r[r.UserFolder=137]="UserFolder",r[r.Velocity=138]="Velocity",r[r.Vinyl=139]="Vinyl",r[r.Volume=140]="Volume",r[r.VUMeter=141]="VUMeter",r[r.Waveform=142]="Waveform",r[r.Zeitgeist=143]="Zeitgeist"})(He||(He={}));(function(r){r.toName=e=>r[e],r.fromName=e=>r[e]??r.Rectangle})(He||(He={}));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.MIDIControllers=23]="MIDIControllers",r[r.MIDIDevice=24]="MIDIDevice",r[r.MIDIEffectHost=25]="MIDIEffectHost",r[r.ModularSetup=26]="ModularSetup",r[r.Modulation=27]="Modulation",r[r.ModuleCollection=28]="ModuleCollection",r[r.NoteEventCollection=29]="NoteEventCollection",r[r.NoteEventFeature=30]="NoteEventFeature",r[r.NoteEvents=31]="NoteEvents",r[r.NotesConnection=32]="NotesConnection",r[r.Parameter=33]="Parameter",r[r.ParameterController=34]="ParameterController",r[r.PianoMode=35]="PianoMode",r[r.RegionCollection=36]="RegionCollection",r[r.Sample=37]="Sample",r[r.Selection=38]="Selection",r[r.Shadertoy=39]="Shadertoy",r[r.SideChain=40]="SideChain",r[r.SignatureAutomation=41]="SignatureAutomation",r[r.SoundfontFile=42]="SoundfontFile",r[r.StepAutomation=43]="StepAutomation",r[r.Timeline=44]="Timeline",r[r.TrackCollection=45]="TrackCollection",r[r.TransientMarkers=46]="TransientMarkers",r[r.User=47]="User",r[r.ValueEventCollection=48]="ValueEventCollection",r[r.ValueEvents=49]="ValueEvents",r[r.ValueInterpolation=50]="ValueInterpolation",r[r.VoltageConnection=51]="VoltageConnection",r[r.WarpMarkers=52]="WarpMarkers",r[r.NeuralAmpModel=53]="NeuralAmpModel"})(c||(c={}));var qa;(function(r){r[r.Once=0]="Once",r[r.Repeat=1]="Repeat",r[r.Pingpong=2]="Pingpong"})(qa||(qa={}));var _o;(function(r){r[r.Monophonic=0]="Monophonic",r[r.Polyphonic=1]="Polyphonic"})(_o||(_o={}));var Dn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MetaDataBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MetaDataBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMetaDataBox,this)}get tags(){return r.Tags}get target(){return this.getField(1)}get origin(){return this.getField(2)}get value(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"target",deprecated:!1,pointerRules:f},c.MetaData,!0),2:C.create({parent:this,fieldKey:2,fieldName:"origin",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"value",deprecated:!1,pointerRules:f},"{}")}}};var fv=class r extends qe{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:f},{length:4},"",0),2:w.create({parent:this,fieldKey:2,fieldName:"timeRangeInQuarters",deprecated:!1,pointerRules:f},{min:1,max:64,scaling:"linear"},"",8),3:w.create({parent:this,fieldKey:3,fieldName:"noteScale",deprecated:!1,pointerRules:f},{min:.5,max:2,scaling:"linear"},"",1),4:k.create({parent:this,fieldKey:4,fieldName:"noteLabels",deprecated:!1,pointerRules:f},!1),5:E.create({parent:this,fieldKey:5,fieldName:"transpose",deprecated:!1,pointerRules:f},{min:-48,max:48},"st",0)}}};var Zc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"RootBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="RootBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitRootBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"timeline",deprecated:!1,pointerRules:f},c.Timeline,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"users",deprecated:!1,pointerRules:{accepts:[c.User],mandatory:!0,exclusive:!1}}),3:C.create({parent:this,fieldKey:3,fieldName:"created",deprecated:!1,pointerRules:f}),4:N.create({parent:this,fieldKey:4,fieldName:"groove",deprecated:!1,pointerRules:f},c.Groove,!0),10:Y.hook({parent:this,fieldKey:10,fieldName:"modularSetups",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!1,exclusive:!1}}),20:Y.hook({parent:this,fieldKey:20,fieldName:"audioUnits",deprecated:!1,pointerRules:{accepts:[c.AudioUnits],mandatory:!1,exclusive:!1}}),21:Y.hook({parent:this,fieldKey:21,fieldName:"audioBusses",deprecated:!1,pointerRules:{accepts:[c.AudioBusses],mandatory:!1,exclusive:!1}}),30:Y.hook({parent:this,fieldKey:30,fieldName:"outputDevice",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!0,exclusive:!1}}),35:Y.hook({parent:this,fieldKey:35,fieldName:"outputMidiDevices",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!1,exclusive:!1}}),40:fv.create({parent:this,fieldKey:40,fieldName:"pianoMode",deprecated:!1,pointerRules:f}),100:N.create({parent:this,fieldKey:100,fieldName:"shadertoy",deprecated:!1,pointerRules:f},c.Shadertoy,!1),111:N.create({parent:this,fieldKey:111,fieldName:"editingChannel",deprecated:!1,pointerRules:f},c.Editing,!1)}}};var al=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SelectionBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="SelectionBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSelectionBox,this)}get tags(){return r.Tags}get selection(){return this.getField(1)}get selectable(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"selection",deprecated:!1,pointerRules:f},c.Selection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"selectable",deprecated:!1,pointerRules:f},c.Selection,!0)}}};var sl=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UserInterfaceBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UserInterfaceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitUserInterfaceBox,this)}get tags(){return r.Tags}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)}get midiControllers(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:f},c.User,!0),10:Y.hook({parent:this,fieldKey:10,fieldName:"selection",deprecated:!1,pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"uploadStates",deprecated:!1,pointerRules:{accepts:[c.FileUploadState],mandatory:!1,exclusive:!1}}),21:N.create({parent:this,fieldKey:21,fieldName:"editingDeviceChain",deprecated:!1,pointerRules:f},c.Editing,!1),22:N.create({parent:this,fieldKey:22,fieldName:"editingTimelineRegion",deprecated:!1,pointerRules:f},c.Editing,!1),23:N.create({parent:this,fieldKey:23,fieldName:"editingModularSystem",deprecated:!1,pointerRules:f},c.Editing,!1),30:Y.hook({parent:this,fieldKey:30,fieldName:"midiControllers",deprecated:!1,pointerRules:{accepts:[c.MIDIControllers],mandatory:!1,exclusive:!1}})}}};var Rg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UploadFileBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="UploadFileBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitUploadFileBox,this)}get tags(){return r.Tags}get user(){return this.getField(1)}get file(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"user",deprecated:!1,pointerRules:f},c.FileUploadState,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.FileUploadState,!0)}}};var Cg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ShadertoyBox",pointerRules:{accepts:[c.Shadertoy],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ShadertoyBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitShadertoyBox,this)}get tags(){return r.Tags}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:f}),2:k.create({parent:this,fieldKey:2,fieldName:"highres",deprecated:!1,pointerRules:f},!0)}}};var Og=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIControllerBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="MIDIControllerBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIControllerBox,this)}get tags(){return r.Tags}get controllers(){return this.getField(1)}get parameter(){return this.getField(2)}get deviceId(){return this.getField(3)}get deviceChannel(){return this.getField(4)}get controlId(){return this.getField(5)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"controllers",deprecated:!1,pointerRules:f},c.MIDIControllers,!0),2:N.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:f},c.MIDIControl,!0),3:C.create({parent:this,fieldKey:3,fieldName:"deviceId",deprecated:!1,pointerRules:f}),4:E.create({parent:this,fieldKey:4,fieldName:"deviceChannel",deprecated:!1,pointerRules:f},{min:0,max:127},""),5:E.create({parent:this,fieldKey:5,fieldName:"controlId",deprecated:!1,pointerRules:f},{min:0,max:127},"")}}};var mv=class r extends qe{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:f},{min:1,max:32},"",4),2:E.create({parent:this,fieldKey:2,fieldName:"denominator",deprecated:!1,pointerRules:f},{min:1,max:32},"",4)}}};var gv=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),2:E.create({parent:this,fieldKey:2,fieldName:"from",deprecated:!1,pointerRules:f},"any","ppqn",0),3:E.create({parent:this,fieldKey:3,fieldName:"to",deprecated:!1,pointerRules:f},"any","ppqn",15360)}}};var vv=class r extends qe{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:Y.hook({parent:this,fieldKey:1,fieldName:"markers",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",0),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var yv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get events(){return this.getField(1)}get index(){return this.getField(10)}get minBpm(){return this.getField(15)}get maxBpm(){return this.getField(16)}get enabled(){return this.getField(20)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!1),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",2),15:E.create({parent:this,fieldKey:15,fieldName:"minBpm",deprecated:!1,pointerRules:f},{min:30,max:999},"bpm",60),16:E.create({parent:this,fieldKey:16,fieldName:"maxBpm",deprecated:!1,pointerRules:f},{min:31,max:1e3},"bpm",240),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var xv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get events(){return this.getField(1)}get index(){return this.getField(10)}get enabled(){return this.getField(20)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.SignatureAutomation],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",1),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var ll=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TimelineBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TimelineBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTimelineBox,this)}get tags(){return r.Tags}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 tempoTrack(){return this.getField(22)}get signatureTrack(){return this.getField(23)}get durationInPulses(){return this.getField(30)}get bpm(){return this.getField(31)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:{accepts:[c.Timeline],mandatory:!0,exclusive:!1}}),10:mv.create({parent:this,fieldKey:10,fieldName:"signature",deprecated:!1,pointerRules:f}),11:gv.create({parent:this,fieldKey:11,fieldName:"loopArea",deprecated:!1,pointerRules:f}),20:Y.hook({parent:this,fieldKey:20,fieldName:"deprecatedMarkerTrack",deprecated:!0,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1,exclusive:!1}}),21:vv.create({parent:this,fieldKey:21,fieldName:"markerTrack",deprecated:!1,pointerRules:f}),22:yv.create({parent:this,fieldKey:22,fieldName:"tempoTrack",deprecated:!1,pointerRules:f}),23:xv.create({parent:this,fieldKey:23,fieldName:"signatureTrack",deprecated:!1,pointerRules:f}),30:E.create({parent:this,fieldKey:30,fieldName:"durationInPulses",deprecated:!1,pointerRules:f},"positive","ppqn",491520),31:w.create({parent:this,fieldKey:31,fieldName:"bpm",deprecated:!1,pointerRules:f},{min:30,max:999,scaling:"exponential"},"bpm",120)}}};var Zr=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TrackBox",pointerRules:{accepts:[c.Selection,c.PianoMode,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TrackBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTrackBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"tracks",deprecated:!1,pointerRules:f},c.TrackCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"target",deprecated:!1,pointerRules:f},c.Automation,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"regions",deprecated:!1,pointerRules:{accepts:[c.RegionCollection],mandatory:!1,exclusive:!1}}),4:Y.hook({parent:this,fieldKey:4,fieldName:"clips",deprecated:!1,pointerRules:{accepts:[c.ClipCollection],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),11:E.create({parent:this,fieldKey:11,fieldName:"type",deprecated:!1,pointerRules:f},{values:[0,1,2,3]},""),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),30:k.create({parent:this,fieldKey:30,fieldName:"excludePianoMode",deprecated:!1,pointerRules:f},!1)}}};var za=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventBox",pointerRules:{accepts:[c.Selection,c.NoteEventFeature],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn",240),20:E.create({parent:this,fieldKey:20,fieldName:"pitch",deprecated:!1,pointerRules:f},{min:0,max:127},"",60),21:w.create({parent:this,fieldKey:21,fieldName:"velocity",deprecated:!1,pointerRules:f},"unipolar","%",.7874015748031497),22:E.create({parent:this,fieldKey:22,fieldName:"playCount",deprecated:!1,pointerRules:f},{min:1,max:128},"",1),23:w.create({parent:this,fieldKey:23,fieldName:"playCurve",deprecated:!1,pointerRules:f},"bipolar","%",0),24:w.create({parent:this,fieldKey:24,fieldName:"cent",deprecated:!1,pointerRules:f},{min:-50,max:50,scaling:"linear"},"ct",0),25:E.create({parent:this,fieldKey:25,fieldName:"chance",deprecated:!1,pointerRules:f},{min:0,max:100},"",100)}}};var Vg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventRepeatBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="NoteEventRepeatBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventRepeatBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:f},c.NoteEventFeature,!0),2:E.create({parent:this,fieldKey:2,fieldName:"count",deprecated:!1,pointerRules:f},{min:1,max:128},"",1),3:w.create({parent:this,fieldKey:3,fieldName:"curve",deprecated:!1,pointerRules:f},"bipolar","%",0),4:w.create({parent:this,fieldKey:4,fieldName:"length",deprecated:!1,pointerRules:f},"unipolar","%",1)}}};var aa=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:"shared",ephemeral:!1}),n)}static ClassName="NoteEventCollectionBox";static Resource="shared";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventCollectionBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.NoteEvents],mandatory:!1,exclusive:!1}}),2:Y.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.NoteEventCollection],mandatory:!0,exclusive:!1}})}}};var cl=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteRegionBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"positive","ppqn"),14:E.create({parent:this,fieldKey:14,fieldName:"eventOffset",deprecated:!1,pointerRules:f},"any","ppqn"),15:k.create({parent:this,fieldKey:15,fieldName:"mute",deprecated:!1,pointerRules:f}),16:C.create({parent:this,fieldKey:16,fieldName:"label",deprecated:!1,pointerRules:f}),17:E.create({parent:this,fieldKey:17,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Ha=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"loop",deprecated:!1,pointerRules:f},!0),2:k.create({parent:this,fieldKey:2,fieldName:"reverse",deprecated:!1,pointerRules:f}),3:k.create({parent:this,fieldKey:3,fieldName:"mute",deprecated:!0,pointerRules:f}),4:E.create({parent:this,fieldKey:4,fieldName:"speed",deprecated:!1,pointerRules:f},"non-negative",""),5:E.create({parent:this,fieldKey:5,fieldName:"quantise",deprecated:!1,pointerRules:f},"non-negative",""),6:E.create({parent:this,fieldKey:6,fieldName:"trigger",deprecated:!1,pointerRules:f},"non-negative","")}}};var Gc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Mn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),12:E.create({parent:this,fieldKey:12,fieldName:"interpolation",deprecated:!1,pointerRules:{accepts:[c.ValueInterpolation],mandatory:!1,exclusive:!1}},{values:[0,1]},"",1),13:w.create({parent:this,fieldKey:13,fieldName:"value",deprecated:!1,pointerRules:f},"any",""),14:w.create({parent:this,fieldKey:14,fieldName:"slope",deprecated:!0,pointerRules:f},"any","",NaN)}}};var kn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:"shared",ephemeral:!1}),n)}static ClassName="ValueEventCollectionBox";static Resource="shared";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventCollectionBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.ValueEvents],mandatory:!1,exclusive:!1}}),2:Y.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.ValueEventCollection],mandatory:!0,exclusive:!1}})}}};var Ua=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCurveBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ValueEventCurveBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventCurveBox,this)}get tags(){return r.Tags}get event(){return this.getField(1)}get slope(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:f},c.ValueInterpolation,!0),2:w.create({parent:this,fieldKey:2,fieldName:"slope",deprecated:!1,pointerRules:f},"unipolar","%",.5)}}};var ul=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueRegionBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"positive","ppqn"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:f}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:f}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var qc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Hc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SignatureEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="SignatureEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSignatureEventBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get index(){return this.getField(9)}get relativePosition(){return this.getField(10)}get nominator(){return this.getField(21)}get denominator(){return this.getField(22)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.SignatureAutomation,!0),9:E.create({parent:this,fieldKey:9,fieldName:"index",deprecated:!1,pointerRules:f},"index","",0),10:E.create({parent:this,fieldKey:10,fieldName:"relativePosition",deprecated:!1,pointerRules:f},"positive","bars",1),21:E.create({parent:this,fieldKey:21,fieldName:"nominator",deprecated:!1,pointerRules:f},"positive","",4),22:E.create({parent:this,fieldKey:22,fieldName:"denominator",deprecated:!1,pointerRules:f},"positive","",4)}}};var wv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get in(){return this.getField(1)}get out(){return this.getField(2)}get inSlope(){return this.getField(3)}get outSlope(){return this.getField(4)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"in",deprecated:!1,pointerRules:f},"positive","ppqn",0),2:w.create({parent:this,fieldKey:2,fieldName:"out",deprecated:!1,pointerRules:f},"positive","ppqn",0),3:w.create({parent:this,fieldKey:3,fieldName:"inSlope",deprecated:!1,pointerRules:f},"unipolar","ratio",.75),4:w.create({parent:this,fieldKey:4,fieldName:"outSlope",deprecated:!1,pointerRules:f},"unipolar","ratio",.25)}}};var ja=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioRegionBox,this)}get tags(){return r.Tags}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)}get fading(){return this.getField(18)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),3:C.create({parent:this,fieldKey:3,fieldName:"playback",deprecated:!0,pointerRules:f}),4:C.create({parent:this,fieldKey:4,fieldName:"timeBase",deprecated:!1,pointerRules:f},"musical"),5:N.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),6:N.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:f},c.Deprecated,!1),7:w.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:f},"any","seconds"),8:N.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:f},c.AudioPlayMode,!1),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:w.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"any","mixed"),12:w.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","mixed"),13:w.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"any","mixed"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:f}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:f}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0"),17:w.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!1,pointerRules:f},"decibel","db"),18:wv.create({parent:this,fieldKey:18,fieldName:"fading",deprecated:!1,pointerRules:f})}}};var Jc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),5:N.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),6:N.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:f},c.Deprecated,!1),7:w.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:f},"any","seconds"),8:N.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:f},c.AudioPlayMode,!1),10:w.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"any","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0"),14:w.create({parent:this,fieldKey:14,fieldName:"gain",deprecated:!1,pointerRules:f},"decibel","db"),20:C.create({parent:this,fieldKey:20,fieldName:"playback",deprecated:!0,pointerRules:f}),21:C.create({parent:this,fieldKey:21,fieldName:"timeBase",deprecated:!1,pointerRules:f},"musical")}}};var Qc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioPitchStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioPitchStretchBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioPitchStretchBox,this)}get tags(){return r.Tags}get warpMarkers(){return this.getField(1)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0,exclusive:!1}})}}};var Yc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioTimeStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioTimeStretchBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioTimeStretchBox,this)}get tags(){return r.Tags}get warpMarkers(){return this.getField(1)}get transientPlayMode(){return this.getField(2)}get playbackRate(){return this.getField(3)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0,exclusive:!1}}),2:E.create({parent:this,fieldKey:2,fieldName:"transientPlayMode",deprecated:!1,pointerRules:f},"positive","enum",2),3:w.create({parent:this,fieldKey:3,fieldName:"playbackRate",deprecated:!1,pointerRules:f},"positive","ratio",1)}}};var zg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TransientMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TransientMarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTransientMarkerBox,this)}get tags(){return r.Tags}get owner(){return this.getField(1)}get position(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.TransientMarkers,!0),2:w.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"non-negative","seconds")}}};var La=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"WarpMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="WarpMarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitWarpMarkerBox,this)}get tags(){return r.Tags}get owner(){return this.getField(1)}get position(){return this.getField(2)}get seconds(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.WarpMarkers,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),3:w.create({parent:this,fieldKey:3,fieldName:"seconds",deprecated:!1,pointerRules:f},"non-negative","seconds")}}};var Xc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MarkerBox",pointerRules:{accepts:[c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMarkerBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"track",deprecated:!1,pointerRules:f},c.MarkerTrack,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),3:E.create({parent:this,fieldKey:3,fieldName:"plays",deprecated:!1,pointerRules:f},"non-negative","",1),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:f}),5:E.create({parent:this,fieldKey:5,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var br=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioFileBox",pointerRules:{accepts:[c.AudioFile,c.FileUploadState,c.MetaData],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="AudioFileBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioFileBox,this)}get tags(){return r.Tags}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:w.create({parent:this,fieldKey:1,fieldName:"startInSeconds",deprecated:!1,pointerRules:f},"non-negative","s"),2:w.create({parent:this,fieldKey:2,fieldName:"endInSeconds",deprecated:!1,pointerRules:f},"non-negative","s"),3:C.create({parent:this,fieldKey:3,fieldName:"fileName",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"transientMarkers",deprecated:!1,pointerRules:{accepts:[c.TransientMarkers],mandatory:!1,exclusive:!1}})}}};var Ao=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontFileBox",pointerRules:{accepts:[c.SoundfontFile],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="SoundfontFileBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSoundfontFileBox,this)}get tags(){return r.Tags}get fileName(){return this.getField(1)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"fileName",deprecated:!1,pointerRules:f})}}};var Ug=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NeuralAmpModelBox",pointerRules:{accepts:[c.NeuralAmpModel],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="NeuralAmpModelBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNeuralAmpModelBox,this)}get tags(){return r.Tags}get label(){return this.getField(1)}get model(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"label",deprecated:!1,pointerRules:f}),2:C.create({parent:this,fieldKey:2,fieldName:"model",deprecated:!1,pointerRules:f})}}};var yt=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioUnitBox",pointerRules:{accepts:[c.Selection,c.Automation,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioUnitBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioUnitBox,this)}get tags(){return r.Tags}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:f},"instrument"),2:N.create({parent:this,fieldKey:2,fieldName:"collection",deprecated:!1,pointerRules:f},c.AudioUnits,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1,exclusive:!1}}),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),12:w.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-96,mid:-9,max:6,scaling:"decibel"},"dB"),13:w.create({parent:this,fieldKey:13,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),15:k.create({parent:this,fieldKey:15,fieldName:"solo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),20:Y.hook({parent:this,fieldKey:20,fieldName:"tracks",deprecated:!1,pointerRules:{accepts:[c.TrackCollection],mandatory:!1,exclusive:!1}}),21:Y.hook({parent:this,fieldKey:21,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MIDIEffectHost],mandatory:!1,exclusive:!1}}),22:Y.hook({parent:this,fieldKey:22,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.InstrumentHost,c.AudioOutput],mandatory:!1,exclusive:!0}}),23:Y.hook({parent:this,fieldKey:23,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1,exclusive:!1}}),24:Y.hook({parent:this,fieldKey:24,fieldName:"auxSends",deprecated:!1,pointerRules:{accepts:[c.AuxSend],mandatory:!1,exclusive:!1}}),25:N.create({parent:this,fieldKey:25,fieldName:"output",deprecated:!1,pointerRules:f},c.AudioOutput,!1),26:N.create({parent:this,fieldKey:26,fieldName:"capture",deprecated:!1,pointerRules:f},c.Capture,!1)}}};var Ka=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureAudioBox",pointerRules:{accepts:[c.Capture],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CaptureAudioBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitCaptureAudioBox,this)}get tags(){return r.Tags}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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:f},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"requestChannels",deprecated:!1,pointerRules:f},"any","",2),11:w.create({parent:this,fieldKey:11,fieldName:"gainDb",deprecated:!1,pointerRules:f},"decibel","dB",0)}}};var Wa=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureMidiBox",pointerRules:{accepts:[c.Capture],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CaptureMidiBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitCaptureMidiBox,this)}get tags(){return r.Tags}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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:f},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"channel",deprecated:!1,pointerRules:f},"any","",-1)}}};var $n=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioBusBox",pointerRules:{accepts:[c.SideChain,c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioBusBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioBusBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.AudioBusses,!0),2:N.create({parent:this,fieldKey:2,fieldName:"output",deprecated:!1,pointerRules:f},c.AudioOutput,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!1,exclusive:!1}}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:C.create({parent:this,fieldKey:5,fieldName:"icon",deprecated:!1,pointerRules:f}),6:C.create({parent:this,fieldKey:6,fieldName:"label",deprecated:!1,pointerRules:f}),7:C.create({parent:this,fieldKey:7,fieldName:"color",deprecated:!1,pointerRules:f},"red"),8:k.create({parent:this,fieldKey:8,fieldName:"minimized",deprecated:!1,pointerRules:f})}}};var eu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AuxSendBox",pointerRules:{accepts:[c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AuxSendBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAuxSendBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"audioUnit",deprecated:!1,pointerRules:f},c.AuxSend,!0),2:N.create({parent:this,fieldKey:2,fieldName:"targetBus",deprecated:!1,pointerRules:f},c.AudioOutput,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:E.create({parent:this,fieldKey:4,fieldName:"routing",deprecated:!1,pointerRules:f},{values:[0,1]},"",1),5:w.create({parent:this,fieldKey:5,fieldName:"sendGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB"),6:w.create({parent:this,fieldKey:6,fieldName:"sendPan",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","")}}};var tu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"GrooveShuffleBox",pointerRules:{accepts:[c.Groove],mandatory:!0,exclusive:!1},resource:"internal",ephemeral:!1}),n)}static ClassName="GrooveShuffleBox";static Resource="internal";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitGrooveShuffleBox,this)}get tags(){return r.Tags}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:f}),10:w.create({parent:this,fieldKey:10,fieldName:"amount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.6),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"non-negative","ppqn",480)}}};var jg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownAudioEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UnknownAudioEffectDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitUnknownAudioEffectDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:f})}}};var Lg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownMidiEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UnknownMidiEffectDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitUnknownMidiEffectDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:f})}}};var Kg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceInterfaceKnobBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="DeviceInterfaceKnobBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitDeviceInterfaceKnobBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"userInterface",deprecated:!1,pointerRules:f},c.DeviceUserInterface,!0),2:N.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:f},c.ParameterController,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),10:w.create({parent:this,fieldKey:10,fieldName:"anchor",deprecated:!1,pointerRules:f},"unipolar","%"),11:C.create({parent:this,fieldKey:11,fieldName:"color",deprecated:!1,pointerRules:f})}}};var bv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get elements(){return this.getField(1)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"elements",deprecated:!1,pointerRules:{accepts:[c.DeviceUserInterface],mandatory:!1,exclusive:!1}})}}};var Wg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitModularDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"modularSetup",deprecated:!1,pointerRules:f},c.ModularSetup,!0),11:bv.create({parent:this,fieldKey:11,fieldName:"userInterface",deprecated:!1,pointerRules:f})}}};var Zg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"StereoToolDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="StereoToolDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitStereoToolDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-72,mid:0,max:12,scaling:"decibel"},"dB",0),11:w.create({parent:this,fieldKey:11,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),12:w.create({parent:this,fieldKey:12,fieldName:"stereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),13:k.create({parent:this,fieldKey:13,fieldName:"invertL",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),14:k.create({parent:this,fieldKey:14,fieldName:"invertR",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),15:k.create({parent:this,fieldKey:15,fieldName:"swap",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),20:E.create({parent:this,fieldKey:20,fieldName:"panningMixing",deprecated:!1,pointerRules:f},{values:[0,1]},"",1)}}};var Gg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MaximizerDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MaximizerDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitMaximizerDeviceBox,this)}get tags(){return r.Tags}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 threshold(){return this.getField(11)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:k.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:f},!0),11:w.create({parent:this,fieldKey:11,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-30,max:0,scaling:"linear"},"dB",0)}}};var ru=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CompressorDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CompressorDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitCompressorDeviceBox,this)}get tags(){return r.Tags}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)}get sideChain(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:k.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),11:k.create({parent:this,fieldKey:11,fieldName:"automakeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!0),12:k.create({parent:this,fieldKey:12,fieldName:"autoattack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),13:k.create({parent:this,fieldKey:13,fieldName:"autorelease",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),14:w.create({parent:this,fieldKey:14,fieldName:"inputgain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-30,max:30,scaling:"linear"},"dB",0),15:w.create({parent:this,fieldKey:15,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-60,max:0,scaling:"linear"},"dB",-10),16:w.create({parent:this,fieldKey:16,fieldName:"ratio",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:24,scaling:"exponential"},"",2),17:w.create({parent:this,fieldKey:17,fieldName:"knee",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),18:w.create({parent:this,fieldKey:18,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:100,scaling:"linear"},"ms",0),19:w.create({parent:this,fieldKey:19,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:5,max:1500,scaling:"linear"},"ms",25),20:w.create({parent:this,fieldKey:20,fieldName:"makeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-40,max:40,scaling:"linear"},"dB",0),21:w.create({parent:this,fieldKey:21,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),30:N.create({parent:this,fieldKey:30,fieldName:"sideChain",deprecated:!1,pointerRules:f},c.SideChain,!1)}}};var qg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"GateDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="GateDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitGateDeviceBox,this)}get tags(){return r.Tags}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 threshold(){return this.getField(10)}get return(){return this.getField(11)}get attack(){return this.getField(12)}get hold(){return this.getField(13)}get release(){return this.getField(14)}get floor(){return this.getField(15)}get inverse(){return this.getField(16)}get sideChain(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-60,max:0,scaling:"linear"},"dB",-6),11:w.create({parent:this,fieldKey:11,fieldName:"return",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),12:w.create({parent:this,fieldKey:12,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:50,scaling:"linear"},"ms",1),13:w.create({parent:this,fieldKey:13,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:500,scaling:"linear"},"ms",50),14:w.create({parent:this,fieldKey:14,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:2e3,scaling:"linear"},"ms",100),15:w.create({parent:this,fieldKey:15,fieldName:"floor",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-72,max:0,scaling:"linear"},"dB",-72),16:k.create({parent:this,fieldKey:16,fieldName:"inverse",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),30:N.create({parent:this,fieldKey:30,fieldName:"sideChain",deprecated:!1,pointerRules:f},c.SideChain,!1)}}};var Hg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DelayDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="DelayDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitDelayDeviceBox,this)}get tags(){return r.Tags}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 delayMusical(){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)}get preSyncTimeLeft(){return this.getField(16)}get preMillisTimeLeft(){return this.getField(17)}get preSyncTimeRight(){return this.getField(19)}get preMillisTimeRight(){return this.getField(20)}get delayMillis(){return this.getField(22)}get lfoSpeed(){return this.getField(23)}get lfoDepth(){return this.getField(24)}get version(){return this.getField(99)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"delayMusical",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",13),11:w.create({parent:this,fieldKey:11,fieldName:"feedback",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),12:w.create({parent:this,fieldKey:12,fieldName:"cross",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),13:w.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),14:w.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-6),15:w.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),16:w.create({parent:this,fieldKey:16,fieldName:"preSyncTimeLeft",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",8),17:w.create({parent:this,fieldKey:17,fieldName:"preMillisTimeLeft",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),19:w.create({parent:this,fieldKey:19,fieldName:"preSyncTimeRight",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",0),20:w.create({parent:this,fieldKey:20,fieldName:"preMillisTimeRight",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),22:w.create({parent:this,fieldKey:22,fieldName:"delayMillis",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),23:w.create({parent:this,fieldKey:23,fieldName:"lfoSpeed",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.1,max:5,scaling:"exponential"},"Hz",.1),24:w.create({parent:this,fieldKey:24,fieldName:"lfoDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:50,scaling:"linear"},"ms",0),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:f},"any","")}}};var Jg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CrusherDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CrusherDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitCrusherDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"crush",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),11:E.create({parent:this,fieldKey:11,fieldName:"bits",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:16},"bits",16),12:w.create({parent:this,fieldKey:12,fieldName:"boost",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),13:w.create({parent:this,fieldKey:13,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1)}}};var Qg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DattorroReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="DattorroReverbDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitDattorroReverbDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),11:w.create({parent:this,fieldKey:11,fieldName:"bandwidth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.9999),12:w.create({parent:this,fieldKey:12,fieldName:"inputDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.75),13:w.create({parent:this,fieldKey:13,fieldName:"inputDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.625),14:w.create({parent:this,fieldKey:14,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.75),15:w.create({parent:this,fieldKey:15,fieldName:"decayDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.7),16:w.create({parent:this,fieldKey:16,fieldName:"decayDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),17:w.create({parent:this,fieldKey:17,fieldName:"damping",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.005),18:w.create({parent:this,fieldKey:18,fieldName:"excursionRate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),19:w.create({parent:this,fieldKey:19,fieldName:"excursionDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.7),20:w.create({parent:this,fieldKey:20,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-6),21:w.create({parent:this,fieldKey:21,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0)}}};var Yg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"VelocityDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="VelocityDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitVelocityDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"magnetPosition",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),11:w.create({parent:this,fieldKey:11,fieldName:"magnetStrength",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),12:E.create({parent:this,fieldKey:12,fieldName:"randomSeed",deprecated:!1,pointerRules:f},"any","",2048),13:w.create({parent:this,fieldKey:13,fieldName:"randomAmount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),14:w.create({parent:this,fieldKey:14,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),15:w.create({parent:this,fieldKey:15,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1)}}};var Xg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"FoldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="FoldDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitFoldDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"drive",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:30,scaling:"linear"},"dB",0),11:E.create({parent:this,fieldKey:11,fieldName:"overSampling",deprecated:!1,pointerRules:f},{length:3},"",0),12:w.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-18,max:0,scaling:"linear"},"dB",0)}}};var ev=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TidalDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TidalDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitTidalDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"slope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",-.25),11:w.create({parent:this,fieldKey:11,fieldName:"symmetry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),20:w.create({parent:this,fieldKey:20,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",3),21:w.create({parent:this,fieldKey:21,fieldName:"depth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","",1),22:w.create({parent:this,fieldKey:22,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0),23:w.create({parent:this,fieldKey:23,fieldName:"channelOffset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0)}}};var th=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{length:4},""),12:w.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var rh=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:w.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-24,max:24,scaling:"linear"},"dB")}}};var cu=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:w.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-24,max:24,scaling:"linear"},"dB"),12:w.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var tv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"RevampDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="RevampDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitRevampDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:th.create({parent:this,fieldKey:10,fieldName:"highPass",deprecated:!1,pointerRules:f}),11:rh.create({parent:this,fieldKey:11,fieldName:"lowShelf",deprecated:!1,pointerRules:f}),12:cu.create({parent:this,fieldKey:12,fieldName:"lowBell",deprecated:!1,pointerRules:f}),13:cu.create({parent:this,fieldKey:13,fieldName:"midBell",deprecated:!1,pointerRules:f}),14:cu.create({parent:this,fieldKey:14,fieldName:"highBell",deprecated:!1,pointerRules:f}),15:rh.create({parent:this,fieldKey:15,fieldName:"highShelf",deprecated:!1,pointerRules:f}),16:th.create({parent:this,fieldKey:16,fieldName:"lowPass",deprecated:!1,pointerRules:f}),17:w.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-18,max:18,scaling:"linear"},"db")}}};var rv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ReverbDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitReverbDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),11:w.create({parent:this,fieldKey:11,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:.5,scaling:"exponential"},"s",0),12:w.create({parent:this,fieldKey:12,fieldName:"damp",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),13:w.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),14:w.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-3),15:w.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0)}}};var Av=class r extends qe{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,exclusive:!1}},{values:[0,1,2,3]},""),2:w.create({parent:this,fieldKey:2,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:-3,max:3},"oct",0),4:w.create({parent:this,fieldKey:4,fieldName:"tune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-1200,max:1200,scaling:"linear"},"ct")}}};var _v=class r extends qe{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,exclusive:!1}},{values:[0,1,2,3]},""),2:w.create({parent:this,fieldKey:2,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1e-4,max:30,scaling:"exponential"},"Hz",1e-4),3:k.create({parent:this,fieldKey:3,fieldName:"sync",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),10:w.create({parent:this,fieldKey:10,fieldName:"targetTune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),11:w.create({parent:this,fieldKey:11,fieldName:"targetCutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),12:w.create({parent:this,fieldKey:12,fieldName:"targetVolume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%")}}};var Pv=class r extends qe{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:w.create({parent:this,fieldKey:1,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),2:w.create({parent:this,fieldKey:2,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),3:w.create({parent:this,fieldKey:3,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),4:w.create({parent:this,fieldKey:4,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","db",.001)}}};var iu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"VaporisateurDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="VaporisateurDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitVaporisateurDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},"any","oct"),12:w.create({parent:this,fieldKey:12,fieldName:"tune",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","ct"),13:E.create({parent:this,fieldKey:13,fieldName:"waveform",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any",""),14:w.create({parent:this,fieldKey:14,fieldName:"cutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),15:w.create({parent:this,fieldKey:15,fieldName:"resonance",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"q"),16:w.create({parent:this,fieldKey:16,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s"),17:w.create({parent:this,fieldKey:17,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s"),18:w.create({parent:this,fieldKey:18,fieldName:"filterEnvelope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),19:w.create({parent:this,fieldKey:19,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),20:w.create({parent:this,fieldKey:20,fieldName:"sustain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),21:w.create({parent:this,fieldKey:21,fieldName:"glideTime",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),22:E.create({parent:this,fieldKey:22,fieldName:"voicingMode",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{values:[1,3,5]},"",1),24:w.create({parent:this,fieldKey:24,fieldName:"unisonDetune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:1200,scaling:"exponential"},"ct",30),25:w.create({parent:this,fieldKey:25,fieldName:"unisonStereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),26:E.create({parent:this,fieldKey:26,fieldName:"filterOrder",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{values:[1,2,3,4]},"",1),27:w.create({parent:this,fieldKey:27,fieldName:"filterKeyboard",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),30:_v.create({parent:this,fieldKey:30,fieldName:"lfo",deprecated:!1,pointerRules:f}),40:Mg.create({parent:this,fieldKey:40,fieldName:"oscillators",deprecated:!1,pointerRules:f},e=>Av.create(e),2),50:Pv.create({parent:this,fieldKey:50,fieldName:"noise",deprecated:!1,pointerRules:f}),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:f},"any","")}}};var Sv=class r extends qe{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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f})}}};var nu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:Sv.create({parent:this,fieldKey:10,fieldName:"deprecatedDevice",deprecated:!0,pointerRules:f}),11:E.create({parent:this,fieldKey:11,fieldName:"channel",deprecated:!1,pointerRules:f},{min:0,max:15},"ch"),12:E.create({parent:this,fieldKey:12,fieldName:"deprecatedDelay",deprecated:!0,pointerRules:f},"any","ms",10),13:Y.hook({parent:this,fieldKey:13,fieldName:"parameters",deprecated:!1,pointerRules:{accepts:[c.Parameter],mandatory:!1,exclusive:!1}}),14:N.create({parent:this,fieldKey:14,fieldName:"device",deprecated:!1,pointerRules:f},c.MIDIDevice,!1)}}};var Tn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:f},c.MIDIDevice,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!0,exclusive:!1}}),3:C.create({parent:this,fieldKey:3,fieldName:"id",deprecated:!1,pointerRules:f}),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:f}),5:E.create({parent:this,fieldKey:5,fieldName:"delayInMs",deprecated:!1,pointerRules:f},{min:0,max:500},"ms",10),6:k.create({parent:this,fieldKey:6,fieldName:"sendTransportMessages",deprecated:!1,pointerRules:f},!0)}}};var Rn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputParameterBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputParameterBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputParameterBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.Parameter,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f},""),3:E.create({parent:this,fieldKey:3,fieldName:"controller",deprecated:!1,pointerRules:f},{min:0,max:127},"#",64),4:w.create({parent:this,fieldKey:4,fieldName:"value",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!0,exclusive:!1}},"unipolar","%")}}};var ou=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="SoundfontDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitSoundfontDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"file",deprecated:!1,pointerRules:f},c.SoundfontFile,!1),11:E.create({parent:this,fieldKey:11,fieldName:"presetIndex",deprecated:!1,pointerRules:f},{min:0,max:65535},"")}}};var au=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NanoDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NanoDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitNanoDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-3),15:N.create({parent:this,fieldKey:15,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!1),20:w.create({parent:this,fieldKey:20,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:8,scaling:"exponential"},"s",.1)}}};var su=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PlayfieldDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitPlayfieldDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:Y.hook({parent:this,fieldKey:10,fieldName:"samples",deprecated:!1,pointerRules:{accepts:[c.Sample],mandatory:!1,exclusive:!1}})}}};var Za=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldSampleBox",pointerRules:{accepts:[c.Editing,c.SideChain,c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PlayfieldSampleBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes",copyable:!1});constructor(e){super(e)}accept(e){return P(e.visitPlayfieldSampleBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:10,fieldName:"device",deprecated:!1,pointerRules:f},c.Sample,!0),11:N.create({parent:this,fieldKey:11,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),12:Y.hook({parent:this,fieldKey:12,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MIDIEffectHost],mandatory:!1,exclusive:!1}}),13:Y.hook({parent:this,fieldKey:13,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1,exclusive:!1}}),15:E.create({parent:this,fieldKey:15,fieldName:"index",deprecated:!1,pointerRules:f},{min:0,max:127},"",60),20:C.create({parent:this,fieldKey:20,fieldName:"label",deprecated:!0,pointerRules:f}),21:C.create({parent:this,fieldKey:21,fieldName:"icon",deprecated:!1,pointerRules:f}),22:k.create({parent:this,fieldKey:22,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),23:k.create({parent:this,fieldKey:23,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),40:k.create({parent:this,fieldKey:40,fieldName:"mute",deprecated:!1,pointerRules:f}),41:k.create({parent:this,fieldKey:41,fieldName:"solo",deprecated:!1,pointerRules:f}),42:k.create({parent:this,fieldKey:42,fieldName:"exclude",deprecated:!1,pointerRules:f}),43:k.create({parent:this,fieldKey:43,fieldName:"polyphone",deprecated:!1,pointerRules:f}),44:E.create({parent:this,fieldKey:44,fieldName:"gate",deprecated:!1,pointerRules:f},{length:3},"",0),45:w.create({parent:this,fieldKey:45,fieldName:"pitch",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-1200,max:1200,scaling:"linear"},"ct"),46:w.create({parent:this,fieldKey:46,fieldName:"sampleStart",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),47:w.create({parent:this,fieldKey:47,fieldName:"sampleEnd",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),48:w.create({parent:this,fieldKey:48,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),49:w.create({parent:this,fieldKey:49,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.02)}}};var lu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TapeDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain,c.Automation],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TapeDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"audio"});constructor(e){super(e)}accept(e){return P(e.visitTapeDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"flutter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),11:w.create({parent:this,fieldKey:11,fieldName:"wow",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),12:w.create({parent:this,fieldKey:12,fieldName:"noise",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),13:w.create({parent:this,fieldKey:13,fieldName:"saturation",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%")}}};var iv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ArpeggioDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ArpeggioDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitArpeggioDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:E.create({parent:this,fieldKey:10,fieldName:"modeIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!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,exclusive:!1}},{length:17},"",9),13:w.create({parent:this,fieldKey:13,fieldName:"gate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:1,max:16},"",1),15:w.create({parent:this,fieldKey:15,fieldName:"velocity",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","",0)}}};var nv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PitchDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PitchDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitPitchDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:E.create({parent:this,fieldKey:10,fieldName:"semiTones",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-36,max:36},"st",0),11:w.create({parent:this,fieldKey:11,fieldName:"cents",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:-7,max:7},"oct",0)}}};var ov=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ZeitgeistDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ZeitgeistDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitZeitgeistDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"groove",deprecated:!1,pointerRules:f},c.Groove,!0)}}};var av=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NeuralAmpDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NeuralAmpDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitNeuralAmpDeviceBox,this)}get tags(){return r.Tags}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 modelJson(){return this.getField(10)}get inputGain(){return this.getField(11)}get outputGain(){return this.getField(12)}get mono(){return this.getField(13)}get mix(){return this.getField(14)}get model(){return this.getField(20)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"modelJson",deprecated:!0,pointerRules:f}),11:w.create({parent:this,fieldKey:11,fieldName:"inputGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),12:w.create({parent:this,fieldKey:12,fieldName:"outputGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),13:k.create({parent:this,fieldKey:13,fieldName:"mono",deprecated:!1,pointerRules:f},!0),14:w.create({parent:this,fieldKey:14,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1,scaling:"linear"},"%",1),20:N.create({parent:this,fieldKey:20,fieldName:"model",deprecated:!1,pointerRules:f},c.NeuralAmpModel,!1)}}};var sv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ModularBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ModularSetup,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!0,exclusive:!1}}),3:Y.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"modules",deprecated:!1,pointerRules:{accepts:[c.ModuleCollection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"connections",deprecated:!1,pointerRules:{accepts:[c.ConnectionCollection],mandatory:!1,exclusive:!1}}),13:C.create({parent:this,fieldKey:13,fieldName:"label",deprecated:!1,pointerRules:f})}}};var lv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleConnectionBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleConnectionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleConnectionBox,this)}get tags(){return r.Tags}get collection(){return this.getField(1)}get source(){return this.getField(2)}get target(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ConnectionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"source",deprecated:!1,pointerRules:f},c.VoltageConnection,!0),3:N.create({parent:this,fieldKey:3,fieldName:"target",deprecated:!1,pointerRules:f},c.VoltageConnection,!0)}}};var Ji=class r extends qe{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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ModuleCollection,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:E.create({parent:this,fieldKey:3,fieldName:"x",deprecated:!1,pointerRules:f},"any","x"),4:E.create({parent:this,fieldKey:4,fieldName:"y",deprecated:!1,pointerRules:f},"any","y"),5:k.create({parent:this,fieldKey:5,fieldName:"collapsed",deprecated:!1,pointerRules:f},!1),6:k.create({parent:this,fieldKey:6,fieldName:"removable",deprecated:!1,pointerRules:f},!0)}}};var cv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioInputBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularAudioInputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularAudioInputBox,this)}get tags(){return r.Tags}get attributes(){return this.getField(1)}get output(){return this.getField(10)}initializeFields(){return{1:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"output",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}})}}};var uv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioOutputBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularAudioOutputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularAudioOutputBox,this)}get tags(){return r.Tags}get attributes(){return this.getField(1)}get input(){return this.getField(10)}initializeFields(){return{1:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}})}}};var dv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleDelayBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleDelayBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleDelayBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"time",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1,exclusive:!1}},{min:1,max:1e3,scaling:"exponential"},"ms",500)}}};var pv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleMultiplierBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleMultiplierBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleMultiplierBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInputX",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"voltageInputY",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"multiplier",deprecated:!1,pointerRules:f},"unipolar","%")}}};var hv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleGainBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleGainBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleGainBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1,exclusive:!1}},"decibel","dB")}}};var Ev=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 fB=(r,e)=>{if(r===e)return 0;let t=r-e;return t===0?D(`Indices cannot be equal (${r}, ${e})`):t};var sa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ar=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fv,Cn,Ja,Bv,la,sr=class r{static create(e,t,n){return new r(e,t,n)}constructor(e,t,n){Fv.set(this,void 0),Cn.set(this,void 0),Ja.set(this,void 0),Bv.set(this,void 0),la.set(this,null),sa(this,Fv,e,"f"),sa(this,Cn,b.newSet(i=>i.adapter.uuid),"f"),sa(this,Ja,new ar,"f"),sa(this,Bv,e.pointerHub.catchupAndSubscribe({onAdded:i=>{sa(this,la,null,"f");let o=t(i.box),a=o.indexField.subscribe(()=>{sa(this,la,null,"f"),Ar(this,Ja,"f").proxy.onReorder(o)}),s=Ar(this,Cn,"f").add({adapter:o,subscription:a});V(s,`Could not add ${o}`),Ar(this,Ja,"f").proxy.onAdd(o)},onRemoved:i=>{sa(this,la,null,"f");let o=i.box.address.uuid,{adapter:a,subscription:s}=Ar(this,Cn,"f").removeByKey(o);s.terminate(),Ar(this,Ja,"f").proxy.onRemove(a)}},n),"f")}field(){return Ar(this,Fv,"f")}subscribe(e){return Ar(this,Ja,"f").subscribe(e)}catchupAndSubscribe(e){return Ar(this,Cn,"f").forEach(({adapter:t})=>e.onAdd(t)),this.subscribe(e)}getAdapterByIndex(e){let t=ct.exactMapped(this.adapters(),e,fB,n=>n.indexField.getValue());return t===-1?m.None:m.wrap(this.adapters()[t])}getAdapterById(e){return Ar(this,Cn,"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 Ar(this,la,"f")===null&&sa(this,la,Ar(this,Cn,"f").values().map(({adapter:e})=>e).sort((e,t)=>e.indexField.getValue()-t.indexField.getValue()),"f"),Ar(this,la,"f")}move(e,t){this.moveIndex(e.indexField.getValue(),t)}moveIndex(e,t){let n=this.adapters(),i=n[e];if(t<0){let o=be(e+t,0,n.length-1);for(let a=o;a<e;a++)n[a].indexField.setValue(a+1);i.indexField.setValue(o)}else if(t>1){let o=be(e+(t-1),0,n.length-1);for(let a=e;a<o;a++)n[a+1].indexField.setValue(a);i.indexField.setValue(o)}else console.warn(`moveIndex had no effect: startIndex: ${e}, delta: ${t}`)}size(){return Ar(this,Cn,"f").size()}isEmpty(){return this.size()===0}terminate(){sa(this,la,null,"f"),Ar(this,Cn,"f").forEach(({subscription:e})=>e.terminate()),Ar(this,Cn,"f").clear(),Ar(this,Ja,"f").terminate(),Ar(this,Bv,"f").terminate()}};Fv=new WeakMap,Cn=new WeakMap,Ja=new WeakMap,Bv=new WeakMap,la=new WeakMap;var li;(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 n=e.pointerHub.filter(c.ValueInterpolation).at(0)?.box;q(n)?(W0(n,Ua),n.slope.setValue(t.slope)):Ua.create(e.box.graph,b.generate(),i=>{i.slope.setValue(t.slope),i.event.refer(e)})}},r.read=e=>{let t=e.pointerHub.incoming().at(0)?.box;return q(t)?(W0(t,Ua),{type:"curve",slope:t.slope.getValue()}):e.getValue()===0?si.None:e.getValue()===1?si.Linear:D("Unknown Interpolation value")}})(li||(li={}));var Qa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ih,uu,$t,nh,Ya,oh,ca=class r{constructor(e,t){this.type="value-event",ih.set(this,new j),uu.set(this,void 0),$t.set(this,void 0),nh.set(this,void 0),Ya.set(this,void 0),oh.set(this,!1),Qa(this,uu,e,"f"),Qa(this,$t,t,"f"),Qa(this,nh,Xe(this,ih,"f").own(new sg(()=>li.read(Xe(this,$t,"f").interpolation))),"f");let n=()=>{Xe(this,nh,"f").invalidate(),this.collection.ifSome(i=>i.onEventPropertyChanged())};Xe(this,ih,"f").ownAll(Xe(this,$t,"f").subscribe(Ue.Children,i=>{if(!this.collection.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let o=this.collection.unwrap(),a=i.address.fieldKeys,s=U.equals(Xe(this,$t,"f").index.address.fieldKeys,a),l=U.equals(Xe(this,$t,"f").position.address.fieldKeys,a);s||l?o.requestSorting():o.onEventPropertyChanged()}}),Xe(this,$t,"f").interpolation.subscribe(n),Xe(this,$t,"f").interpolation.pointerHub.subscribe({onAdded:({box:i})=>{Xe(this,Ya,"f").terminate(),Qa(this,Ya,i.subscribe(Ue.Children,n),"f"),n()},onRemoved:()=>{Xe(this,Ya,"f").terminate(),Qa(this,Ya,ee.Empty,"f"),n()}})),Qa(this,Ya,Xe(this,$t,"f").interpolation.pointerHub.filter(c.ValueInterpolation).at(0)?.box.subscribe(Ue.Children,n)??ee.Empty,"f")}onSelected(){Qa(this,oh,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Qa(this,oh,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Xe(this,Ya,"f").terminate(),Xe(this,ih,"f").terminate()}get box(){return Xe(this,$t,"f")}get uuid(){return Xe(this,$t,"f").address.uuid}get address(){return Xe(this,$t,"f").address}get position(){return Xe(this,$t,"f").position.getValue()}get index(){return Xe(this,$t,"f").index.getValue()}set interpolation(e){li.write(Xe(this,$t,"f").interpolation,e)}get interpolation(){return Xe(this,nh,"f").get()}get value(){return Xe(this,$t,"f").value.getValue()}get isSelected(){return Xe(this,oh,"f")}get collection(){return Xe(this,$t,"f").events.targetVertex.map(e=>Xe(this,uu,"f").boxAdapters.adapterFor(e.box,_r))}copyTo(e){let t=e?.position??this.position,n=e?.index??this.index,i=Mn.create(Xe(this,uu,"f").boxGraph,b.generate(),o=>{o.position.setValue(t),o.index.setValue(n),o.events.refer(e?.events??this.collection.unwrap().box.events),o.value.setValue(e?.value??this.value)});return li.write(i.interpolation,e?.interpolation??this.interpolation),Xe(this,uu,"f").boxAdapters.adapterFor(i,r)}copyFrom(e){return Xe(this,$t,"f").position.setValue(e?.position??this.position),Xe(this,$t,"f").index.setValue(e?.index??this.index),Xe(this,$t,"f").events.refer(e?.events??this.collection.unwrap().box.events),Xe(this,$t,"f").value.setValue(e?.value??this.value),li.write(Xe(this,$t,"f").interpolation,e?.interpolation??this.interpolation),this}toString(){return`{ValueEventBoxAdapter position: ${this.position} index: ${this.index}}`}};ih=new WeakMap,uu=new WeakMap,$t=new WeakMap,nh=new WeakMap,Ya=new WeakMap,oh=new WeakMap;ca.Comparator=(r,e)=>{if(r===e)return D(`${r} is equal to itself`);let t=r.position-e.position;if(t!==0)return t;let n=r.index-e.index;return n!==0?n:D(`${r} and ${e} are identical in terms of comparison`)};var ah=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Qe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sh,lh,Xa,Qi,dl,du,ua,Nv,_r=class r{constructor(e,t){sh.add(this),lh.set(this,new j),Xa.set(this,void 0),Qi.set(this,void 0),dl.set(this,void 0),du.set(this,void 0),ua.set(this,void 0),ah(this,Xa,e,"f"),ah(this,Qi,t,"f"),ah(this,dl,new ce,"f"),ah(this,du,b.newSet(i=>i.uuid),"f"),ah(this,ua,ai.create(ca.Comparator),"f");let n=i=>{let o=he(i.accept({visitValueEventBox:a=>Qe(this,Xa,"f").boxAdapters.adapterFor(a,ca)}),`Could not find adapter for ${i}`);Qe(this,du,"f").add(o)&&(Qe(this,ua,"f").add(o),Qe(this,sh,"m",Nv).call(this))};Qe(this,Qi,"f").events.pointerHub.incoming().forEach(({box:i})=>n(i)),Qe(this,lh,"f").own(Qe(this,Qi,"f").events.pointerHub.subscribe({onAdded:({box:i})=>n(i),onRemoved:({box:{address:{uuid:i}}})=>{Qe(this,ua,"f").remove(Qe(this,du,"f").removeByKey(i)),Qe(this,sh,"m",Nv).call(this)}})),Qe(this,lh,"f").own(Qe(this,Qi,"f").owners.pointerHub.subscribe({onAdded:()=>Qe(this,dl,"f").notify(this),onRemoved:()=>Qe(this,dl,"f").notify(this)}))}valueAt(e,t){return Ig.valueAt(Qe(this,ua,"f"),e,t)}copy(){let e=Qe(this,Xa,"f").boxGraph,t=kn.create(e,b.generate());return Qe(this,ua,"f").asArray().forEach(n=>n.copyTo({events:t.events})),Qe(this,Xa,"f").boxAdapters.adapterFor(t,r)}cut(e,t=A.unipolar()){let n=this.events.lowerEqual(e),i=this.events.greaterEqual(e);if(i===null)return n===null?m.None:m.wrap(this.createEvent({position:e,value:n.value,index:n.index,interpolation:n.interpolation}));if(n===null)return m.wrap(this.createEvent({position:e,value:i.value,index:i.index,interpolation:i.interpolation}));if(n.position===e)return m.wrap(n);if(i.position===e)return m.wrap(i);if(n.interpolation.type==="none")return m.wrap(this.createEvent({position:e,value:n.value,index:n.index,interpolation:n.interpolation}));if(n.interpolation.type==="linear"){let{position:o}=n,{position:a}=i,s=t.x(n.value),l=t.x(i.value),u=lg(s,l,(e-o)/(a-o));return m.wrap(this.createEvent({position:e,value:t.y(u),index:0,interpolation:n.interpolation}))}if(n.interpolation.type==="curve"){let{position:o}=n,{position:a}=i,s=t.x(n.value),l=t.x(i.value),u=a-o,p=e-o,d=vr.byHalf(u,s,vr.valueAt({slope:n.interpolation.slope,steps:u,y0:s,y1:l},u*.5),l),h=vr.valueAt(d,p),g=vr.slopeByHalf(s,vr.valueAt(d,p*.5),h);return li.write(n.box.interpolation,si.Curve(g)),m.wrap(this.createEvent({position:e,value:t.y(h),index:0,interpolation:si.Curve(vr.slopeByHalf(h,vr.valueAt(d,(p+u)*.5),l))}))}return D("Unknown interpolation type")}subscribeChange(e){return Qe(this,dl,"f").subscribe(e)}createEvent({position:e,index:t,value:n,interpolation:i}){let o=Math.trunc(e),a=Qe(this,du,"f").values().find(l=>l.position===o&&l.index===t);if(q(a)&&a.box.isAttached())return a.box.value.setValue(n),li.write(a.box.interpolation,i),a;let s=Mn.create(Qe(this,Xa,"f").boxGraph,b.generate(),l=>{l.position.setValue(e),l.index.setValue(t),l.value.setValue(n),l.events.refer(Qe(this,Qi,"f").events)});return li.write(s.interpolation,i),Qe(this,Xa,"f").boxAdapters.adapterFor(s,ca)}requestSorting(){Qe(this,ua,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Qe(this,sh,"m",Nv).call(this)}terminate(){Qe(this,lh,"f").terminate()}get box(){return Qe(this,Qi,"f")}get uuid(){return Qe(this,Qi,"f").address.uuid}get address(){return Qe(this,Qi,"f").address}get numOwners(){return Qe(this,Qi,"f").owners.pointerHub.filter(c.ValueEventCollection).length}get events(){return Qe(this,ua,"f")}toString(){return`{ValueEventCollectionBox ${b.toString(Qe(this,Qi,"f").address.uuid)}}`}};lh=new WeakMap,Xa=new WeakMap,Qi=new WeakMap,dl=new WeakMap,du=new WeakMap,ua=new WeakMap,sh=new WeakSet,Nv=function(){Qe(this,dl,"f").notify(this)};var pl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ze=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hl,es,fl,Yt,ml,dh,ch,uh,pu,ts=class{constructor(e,t){hl.add(this),this.type="value-clip",es.set(this,new j),fl.set(this,void 0),Yt.set(this,void 0),ml.set(this,void 0),dh.set(this,void 0),ch.set(this,void 0),uh.set(this,ee.Empty),pl(this,fl,e,"f"),pl(this,Yt,t,"f"),pl(this,ch,!0,"f"),pl(this,ml,ze(this,es,"f").own(new Hi(!1)),"f"),pl(this,dh,ze(this,es,"f").own(new ce),"f"),ze(this,es,"f").own(ze(this,Yt,"f").pointerHub.subscribe({onAdded:()=>ze(this,hl,"m",pu).call(this),onRemoved:()=>ze(this,hl,"m",pu).call(this)})),ze(this,es,"f").own(ze(this,Yt,"f").subscribe(Ue.Children,n=>ze(this,hl,"m",pu).call(this))),ze(this,es,"f").own(ze(this,Yt,"f").events.catchupAndSubscribe(({targetVertex:n})=>{ze(this,uh,"f").terminate(),pl(this,uh,n.match({none:()=>ee.Empty,some:({box:i})=>ze(this,fl,"f").boxAdapters.adapterFor(i,_r).subscribeChange(()=>ze(this,hl,"m",pu).call(this))}),"f"),ze(this,hl,"m",pu).call(this)})),pl(this,ch,!1,"f")}valueAt(e,t){let n=this.optCollection;return n.isEmpty()?t:n.unwrap().valueAt(e%this.duration,t)}catchupAndSubscribeSelected(e){return ze(this,ml,"f").catchupAndSubscribe(e)}subscribeChange(e){return ze(this,dh,"f").subscribe(e)}accept(e){return P(e.visitValueClipBoxAdapter,this)}consolidate(){this.isMirrowed&&ze(this,Yt,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:ze(this,Yt,"f").events.targetVertex.unwrap();qc.create(ze(this,fl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(ze(this,Yt,"f").clips.targetVertex.unwrap()),n.events.refer(t)})}onSelected(){ze(this,ml,"f").setValue(!0)}onDeselected(){ze(this,ml,"f").setValue(!1)}get isSelected(){return ze(this,ml,"f").getValue()}terminate(){ze(this,uh,"f").terminate(),ze(this,es,"f").terminate()}get box(){return ze(this,Yt,"f")}get uuid(){return ze(this,Yt,"f").address.uuid}get address(){return ze(this,Yt,"f").address}get indexField(){return ze(this,Yt,"f").index}get duration(){return ze(this,Yt,"f").duration.getValue()}get mute(){return ze(this,Yt,"f").mute.getValue()}get hue(){return ze(this,Yt,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return ze(this,Yt,"f").events.targetVertex.map(e=>ze(this,fl,"f").boxAdapters.adapterFor(e.box,_r))}get label(){return ze(this,Yt,"f").label.getValue()}get trackBoxAdapter(){return ze(this,ch,"f")?m.None:ze(this,Yt,"f").clips.targetVertex.map(e=>ze(this,fl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{ValueClipBoxAdapter ${b.toString(ze(this,Yt,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};es=new WeakMap,fl=new WeakMap,Yt=new WeakMap,ml=new WeakMap,dh=new WeakMap,ch=new WeakMap,uh=new WeakMap,hl=new WeakSet,pu=function(){ze(this,dh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var mB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},hu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hA,gl,Iv,fu=class{constructor(e){this.type="transient-marker",hA.set(this,new j),gl.set(this,void 0),Iv.set(this,void 0),mB(this,gl,e,"f"),mB(this,Iv,new ce,"f")}get box(){return hu(this,gl,"f")}get uuid(){return hu(this,gl,"f").address.uuid}get address(){return hu(this,gl,"f").address}get position(){return hu(this,gl,"f").position.getValue()}subscribe(e){return hu(this,Iv,"f").subscribe(e)}terminate(){hu(this,hA,"f").terminate()}};hA=new WeakMap,gl=new WeakMap,Iv=new WeakMap;var ph=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Pr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Dv,hh,Po,fh,mu,Mv,On=class r{constructor(e,t){Dv.set(this,new j),hh.set(this,void 0),Po.set(this,void 0),fh.set(this,void 0),mu.set(this,void 0),Mv.set(this,void 0),ph(this,hh,e,"f"),ph(this,Po,t,"f"),ph(this,fh,b.newSet(({uuid:n})=>n),"f"),ph(this,mu,ai.create(r.Comparator),"f"),ph(this,Mv,Tg.memoizeAsync(async()=>{if(this.data.nonEmpty())return this.data.unwrap();let{promise:n,resolve:i,reject:o}=Promise.withResolvers(),a=this.getOrCreateLoader(),s=a.subscribe(l=>{l.type==="loaded"?(queueMicrotask(()=>s.terminate()),i(a.data.unwrap("State mismatch"))):l.type==="error"&&(queueMicrotask(()=>s.terminate()),o(new Error(l.reason)))});return n}),"f"),Pr(this,Dv,"f").ownAll(t.transientMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Pr(this,hh,"f").boxAdapters.adapterFor(n.box,fu);Pr(this,fh,"f").add(i)&&Pr(this,mu,"f").add(i)},onRemoved:({box:{address:{uuid:n}}})=>{Pr(this,mu,"f").remove(Pr(this,fh,"f").removeByKey(n))}}))}get box(){return Pr(this,Po,"f")}get uuid(){return Pr(this,Po,"f").address.uuid}get address(){return Pr(this,Po,"f").address}get startInSeconds(){return Pr(this,Po,"f").startInSeconds.getValue()}get endInSeconds(){return Pr(this,Po,"f").endInSeconds.getValue()}get transients(){return Pr(this,mu,"f")}get fileName(){return Pr(this,Po,"f").fileName.getValue()}get data(){return this.getOrCreateLoader().data}get peaks(){return this.getOrCreateLoader().peaks}get audioData(){return Pr(this,Mv,"f").call(this)}getOrCreateLoader(){return Pr(this,hh,"f").sampleManager.getOrCreate(Pr(this,Po,"f").address.uuid)}terminate(){Pr(this,Dv,"f").terminate()}};Dv=new WeakMap,hh=new WeakMap,Po=new WeakMap,fh=new WeakMap,mu=new WeakMap,Mv=new WeakMap;On.Comparator=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),D("Events at the same position: "+r.position+", "+e.position)):t};var mh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Gr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},gh,kv,$v,da,yh,vh,Tv,rs=class{constructor(e,t){gh.add(this),this.type="warp-marker",kv.set(this,new j),$v.set(this,void 0),da.set(this,void 0),yh.set(this,void 0),vh.set(this,!1),mh(this,$v,e,"f"),mh(this,da,t,"f"),mh(this,yh,new ce,"f"),Gr(this,kv,"f").own(t.subscribe(Ue.Children,()=>Gr(this,gh,"m",Tv).call(this)))}onSelected(){mh(this,vh,!0,"f"),this.optWarping.ifSome(e=>e.onChanged()),Gr(this,gh,"m",Tv).call(this)}onDeselected(){mh(this,vh,!1,"f"),Gr(this,gh,"m",Tv).call(this)}get box(){return Gr(this,da,"f")}get uuid(){return Gr(this,da,"f").address.uuid}get address(){return Gr(this,da,"f").address}get position(){return Gr(this,da,"f").position.getValue()}get seconds(){return Gr(this,da,"f").seconds.getValue()}get isSelected(){return Gr(this,vh,"f")}get optWarping(){return Gr(this,da,"f").owner.targetVertex.map(e=>Gr(this,$v,"f").boxAdapters.adapterFor(e.box,So.isAudioPlayMode))}get isAnchor(){return this.optWarping.mapOr(({warpMarkers:e})=>this===e.optAt(0)||this===e.optAt(e.length()-1),!1)}subscribe(e){return Gr(this,yh,"f").subscribe(e)}terminate(){Gr(this,kv,"f").terminate()}};kv=new WeakMap,$v=new WeakMap,da=new WeakMap,yh=new WeakMap,vh=new WeakMap,gh=new WeakSet,Tv=function(){Gr(this,yh,"f").notify(),this.optWarping.ifSome(e=>e.onChanged())};var Rv=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),D("Events at the same position: "+r.position+", "+e.position)):t};var xh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Tr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Cv,Ov,vl,yl,wh,gu,Eo=class{constructor(e,t){Cv.set(this,new j),Ov.set(this,void 0),vl.set(this,void 0),yl.set(this,void 0),wh.set(this,void 0),gu.set(this,void 0),xh(this,Ov,e,"f"),xh(this,vl,t,"f"),xh(this,yl,new ce,"f"),xh(this,wh,b.newSet(({uuid:n})=>n),"f"),xh(this,gu,ai.create(Rv),"f"),Tr(this,Cv,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Tr(this,Ov,"f").boxAdapters.adapterFor(n.box,rs);Tr(this,wh,"f").add(i)&&(Tr(this,gu,"f").add(i),Tr(this,yl,"f").notify())},onRemoved:({box:{address:{uuid:n}}})=>{Tr(this,gu,"f").remove(Tr(this,wh,"f").removeByKey(n)),Tr(this,yl,"f").notify()}}))}get box(){return Tr(this,vl,"f")}get uuid(){return Tr(this,vl,"f").address.uuid}get address(){return Tr(this,vl,"f").address}get warpMarkers(){return Tr(this,gu,"f")}clone(){let e=Qc.create(Tr(this,vl,"f").graph,b.generate());return this.warpMarkers.asArray().forEach(t=>La.create(e.graph,b.generate(),n=>{n.position.setValue(t.position),n.seconds.setValue(t.seconds),n.owner.refer(e.warpMarkers)})),e}subscribe(e){return Tr(this,yl,"f").subscribe(e)}onChanged(){Tr(this,yl,"f").notify()}terminate(){Tr(this,Cv,"f").terminate()}};Cv=new WeakMap,Ov=new WeakMap,vl=new WeakMap,yl=new WeakMap,wh=new WeakMap,gu=new WeakMap;var bh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Vv,zv,Vn,xl,Ah,vu,Fo=class{constructor(e,t){Vv.set(this,new j),zv.set(this,void 0),Vn.set(this,void 0),xl.set(this,void 0),Ah.set(this,void 0),vu.set(this,void 0),bh(this,zv,e,"f"),bh(this,Vn,t,"f"),bh(this,xl,new ce,"f"),bh(this,Ah,b.newSet(({uuid:n})=>n),"f"),bh(this,vu,ai.create(Rv),"f"),Xt(this,Vv,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Xt(this,zv,"f").boxAdapters.adapterFor(n.box,rs);Xt(this,Ah,"f").add(i)&&(Xt(this,vu,"f").add(i),Xt(this,xl,"f").notify())},onRemoved:({box:{address:{uuid:n}}})=>{Xt(this,vu,"f").remove(Xt(this,Ah,"f").removeByKey(n)),Xt(this,xl,"f").notify()}}))}get box(){return Xt(this,Vn,"f")}get uuid(){return Xt(this,Vn,"f").address.uuid}get address(){return Xt(this,Vn,"f").address}get warpMarkers(){return Xt(this,vu,"f")}get playbackRate(){return Xt(this,Vn,"f").playbackRate.getValue()}get cents(){return Math.log2(Xt(this,Vn,"f").playbackRate.getValue())*1200}set cents(e){Xt(this,Vn,"f").playbackRate.setValue(be(2**(e/1200),.5,2))}get transientPlayMode(){return Gi(Xt(this,Vn,"f").transientPlayMode.getValue(),qa)}clone(){let e=Yc.create(Xt(this,Vn,"f").graph,b.generate(),t=>{t.transientPlayMode.setValue(this.transientPlayMode),t.playbackRate.setValue(this.playbackRate),t.warpMarkers});return this.warpMarkers.asArray().forEach(t=>La.create(e.graph,b.generate(),n=>{n.position.setValue(t.position),n.seconds.setValue(t.seconds),n.owner.refer(e.warpMarkers)})),e}subscribe(e){return Xt(this,xl,"f").subscribe(e)}onChanged(){Xt(this,xl,"f").notify()}terminate(){Xt(this,Vv,"f").terminate()}};Vv=new WeakMap,zv=new WeakMap,Vn=new WeakMap,xl=new WeakMap,Ah=new WeakMap,vu=new WeakMap;var So;(function(r){r.isAudioPlayMode=e=>e instanceof Eo||e instanceof Fo})(So||(So={}));var Si=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ve=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},wl,yu,bl,Tt,Al,_l,_h,Sh,Ph,Pl,xu,wu,bu,is=class{constructor(e,t){wl.add(this),this.type="audio-clip",yu.set(this,new j),bl.set(this,void 0),Tt.set(this,void 0),Al.set(this,void 0),_l.set(this,void 0),_h.set(this,void 0),Sh.set(this,void 0),Ph.set(this,void 0),Pl.set(this,m.None),xu.set(this,m.None),wu.set(this,ee.Empty),Si(this,bl,e,"f"),Si(this,Tt,t,"f"),Si(this,Ph,!0,"f"),Si(this,Al,new Mr,"f"),Si(this,_l,ve(this,yu,"f").own(new Hi(!1)),"f"),Si(this,_h,Ys.aware(e.tempoMap,t.timeBase,t.duration),"f"),Si(this,Sh,ve(this,yu,"f").own(new ce),"f"),ve(this,yu,"f").ownAll(ve(this,Tt,"f").pointerHub.subscribe({onAdded:()=>ve(this,wl,"m",bu).call(this),onRemoved:()=>ve(this,wl,"m",bu).call(this)}),ve(this,Tt,"f").playMode.catchupAndSubscribe(({targetVertex:n})=>{ve(this,wu,"f").terminate(),n.match({none:()=>ve(this,Al,"f").clear(),some:({box:i})=>{let o=ve(this,bl,"f").boxAdapters.adapterFor(i,So.isAudioPlayMode);Si(this,wu,o.subscribe(()=>ve(this,wl,"m",bu).call(this)),"f"),ve(this,Al,"f").wrap(o)}})}),ve(this,Tt,"f").file.catchupAndSubscribe(n=>{Si(this,Pl,n.targetVertex.map(i=>ve(this,bl,"f").boxAdapters.adapterFor(i.box,On)),"f"),ve(this,xu,"f").ifSome(i=>i.terminate()),Si(this,xu,ve(this,Pl,"f").map(i=>i.getOrCreateLoader().subscribe(()=>ve(this,wl,"m",bu).call(this))),"f")}),ve(this,Tt,"f").subscribe(Ue.Children,n=>ve(this,wl,"m",bu).call(this))),Si(this,Ph,!1,"f")}catchupAndSubscribeSelected(e){return ve(this,_l,"f").catchupAndSubscribe(e)}subscribeChange(e){return ve(this,Sh,"f").subscribe(e)}accept(e){return P(e.visitAudioClipBoxAdapter,this)}consolidate(){}clone(e){let t=this.observableOptPlayMode.map(n=>n.clone());Jc.create(ve(this,bl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.gain.setValue(this.gain.getValue()),n.timeBase.setValue(this.timeBase),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(ve(this,Tt,"f").clips.targetVertex.unwrap()),n.file.refer(ve(this,Tt,"f").file.targetVertex.unwrap()),n.events.refer(ve(this,Tt,"f").events.targetVertex.unwrap()),t.ifSome(i=>n.playMode.refer(i))})}onSelected(){ve(this,_l,"f").setValue(!0)}onDeselected(){ve(this,_l,"f").setValue(!1)}get isSelected(){return ve(this,_l,"f").getValue()}get box(){return ve(this,Tt,"f")}get uuid(){return ve(this,Tt,"f").address.uuid}get address(){return ve(this,Tt,"f").address}get indexField(){return ve(this,Tt,"f").index}get duration(){return ve(this,_h,"f").toPPQN(0)}set duration(e){ve(this,_h,"f").fromPPQN(e,0)}get mute(){return ve(this,Tt,"f").mute.getValue()}get hue(){return ve(this,Tt,"f").hue.getValue()}get gain(){return ve(this,Tt,"f").gain}get file(){return ve(this,Pl,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return ve(this,Al,"f")}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return m.None}get timeBase(){return Gi(ve(this,Tt,"f").timeBase.getValue(),Wr)}get waveformOffset(){return ve(this,Tt,"f").waveformOffset}get isPlayModeNoStretch(){return ve(this,Tt,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>pt(e,Eo)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>pt(e,Fo)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>So.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(ve(this,Pl,"f").isEmpty())return"No Audio File";let e=ve(this,Pl,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):ve(this,Tt,"f").label.getValue()}get trackBoxAdapter(){return ve(this,Ph,"f")?m.None:ve(this,Tt,"f").clips.targetVertex.map(e=>ve(this,bl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return!1}get canMirror(){return!1}get canResize(){return ve(this,Al,"f").nonEmpty()}terminate(){ve(this,xu,"f").ifSome(e=>e.terminate()),Si(this,xu,m.None,"f"),ve(this,wu,"f").terminate(),Si(this,wu,ee.Empty,"f"),ve(this,yu,"f").terminate()}toString(){return`{AudioClipBoxAdapter ${b.toString(ve(this,Tt,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};yu=new WeakMap,bl=new WeakMap,Tt=new WeakMap,Al=new WeakMap,_l=new WeakMap,_h=new WeakMap,Sh=new WeakMap,Ph=new WeakMap,Pl=new WeakMap,xu=new WeakMap,wu=new WeakMap,wl=new WeakSet,bu=function(){ve(this,Sh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var Eh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Wt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Au,lr,Uv,Fh,Sl=class r{constructor(e,t){this.type="note-event",Au.set(this,void 0),lr.set(this,void 0),Uv.set(this,void 0),Fh.set(this,!1),Eh(this,Au,e,"f"),Eh(this,lr,t,"f"),Eh(this,Uv,Wt(this,lr,"f").subscribe(Ue.Children,n=>{if(!this.collection.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.collection.unwrap(),o=n.address.fieldKeys,a=U.equals(Wt(this,lr,"f").pitch.address.fieldKeys,o),s=U.equals(Wt(this,lr,"f").position.address.fieldKeys,o);a||s?i.requestSorting():i.onEventPropertyChanged()}}),"f")}onSelected(){Eh(this,Fh,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Eh(this,Fh,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Wt(this,Uv,"f").terminate()}get box(){return Wt(this,lr,"f")}get uuid(){return Wt(this,lr,"f").address.uuid}get address(){return Wt(this,lr,"f").address}get position(){return Wt(this,lr,"f").position.getValue()}get duration(){return Wt(this,lr,"f").duration.getValue()}get complete(){return this.position+this.duration}get velocity(){return Wt(this,lr,"f").velocity.getValue()}get pitch(){return Wt(this,lr,"f").pitch.getValue()}get cent(){return Wt(this,lr,"f").cent.getValue()}get chance(){return Wt(this,lr,"f").chance.getValue()}get playCount(){return Wt(this,lr,"f").playCount.getValue()}get playCurve(){return Wt(this,lr,"f").playCurve.getValue()}get isSelected(){return Wt(this,Fh,"f")}get collection(){return Wt(this,lr,"f").events.targetVertex.map(e=>Wt(this,Au,"f").boxAdapters.adapterFor(e.box,Yi))}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 Wt(this,Au,"f").boxAdapters.adapterFor(za.create(Wt(this,Au,"f").boxGraph,b.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 $r.curveFunc(e,this.playCurve)}canConsolidate(){return this.playCount>1}consolidate(){let e=this.playCount,t=this.collection.unwrap().box.events,n=U.create(i=>{let o=Math.floor(this.computeCurveValue(i/e)*this.duration),a=Math.floor(this.computeCurveValue((i+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 Wt(this,lr,"f").delete(),n}};Au=new WeakMap,lr=new WeakMap,Uv=new WeakMap,Fh=new WeakMap;var Bo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ne=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},pa,Bh,ns,zn,El,Nh,Ei,Lv,Kv,Wv,os,jv,Ih,Yi=class r{constructor(e,t){pa.add(this),Bh.set(this,new j),ns.set(this,void 0),zn.set(this,void 0),El.set(this,void 0),Nh.set(this,void 0),Ei.set(this,void 0),Lv.set(this,60),Kv.set(this,60),Wv.set(this,0),os.set(this,!1),Bo(this,ns,e,"f"),Bo(this,zn,t,"f"),Bo(this,El,new ce,"f"),Bo(this,Nh,b.newSet(n=>n.uuid),"f"),Bo(this,Ei,ai.create($r.Comparator),"f"),Ne(this,Bh,"f").own(Ne(this,zn,"f").events.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{let i=Ne(this,ns,"f").boxAdapters.adapterFor(n,Sl);Ne(this,Nh,"f").add(i)&&(Ne(this,Ei,"f").add(i),Ne(this,pa,"m",jv).call(this))},onRemoved:({box:{address:{uuid:n}}})=>{Ne(this,Ei,"f").remove(Ne(this,Nh,"f").removeByKey(n)),Ne(this,pa,"m",jv).call(this)}})),Ne(this,Bh,"f").own(Ne(this,zn,"f").owners.pointerHub.subscribe({onAdded:()=>Ne(this,El,"f").notify(this),onRemoved:()=>Ne(this,El,"f").notify(this)}))}copy(){let e=Ne(this,ns,"f").boxGraph,t=aa.create(e,b.generate());return Ne(this,Ei,"f").asArray().forEach(n=>n.copyTo({events:t.events})),Ne(this,ns,"f").boxAdapters.adapterFor(t,r)}createEvent({position:e,duration:t,velocity:n,pitch:i,chance:o,playCount:a,cent:s}){return Ne(this,ns,"f").boxAdapters.adapterFor(za.create(Ne(this,ns,"f").boxGraph,b.generate(),l=>{l.position.setValue(e),l.duration.setValue(t),l.velocity.setValue(n),l.pitch.setValue(i),l.chance.setValue(o),l.playCount.setValue(a),l.cent.setValue(s),l.events.refer(Ne(this,zn,"f").events)}),Sl)}subscribeChange(e){return Ne(this,El,"f").subscribe(e)}selectable(){return Ne(this,Ei,"f").asArray()}selectableAt(e){for(let t of Ne(this,Ei,"f").asArray())if(t.position<=e.u&&e.u<t.complete&&t.pitch===e.v)return ht.one(t);return ht.empty()}selectablesBetween(e,t){let n=[],i=Ne(this,Ei,"f").asArray(),o=Ne(this,Ei,"f").ceilFirstIndex(t.u);for(let a=0;a<o;a++){let s=i[a];s.complete>e.u&&s.pitch>=e.v&&s.pitch<=t.v&&n.push(s)}return n}requestSorting(){Ne(this,Ei,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Ne(this,pa,"m",jv).call(this)}terminate(){Ne(this,Bh,"f").terminate()}get box(){return Ne(this,zn,"f")}get uuid(){return Ne(this,zn,"f").address.uuid}get address(){return Ne(this,zn,"f").address}get numOwners(){return Ne(this,zn,"f").owners.pointerHub.filter(c.NoteEventCollection).length}get events(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Ei,"f")}get minPitch(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Lv,"f")}get maxPitch(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Kv,"f")}get maxDuration(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Wv,"f")}toString(){return`{NoteEventCollectionBox ${b.toString(Ne(this,zn,"f").address.uuid)}}`}};Bh=new WeakMap,ns=new WeakMap,zn=new WeakMap,El=new WeakMap,Nh=new WeakMap,Ei=new WeakMap,Lv=new WeakMap,Kv=new WeakMap,Wv=new WeakMap,os=new WeakMap,pa=new WeakSet,jv=function(){Bo(this,os,!1,"f"),Ne(this,El,"f").notify(this)},Ih=function(){let e=127,t=0,n=0;Ne(this,Ei,"f").asArray().forEach(({pitch:i,duration:o})=>{e=Math.min(e,i),t=Math.max(t,i),n=Math.max(n,o)}),Bo(this,Lv,e,"f"),Bo(this,Kv,t,"f"),Bo(this,Wv,n,"f"),Bo(this,os,!0,"f")};var Fl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ke=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Bl,_u,Nl,er,Il,kh,Dh,Mh,Pu,Su=class{constructor(e,t){Bl.add(this),this.type="note-clip",_u.set(this,new j),Nl.set(this,void 0),er.set(this,void 0),Il.set(this,void 0),kh.set(this,void 0),Dh.set(this,void 0),Mh.set(this,ee.Empty),Fl(this,Nl,e,"f"),Fl(this,er,t,"f"),Fl(this,Dh,!0,"f"),Fl(this,Il,Ke(this,_u,"f").own(new Hi(!1)),"f"),Fl(this,kh,Ke(this,_u,"f").own(new ce),"f"),Ke(this,_u,"f").ownAll(Ke(this,er,"f").pointerHub.subscribe({onAdded:()=>Ke(this,Bl,"m",Pu).call(this),onRemoved:()=>Ke(this,Bl,"m",Pu).call(this)}),Ke(this,er,"f").subscribe(Ue.Children,n=>Ke(this,Bl,"m",Pu).call(this)),Ke(this,er,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Ke(this,Mh,"f").terminate(),Fl(this,Mh,n.match({none:()=>ee.Empty,some:({box:i})=>Ke(this,Nl,"f").boxAdapters.adapterFor(i,Yi).subscribeChange(()=>Ke(this,Bl,"m",Pu).call(this))}),"f"),Ke(this,Bl,"m",Pu).call(this)})),Fl(this,Dh,!1,"f")}catchupAndSubscribeSelected(e){return Ke(this,Il,"f").catchupAndSubscribe(e)}subscribeChange(e){return Ke(this,kh,"f").subscribe(e)}accept(e){return P(e.visitNoteClipBoxAdapter,this)}consolidate(){this.isMirrowed&&Ke(this,er,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:Ke(this,er,"f").events.targetVertex.unwrap();Gc.create(Ke(this,Nl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(Ke(this,er,"f").clips.targetVertex.unwrap()),n.events.refer(t)})}onSelected(){Ke(this,Il,"f").setValue(!0)}onDeselected(){Ke(this,Il,"f").setValue(!1)}get isSelected(){return Ke(this,Il,"f").getValue()}terminate(){Ke(this,Mh,"f").terminate(),Ke(this,_u,"f").terminate()}get box(){return Ke(this,er,"f")}get uuid(){return Ke(this,er,"f").address.uuid}get address(){return Ke(this,er,"f").address}get indexField(){return Ke(this,er,"f").index}get duration(){return Ke(this,er,"f").duration.getValue()}get mute(){return Ke(this,er,"f").mute.getValue()}get hue(){return Ke(this,er,"f").hue.getValue()}get events(){return this.optCollection.map(e=>e.events)}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return Ke(this,er,"f").events.targetVertex.map(e=>Ke(this,Nl,"f").boxAdapters.adapterFor(e.box,Yi))}get label(){return Ke(this,er,"f").label.getValue()}get trackBoxAdapter(){return Ke(this,Dh,"f")?m.None:Ke(this,er,"f").clips.targetVertex.map(e=>Ke(this,Nl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{NoteClipBoxAdapter ${b.toString(Ke(this,er,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};_u=new WeakMap,Nl=new WeakMap,er=new WeakMap,Il=new WeakMap,kh=new WeakMap,Dh=new WeakMap,Mh=new WeakMap,Bl=new WeakSet,Pu=function(){Ke(this,kh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var Zv={for:(r,e)=>he(e.accept({visitNoteClipBox:t=>r.adapterFor(t,Su),visitValueClipBox:t=>r.adapterFor(t,ts),visitAudioClipBox:t=>r.adapterFor(t,is)}),"")};var Gv=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},as=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qv,Eu,$h,Th,Hv=class{constructor(e,t){qv.set(this,void 0),Eu.set(this,void 0),$h.set(this,void 0),Th.set(this,void 0),Gv(this,qv,e,"f"),Gv(this,Eu,new j,"f"),Gv(this,$h,as(this,Eu,"f").own(new ce),"f"),Gv(this,Th,as(this,Eu,"f").own(sr.create(e.box.clips,n=>Zv.for(t,n),c.ClipCollection)),"f"),as(this,Th,"f").subscribe({onAdd:()=>this.dispatchChange(),onRemove:()=>this.dispatchChange(),onReorder:()=>this.dispatchChange()})}get trackBoxAdapter(){return as(this,qv,"f")}get collection(){return as(this,Th,"f")}dispatchChange(){as(this,$h,"f").notify()}subscribeChanges(e){return as(this,$h,"f").subscribe(e)}terminate(){as(this,Eu,"f").terminate()}};qv=new WeakMap,Eu=new WeakMap,$h=new WeakMap,Th=new WeakMap;var Ek=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qr,Jv=class{constructor(e){qr.set(this,void 0),Ek(this,qr,e,"f")}get inField(){return Xi(this,qr,"f").in}get outField(){return Xi(this,qr,"f").out}get inSlopeField(){return Xi(this,qr,"f").inSlope}get outSlopeField(){return Xi(this,qr,"f").outSlope}get in(){return Xi(this,qr,"f").in.getValue()}get out(){return Xi(this,qr,"f").out.getValue()}get inSlope(){return Xi(this,qr,"f").inSlope.getValue()}get outSlope(){return Xi(this,qr,"f").outSlope.getValue()}get hasFading(){return Ca.hasFading(this)}copyTo(e){e.in.setValue(this.in),e.out.setValue(this.out),e.inSlope.setValue(this.inSlope),e.outSlope.setValue(this.outSlope)}reset(){Xi(this,qr,"f").in.setValue(0),Xi(this,qr,"f").out.setValue(0),Xi(this,qr,"f").inSlope.setValue(.75),Xi(this,qr,"f").outSlope.setValue(.25)}};qr=new WeakMap;var zt=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},X=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fi,Rh,en,et,Fu,Bu,Nu,Ch,Un,Oh,Dl,Iu,Du,Mu,ku,$u,tn,ha=class r{constructor(e,t){Fi.add(this),this.type="audio-region",Rh.set(this,void 0),en.set(this,void 0),et.set(this,void 0),Fu.set(this,void 0),Bu.set(this,void 0),Nu.set(this,void 0),Ch.set(this,void 0),Un.set(this,void 0),Oh.set(this,void 0),Dl.set(this,m.None),Iu.set(this,ee.Empty),Du.set(this,ee.Empty),Mu.set(this,ee.Empty),ku.set(this,ee.Empty),$u.set(this,void 0),zt(this,en,e,"f"),zt(this,et,t,"f"),zt(this,Rh,new j,"f");let{timeBase:n,duration:i,loopDuration:o}=t;zt(this,Fu,Ys.aware(e.tempoMap,n,i),"f"),zt(this,Bu,Ys.aware(e.tempoMap,n,o),"f"),zt(this,Nu,new Mr,"f"),zt(this,Ch,new ce,"f"),zt(this,Un,new Jv(t.fading),"f"),zt(this,$u,!1,"f"),zt(this,Oh,!0,"f"),X(this,Rh,"f").ownAll(X(this,et,"f").pointerHub.subscribe({onAdded:()=>X(this,Fi,"m",tn).call(this),onRemoved:()=>X(this,Fi,"m",tn).call(this)}),X(this,et,"f").file.catchupAndSubscribe(a=>{zt(this,Dl,a.targetVertex.map(s=>X(this,en,"f").boxAdapters.adapterFor(s.box,On)),"f"),X(this,Iu,"f").terminate(),zt(this,Iu,X(this,Dl,"f").mapOr(s=>s.getOrCreateLoader().subscribe(()=>X(this,Fi,"m",tn).call(this)),ee.Empty),"f")}),X(this,et,"f").playMode.catchupAndSubscribe(({targetVertex:a})=>{X(this,Du,"f").terminate(),a.match({none:()=>X(this,Nu,"f").clear(),some:({box:s})=>{let l=X(this,en,"f").boxAdapters.adapterFor(s,So.isAudioPlayMode);zt(this,Du,l.subscribe(()=>X(this,Fi,"m",tn).call(this)),"f"),X(this,Nu,"f").wrap(l)}})}),X(this,et,"f").timeBase.catchupAndSubscribe(a=>{X(this,Mu,"f").terminate(),Gi(a.getValue(),Wr)===Wr.Seconds&&zt(this,Mu,e.tempoMap.subscribe(()=>X(this,Fi,"m",tn).call(this)),"f")}),X(this,et,"f").subscribe(Ue.Children,a=>{if(!this.trackBoxAdapter.isEmpty()&&(a.type==="primitive"||a.type==="pointer")){let s=this.trackBoxAdapter.unwrap();X(this,et,"f").position.address.equals(a.address)?(s.regions.onIndexingChanged(),X(this,Fi,"m",tn).call(this)):X(this,Fi,"m",tn).call(this)}}),X(this,et,"f").events.catchupAndSubscribe(({targetVertex:a})=>{X(this,ku,"f").terminate(),zt(this,ku,a.match({none:()=>ee.Empty,some:({box:s})=>X(this,en,"f").boxAdapters.adapterFor(s,_r).subscribeChange(()=>X(this,Fi,"m",tn).call(this))}),"f"),X(this,Fi,"m",tn).call(this)})),zt(this,Oh,!1,"f")}subscribeChange(e){return X(this,Ch,"f").subscribe(e)}accept(e){return P(e.visitAudioRegionBoxAdapter,this)}onSelected(){zt(this,$u,!0,"f"),X(this,Fi,"m",tn).call(this)}onDeselected(){zt(this,$u,!1,"f"),X(this,Fi,"m",tn).call(this)}get isSelected(){return X(this,$u,"f")}get box(){return X(this,et,"f")}get uuid(){return X(this,et,"f").address.uuid}get address(){return X(this,et,"f").address}get position(){return X(this,et,"f").position.getValue()}get duration(){return X(this,Fu,"f").toPPQN(this.position)}get complete(){return this.position+this.duration}get loopOffset(){return X(this,et,"f").loopOffset.getValue()}get loopDuration(){return X(this,Bu,"f").toPPQN(this.position)}resolveDuration(e){return X(this,Fu,"f").toPPQN(e)}resolveComplete(e){return e+this.resolveDuration(e)}resolveLoopDuration(e){return X(this,Bu,"f").toPPQN(e)}get offset(){return this.position-this.loopOffset}get mute(){return X(this,et,"f").mute.getValue()}get hue(){return X(this,et,"f").hue.getValue()}get gain(){return X(this,et,"f").gain}get fading(){return X(this,Un,"f")}get file(){return X(this,Dl,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return X(this,Nu,"f")}get timeBase(){return Gi(X(this,et,"f").timeBase.getValue(),Wr)}get waveformOffset(){return X(this,et,"f").waveformOffset}get isPlayModeNoStretch(){return X(this,et,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>pt(e,Eo)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>pt(e,Fo)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>So.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(X(this,Dl,"f").isEmpty())return"No Audio File";let e=X(this,Dl,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):X(this,et,"f").label.getValue()}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}get trackBoxAdapter(){return X(this,et,"f").regions.targetVertex.map(e=>X(this,en,"f").boxAdapters.adapterFor(e.box,Vt))}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return X(this,et,"f").events.targetVertex.map(e=>X(this,en,"f").boxAdapters.adapterFor(e.box,_r))}set position(e){X(this,et,"f").position.setValue(e)}set duration(e){X(this,Fu,"f").fromPPQN(e,this.position);let t=X(this,Un,"f").in+X(this,Un,"f").out;if(t>e){let n=e/t;X(this,Un,"f").inField.setValue(X(this,Un,"f").in*n),X(this,Un,"f").outField.setValue(X(this,Un,"f").out*n)}}set loopOffset(e){X(this,et,"f").loopOffset.setValue(qs(e,this.loopDuration))}set loopDuration(e){X(this,Bu,"f").fromPPQN(e,this.position)}moveContentStart(e){let t=this.position,n=t+e;if(this.position=n,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e,this.timeBase===Wr.Seconds){let i=e>=0?X(this,en,"f").tempoMap.intervalToSeconds(t,n):-X(this,en,"f").tempoMap.intervalToSeconds(n,t);X(this,et,"f").waveformOffset.setValue(this.waveformOffset.getValue()+i)}else this.optWarpMarkers.ifSome(i=>i.asArray().forEach(o=>o.box.position.setValue(o.position-e)))}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners,i=this.observableOptPlayMode.map(a=>a.clone()),o=X(this,en,"f").boxAdapters.adapterFor(ja.create(X(this,en,"f").boxGraph,b.generate(),a=>{a.timeBase.setValue(X(this,et,"f").timeBase.getValue()),a.position.setValue(e?.position??X(this,et,"f").position.getValue()),a.regions.refer(e?.target??X(this,et,"f").regions.targetVertex.unwrap()),a.file.refer(X(this,et,"f").file.targetVertex.unwrap()),a.events.refer(n),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()),i.ifSome(s=>a.playMode.refer(s)),X(this,Un,"f").copyTo(a.fading)}),r);return o.loopDuration=e?.loopDuration??this.resolveLoopDuration(o.position),o.loopOffset=e?.loopOffset??this.loopOffset,o.duration=e?.duration??this.resolveDuration(o.position),o}consolidate(){}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){return m.None}terminate(){X(this,Iu,"f").terminate(),zt(this,Iu,ee.Empty,"f"),X(this,Mu,"f").terminate(),zt(this,Mu,ee.Empty,"f"),X(this,Du,"f").terminate(),zt(this,Du,ee.Empty,"f"),X(this,ku,"f").terminate(),zt(this,ku,ee.Empty,"f"),X(this,Rh,"f").terminate()}toString(){return`{AudioRegionBoxAdapter ${b.toString(X(this,et,"f").address.uuid)}}`}};Rh=new WeakMap,en=new WeakMap,et=new WeakMap,Fu=new WeakMap,Bu=new WeakMap,Nu=new WeakMap,Ch=new WeakMap,Un=new WeakMap,Oh=new WeakMap,Dl=new WeakMap,Iu=new WeakMap,Du=new WeakMap,Mu=new WeakMap,ku=new WeakMap,$u=new WeakMap,Fi=new WeakSet,tn=function(){X(this,Oh,"f")||(X(this,Ch,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange())};var fa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ie=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},No,Qv,Io,bt,Uh,Vh,Tu,zh,ma,ss=class r{constructor(e,t){No.add(this),this.type="note-region",Qv.set(this,new j),Io.set(this,void 0),bt.set(this,void 0),Uh.set(this,void 0),Vh.set(this,void 0),Tu.set(this,void 0),zh.set(this,ee.Empty),fa(this,Io,e,"f"),fa(this,bt,t,"f"),fa(this,Uh,new ce,"f"),fa(this,Tu,!1,"f"),fa(this,Vh,!0,"f"),Ie(this,Qv,"f").ownAll(Ie(this,bt,"f").pointerHub.subscribe({onAdded:()=>Ie(this,No,"m",ma).call(this),onRemoved:()=>Ie(this,No,"m",ma).call(this)}),Ie(this,bt,"f").subscribe(Ue.Children,n=>{if(!this.trackBoxAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackBoxAdapter.unwrap();Ie(this,bt,"f").position.address.equals(n.address)?(i.regions.onIndexingChanged(),Ie(this,No,"m",ma).call(this)):Ie(this,No,"m",ma).call(this)}}),Ie(this,bt,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Ie(this,zh,"f").terminate(),fa(this,zh,n.match({none:()=>ee.Empty,some:({box:i})=>Ie(this,Io,"f").boxAdapters.adapterFor(i,Yi).subscribeChange(()=>Ie(this,No,"m",ma).call(this))}),"f"),Ie(this,No,"m",ma).call(this)})),fa(this,Vh,!1,"f")}set position(e){Ie(this,bt,"f").position.setValue(e)}set duration(e){Ie(this,bt,"f").duration.setValue(e)}set loopOffset(e){Ie(this,bt,"f").loopOffset.setValue(e)}set loopDuration(e){Ie(this,bt,"f").loopDuration.setValue(e)}moveContentStart(e){this.optCollection.ifSome(t=>t.events.asArray().forEach(n=>n.box.position.setValue(n.position-e))),this.position=this.position+e,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e}subscribeChange(e){return Ie(this,Uh,"f").subscribe(e)}accept(e){return P(e.visitNoteRegionBoxAdapter,this)}onSelected(){fa(this,Tu,!0,"f"),Ie(this,No,"m",ma).call(this)}onDeselected(){fa(this,Tu,!1,"f"),Ie(this,No,"m",ma).call(this)}get isSelected(){return Ie(this,Tu,"f")}*iterateActiveNotesAt(e){let t=this.optCollection;if(t.isEmpty())return;let n=t.unwrap(),i=kr.globalToLocal(this,e);for(let o of n.events.iterateFrom(i-n.maxDuration)){if(i<o.position)return;i<o.complete&&(yield o.copyAsNoteEvent())}}terminate(){Ie(this,zh,"f").terminate(),Ie(this,Qv,"f").terminate()}get box(){return Ie(this,bt,"f")}get uuid(){return Ie(this,bt,"f").address.uuid}get address(){return Ie(this,bt,"f").address}get position(){return Ie(this,bt,"f").position.getValue()}get duration(){return Ie(this,bt,"f").duration.getValue()}get loopOffset(){return Ie(this,bt,"f").loopOffset.getValue()}get loopDuration(){return Ie(this,bt,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}resolveDuration(e){return this.duration}resolveComplete(e){return e+this.duration}resolveLoopDuration(e){return this.loopDuration}get mute(){return Ie(this,bt,"f").mute.getValue()}get hue(){return Ie(this,bt,"f").hue.getValue()}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return Ie(this,bt,"f").events.targetVertex.map(e=>Ie(this,Io,"f").boxAdapters.adapterFor(e.box,Yi))}get label(){return Ie(this,bt,"f").label.getValue()}get trackBoxAdapter(){return Ie(this,Vh,"f")?m.None:Ie(this,bt,"f").regions.targetVertex.map(e=>Ie(this,Io,"f").boxAdapters.adapterFor(e.box,Vt))}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"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return Ie(this,Io,"f").boxAdapters.adapterFor(cl.create(Ie(this,Io,"f").boxGraph,b.generate(),i=>{i.position.setValue(e?.position??this.position),i.duration.setValue(e?.duration??this.duration),i.loopOffset.setValue(e?.loopOffset??this.loopOffset),i.loopDuration.setValue(e?.loopDuration??this.loopDuration),i.hue.setValue(this.hue),i.label.setValue(this.label),i.mute.setValue(this.mute),i.events.refer(n),i.regions.refer(e?.target??Ie(this,bt,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.optCollection.ifSome(e=>{let t=Ie(this,Io,"f").boxGraph,n=aa.create(t,b.generate());e.events.asArray().forEach(i=>i.copyTo({events:n.events})),Ie(this,bt,"f").events.refer(n.owners)})}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return m.None;let t=Ie(this,Io,"f").boxGraph,n=e.toSorted(Ra.Comparator),i=U.getFirst(n,"Internal error (no first)"),o=U.getLast(n,"Internal error (no last)"),a=i.position,s=o.position+o.duration,l=i.trackBoxAdapter.unwrap(),u=aa.create(t,b.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let h=d;for(let{resultStart:g,resultEnd:v,rawStart:y}of kr.locateLoops(h,h.position,h.complete)){let x=Math.floor(g-y),B=Math.floor(v-y);for(let I of h.optCollection.unwrap().events.iterateRange(x,B))I.copyTo({position:I.position+y-i.position,events:u.events})}}),p.forEach(({box:d})=>d.delete()),m.wrap(cl.create(t,b.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 ${b.toString(Ie(this,bt,"f").address.uuid)} p: ${J.toString(this.position)}, c: ${J.toString(this.complete)}}`}};Qv=new WeakMap,Io=new WeakMap,bt=new WeakMap,Uh=new WeakMap,Vh=new WeakMap,Tu=new WeakMap,zh=new WeakMap,No=new WeakSet,ma=function(){Ie(this,Uh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var ga=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Se=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},jn,Ru,Do,At,Kh,Cu,jh,Lh,Mo,va=class r{constructor(e,t){jn.add(this),this.type="value-region",Ru.set(this,new j),Do.set(this,void 0),At.set(this,void 0),Kh.set(this,void 0),Cu.set(this,void 0),jh.set(this,void 0),Lh.set(this,ee.Empty),ga(this,Do,e,"f"),ga(this,At,t,"f"),ga(this,jh,!0,"f"),ga(this,Kh,new ce,"f"),ga(this,Cu,!1,"f"),Se(this,Ru,"f").own(Se(this,At,"f").pointerHub.subscribe({onAdded:()=>Se(this,jn,"m",Mo).call(this),onRemoved:()=>Se(this,jn,"m",Mo).call(this)})),Se(this,Ru,"f").own(Se(this,At,"f").subscribe(Ue.Children,n=>{if(!this.trackBoxAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackBoxAdapter.unwrap();Se(this,At,"f").position.address.equals(n.address)?(i.regions.onIndexingChanged(),Se(this,jn,"m",Mo).call(this)):Se(this,jn,"m",Mo).call(this)}})),Se(this,Ru,"f").own(Se(this,At,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Se(this,Lh,"f").terminate(),ga(this,Lh,n.match({none:()=>ee.Empty,some:({box:i})=>Se(this,Do,"f").boxAdapters.adapterFor(i,_r).subscribeChange(()=>Se(this,jn,"m",Mo).call(this))}),"f"),Se(this,jn,"m",Mo).call(this)})),ga(this,jh,!1,"f")}valueAt(e,t){let n=this.optCollection;return n.isEmpty()?t:n.unwrap().valueAt(kr.globalToLocal(this,e),t)}incomingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let n=t.unwrap().events.greaterEqual(0);return q(n)&&n.position===0?n.value:this.valueAt(this.position,e)}outgoingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let n=t.unwrap();return(this.complete-this.offset)%this.loopDuration===0?n.valueAt(this.loopDuration,e):n.valueAt(kr.globalToLocal(this,this.complete),e)}subscribeChange(e){return Se(this,Kh,"f").subscribe(e)}accept(e){return P(e.visitValueRegionBoxAdapter,this)}onSelected(){ga(this,Cu,!0,"f"),Se(this,jn,"m",Mo).call(this)}onDeselected(){ga(this,Cu,!1,"f"),Se(this,jn,"m",Mo).call(this)}get isSelected(){return Se(this,Cu,"f")}onValuesPropertyChanged(){Se(this,jn,"m",Mo).call(this)}onValuesSortingChanged(){this.onValuesPropertyChanged()}terminate(){Se(this,Lh,"f").terminate(),Se(this,Ru,"f").terminate()}get box(){return Se(this,At,"f")}get uuid(){return Se(this,At,"f").address.uuid}get address(){return Se(this,At,"f").address}get position(){return Se(this,At,"f").position.getValue()}get duration(){return Se(this,At,"f").duration.getValue()}get loopOffset(){return Se(this,At,"f").loopOffset.getValue()}get loopDuration(){return Se(this,At,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}resolveDuration(e){return this.duration}resolveComplete(e){return e+this.duration}resolveLoopDuration(e){return this.loopDuration}get mute(){return Se(this,At,"f").mute.getValue()}get hue(){return Se(this,At,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return Se(this,At,"f").events.targetVertex.map(e=>Se(this,Do,"f").boxAdapters.adapterFor(e.box,_r))}get label(){return Se(this,At,"f").label.getValue()}get trackBoxAdapter(){return Se(this,jh,"f")?m.None:Se(this,At,"f").regions.targetVertex.map(e=>Se(this,Do,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}set position(e){Se(this,At,"f").position.setValue(e)}set duration(e){Se(this,At,"f").duration.setValue(e)}set loopOffset(e){Se(this,At,"f").loopOffset.setValue(e)}set loopDuration(e){Se(this,At,"f").loopDuration.setValue(e)}moveContentStart(e){this.optCollection.ifSome(t=>t.events.asArray().forEach(n=>n.box.position.setValue(n.position-e))),this.position=this.position+e,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return Se(this,Do,"f").boxAdapters.adapterFor(ul.create(Se(this,Do,"f").boxGraph,b.generate(),i=>{i.position.setValue(e?.position??this.position),i.duration.setValue(e?.duration??this.duration),i.loopOffset.setValue(e?.loopOffset??this.loopOffset),i.loopDuration.setValue(e?.loopDuration??this.loopDuration),i.hue.setValue(this.hue),i.label.setValue(this.label),i.mute.setValue(this.mute),i.events.refer(n),i.regions.refer(e?.target??Se(this,At,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.events.ifSome(e=>{let t=Se(this,Do,"f").boxGraph,n=kn.create(t,b.generate());e.asArray().forEach(i=>i.copyTo({events:n.events})),Se(this,At,"f").events.refer(n.owners)})}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return m.None;let t=Se(this,Do,"f").boxGraph,n=e.toSorted(Ra.Comparator),i=U.getFirst(n,"Internal error (no first)"),o=U.getLast(n,"Internal error (no last)"),a=i.position,s=o.position+o.duration,l=i.trackBoxAdapter.unwrap(),u=Array.from(l.regions.collection.iterateRange(a,s)),p=[];u.filter(v=>v.isSelected).forEach(v=>{let y=v,x=y.optCollection.unwrap(),B=x.events;for(let{rawStart:I,regionStart:O,regionEnd:z}of kr.locateLoops(y,y.position,y.complete)){let $=O-I,ie=z-I,ne=B.greaterEqual($);if(!q(ne)||ne.position!==$){let W=B.lowerEqual($);q(W)&&p.push({position:O-a,value:x.valueAt($,0),interpolation:W.interpolation})}let le=!1;for(let W of B.iterateRange($,yr.MAX_VALUE)){let xe=W.position+I;if(xe<z)p.push({position:xe-a,value:W.value,interpolation:W.interpolation});else if(xe===z){p.push({position:xe-a,value:W.value,interpolation:si.None}),le=!0;break}else{p.push({position:z-a,value:x.valueAt(ie,0),interpolation:si.None}),le=!0;break}}le||p.push({position:z-a,value:x.valueAt(ie,0),interpolation:si.None})}});let d=[];for(let v of p){let y=d.length>0?d[d.length-1]:void 0;q(y)&&y.position===v.position&&y.value===v.value?d[d.length-1]=v:d.push(v)}let h=kn.create(t,b.generate()),g=0;for(;g<d.length;){let v=g+1;for(;v<d.length&&d[v].position===d[g].position;)v++;let y=d[g],x=d[v-1],B=Mn.create(t,b.generate(),I=>{I.position.setValue(y.position),I.index.setValue(0),I.value.setValue(y.value),I.events.refer(h.events)});if(li.write(B.interpolation,v-g>1?si.None:y.interpolation),v-g>1){let I=Mn.create(t,b.generate(),O=>{O.position.setValue(x.position),O.index.setValue(1),O.value.setValue(x.value),O.events.refer(h.events)});li.write(I.interpolation,x.interpolation)}g=v}return u.forEach(({box:v})=>v.delete()),m.wrap(ul.create(t,b.generate(),v=>{v.position.setValue(a),v.duration.setValue(s-a),v.loopDuration.setValue(s-a),v.loopOffset.setValue(0),v.hue.setValue(this.hue),v.mute.setValue(this.mute),v.label.setValue(this.label),v.events.refer(h.owners),v.regions.refer(l.box.regions)}))}toString(){return`{ValueRegionBoxAdapter ${b.toString(Se(this,At,"f").address.uuid)} p: ${J.toString(this.position)}, c: ${J.toString(this.complete)}}`}};Ru=new WeakMap,Do=new WeakMap,At=new WeakMap,Kh=new WeakMap,Cu=new WeakMap,jh=new WeakMap,Lh=new WeakMap,jn=new WeakSet,Mo=function(){Se(this,Kh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var gB=(r,e)=>r.position-e.position,vB={for:(r,e)=>he(e.accept({visitNoteRegionBox:t=>r.adapterFor(t,ss),visitAudioRegionBox:t=>r.adapterFor(t,ha),visitValueRegionBox:t=>r.adapterFor(t,va)}),"")};var Ou=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Wh,Ml,Zh,Vu,kl,zu,Yv=class{constructor(e,t){Wh.set(this,void 0),Ml.set(this,void 0),Zh.set(this,void 0),Vu.set(this,void 0),kl.set(this,void 0),zu.set(this,void 0),Ou(this,Wh,e,"f"),Ou(this,Ml,new j,"f"),Ou(this,Zh,mr(this,Ml,"f").own(new ce),"f"),Ou(this,Vu,mr(this,Ml,"f").own(new ar),"f"),Ou(this,kl,Ra.create(gB),"f"),Ou(this,zu,b.newSet(n=>n.uuid),"f"),mr(this,Ml,"f").ownAll(mr(this,Wh,"f").box.regions.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{let i=vB.for(t,n),o=mr(this,zu,"f").add(i);V(o,`Cannot add ${n}`),mr(this,kl,"f").add(i),mr(this,Vu,"f").forEach(a=>a.onAdded(i)),this.dispatchChange()},onRemoved:({box:{address:{uuid:n}}})=>{let i=mr(this,zu,"f").removeByKey(n);mr(this,kl,"f").remove(i),mr(this,Vu,"f").forEach(o=>o.onRemoved(i)),this.dispatchChange()}},c.RegionCollection))}get trackBoxAdapter(){return mr(this,Wh,"f")}get collection(){return mr(this,kl,"f")}get adapters(){return mr(this,zu,"f")}onIndexingChanged(){mr(this,kl,"f").onIndexingChanged(),this.dispatchChange()}catchupAndSubscribe(e){return this.collection.asArray().forEach(e.onAdded),mr(this,Vu,"f").subscribe(e)}subscribeChanges(e){return mr(this,Zh,"f").subscribe(e)}dispatchChange(){mr(this,Zh,"f").notify()}terminate(){mr(this,Ml,"f").terminate()}};Wh=new WeakMap,Ml=new WeakMap,Zh=new WeakMap,Vu=new WeakMap,kl=new WeakMap,zu=new WeakMap;var me;(function(r){r[r.Undefined=0]="Undefined",r[r.Notes=1]="Notes",r[r.Audio=2]="Audio",r[r.Value=3]="Value"})(me||(me={}));(function(r){r.toLabelString=e=>{switch(e){case r.Audio:return"Audio";case r.Notes:return"Note";case r.Value:return"Automation";case r.Undefined:default:return"N/A"}},r.toIconSymbol=e=>{switch(e){case r.Audio:return He.Waveform;case r.Notes:return He.Piano;case r.Value:return He.Automation;case r.Undefined:return He.AudioBus;default:return He.Unknown}}})(me||(me={}));var Xv;(function(r){r.isDeviceBox=e=>e.tags.type==="device",r.isInstrumentDeviceBox=e=>r.isDeviceBox(e)&&e.tags.deviceType==="instrument",r.isEffectDeviceBox=e=>r.isDeviceBox(e)&&(e.tags.deviceType==="audio-effect"||e.tags.deviceType==="midi-effect"),r.lookupHostField=e=>q(e)&&"host"in e&&pt(e.host,N)?e.host:D(`Could not find 'host' field in '${e?.name}'`),r.lookupLabelField=e=>q(e)&&"label"in e&&pt(e.label,C)?e.label:D(`Could not find 'label' field in '${e?.name}'`),r.lookupEnabledField=e=>q(e)&&"enabled"in e&&pt(e.enabled,k)?e.enabled:D(`Could not find 'enabled' field in '${e?.name}'`),r.lookupMinimizedField=e=>q(e)&&"minimized"in e&&pt(e.minimized,k)?e.minimized:D(`Could not find 'minimized' field in '${e?.name}'`),r.lookupIndexField=e=>q(e)&&"index"in e&&pt(e.index,E)?e.index:D(`Could not find 'index' field in '${e?.name}'`)})(Xv||(Xv={}));var yB;(function(r){r.toTrackType=e=>{switch(e){case"midi":return me.Notes;case"audio":return me.Audio;default:return D()}}})(yB||(yB={}));var de;(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;V(U.satisfy(e,(i,o)=>i.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):D("unknown type")).map(({box:i})=>Xv.lookupIndexField(i)).filter(i=>e.some(o=>b.Comparator(o.uuid,i.address.uuid)!==0)).sort((i,o)=>i.getValue()-o.getValue()).forEach((i,o)=>i.setValue(o)),e.forEach(i=>i.box.delete())}})(de||(de={}));var ey=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Sr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Gh,ty,Ln,$l,ry,iy=class{constructor(e,t){Gh.set(this,void 0),ty.set(this,new ce),Ln.set(this,void 0),$l.set(this,void 0),ry.set(this,void 0),ey(this,Gh,e,"f"),ey(this,Ln,sr.create(e.box.tracks,n=>t.adapterFor(n,Vt),c.TrackCollection),"f"),ey(this,$l,b.newSet(({uuid:n})=>n),"f"),ey(this,ry,Sr(this,Ln,"f").catchupAndSubscribe({onAdd:n=>Sr(this,$l,"f").add({uuid:n.uuid,subscription:n.regions.subscribeChanges(()=>Sr(this,ty,"f").notify())}),onRemove:({uuid:n})=>Sr(this,$l,"f").removeByKey(n).subscription.terminate(),onReorder:n=>{}}),"f")}create(e,t,n){let i=Sr(this,Gh,"f").box.graph,o=Sr(this,Gh,"f").box.tracks;Zr.create(i,b.generate(),a=>{a.index.setValue(n??Sr(this,Ln,"f").getMinFreeIndex()),a.type.setValue(e),a.tracks.refer(o),a.target.refer(t)})}controls(e){return m.wrap(Sr(this,Ln,"f").adapters().find(t=>t.target.targetVertex.contains(e),!1))}delete(e){let t=Sr(this,Ln,"f").adapters(),n=t.indexOf(e);if(n===-1)return D(`Cannot delete ${e}. Does not exist.`);for(let i=n+1;i<t.length;i++)t[i].indexField.setValue(i-1);e.box.delete()}get collection(){return Sr(this,Ln,"f")}values(){return Sr(this,Ln,"f").adapters()}catchupAndSubscribe(e){return Sr(this,Ln,"f").catchupAndSubscribe(e)}subscribeAnyChange(e){return Sr(this,ty,"f").subscribe(e)}terminate(){Sr(this,Ln,"f").terminate(),Sr(this,ry,"f").terminate(),Sr(this,$l,"f").forEach(({subscription:e})=>e.terminate()),Sr(this,$l,"f").clear()}};Gh=new WeakMap,ty=new WeakMap,Ln=new WeakMap,$l=new WeakMap,ry=new WeakMap;var pe;(function(r){r.AudioBus="manuals/audio-bus",r.Arpeggio="manuals/devices/midi/arpeggio",r.Pitch="manuals/devices/midi/pitch",r.Velocity="manuals/devices/midi/velocity",r.Zeitgeist="manuals/devices/midi/zeitgeist",r.StereoTool="manuals/devices/audio/stereo-tool",r.Delay="manuals/devices/audio/delay",r.DattorroReverb="manuals/devices/audio/dattorro-reverb",r.Maximizer="manuals/devices/audio/maximizer",r.Compressor="manuals/devices/audio/compressor",r.Gate="manuals/devices/audio/gate",r.Reverb="manuals/devices/audio/cheap-reverb",r.Crusher="manuals/devices/audio/crusher",r.Fold="manuals/devices/audio/fold",r.Tidal="manuals/devices/audio/tidal",r.Revamp="manuals/devices/audio/revamp",r.Modular="manuals/devices/audio/modular",r.NeuralAmp="manuals/devices/audio/neural-amp",r.Tape="manuals/devices/instruments/tape",r.Nano="manuals/devices/instruments/nano",r.Playfield="manuals/devices/instruments/playfield",r.Vaporisateur="manuals/devices/instruments/vaporisateur",r.MIDIOutput="manuals/devices/instruments/midi-output",r.Soundfont="manuals/devices/instruments/soundfont"})(pe||(pe={}));var xB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Kn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ny,Bi,Hr=class{constructor(e,t){this.type="bus",this.accepts="audio",this.manualUrl=pe.AudioBus,ny.set(this,void 0),Bi.set(this,void 0),xB(this,ny,e,"f"),xB(this,Bi,t,"f")}catchupAndSubscribe(e){return e(this),Kn(this,Bi,"f").subscribe(Ue.Children,()=>e(this))}get uuid(){return Kn(this,Bi,"f").address.uuid}get address(){return Kn(this,Bi,"f").address}get box(){return Kn(this,Bi,"f")}get enabledField(){return Kn(this,Bi,"f").enabled}get minimizedField(){return Kn(this,Bi,"f").minimized}get iconField(){return Kn(this,Bi,"f").icon}get labelField(){return Kn(this,Bi,"f").label}get colorField(){return Kn(this,Bi,"f").color}get iconSymbol(){return He.fromName(this.iconField.getValue()??"audio-bus")}deviceHost(){return Kn(this,ny,"f").boxAdapters.adapterFor(Kn(this,Bi,"f").output.targetVertex.unwrap("No AudioUnitBox found").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}toString(){return`{${this.constructor.name}}`}};ny=new WeakMap,Bi=new WeakMap;var qh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Dt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ya,Uu,ju,Ni,Hh,oy=class{constructor(e,t){ya.set(this,void 0),Uu.set(this,void 0),ju.set(this,void 0),Ni.set(this,void 0),Hh.set(this,ee.Empty),qh(this,ya,new j,"f"),qh(this,Uu,Dt(this,ya,"f").own(new ce),"f"),qh(this,ju,Dt(this,ya,"f").own(new Hi(He.Unknown)),"f"),qh(this,Ni,Dt(this,ya,"f").own(new Mr),"f"),Dt(this,ya,"f").own(Dt(this,Ni,"f").subscribe(n=>{Dt(this,Hh,"f").terminate(),qh(this,Hh,n.match({none:()=>(Dt(this,Uu,"f").notify(m.None),ee.Empty),some:({labelField:i,iconField:o})=>ee.many(o.catchupAndSubscribe(a=>Dt(this,ju,"f").setValue(He.fromName(a.getValue()))),i.catchupAndSubscribe(a=>Dt(this,Uu,"f").notify(m.wrap(a.getValue()))))}),"f")})),Dt(this,ya,"f").own(e.catchupAndSubscribe({onAdded:({box:n,pointerType:i})=>{if(Dt(this,Ni,"f").nonEmpty()){let a=Dt(this,Ni,"f").unwrap();D(`AudioUnitInput already has an input. Existing: ${a.box.name}@${a.box.address.toString()} (type: ${a.type}), Incoming: ${n.name}@${n.address.toString()} (pointerType: ${String(i)})`)}let o=n instanceof $n?t.adapterFor(n,Hr):t.adapterFor(n,de.isInstrument);Dt(this,Ni,"f").unwrapOrNull()!==o&&Dt(this,Ni,"f").wrap(o)},onRemoved:({box:n})=>{V(Dt(this,Ni,"f").unwrap("Cannot remove").box.address.equals(n.address),"Unexpected value to remove"),Dt(this,Ni,"f").clear()}},c.InstrumentHost,c.AudioOutput))}adapter(){return Dt(this,Ni,"f")}subscribe(e){return Dt(this,Ni,"f").subscribe(e)}catchupAndSubscribe(e){return e(Dt(this,Ni,"f")),this.subscribe(e)}catchupAndSubscribeLabelChange(e){return e(this.label),Dt(this,Uu,"f").subscribe(e)}catchupAndSubscribeIconChange(e){return Dt(this,ju,"f").catchupAndSubscribe(e)}set label(e){this.adapter().ifSome(t=>t.labelField.setValue(e))}get label(){return this.adapter().map(e=>e.labelField.getValue())}set icon(e){this.adapter().ifSome(t=>t.iconField.setValue(He.toName(e)))}get icon(){return this.adapter().match({none:()=>He.Unknown,some:e=>He.fromName(e.iconField.getValue())})}get iconValue(){return Dt(this,ju,"f")}terminate(){Dt(this,ya,"f").terminate(),Dt(this,Hh,"f").terminate()}};ya=new WeakMap,Uu=new WeakMap,ju=new WeakMap,Ni=new WeakMap,Hh=new WeakMap;var wB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Tl=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ay,xa,we=class{constructor(e){ay.set(this,void 0),xa.set(this,void 0),wB(this,ay,e,"f"),wB(this,xa,Me.newSet(t=>t.address),"f")}terminate(){Tl(this,xa,"f").forEach(e=>e.terminate()),Tl(this,xa,"f").clear()}parameters(){return Tl(this,xa,"f").values()}parameterAt(e){return Tl(this,xa,"f").getOrThrow(e,()=>new Error(`No ParameterAdapter found at [${e.toString()}]`))}createParameter(e,t,n,i,o){let a=new Rl(Tl(this,ay,"f"),e,t,n,i,o),s=Tl(this,xa,"f").add(a);return V(s,`Could not add adapter for ${e}`),a}removeParameter(e){return Tl(this,xa,"f").removeByKey(e)}};ay=new WeakMap,xa=new WeakMap;var Cl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Et=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ol,rn,ls,Lu,sy,ly,Jh,Ku=class{constructor(e,t){Ol.set(this,void 0),rn.set(this,void 0),ls.set(this,void 0),Lu.set(this,void 0),sy.set(this,void 0),ly.set(this,void 0),Jh.set(this,ee.Empty),Cl(this,Ol,e,"f"),Cl(this,rn,t,"f"),Cl(this,ls,new j,"f"),Cl(this,Lu,Et(this,ls,"f").own(new ce),"f"),Et(this,ls,"f").own(t.targetBus.catchupAndSubscribe(()=>{Et(this,Jh,"f").terminate(),Cl(this,Jh,this.optTargetBus.match({none:()=>(Et(this,Lu,"f").notify(m.None),ee.Empty),some:n=>n.catchupAndSubscribe(i=>Et(this,Lu,"f").notify(m.wrap(i)))}),"f")})),Cl(this,sy,Et(this,ls,"f").own(new Rl(Et(this,Ol,"f"),Et(this,rn,"f").sendPan,A.bipolar(),_.percent({unit:"%",fractionDigits:0}),"panning")),"f"),Cl(this,ly,Et(this,ls,"f").own(new Rl(Et(this,Ol,"f"),Et(this,rn,"f").sendGain,A.DefaultDecibel,_.numeric({unit:"dB",fractionDigits:1}),"gain")),"f")}catchupAndSubscribeBusChanges(e){return e(this.optTargetBus),Et(this,Lu,"f").subscribe(e)}get uuid(){return Et(this,rn,"f").address.uuid}get address(){return Et(this,rn,"f").address}get box(){return Et(this,rn,"f")}get indexField(){return Et(this,rn,"f").index}get sendPan(){return Et(this,sy,"f")}get sendGain(){return Et(this,ly,"f")}get targetBus(){return Et(this,Ol,"f").boxAdapters.adapterFor(Et(this,rn,"f").targetBus.targetVertex.unwrap("no audioUnit").box,Hr)}get optTargetBus(){return Et(this,rn,"f").targetBus.targetVertex.flatMap(e=>m.wrap(e.box.accept({visitAudioBusBox:t=>Et(this,Ol,"f").boxAdapters.adapterFor(t,Hr)})))}delete(){Et(this,rn,"f").delete()}terminate(){Et(this,ls,"f").terminate(),Et(this,Jh,"f").terminate()}};Ol=new WeakMap,rn=new WeakMap,ls=new WeakMap,Lu=new WeakMap,sy=new WeakMap,ly=new WeakMap,Jh=new WeakMap;var Qh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ko=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},cy,uy,Wu,Zu,Yh,dy=class{constructor(e,t){cy.set(this,void 0),uy.set(this,void 0),Wu.set(this,void 0),Zu.set(this,void 0),Yh.set(this,ee.Empty),Qh(this,cy,e,"f"),Qh(this,uy,t,"f"),Qh(this,Wu,new j,"f"),Qh(this,Zu,ko(this,Wu,"f").own(new ce),"f"),ko(this,Wu,"f").own(e.catchupAndSubscribe(()=>{ko(this,Yh,"f").terminate(),Qh(this,Yh,this.adapter.match({none:()=>(ko(this,Zu,"f").notify(m.None),ee.Empty),some:n=>n.catchupAndSubscribe(i=>ko(this,Zu,"f").notify(m.wrap(i)))}),"f")}))}subscribe(e){return ko(this,Zu,"f").subscribe(e)}catchupAndSubscribe(e){return e(this.adapter),this.subscribe(e)}get adapter(){return ko(this,cy,"f").targetVertex.flatMap(e=>m.wrap(e.box.accept({visitAudioBusBox:t=>ko(this,uy,"f").adapterFor(t,Hr)})))}terminate(){ko(this,Wu,"f").terminate(),ko(this,Yh,"f").terminate()}};cy=new WeakMap,uy=new WeakMap,Wu=new WeakMap,Zu=new WeakMap,Yh=new WeakMap;var wa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ge=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},py,bB,$o,Ii,Ut,zl,Gu,Vl,hy,Xh,fy,my,AB,_B,nn=class{constructor(e,t){py.add(this),this.class="device-host",$o.set(this,new j),Ii.set(this,void 0),Ut.set(this,void 0),zl.set(this,void 0),Gu.set(this,void 0),Vl.set(this,void 0),hy.set(this,void 0),Xh.set(this,void 0),fy.set(this,void 0),my.set(this,void 0),wa(this,Ii,e,"f"),wa(this,Ut,t,"f"),wa(this,zl,ge(this,$o,"f").own(new we(ge(this,Ii,"f"))),"f"),wa(this,Gu,ge(this,$o,"f").own(new iy(this,ge(this,Ii,"f").boxAdapters)),"f"),wa(this,Vl,ge(this,$o,"f").own(new oy(ge(this,Ut,"f").input.pointerHub,ge(this,Ii,"f").boxAdapters)),"f"),wa(this,hy,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").midiEffects,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,de.isMidiEffect),c.MIDIEffectHost)),"f"),wa(this,Xh,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").audioEffects,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,de.isAudioEffect),c.AudioEffectHost)),"f"),wa(this,fy,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").auxSends,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,Ku),c.AuxSend)),"f"),wa(this,my,ge(this,$o,"f").own(new dy(ge(this,Ut,"f").output,ge(this,Ii,"f").boxAdapters)),"f"),this.namedParameter=ge(this,py,"m",AB).call(this,t),ge(this,py,"m",_B).call(this)}get box(){return ge(this,Ut,"f")}get uuid(){return ge(this,Ut,"f").address.uuid}get address(){return ge(this,Ut,"f").address}get indexField(){return ge(this,Ut,"f").index}get type(){return ge(this,Ut,"f").type.getValue()}get captureBox(){return ge(this,Ut,"f").capture.targetVertex}get tracks(){return ge(this,Gu,"f")}get input(){return ge(this,Vl,"f")}get midiEffects(){return ge(this,hy,"f")}get audioEffects(){return ge(this,Xh,"f")}get inputAdapter(){return ge(this,Vl,"f").adapter()}get auxSends(){return ge(this,fy,"f")}get output(){return ge(this,my,"f")}get isBus(){return this.input.adapter().mapOr(e=>e.type==="bus",!1)}get isInstrument(){return this.input.adapter().mapOr(e=>e.type==="instrument",!1)}get isOutput(){return ge(this,Ut,"f").output.targetVertex.mapOr(e=>e.box.address.equals(ge(this,Ii,"f").rootBoxAdapter.address),!1)}get midiEffectsField(){return ge(this,Ut,"f").midiEffects}get inputField(){return ge(this,Ut,"f").input}get audioEffectsField(){return ge(this,Ut,"f").audioEffects}get tracksField(){return ge(this,Ut,"f").tracks}get minimizedField(){return ge(this,Vl,"f").adapter().unwrap().minimizedField}get isAudioUnit(){return!0}get label(){return ge(this,Vl,"f").adapter().mapOr(e=>e.labelField.getValue(),"")}deviceHost(){return this}audioUnitBoxAdapter(){return this}*labeledAudioOutputs(){let e=this.input.adapter();e.nonEmpty()&&(yield*e.unwrap().labeledAudioOutputs());for(let t of ge(this,Xh,"f").adapters())yield*t.labeledAudioOutputs();yield{address:this.address,label:"Channelstrip",children:()=>m.None}}indicesLimit(){let e=ge(this,Ii,"f").rootBoxAdapter.audioUnits.adapters(),t=this.indexField.getValue(),n=this.type,i=t,o=t;for(;i>0&&e[i-1].type===n;)i--;for(;o<e.length-1&&e[o+1].type===n;)o++;return[i,o+1]}move(e){ge(this,Ii,"f").rootBoxAdapter.audioUnits.move(this,e)}moveTrack(e,t){ge(this,Gu,"f").collection.move(e,t)}deleteTrack(e){ge(this,Gu,"f").delete(e)}toString(){return`{${this.constructor.name}}`}terminate(){ge(this,$o,"f").terminate()}};bB=nn,$o=new WeakMap,Ii=new WeakMap,Ut=new WeakMap,zl=new WeakMap,Gu=new WeakMap,Vl=new WeakMap,hy=new WeakMap,Xh=new WeakMap,fy=new WeakMap,my=new WeakMap,py=new WeakSet,AB=function(e){return{volume:ge(this,zl,"f").createParameter(e.volume,bB.VolumeMapper,_.decible,"volume"),panning:ge(this,zl,"f").createParameter(e.panning,A.bipolar(),_.panning,"panning",.5),mute:ge(this,zl,"f").createParameter(e.mute,A.bool,_.bool,"mute"),solo:ge(this,zl,"f").createParameter(e.solo,A.bool,_.bool,"solo")}},_B=function(){let e=this.address.toString(),t=ge(this,Ut,"f").capture.targetAddress.unwrapOrUndefined(),n=()=>`AudioUnit '${e}' must have a capture. AudioUnit is typed ${this.type} and has input ${ge(this,Ut,"f").input.pointerHub.incoming().at(0)?.box.name}, but capture is ${t}`;V(this.type!==Qt.Instrument||ge(this,Ut,"f").capture.targetAddress.nonEmpty(),n)};nn.VolumeMapper=A.decibel(-96,-9,6);var qu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},rt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},gy,on,Jr,Ul,vy,yy,ef,PB,SB,Vt=class{constructor(e,t){gy.add(this),on.set(this,void 0),Jr.set(this,void 0),Ul.set(this,void 0),vy.set(this,void 0),yy.set(this,void 0),ef.set(this,void 0),qu(this,on,e,"f"),qu(this,Jr,t,"f"),qu(this,Ul,new j,"f"),qu(this,vy,rt(this,Ul,"f").own(new Hv(this,e.boxAdapters)),"f"),qu(this,yy,rt(this,Ul,"f").own(new Yv(this,e.boxAdapters)),"f"),qu(this,ef,rt(this,Ul,"f").own(new Hi(-1)),"f")}catchupAndSubscribePath(e){let t=[m.None,m.None],n=()=>{t.every(i=>i.nonEmpty())?e(m.wrap(t.map(i=>i.unwrap()))):e(m.None)};return ee.many(rt(this,gy,"m",PB).call(this,i=>{t[0].equals(i)||(t[0]=i,n())}),rt(this,gy,"m",SB).call(this,i=>{t[1].equals(i)||(t[1]=i,n())}))}get context(){return rt(this,on,"f")}set targetName(e){rt(this,Jr,"f").target.targetVertex.ifSome(t=>{let n=t.box;if(n instanceof yt){rt(this,on,"f").boxAdapters.adapterFor(n,nn).input.adapter().ifSome(o=>o.labelField.setValue(e));return}rt(this,on,"f").boxAdapters.optAdapter(n).ifSome(i=>{"labelField"in i&&i.labelField instanceof C&&i.labelField.setValue(e)})})}get targetName(){return rt(this,Jr,"f").target.targetVertex.flatMap(e=>{let t=e.box;if(t instanceof yt)return rt(this,on,"f").boxAdapters.adapterFor(t,nn).input.label;let n=rt(this,on,"f").boxAdapters.optAdapter(t);if(n.nonEmpty()){let i=n.unwrap();if("labelField"in i&&i.labelField instanceof C)return m.wrap(i.labelField.getValue())}return m.wrap(t.name)})}terminate(){rt(this,Ul,"f").terminate()}get audioUnit(){return Ce(rt(this,Jr,"f").tracks.targetVertex.unwrap().box,yt)}get target(){return rt(this,Jr,"f").target}get clips(){return rt(this,vy,"f")}get regions(){return rt(this,yy,"f")}get enabled(){return rt(this,Jr,"f").enabled}get indexField(){return rt(this,Jr,"f").index}get type(){return rt(this,Jr,"f").type.getValue()}get box(){return rt(this,Jr,"f")}get uuid(){return rt(this,Jr,"f").address.uuid}get address(){return rt(this,Jr,"f").address}get listIndex(){return rt(this,ef,"f").getValue()}set listIndex(e){rt(this,ef,"f").setValue(e)}accepts(e){switch(e.type){case"audio-clip":return this.type===me.Audio;case"note-clip":return this.type===me.Notes;case"value-clip":return this.type===me.Value;case"audio-region":return this.type===me.Audio;case"note-region":return this.type===me.Notes;case"value-region":return this.type===me.Value}}valueAt(e,t){if(!this.enabled.getValue())return t;let n=t,i=rt(this,on,"f").clipSequencing.iterate(this.uuid,e,e+Ng);for(let{optClip:o,sectionFrom:a}of i)n=o.match({none:()=>{let s=this.regions.collection.lowerEqual(e,l=>!l.mute);if(s===null){let l=this.regions.collection.optAt(0);return pt(l,va)?l.incomingValue(t):t}else if(pt(s,va))return e<s.complete?s.valueAt(e,t):s.outgoingValue(t);return t},some:s=>a===e&&pt(s,ts)?s.valueAt(e,t):t});return n}};on=new WeakMap,Jr=new WeakMap,Ul=new WeakMap,vy=new WeakMap,yy=new WeakMap,ef=new WeakMap,gy=new WeakSet,PB=function(e){let t=rt(this,Jr,"f").target.targetVertex;if(t.nonEmpty()){let n=t.unwrap().box;if(n instanceof yt)return rt(this,on,"f").boxAdapters.adapterFor(n,nn).input.catchupAndSubscribeLabelChange(a=>e(a));let i=rt(this,on,"f").boxAdapters.optAdapter(n);if(i.nonEmpty()){let o=i.unwrap();if("labelField"in o&&o.labelField instanceof C)return o.labelField.catchupAndSubscribe(a=>e(m.wrap(a.getValue())))}return e(m.wrap(n.name)),ee.Empty}return e(m.None),ee.Empty},SB=function(e){let t=this.type;switch(t){case me.Audio:case me.Notes:return e(m.wrap(me[t])),ee.Empty;case me.Value:{let n=rt(this,Jr,"f").target.targetVertex.unwrap();if(n.isField())e(rt(this,on,"f").parameterFieldAdapters.opt(n.address).map(i=>i.name));else if(n.isBox())e(m.wrap(n.name));else return D("Illegal State. Vertex is not a field nor box.");return ee.Empty}case me.Undefined:return e(m.wrap("")),ee.Empty;default:return e(m.None),ee.Empty}};var Er=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},_e=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ba,Di,cs,jl,xy,wy,Ll,Kl,us,ds,Wl,Hu,tf,EB=[c.Automation,c.Modulation,c.MIDIControl,c.ParameterController],Rl=class{constructor(e,t,n,i,o,a){ba.set(this,void 0),Di.set(this,void 0),cs.set(this,void 0),jl.set(this,void 0),xy.set(this,void 0),wy.set(this,void 0),Ll.set(this,new j),Kl.set(this,void 0),us.set(this,void 0),ds.set(this,m.None),Wl.set(this,m.None),Hu.set(this,null),tf.set(this,!1),Er(this,ba,e,"f"),Er(this,Di,t,"f"),Er(this,cs,n,"f"),Er(this,jl,i,"f"),Er(this,xy,o,"f"),Er(this,wy,a??0,"f"),_e(this,Ll,"f").own(_e(this,ba,"f").parameterFieldAdapters.register(this)),Er(this,Kl,_e(this,Ll,"f").own(new ce),"f"),Er(this,us,new ar,"f"),_e(this,Ll,"f").own(_e(this,Di,"f").subscribe(()=>_e(this,Kl,"f").notify(this))),_e(this,Ll,"f").own(_e(this,Di,"f").pointerHub.catchupAndSubscribe({onAdded:s=>{_e(this,us,"f").proxy.onControlSourceAdd(fA(s.pointerType)),s.box.accept({visitTrackBox:l=>{V(_e(this,ds,"f").isEmpty(),"Already assigned");let u=_e(this,ba,"f").boxAdapters.adapterFor(l,Vt);Er(this,ds,m.wrap(u),"f"),_e(this,ba,"f").isMainThread&&Er(this,Wl,m.wrap(_e(this,ba,"f").liveStreamReceiver.subscribeFloat(_e(this,Di,"f").address,p=>{_e(this,Hu,"f")!==p&&(Er(this,Hu,p,"f"),_e(this,Kl,"f").notify(this))})),"f")}})},onRemoved:s=>{_e(this,us,"f").proxy.onControlSourceRemove(fA(s.pointerType)),s.box.accept({visitTrackBox:l=>{V(_e(this,ds,"f").unwrapOrNull()?.address?.equals(l.address)===!0,`Unknown ${l}`),Er(this,ds,m.None,"f"),_e(this,ba,"f").isMainThread&&(_e(this,Wl,"f").ifSome(u=>u.terminate()),Er(this,Wl,m.None,"f"),Er(this,Hu,null,"f"),_e(this,Kl,"f").notify(this))}})}},...EB)),t.getValue(),n.clamp(t.getValue())}registerMidiControl(){return _e(this,us,"f").proxy.onControlSourceAdd("midi"),Er(this,tf,!0,"f"),{terminate:()=>{Er(this,tf,!1,"f"),_e(this,us,"f").proxy.onControlSourceRemove("midi")}}}get field(){return _e(this,Di,"f")}get valueMapping(){return _e(this,cs,"f")}get stringMapping(){return _e(this,jl,"f")}get name(){return _e(this,xy,"f")}get anchor(){return _e(this,wy,"f")}get type(){return _e(this,Di,"f").type}get address(){return _e(this,Di,"f").address}get track(){return _e(this,ds,"f")}valueAt(e){let t=_e(this,ds,"f");if(t.nonEmpty()){let n=t.unwrap();if(n.enabled)return this.valueMapping.y(n.valueAt(e,this.getUnitValue()))}return this.getValue()}subscribe(e){return _e(this,Kl,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}catchupAndSubscribeControlSources(e){return _e(this,tf,"f")&&e.onControlSourceAdd("midi"),_e(this,Di,"f").pointerHub.filter(...EB).forEach(t=>e.onControlSourceAdd(fA(t.pointerType))),_e(this,us,"f").subscribe(e)}getValue(){return _e(this,Di,"f").getValue()}setValue(e){let t=this.getUnitValue();_e(this,Di,"f").setValue(e),_e(this,ba,"f").parameterFieldAdapters.notifyWrite(this,t)}setUnitValue(e){this.setValue(_e(this,cs,"f").y(e))}getUnitValue(){return _e(this,cs,"f").x(this.getValue())}getControlledValue(){return _e(this,cs,"f").y(this.getControlledUnitValue())}getControlledUnitValue(){return _e(this,Hu,"f")??this.getUnitValue()}getControlledPrintValue(){return _e(this,jl,"f").x(this.getControlledValue())}getPrintValue(){return _e(this,jl,"f").x(this.getValue())}setPrintValue(e){let t=_e(this,jl,"f").y(e);t.type==="unitValue"?this.setUnitValue(be(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(_e(this,cs,"f").clamp(_e(this,Di,"f").initValue))}terminate(){_e(this,Wl,"f").ifSome(e=>e.terminate()),Er(this,Wl,m.None,"f"),_e(this,Ll,"f").terminate()}};ba=new WeakMap,Di=new WeakMap,cs=new WeakMap,jl=new WeakMap,xy=new WeakMap,wy=new WeakMap,Ll=new WeakMap,Kl=new WeakMap,us=new WeakMap,ds=new WeakMap,Wl=new WeakMap,Hu=new WeakMap,tf=new WeakMap;var fA=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 D(`${r.toString()} is an unknown pointer type`)}};var mA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Wn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Aa,Zl,by,Ay=class{constructor(e,t,n){Aa.set(this,void 0),Zl.set(this,void 0),by.set(this,void 0),mA(this,Aa,b.newSet(i=>i.uuid),"f"),mA(this,Zl,new ar,"f"),mA(this,by,e.catchupAndSubscribe({onAdded:i=>{let o=t(i.box),a=Wn(this,Aa,"f").add(o);V(a,`Could not add ${o}`),Wn(this,Zl,"f").proxy.onAdd(o)},onRemoved:i=>{let o=i.box.address.uuid;Wn(this,Zl,"f").proxy.onRemove(Wn(this,Aa,"f").removeByKey(o))}},n),"f")}subscribe(e){return Wn(this,Zl,"f").subscribe(e)}catchupAndSubscribe(e){return Wn(this,Aa,"f").forEach(t=>e.onAdd(t)),this.subscribe(e)}adapters(){return Wn(this,Aa,"f").values()}size(){return Wn(this,Aa,"f").size()}isEmpty(){return this.size()===0}terminate(){Wn(this,Aa,"f").clear(),Wn(this,Zl,"f").terminate(),Wn(this,by,"f").terminate()}};Aa=new WeakMap,Zl=new WeakMap,by=new WeakMap;var gA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},_t=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},vA,ci,rf,an,Fr,FB,tr=class{constructor(e,t){vA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Delay,rf.set(this,void 0),an.set(this,void 0),Fr.set(this,void 0),gA(this,rf,e,"f"),gA(this,an,t,"f"),gA(this,Fr,new we(_t(this,rf,"f")),"f"),this.namedParameter=_t(this,vA,"m",FB).call(this,t)}get box(){return _t(this,an,"f")}get uuid(){return _t(this,an,"f").address.uuid}get address(){return _t(this,an,"f").address}get indexField(){return _t(this,an,"f").index}get labelField(){return _t(this,an,"f").label}get enabledField(){return _t(this,an,"f").enabled}get minimizedField(){return _t(this,an,"f").minimized}get host(){return _t(this,an,"f").host}deviceHost(){return _t(this,rf,"f").boxAdapters.adapterFor(_t(this,an,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){_t(this,Fr,"f").terminate()}};ci=tr,rf=new WeakMap,an=new WeakMap,Fr=new WeakMap,vA=new WeakSet,FB=function(e){return{preSyncTimeLeft:_t(this,Fr,"f").createParameter(e.preSyncTimeLeft,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"pre sync L"),preMillisTimeLeft:_t(this,Fr,"f").createParameter(e.preMillisTimeLeft,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"pre ms L"),preSyncTimeRight:_t(this,Fr,"f").createParameter(e.preSyncTimeRight,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"pre sync R"),preMillisTimeRight:_t(this,Fr,"f").createParameter(e.preMillisTimeRight,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"pre ms R"),delay:_t(this,Fr,"f").createParameter(e.delayMusical,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"delay"),millisTime:_t(this,Fr,"f").createParameter(e.delayMillis,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"ms"),feedback:_t(this,Fr,"f").createParameter(e.feedback,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"feedback"),cross:_t(this,Fr,"f").createParameter(e.cross,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"cross"),lfoSpeed:_t(this,Fr,"f").createParameter(e.lfoSpeed,A.exponential(ci.LFO_SPEED_MIN,ci.LFO_SPEED_MAX),_.numeric({unit:"Hz",fractionDigits:2}),"lfo speed"),lfoDepth:_t(this,Fr,"f").createParameter(e.lfoDepth,A.power(4,0,ci.LFO_DEPTH_MAX),_.numeric({unit:"ms",fractionDigits:1}),"lfo depth"),filter:_t(this,Fr,"f").createParameter(e.filter,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"filter",.5),dry:_t(this,Fr,"f").createParameter(e.dry,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"dry"),wet:_t(this,Fr,"f").createParameter(e.wet,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"wet")}};tr.Fractions=wr.builder().add([0,1]).add([1,128]).add([1,96]).add([1,64]).add([1,48]).add([1,32]).add([1,24]).add([3,64]).add([1,16]).add([1,12]).add([3,32]).add([1,8]).add([1,6]).add([3,16]).add([1,4]).add([5,16]).add([1,3]).add([3,8]).add([7,16]).add([1,2]).add([1,1]).asAscendingArray();tr.FractionsStringMapping=_.indices("",ci.Fractions.map(([r,e])=>r===0?"Off":`${r}/${e}`));tr.MAX_MILLIS_TIME=1e3;tr.LFO_SPEED_MIN=.1;tr.LFO_SPEED_MAX=5;tr.LFO_DEPTH_MAX=50;var yA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},cr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},xA,nf,sn,To,BB,Ju=class{constructor(e,t){xA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Reverb,nf.set(this,void 0),sn.set(this,void 0),To.set(this,void 0),yA(this,nf,e,"f"),yA(this,sn,t,"f"),yA(this,To,new we(cr(this,nf,"f")),"f"),this.namedParameter=cr(this,xA,"m",BB).call(this,t)}get box(){return cr(this,sn,"f")}get uuid(){return cr(this,sn,"f").address.uuid}get address(){return cr(this,sn,"f").address}get indexField(){return cr(this,sn,"f").index}get labelField(){return cr(this,sn,"f").label}get enabledField(){return cr(this,sn,"f").enabled}get minimizedField(){return cr(this,sn,"f").minimized}get host(){return cr(this,sn,"f").host}deviceHost(){return cr(this,nf,"f").boxAdapters.adapterFor(cr(this,sn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){cr(this,To,"f").terminate()}};nf=new WeakMap,sn=new WeakMap,To=new WeakMap,xA=new WeakSet,BB=function(e){return{decay:cr(this,To,"f").createParameter(e.decay,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"Room-Size"),preDelay:cr(this,To,"f").createParameter(e.preDelay,A.exponential(.001,.5),_.numeric({unit:"s",fractionDigits:1,unitPrefix:!0}),"Pre-Delay"),damp:cr(this,To,"f").createParameter(e.damp,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"damping"),filter:cr(this,To,"f").createParameter(e.filter,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"filter"),dry:cr(this,To,"f").createParameter(e.dry,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"dry"),wet:cr(this,To,"f").createParameter(e.wet,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"wet")}};var wA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Zt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},AA,of,Mi,Zn,DB,Qu=class{constructor(e,t){AA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Revamp,of.set(this,void 0),Mi.set(this,void 0),Zn.set(this,void 0),wA(this,of,e,"f"),wA(this,Mi,t,"f"),wA(this,Zn,new we(Zt(this,of,"f")),"f"),this.namedParameter=Zt(this,AA,"m",DB).call(this,t)}get box(){return Zt(this,Mi,"f")}get uuid(){return Zt(this,Mi,"f").address.uuid}get address(){return Zt(this,Mi,"f").address}get indexField(){return Zt(this,Mi,"f").index}get labelField(){return Zt(this,Mi,"f").label}get enabledField(){return Zt(this,Mi,"f").enabled}get minimizedField(){return Zt(this,Mi,"f").minimized}get host(){return Zt(this,Mi,"f").host}get spectrum(){return Zt(this,Mi,"f").address.append(4095)}deviceHost(){return Zt(this,of,"f").boxAdapters.adapterFor(Zt(this,Mi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Zt(this,Zn,"f").terminate()}};of=new WeakMap,Mi=new WeakMap,Zn=new WeakMap,AA=new WeakSet,DB=function(e){return{highPass:NB(Zt(this,Zn,"f"),e.highPass,"High-Pass"),lowShelf:IB(Zt(this,Zn,"f"),e.lowShelf,"Low-Shelf"),lowBell:bA(Zt(this,Zn,"f"),e.lowBell,"Low-Bell"),midBell:bA(Zt(this,Zn,"f"),e.midBell,"Mid-Bell"),highBell:bA(Zt(this,Zn,"f"),e.highBell,"High-Bell"),highShelf:IB(Zt(this,Zn,"f"),e.highShelf,"High-Shelf"),lowPass:NB(Zt(this,Zn,"f"),e.lowPass,"Low-Pass")}};var _A=A.exponential(20,2e4),MB=A.linear(-24,24),kB=A.exponential(.01,10),NB=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),order:r.createParameter(e.order,A.linearInteger(0,3),_.indices("db",["12","24","36","48"]),`${t} Order`),q:r.createParameter(e.q,kB,_.numeric({fractionDigits:3}),`${t} Q`)}),IB=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,MB,_.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5)}),bA=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,MB,_.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5),q:r.createParameter(e.q,kB,_.numeric({fractionDigits:3}),`${t} Q`)});var $B=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ui=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},_y,Py,di,ps=class{constructor(e,t){this.type="marker-event",_y.set(this,new j),Py.set(this,void 0),di.set(this,void 0),$B(this,Py,e,"f"),$B(this,di,t,"f"),ui(this,_y,"f").own(ui(this,di,"f").subscribe(Ue.Children,n=>{if(!this.trackAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackAdapter.unwrap();ui(this,di,"f").position.address.equals(n.address)?i.onSortingChanged():i.dispatchChange()}}))}get box(){return ui(this,di,"f")}get uuid(){return ui(this,di,"f").address.uuid}get address(){return ui(this,di,"f").address}get position(){return ui(this,di,"f").position.getValue()}get plays(){return ui(this,di,"f").plays.getValue()}get hue(){return ui(this,di,"f").hue.getValue()}get label(){return ui(this,di,"f").label.getValue()}get trackAdapter(){return ui(this,di,"f").track.targetVertex.map(e=>ui(this,Py,"f").boxAdapters.adapterFor(e.box,ln).markerTrack)}terminate(){ui(this,_y,"f").terminate()}toString(){return`{MarkerBoxAdapter ${b.toString(ui(this,di,"f").address.uuid).substring(0,4)}, plays: ${this.plays}`}};_y=new WeakMap,Py=new WeakMap,di=new WeakMap;ps.Comparator=(r,e)=>r.position-e.position;var af=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},cn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sf,Yu,lf,Gl,Sy,Ey=class{constructor(e,t){sf.set(this,void 0),Yu.set(this,void 0),lf.set(this,void 0),Gl.set(this,void 0),Sy.set(this,void 0),af(this,sf,e,"f"),af(this,Yu,t,"f"),this.changeNotifier=new ce,af(this,lf,b.newSet(n=>n.uuid),"f"),af(this,Gl,ai.create(ps.Comparator),"f"),af(this,Sy,cn(this,Yu,"f").markers.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{if(n instanceof Xc){let i=cn(this,sf,"f").boxAdapters.adapterFor(n,ps),o=cn(this,lf,"f").add(i);V(o,"Could not add adapter"),cn(this,Gl,"f").add(i),this.dispatchChange()}},onRemoved:({box:{address:{uuid:n}}})=>{cn(this,Gl,"f").remove(cn(this,lf,"f").removeByKey(n)),this.dispatchChange()}}),"f")}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return cn(this,sf,"f")}get enabled(){return cn(this,Yu,"f").enabled.getValue()}get events(){return cn(this,Gl,"f")}get object(){return cn(this,Yu,"f")}dispatchChange(){this.changeNotifier.notify()}onSortingChanged(){cn(this,Gl,"f").onIndexingChanged(),this.dispatchChange()}terminate(){cn(this,Sy,"f").terminate()}};sf=new WeakMap,Yu=new WeakMap,lf=new WeakMap,Gl=new WeakMap,Sy=new WeakMap;var TB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ki=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fy,By,$i,ql=class{constructor(e,t){this.type="signature-event",Fy.set(this,new j),By.set(this,void 0),$i.set(this,void 0),TB(this,By,e,"f"),TB(this,$i,t,"f"),ki(this,Fy,"f").own(ki(this,$i,"f").subscribe(Ue.Children,n=>this.trackAdapter.ifSome(i=>i.dispatchChange())))}get box(){return ki(this,$i,"f")}get uuid(){return ki(this,$i,"f").address.uuid}get address(){return ki(this,$i,"f").address}get index(){return ki(this,$i,"f").index.getValue()}get indexField(){return ki(this,$i,"f").index}get relativePosition(){return ki(this,$i,"f").relativePosition.getValue()}get nominator(){return ki(this,$i,"f").nominator.getValue()}get denominator(){return ki(this,$i,"f").denominator.getValue()}get trackAdapter(){return ki(this,$i,"f").events.targetVertex.map(e=>ki(this,By,"f").boxAdapters.adapterFor(e.box,ln).signatureTrack)}terminate(){ki(this,Fy,"f").terminate()}toString(){return`{SignatureEventBoxAdapter ${this.nominator}/${this.denominator}}`}};Fy=new WeakMap,By=new WeakMap,$i=new WeakMap;ql.Comparator=(r,e)=>r.index-e.index;var Ny=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ft=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Hl,cf,uf,Jl,_a,hs,RB,df,Iy=class{constructor(e,t,n){Hl.add(this),cf.set(this,new j),uf.set(this,void 0),Jl.set(this,void 0),_a.set(this,void 0),hs.set(this,void 0),Ny(this,uf,e,"f"),Ny(this,Jl,t,"f"),Ny(this,_a,n,"f"),this.changeNotifier=new ce,Ny(this,hs,Ft(this,cf,"f").own(sr.create(Ft(this,_a,"f").events,i=>e.boxAdapters.adapterFor(i,ql),c.SignatureAutomation)),"f"),Ft(this,cf,"f").ownAll(Ft(this,Jl,"f").subscribe(()=>this.dispatchChange()),Ft(this,_a,"f").enabled.subscribe(()=>this.dispatchChange()),Ft(this,hs,"f").subscribe({onAdd:i=>this.changeNotifier.notify(),onRemove:i=>this.changeNotifier.notify(),onReorder:i=>this.changeNotifier.notify()}))}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return Ft(this,uf,"f")}get enabled(){return Ft(this,_a,"f").enabled.getValue()}get object(){return Ft(this,_a,"f")}get size(){return Ft(this,hs,"f").size()}get storageSignature(){let{nominator:e,denominator:t}=Ft(this,Jl,"f");return[e.getValue(),t.getValue()]}nonEmpty(){return Ft(this,hs,"f").size()>0}dispatchChange(){this.changeNotifier.notify()}signatureAt(e){e=Math.max(0,e);let t=this.storageSignature;for(let{accumulatedPpqn:n,nominator:i,denominator:o}of this.iterateAll()){if(n>e)break;t=[i,o]}return t}*iterateAll(){let e=0,t=0,[n,i]=this.storageSignature;if(yield{index:-1,accumulatedPpqn:e,accumulatedBars:t,nominator:n,denominator:i},!!Ft(this,_a,"f").enabled.getValue())for(let o of Ft(this,hs,"f").adapters())e+=J.fromSignature(n,i)*o.relativePosition,t+=o.relativePosition,n=o.nominator,i=o.denominator,yield{index:o.index,accumulatedPpqn:e,accumulatedBars:t,nominator:n,denominator:i}}changeSignature(e,t){let n=Array.from(this.iterateAll()).slice(1),i=n.map(l=>l.accumulatedPpqn);Ft(this,Jl,"f").nominator.setValue(e),Ft(this,Jl,"f").denominator.setValue(t);let o=0,a=0,s=J.fromSignature(e,t);for(let l=0;l<n.length;l++){let u=n[l],p=this.adapterAt(u.index);if(p.isEmpty())continue;let h=(i[l]-o)/s,g=Math.floor(h),v=h-g;a+=v;let y=g;a>=1&&(y++,a--),y=Math.max(1,y),p.unwrap().box.relativePosition.setValue(y),o+=y*s,s=J.fromSignature(u.nominator,u.denominator)}}deleteAdapter(e){let t=e.index,n=Array.from(this.iterateAll()).slice(1),i=n.findIndex(g=>g.index===t);if(i===-1)return;let o=n.slice(i+1),a=o.map(g=>g.accumulatedPpqn),s=i>0?n[i-1]:null,[l,u]=s!==null?[s.nominator,s.denominator]:this.storageSignature,p=s!==null?s.accumulatedPpqn:0;e.box.delete();let d=p,h=J.fromSignature(l,u);for(let g=0;g<o.length;g++){let v=o[g],y=this.adapterAt(v.index);if(y.isEmpty())continue;let B=(a[g]-d)/h,I=Math.max(1,Math.round(B));y.unwrap().box.relativePosition.setValue(I),d+=I*h,h=J.fromSignature(v.nominator,v.denominator)}}createEvent(e,t,n){let i=Array.from(this.iterateAll()),o=i[0],a=0;for(let y=1;y<i.length&&!(i[y].accumulatedPpqn>e);y++)o=i[y],a=y;let s=J.fromSignature(o.nominator,o.denominator),l=(e-o.accumulatedPpqn)/s,u=Math.max(1,Math.round(l)),p=o.index+1,d=i.slice(a+1),h=o.accumulatedPpqn+u*s,g=J.fromSignature(t,n),v=d.map(y=>({event:y,adapter:this.adapterAt(y.index)})).filter(({adapter:y})=>y.nonEmpty()).map(({event:y,adapter:x})=>({event:y,adapter:x.unwrap()}));for(let y=0;y<v.length;y++){let{event:x,adapter:B}=v[y];if(B.box.index.setValue(x.index+1),y===0){let I=(x.accumulatedPpqn-h)/g;B.box.relativePosition.setValue(Math.max(1,Math.round(I)))}}Hc.create(Ft(this,uf,"f").boxGraph,b.generate(),y=>{y.index.setValue(p),y.relativePosition.setValue(u),y.nominator.setValue(t),y.denominator.setValue(n),y.events.refer(Ft(this,_a,"f").events)})}adapterAt(e){return Ft(this,hs,"f").getAdapterByIndex(e)}moveEvent(e,t){let n=Array.from(this.iterateAll()).slice(1),i=n.findIndex(h=>h.index===e.index);if(i===-1)return;let o=n[i];if(t===o.accumulatedPpqn)return;let a=n.map(h=>h.accumulatedBars),s=Ft(this,Hl,"m",RB).call(this,t,o.index);if(s===o.accumulatedBars)return;let l=[...a];l[i]=s;let u=l.map((h,g)=>({bar:h,i:g})).sort((h,g)=>h.bar-g.bar).map(h=>h.i),p=n.map(h=>this.adapterAt(h.index).unwrap());for(let h=0;h<u.length;h++)p[u[h]].box.index.setValue(h);let d=0;for(let h=0;h<u.length;h++){let g=u[h],v=p[g],y=l[g],x=Math.max(1,y-d);v.box.relativePosition.setValue(x),d=y}}floorToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.floor((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}ceilToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.ceil((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}roundToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.round((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}barLengthAt(e){let[t,n]=this.signatureAt(e);return J.fromSignature(t,n)}getBarInterval(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.floor((e-t.accumulatedPpqn)/n),o=t.accumulatedPpqn+i*n;return{position:o,complete:o+n}}terminate(){Ft(this,cf,"f").terminate()}};cf=new WeakMap,uf=new WeakMap,Jl=new WeakMap,_a=new WeakMap,hs=new WeakMap,Hl=new WeakSet,RB=function(e,t){let n=null;for(let a of this.iterateAll())if(a.index!==t){if(a.accumulatedPpqn>e)break;n=a}if(uo(n)){let[a,s]=this.storageSignature,l=J.fromSignature(a,s);return Math.max(1,Math.round(e/l))}let i=J.fromSignature(n.nominator,n.denominator),o=Math.round((e-n.accumulatedPpqn)/i);return Math.max(1,n.accumulatedBars+o)},df=function(e){let t=null;for(let n of this.iterateAll()){if(n.accumulatedPpqn>e)break;t=n}if(uo(t)){let[n,i]=this.storageSignature;return{event:{index:-1,accumulatedPpqn:0,accumulatedBars:0,nominator:n,denominator:i},barPpqn:J.fromSignature(n,i)}}return{event:t,barPpqn:J.fromSignature(t.nominator,t.denominator)}};var pf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},jt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hf,Ro,Dy,My,Pa,ff,ky,ln=class{constructor(e,t){hf.set(this,new j),Ro.set(this,void 0),Dy.set(this,void 0),My.set(this,void 0),Pa.set(this,void 0),ff.set(this,void 0),ky.set(this,()=>{let{tempoTrack:{enabled:s}}=jt(this,Ro,"f");return s.getValue()?jt(this,Pa,"f").isEmpty()?m.None:jt(this,Pa,"f").unwrap().events.isEmpty()?m.None:jt(this,Pa,"f"):m.None}),pf(this,Ro,t,"f"),pf(this,Dy,new Ey(e,t.markerTrack),"f"),pf(this,My,new Iy(e,t.signature,t.signatureTrack),"f"),pf(this,Pa,new Mr,"f"),pf(this,ff,new ce,"f");let n=jt(this,hf,"f").own(new j),i=()=>jt(this,ff,"f").notify(jt(this,ky,"f").call(this)),{tempoTrack:{events:o,enabled:a}}=t;jt(this,hf,"f").own(o.catchupAndSubscribe(({targetVertex:s})=>{n.terminate(),s.match({none:()=>jt(this,Pa,"f").clear(),some:({box:l})=>{let u=e.boxAdapters.adapterFor(l,_r);jt(this,Pa,"f").wrap(u),n.ownAll(u.subscribeChange(i),a.subscribe(i))}})}))}catchupAndSubscribeTempoAutomation(e){return e(jt(this,ky,"f").call(this)),jt(this,ff,"f").subscribe(e)}get box(){return jt(this,Ro,"f")}get uuid(){return jt(this,Ro,"f").address.uuid}get address(){return jt(this,Ro,"f").address}get markerTrack(){return jt(this,Dy,"f")}get signatureTrack(){return jt(this,My,"f")}get tempoTrackEvents(){return jt(this,Pa,"f")}get signature(){let{nominator:e,denominator:t}=jt(this,Ro,"f").signature;return[e.getValue(),t.getValue()]}get signatureDuration(){let{nominator:e,denominator:t}=jt(this,Ro,"f").signature;return J.fromSignature(e.getValue(),t.getValue())}catchupAndSubscribeSignature(e){return e(this.signature),jt(this,Ro,"f").signature.subscribe(()=>e(this.signature))}terminate(){jt(this,hf,"f").terminate()}};hf=new WeakMap,Ro=new WeakMap,Dy=new WeakMap,My=new WeakMap,Pa=new WeakMap,ff=new WeakMap,ky=new WeakMap;var Fk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},fs,ms=class{constructor(e,t){fs.set(this,void 0),Fk(this,fs,t,"f")}get box(){return mf(this,fs,"f")}get uuid(){return mf(this,fs,"f").address.uuid}get address(){return mf(this,fs,"f").address}get source(){return mf(this,fs,"f").source.targetVertex.unwrap("Insufficient Vertex")}get target(){return mf(this,fs,"f").target.targetVertex.unwrap("Insufficient Vertex")}terminate(){}};fs=new WeakMap;var Ql=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},un=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$y,Yl,Xl,Ty,Ry,gf,dn=class{constructor(e,t){$y.set(this,void 0),Yl.set(this,void 0),Xl.set(this,void 0),Ty.set(this,void 0),Ry.set(this,void 0),gf.set(this,!1),Ql(this,$y,e,"f"),Ql(this,Yl,t,"f"),Ql(this,Xl,new j,"f"),Ql(this,Ty,t.attributes,"f"),Ql(this,Ry,un(this,Xl,"f").own(new we(e)),"f")}get inputs(){throw new Error("Method not implemented.")}get outputs(){throw new Error("Method not implemented.")}own(e){return un(this,Xl,"f").own(e)}ownAll(...e){un(this,Xl,"f").ownAll(...e)}onSelected(){Ql(this,gf,!0,"f")}onDeselected(){Ql(this,gf,!1,"f")}isSelected(){return un(this,gf,"f")}get box(){return un(this,Yl,"f")}get attributes(){return un(this,Ty,"f")}get uuid(){return un(this,Yl,"f").address.uuid}get address(){return un(this,Yl,"f").address}get parameters(){return un(this,Ry,"f")}get modular(){return un(this,$y,"f").boxAdapters.adapterFor(un(this,Yl,"f").attributes.collection.targetVertex.unwrap().box,gs)}terminate(){un(this,Xl,"f").terminate()}};$y=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,Ty=new WeakMap,Ry=new WeakMap,gf=new WeakMap;var Cy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Sa=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Oy,vs,vf,Vy,Rr;(function(r){r.Input="input",r.Output="output"})(Rr||(Rr={}));var Cr=class r{static create(e,t,n,i){return new r(e,t,n,i??t.fieldName)}constructor(e,t,n,i){Oy.set(this,void 0),vs.set(this,void 0),vf.set(this,void 0),Vy.set(this,void 0),Cy(this,Oy,e,"f"),Cy(this,vs,t,"f"),Cy(this,vf,n,"f"),Cy(this,Vy,i,"f")}matches(e){return this.direction!==e.direction&&this.field.pointerRules.accepts.some(t=>e.field.pointerRules.accepts.some(n=>n===t))}get connections(){return Sa(this,vs,"f").pointerHub.isEmpty()?U.empty():Sa(this,vs,"f").pointerHub.filter(c.VoltageConnection).map(({box:e})=>Sa(this,Oy,"f").adapterFor(e,ms))}get field(){return Sa(this,vs,"f")}get address(){return Sa(this,vs,"f").address}get direction(){return Sa(this,vf,"f")}get name(){return Sa(this,Vy,"f")}toString(){return`{ModuleConnectorAdapter address: ${Sa(this,vs,"f").address.toString()}, direction: ${Sa(this,vf,"f")}}`}};Oy=new WeakMap,vs=new WeakMap,vf=new WeakMap,Vy=new WeakMap;var PA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},yf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zy,xf,wf,Xu=class extends dn{constructor(e,t){super(e,t),zy.set(this,void 0),xf.set(this,void 0),wf.set(this,void 0),PA(this,zy,this.parameters.createParameter(t.time,A.exponential(1,1e4),_.numeric({unit:"ms"}),"Time"),"f"),PA(this,xf,Cr.create(e.boxAdapters,t.voltageInput,Rr.Input,"Input"),"f"),PA(this,wf,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Output"),"f")}get parameterTime(){return yf(this,zy,"f")}get voltageInput(){return yf(this,xf,"f")}get voltageOutput(){return yf(this,wf,"f")}get inputs(){return[yf(this,xf,"f")]}get outputs(){return[yf(this,wf,"f")]}};zy=new WeakMap,xf=new WeakMap,wf=new WeakMap;var Bk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},CB=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},bf,ed=class extends dn{constructor(e,t){super(e,t),bf.set(this,void 0),Bk(this,bf,Cr.create(e.boxAdapters,t.input,Rr.Input,"Input"),"f")}get voltageInput(){return CB(this,bf,"f")}get inputs(){return[CB(this,bf,"f")]}get outputs(){return U.empty()}};bf=new WeakMap;var SA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Af=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Uy,_f,Pf,td=class extends dn{constructor(e,t){super(e,t),Uy.set(this,void 0),_f.set(this,void 0),Pf.set(this,void 0),SA(this,Uy,this.parameters.createParameter(t.gain,A.DefaultDecibel,_.numeric({unit:"db"}),"Gain"),"f"),SA(this,_f,Cr.create(e.boxAdapters,t.voltageInput,Rr.Input,"Input"),"f"),SA(this,Pf,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Output"),"f")}get parameterGain(){return Af(this,Uy,"f")}get voltageInput(){return Af(this,_f,"f")}get voltageOutput(){return Af(this,Pf,"f")}get inputs(){return[Af(this,_f,"f")]}get outputs(){return[Af(this,Pf,"f")]}};Uy=new WeakMap,_f=new WeakMap,Pf=new WeakMap;var EA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},FA=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},jy,Ly,Ky,rd=class extends dn{constructor(e,t){super(e,t),jy.set(this,void 0),Ly.set(this,void 0),Ky.set(this,void 0),EA(this,jy,Cr.create(e.boxAdapters,t.voltageInputX,Rr.Input,"X"),"f"),EA(this,Ly,Cr.create(e.boxAdapters,t.voltageInputY,Rr.Input,"Y"),"f"),EA(this,Ky,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Result"),"f")}get inputs(){return[FA(this,jy,"f"),FA(this,Ly,"f")]}get outputs(){return[FA(this,Ky,"f")]}};jy=new WeakMap,Ly=new WeakMap,Ky=new WeakMap;var Nk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},OB=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Sf,id=class extends dn{constructor(e,t){super(e,t),Sf.set(this,void 0),Nk(this,Sf,Cr.create(e.boxAdapters,t.output,Rr.Output,"Output"),"f")}get voltageOutput(){return OB(this,Sf,"f")}get inputs(){return U.empty()}get outputs(){return[OB(this,Sf,"f")]}};Sf=new WeakMap;var nd;(function(r){r.isVertexOfModule=e=>e.box.accept({visitModuleGainBox:()=>!0,visitModuleDelayBox:()=>!0,visitModuleMultiplierBox:()=>!0,visitModularAudioInputBox:()=>!0,visitModularAudioOutputBox:()=>!0})??!1,r.adapterFor=(e,t)=>he(t.accept({visitModuleGainBox:n=>e.adapterFor(n,td),visitModuleDelayBox:n=>e.adapterFor(n,Xu),visitModuleMultiplierBox:n=>e.adapterFor(n,rd),visitModularAudioInputBox:n=>e.adapterFor(n,id),visitModularAudioOutputBox:n=>e.adapterFor(n,ed)}),`Could not find ModuleAdapter for ${t.name}`)})(nd||(nd={}));var VB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ec=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Wy,Zy,tc,BA,od=class{constructor(e,t){Wy.add(this),Zy.set(this,void 0),tc.set(this,void 0),VB(this,Zy,e,"f"),VB(this,tc,t,"f")}get box(){return ec(this,tc,"f")}get uuid(){return ec(this,tc,"f").address.uuid}get address(){return ec(this,tc,"f").address}get moduleAdapter(){return nd.adapterFor(ec(this,Zy,"f").boxAdapters,ec(this,Wy,"a",BA).box)}get parameterAdapter(){return this.moduleAdapter.parameters.parameterAt(ec(this,Wy,"a",BA).address)}terminate(){}};Zy=new WeakMap,tc=new WeakMap,Wy=new WeakSet,BA=function(){return ec(this,tc,"f").parameter.targetVertex.unwrap("Parameter not assigned")};var zB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ad,hi,ys=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Modular,ad.set(this,void 0),hi.set(this,void 0),zB(this,ad,e,"f"),zB(this,hi,t,"f")}get box(){return pi(this,hi,"f")}get uuid(){return pi(this,hi,"f").address.uuid}get address(){return pi(this,hi,"f").address}get indexField(){return pi(this,hi,"f").index}get labelField(){return pi(this,hi,"f").label}get enabledField(){return pi(this,hi,"f").enabled}get minimizedField(){return pi(this,hi,"f").minimized}get host(){return pi(this,hi,"f").host}parameterAt(e){return D("Not yet implemented")}deviceHost(){return pi(this,ad,"f").boxAdapters.adapterFor(pi(this,hi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}modular(){return pi(this,ad,"f").boxAdapters.adapterFor(pi(this,hi,"f").modularSetup.targetVertex.unwrap("No Modular found").box,gs)}elements(){return pi(this,hi,"f").userInterface.elements.pointerHub.filter(c.DeviceUserInterface).map(e=>pi(this,ad,"f").boxAdapters.adapterFor(e.box,od))}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}};ad=new WeakMap,hi=new WeakMap;var Ef=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ot=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sd,xs,ld,Ti,rc,ic,gs=class{constructor(e,t){sd.set(this,new j),xs.set(this,void 0),ld.set(this,void 0),Ti.set(this,void 0),rc.set(this,void 0),ic.set(this,void 0),Ef(this,ld,e,"f"),Ef(this,Ti,t,"f"),Ef(this,xs,ot(this,sd,"f").own(new ar),"f"),Ef(this,rc,b.newSet(s=>s.uuid),"f"),Ef(this,ic,b.newSet(s=>s.uuid),"f");let n=s=>{let l=nd.adapterFor(ot(this,ld,"f").boxAdapters,s.box);ot(this,rc,"f").add(l)&&ot(this,xs,"f").proxy.onModuleAdded(l)},i=s=>ot(this,xs,"f").proxy.onModuleRemoved(ot(this,rc,"f").removeByKey(s.address.uuid)),o=s=>{let l=ot(this,ld,"f").boxAdapters.adapterFor(s.box,ms);ot(this,ic,"f").add(l)&&ot(this,xs,"f").proxy.onConnectionAdded(l)},a=s=>ot(this,xs,"f").proxy.onConnectionRemoved(ot(this,ic,"f").removeByKey(s.address.uuid));ot(this,Ti,"f").modules.pointerHub.filter(c.ModuleCollection).forEach(n),ot(this,Ti,"f").connections.pointerHub.filter(c.ConnectionCollection).forEach(o),ot(this,sd,"f").own(ot(this,Ti,"f").modules.pointerHub.subscribe({onAdded:n,onRemoved:i},c.ModuleCollection)),ot(this,sd,"f").own(ot(this,Ti,"f").connections.pointerHub.subscribe({onAdded:o,onRemoved:a},c.ConnectionCollection))}catchupAndSubscribe(e){return K0(e.onModuleAdded,t=>ot(this,rc,"f").forEach(n=>t(n))),K0(e.onConnectionAdded,t=>ot(this,ic,"f").forEach(n=>t(n))),ot(this,xs,"f").subscribe(e)}get box(){return ot(this,Ti,"f")}get address(){return ot(this,Ti,"f").address}get uuid(){return ot(this,Ti,"f").address.uuid}get editingField(){return ot(this,Ti,"f").editing}get labelField(){return ot(this,Ti,"f").label}get modules(){return ot(this,rc,"f").values()}get connections(){return ot(this,ic,"f").values()}get device(){return ot(this,ld,"f").boxAdapters.adapterFor(he(ot(this,Ti,"f").device.pointerHub.incoming().at(0),"No device found").box,ys)}terminate(){console.debug(`terminate ${this}`),ot(this,sd,"f").terminate()}};sd=new WeakMap,xs=new WeakMap,ld=new WeakMap,Ti=new WeakMap,rc=new WeakMap,ic=new WeakMap;var Ff=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Qr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},NA,ud,Bf,Gy,cd,If,qy,Nf,Hy,UB,Co=class{constructor(e,t){NA.add(this),this.type="groove-adapter",Bf.set(this,new j),Gy.set(this,void 0),cd.set(this,void 0),If.set(this,void 0),qy.set(this,new _g({duration:()=>Qr(this,Hy,"f"),fx:n=>q0(n,Qr(this,Nf,"f")),fy:n=>q0(n,1-Qr(this,Nf,"f"))})),Nf.set(this,0),Hy.set(this,J.SemiQuaver*2),Ff(this,Gy,e,"f"),Ff(this,cd,t,"f"),Ff(this,If,Qr(this,Bf,"f").own(new we(Qr(this,Gy,"f"))),"f"),this.namedParameter=Qr(this,NA,"m",UB).call(this,t),Qr(this,Bf,"f").ownAll(this.namedParameter.duration.catchupAndSubscribe(n=>Ff(this,Hy,n.getValue(),"f")),this.namedParameter.amount.catchupAndSubscribe(n=>Ff(this,Nf,HF(n.getValue(),.01),"f")))}unwarp(e){return Qr(this,qy,"f").unwarp(e)}warp(e){return Qr(this,qy,"f").warp(e)}get box(){return Qr(this,cd,"f")}get uuid(){return Qr(this,cd,"f").address.uuid}get address(){return Qr(this,cd,"f").address}terminate(){Qr(this,Bf,"f").terminate()}};ud=Co,Bf=new WeakMap,Gy=new WeakMap,cd=new WeakMap,If=new WeakMap,qy=new WeakMap,Nf=new WeakMap,Hy=new WeakMap,NA=new WeakSet,UB=function(e){return{duration:Qr(this,If,"f").createParameter(e.duration,A.values(ud.DurationPPQNs),_.values("",ud.DurationPPQNs,ud.DurationStrings),"duration"),amount:Qr(this,If,"f").createParameter(e.amount,A.unipolar(),_.percent({fractionDigits:0}),"amount")}};Co.Durations=[[1,8],[1,4],[1,4],[1,2],[1,1],[2,1],[4,1],[8,1],[16,1]];Co.DurationPPQNs=ud.Durations.map(([r,e])=>J.fromSignature(r,e));Co.DurationStrings=ud.Durations.map(([r,e])=>`${r}/${e}`);var dd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Rt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Oo,ws,pd,Jy,Qy,Df,Mf,IA,bs=class{constructor(e,t,n,i,o){Oo.set(this,void 0),ws.set(this,void 0),pd.set(this,void 0),Jy.set(this,void 0),Qy.set(this,void 0),Df.set(this,new j),Mf.set(this,void 0),IA.set(this,m.None),dd(this,Oo,e,"f"),dd(this,ws,t,"f"),dd(this,pd,n,"f"),dd(this,Jy,i,"f"),dd(this,Qy,o??0,"f"),dd(this,Mf,Rt(this,Df,"f").own(new ce),"f"),Rt(this,Df,"f").own(Rt(this,Oo,"f").subscribe(()=>Rt(this,Mf,"f").notify(this))),e.getValue(),t.clamp(e.getValue())}get field(){return Rt(this,Oo,"f")}get valueMapping(){return Rt(this,ws,"f")}get stringMapping(){return Rt(this,pd,"f")}get name(){return Rt(this,Jy,"f")}get anchor(){return Rt(this,Qy,"f")}get type(){return Rt(this,Oo,"f").type}get address(){return Rt(this,Oo,"f").address}get track(){return Rt(this,IA,"f")}subscribe(e){return Rt(this,Mf,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}getValue(){return Rt(this,Oo,"f").getValue()}setValue(e){Rt(this,Oo,"f").setValue(Rt(this,ws,"f").clamp(e))}setUnitValue(e){this.setValue(Rt(this,ws,"f").y(e))}getUnitValue(){return Rt(this,ws,"f").x(this.getValue())}getPrintValue(){return Rt(this,pd,"f").x(this.getValue())}setPrintValue(e){let t=Rt(this,pd,"f").y(e);t.type==="unitValue"?this.setUnitValue(be(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(Rt(this,ws,"f").clamp(Rt(this,Oo,"f").initValue))}terminate(){Rt(this,Df,"f").terminate()}};Oo=new WeakMap,ws=new WeakMap,pd=new WeakMap,Jy=new WeakMap,Qy=new WeakMap,Df=new WeakMap,Mf=new WeakMap,IA=new WeakMap;var hd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Vo,Yy,Xy,ex,tx,rx,ix=class{constructor(e){Vo.set(this,void 0),Yy.set(this,void 0),Xy.set(this,void 0),ex.set(this,void 0),tx.set(this,void 0),rx.set(this,void 0),hd(this,Vo,e,"f"),hd(this,Yy,new bs(pn(this,Vo,"f").keyboard,A.values([88,76,61,49]),_.numeric({fractionDigits:1}),"Keyboard Type"),"f"),hd(this,Xy,new bs(pn(this,Vo,"f").timeRangeInQuarters,A.exponential(1,64),_.numeric({fractionDigits:1}),"Time-Range"),"f"),hd(this,ex,new bs(pn(this,Vo,"f").noteScale,A.exponential(.5,2),_.numeric({fractionDigits:1}),"Note Scale"),"f"),hd(this,tx,new bs(pn(this,Vo,"f").noteLabels,A.bool,_.bool,"Note Labels"),"f"),hd(this,rx,new bs(pn(this,Vo,"f").transpose,A.linearInteger(-48,48),_.numeric({fractionDigits:0}),"Transpose"),"f")}subscribe(e){return pn(this,Vo,"f").box.subscribe(Ue.Children,()=>e(this))}get object(){return pn(this,Vo,"f")}get keyboard(){return pn(this,Yy,"f")}get timeRangeInQuarters(){return pn(this,Xy,"f")}get noteScale(){return pn(this,ex,"f")}get noteLabels(){return pn(this,tx,"f")}get transpose(){return pn(this,rx,"f")}};Vo=new WeakMap,Yy=new WeakMap,Xy=new WeakMap,ex=new WeakMap,tx=new WeakMap,rx=new WeakMap;var kf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},rr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},nc,Ri,oc,nx,ox,fd=class{constructor(e,t){nc.set(this,void 0),Ri.set(this,void 0),oc.set(this,void 0),nx.set(this,void 0),ox.set(this,void 0),kf(this,nc,e,"f"),kf(this,Ri,t,"f"),kf(this,oc,sr.create(rr(this,Ri,"f").audioUnits,n=>rr(this,nc,"f").boxAdapters.adapterFor(n,nn),c.AudioUnits),"f"),kf(this,nx,new Ay(rr(this,Ri,"f").audioBusses.pointerHub,n=>rr(this,nc,"f").boxAdapters.adapterFor(n,Hr),c.AudioBusses),"f"),kf(this,ox,new ix(rr(this,Ri,"f").pianoMode),"f")}get uuid(){return rr(this,Ri,"f").address.uuid}get address(){return rr(this,Ri,"f").address}get box(){return rr(this,Ri,"f")}get audioBusses(){return rr(this,nx,"f")}get audioUnits(){return rr(this,oc,"f")}get clips(){return rr(this,oc,"f").adapters().flatMap(e=>e.tracks.collection.adapters()).flatMap(e=>e.clips.collection.adapters())}get groove(){return rr(this,nc,"f").boxAdapters.adapterFor(rr(this,Ri,"f").groove.targetVertex.unwrap("no groove").box,Co)}get timeline(){return rr(this,nc,"f").boxAdapters.adapterFor(rr(this,Ri,"f").timeline.targetVertex.unwrap("no timeline").box,ln)}get pianoMode(){return rr(this,ox,"f")}get created(){return new Date(rr(this,Ri,"f").created.getValue())}get midiOutputDevices(){return rr(this,Ri,"f").outputMidiDevices.pointerHub.incoming().map(({box:e})=>Ce(e,Tn))}*labeledAudioOutputs(){for(let e of rr(this,oc,"f").adapters())yield{label:e.label,address:e.address,children:()=>m.wrap(e.labeledAudioOutputs())}}terminate(){rr(this,oc,"f").terminate()}};nc=new WeakMap,Ri=new WeakMap,oc=new WeakMap,nx=new WeakMap,ox=new WeakMap;var DA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Or=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},MA,$f,Gn,As,jB,md=class{constructor(e,t){MA.add(this),this.type="instrument",this.accepts="audio",this.manualUrl=pe.Tape,$f.set(this,void 0),Gn.set(this,void 0),As.set(this,void 0),DA(this,$f,e,"f"),DA(this,Gn,t,"f"),DA(this,As,new we(Or(this,$f,"f")),"f"),this.namedParameter=Or(this,MA,"m",jB).call(this,t)}get box(){return Or(this,Gn,"f")}get uuid(){return Or(this,Gn,"f").address.uuid}get address(){return Or(this,Gn,"f").address}get labelField(){return Or(this,Gn,"f").label}get iconField(){return Or(this,Gn,"f").icon}get defaultTrackType(){return me.Audio}get enabledField(){return Or(this,Gn,"f").enabled}get minimizedField(){return Or(this,Gn,"f").minimized}get acceptsMidiEvents(){return!1}deviceHost(){return Or(this,$f,"f").boxAdapters.adapterFor(Or(this,Gn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Or(this,As,"f").terminate()}};$f=new WeakMap,Gn=new WeakMap,As=new WeakMap,MA=new WeakSet,jB=function(e){return{flutter:Or(this,As,"f").createParameter(e.flutter,A.unipolar(),_.percent(),"flutter"),wow:Or(this,As,"f").createParameter(e.wow,A.unipolar(),_.percent(),"wow"),noise:Or(this,As,"f").createParameter(e.noise,A.unipolar(),_.percent(),"noise"),saturation:Or(this,As,"f").createParameter(e.saturation,A.unipolar(),_.percent(),"saturation")}};var zo=(()=>{let t=[1,2,3,4],n=["12","24","36","48"],i=[ut.sine,ut.triangle,ut.saw,ut.square],o=["Sine","Triangle","Saw","Square"];return{MIN_CUTOFF:20,MAX_CUTOFF:2e4,CUTOFF_VALUE_MAPPING:A.exponential(20,2e4),CUTOFF_STRING_MAPPING:_.numeric({unit:"Hz"}),FILTER_ORDER_VALUES:t,FILTER_ORDER_STRINGS:n,FILTER_ORDER_VALUE_MAPPING:A.values(t),FILTER_ORDER_STRING_MAPPING:_.values("db",t,n),LFO_WAVEFORM_VALUES:i,LFO_WAVEFORM_STRINGS:o,LFO_WAVEFORM_VALUE_MAPPING:A.values(i),LFO_WAVEFORM_STRING_MAPPING:_.values("",i,o)}})();var kA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},We=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$A,Tf,qn,it,LB,gd=class{constructor(e,t){$A.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Vaporisateur,Tf.set(this,void 0),qn.set(this,void 0),it.set(this,void 0),kA(this,Tf,e,"f"),kA(this,qn,t,"f"),kA(this,it,new we(We(this,Tf,"f")),"f"),this.namedParameter=We(this,$A,"m",LB).call(this,t)}get box(){return We(this,qn,"f")}get uuid(){return We(this,qn,"f").address.uuid}get address(){return We(this,qn,"f").address}get labelField(){return We(this,qn,"f").label}get iconField(){return We(this,qn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return We(this,qn,"f").enabled}get minimizedField(){return We(this,qn,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return We(this,Tf,"f").boxAdapters.adapterFor(We(this,qn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){We(this,it,"f").terminate()}};Tf=new WeakMap,qn=new WeakMap,it=new WeakMap,$A=new WeakSet,LB=function(e){let t=[_o.Monophonic,_o.Polyphonic];return{oscillators:e.oscillators.fields().map(n=>({waveform:We(this,it,"f").createParameter(n.waveform,A.linearInteger(0,3),_.indices("",["Sine","Triangle","Sawtooth","Square"]),"Waveform"),volume:We(this,it,"f").createParameter(n.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"Volume"),octave:We(this,it,"f").createParameter(n.octave,A.linearInteger(-3,3),_.numeric({unit:"oct"}),"Octave",.5),tune:We(this,it,"f").createParameter(n.tune,A.linear(-1200,1200),_.numeric({unit:"ct",fractionDigits:0}),"Tune",.5)})),noise:{volume:We(this,it,"f").createParameter(e.noise.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"Volume"),attack:We(this,it,"f").createParameter(e.noise.attack,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Attack"),hold:We(this,it,"f").createParameter(e.noise.hold,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Hold"),release:We(this,it,"f").createParameter(e.noise.release,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Release")},filterOrder:We(this,it,"f").createParameter(e.filterOrder,zo.FILTER_ORDER_VALUE_MAPPING,zo.FILTER_ORDER_STRING_MAPPING,"Flt. Order"),cutoff:We(this,it,"f").createParameter(e.cutoff,zo.CUTOFF_VALUE_MAPPING,zo.CUTOFF_STRING_MAPPING,"Flt. Cutoff"),resonance:We(this,it,"f").createParameter(e.resonance,A.exponential(.01,10),_.numeric({unit:"q",fractionDigits:3}),"Flt. Q"),attack:We(this,it,"f").createParameter(e.attack,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Attack"),decay:We(this,it,"f").createParameter(e.decay,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Decay"),sustain:We(this,it,"f").createParameter(e.sustain,A.unipolar(),_.percent({fractionDigits:1}),"Sustain"),release:We(this,it,"f").createParameter(e.release,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Release"),filterEnvelope:We(this,it,"f").createParameter(e.filterEnvelope,A.bipolar(),_.percent({fractionDigits:1}),"Flt. Env.",.5),filterKeyboard:We(this,it,"f").createParameter(e.filterKeyboard,A.bipolar(),_.percent({fractionDigits:1}),"Flt. Kbd.",.5),voicingMode:We(this,it,"f").createParameter(e.voicingMode,A.values(t),_.values("",t,["mono","poly"]),"Play Mode",.5),glideTime:We(this,it,"f").createParameter(e.glideTime,A.unipolar(),_.percent({fractionDigits:1}),"Glide time",0),unisonCount:We(this,it,"f").createParameter(e.unisonCount,A.values([1,3,5]),_.values("#",[1,3,5],[1,3,5].map(n=>String(n))),"Unisono",0),unisonDetune:We(this,it,"f").createParameter(e.unisonDetune,A.exponential(1,1200),_.numeric({unit:"ct",fractionDigits:0}),"Detune",0),unisonStereo:We(this,it,"f").createParameter(e.unisonStereo,A.unipolar(),_.percent({fractionDigits:0}),"Stereo",0),lfoWaveform:We(this,it,"f").createParameter(e.lfo.waveform,zo.LFO_WAVEFORM_VALUE_MAPPING,zo.LFO_WAVEFORM_STRING_MAPPING,"LFO Shape",0),lfoRate:We(this,it,"f").createParameter(e.lfo.rate,A.exponential(1e-4,30),_.numeric({unit:"Hz",fractionDigits:1,unitPrefix:!0}),"Rate",0),lfoTargetTune:We(this,it,"f").createParameter(e.lfo.targetTune,A.bipolar(),_.percent({fractionDigits:1}),"Vibrato \u29BF",.5),lfoTargetVolume:We(this,it,"f").createParameter(e.lfo.targetVolume,A.bipolar(),_.percent({fractionDigits:1}),"Tremolo \u29BF",.5),lfoTargetCutoff:We(this,it,"f").createParameter(e.lfo.targetCutoff,A.bipolar(),_.percent({fractionDigits:1}),"Cutoff \u29BF",.5)}};var TA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ur=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},RA,ax,Rf,hn,Uo,KB,Hn=class{constructor(e,t){RA.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Arpeggio,Rf.set(this,void 0),hn.set(this,void 0),Uo.set(this,void 0),TA(this,Rf,e,"f"),TA(this,hn,t,"f"),TA(this,Uo,new we(ur(this,Rf,"f")),"f"),this.namedParameter=ur(this,RA,"m",KB).call(this,t)}get box(){return ur(this,hn,"f")}get uuid(){return ur(this,hn,"f").address.uuid}get address(){return ur(this,hn,"f").address}get indexField(){return ur(this,hn,"f").index}get labelField(){return ur(this,hn,"f").label}get enabledField(){return ur(this,hn,"f").enabled}get minimizedField(){return ur(this,hn,"f").minimized}get host(){return ur(this,hn,"f").host}deviceHost(){return ur(this,Rf,"f").boxAdapters.adapterFor(ur(this,hn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){ur(this,Uo,"f").terminate()}};ax=Hn,Rf=new WeakMap,hn=new WeakMap,Uo=new WeakMap,RA=new WeakSet,KB=function(e){return{modeIndex:ur(this,Uo,"f").createParameter(e.modeIndex,A.linearInteger(0,2),_.indices("",["Up","Down","UpDown"]),"mode"),numOctaves:ur(this,Uo,"f").createParameter(e.numOctaves,A.linearInteger(1,5),_.numeric({unit:"",fractionDigits:0}),"Octaves"),rate:ur(this,Uo,"f").createParameter(e.rateIndex,A.linearInteger(0,ax.RateFractions.length-1),ax.RateStringMapping,"Rate"),gate:ur(this,Uo,"f").createParameter(e.gate,A.linear(0,2),_.percent({fractionDigits:0}),"Gate"),repeat:ur(this,Uo,"f").createParameter(e.repeat,A.linearInteger(1,16),_.numeric({fractionDigits:0}),"Repeat"),velocity:ur(this,Uo,"f").createParameter(e.velocity,A.bipolar(),_.percent({fractionDigits:0,bipolar:!1}),"Velocity")}};Hn.RateFractions=wr.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();Hn.RateStringMapping=_.indices("",ax.RateFractions.map(([r,e])=>`${r}/${e}`));var CA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Vr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},OA,Cf,fn,ac,WB,vd=class{constructor(e,t){OA.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Pitch,Cf.set(this,void 0),fn.set(this,void 0),ac.set(this,void 0),CA(this,Cf,e,"f"),CA(this,fn,t,"f"),CA(this,ac,new we(Vr(this,Cf,"f")),"f"),this.namedParameter=Vr(this,OA,"m",WB).call(this,t)}get box(){return Vr(this,fn,"f")}get uuid(){return Vr(this,fn,"f").address.uuid}get address(){return Vr(this,fn,"f").address}get indexField(){return Vr(this,fn,"f").index}get labelField(){return Vr(this,fn,"f").label}get enabledField(){return Vr(this,fn,"f").enabled}get minimizedField(){return Vr(this,fn,"f").minimized}get host(){return Vr(this,fn,"f").host}deviceHost(){return Vr(this,Cf,"f").boxAdapters.adapterFor(Vr(this,fn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Vr(this,ac,"f").terminate()}};Cf=new WeakMap,fn=new WeakMap,ac=new WeakMap,OA=new WeakSet,WB=function(e){return{octaves:Vr(this,ac,"f").createParameter(e.octaves,A.linearInteger(-7,7),_.numeric({unit:"oct",fractionDigits:0}),"octaves"),semiTones:Vr(this,ac,"f").createParameter(e.semiTones,A.linearInteger(-36,36),_.numeric({unit:"st",fractionDigits:0}),"semi-tones"),cent:Vr(this,ac,"f").createParameter(e.cents,A.linear(-50,50),_.numeric({unit:"cents",fractionDigits:1}),"cents")}};var VA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},fi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zA,Of,Jn,yd,ZB,xd=class{constructor(e,t){zA.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Nano,Of.set(this,void 0),Jn.set(this,void 0),yd.set(this,void 0),VA(this,Of,e,"f"),VA(this,Jn,t,"f"),VA(this,yd,new we(fi(this,Of,"f")),"f"),this.namedParameter=fi(this,zA,"m",ZB).call(this,t)}get box(){return fi(this,Jn,"f")}get uuid(){return fi(this,Jn,"f").address.uuid}get address(){return fi(this,Jn,"f").address}get labelField(){return fi(this,Jn,"f").label}get iconField(){return fi(this,Jn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return fi(this,Jn,"f").enabled}get minimizedField(){return fi(this,Jn,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return fi(this,Of,"f").boxAdapters.adapterFor(fi(this,Jn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){fi(this,yd,"f").terminate()}};Of=new WeakMap,Jn=new WeakMap,yd=new WeakMap,zA=new WeakSet,ZB=function(e){return{volume:fi(this,yd,"f").createParameter(e.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"volume"),release:fi(this,yd,"f").createParameter(e.release,A.exponential(.001,8),_.numeric({unit:"s",fractionDigits:3}),"release")}};var wd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ae=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},UA,sc,_s,Te,sx,Vf,Ci,lc,GB,bd=class{constructor(e,t){UA.add(this),this.class="device-host",this.accepts=!1,this.type="instrument",this.manualUrl="manuals/devices/instruments/playfield",sc.set(this,new j),_s.set(this,void 0),Te.set(this,void 0),sx.set(this,void 0),Vf.set(this,void 0),Ci.set(this,void 0),lc.set(this,m.None),wd(this,_s,e,"f"),wd(this,Te,t,"f"),wd(this,sx,ae(this,sc,"f").own(sr.create(ae(this,Te,"f").midiEffects,n=>ae(this,_s,"f").boxAdapters.adapterFor(n,de.isMidiEffect),c.MIDIEffectHost)),"f"),wd(this,Vf,ae(this,sc,"f").own(sr.create(ae(this,Te,"f").audioEffects,n=>ae(this,_s,"f").boxAdapters.adapterFor(n,de.isAudioEffect),c.AudioEffectHost)),"f"),wd(this,Ci,ae(this,sc,"f").own(new we(ae(this,_s,"f"))),"f"),this.namedParameter=ae(this,UA,"m",GB).call(this,t),ae(this,sc,"f").own(ae(this,Te,"f").file.catchupAndSubscribe(n=>{wd(this,lc,n.targetVertex.map(({box:i})=>ae(this,_s,"f").boxAdapters.adapterFor(i,On)),"f"),ae(this,lc,"f").unwrapOrNull()?.getOrCreateLoader()}))}get box(){return ae(this,Te,"f")}get uuid(){return ae(this,Te,"f").address.uuid}get address(){return ae(this,Te,"f").address}get peakAddress(){return ae(this,Te,"f").address.append(1001)}get indexField(){return ae(this,Te,"f").index}get gate(){return ae(this,Te,"f").gate.getValue()}get exclude(){return ae(this,Te,"f").exclude.getValue()}get label(){return`${this.device().labelField.getValue()} > ${ae(this,lc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get fileLabel(){return`${ae(this,lc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get iconField(){return ae(this,Te,"f").icon}get defaultTrackType(){return me.Notes}get acceptsMidiEvents(){return!0}get midiEffectsField(){return ae(this,Te,"f").midiEffects}get inputField(){return this.audioUnitBoxAdapter().box.input}get audioEffectsField(){return ae(this,Te,"f").audioEffects}get tracksField(){return this.audioUnitBoxAdapter().box.tracks}get isAudioUnit(){return!1}file(){return ae(this,lc,"f")}fileUUID(){return ae(this,Te,"f").file.targetAddress.unwrap().uuid}resetParameters(){ae(this,Te,"f").mute.reset(),ae(this,Te,"f").solo.reset(),ae(this,Te,"f").exclude.reset(),ae(this,Te,"f").polyphone.reset(),ae(this,Te,"f").pitch.reset(),ae(this,Te,"f").attack.reset(),ae(this,Te,"f").release.reset(),ae(this,Te,"f").sampleStart.reset(),ae(this,Te,"f").sampleEnd.reset(),ae(this,Te,"f").gate.reset()}copyToIndex(e){Za.create(ae(this,Te,"f").graph,b.generate(),t=>{t.file.refer(ae(this,Te,"f").file.targetVertex.unwrap()),t.device.refer(ae(this,Te,"f").device.targetVertex.unwrap()),t.index.setValue(e),t.mute.setValue(ae(this,Te,"f").mute.getValue()),t.solo.setValue(ae(this,Te,"f").solo.getValue()),t.sampleStart.setValue(ae(this,Te,"f").sampleStart.getValue()),t.sampleEnd.setValue(ae(this,Te,"f").sampleEnd.getValue()),t.attack.setValue(ae(this,Te,"f").attack.getValue()),t.release.setValue(ae(this,Te,"f").release.getValue()),t.pitch.setValue(ae(this,Te,"f").pitch.getValue()),t.exclude.setValue(ae(this,Te,"f").exclude.getValue()),t.gate.setValue(ae(this,Te,"f").gate.getValue())})}get midiEffects(){return ae(this,sx,"f")}get inputAdapter(){return m.wrap(this)}get audioEffects(){return ae(this,Vf,"f")}get labelField(){return Ce(ae(this,Te,"f").file.targetVertex.unwrap().box,br).fileName}get enabledField(){return ae(this,Te,"f").enabled}get minimizedField(){return ae(this,Te,"f").minimized}device(){return ae(this,_s,"f").boxAdapters.adapterFor(ae(this,Te,"f").device.targetVertex.unwrap().box,Ps)}deviceHost(){return this.device().deviceHost()}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.fileLabel,children:()=>m.None};for(let e of ae(this,Vf,"f").adapters())yield*e.labeledAudioOutputs()}terminate(){ae(this,sc,"f").terminate()}};sc=new WeakMap,_s=new WeakMap,Te=new WeakMap,sx=new WeakMap,Vf=new WeakMap,Ci=new WeakMap,lc=new WeakMap,UA=new WeakSet,GB=function(e){return{gate:ae(this,Ci,"f").createParameter(e.gate,A.linearInteger(0,2),_.indices("",["Off","On","Loop"]),"Gate"),mute:ae(this,Ci,"f").createParameter(e.mute,A.bool,_.bool,"Mute"),solo:ae(this,Ci,"f").createParameter(e.solo,A.bool,_.bool,"Solo"),polyphone:ae(this,Ci,"f").createParameter(e.polyphone,A.bool,_.bool,"Polyphone"),exclude:ae(this,Ci,"f").createParameter(e.exclude,A.bool,_.bool,"Exclude"),pitch:ae(this,Ci,"f").createParameter(e.pitch,A.linear(-1200,1200),_.numeric({unit:"cents",bipolar:!0,fractionDigits:0}),"Pitch",0),sampleStart:ae(this,Ci,"f").createParameter(e.sampleStart,A.unipolar(),_.percent(),"Start",0),sampleEnd:ae(this,Ci,"f").createParameter(e.sampleEnd,A.unipolar(),_.percent(),"End",1),attack:ae(this,Ci,"f").createParameter(e.attack,A.exponential(.001,5),_.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Attack"),release:ae(this,Ci,"f").createParameter(e.release,A.exponential(.001,5),_.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Release")}};var lx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Yr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ad,Qn,_d,cx,Ps=class{constructor(e,t){this.type="instrument",this.accepts="midi",this.manualUrl=pe.Playfield,Ad.set(this,void 0),Qn.set(this,void 0),_d.set(this,void 0),cx.set(this,void 0),lx(this,Ad,e,"f"),lx(this,Qn,t,"f"),lx(this,_d,sr.create(t.samples,n=>e.boxAdapters.adapterFor(n,bd),c.Sample),"f"),lx(this,cx,new we(Yr(this,Ad,"f")),"f")}reset(){Yr(this,_d,"f").adapters().forEach(e=>e.box.delete())}get box(){return Yr(this,Qn,"f")}get uuid(){return Yr(this,Qn,"f").address.uuid}get address(){return Yr(this,Qn,"f").address}get labelField(){return Yr(this,Qn,"f").label}get iconField(){return Yr(this,Qn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return Yr(this,Qn,"f").enabled}get minimizedField(){return Yr(this,Qn,"f").minimized}get acceptsMidiEvents(){return!0}get samples(){return Yr(this,_d,"f")}get context(){return Yr(this,Ad,"f")}deviceHost(){return Yr(this,Ad,"f").boxAdapters.adapterFor(Yr(this,Qn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None};for(let e of Yr(this,_d,"f").adapters())yield{address:e.address,label:e.fileLabel,children:()=>m.wrap(e.labeledAudioOutputs())}}terminate(){Yr(this,cx,"f").terminate()}};Ad=new WeakMap,Qn=new WeakMap,_d=new WeakMap,cx=new WeakMap;var jA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},dr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},LA,zf,mn,jo,qB,Pd=class{constructor(e,t){LA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.StereoTool,zf.set(this,void 0),mn.set(this,void 0),jo.set(this,void 0),jA(this,zf,e,"f"),jA(this,mn,t,"f"),jA(this,jo,new we(dr(this,zf,"f")),"f"),this.namedParameter=dr(this,LA,"m",qB).call(this,t)}get box(){return dr(this,mn,"f")}get uuid(){return dr(this,mn,"f").address.uuid}get address(){return dr(this,mn,"f").address}get indexField(){return dr(this,mn,"f").index}get labelField(){return dr(this,mn,"f").label}get enabledField(){return dr(this,mn,"f").enabled}get minimizedField(){return dr(this,mn,"f").minimized}get host(){return dr(this,mn,"f").host}deviceHost(){return dr(this,zf,"f").boxAdapters.adapterFor(dr(this,mn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){dr(this,jo,"f").terminate()}};zf=new WeakMap,mn=new WeakMap,jo=new WeakMap,LA=new WeakSet,qB=function(e){return{volume:dr(this,jo,"f").createParameter(e.volume,A.decibel(-72,0,12),_.numeric({unit:"db",fractionDigits:1}),"Volume"),panning:dr(this,jo,"f").createParameter(e.panning,A.bipolar(),_.panning,"Panning",.5),stereo:dr(this,jo,"f").createParameter(e.stereo,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"stereo",.5),invertL:dr(this,jo,"f").createParameter(e.invertL,A.bool,_.bool,"Invert Left"),invertR:dr(this,jo,"f").createParameter(e.invertR,A.bool,_.bool,"Invert Right"),swap:dr(this,jo,"f").createParameter(e.swap,A.bool,_.bool,"Swap")}};var cc;(function(r){r.checkType=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="groove-adapter"})(cc||(cc={}));var HB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Sd,gi,Ed=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Zeitgeist,Sd.set(this,void 0),gi.set(this,void 0),HB(this,Sd,e,"f"),HB(this,gi,t,"f"),this.groove()}get box(){return mi(this,gi,"f")}get uuid(){return mi(this,gi,"f").address.uuid}get address(){return mi(this,gi,"f").address}get indexField(){return mi(this,gi,"f").index}get labelField(){return mi(this,gi,"f").label}get enabledField(){return mi(this,gi,"f").enabled}get minimizedField(){return mi(this,gi,"f").minimized}get host(){return mi(this,gi,"f").host}deviceHost(){return mi(this,Sd,"f").boxAdapters.adapterFor(mi(this,gi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}groove(){return mi(this,Sd,"f").boxAdapters.adapterFor(mi(this,gi,"f").groove.targetVertex.unwrap("no groove").box,cc.checkType)}catchupAndSubscribeGroove(e){return mi(this,gi,"f").groove.catchupAndSubscribe(t=>e(mi(this,Sd,"f").boxAdapters.adapterFor(t.targetVertex.unwrap("No groove found").box,cc.checkType)))}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Sd=new WeakMap,gi=new WeakMap;var JB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Yn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ux,Oi,Fd=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",this.manualUrl="",ux.set(this,void 0),Oi.set(this,void 0),JB(this,ux,e,"f"),JB(this,Oi,t,"f")}get box(){return Yn(this,Oi,"f")}get uuid(){return Yn(this,Oi,"f").address.uuid}get address(){return Yn(this,Oi,"f").address}get indexField(){return Yn(this,Oi,"f").index}get labelField(){return Yn(this,Oi,"f").label}get enabledField(){return Yn(this,Oi,"f").enabled}get minimizedField(){return Yn(this,Oi,"f").minimized}get host(){return Yn(this,Oi,"f").host}get commentField(){return Yn(this,Oi,"f").comment}deviceHost(){return Yn(this,ux,"f").boxAdapters.adapterFor(Yn(this,Oi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}};ux=new WeakMap,Oi=new WeakMap;var QB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},dx,Vi,Bd=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",this.manualUrl="",dx.set(this,void 0),Vi.set(this,void 0),QB(this,dx,e,"f"),QB(this,Vi,t,"f")}get box(){return Xn(this,Vi,"f")}get uuid(){return Xn(this,Vi,"f").address.uuid}get address(){return Xn(this,Vi,"f").address}get indexField(){return Xn(this,Vi,"f").index}get labelField(){return Xn(this,Vi,"f").label}get enabledField(){return Xn(this,Vi,"f").enabled}get minimizedField(){return Xn(this,Vi,"f").minimized}get host(){return Xn(this,Vi,"f").host}get commentField(){return Xn(this,Vi,"f").comment}deviceHost(){return Xn(this,dx,"f").boxAdapters.adapterFor(Xn(this,Vi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};dx=new WeakMap,Vi=new WeakMap;var Ss=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ze=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},KA,WA,Uf,vi,px,Nd,eo,gn,Id,YB,ZA,Dd=class{constructor(e,t){KA.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Soundfont,WA.set(this,new j),Uf.set(this,void 0),vi.set(this,void 0),px.set(this,void 0),Nd.set(this,void 0),eo.set(this,void 0),gn.set(this,void 0),Id.set(this,ee.Empty),ZA.set(this,n=>n.match({none:()=>{Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear()},some:i=>i.soundfont.match({none:()=>{Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear(),Ze(this,Id,"f").terminate(),Ss(this,Id,i.subscribe(o=>{if(o.type==="loaded"){let a=i.soundfont.unwrap();Ze(this,gn,"f").wrap(a.presets[this.presetIndex]??a.presets[0]),Ze(this,eo,"f").wrap(a)}else o.type==="error"?(Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear()):o.type==="idle"&&(Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear())}),"f")},some:o=>{Ze(this,eo,"f").wrap(o),Ze(this,gn,"f").wrap(o.presets[this.presetIndex]??o.presets[0])}})})),Ss(this,Uf,e,"f"),Ss(this,vi,t,"f"),Ss(this,px,new we(Ze(this,Uf,"f")),"f"),this.namedParameter=Ze(this,KA,"m",YB).call(this,t),Ss(this,Nd,new Mr,"f"),Ss(this,eo,new Mr,"f"),Ss(this,gn,new Mr,"f"),Ze(this,WA,"f").ownAll(Ze(this,Nd,"f").subscribe(Ze(this,ZA,"f")),Ze(this,vi,"f").file.catchupAndSubscribe(({targetVertex:n})=>Ze(this,Nd,"f").wrapOption(n.map(({box:i})=>e.soundfontManager.getOrCreate(i.address.uuid)))),Ze(this,vi,"f").presetIndex.catchupAndSubscribe(n=>Ze(this,eo,"f").match({none:()=>Ze(this,gn,"f").clear(),some:i=>Ze(this,gn,"f").wrap(i.presets[n.getValue()]??i.presets[0])})))}get loader(){return Ze(this,Nd,"f")}get soundfont(){return Ze(this,eo,"f")}get preset(){return Ze(this,gn,"f")}get presetIndex(){return Ze(this,vi,"f").presetIndex.getValue()}get box(){return Ze(this,vi,"f")}get uuid(){return Ze(this,vi,"f").address.uuid}get address(){return Ze(this,vi,"f").address}get labelField(){return Ze(this,vi,"f").label}get iconField(){return Ze(this,vi,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return Ze(this,vi,"f").enabled}get minimizedField(){return Ze(this,vi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Ze(this,Uf,"f").boxAdapters.adapterFor(Ze(this,vi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Ze(this,Id,"f").terminate(),Ss(this,Id,ee.Empty,"f"),Ze(this,px,"f").terminate()}};WA=new WeakMap,Uf=new WeakMap,vi=new WeakMap,px=new WeakMap,Nd=new WeakMap,eo=new WeakMap,gn=new WeakMap,Id=new WeakMap,ZA=new WeakMap,KA=new WeakSet,YB=function(e){return{}};var XB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},jf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hx,uc,fx=class{constructor(e,t){hx.set(this,void 0),uc.set(this,void 0),XB(this,hx,e,"f"),XB(this,uc,t,"f")}get box(){return jf(this,uc,"f")}get uuid(){return jf(this,uc,"f").address.uuid}get address(){return jf(this,uc,"f").address}get soundfont(){return this.getOrCreateLoader().soundfont}getOrCreateLoader(){return jf(this,hx,"f").soundfontManager.getOrCreate(jf(this,uc,"f").address.uuid)}terminate(){}};hx=new WeakMap,uc=new WeakMap;var GA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},yi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qA,Lf,vn,Kf,eN,Md=class{constructor(e,t){qA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Maximizer,Lf.set(this,void 0),vn.set(this,void 0),Kf.set(this,void 0),GA(this,Lf,e,"f"),GA(this,vn,t,"f"),GA(this,Kf,new we(yi(this,Lf,"f")),"f"),this.namedParameter=yi(this,qA,"m",eN).call(this,t)}get box(){return yi(this,vn,"f")}get uuid(){return yi(this,vn,"f").address.uuid}get address(){return yi(this,vn,"f").address}get indexField(){return yi(this,vn,"f").index}get labelField(){return yi(this,vn,"f").label}get enabledField(){return yi(this,vn,"f").enabled}get minimizedField(){return yi(this,vn,"f").minimized}get host(){return yi(this,vn,"f").host}deviceHost(){return yi(this,Lf,"f").boxAdapters.adapterFor(yi(this,vn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){yi(this,Kf,"f").terminate()}};Lf=new WeakMap,vn=new WeakMap,Kf=new WeakMap,qA=new WeakSet,eN=function(e){return{threshold:yi(this,Kf,"f").createParameter(e.threshold,A.linear(-24,0),_.decible,"Threshold")}};var HA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Pt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},JA,Wf,zi,zr,tN,kd=class{constructor(e,t){JA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Compressor,Wf.set(this,void 0),zi.set(this,void 0),zr.set(this,void 0),HA(this,Wf,e,"f"),HA(this,zi,t,"f"),HA(this,zr,new we(Pt(this,Wf,"f")),"f"),this.namedParameter=Pt(this,JA,"m",tN).call(this,t)}get box(){return Pt(this,zi,"f")}get uuid(){return Pt(this,zi,"f").address.uuid}get address(){return Pt(this,zi,"f").address}get indexField(){return Pt(this,zi,"f").index}get labelField(){return Pt(this,zi,"f").label}get enabledField(){return Pt(this,zi,"f").enabled}get minimizedField(){return Pt(this,zi,"f").minimized}get host(){return Pt(this,zi,"f").host}get sideChain(){return Pt(this,zi,"f").sideChain}deviceHost(){return Pt(this,Wf,"f").boxAdapters.adapterFor(Pt(this,zi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Pt(this,zr,"f").terminate()}};Wf=new WeakMap,zi=new WeakMap,zr=new WeakMap,JA=new WeakSet,tN=function(e){return{lookahead:Pt(this,zr,"f").createParameter(e.lookahead,A.bool,_.bool,"Lookahead"),automakeup:Pt(this,zr,"f").createParameter(e.automakeup,A.bool,_.bool,"Auto Makeup"),autoattack:Pt(this,zr,"f").createParameter(e.autoattack,A.bool,_.bool,"Auto Attack"),autorelease:Pt(this,zr,"f").createParameter(e.autorelease,A.bool,_.bool,"Auto Release"),inputgain:Pt(this,zr,"f").createParameter(e.inputgain,A.linear(-30,30),_.decible,"Input Gain"),threshold:Pt(this,zr,"f").createParameter(e.threshold,A.linear(-60,0),_.decible,"Threshold"),ratio:Pt(this,zr,"f").createParameter(e.ratio,A.exponential(1,24),_.numeric({fractionDigits:1}),"Ratio"),knee:Pt(this,zr,"f").createParameter(e.knee,A.linear(0,24),_.decible,"Knee"),attack:Pt(this,zr,"f").createParameter(e.attack,A.linear(0,100),_.numeric({unit:"ms",fractionDigits:1}),"Attack Time"),release:Pt(this,zr,"f").createParameter(e.release,A.linear(5,1500),_.numeric({unit:"ms",fractionDigits:1}),"Release Time"),makeup:Pt(this,zr,"f").createParameter(e.makeup,A.linear(-40,40),_.decible,"Makeup Gain"),mix:Pt(this,zr,"f").createParameter(e.mix,A.unipolar(),_.percent(),"Dry/Wet")}};var QA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Gt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},YA,Zf,Ui,to,rN,$d=class{constructor(e,t){YA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Gate,Zf.set(this,void 0),Ui.set(this,void 0),to.set(this,void 0),QA(this,Zf,e,"f"),QA(this,Ui,t,"f"),QA(this,to,new we(Gt(this,Zf,"f")),"f"),this.namedParameter=Gt(this,YA,"m",rN).call(this,t)}get box(){return Gt(this,Ui,"f")}get uuid(){return Gt(this,Ui,"f").address.uuid}get address(){return Gt(this,Ui,"f").address}get indexField(){return Gt(this,Ui,"f").index}get labelField(){return Gt(this,Ui,"f").label}get enabledField(){return Gt(this,Ui,"f").enabled}get minimizedField(){return Gt(this,Ui,"f").minimized}get host(){return Gt(this,Ui,"f").host}get sideChain(){return Gt(this,Ui,"f").sideChain}deviceHost(){return Gt(this,Zf,"f").boxAdapters.adapterFor(Gt(this,Ui,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Gt(this,to,"f").terminate()}};Zf=new WeakMap,Ui=new WeakMap,to=new WeakMap,YA=new WeakSet,rN=function(e){return{inverse:Gt(this,to,"f").createParameter(e.inverse,A.bool,_.bool,"Inverse"),threshold:Gt(this,to,"f").createParameter(e.threshold,A.linear(-80,0),_.decible,"Threshold"),return:Gt(this,to,"f").createParameter(e.return,A.linear(0,24),_.decible,"Return"),attack:Gt(this,to,"f").createParameter(e.attack,A.linear(0,50),_.numeric({unit:"ms",fractionDigits:1}),"Attack"),hold:Gt(this,to,"f").createParameter(e.hold,A.linear(0,500),_.numeric({unit:"ms",fractionDigits:1}),"Hold"),release:Gt(this,to,"f").createParameter(e.release,A.linear(1,2e3),_.numeric({unit:"ms",fractionDigits:1}),"Release"),floor:Gt(this,to,"f").createParameter(e.floor,A.decibel(-72,-12,0),_.decible,"Floor")}};var XA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Br=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},e_,Gf,yn,Es,iN,Td=class{constructor(e,t){e_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Crusher,Gf.set(this,void 0),yn.set(this,void 0),Es.set(this,void 0),XA(this,Gf,e,"f"),XA(this,yn,t,"f"),XA(this,Es,new we(Br(this,Gf,"f")),"f"),this.namedParameter=Br(this,e_,"m",iN).call(this,t)}get box(){return Br(this,yn,"f")}get uuid(){return Br(this,yn,"f").address.uuid}get address(){return Br(this,yn,"f").address}get indexField(){return Br(this,yn,"f").index}get labelField(){return Br(this,yn,"f").label}get enabledField(){return Br(this,yn,"f").enabled}get minimizedField(){return Br(this,yn,"f").minimized}get host(){return Br(this,yn,"f").host}deviceHost(){return Br(this,Gf,"f").boxAdapters.adapterFor(Br(this,yn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Br(this,Es,"f").terminate()}};Gf=new WeakMap,yn=new WeakMap,Es=new WeakMap,e_=new WeakSet,iN=function(e){return{crush:Br(this,Es,"f").createParameter(e.crush,A.unipolar(),_.percent(),"Crush"),bits:Br(this,Es,"f").createParameter(e.bits,A.linearInteger(1,16),_.numeric(),"Bits"),boost:Br(this,Es,"f").createParameter(e.boost,A.linear(0,24),_.decible,"Boost"),mix:Br(this,Es,"f").createParameter(e.mix,A.exponential(.001,1),_.percent(),"Mix")}};var t_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},r_,qf,xn,Rd,nN,Cd=class{constructor(e,t){r_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Fold,qf.set(this,void 0),xn.set(this,void 0),Rd.set(this,void 0),t_(this,qf,e,"f"),t_(this,xn,t,"f"),t_(this,Rd,new we(Xr(this,qf,"f")),"f"),this.namedParameter=Xr(this,r_,"m",nN).call(this,t)}get box(){return Xr(this,xn,"f")}get uuid(){return Xr(this,xn,"f").address.uuid}get address(){return Xr(this,xn,"f").address}get indexField(){return Xr(this,xn,"f").index}get labelField(){return Xr(this,xn,"f").label}get enabledField(){return Xr(this,xn,"f").enabled}get minimizedField(){return Xr(this,xn,"f").minimized}get host(){return Xr(this,xn,"f").host}deviceHost(){return Xr(this,qf,"f").boxAdapters.adapterFor(Xr(this,xn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Xr(this,Rd,"f").terminate()}};qf=new WeakMap,xn=new WeakMap,Rd=new WeakMap,r_=new WeakSet,nN=function(e){return{drive:Xr(this,Rd,"f").createParameter(e.drive,A.linear(0,30),_.decible,"Drive"),volume:Xr(this,Rd,"f").createParameter(e.volume,A.linear(-18,0),_.decible,"Volume")}};var mx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ir=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Hf,Jf,wn,Od,Vd,zd=class{constructor(e,t){Hf.set(this,new j),this.type="instrument",this.accepts="midi",this.manualUrl=pe.MIDIOutput,Jf.set(this,void 0),wn.set(this,void 0),Od.set(this,void 0),Vd.set(this,void 0),mx(this,Jf,e,"f"),mx(this,wn,t,"f"),mx(this,Od,new Mr,"f"),mx(this,Vd,ir(this,Hf,"f").own(new we(ir(this,Jf,"f"))),"f"),ir(this,Hf,"f").ownAll(t.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>ir(this,Vd,"f").createParameter(Ce(n,Rn).value,A.unipolar(),_.percent({fractionDigits:1}),"",0),onRemoved:({box:n})=>ir(this,Vd,"f").removeParameter(Ce(n,Rn).value.address)}),ir(this,wn,"f").device.catchupAndSubscribe(({targetVertex:n})=>n.match({none:()=>ir(this,Od,"f").clear(),some:({box:i})=>ir(this,Od,"f").wrap(Ce(i,Tn))})))}get box(){return ir(this,wn,"f")}get uuid(){return ir(this,wn,"f").address.uuid}get address(){return ir(this,wn,"f").address}get labelField(){return ir(this,wn,"f").label}get iconField(){return ir(this,wn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return ir(this,wn,"f").enabled}get minimizedField(){return ir(this,wn,"f").minimized}get acceptsMidiEvents(){return!0}get parameters(){return ir(this,Vd,"f")}get midiDevice(){return ir(this,Od,"f")}deviceHost(){return ir(this,Jf,"f").boxAdapters.adapterFor(ir(this,wn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){ir(this,Hf,"f").terminate()}};Hf=new WeakMap,Jf=new WeakMap,wn=new WeakMap,Od=new WeakMap,Vd=new WeakMap;var gx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},qt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},i_,Qf,bn,Lo,Yf,oN,Ud=class{constructor(e,t){i_.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Velocity,Qf.set(this,void 0),bn.set(this,void 0),Lo.set(this,void 0),Yf.set(this,void 0),gx(this,Qf,e,"f"),gx(this,bn,t,"f"),gx(this,Lo,new we(qt(this,Qf,"f")),"f"),gx(this,Yf,Rc.create(),"f"),this.namedParameter=qt(this,i_,"m",oN).call(this,t)}computeVelocity(e,t){let{magnetPosition:n,magnetStrength:i,randomSeed:o,randomAmount:a,offset:s,mix:l}=this.namedParameter;qt(this,Yf,"f").setSeed(o.valueAt(e)+e);let u=t+(n.valueAt(e)-t)*i.valueAt(e),p=(qt(this,Yf,"f").uniform()*2-1)*a.valueAt(e),d=s.valueAt(e),h=l.valueAt(e);return t*(1-h)+qi(u+p+d)*h}get box(){return qt(this,bn,"f")}get uuid(){return qt(this,bn,"f").address.uuid}get address(){return qt(this,bn,"f").address}get indexField(){return qt(this,bn,"f").index}get labelField(){return qt(this,bn,"f").label}get enabledField(){return qt(this,bn,"f").enabled}get minimizedField(){return qt(this,bn,"f").minimized}get host(){return qt(this,bn,"f").host}deviceHost(){return qt(this,Qf,"f").boxAdapters.adapterFor(qt(this,bn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){qt(this,Lo,"f").terminate()}};Qf=new WeakMap,bn=new WeakMap,Lo=new WeakMap,Yf=new WeakMap,i_=new WeakSet,oN=function(e){return{magnetPosition:qt(this,Lo,"f").createParameter(e.magnetPosition,A.unipolar(),_.percent(),"Position"),magnetStrength:qt(this,Lo,"f").createParameter(e.magnetStrength,A.unipolar(),_.percent(),"Strength"),randomSeed:qt(this,Lo,"f").createParameter(e.randomSeed,A.linearInteger(0,65535),_.numeric({unit:"",fractionDigits:0}),"Seed"),randomAmount:qt(this,Lo,"f").createParameter(e.randomAmount,A.unipolar(),_.percent(),"Amount"),offset:qt(this,Lo,"f").createParameter(e.offset,A.bipolar(),_.percent(),"Offset"),mix:qt(this,Lo,"f").createParameter(e.mix,A.unipolar(),_.percent(),"Mix")}};var n_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},o_,a_,Xf,An,Ko,aN,ro=class{constructor(e,t){o_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Tidal,Xf.set(this,void 0),An.set(this,void 0),Ko.set(this,void 0),n_(this,Xf,e,"f"),n_(this,An,t,"f"),n_(this,Ko,new we(pr(this,Xf,"f")),"f"),this.namedParameter=pr(this,o_,"m",aN).call(this,t)}get box(){return pr(this,An,"f")}get uuid(){return pr(this,An,"f").address.uuid}get address(){return pr(this,An,"f").address}get indexField(){return pr(this,An,"f").index}get labelField(){return pr(this,An,"f").label}get enabledField(){return pr(this,An,"f").enabled}get minimizedField(){return pr(this,An,"f").minimized}get host(){return pr(this,An,"f").host}deviceHost(){return pr(this,Xf,"f").boxAdapters.adapterFor(pr(this,An,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){pr(this,Ko,"f").terminate()}};a_=ro,Xf=new WeakMap,An=new WeakMap,Ko=new WeakMap,o_=new WeakSet,aN=function(e){let{RateFractions:t,RateStringMapping:n}=a_;return{slope:pr(this,Ko,"f").createParameter(e.slope,A.bipolar(),_.percent({fractionDigits:1}),"Slope",.5),symmetry:pr(this,Ko,"f").createParameter(e.symmetry,A.unipolar(),_.percent({fractionDigits:1,bipolar:!0}),"Symmetry",.5),rate:pr(this,Ko,"f").createParameter(e.rate,A.values(t.map((i,o)=>o)),n,"Rate",0),depth:pr(this,Ko,"f").createParameter(e.depth,A.unipolar(),_.percent({fractionDigits:1}),"Depth",0),offset:pr(this,Ko,"f").createParameter(e.offset,A.linear(-180,180),_.numeric({unit:"\xB0",fractionDigits:0}),"Offset",.5),channelOffset:pr(this,Ko,"f").createParameter(e.channelOffset,A.linear(-180,180),_.numeric({unit:"\xB0",fractionDigits:0}),"Ch. Offset",.5)}};ro.RateFractions=wr.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();ro.RateStringMapping=_.indices("",a_.RateFractions.map(([r,e])=>`${r}/${e}`));var s_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Bt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},l_,em,_n,Ur,sN,jd=class{constructor(e,t){l_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.DattorroReverb,em.set(this,void 0),_n.set(this,void 0),Ur.set(this,void 0),s_(this,em,e,"f"),s_(this,_n,t,"f"),s_(this,Ur,new we(Bt(this,em,"f")),"f"),this.namedParameter=Bt(this,l_,"m",sN).call(this,t)}get box(){return Bt(this,_n,"f")}get uuid(){return Bt(this,_n,"f").address.uuid}get address(){return Bt(this,_n,"f").address}get indexField(){return Bt(this,_n,"f").index}get labelField(){return Bt(this,_n,"f").label}get enabledField(){return Bt(this,_n,"f").enabled}get minimizedField(){return Bt(this,_n,"f").minimized}get host(){return Bt(this,_n,"f").host}deviceHost(){return Bt(this,em,"f").boxAdapters.adapterFor(Bt(this,_n,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Bt(this,Ur,"f").terminate()}};em=new WeakMap,_n=new WeakMap,Ur=new WeakMap,l_=new WeakSet,sN=function(e){return{preDelay:Bt(this,Ur,"f").createParameter(e.preDelay,A.linear(0,1e3),_.numeric({unit:e.preDelay.unit}),"Pre-Delay"),bandwidth:Bt(this,Ur,"f").createParameter(e.bandwidth,A.unipolar(),_.percent(),"Bandwidth"),inputDiffusion1:Bt(this,Ur,"f").createParameter(e.inputDiffusion1,A.unipolar(),_.percent(),"Tank 1"),inputDiffusion2:Bt(this,Ur,"f").createParameter(e.inputDiffusion2,A.unipolar(),_.percent(),"Tank 2"),decay:Bt(this,Ur,"f").createParameter(e.decay,A.unipolar(),_.percent(),"Decay"),decayDiffusion1:Bt(this,Ur,"f").createParameter(e.decayDiffusion1,A.unipolar(),_.percent(),"Tank 1"),decayDiffusion2:Bt(this,Ur,"f").createParameter(e.decayDiffusion2,A.unipolar(),_.percent(),"Tank 2"),damping:Bt(this,Ur,"f").createParameter(e.damping,A.unipolar(),_.percent(),"Damping"),excursionRate:Bt(this,Ur,"f").createParameter(e.excursionRate,A.unipolar(),_.numeric({unit:e.excursionRate.unit}),"Rate"),excursionDepth:Bt(this,Ur,"f").createParameter(e.excursionDepth,A.unipolar(),_.numeric({unit:e.excursionDepth.unit}),"Depth"),wet:Bt(this,Ur,"f").createParameter(e.wet,A.DefaultDecibel,_.decible,"Wet"),dry:Bt(this,Ur,"f").createParameter(e.dry,A.DefaultDecibel,_.decible,"Dry")}};var lN=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ld=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},c_,Ea,Kd=class{constructor(e,t){c_.set(this,void 0),Ea.set(this,void 0),lN(this,c_,e,"f"),lN(this,Ea,t,"f")}get box(){return Ld(this,Ea,"f")}get uuid(){return Ld(this,Ea,"f").address.uuid}get address(){return Ld(this,Ea,"f").address}get labelField(){return Ld(this,Ea,"f").label}get modelField(){return Ld(this,Ea,"f").model}getModelJson(){return Ld(this,Ea,"f").model.getValue()}terminate(){}};c_=new WeakMap,Ea=new WeakMap;var u_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Lt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},d_,Wd,Nr,dc,cN,Zd=class{constructor(e,t){d_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.NeuralAmp,Wd.set(this,void 0),Nr.set(this,void 0),dc.set(this,void 0),u_(this,Wd,e,"f"),u_(this,Nr,t,"f"),u_(this,dc,new we(Lt(this,Wd,"f")),"f"),this.namedParameter=Lt(this,d_,"m",cN).call(this,t)}get box(){return Lt(this,Nr,"f")}get uuid(){return Lt(this,Nr,"f").address.uuid}get address(){return Lt(this,Nr,"f").address}get indexField(){return Lt(this,Nr,"f").index}get labelField(){return Lt(this,Nr,"f").label}get enabledField(){return Lt(this,Nr,"f").enabled}get minimizedField(){return Lt(this,Nr,"f").minimized}get host(){return Lt(this,Nr,"f").host}get modelField(){return Lt(this,Nr,"f").model}get monoField(){return Lt(this,Nr,"f").mono}get spectrum(){return Lt(this,Nr,"f").address.append(4095)}getModelAdapter(){let e=Lt(this,Nr,"f").model.targetVertex;return e.isEmpty()?m.None:m.wrap(Lt(this,Wd,"f").boxAdapters.adapterFor(e.unwrap().box,Kd))}getModelJson(){let e=this.getModelAdapter();return e.nonEmpty()?e.unwrap().getModelJson():Lt(this,Nr,"f").modelJson.getValue()}deviceHost(){return Lt(this,Wd,"f").boxAdapters.adapterFor(Lt(this,Nr,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Lt(this,dc,"f").terminate()}};Wd=new WeakMap,Nr=new WeakMap,dc=new WeakMap,d_=new WeakSet,cN=function(e){return{inputGain:Lt(this,dc,"f").createParameter(e.inputGain,A.decibel(-72,0,12),_.numeric({unit:"dB",fractionDigits:1}),"input"),outputGain:Lt(this,dc,"f").createParameter(e.outputGain,A.decibel(-72,0,12),_.numeric({unit:"dB",fractionDigits:1}),"output"),mix:Lt(this,dc,"f").createParameter(e.mix,A.linear(0,1),_.percent(),"Mix")}};var vx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},oe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},p_,ue,Wo,tm,yx,uN,xx=class{constructor(e){p_.add(this),ue.set(this,void 0),Wo.set(this,void 0),tm.set(this,void 0),yx.set(this,void 0),vx(this,ue,e,"f"),vx(this,Wo,b.newSet(t=>t.uuid),"f"),vx(this,tm,new Set,"f"),vx(this,yx,oe(this,ue,"f").boxGraph.subscribeToAllUpdates({onUpdate:t=>{if(t.type==="delete"){let n=oe(this,Wo,"f").getOrNull(t.uuid);q(n)&&(oe(this,tm,"f").add(n.box),oe(this,Wo,"f").removeByValue(n).terminate())}}}),"f")}terminate(){oe(this,Wo,"f").values().forEach(e=>e.terminate()),oe(this,Wo,"f").clear(),oe(this,yx,"f").terminate()}adapterFor(e,t){if(oe(this,tm,"f").has(e))return D(`Cannot resolve adapter for already deleted box: ${e}`);let n=oe(this,Wo,"f").getOrNull(e.address.uuid);if(n===null){n=oe(this,p_,"m",uN).call(this,e);let i=oe(this,Wo,"f").add(n);V(i,`Could not add adapter for ${e}`)}return typeof t=="function"?Object.hasOwn(t,"prototype")?n instanceof t?n:D(`${n} is not instance of ${t}`):t(n)?n:D(`${n} did not pass custom type guard`):D("Unknown checkType method")}optAdapter(e){return oe(this,Wo,"f").opt(e.address.uuid)}};ue=new WeakMap,Wo=new WeakMap,tm=new WeakMap,yx=new WeakMap,p_=new WeakSet,uN=function(e){return he(e.accept({visitArpeggioDeviceBox:t=>new Hn(oe(this,ue,"f"),t),visitAudioBusBox:t=>new Hr(oe(this,ue,"f"),t),visitAudioClipBox:t=>new is(oe(this,ue,"f"),t),visitAudioFileBox:t=>new On(oe(this,ue,"f"),t),visitAudioTimeStretchBox:t=>new Fo(oe(this,ue,"f"),t),visitAudioPitchStretchBox:t=>new Eo(oe(this,ue,"f"),t),visitTransientMarkerBox:t=>new fu(t),visitWarpMarkerBox:t=>new rs(oe(this,ue,"f"),t),visitAudioRegionBox:t=>new ha(oe(this,ue,"f"),t),visitAudioUnitBox:t=>new nn(oe(this,ue,"f"),t),visitAuxSendBox:t=>new Ku(oe(this,ue,"f"),t),visitMaximizerDeviceBox:t=>new Md(oe(this,ue,"f"),t),visitCompressorDeviceBox:t=>new kd(oe(this,ue,"f"),t),visitGateDeviceBox:t=>new $d(oe(this,ue,"f"),t),visitCrusherDeviceBox:t=>new Td(oe(this,ue,"f"),t),visitDattorroReverbDeviceBox:t=>new jd(oe(this,ue,"f"),t),visitDelayDeviceBox:t=>new tr(oe(this,ue,"f"),t),visitDeviceInterfaceKnobBox:t=>new od(oe(this,ue,"f"),t),visitTidalDeviceBox:t=>new ro(oe(this,ue,"f"),t),visitFoldDeviceBox:t=>new Cd(oe(this,ue,"f"),t),visitGrooveShuffleBox:t=>new Co(oe(this,ue,"f"),t),visitMarkerBox:t=>new ps(oe(this,ue,"f"),t),visitSignatureEventBox:t=>new ql(oe(this,ue,"f"),t),visitMIDIOutputDeviceBox:t=>new zd(oe(this,ue,"f"),t),visitModularAudioInputBox:t=>new id(oe(this,ue,"f"),t),visitModularAudioOutputBox:t=>new ed(oe(this,ue,"f"),t),visitModularBox:t=>new gs(oe(this,ue,"f"),t),visitModularDeviceBox:t=>new ys(oe(this,ue,"f"),t),visitModuleConnectionBox:t=>new ms(oe(this,ue,"f"),t),visitModuleDelayBox:t=>new Xu(oe(this,ue,"f"),t),visitModuleGainBox:t=>new td(oe(this,ue,"f"),t),visitModuleMultiplierBox:t=>new rd(oe(this,ue,"f"),t),visitNanoDeviceBox:t=>new xd(oe(this,ue,"f"),t),visitNeuralAmpDeviceBox:t=>new Zd(oe(this,ue,"f"),t),visitNeuralAmpModelBox:t=>new Kd(oe(this,ue,"f"),t),visitNoteClipBox:t=>new Su(oe(this,ue,"f"),t),visitNoteEventBox:t=>new Sl(oe(this,ue,"f"),t),visitNoteEventCollectionBox:t=>new Yi(oe(this,ue,"f"),t),visitNoteRegionBox:t=>new ss(oe(this,ue,"f"),t),visitPitchDeviceBox:t=>new vd(oe(this,ue,"f"),t),visitPlayfieldDeviceBox:t=>new Ps(oe(this,ue,"f"),t),visitPlayfieldSampleBox:t=>new bd(oe(this,ue,"f"),t),visitRevampDeviceBox:t=>new Qu(oe(this,ue,"f"),t),visitReverbDeviceBox:t=>new Ju(oe(this,ue,"f"),t),visitRootBox:t=>new fd(oe(this,ue,"f"),t),visitSoundfontDeviceBox:t=>new Dd(oe(this,ue,"f"),t),visitSoundfontFileBox:t=>new fx(oe(this,ue,"f"),t),visitStereoToolDeviceBox:t=>new Pd(oe(this,ue,"f"),t),visitTapeDeviceBox:t=>new md(oe(this,ue,"f"),t),visitTimelineBox:t=>new ln(oe(this,ue,"f"),t),visitTrackBox:t=>new Vt(oe(this,ue,"f"),t),visitUnknownAudioEffectDeviceBox:t=>new Fd(oe(this,ue,"f"),t),visitUnknownMidiEffectDeviceBox:t=>new Bd(oe(this,ue,"f"),t),visitValueClipBox:t=>new ts(oe(this,ue,"f"),t),visitValueEventBox:t=>new ca(oe(this,ue,"f"),t),visitValueEventCollectionBox:t=>new _r(oe(this,ue,"f"),t),visitValueRegionBox:t=>new va(oe(this,ue,"f"),t),visitVaporisateurDeviceBox:t=>new gd(oe(this,ue,"f"),t),visitVelocityDeviceBox:t=>new Ud(oe(this,ue,"f"),t),visitZeitgeistDeviceBox:t=>new Ed(oe(this,ue,"f"),t)}),`Could not find factory for ${e}`)};var Gd;(function(r){r.PEAKS=Me.compose(b.Lowest).append(0),r.SPECTRUM=Me.compose(b.Lowest).append(1),r.WAVEFORM=Me.compose(b.Lowest).append(2)})(Gd||(Gd={}));var dN;(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,n=i=>{let o=t.get(i)??0,a=i;for(;t.has(a);)o++,a=`${i} ${o}`;return t.set(i,o),t.set(a,1),a};Object.keys(e).forEach(i=>{let o=e[i];o.fileName=n(r.sanitizeFileName(o.fileName))})}})(dN||(dN={}));var wx=512,pN=xr.createBuilder({position:xr.float,bpm:xr.float,playbackTimestamp:xr.float,countInBeatsRemaining:xr.float,isPlaying:xr.bool,isCountingIn:xr.bool,isRecording:xr.bool,perfIndex:xr.int32,perfBuffer:xr.floats(wx)});var hN;(function(r){r.store=(e,t,n)=>{if(n==="")return D("MetaData.store: origin must be unique to your app.");let i=e.pointerHub.filter(c.MetaData).map(({box:a})=>a).find(a=>a instanceof Dn&&a.origin.getValue()===n),o=a=>{a.target.refer(e),a.origin.setValue(n),a.value.setValue(JSON.stringify(t))};Zs(i)?o(i):Dn.create(e.graph,b.generate(),o)},r.read=(e,t)=>{if(t==="")return D("MetaData.read: origin must be unique to your app.");let n=e.pointerHub.filter(c.MetaData).map(({box:i})=>i).find(i=>i instanceof Dn&&i.origin.getValue()===t);if(Zs(n)){let{status:i,value:o,error:a}=ho(()=>JSON.parse(n.value.getValue()));if(i==="success")return o;console.warn(a)}return null},r.clear=(e,t)=>{if(t==="")return D("MetaData.clear: origin must be unique to your app.");e.pointerHub.filter(c.MetaData).map(({box:n})=>n).filter(n=>n instanceof Dn&&n.origin.getValue()===t).forEach(n=>n.delete())},r.catchupAndSubscribeMessage=(e,t,n)=>{if(t==="")return D("MetaData.catchupAndSubscribeMessage: origin must be unique to your app.");let i=b.newSet(s=>s.uuid),o=s=>{let{status:l,value:u,error:p}=ho(()=>JSON.parse(s.value.getValue()));l==="success"?n(m.wrap(u)):(console.warn(p),n(m.None))},a=e.pointerHub.catchupAndSubscribe({onAdded:({box:s})=>{if(!(s instanceof Dn)||s.origin.getValue()!==t)return;let l=s.value.catchupAndSubscribe(()=>o(s));i.add({uuid:s.address.uuid,subscription:l})},onRemoved:({box:s})=>{if(!(s instanceof Dn)||s.origin.getValue()!==t)return;i.removeByKey(s.address.uuid).subscription.terminate(),n(m.None)}},c.MetaData);return{terminate:()=>{a.terminate(),i.forEach(({subscription:s})=>s.terminate()),i.clear()}}}})(hN||(hN={}));var h_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Fs=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},bx,Ax,_x,pc,Pn=class{constructor(e,t){bx.set(this,new j),Ax.set(this,void 0),_x.set(this,void 0),pc.set(this,void 0),h_(this,Ax,e,"f"),h_(this,_x,t,"f"),h_(this,pc,new St(128),"f"),Fs(this,bx,"f").own(Fs(this,Ax,"f").broadcastIntegers(Fs(this,_x,"f"),new Int32Array(Fs(this,pc,"f").buffer),n=>{}))}noteOn(e){e>=0&&e<128&&Fs(this,pc,"f").setBit(e,!0)}noteOff(e){e>=0&&e<128&&Fs(this,pc,"f").setBit(e,!1)}reset(){}clear(){Fs(this,pc,"f").clear()}terminate(){Fs(this,bx,"f").terminate()}toString(){return`{${this.constructor.name}}`}};bx=new WeakMap,Ax=new WeakMap,_x=new WeakMap,pc=new WeakMap;var Nt;(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 n=r.readParam1(t)&127,i=r.readParam2(t)&127,o=n|i<<7;return 8192>=o?o/8192-1:(o-8191)/8192},r.asValue=t=>{let n=r.readParam2(t);return n>64?.5+(n-63)/128:n<64?n/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,n,i)=>new Uint8Array([e.NoteOn|t,n,i]),r.noteOff=(t,n)=>new Uint8Array([e.NoteOff|t,n,0]),r.control=(t,n,i)=>new Uint8Array([e.Controller|t,n&127,i&127]),r.position=(t,n)=>new Uint8Array([e.Position,t&127,n&127]),r.positionInPPQN=t=>{let n=Math.floor(t/96),i=n&127,o=n>>7&127;return new Uint8Array([e.Position,i,o])},r.accept=(t,n)=>{uo(t)||(r.isNoteOn(t)?P(n.noteOn,r.readPitch(t),r.readVelocity(t)):r.isNoteOff(t)?P(n.noteOff,r.readPitch(t)):r.isPitchWheel(t)?P(n.pitchBend,r.asPitchBend(t)):r.isController(t)?P(n.controller,r.readParam1(t),r.readParam2(t)/127):r.isClock(t)?P(n.clock):r.isStart(t)?P(n.start):r.isContinue(t)?P(n.continue):r.isStop(t)?P(n.stop):r.isPosition(t)&&P(n.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"})(Nt||(Nt={}));var Fa;(function(r){r.on=(e,t,n)=>({type:"note-on",uuid:e,pitch:t,velocity:n}),r.off=(e,t)=>({type:"note-off",uuid:e,pitch:t}),r.audition=(e,t,n,i)=>({type:"note-audition",uuid:e,pitch:t,duration:n,velocity:i}),r.isOn=e=>e.type==="note-on",r.isOff=e=>e.type==="note-off",r.isAudition=e=>e.type==="note-audition",r.fromEvent=(e,t)=>{let n=e.data;if(Nt.isNoteOn(n)){let i=Nt.readPitch(n),o=Nt.readVelocity(n);return{type:"note-on",uuid:t,pitch:i,velocity:o}}else if(Nt.isNoteOff(n)){let i=Nt.readPitch(n);return{type:"note-off",uuid:t,pitch:i}}return D("Unknown MIDI event")}})(Fa||(Fa={}));var fN;(function(r){r.start=(e,t,n,i=1)=>{let o=!0;return e(Fa.on(t,n,i)),{terminate:()=>{o&&(e(Fa.off(t,n)),o=!1)}}}})(fN||(fN={}));var Ik,Dk,Mk,kk,$k;Ik=new WeakMap,Dk=new WeakMap,Mk=new WeakMap,kk=new WeakMap,$k=new WeakMap;var mN=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},qd=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hc,rm,Px=class{constructor(){hc.set(this,void 0),rm.set(this,void 0),mN(this,hc,Me.newSet(e=>e.field.address),"f"),mN(this,rm,new ce,"f")}register(e){return qd(this,hc,"f").add(e),{terminate:()=>qd(this,hc,"f").removeByValue(e)}}get(e){return qd(this,hc,"f").get(e)}opt(e){return qd(this,hc,"f").opt(e)}subscribeWrites(e){return qd(this,rm,"f").subscribe(e)}notifyWrite(e,t){qd(this,rm,"f").notify({adapter:e,previousUnitValue:t})}};hc=new WeakMap,rm=new WeakMap;var io={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})??D("Could not cast to AnyRegionBox"),isLoopableRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1};var im={min:30,max:1e3};var Sx;(function(r){r.isTimeSignatureValid=(e,t)=>!Number.isInteger(e)||e<1||e>31?fo.err("Numerator needs to be a interger between 1 and 31"):!Number.isInteger(t)||t<1||t>32||t&t-1?fo.err("Denominator must be a power of two between 1 and 32"):fo.ok([e,t]),r.clampBpm=e=>Number.isFinite(e)?be(e,im.min,im.max):120,r.hasOverlappingRegions=e=>e.boxes().some(t=>t.accept({visitTrackBox:n=>{for(let[i,o]of U.iterateAdjacent(n.regions.pointerHub.incoming().map(({box:a})=>io.asRegionBox(a)).sort(({position:a},{position:s})=>a.getValue()-s.getValue()))){if(i instanceof ja&&i.timeBase.getValue()===Wr.Seconds)return!1;if(i.position.getValue()+i.duration.getValue()>o.position.getValue())return!0}return!1}})??!1)})(Sx||(Sx={}));var gN;(function(r){r.parseTimeSignature=e=>{let[t,n]=e.split("/"),i=parseInt(t,10),o=parseInt(n,10);return Sx.isTimeSignatureValid(i,o)}})(gN||(gN={}));var Ex;(function(r){r.reader=({sab:e,numChunks:t,numberOfChannels:n,bufferSize:i},o)=>{let a=!0,s=new Int32Array(e,0,2),l=new Float32Array(e,8),u=new Float32Array(n*i),p=typeof document>"u",d=()=>{if(!a)return;let h=Atomics.load(s,1),g=Atomics.load(s,0);if(h===g){if(p)Atomics.wait(s,0,g);else{setTimeout(d,1);return}g=Atomics.load(s,0)}for(;h!==g;){let v=h*n*i;u.set(l.subarray(v,v+n*i));let y=[];for(let x=0;x<n;x++){let B=x*i,I=B+i;y.push(u.slice(B,I))}if(h=(h+1)%t,Atomics.store(s,1,h),!a)return;o(y)}d()};return d(),{stop:()=>a=!1}},r.writer=({sab:e,numChunks:t,numberOfChannels:n,bufferSize:i})=>{let o=new Int32Array(e,0,2),a=new Float32Array(e,8);return Object.freeze({write:s=>{if(s.length!==n)return;for(let p of s)if(p.length!==i)return D("Each channel buffer must contain 'bufferSize' samples");let l=Atomics.load(o,0),u=l*n*i;s.forEach((p,d)=>a.set(p,u+d*i)),Atomics.store(o,0,(l+1)%t),Atomics.notify(o,0)}})}})(Ex||(Ex={}));var f_={isRegion:r=>io.isRegionBox(r.box),isLoopableRegion:r=>io.isLoopableRegionBox(r.box)};var Tk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ye=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},no,Fx,ji,Bs,Ns,m_,nm,Bx,Nx=class{constructor(e){no.add(this),Fx.set(this,new j),ji.set(this,void 0),Bs.set(this,[]),Ns.set(this,[]),Tk(this,ji,e,"f"),Ye(this,Fx,"f").ownAll(e.box.bpm.subscribe(()=>Ye(this,no,"m",m_).call(this)),e.catchupAndSubscribeTempoAutomation(()=>Ye(this,no,"m",m_).call(this)))}terminate(){Ye(this,Fx,"f").terminate()}getTempoAt(e){let t=Ye(this,ji,"f").box.bpm.getValue();return Ye(this,ji,"f").tempoTrackEvents.mapOr(n=>n.valueAt(e,t),t)}ppqnToSeconds(e){return e<0?-Ye(this,no,"m",nm).call(this,-e):Ye(this,no,"m",nm).call(this,e)}secondsToPPQN(e){return Ye(this,no,"m",Bx).call(this,e)}intervalToSeconds(e,t){return e>=t?0:Ye(this,no,"m",nm).call(this,t)-Ye(this,no,"m",nm).call(this,e)}intervalToPPQN(e,t){if(e>=t)return 0;let n=Ye(this,no,"m",Bx).call(this,e);return Ye(this,no,"m",Bx).call(this,t)-n}subscribe(e){let t=new j;return t.ownAll(Ye(this,ji,"f").box.bpm.subscribe(()=>e(this)),Ye(this,ji,"f").catchupAndSubscribeTempoAutomation(()=>e(this))),t}};Fx=new WeakMap,ji=new WeakMap,Bs=new WeakMap,Ns=new WeakMap,no=new WeakSet,m_=function(){Ye(this,Bs,"f").length=0,Ye(this,Ns,"f").length=0;let e=Ye(this,ji,"f").tempoTrackEvents;if(e.isEmpty())return;let t=e.unwrap();if(t.events.isEmpty())return;let n=t.events.asArray(),i=Ye(this,ji,"f").box.bpm.getValue(),o=[{ppqn:0,seconds:0,bpm:t.valueAt(0,i)}],a=0,s=0;for(let u of n){let p=u.position;if(!(p<=s)){for(;s<p;){let d=t.valueAt(s,i),h=Dc(s,na),g=h<=s?h+na:h,v=Math.min(g,p);a+=J.pulsesToSeconds(v-s,d),s=v}o.push({ppqn:p,seconds:a,bpm:t.valueAt(p,i)})}}Ye(this,Bs,"f").push(...o);let l=o.slice().sort((u,p)=>u.seconds-p.seconds);Ye(this,Ns,"f").push(...l)},nm=function(e){if(e<=0)return 0;let t=Ye(this,ji,"f").box.bpm.getValue(),n=Ye(this,ji,"f").tempoTrackEvents;if(n.isEmpty())return J.pulsesToSeconds(e,t);let i=n.unwrap();if(i.events.isEmpty())return J.pulsesToSeconds(e,t);let o=0,a=0;if(Ye(this,Bs,"f").length>0){let u=ct.rightMostMapped(Ye(this,Bs,"f"),e,$a,p=>p.ppqn);if(u>=0){let p=Ye(this,Bs,"f")[u];if(o=p.ppqn,a=p.seconds,u===Ye(this,Bs,"f").length-1)return a+J.pulsesToSeconds(e-o,p.bpm)}}let s=a,l=o;for(;l<e;){let u=i.valueAt(l,t),p=Dc(l,na),d=p<=l?p+na:p,h=Math.min(d,e);s+=J.pulsesToSeconds(h-l,u),l=h}return s},Bx=function(e){if(e<=0)return 0;let t=Ye(this,ji,"f").box.bpm.getValue(),n=Ye(this,ji,"f").tempoTrackEvents;if(n.isEmpty())return J.secondsToPulses(e,t);let i=n.unwrap();if(i.events.isEmpty())return J.secondsToPulses(e,t);let o=0,a=0;if(Ye(this,Ns,"f").length>0){let u=ct.rightMostMapped(Ye(this,Ns,"f"),e,$a,p=>p.seconds);if(u>=0){let p=Ye(this,Ns,"f")[u];if(o=p.ppqn,a=p.seconds,u===Ye(this,Ns,"f").length-1)return o+J.secondsToPulses(e-a,p.bpm)}}let s=a,l=o;for(;s<e;){let u=i.valueAt(l,t),p=Dc(l,na),d=p<=l?p+na:p,h=d-l,g=J.pulsesToSeconds(h,u);if(s+g>=e){let v=e-s;l+=J.secondsToPulses(v,u);break}s+=g,l=d}return l};var Zo;(function(r){r[r.Off=0]="Off",r[r.On=1]="On",r[r.Loop=2]="Loop"})(Zo||(Zo={}));var Rk,Ck,Ok,Vk;Rk=new WeakMap,Ck=new WeakMap,Ok=new WeakMap,Vk=new WeakMap;var zk,Uk,jk,Lk;zk=new WeakMap,Uk=new WeakMap,jk=new WeakMap,Lk=new WeakMap;var Le={};Xo(Le,{$brand:()=>Ix,$input:()=>T1,$output:()=>$1,NEVER:()=>g_,TimePrecision:()=>V1,ZodAny:()=>BE,ZodArray:()=>ME,ZodBase64:()=>ib,ZodBase64URL:()=>nb,ZodBigInt:()=>Pp,ZodBigIntFormat:()=>sb,ZodBoolean:()=>_p,ZodCIDRv4:()=>tb,ZodCIDRv6:()=>rb,ZodCUID:()=>qw,ZodCUID2:()=>Hw,ZodCatch:()=>eF,ZodCodec:()=>mb,ZodCustom:()=>Rm,ZodCustomStringFormat:()=>bp,ZodDate:()=>Dm,ZodDefault:()=>qE,ZodDiscriminatedUnion:()=>$E,ZodE164:()=>ob,ZodEmail:()=>Ww,ZodEmoji:()=>Zw,ZodEnum:()=>xp,ZodError:()=>vR,ZodExactOptional:()=>WE,ZodFile:()=>LE,ZodFirstPartyTypeKind:()=>pF,ZodFunction:()=>cF,ZodGUID:()=>Em,ZodIPv4:()=>Xw,ZodIPv6:()=>eb,ZodISODate:()=>Vw,ZodISODateTime:()=>Ow,ZodISODuration:()=>Uw,ZodISOTime:()=>zw,ZodIntersection:()=>TE,ZodIssueCode:()=>xR,ZodJWT:()=>ab,ZodKSUID:()=>Yw,ZodLazy:()=>aF,ZodLiteral:()=>jE,ZodMAC:()=>bE,ZodMap:()=>zE,ZodNaN:()=>rF,ZodNanoID:()=>Gw,ZodNever:()=>IE,ZodNonOptional:()=>hb,ZodNull:()=>EE,ZodNullable:()=>GE,ZodNumber:()=>Ap,ZodNumberFormat:()=>bc,ZodObject:()=>km,ZodOptional:()=>pb,ZodPipe:()=>fb,ZodPrefault:()=>JE,ZodPromise:()=>lF,ZodReadonly:()=>iF,ZodRealError:()=>bi,ZodRecord:()=>Tm,ZodSet:()=>UE,ZodString:()=>wp,ZodStringFormat:()=>mt,ZodSuccess:()=>XE,ZodSymbol:()=>PE,ZodTemplateLiteral:()=>oF,ZodTransform:()=>KE,ZodTuple:()=>CE,ZodType:()=>Oe,ZodULID:()=>Jw,ZodURL:()=>Im,ZodUUID:()=>Jo,ZodUndefined:()=>SE,ZodUnion:()=>$m,ZodUnknown:()=>NE,ZodVoid:()=>DE,ZodXID:()=>Qw,ZodXor:()=>kE,_ZodString:()=>Kw,_default:()=>HE,_function:()=>HD,any:()=>FD,array:()=>Mm,base64:()=>uD,base64url:()=>dD,bigint:()=>AD,boolean:()=>_E,catch:()=>tF,check:()=>JD,cidrv4:()=>lD,cidrv6:()=>cD,clone:()=>ei,codec:()=>ZD,coerce:()=>hF,config:()=>Kt,core:()=>Ia,cuid:()=>eD,cuid2:()=>tD,custom:()=>QD,date:()=>ND,decode:()=>fE,decodeAsync:()=>gE,describe:()=>YD,discriminatedUnion:()=>TD,e164:()=>pD,email:()=>KI,emoji:()=>YI,encode:()=>hE,encodeAsync:()=>mE,endsWith:()=>cp,enum:()=>ub,exactOptional:()=>ZE,file:()=>jD,flattenError:()=>hm,float32:()=>yD,float64:()=>xD,formatError:()=>fm,fromJSONSchema:()=>oM,function:()=>HD,getErrorMap:()=>bR,globalRegistry:()=>Ir,gt:()=>qo,gte:()=>ti,guid:()=>WI,hash:()=>vD,hex:()=>gD,hostname:()=>mD,httpUrl:()=>QI,includes:()=>sp,instanceof:()=>eM,int:()=>Lw,int32:()=>wD,int64:()=>_D,intersection:()=>RE,ipv4:()=>oD,ipv6:()=>sD,iso:()=>yp,json:()=>rM,jwt:()=>hD,keyof:()=>ID,ksuid:()=>nD,lazy:()=>sF,length:()=>xc,literal:()=>UD,locales:()=>Am,looseObject:()=>kD,looseRecord:()=>CD,lowercase:()=>op,lt:()=>Go,lte:()=>Ki,mac:()=>aD,map:()=>OD,maxLength:()=>yc,maxSize:()=>Rs,meta:()=>XD,mime:()=>up,minLength:()=>Na,minSize:()=>Ho,multipleOf:()=>Ts,nan:()=>WD,nanoid:()=>XI,nativeEnum:()=>zD,negative:()=>Bw,never:()=>lb,nonnegative:()=>Iw,nonoptional:()=>YE,nonpositive:()=>Nw,normalize:()=>dp,null:()=>FE,nullable:()=>Bm,nullish:()=>LD,number:()=>AE,object:()=>DD,optional:()=>Fm,overwrite:()=>ao,parse:()=>cE,parseAsync:()=>uE,partialRecord:()=>RD,pipe:()=>Nm,positive:()=>Fw,prefault:()=>QE,preprocess:()=>iM,prettifyError:()=>B_,promise:()=>qD,property:()=>Dw,readonly:()=>nF,record:()=>VE,refine:()=>uF,regex:()=>np,regexes:()=>En,registry:()=>aw,safeDecode:()=>yE,safeDecodeAsync:()=>wE,safeEncode:()=>vE,safeEncodeAsync:()=>xE,safeParse:()=>dE,safeParseAsync:()=>pE,set:()=>VD,setErrorMap:()=>wR,size:()=>vc,slugify:()=>mp,startsWith:()=>lp,strictObject:()=>MD,string:()=>jw,stringFormat:()=>fD,stringbool:()=>tM,success:()=>KD,superRefine:()=>dF,symbol:()=>SD,templateLiteral:()=>GD,toJSONSchema:()=>Tw,toLowerCase:()=>hp,toUpperCase:()=>fp,transform:()=>db,treeifyError:()=>F_,trim:()=>pp,tuple:()=>OE,uint32:()=>bD,uint64:()=>PD,ulid:()=>rD,undefined:()=>ED,union:()=>cb,unknown:()=>wc,uppercase:()=>ap,url:()=>JI,util:()=>G,uuid:()=>ZI,uuidv4:()=>GI,uuidv6:()=>qI,uuidv7:()=>HI,void:()=>BD,xid:()=>iD,xor:()=>$D});var Ia={};Xo(Ia,{$ZodAny:()=>r1,$ZodArray:()=>s1,$ZodAsyncError:()=>oo,$ZodBase64:()=>ZP,$ZodBase64URL:()=>GP,$ZodBigInt:()=>Xx,$ZodBigIntFormat:()=>YP,$ZodBoolean:()=>ym,$ZodCIDRv4:()=>LP,$ZodCIDRv6:()=>KP,$ZodCUID:()=>DP,$ZodCUID2:()=>MP,$ZodCatch:()=>S1,$ZodCheck:()=>xt,$ZodCheckBigIntFormat:()=>sP,$ZodCheckEndsWith:()=>xP,$ZodCheckGreaterThan:()=>Zx,$ZodCheckIncludes:()=>vP,$ZodCheckLengthEquals:()=>hP,$ZodCheckLessThan:()=>Wx,$ZodCheckLowerCase:()=>mP,$ZodCheckMaxLength:()=>dP,$ZodCheckMaxSize:()=>lP,$ZodCheckMimeType:()=>bP,$ZodCheckMinLength:()=>pP,$ZodCheckMinSize:()=>cP,$ZodCheckMultipleOf:()=>oP,$ZodCheckNumberFormat:()=>aP,$ZodCheckOverwrite:()=>AP,$ZodCheckProperty:()=>wP,$ZodCheckRegex:()=>fP,$ZodCheckSizeEquals:()=>uP,$ZodCheckStartsWith:()=>yP,$ZodCheckStringFormat:()=>rp,$ZodCheckUpperCase:()=>gP,$ZodCodec:()=>wm,$ZodCustom:()=>k1,$ZodCustomStringFormat:()=>JP,$ZodDate:()=>a1,$ZodDefault:()=>b1,$ZodDiscriminatedUnion:()=>u1,$ZodE164:()=>qP,$ZodEmail:()=>FP,$ZodEmoji:()=>NP,$ZodEncodeError:()=>Is,$ZodEnum:()=>m1,$ZodError:()=>pm,$ZodExactOptional:()=>x1,$ZodFile:()=>v1,$ZodFunction:()=>I1,$ZodGUID:()=>SP,$ZodIPv4:()=>zP,$ZodIPv6:()=>UP,$ZodISODate:()=>CP,$ZodISODateTime:()=>RP,$ZodISODuration:()=>VP,$ZodISOTime:()=>OP,$ZodIntersection:()=>d1,$ZodJWT:()=>HP,$ZodKSUID:()=>TP,$ZodLazy:()=>M1,$ZodLiteral:()=>g1,$ZodMAC:()=>jP,$ZodMap:()=>h1,$ZodNaN:()=>E1,$ZodNanoID:()=>IP,$ZodNever:()=>n1,$ZodNonOptional:()=>_1,$ZodNull:()=>t1,$ZodNullable:()=>w1,$ZodNumber:()=>Yx,$ZodNumberFormat:()=>QP,$ZodObject:()=>LN,$ZodObjectJIT:()=>l1,$ZodOptional:()=>tw,$ZodPipe:()=>F1,$ZodPrefault:()=>A1,$ZodPromise:()=>D1,$ZodReadonly:()=>B1,$ZodRealError:()=>wi,$ZodRecord:()=>p1,$ZodRegistry:()=>ow,$ZodSet:()=>f1,$ZodString:()=>gc,$ZodStringFormat:()=>ft,$ZodSuccess:()=>P1,$ZodSymbol:()=>XP,$ZodTemplateLiteral:()=>N1,$ZodTransform:()=>y1,$ZodTuple:()=>ew,$ZodType:()=>De,$ZodULID:()=>kP,$ZodURL:()=>BP,$ZodUUID:()=>EP,$ZodUndefined:()=>e1,$ZodUnion:()=>xm,$ZodUnknown:()=>i1,$ZodVoid:()=>o1,$ZodXID:()=>$P,$ZodXor:()=>c1,$brand:()=>Ix,$constructor:()=>S,$input:()=>T1,$output:()=>$1,Doc:()=>vm,JSONSchema:()=>jI,JSONSchemaGenerator:()=>Rw,NEVER:()=>g_,TimePrecision:()=>V1,_any:()=>aS,_array:()=>hS,_base64:()=>_w,_base64url:()=>Pw,_bigint:()=>X1,_boolean:()=>Q1,_catch:()=>cR,_check:()=>UI,_cidrv4:()=>bw,_cidrv6:()=>Aw,_coercedBigint:()=>eS,_coercedBoolean:()=>Y1,_coercedDate:()=>dS,_coercedNumber:()=>W1,_coercedString:()=>C1,_cuid:()=>fw,_cuid2:()=>mw,_custom:()=>mS,_date:()=>uS,_decode:()=>Rx,_decodeAsync:()=>Ox,_default:()=>aR,_discriminatedUnion:()=>qT,_e164:()=>Sw,_email:()=>sw,_emoji:()=>pw,_encode:()=>Tx,_encodeAsync:()=>Cx,_endsWith:()=>cp,_enum:()=>eR,_file:()=>fS,_float32:()=>G1,_float64:()=>q1,_gt:()=>qo,_gte:()=>ti,_guid:()=>_m,_includes:()=>sp,_int:()=>Z1,_int32:()=>H1,_int64:()=>tS,_intersection:()=>HT,_ipv4:()=>xw,_ipv6:()=>ww,_isoDate:()=>U1,_isoDateTime:()=>z1,_isoDuration:()=>L1,_isoTime:()=>j1,_jwt:()=>Ew,_ksuid:()=>yw,_lazy:()=>hR,_length:()=>xc,_literal:()=>rR,_lowercase:()=>op,_lt:()=>Go,_lte:()=>Ki,_mac:()=>O1,_map:()=>YT,_max:()=>Ki,_maxLength:()=>yc,_maxSize:()=>Rs,_mime:()=>up,_min:()=>ti,_minLength:()=>Na,_minSize:()=>Ho,_multipleOf:()=>Ts,_nan:()=>pS,_nanoid:()=>hw,_nativeEnum:()=>tR,_negative:()=>Bw,_never:()=>lS,_nonnegative:()=>Iw,_nonoptional:()=>sR,_nonpositive:()=>Nw,_normalize:()=>dp,_null:()=>oS,_nullable:()=>oR,_number:()=>K1,_optional:()=>nR,_overwrite:()=>ao,_parse:()=>Yd,_parseAsync:()=>Xd,_pipe:()=>uR,_positive:()=>Fw,_promise:()=>fR,_property:()=>Dw,_readonly:()=>dR,_record:()=>QT,_refine:()=>gS,_regex:()=>np,_safeDecode:()=>zx,_safeDecodeAsync:()=>jx,_safeEncode:()=>Vx,_safeEncodeAsync:()=>Ux,_safeParse:()=>ep,_safeParseAsync:()=>tp,_set:()=>XT,_size:()=>vc,_slugify:()=>mp,_startsWith:()=>lp,_string:()=>R1,_stringFormat:()=>gp,_stringbool:()=>wS,_success:()=>lR,_superRefine:()=>vS,_symbol:()=>iS,_templateLiteral:()=>pR,_toLowerCase:()=>hp,_toUpperCase:()=>fp,_transform:()=>iR,_trim:()=>pp,_tuple:()=>JT,_uint32:()=>J1,_uint64:()=>rS,_ulid:()=>gw,_undefined:()=>nS,_union:()=>ZT,_unknown:()=>sS,_uppercase:()=>ap,_url:()=>Pm,_uuid:()=>lw,_uuidv4:()=>cw,_uuidv6:()=>uw,_uuidv7:()=>dw,_void:()=>cS,_xid:()=>vw,_xor:()=>GT,clone:()=>ei,config:()=>Kt,createStandardJSONSchemaMethod:()=>vp,createToJSONSchemaMethod:()=>bS,decode:()=>v$,decodeAsync:()=>x$,describe:()=>yS,encode:()=>g$,encodeAsync:()=>y$,extractDefs:()=>Os,finalize:()=>Vs,flattenError:()=>hm,formatError:()=>fm,globalConfig:()=>om,globalRegistry:()=>Ir,initializeContext:()=>Cs,isValidBase64:()=>WP,isValidBase64URL:()=>VN,isValidJWT:()=>zN,locales:()=>Am,meta:()=>xS,parse:()=>kx,parseAsync:()=>$x,prettifyError:()=>B_,process:()=>at,regexes:()=>En,registry:()=>aw,safeDecode:()=>b$,safeDecodeAsync:()=>_$,safeEncode:()=>w$,safeEncodeAsync:()=>A$,safeParse:()=>N_,safeParseAsync:()=>I_,toDotPath:()=>bN,toJSONSchema:()=>Tw,treeifyError:()=>F_,util:()=>G,version:()=>_P});var g_=Object.freeze({status:"aborted"});function S(r,e,t){function n(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 h=p[d];h in s||(s[h]=u[h].bind(s))}}let i=t?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:r});function a(s){var l;let u=t?.Parent?new o:this;n(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let p of u._zod.deferred)p();return u}return Object.defineProperty(a,"init",{value:n}),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 Ix=Symbol("zod_brand"),oo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Is=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},om={};function Kt(r){return r&&Object.assign(om,r),om}var G={};Xo(G,{BIGINT_FORMAT_RANGES:()=>E_,Class:()=>y_,NUMBER_FORMAT_RANGES:()=>S_,aborted:()=>$s,allowsEval:()=>b_,assert:()=>qk,assertEqual:()=>Kk,assertIs:()=>Zk,assertNever:()=>Gk,assertNotEqual:()=>Wk,assignProp:()=>Ms,base64ToUint8Array:()=>yN,base64urlToUint8Array:()=>d$,cached:()=>Jd,captureStackTrace:()=>Mx,cleanEnum:()=>u$,cleanRegex:()=>lm,clone:()=>ei,cloneDef:()=>Jk,createTransparentProxy:()=>r$,defineLazy:()=>je,esc:()=>Dx,escapeRegex:()=>Sn,extend:()=>o$,finalizeIssue:()=>xi,floatSafeRemainder:()=>x_,getElementAtPath:()=>Qk,getEnumValues:()=>sm,getLengthableOrigin:()=>dm,getParsedType:()=>t$,getSizableOrigin:()=>um,hexToUint8Array:()=>h$,isObject:()=>fc,isPlainObject:()=>ks,issue:()=>Qd,joinValues:()=>T,jsonStringifyReplacer:()=>Hd,merge:()=>s$,mergeDefs:()=>Ba,normalizeParams:()=>H,nullish:()=>Ds,numKeys:()=>e$,objectClone:()=>Hk,omit:()=>n$,optionalKeys:()=>P_,parsedType:()=>Z,partial:()=>l$,pick:()=>i$,prefixIssues:()=>Li,primitiveTypes:()=>__,promiseAllObject:()=>Yk,propertyKeyTypes:()=>cm,randomString:()=>Xk,required:()=>c$,safeExtend:()=>a$,shallowClone:()=>A_,slugify:()=>w_,stringifyPrimitive:()=>K,uint8ArrayToBase64:()=>xN,uint8ArrayToBase64url:()=>p$,uint8ArrayToHex:()=>f$,unwrapMessage:()=>am});function Kk(r){return r}function Wk(r){return r}function Zk(r){}function Gk(r){throw new Error("Unexpected value in exhaustive check")}function qk(r){}function sm(r){let e=Object.values(r).filter(n=>typeof n=="number");return Object.entries(r).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function T(r,e="|"){return r.map(t=>K(t)).join(e)}function Hd(r,e){return typeof e=="bigint"?e.toString():e}function Jd(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function Ds(r){return r==null}function lm(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}function x_(r,e){let t=(r.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=t>i?t:i,a=Number.parseInt(r.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var vN=Symbol("evaluating");function je(r,e,t){let n;Object.defineProperty(r,e,{get(){if(n!==vN)return n===void 0&&(n=vN,n=t()),n},set(i){Object.defineProperty(r,e,{value:i})},configurable:!0})}function Hk(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function Ms(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Ba(...r){let e={};for(let t of r){let n=Object.getOwnPropertyDescriptors(t);Object.assign(e,n)}return Object.defineProperties({},e)}function Jk(r){return Ba(r._zod.def)}function Qk(r,e){return e?e.reduce((t,n)=>t?.[n],r):r}function Yk(r){let e=Object.keys(r),t=e.map(n=>r[n]);return Promise.all(t).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function Xk(r=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let n=0;n<r;n++)t+=e[Math.floor(Math.random()*e.length)];return t}function Dx(r){return JSON.stringify(r)}function w_(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mx="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function fc(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var b_=Jd(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function ks(r){if(fc(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(fc(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function A_(r){return ks(r)?{...r}:Array.isArray(r)?[...r]:r}function e$(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}var t$=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}`)}},cm=new Set(["string","number","symbol"]),__=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Sn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(r,e,t){let n=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(n._zod.parent=r),n}function H(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 r$(r){let e;return new Proxy({},{get(t,n,i){return e??(e=r()),Reflect.get(e,n,i)},set(t,n,i,o){return e??(e=r()),Reflect.set(e,n,i,o)},has(t,n){return e??(e=r()),Reflect.has(e,n)},deleteProperty(t,n){return e??(e=r()),Reflect.deleteProperty(e,n)},ownKeys(t){return e??(e=r()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(t,n){return e??(e=r()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(t,n,i){return e??(e=r()),Reflect.defineProperty(e,n,i)}})}function K(r){return typeof r=="bigint"?r.toString()+"n":typeof r=="string"?`"${r}"`:`${r}`}function P_(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}var S_={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]},E_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function i$(r,e){let t=r._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Ba(r._zod.def,{get shape(){let a={};for(let s in e){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=t.shape[s])}return Ms(this,"shape",a),a},checks:[]});return ei(r,o)}function n$(r,e){let t=r._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Ba(r._zod.def,{get shape(){let a={...r._zod.def.shape};for(let s in e){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return Ms(this,"shape",a),a},checks:[]});return ei(r,o)}function o$(r,e){if(!ks(e))throw new Error("Invalid input to extend: expected a plain object");let t=r._zod.def.checks;if(t&&t.length>0){let o=r._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ba(r._zod.def,{get shape(){let o={...r._zod.def.shape,...e};return Ms(this,"shape",o),o}});return ei(r,i)}function a$(r,e){if(!ks(e))throw new Error("Invalid input to safeExtend: expected a plain object");let t=Ba(r._zod.def,{get shape(){let n={...r._zod.def.shape,...e};return Ms(this,"shape",n),n}});return ei(r,t)}function s$(r,e){let t=Ba(r._zod.def,{get shape(){let n={...r._zod.def.shape,...e._zod.def.shape};return Ms(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return ei(r,t)}function l$(r,e,t){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Ba(e._zod.def,{get shape(){let s=e._zod.def.shape,l={...s};if(t)for(let u in t){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=r?new r({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)l[u]=r?new r({type:"optional",innerType:s[u]}):s[u];return Ms(this,"shape",l),l},checks:[]});return ei(e,a)}function c$(r,e,t){let n=Ba(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};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:i[a]}))}else for(let a in i)o[a]=new r({type:"nonoptional",innerType:i[a]});return Ms(this,"shape",o),o}});return ei(e,n)}function $s(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 Li(r,e){return e.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(r),t})}function am(r){return typeof r=="string"?r:r?.message}function xi(r,e,t){let n={...r,path:r.path??[]};if(!r.message){let i=am(r.inst?._zod.def?.error?.(r))??am(e?.error?.(r))??am(t.customError?.(r))??am(t.localeError?.(r))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function um(r){return r instanceof Set?"set":r instanceof Map?"map":r instanceof File?"file":"unknown"}function dm(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}function Z(r){let e=typeof r;switch(e){case"number":return Number.isNaN(r)?"nan":"number";case"object":{if(r===null)return"null";if(Array.isArray(r))return"array";let t=r;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return e}function Qd(...r){let[e,t,n]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:n}:{...e}}function u$(r){return Object.entries(r).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function yN(r){let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function xN(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function d$(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return yN(e+t)}function p$(r){return xN(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function h$(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 n=0;n<e.length;n+=2)t[n/2]=Number.parseInt(e.slice(n,n+2),16);return t}function f$(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}var y_=class{constructor(...e){}};var wN=(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,Hd,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},pm=S("$ZodError",wN),wi=S("$ZodError",wN,{Parent:Error});function hm(r,e=t=>t.message){let t={},n=[];for(let i of r.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}function fm(r,e=t=>t.message){let t={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({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 n(r),t}function F_(r,e=t=>t.message){let t={errors:[]},n=(i,o=[])=>{var a,s;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>n({issues:u},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({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 h=u[d],g=d===u.length-1;typeof h=="string"?(p.properties??(p.properties={}),(a=p.properties)[h]??(a[h]={errors:[]}),p=p.properties[h]):(p.items??(p.items=[]),(s=p.items)[h]??(s[h]={errors:[]}),p=p.items[h]),g&&p.errors.push(e(l)),d++}}};return n(r),t}function bN(r){let e=[],t=r.map(n=>typeof n=="object"?n.key:n);for(let n of t)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function B_(r){let e=[],t=[...r.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of t)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${bN(n.path)}`);return e.join(`
3
+ `),this));for(let n of t)n.defer();for(let n of e)n.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(n=>n.accept({visitPointerField:i=>!i.mandatory||i.nonEmpty(),visitArrayField:i=>e(i.fields()),visitObjectField:i=>e(i.fields()),visitPrimitiveField:i=>!0,visitField:i=>!0})??!0);return e(this.fields())}toString(){return`${this.constructor.name} ${this.address.toString()}`}};Pk([kc,sB("design:type",bo),sB("design:paramtypes",[])],M.prototype,"pointerHub",null);var Jp;(function(r){r.clampInt32=(e,t)=>t,r.clampFloat32=(e,t)=>t})(Jp||(Jp={}));var Ue;(function(r){r[r.This=0]="This",r[r.Parent=1]="Parent",r[r.Children=2]="Children"})(Ue||(Ue={}));var kg;(function(r){r.create=()=>new sA})(kg||(kg={}));var sA=class{#e=new Qp(Xs.equals);#t=new Qp(Xs.startsWith);#r=new Qp(Xs.endsWith);#i=[];#n=0;#o=!1;subscribe(e,t,n){let i=new lA(t,e,this.#n++,n);if(this.#o){let o=new cA(i,e);return this.#i.push(o),o}else return this.subscribeMonitor(i,e)}dispatch(e){this.#o=!0,[...this.#e.filter(e),...this.#t.filter(e),...this.#r.filter(e)].sort(({order:n},{order:i})=>n-i).forEach(n=>n.procedure(e)),this.#o=!1,this.#i.forEach(n=>n.subscribe(this)),this.#i.length=0}subscribeMonitor(e,t){switch(t){case Ue.This:return this.#e.subscribe(e);case Ue.Parent:return this.#t.subscribe(e);case Ue.Children:return this.#r.subscribe(e);default:return ag(t)}}countStations(){return this.#e.count()+this.#t.count()+this.#r.count()}},lA=class{address;propagation;order;procedure;constructor(e,t,n,i){this.address=e,this.propagation=t,this.order=n,this.procedure=i}toString(){return`{ Monitor address: ${this.address}, propagation: ${Ue[this.propagation]}, order: ${this.order} }`}},Qp=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(Xs.Comparator),this.#t=!0),this.#e}filter(e){return this.filterStrategy(e.address,this.stations())}count(){return this.#e.length}},cA=class{monitor;propagation;#e=new j;#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 Ot;(function(r){r.Boolean="boolean",r.Float32="float32",r.Int32="int32",r.String="string",r.Bytes="bytes"})(Ot||(Ot={}));var tl={[Ot.Boolean]:{type:Ot.Boolean,encode:(r,e)=>r.writeBoolean(e),decode:r=>r.readBoolean()},[Ot.Float32]:{type:Ot.Float32,encode:(r,e)=>r.writeFloat(e),decode:r=>r.readFloat()},[Ot.Int32]:{type:Ot.Int32,encode:(r,e)=>r.writeInt(e),decode:r=>r.readInt()},[Ot.String]:{type:Ot.String,encode:(r,e)=>r.writeString(e),decode:r=>r.readString()},[Ot.Bytes]:{type:Ot.Bytes,encode:(r,e)=>{r.writeInt(e.length),r.writeBytes(e)},decode:r=>{let e=new Int8Array(r.readInt());return r.readBytes(e),e}}},el=class extends Y{#e;#t;#r;constructor(e,t,n){super(e),this.#e=t,this.#t=n,this.#r=this.#t}accept(e){return P(e.visitPrimitiveField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.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){V(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,n=this.clamp(e);this.equals(n)||(this.#r=n,this.graph.onPrimitiveValueUpdate(this,t,n))}writeValue(e,t){V(!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)?D("not implemented"):e}fromJSON(e){return D("Type mismatch")}reset(){this.setValue(this.#t)}},k=class r extends el{static create(e,t=!1){return new r(e,t)}constructor(e,t){super(e,Ot.Boolean,t)}toggle(){this.setValue(!this.getValue())}serialization(){return tl[Ot.Boolean]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readBoolean())}write(e){V(!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()))}},w=class r extends el{static create(e,t,n,i=0){return new r(e,t,n,i)}#e;#t;constructor(e,t,n,i){super(e,Ot.Float32,i),this.#e=t,this.#t=n}serialization(){return tl[Ot.Float32]}equals(e){return this.getValue()===e}clamp(e){return Jp.clampFloat32(this.#e,ra.toFloat32(e))}read(e){this.setValue(e.readFloat())}write(e){V(!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 el{static create(e,t,n,i=0){return new r(e,t,n,i)}#e;#t;constructor(e,t,n,i){super(e,Ot.Int32,i),this.#e=t,this.#t=n}serialization(){return tl[Ot.Int32]}equals(e){return this.getValue()===e}clamp(e){return Jp.clampInt32(this.#e,yr.toInt(e))}read(e){this.setValue(e.readInt())}write(e){V(!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>=yr.MIN_VALUE&&e<=yr.MAX_VALUE?this.setValue(e):console.warn("Int32Field Type mismatch",e,this.address.toString()))}},C=class r extends el{static create(e,t=""){return new r(e,t)}constructor(e,t){super(e,Ot.String,t)}serialization(){return tl[Ot.String]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readString())}write(e){V(!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()))}},lB=class r extends el{static create(e,t=this.#e){return new r(e,t)}static#e=Object.freeze(new Int8Array(0));constructor(e,t){super(e,Ot.Bytes,t)}serialization(){return tl[Ot.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){V(!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 cB;(function(r){r.decode=e=>{let t=e.readInt();return U.create(()=>{switch(e.readString()){case"new":{let i=b.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new rl(i,o,a.buffer)}case"pointer":{let i=Me.read(e),o=e.readBoolean()?m.wrap(Me.read(e)):m.None,a=e.readBoolean()?m.wrap(Me.read(e)):m.None;return new Xp(i,o,a)}case"primitive":{let i=Me.read(e),o=e.readString(),a=tl[o],s=a.decode(e),l=a.decode(e);return new Yp(i,a,s,l)}case"delete":{let i=b.fromDataInput(e),o=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new il(i,o,a.buffer)}}},t)}})(cB||(cB={}));var rl=class{type="new";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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 wt(this.#r)))}inverse(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}write(e){e.writeString(this.type),b.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{NewUpdate uuid: ${b.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}toDebugString(e){return this.toString()}},Yp=class{type="primitive";#e;#t;#r;#i;constructor(e,t,n,i){this.#e=e,this.#t=t,this.#r=n,this.#i=i}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}`}},Xp=class{type="pointer";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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()}`}},il=class{type="delete";#e;#t;#r;constructor(e,t,n){this.#e=e,this.#t=t,this.#r=n}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 wt(this.#r)))}write(e){e.writeString(this.type),b.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{DeleteUpdate uuid: ${b.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}};var tz=Symbol("Unreferenceable"),N=class r extends Y{static create(e,t,n){return new r(e,t,n)}static encodeWith(e,t){V(this.#e.isEmpty(),"SerializationEncoder already in use"),this.#e=m.wrap(e);let n=ho(t);if(this.#e=m.None,n.status==="failure")throw n.error;return n.value}static decodeWith(e,t){V(this.#t.isEmpty(),"SerializationDecoder already in use"),this.#t=m.wrap(e);let n=ho(t);if(this.#t=m.None,n.status==="failure")throw n.error;return n.value}static#e=m.None;static#t=m.None;#r;#i;#n=m.None;#o=m.None;constructor(e,t,n){super(e),this.#r=t,this.#i=n,n&&this.graph.edges().watchVertex(this)}get pointerHub(){return D(`${this} cannot be pointed to`)}get pointerType(){return this.#r}get mandatory(){return this.#i}accept(e){return P(e.visitPointerField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.This,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}refer(e){this.targetVertex=m.wrap(e)}defer(){this.targetVertex=m.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=bo.validate(this,e.unwrap());t.nonEmpty()&&D(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()?m.wrap(Me.read(e)):m.None;this.targetAddress=r.#t.match({none:()=>t,some:n=>n.map(this,t)})}write(e){V(!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(uo(e)||typeof e=="string"){let t=m.wrap(uo(e)?null:Me.decode(e));this.targetAddress=r.#t.match({none:()=>t,some:n=>n.map(this,t)})}else return D(`Pointer at (${this.address}) has type mismatch. value (${e}) must be a string, but is ${typeof e}.`)}};var $g=class{#e;#t;#r;#i;#n;constructor(){this.#e=Me.newSet(e=>e.address),this.#t=Me.newSet(e=>e.address),this.#r=Me.newSet(e=>e.address),this.#i=Me.newSet(([e])=>e),this.#n=Me.newSet(([e])=>e.address)}watchVertex(e){if(pt(e,N)){if(!e.mandatory)return D("watchVertex called but has no edge requirement");this.#e.add(e)}else{let{mandatory:t,exclusive:n}=e.pointerRules;if(!t&&!n)return D("watchVertex called but has no edge requirement");t&&this.#t.add(e),n&&this.#r.add(e)}}unwatchVerticesOf(...e){let t=({box:{address:{uuid:n}}})=>n;for(let{address:{uuid:n}}of e)this.#a(this.#e,n,t),this.#a(this.#t,n,t),this.#a(this.#r,n,t);for(let n of e){let i=this.outgoingEdgesOf(n);if(i.length>0)return D(`${n} has outgoing edges: ${i.map(([a,s])=>`[${a.toString()}, ${s.toString()}]`)}`);let o=this.incomingEdgesOf(n);if(o.length>0)return D(`${n} has incoming edges from: ${o.map(a=>a.toString())}`)}}connect(e,t){this.#n.add([e,t]),this.#i.opt(t).match({none:()=>this.#i.add([t,[e]]),some:([,n])=>n.push(e)})}disconnect(e){let[,t]=this.#n.removeByKey(e.address),[,n]=this.#i.get(t);U.remove(n,e),n.length===0&&this.#i.removeByKey(t)}isConnected(e,t){return this.#n.opt(e.address).mapOr(([,n])=>n.equals(t),!1)}outgoingEdgesOf(e){return this.#o(this.#n,e.address.uuid,([{box:{address:{uuid:t}}}])=>t)}incomingEdgesOf(e){return e.isBox()?this.#o(this.#i,e.address.uuid,([{uuid:t}])=>t).flatMap(([t,n])=>n):this.#i.opt(e.address).mapOr(([t,n])=>n,U.empty())}validateRequirements(){this.#e.forEach(e=>{if(e.isEmpty())return e.mandatory?(console.warn(`[GraphEdges] Validation failed: Pointer ${e.toString()} requires an edge.`),D(`Pointer ${e.toString()} requires an edge.`)):D(`Illegal state: ${e} has no edge requirements.`)}),this.#t.forEach(e=>{if(e.pointerHub.isEmpty())return e.pointerRules.mandatory?(console.warn(e),console.warn(`[GraphEdges] Validation failed: Target ${e.toString()} requires an edge.`),D(`Target ${e.toString()} requires an edge.`)):D(`Illegal state: ${e} has no edge requirements.`)}),this.#r.forEach(e=>{let t=e.pointerHub.size();if(t>1)return console.warn(`[GraphEdges] Validation failed: Target ${e.toString()} is exclusive but has ${t} incoming pointers.`),D(`Target ${e.toString()} is exclusive but has ${t} incoming pointers.`)})}#o(e,t,n){let i=Me.boxRange(e,t,n);return q(i)?e.values().slice(i[0],i[1]):U.empty()}#a(e,t,n){let i=Me.boxRange(e,t,n);q(i)&&e.removeRange(i[0],i[1])}};var nl=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p=!1;#d=!1;constructor(e=m.None){this.#e=e,this.#t=b.newSet(t=>t.address.uuid),this.#r=[],this.#a=kg.create(),this.#i=new ar,this.#n=new ar,this.#o=new ar,this.#s=new $g,this.#l=Me.newSet(({pointer:t})=>t.address),this.#c=[],this.#u=b.newSet(t=>t.uuid)}beginTransaction(){V(!this.#p,"Transaction already in progress"),this.#p=!0,this.#o.proxy.onBeginTransaction()}endTransaction(){for(V(this.#p,"No transaction in progress"),this.#r.length>0&&(this.#r.forEach(({pointerField:e,update:t})=>this.#f(e,t)),this.#r.length=0),this.#l.values().toSorted((e,t)=>e.index-t.index).forEach(({pointer:e,initial:t,final:n})=>{t.equals(n)||(t.ifSome(i=>this.findVertex(i).unwrapOrUndefined()?.pointerHub.onRemoved(e)),n.ifSome(i=>this.findVertex(i).unwrapOrUndefined()?.pointerHub.onAdded(e)))}),this.#l.clear(),this.#p=!1;this.#c.length>0;)this.#c.splice(0).forEach(e=>e()),this.#c.length>0&&console.debug(`${this.#c.length} new observers while notifying`);this.#o.proxy.onEndTransaction()}inTransaction(){return this.#p}constructingBox(){return this.#d}createBox(e,t,n){return this.#e.unwrap("No box-factory installed")(e,this,t,n)}stageBox(e,t){this.#g(),V(!this.#d,"Cannot construct box while other box is constructing"),q(t)&&(this.#d=!0,t(e),this.#d=!1);let n=this.#t.add(e);V(n,()=>`${e.name} ${e.address.toString()} already staged`);let i=new rl(e.address.uuid,e.name,e.toArrayBuffer());return this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i),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,n){return this.#a.subscribe(e,t,n)}subscribeEndTransaction(e){this.#c.push(e)}subscribeDeletion(e,t){let n=this.#u.getOrCreate(e,()=>({uuid:e,listeners:new Set}));return n.listeners.add(t),{terminate:()=>{n.listeners.delete(t),n.listeners.size===0&&this.#u.removeByKeyIfExist(e)}}}unstageBox(e){this.#g();let t=this.#t.removeByKey(e.address.uuid);V(t===e,`${e} could not be found to unstage`),this.#s.unwatchVerticesOf(e);let n=new il(e.address.uuid,e.name,e.toArrayBuffer());this.#u.removeByKeyIfExist(e.address.uuid)?.listeners.forEach(i=>i()),this.#i.proxy.onUpdate(n),this.#n.proxy.onUpdate(n)}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.#s}checksum(){let e=new ug;return this.boxes().forEach(t=>t.write(e)),e.result()}onPrimitiveValueUpdate(e,t,n){if(this.#g(),e.isAttached()&&!this.#d){let i=new Yp(e.address,e.serialization(),t,n);this.#a.dispatch(i),this.#i.proxy.onUpdate(i),this.#n.proxy.onUpdate(i)}}onPointerAddressUpdated(e,t,n){this.#g(),t.nonEmpty()&&this.#s.disconnect(e),n.nonEmpty()&&this.#s.connect(e,n.unwrap());let i=new Xp(e.address,t,n);this.#d?this.#r.push({pointerField:e,update:i}):(this.#f(e,i),this.#n.proxy.onUpdate(i))}#f(e,t){let{oldAddress:n,newAddress:i}=t;e.resolvedTo(i.flatMap(a=>this.findVertex(a))),this.#l.opt(e.address).match({none:()=>this.#l.add({pointer:e,initial:n,final:i,index:this.#l.size()}),some:a=>a.final=i}),this.#a.dispatch(t),this.#i.proxy.onUpdate(t)}findOrphans(e){let t=this.#h(e);return this.boxes().filter(n=>!t.has(n))}#h(e){let t=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!t.has(i)){t.add(i),this.#m(i).forEach(o=>{o.targetAddress.ifSome(a=>{this.findBox(a.uuid).ifSome(s=>{t.has(s)||n.push(s)})})});for(let o of i.incomingEdges())t.has(o.box)||n.push(o.box)}}return t}#m(e){let t=[],n=i=>{for(let o of i)o.accept({visitPointerField:a=>t.push(a),visitObjectField:a=>n(a.fields()),visitArrayField:a=>n(a.fields())})};return n(e.fields()),t}dependenciesOf(e,t={}){let n=q(t.excludeBox)?t.excludeBox:Tc.alwaysFalse,i=q(t.alwaysFollowMandatory)?t.alwaysFollowMandatory:!1,o=q(t.stopAtResources)?t.stopAtResources:!1,a=new Set,s=new Set,l=(p,d=!1)=>{if(!(a.has(p)||!d&&n(p))){if(a.add(p),o&&q(p.resource)){p.incomingEdges().forEach(h=>{s.add(h);let g=h.targetAddress.mapOr(v=>!v.isBox(),!1);if(h.mandatory&&g){if(p.resource==="shared"&&h.targetAddress.flatMap(y=>this.findVertex(y)).mapOr(y=>y.pointerRules.mandatory,!1))return;l(h.box)}});return}p.outgoingEdges().filter(([h])=>!s.has(h)).forEach(([h,g])=>{let v=this.findVertex(g).unwrap(`Could not find target of ${h.toString()}`);if(s.add(h),v.pointerRules.mandatory&&(i||v.pointerHub.incoming().filter(y=>y.targetAddress.mapOr(x=>x.equals(g),!1)).every(y=>s.has(y))))return l(v.box)}),p.incomingEdges().forEach(h=>{s.add(h),h.mandatory&&l(h.box)})}},u=Array.isArray(e)?e:[e];return u.forEach(p=>l(p,!0)),u.forEach(p=>a.delete(p)),{boxes:a,pointers:Array.from(s).reverse()}}verifyPointers(){this.#s.validateRequirements();let e=0,t=n=>{for(let i of n.fields())i.accept({visitPointerField:o=>{if(o.targetAddress.nonEmpty()){let a=o.targetVertex.nonEmpty(),s=this.findVertex(o.targetAddress.unwrap()).nonEmpty();V(a,`pointer ${o.address} is broken`),V(s,`Cannot find target for pointer ${o.address}`),e++}},visitObjectField:o=>t(o)})};return this.#t.forEach(n=>t(n)),console.debug("verification complete."),{count:e}}debugBoxes(){console.table(this.#t.values().reduce((e,t)=>(e[b.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(n=>n.name):this.findBox(t.uuid).flatMap(n=>n.searchVertex(t.fieldKeys).map(i=>i.isField()?i.debugPath:D("Unknown address"))))}toArrayBuffer(){let e=or.create(),t=this.#t.values();return e.writeInt(t.length),t.forEach(n=>{let i=n.serialize();e.writeInt(i.byteLength),e.writeBytes(new Int8Array(i))}),e.toArrayBuffer()}fromArrayBuffer(e){V(this.#t.isEmpty(),"Cannot call fromArrayBuffer if boxes is not empty");let t=new wt(e),n=t.readInt();this.beginTransaction();let i=[];for(let o=0;o<n;o++){let a=t.readInt(),s=new Int8Array(a);t.readBytes(s);let l=new wt(s.buffer),u=l.readInt(),p=l.readString(),d=b.fromDataInput(l);i.push({creationIndex:u,name:p,uuid:d,boxStream:l})}i.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(){let e={};for(let t of this.#t.values())e[t.address.toString()]={name:t.name,fields:he(t.toJSON())};return e}fromJSON(e){if(typeof e!="object"||e===null||Array.isArray(e))return D("Expected object");this.beginTransaction();let t=Object.entries(e);for(let[n,{name:i,fields:o}]of t)this.createBox(i,b.parse(n),a=>a.fromJSON(o));this.endTransaction()}#g(){V(this.#p,()=>"Modification only prohibited in transaction mode.")}};var Wc;(function(r){r.insertOrder=(e,t=Number.MAX_SAFE_INTEGER)=>{let n=r.collectIndexedBoxes(e),i=be(t,0,n.length);if(i<n.length)for(let o=i;o<n.length;o++)n[o].index.setValue(o+1);return i},r.removeOrder=(e,t)=>{let n=r.collectIndexedBoxes(e);if(t<n.length)for(let i=t+1;i<n.length;i++)n[i].index.setValue(i-1)},r.moveIndex=(e,t,n)=>{let i=r.collectIndexedBoxes(e),o=i[t];if(n<0){let a=be(t+n,0,i.length-1);for(let s=a;s<t;s++)i[s].index.setValue(s+1);o.index.setValue(a)}else if(n>1){let a=be(t+(n-1),0,i.length-1);for(let s=t;s<a;s++)i[s+1].index.setValue(s);o.index.setValue(a)}else console.warn(`moveIndex had no effect: startIndex: ${t}, delta: ${n}`)},r.isIndexedBox=e=>"index"in e&&e.index instanceof E,r.collectIndexedBoxes=(e,t)=>e.pointerHub.incoming().map(({box:n})=>r.isIndexedBox(n)&&(t===void 0||n instanceof t)?n:D(`${n} has no index field`)).sort((n,i)=>n.index.getValue()-i.index.getValue())})(Wc||(Wc={}));var qe=class extends Y{#e;constructor(e){super(e),this.#e=this.initializeFields()}accept(e){return P(e.visitObjectField,this)}fields(){return Object.values(this.#e)}record(){return this.#e}getField(e){return he(this.#e[e])}optField(e){return m.wrap(this.#e[e])}subscribe(e){return this.graph.subscribeVertexUpdates(Ue.Children,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}read(e){Va.readFields(e,this.#e)}write(e){Va.writeFields(e,this.#e)}toJSON(){if(!this.deprecated)return Object.entries(this.#e).reduce((e,[t,n])=>(e[t]=n.toJSON(),e),{})}fromJSON(e){if(!this.deprecated)if(og(e))Object.entries(e).forEach(([t,n])=>{let i=this.#e[parseInt(t)];q(n)&&i.fromJSON(n)});else return D("Type mismatch")}};var In;(function(r){class e{value;constructor(s){this.value=s}}r.Transfer=e,r.makeTransferable=a=>new e(a),r.sender=(a,s)=>s(new i(a)),r.executor=(a,s)=>new o(a,s);let t=a=>{let s=[];for(let l of a)l instanceof e?s.push(l.value):(l instanceof MessagePort||typeof ImageBitmap<"u"&&l instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&l instanceof OffscreenCanvas)&&s.push(l);return s},n=a=>a instanceof e?a.value:a;class i{#e;#t=new Map;#r;#i=0;constructor(s){this.#e=s,this.#r=s.subscribe(this.#n)}terminate(){this.#r.terminate()}dispatchAndForget=(s,...l)=>{let u=t(l);this.#e.send({type:"send",returnId:!1,func:s.name,args:Array.from(ht.map(l,p=>({value:n(p)})))},u)};dispatchAndReturn=(s,...l)=>new Promise((u,p)=>{let d=ht.reduce(l,(g,v,y)=>(typeof v=="function"&&g.push([y,v]),g),[]);this.#t.set(this.#i,{executorTuple:{resolve:u,reject:p},callbacks:new Map(d)});let h=t(l);this.#e.send({type:"send",returnId:this.#i,func:s.name,args:Array.from(ht.map(l,(g,v)=>typeof g=="function"?{callback:v}:{value:n(g)}))},h),this.#i++});#n=s=>{let l=this.#t.get(s.returnId);q(l)?s.type==="resolve"?(l.executorTuple.resolve(s.resolve),this.#t.delete(s.returnId)):s.type==="reject"?(l.executorTuple.reject(s.reject),this.#t.delete(s.returnId)):s.type==="callback"&&l.callbacks?.get(s.funcAt).apply(this,s.args):D(`Promise has already been resolved. ${JSON.stringify(s)}`)}}class o{#e;#t;#r;constructor(s,l){this.#e=s,this.#t=l,this.#r=s.subscribe(this.#i)}terminate(){this.#r.terminate()}#i=s=>{V(s.type==="send",()=>"Message type must be 'send'");let l=Object.getPrototypeOf(this.#t)===Object.getPrototypeOf({})?this.#t:Object.getPrototypeOf(this.#t),u=he(l[s.func],`${s.func.toString()} does not exists on ${this.#t}`),p=s.returnId;if(p===!1)u.apply(this.#t,s.args.map(d=>"value"in d?d.value:D(`${s.func.toString()} has no promise.`)));else try{u.apply(this.#t,s.args.map(h=>"callback"in h?(...g)=>this.#a(p,h.callback,g):h.value)).then(h=>{try{this.#n(p,h)}catch(g){this.#o(p,g)}},h=>this.#o(p,h))}catch(d){this.#o(p,d)}};#n=(s,l)=>this.#e.send({type:"resolve",returnId:s,resolve:l});#o=(s,l)=>this.#e.send({type:"reject",returnId:s,reject:l});#a=(s,l,u)=>this.#e.send({type:"callback",returnId:s,funcAt:l,args:u})}r.Executor=o})(In||(In={}));var uB={for:r=>new uA(r)},Sk=[],uA=class{#e;#t=new ce;constructor(e){if(this.#e=e,q(e.onmessage)||q(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??Sk)}channel(e){return new dA(this,e)}subscribe(e){return this.#t.subscribe(e)}terminate(){this.#t.terminate(),this.#e.onmessage=null,this.#e.onmessageerror=null}},dA=class r{#e;#t;#r=new ce;#i;constructor(e,t){this.#e=e,this.#t=t,this.#i=e.subscribe(n=>{"__id__"in n&&n.__id__==="42"&&"message"in n&&"channel"in n&&n.channel===t&&this.#r.notify(n.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 eh;(function(r){r.frame=()=>new Promise(e=>requestAnimationFrame(()=>e())),r.frames=e=>new Promise(t=>{let n=e,i=()=>{--n<=0?t():requestAnimationFrame(i)};requestAnimationFrame(i)}),r.timeSpan=(e,...t)=>new Promise(n=>setTimeout(n,e.millis(),...t)),r.event=(e,t)=>new Promise(n=>e.addEventListener(t,n,{once:!0})),r.observable=e=>new Promise(t=>{let n=e.subscribe(()=>{n.terminate(),t()})}),r.complete=e=>new Promise((t,n)=>{let i=setInterval(()=>{let{status:o,value:a,error:s}=ho(()=>e.next());if(o==="success"){let{done:l,value:u}=a;l&&(clearInterval(i),t(u))}else clearInterval(i),n(s)},0)})})(eh||(eh={}));var pA=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)}},Tg;(function(r){class e{value;status="resolved";constructor(s){this.value=s}error=Gs("Cannot access error when promise is resolved")}r.ResolveResult=e;class t{error;status="rejected";constructor(s){this.error=s}value=Gs("Cannot access value when promise is rejected")}r.RejectedResult=t,r.makeAbortable=async(a,s)=>{let l=!0;return a.own(ee.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 n=new pA(3,jp.seconds(3));r.retry=(a,s=n)=>a().catch(l=>new Promise((u,p)=>{let d=h=>{s.retry(h,()=>a().then(g=>u(g),d))||p(h)};d(l)})),r.guardedRetry=(a,s)=>{let l=async(u=0)=>{try{return await a()}catch(p){if(s(p,++u))return console.debug(`retry after failure (online: ${navigator.onLine}):`,p),await eh.timeSpan(jp.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 Oc.approve(s(u)))return l();throw u}};return l()},r.delay=(a,s)=>Promise.all([a,eh.timeSpan(s)]).then(([l])=>l),r.fail=(a,s="fail")=>Promise.reject(s),r.timeout=(a,s,l)=>new Promise((u,p)=>{let d=!0,h=setTimeout(()=>{d=!1,p(new Error(l??"timeout"))},s.millis());a.then(g=>{d&&u(g)},g=>{d&&p(g)}).finally(()=>clearTimeout(h))}),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(uo(l)||q(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 h=u++;try{let g=await a[h]();p||(l[h]=g)}catch(g){throw p=!0,g}}};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 h=await a[d]();l[d]={status:"fulfilled",value:h}}catch(h){l[d]={status:"rejected",reason:h}}}};return await Promise.all(Array.from({length:Math.min(s,a.length)},p)),l};class i{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(V(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=i;class o{#e;#t;#r;#i=m.None;constructor(s,l,u){this.#e=s,this.#t=l,this.#r=u}update(s){this.#i=m.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(),P(this.#r))})}terminate(){this.#i=m.None}}r.Latest=o})(Tg||(Tg={}));var dB=(r,e)=>In.executor(e,new class{sendUpdates(t){r.beginTransaction(),t.forEach(n=>{let i=n.type;i==="new"?r.createBox(n.name,n.uuid,o=>o.read(new wt(n.buffer))):i==="update-primitive"?r.findVertex(Me.reconstruct(n.address)).unwrap(()=>`Could not find primitive field ${n.address}`).setValue(n.value):i==="update-pointer"?r.findVertex(Me.reconstruct(n.address)).unwrap(()=>`Could not find pointer field ${n.address}`).targetAddress=q(n.target)?m.wrap(Me.reconstruct(n.target)):m.None:n.type==="delete"&&r.unstageBox(r.findBox(n.uuid).unwrap(()=>`Could not find box ${b.toString(n.uuid)}`))}),r.endTransaction()}checksum(t){return U.equals(r.checksum(),t)?Promise.resolve():Promise.reject("Checksum mismatch")}});var ol;(function(r){r.create=(e,t,n,i)=>{switch(e){case"MetaDataBox":return Dn.create(t,n,i);case"RootBox":return Zc.create(t,n,i);case"SelectionBox":return al.create(t,n,i);case"UserInterfaceBox":return sl.create(t,n,i);case"UploadFileBox":return Rg.create(t,n,i);case"ShadertoyBox":return Cg.create(t,n,i);case"MIDIControllerBox":return Og.create(t,n,i);case"TimelineBox":return ll.create(t,n,i);case"TrackBox":return Zr.create(t,n,i);case"NoteEventBox":return za.create(t,n,i);case"NoteEventRepeatBox":return Vg.create(t,n,i);case"NoteEventCollectionBox":return aa.create(t,n,i);case"NoteRegionBox":return cl.create(t,n,i);case"NoteClipBox":return Gc.create(t,n,i);case"ValueEventBox":return Mn.create(t,n,i);case"ValueEventCollectionBox":return kn.create(t,n,i);case"ValueEventCurveBox":return Ua.create(t,n,i);case"ValueRegionBox":return ul.create(t,n,i);case"ValueClipBox":return qc.create(t,n,i);case"SignatureEventBox":return Hc.create(t,n,i);case"AudioRegionBox":return ja.create(t,n,i);case"AudioClipBox":return Jc.create(t,n,i);case"AudioPitchStretchBox":return Qc.create(t,n,i);case"AudioTimeStretchBox":return Yc.create(t,n,i);case"TransientMarkerBox":return zg.create(t,n,i);case"WarpMarkerBox":return La.create(t,n,i);case"MarkerBox":return Xc.create(t,n,i);case"AudioFileBox":return br.create(t,n,i);case"SoundfontFileBox":return Ao.create(t,n,i);case"NeuralAmpModelBox":return Ug.create(t,n,i);case"AudioUnitBox":return yt.create(t,n,i);case"CaptureAudioBox":return Ka.create(t,n,i);case"CaptureMidiBox":return Wa.create(t,n,i);case"AudioBusBox":return $n.create(t,n,i);case"AuxSendBox":return eu.create(t,n,i);case"GrooveShuffleBox":return tu.create(t,n,i);case"UnknownAudioEffectDeviceBox":return jg.create(t,n,i);case"UnknownMidiEffectDeviceBox":return Lg.create(t,n,i);case"DeviceInterfaceKnobBox":return Kg.create(t,n,i);case"ModularDeviceBox":return Wg.create(t,n,i);case"StereoToolDeviceBox":return Zg.create(t,n,i);case"MaximizerDeviceBox":return Gg.create(t,n,i);case"CompressorDeviceBox":return ru.create(t,n,i);case"GateDeviceBox":return qg.create(t,n,i);case"DelayDeviceBox":return Hg.create(t,n,i);case"CrusherDeviceBox":return Jg.create(t,n,i);case"DattorroReverbDeviceBox":return Qg.create(t,n,i);case"VelocityDeviceBox":return Yg.create(t,n,i);case"FoldDeviceBox":return Xg.create(t,n,i);case"TidalDeviceBox":return ev.create(t,n,i);case"RevampDeviceBox":return tv.create(t,n,i);case"ReverbDeviceBox":return rv.create(t,n,i);case"VaporisateurDeviceBox":return iu.create(t,n,i);case"MIDIOutputDeviceBox":return nu.create(t,n,i);case"MIDIOutputBox":return Tn.create(t,n,i);case"MIDIOutputParameterBox":return Rn.create(t,n,i);case"SoundfontDeviceBox":return ou.create(t,n,i);case"NanoDeviceBox":return au.create(t,n,i);case"PlayfieldDeviceBox":return su.create(t,n,i);case"PlayfieldSampleBox":return Za.create(t,n,i);case"TapeDeviceBox":return lu.create(t,n,i);case"ArpeggioDeviceBox":return iv.create(t,n,i);case"PitchDeviceBox":return nv.create(t,n,i);case"ZeitgeistDeviceBox":return ov.create(t,n,i);case"NeuralAmpDeviceBox":return av.create(t,n,i);case"ModularBox":return sv.create(t,n,i);case"ModuleConnectionBox":return lv.create(t,n,i);case"ModularAudioInputBox":return cv.create(t,n,i);case"ModularAudioOutputBox":return uv.create(t,n,i);case"ModuleDelayBox":return dv.create(t,n,i);case"ModuleMultiplierBox":return pv.create(t,n,i);case"ModuleGainBox":return hv.create(t,n,i);default:return D(`Unknown box class '${e}'`)}},r.deserialize=(e,t)=>{let n=new wt(t),i=n.readString(),o=b.fromDataInput(n),a=r.create(i,e,o);return a.read(n),a}})(ol||(ol={}));var pB;(function(r){r.NoSync="nosync",r.Pitch="pitch",r.Timestretch="timestretch",r.AudioFit="audiofit"})(pB||(pB={}));var hB;(function(r){r[r.Pre=0]="Pre",r[r.Post=1]="Post"})(hB||(hB={}));var Qt;(function(r){r.Instrument="instrument",r.Bus="bus",r.Aux="aux",r.Output="output"})(Qt||(Qt={}));var Ga={white:new Ht(0,0,100),blue:new Ht(189,100,65),green:new Ht(150,77,69),yellow:new Ht(60,100,84),cream:new Ht(65,20,83),orange:new Ht(31,100,73),red:new Ht(354,100,65),purple:new Ht(314,100,78),bright:new Ht(197,5,95),gray:new Ht(197,31,80),dark:new Ht(197,15,60),shadow:new Ht(197,10,45),black:new Ht(197,10,16),background:new Ht(197,6,7),panelBackground:new Ht(197,14,10),panelBackgroundBright:new Ht(197,10,17),panelBackgroundDark:new Ht(197,14,9)};var He;(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.Browse=11]="Browse",r[r.Maximizer=12]="Maximizer",r[r.Bug=13]="Bug",r[r.Fold=14]="Fold",r[r.Checkbox=15]="Checkbox",r[r.Clips=16]="Clips",r[r.Close=17]="Close",r[r.CloudFolder=18]="CloudFolder",r[r.CollapseDown=19]="CollapseDown",r[r.Compressor=20]="Compressor",r[r.Connected=21]="Connected",r[r.Cube=22]="Cube",r[r.Cursor=23]="Cursor",r[r.Curve=24]="Curve",r[r.Dattorro=25]="Dattorro",r[r.Delete=26]="Delete",r[r.Dial=27]="Dial",r[r.DinSlot=28]="DinSlot",r[r.Disconnected=29]="Disconnected",r[r.Divide=30]="Divide",r[r.DragConnections=31]="DragConnections",r[r.Dropdown=32]="Dropdown",r[r.Dropbox=33]="Dropbox",r[r.DrumSet=34]="DrumSet",r[r.Tidal=35]="Tidal",r[r.Duration=36]="Duration",r[r.EditBox=37]="EditBox",r[r.Effects=38]="Effects",r[r.Embed=39]="Embed",r[r.EQ=40]="EQ",r[r.Eraser=41]="Eraser",r[r.Exclude=42]="Exclude",r[r.Exit=43]="Exit",r[r.ExpandWidth=44]="ExpandWidth",r[r.FileList=45]="FileList",r[r.Film=46]="Film",r[r.Flask=47]="Flask",r[r.Focus=48]="Focus",r[r.Gate=49]="Gate",r[r.Generator=50]="Generator",r[r.GoogleDrive=51]="GoogleDrive",r[r.Groove=52]="Groove",r[r.Guitar=53]="Guitar",r[r.GuitarTab=54]="GuitarTab",r[r.Headphone=55]="Headphone",r[r.Heart=56]="Heart",r[r.Help=57]="Help",r[r.HighPass=58]="HighPass",r[r.HighShelf=59]="HighShelf",r[r.Insert=60]="Insert",r[r.Invert=61]="Invert",r[r.Info=62]="Info",r[r.Loop=63]="Loop",r[r.LoopEnd=64]="LoopEnd",r[r.LoopStart=65]="LoopStart",r[r.LowPass=66]="LowPass",r[r.LowShelf=67]="LowShelf",r[r.Magnet=68]="Magnet",r[r.MainMenu=69]="MainMenu",r[r.Maximized=70]="Maximized",r[r.Menu=71]="Menu",r[r.Merge=72]="Merge",r[r.Metronome=73]="Metronome",r[r.Microphone=74]="Microphone",r[r.Midi=75]="Midi",r[r.Minimized=76]="Minimized",r[r.Mix=77]="Mix",r[r.Mixing=78]="Mixing",r[r.Mute=79]="Mute",r[r.NanoWave=80]="NanoWave",r[r.NeuralAmp=81]="NeuralAmp",r[r.New=82]="New",r[r.NoAudio=83]="NoAudio",r[r.Note=84]="Note",r[r.NotePad=85]="NotePad",r[r.OpenDAW=86]="OpenDAW",r[r.Panel=87]="Panel",r[r.Peak=88]="Peak",r[r.Pencil=89]="Pencil",r[r.Piano=90]="Piano",r[r.Play=91]="Play",r[r.Playfield=92]="Playfield",r[r.PlayOnce=93]="PlayOnce",r[r.PlayRepeat=94]="PlayRepeat",r[r.PlayAlternate=95]="PlayAlternate",r[r.Pointer=96]="Pointer",r[r.Popout=97]="Popout",r[r.Primary=98]="Primary",r[r.Random=99]="Random",r[r.Record=100]="Record",r[r.Rectangle=101]="Rectangle",r[r.Redo=102]="Redo",r[r.Region=103]="Region",r[r.Robot=104]="Robot",r[r.RoundDown=105]="RoundDown",r[r.RoundUp=106]="RoundUp",r[r.Run=107]="Run",r[r.Sawtooth=108]="Sawtooth",r[r.Saxophone=109]="Saxophone",r[r.Scissors=110]="Scissors",r[r.Search=111]="Search",r[r.Shadertoy=112]="Shadertoy",r[r.Shutdown=113]="Shutdown",r[r.Sine=114]="Sine",r[r.Solo=115]="Solo",r[r.SoundFont=116]="SoundFont",r[r.Speaker=117]="Speaker",r[r.SpeakerHeadphone=118]="SpeakerHeadphone",r[r.Square=119]="Square",r[r.Stack=120]="Stack",r[r.Start=121]="Start",r[r.Stereo=122]="Stereo",r[r.Stop=123]="Stop",r[r.Subtract=124]="Subtract",r[r.Sun=125]="Sun",r[r.Swap=126]="Swap",r[r.System=127]="System",r[r.Table=128]="Table",r[r.Tape=129]="Tape",r[r.TapeReel=130]="TapeReel",r[r.Time=131]="Time",r[r.Timeline=132]="Timeline",r[r.Tool=133]="Tool",r[r.Triangle=134]="Triangle",r[r.Undo=135]="Undo",r[r.Unknown=136]="Unknown",r[r.UserFolder=137]="UserFolder",r[r.Velocity=138]="Velocity",r[r.Vinyl=139]="Vinyl",r[r.Volume=140]="Volume",r[r.VUMeter=141]="VUMeter",r[r.Waveform=142]="Waveform",r[r.Zeitgeist=143]="Zeitgeist"})(He||(He={}));(function(r){r.toName=e=>r[e],r.fromName=e=>r[e]??r.Rectangle})(He||(He={}));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.MIDIControllers=23]="MIDIControllers",r[r.MIDIDevice=24]="MIDIDevice",r[r.MIDIEffectHost=25]="MIDIEffectHost",r[r.ModularSetup=26]="ModularSetup",r[r.Modulation=27]="Modulation",r[r.ModuleCollection=28]="ModuleCollection",r[r.NoteEventCollection=29]="NoteEventCollection",r[r.NoteEventFeature=30]="NoteEventFeature",r[r.NoteEvents=31]="NoteEvents",r[r.NotesConnection=32]="NotesConnection",r[r.Parameter=33]="Parameter",r[r.ParameterController=34]="ParameterController",r[r.PianoMode=35]="PianoMode",r[r.RegionCollection=36]="RegionCollection",r[r.Sample=37]="Sample",r[r.Selection=38]="Selection",r[r.Shadertoy=39]="Shadertoy",r[r.SideChain=40]="SideChain",r[r.SignatureAutomation=41]="SignatureAutomation",r[r.SoundfontFile=42]="SoundfontFile",r[r.StepAutomation=43]="StepAutomation",r[r.Timeline=44]="Timeline",r[r.TrackCollection=45]="TrackCollection",r[r.TransientMarkers=46]="TransientMarkers",r[r.User=47]="User",r[r.ValueEventCollection=48]="ValueEventCollection",r[r.ValueEvents=49]="ValueEvents",r[r.ValueInterpolation=50]="ValueInterpolation",r[r.VoltageConnection=51]="VoltageConnection",r[r.WarpMarkers=52]="WarpMarkers",r[r.NeuralAmpModel=53]="NeuralAmpModel"})(c||(c={}));var qa;(function(r){r[r.Once=0]="Once",r[r.Repeat=1]="Repeat",r[r.Pingpong=2]="Pingpong"})(qa||(qa={}));var _o;(function(r){r[r.Monophonic=0]="Monophonic",r[r.Polyphonic=1]="Polyphonic"})(_o||(_o={}));var Dn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MetaDataBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MetaDataBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMetaDataBox,this)}get tags(){return r.Tags}get target(){return this.getField(1)}get origin(){return this.getField(2)}get value(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"target",deprecated:!1,pointerRules:f},c.MetaData,!0),2:C.create({parent:this,fieldKey:2,fieldName:"origin",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"value",deprecated:!1,pointerRules:f},"{}")}}};var fv=class r extends qe{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:f},{length:4},"",0),2:w.create({parent:this,fieldKey:2,fieldName:"timeRangeInQuarters",deprecated:!1,pointerRules:f},{min:1,max:64,scaling:"linear"},"",8),3:w.create({parent:this,fieldKey:3,fieldName:"noteScale",deprecated:!1,pointerRules:f},{min:.5,max:2,scaling:"linear"},"",1),4:k.create({parent:this,fieldKey:4,fieldName:"noteLabels",deprecated:!1,pointerRules:f},!1),5:E.create({parent:this,fieldKey:5,fieldName:"transpose",deprecated:!1,pointerRules:f},{min:-48,max:48},"st",0)}}};var Zc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"RootBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="RootBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitRootBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"timeline",deprecated:!1,pointerRules:f},c.Timeline,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"users",deprecated:!1,pointerRules:{accepts:[c.User],mandatory:!0,exclusive:!1}}),3:C.create({parent:this,fieldKey:3,fieldName:"created",deprecated:!1,pointerRules:f}),4:N.create({parent:this,fieldKey:4,fieldName:"groove",deprecated:!1,pointerRules:f},c.Groove,!0),10:Y.hook({parent:this,fieldKey:10,fieldName:"modularSetups",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!1,exclusive:!1}}),20:Y.hook({parent:this,fieldKey:20,fieldName:"audioUnits",deprecated:!1,pointerRules:{accepts:[c.AudioUnits],mandatory:!1,exclusive:!1}}),21:Y.hook({parent:this,fieldKey:21,fieldName:"audioBusses",deprecated:!1,pointerRules:{accepts:[c.AudioBusses],mandatory:!1,exclusive:!1}}),30:Y.hook({parent:this,fieldKey:30,fieldName:"outputDevice",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!0,exclusive:!1}}),35:Y.hook({parent:this,fieldKey:35,fieldName:"outputMidiDevices",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!1,exclusive:!1}}),40:fv.create({parent:this,fieldKey:40,fieldName:"pianoMode",deprecated:!1,pointerRules:f}),100:N.create({parent:this,fieldKey:100,fieldName:"shadertoy",deprecated:!1,pointerRules:f},c.Shadertoy,!1),111:N.create({parent:this,fieldKey:111,fieldName:"editingChannel",deprecated:!1,pointerRules:f},c.Editing,!1)}}};var al=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SelectionBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="SelectionBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSelectionBox,this)}get tags(){return r.Tags}get selection(){return this.getField(1)}get selectable(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"selection",deprecated:!1,pointerRules:f},c.Selection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"selectable",deprecated:!1,pointerRules:f},c.Selection,!0)}}};var sl=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UserInterfaceBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UserInterfaceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitUserInterfaceBox,this)}get tags(){return r.Tags}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)}get midiControllers(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:f},c.User,!0),10:Y.hook({parent:this,fieldKey:10,fieldName:"selection",deprecated:!1,pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"uploadStates",deprecated:!1,pointerRules:{accepts:[c.FileUploadState],mandatory:!1,exclusive:!1}}),21:N.create({parent:this,fieldKey:21,fieldName:"editingDeviceChain",deprecated:!1,pointerRules:f},c.Editing,!1),22:N.create({parent:this,fieldKey:22,fieldName:"editingTimelineRegion",deprecated:!1,pointerRules:f},c.Editing,!1),23:N.create({parent:this,fieldKey:23,fieldName:"editingModularSystem",deprecated:!1,pointerRules:f},c.Editing,!1),30:Y.hook({parent:this,fieldKey:30,fieldName:"midiControllers",deprecated:!1,pointerRules:{accepts:[c.MIDIControllers],mandatory:!1,exclusive:!1}})}}};var Rg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UploadFileBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="UploadFileBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitUploadFileBox,this)}get tags(){return r.Tags}get user(){return this.getField(1)}get file(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"user",deprecated:!1,pointerRules:f},c.FileUploadState,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.FileUploadState,!0)}}};var Cg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ShadertoyBox",pointerRules:{accepts:[c.Shadertoy],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ShadertoyBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitShadertoyBox,this)}get tags(){return r.Tags}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:f}),2:k.create({parent:this,fieldKey:2,fieldName:"highres",deprecated:!1,pointerRules:f},!0)}}};var Og=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIControllerBox",pointerRules:f,resource:void 0,ephemeral:!0}),n)}static ClassName="MIDIControllerBox";static Resource=void 0;static Ephemeral=!0;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIControllerBox,this)}get tags(){return r.Tags}get controllers(){return this.getField(1)}get parameter(){return this.getField(2)}get deviceId(){return this.getField(3)}get deviceChannel(){return this.getField(4)}get controlId(){return this.getField(5)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"controllers",deprecated:!1,pointerRules:f},c.MIDIControllers,!0),2:N.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:f},c.MIDIControl,!0),3:C.create({parent:this,fieldKey:3,fieldName:"deviceId",deprecated:!1,pointerRules:f}),4:E.create({parent:this,fieldKey:4,fieldName:"deviceChannel",deprecated:!1,pointerRules:f},{min:0,max:127},""),5:E.create({parent:this,fieldKey:5,fieldName:"controlId",deprecated:!1,pointerRules:f},{min:0,max:127},"")}}};var mv=class r extends qe{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:f},{min:1,max:32},"",4),2:E.create({parent:this,fieldKey:2,fieldName:"denominator",deprecated:!1,pointerRules:f},{min:1,max:32},"",4)}}};var gv=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),2:E.create({parent:this,fieldKey:2,fieldName:"from",deprecated:!1,pointerRules:f},"any","ppqn",0),3:E.create({parent:this,fieldKey:3,fieldName:"to",deprecated:!1,pointerRules:f},"any","ppqn",15360)}}};var vv=class r extends qe{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:Y.hook({parent:this,fieldKey:1,fieldName:"markers",deprecated:!1,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",0),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var yv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get events(){return this.getField(1)}get index(){return this.getField(10)}get minBpm(){return this.getField(15)}get maxBpm(){return this.getField(16)}get enabled(){return this.getField(20)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!1),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",2),15:E.create({parent:this,fieldKey:15,fieldName:"minBpm",deprecated:!1,pointerRules:f},{min:30,max:999},"bpm",60),16:E.create({parent:this,fieldKey:16,fieldName:"maxBpm",deprecated:!1,pointerRules:f},{min:31,max:1e3},"bpm",240),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var xv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get events(){return this.getField(1)}get index(){return this.getField(10)}get enabled(){return this.getField(20)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.SignatureAutomation],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index","",1),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0)}}};var ll=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TimelineBox",pointerRules:{accepts:[c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TimelineBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTimelineBox,this)}get tags(){return r.Tags}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 tempoTrack(){return this.getField(22)}get signatureTrack(){return this.getField(23)}get durationInPulses(){return this.getField(30)}get bpm(){return this.getField(31)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:{accepts:[c.Timeline],mandatory:!0,exclusive:!1}}),10:mv.create({parent:this,fieldKey:10,fieldName:"signature",deprecated:!1,pointerRules:f}),11:gv.create({parent:this,fieldKey:11,fieldName:"loopArea",deprecated:!1,pointerRules:f}),20:Y.hook({parent:this,fieldKey:20,fieldName:"deprecatedMarkerTrack",deprecated:!0,pointerRules:{accepts:[c.MarkerTrack],mandatory:!1,exclusive:!1}}),21:vv.create({parent:this,fieldKey:21,fieldName:"markerTrack",deprecated:!1,pointerRules:f}),22:yv.create({parent:this,fieldKey:22,fieldName:"tempoTrack",deprecated:!1,pointerRules:f}),23:xv.create({parent:this,fieldKey:23,fieldName:"signatureTrack",deprecated:!1,pointerRules:f}),30:E.create({parent:this,fieldKey:30,fieldName:"durationInPulses",deprecated:!1,pointerRules:f},"positive","ppqn",491520),31:w.create({parent:this,fieldKey:31,fieldName:"bpm",deprecated:!1,pointerRules:f},{min:30,max:999,scaling:"exponential"},"bpm",120)}}};var Zr=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TrackBox",pointerRules:{accepts:[c.Selection,c.PianoMode,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TrackBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTrackBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"tracks",deprecated:!1,pointerRules:f},c.TrackCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"target",deprecated:!1,pointerRules:f},c.Automation,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"regions",deprecated:!1,pointerRules:{accepts:[c.RegionCollection],mandatory:!1,exclusive:!1}}),4:Y.hook({parent:this,fieldKey:4,fieldName:"clips",deprecated:!1,pointerRules:{accepts:[c.ClipCollection],mandatory:!1,exclusive:!1}}),10:E.create({parent:this,fieldKey:10,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),11:E.create({parent:this,fieldKey:11,fieldName:"type",deprecated:!1,pointerRules:f},{values:[0,1,2,3]},""),20:k.create({parent:this,fieldKey:20,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),30:k.create({parent:this,fieldKey:30,fieldName:"excludePianoMode",deprecated:!1,pointerRules:f},!1)}}};var za=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventBox",pointerRules:{accepts:[c.Selection,c.NoteEventFeature],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn",240),20:E.create({parent:this,fieldKey:20,fieldName:"pitch",deprecated:!1,pointerRules:f},{min:0,max:127},"",60),21:w.create({parent:this,fieldKey:21,fieldName:"velocity",deprecated:!1,pointerRules:f},"unipolar","%",.7874015748031497),22:E.create({parent:this,fieldKey:22,fieldName:"playCount",deprecated:!1,pointerRules:f},{min:1,max:128},"",1),23:w.create({parent:this,fieldKey:23,fieldName:"playCurve",deprecated:!1,pointerRules:f},"bipolar","%",0),24:w.create({parent:this,fieldKey:24,fieldName:"cent",deprecated:!1,pointerRules:f},{min:-50,max:50,scaling:"linear"},"ct",0),25:E.create({parent:this,fieldKey:25,fieldName:"chance",deprecated:!1,pointerRules:f},{min:0,max:100},"",100)}}};var Vg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventRepeatBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="NoteEventRepeatBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventRepeatBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:f},c.NoteEventFeature,!0),2:E.create({parent:this,fieldKey:2,fieldName:"count",deprecated:!1,pointerRules:f},{min:1,max:128},"",1),3:w.create({parent:this,fieldKey:3,fieldName:"curve",deprecated:!1,pointerRules:f},"bipolar","%",0),4:w.create({parent:this,fieldKey:4,fieldName:"length",deprecated:!1,pointerRules:f},"unipolar","%",1)}}};var aa=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:"shared",ephemeral:!1}),n)}static ClassName="NoteEventCollectionBox";static Resource="shared";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteEventCollectionBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.NoteEvents],mandatory:!1,exclusive:!1}}),2:Y.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.NoteEventCollection],mandatory:!0,exclusive:!1}})}}};var cl=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteRegionBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"positive","ppqn"),14:E.create({parent:this,fieldKey:14,fieldName:"eventOffset",deprecated:!1,pointerRules:f},"any","ppqn"),15:k.create({parent:this,fieldKey:15,fieldName:"mute",deprecated:!1,pointerRules:f}),16:C.create({parent:this,fieldKey:16,fieldName:"label",deprecated:!1,pointerRules:f}),17:E.create({parent:this,fieldKey:17,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Ha=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"loop",deprecated:!1,pointerRules:f},!0),2:k.create({parent:this,fieldKey:2,fieldName:"reverse",deprecated:!1,pointerRules:f}),3:k.create({parent:this,fieldKey:3,fieldName:"mute",deprecated:!0,pointerRules:f}),4:E.create({parent:this,fieldKey:4,fieldName:"speed",deprecated:!1,pointerRules:f},"non-negative",""),5:E.create({parent:this,fieldKey:5,fieldName:"quantise",deprecated:!1,pointerRules:f},"non-negative",""),6:E.create({parent:this,fieldKey:6,fieldName:"trigger",deprecated:!1,pointerRules:f},"non-negative","")}}};var Gc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NoteClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NoteClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNoteClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.NoteEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Mn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEvents,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),12:E.create({parent:this,fieldKey:12,fieldName:"interpolation",deprecated:!1,pointerRules:{accepts:[c.ValueInterpolation],mandatory:!1,exclusive:!1}},{values:[0,1]},"",1),13:w.create({parent:this,fieldKey:13,fieldName:"value",deprecated:!1,pointerRules:f},"any",""),14:w.create({parent:this,fieldKey:14,fieldName:"slope",deprecated:!0,pointerRules:f},"any","",NaN)}}};var kn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCollectionBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:"shared",ephemeral:!1}),n)}static ClassName="ValueEventCollectionBox";static Resource="shared";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventCollectionBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:{accepts:[c.ValueEvents],mandatory:!1,exclusive:!1}}),2:Y.hook({parent:this,fieldKey:2,fieldName:"owners",deprecated:!1,pointerRules:{accepts:[c.ValueEventCollection],mandatory:!0,exclusive:!1}})}}};var Ua=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCurveBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ValueEventCurveBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueEventCurveBox,this)}get tags(){return r.Tags}get event(){return this.getField(1)}get slope(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"event",deprecated:!1,pointerRules:f},c.ValueInterpolation,!0),2:w.create({parent:this,fieldKey:2,fieldName:"slope",deprecated:!1,pointerRules:f},"unipolar","%",.5)}}};var ul=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueRegionBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),12:E.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","ppqn"),13:E.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"positive","ppqn"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:f}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:f}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var qc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ValueClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ValueClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitValueClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),10:E.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"positive","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var Hc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SignatureEventBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="SignatureEventBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSignatureEventBox,this)}get tags(){return r.Tags}get events(){return this.getField(1)}get index(){return this.getField(9)}get relativePosition(){return this.getField(10)}get nominator(){return this.getField(21)}get denominator(){return this.getField(22)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"events",deprecated:!1,pointerRules:f},c.SignatureAutomation,!0),9:E.create({parent:this,fieldKey:9,fieldName:"index",deprecated:!1,pointerRules:f},"index","",0),10:E.create({parent:this,fieldKey:10,fieldName:"relativePosition",deprecated:!1,pointerRules:f},"positive","bars",1),21:E.create({parent:this,fieldKey:21,fieldName:"nominator",deprecated:!1,pointerRules:f},"positive","",4),22:E.create({parent:this,fieldKey:22,fieldName:"denominator",deprecated:!1,pointerRules:f},"positive","",4)}}};var wv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get in(){return this.getField(1)}get out(){return this.getField(2)}get inSlope(){return this.getField(3)}get outSlope(){return this.getField(4)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"in",deprecated:!1,pointerRules:f},"positive","ppqn",0),2:w.create({parent:this,fieldKey:2,fieldName:"out",deprecated:!1,pointerRules:f},"positive","ppqn",0),3:w.create({parent:this,fieldKey:3,fieldName:"inSlope",deprecated:!1,pointerRules:f},"unipolar","ratio",.75),4:w.create({parent:this,fieldKey:4,fieldName:"outSlope",deprecated:!1,pointerRules:f},"unipolar","ratio",.25)}}};var ja=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioRegionBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioRegionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioRegionBox,this)}get tags(){return r.Tags}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)}get fading(){return this.getField(18)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"regions",deprecated:!1,pointerRules:f},c.RegionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),3:C.create({parent:this,fieldKey:3,fieldName:"playback",deprecated:!0,pointerRules:f}),4:C.create({parent:this,fieldKey:4,fieldName:"timeBase",deprecated:!1,pointerRules:f},"musical"),5:N.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),6:N.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:f},c.Deprecated,!1),7:w.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:f},"any","seconds"),8:N.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:f},c.AudioPlayMode,!1),10:E.create({parent:this,fieldKey:10,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),11:w.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:f},"any","mixed"),12:w.create({parent:this,fieldKey:12,fieldName:"loopOffset",deprecated:!1,pointerRules:f},"any","mixed"),13:w.create({parent:this,fieldKey:13,fieldName:"loopDuration",deprecated:!1,pointerRules:f},"any","mixed"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:f}),15:C.create({parent:this,fieldKey:15,fieldName:"label",deprecated:!1,pointerRules:f}),16:E.create({parent:this,fieldKey:16,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0"),17:w.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!1,pointerRules:f},"decibel","db"),18:wv.create({parent:this,fieldKey:18,fieldName:"fading",deprecated:!1,pointerRules:f})}}};var Jc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioClipBox",pointerRules:{accepts:[c.Selection,c.Editing,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioClipBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioClipBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"clips",deprecated:!1,pointerRules:f},c.ClipCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:Ha.create({parent:this,fieldKey:4,fieldName:"triggerMode",deprecated:!1,pointerRules:f}),5:N.create({parent:this,fieldKey:5,fieldName:"events",deprecated:!1,pointerRules:f},c.ValueEventCollection,!0),6:N.create({parent:this,fieldKey:6,fieldName:"warping",deprecated:!0,pointerRules:f},c.Deprecated,!1),7:w.create({parent:this,fieldKey:7,fieldName:"waveformOffset",deprecated:!1,pointerRules:f},"any","seconds"),8:N.create({parent:this,fieldKey:8,fieldName:"playMode",deprecated:!1,pointerRules:f},c.AudioPlayMode,!1),10:w.create({parent:this,fieldKey:10,fieldName:"duration",deprecated:!1,pointerRules:f},"any","ppqn"),11:k.create({parent:this,fieldKey:11,fieldName:"mute",deprecated:!1,pointerRules:f}),12:C.create({parent:this,fieldKey:12,fieldName:"label",deprecated:!1,pointerRules:f}),13:E.create({parent:this,fieldKey:13,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0"),14:w.create({parent:this,fieldKey:14,fieldName:"gain",deprecated:!1,pointerRules:f},"decibel","db"),20:C.create({parent:this,fieldKey:20,fieldName:"playback",deprecated:!0,pointerRules:f}),21:C.create({parent:this,fieldKey:21,fieldName:"timeBase",deprecated:!1,pointerRules:f},"musical")}}};var Qc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioPitchStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioPitchStretchBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioPitchStretchBox,this)}get tags(){return r.Tags}get warpMarkers(){return this.getField(1)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0,exclusive:!1}})}}};var Yc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioTimeStretchBox",pointerRules:{accepts:[c.AudioPlayMode],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioTimeStretchBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioTimeStretchBox,this)}get tags(){return r.Tags}get warpMarkers(){return this.getField(1)}get transientPlayMode(){return this.getField(2)}get playbackRate(){return this.getField(3)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"warpMarkers",deprecated:!1,pointerRules:{accepts:[c.WarpMarkers],mandatory:!0,exclusive:!1}}),2:E.create({parent:this,fieldKey:2,fieldName:"transientPlayMode",deprecated:!1,pointerRules:f},"positive","enum",2),3:w.create({parent:this,fieldKey:3,fieldName:"playbackRate",deprecated:!1,pointerRules:f},"positive","ratio",1)}}};var zg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TransientMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TransientMarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitTransientMarkerBox,this)}get tags(){return r.Tags}get owner(){return this.getField(1)}get position(){return this.getField(2)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.TransientMarkers,!0),2:w.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"non-negative","seconds")}}};var La=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"WarpMarkerBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="WarpMarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitWarpMarkerBox,this)}get tags(){return r.Tags}get owner(){return this.getField(1)}get position(){return this.getField(2)}get seconds(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.WarpMarkers,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),3:w.create({parent:this,fieldKey:3,fieldName:"seconds",deprecated:!1,pointerRules:f},"non-negative","seconds")}}};var Xc=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MarkerBox",pointerRules:{accepts:[c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MarkerBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMarkerBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"track",deprecated:!1,pointerRules:f},c.MarkerTrack,!0),2:E.create({parent:this,fieldKey:2,fieldName:"position",deprecated:!1,pointerRules:f},"any","ppqn"),3:E.create({parent:this,fieldKey:3,fieldName:"plays",deprecated:!1,pointerRules:f},"non-negative","",1),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:f}),5:E.create({parent:this,fieldKey:5,fieldName:"hue",deprecated:!1,pointerRules:f},{min:0,max:360},"\xB0")}}};var br=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioFileBox",pointerRules:{accepts:[c.AudioFile,c.FileUploadState,c.MetaData],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="AudioFileBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioFileBox,this)}get tags(){return r.Tags}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:w.create({parent:this,fieldKey:1,fieldName:"startInSeconds",deprecated:!1,pointerRules:f},"non-negative","s"),2:w.create({parent:this,fieldKey:2,fieldName:"endInSeconds",deprecated:!1,pointerRules:f},"non-negative","s"),3:C.create({parent:this,fieldKey:3,fieldName:"fileName",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"transientMarkers",deprecated:!1,pointerRules:{accepts:[c.TransientMarkers],mandatory:!1,exclusive:!1}})}}};var Ao=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontFileBox",pointerRules:{accepts:[c.SoundfontFile],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="SoundfontFileBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitSoundfontFileBox,this)}get tags(){return r.Tags}get fileName(){return this.getField(1)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"fileName",deprecated:!1,pointerRules:f})}}};var Ug=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NeuralAmpModelBox",pointerRules:{accepts:[c.NeuralAmpModel],mandatory:!0,exclusive:!1},resource:"preserved",ephemeral:!1}),n)}static ClassName="NeuralAmpModelBox";static Resource="preserved";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitNeuralAmpModelBox,this)}get tags(){return r.Tags}get label(){return this.getField(1)}get model(){return this.getField(2)}initializeFields(){return{1:C.create({parent:this,fieldKey:1,fieldName:"label",deprecated:!1,pointerRules:f}),2:C.create({parent:this,fieldKey:2,fieldName:"model",deprecated:!1,pointerRules:f})}}};var yt=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioUnitBox",pointerRules:{accepts:[c.Selection,c.Automation,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioUnitBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioUnitBox,this)}get tags(){return r.Tags}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:f},"instrument"),2:N.create({parent:this,fieldKey:2,fieldName:"collection",deprecated:!1,pointerRules:f},c.AudioUnits,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1,exclusive:!1}}),11:E.create({parent:this,fieldKey:11,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),12:w.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-96,mid:-9,max:6,scaling:"decibel"},"dB"),13:w.create({parent:this,fieldKey:13,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),14:k.create({parent:this,fieldKey:14,fieldName:"mute",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),15:k.create({parent:this,fieldKey:15,fieldName:"solo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),20:Y.hook({parent:this,fieldKey:20,fieldName:"tracks",deprecated:!1,pointerRules:{accepts:[c.TrackCollection],mandatory:!1,exclusive:!1}}),21:Y.hook({parent:this,fieldKey:21,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MIDIEffectHost],mandatory:!1,exclusive:!1}}),22:Y.hook({parent:this,fieldKey:22,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.InstrumentHost,c.AudioOutput],mandatory:!1,exclusive:!0}}),23:Y.hook({parent:this,fieldKey:23,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1,exclusive:!1}}),24:Y.hook({parent:this,fieldKey:24,fieldName:"auxSends",deprecated:!1,pointerRules:{accepts:[c.AuxSend],mandatory:!1,exclusive:!1}}),25:N.create({parent:this,fieldKey:25,fieldName:"output",deprecated:!1,pointerRules:f},c.AudioOutput,!1),26:N.create({parent:this,fieldKey:26,fieldName:"capture",deprecated:!1,pointerRules:f},c.Capture,!1)}}};var Ka=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureAudioBox",pointerRules:{accepts:[c.Capture],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CaptureAudioBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitCaptureAudioBox,this)}get tags(){return r.Tags}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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:f},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"requestChannels",deprecated:!1,pointerRules:f},"any","",2),11:w.create({parent:this,fieldKey:11,fieldName:"gainDb",deprecated:!1,pointerRules:f},"decibel","dB",0)}}};var Wa=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CaptureMidiBox",pointerRules:{accepts:[c.Capture],mandatory:!0,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CaptureMidiBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitCaptureMidiBox,this)}get tags(){return r.Tags}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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"recordMode",deprecated:!1,pointerRules:f},"normal"),10:E.create({parent:this,fieldKey:10,fieldName:"channel",deprecated:!1,pointerRules:f},"any","",-1)}}};var $n=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AudioBusBox",pointerRules:{accepts:[c.SideChain,c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AudioBusBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAudioBusBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.AudioBusses,!0),2:N.create({parent:this,fieldKey:2,fieldName:"output",deprecated:!1,pointerRules:f},c.AudioOutput,!0),3:Y.hook({parent:this,fieldKey:3,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.AudioOutput],mandatory:!1,exclusive:!1}}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:C.create({parent:this,fieldKey:5,fieldName:"icon",deprecated:!1,pointerRules:f}),6:C.create({parent:this,fieldKey:6,fieldName:"label",deprecated:!1,pointerRules:f}),7:C.create({parent:this,fieldKey:7,fieldName:"color",deprecated:!1,pointerRules:f},"red"),8:k.create({parent:this,fieldKey:8,fieldName:"minimized",deprecated:!1,pointerRules:f})}}};var eu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"AuxSendBox",pointerRules:{accepts:[c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="AuxSendBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitAuxSendBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"audioUnit",deprecated:!1,pointerRules:f},c.AuxSend,!0),2:N.create({parent:this,fieldKey:2,fieldName:"targetBus",deprecated:!1,pointerRules:f},c.AudioOutput,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),4:E.create({parent:this,fieldKey:4,fieldName:"routing",deprecated:!1,pointerRules:f},{values:[0,1]},"",1),5:w.create({parent:this,fieldKey:5,fieldName:"sendGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB"),6:w.create({parent:this,fieldKey:6,fieldName:"sendPan",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","")}}};var tu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"GrooveShuffleBox",pointerRules:{accepts:[c.Groove],mandatory:!0,exclusive:!1},resource:"internal",ephemeral:!1}),n)}static ClassName="GrooveShuffleBox";static Resource="internal";static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitGrooveShuffleBox,this)}get tags(){return r.Tags}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:f}),10:w.create({parent:this,fieldKey:10,fieldName:"amount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.6),11:E.create({parent:this,fieldKey:11,fieldName:"duration",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"non-negative","ppqn",480)}}};var jg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownAudioEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UnknownAudioEffectDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitUnknownAudioEffectDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:f})}}};var Lg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"UnknownMidiEffectDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="UnknownMidiEffectDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitUnknownMidiEffectDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"comment",deprecated:!1,pointerRules:f})}}};var Kg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceInterfaceKnobBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="DeviceInterfaceKnobBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitDeviceInterfaceKnobBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"userInterface",deprecated:!1,pointerRules:f},c.DeviceUserInterface,!0),2:N.create({parent:this,fieldKey:2,fieldName:"parameter",deprecated:!1,pointerRules:f},c.ParameterController,!0),3:E.create({parent:this,fieldKey:3,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),10:w.create({parent:this,fieldKey:10,fieldName:"anchor",deprecated:!1,pointerRules:f},"unipolar","%"),11:C.create({parent:this,fieldKey:11,fieldName:"color",deprecated:!1,pointerRules:f})}}};var bv=class r extends qe{static create(e){return new r(e)}constructor(e){super(e)}get elements(){return this.getField(1)}initializeFields(){return{1:Y.hook({parent:this,fieldKey:1,fieldName:"elements",deprecated:!1,pointerRules:{accepts:[c.DeviceUserInterface],mandatory:!1,exclusive:!1}})}}};var Wg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitModularDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"modularSetup",deprecated:!1,pointerRules:f},c.ModularSetup,!0),11:bv.create({parent:this,fieldKey:11,fieldName:"userInterface",deprecated:!1,pointerRules:f})}}};var Zg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"StereoToolDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="StereoToolDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitStereoToolDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-72,mid:0,max:12,scaling:"decibel"},"dB",0),11:w.create({parent:this,fieldKey:11,fieldName:"panning",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),12:w.create({parent:this,fieldKey:12,fieldName:"stereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),13:k.create({parent:this,fieldKey:13,fieldName:"invertL",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),14:k.create({parent:this,fieldKey:14,fieldName:"invertR",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),15:k.create({parent:this,fieldKey:15,fieldName:"swap",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),20:E.create({parent:this,fieldKey:20,fieldName:"panningMixing",deprecated:!1,pointerRules:f},{values:[0,1]},"",1)}}};var Gg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MaximizerDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MaximizerDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitMaximizerDeviceBox,this)}get tags(){return r.Tags}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 threshold(){return this.getField(11)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:k.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:f},!0),11:w.create({parent:this,fieldKey:11,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-30,max:0,scaling:"linear"},"dB",0)}}};var ru=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CompressorDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CompressorDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitCompressorDeviceBox,this)}get tags(){return r.Tags}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)}get sideChain(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:k.create({parent:this,fieldKey:10,fieldName:"lookahead",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),11:k.create({parent:this,fieldKey:11,fieldName:"automakeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!0),12:k.create({parent:this,fieldKey:12,fieldName:"autoattack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),13:k.create({parent:this,fieldKey:13,fieldName:"autorelease",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),14:w.create({parent:this,fieldKey:14,fieldName:"inputgain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-30,max:30,scaling:"linear"},"dB",0),15:w.create({parent:this,fieldKey:15,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-60,max:0,scaling:"linear"},"dB",-10),16:w.create({parent:this,fieldKey:16,fieldName:"ratio",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:24,scaling:"exponential"},"",2),17:w.create({parent:this,fieldKey:17,fieldName:"knee",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),18:w.create({parent:this,fieldKey:18,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:100,scaling:"linear"},"ms",0),19:w.create({parent:this,fieldKey:19,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:5,max:1500,scaling:"linear"},"ms",25),20:w.create({parent:this,fieldKey:20,fieldName:"makeup",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-40,max:40,scaling:"linear"},"dB",0),21:w.create({parent:this,fieldKey:21,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),30:N.create({parent:this,fieldKey:30,fieldName:"sideChain",deprecated:!1,pointerRules:f},c.SideChain,!1)}}};var qg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"GateDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="GateDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitGateDeviceBox,this)}get tags(){return r.Tags}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 threshold(){return this.getField(10)}get return(){return this.getField(11)}get attack(){return this.getField(12)}get hold(){return this.getField(13)}get release(){return this.getField(14)}get floor(){return this.getField(15)}get inverse(){return this.getField(16)}get sideChain(){return this.getField(30)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"threshold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-60,max:0,scaling:"linear"},"dB",-6),11:w.create({parent:this,fieldKey:11,fieldName:"return",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),12:w.create({parent:this,fieldKey:12,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:50,scaling:"linear"},"ms",1),13:w.create({parent:this,fieldKey:13,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:500,scaling:"linear"},"ms",50),14:w.create({parent:this,fieldKey:14,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:2e3,scaling:"linear"},"ms",100),15:w.create({parent:this,fieldKey:15,fieldName:"floor",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-72,max:0,scaling:"linear"},"dB",-72),16:k.create({parent:this,fieldKey:16,fieldName:"inverse",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),30:N.create({parent:this,fieldKey:30,fieldName:"sideChain",deprecated:!1,pointerRules:f},c.SideChain,!1)}}};var Hg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DelayDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="DelayDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitDelayDeviceBox,this)}get tags(){return r.Tags}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 delayMusical(){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)}get preSyncTimeLeft(){return this.getField(16)}get preMillisTimeLeft(){return this.getField(17)}get preSyncTimeRight(){return this.getField(19)}get preMillisTimeRight(){return this.getField(20)}get delayMillis(){return this.getField(22)}get lfoSpeed(){return this.getField(23)}get lfoDepth(){return this.getField(24)}get version(){return this.getField(99)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"delayMusical",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",13),11:w.create({parent:this,fieldKey:11,fieldName:"feedback",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),12:w.create({parent:this,fieldKey:12,fieldName:"cross",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),13:w.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),14:w.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-6),15:w.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),16:w.create({parent:this,fieldKey:16,fieldName:"preSyncTimeLeft",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",8),17:w.create({parent:this,fieldKey:17,fieldName:"preMillisTimeLeft",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),19:w.create({parent:this,fieldKey:19,fieldName:"preSyncTimeRight",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","",0),20:w.create({parent:this,fieldKey:20,fieldName:"preMillisTimeRight",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),22:w.create({parent:this,fieldKey:22,fieldName:"delayMillis",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),23:w.create({parent:this,fieldKey:23,fieldName:"lfoSpeed",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.1,max:5,scaling:"exponential"},"Hz",.1),24:w.create({parent:this,fieldKey:24,fieldName:"lfoDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:50,scaling:"linear"},"ms",0),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:f},"any","")}}};var Jg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"CrusherDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="CrusherDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitCrusherDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"crush",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),11:E.create({parent:this,fieldKey:11,fieldName:"bits",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:16},"bits",16),12:w.create({parent:this,fieldKey:12,fieldName:"boost",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:24,scaling:"linear"},"dB",0),13:w.create({parent:this,fieldKey:13,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1)}}};var Qg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"DattorroReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="DattorroReverbDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitDattorroReverbDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1e3,scaling:"linear"},"ms",0),11:w.create({parent:this,fieldKey:11,fieldName:"bandwidth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.9999),12:w.create({parent:this,fieldKey:12,fieldName:"inputDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.75),13:w.create({parent:this,fieldKey:13,fieldName:"inputDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.625),14:w.create({parent:this,fieldKey:14,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.75),15:w.create({parent:this,fieldKey:15,fieldName:"decayDiffusion1",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.7),16:w.create({parent:this,fieldKey:16,fieldName:"decayDiffusion2",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),17:w.create({parent:this,fieldKey:17,fieldName:"damping",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.005),18:w.create({parent:this,fieldKey:18,fieldName:"excursionRate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),19:w.create({parent:this,fieldKey:19,fieldName:"excursionDepth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.7),20:w.create({parent:this,fieldKey:20,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-6),21:w.create({parent:this,fieldKey:21,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0)}}};var Yg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"VelocityDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="VelocityDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitVelocityDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"magnetPosition",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),11:w.create({parent:this,fieldKey:11,fieldName:"magnetStrength",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),12:E.create({parent:this,fieldKey:12,fieldName:"randomSeed",deprecated:!1,pointerRules:f},"any","",2048),13:w.create({parent:this,fieldKey:13,fieldName:"randomAmount",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),14:w.create({parent:this,fieldKey:14,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),15:w.create({parent:this,fieldKey:15,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1)}}};var Xg=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"FoldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="FoldDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitFoldDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"drive",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:30,scaling:"linear"},"dB",0),11:E.create({parent:this,fieldKey:11,fieldName:"overSampling",deprecated:!1,pointerRules:f},{length:3},"",0),12:w.create({parent:this,fieldKey:12,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-18,max:0,scaling:"linear"},"dB",0)}}};var ev=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TidalDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TidalDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitTidalDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"slope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",-.25),11:w.create({parent:this,fieldKey:11,fieldName:"symmetry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),20:w.create({parent:this,fieldKey:20,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",3),21:w.create({parent:this,fieldKey:21,fieldName:"depth",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","",1),22:w.create({parent:this,fieldKey:22,fieldName:"offset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0),23:w.create({parent:this,fieldKey:23,fieldName:"channelOffset",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-180,max:180,scaling:"linear"},"\xB0",0)}}};var th=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{length:4},""),12:w.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var rh=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:w.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-24,max:24,scaling:"linear"},"dB")}}};var cu=class r extends qe{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:k.create({parent:this,fieldKey:1,fieldName:"enabled",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}}),10:w.create({parent:this,fieldKey:10,fieldName:"frequency",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),11:w.create({parent:this,fieldKey:11,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-24,max:24,scaling:"linear"},"dB"),12:w.create({parent:this,fieldKey:12,fieldName:"q",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"")}}};var tv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"RevampDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="RevampDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitRevampDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:th.create({parent:this,fieldKey:10,fieldName:"highPass",deprecated:!1,pointerRules:f}),11:rh.create({parent:this,fieldKey:11,fieldName:"lowShelf",deprecated:!1,pointerRules:f}),12:cu.create({parent:this,fieldKey:12,fieldName:"lowBell",deprecated:!1,pointerRules:f}),13:cu.create({parent:this,fieldKey:13,fieldName:"midBell",deprecated:!1,pointerRules:f}),14:cu.create({parent:this,fieldKey:14,fieldName:"highBell",deprecated:!1,pointerRules:f}),15:rh.create({parent:this,fieldKey:15,fieldName:"highShelf",deprecated:!1,pointerRules:f}),16:th.create({parent:this,fieldKey:16,fieldName:"lowPass",deprecated:!1,pointerRules:f}),17:w.create({parent:this,fieldKey:17,fieldName:"gain",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-18,max:18,scaling:"linear"},"db")}}};var rv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ReverbDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ReverbDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitReverbDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),11:w.create({parent:this,fieldKey:11,fieldName:"preDelay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:.5,scaling:"exponential"},"s",0),12:w.create({parent:this,fieldKey:12,fieldName:"damp",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",.5),13:w.create({parent:this,fieldKey:13,fieldName:"filter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%",0),14:w.create({parent:this,fieldKey:14,fieldName:"wet",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-3),15:w.create({parent:this,fieldKey:15,fieldName:"dry",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0)}}};var Av=class r extends qe{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,exclusive:!1}},{values:[0,1,2,3]},""),2:w.create({parent:this,fieldKey:2,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:-3,max:3},"oct",0),4:w.create({parent:this,fieldKey:4,fieldName:"tune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-1200,max:1200,scaling:"linear"},"ct")}}};var _v=class r extends qe{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,exclusive:!1}},{values:[0,1,2,3]},""),2:w.create({parent:this,fieldKey:2,fieldName:"rate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1e-4,max:30,scaling:"exponential"},"Hz",1e-4),3:k.create({parent:this,fieldKey:3,fieldName:"sync",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},!1),10:w.create({parent:this,fieldKey:10,fieldName:"targetTune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),11:w.create({parent:this,fieldKey:11,fieldName:"targetCutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),12:w.create({parent:this,fieldKey:12,fieldName:"targetVolume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%")}}};var Pv=class r extends qe{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:w.create({parent:this,fieldKey:1,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),2:w.create({parent:this,fieldKey:2,fieldName:"hold",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),3:w.create({parent:this,fieldKey:3,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),4:w.create({parent:this,fieldKey:4,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","db",.001)}}};var iu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"VaporisateurDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="VaporisateurDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitVaporisateurDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},"any","oct"),12:w.create({parent:this,fieldKey:12,fieldName:"tune",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any","ct"),13:E.create({parent:this,fieldKey:13,fieldName:"waveform",deprecated:!0,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"any",""),14:w.create({parent:this,fieldKey:14,fieldName:"cutoff",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:20,max:2e4,scaling:"exponential"},"Hz"),15:w.create({parent:this,fieldKey:15,fieldName:"resonance",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.01,max:10,scaling:"exponential"},"q"),16:w.create({parent:this,fieldKey:16,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s"),17:w.create({parent:this,fieldKey:17,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s"),18:w.create({parent:this,fieldKey:18,fieldName:"filterEnvelope",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),19:w.create({parent:this,fieldKey:19,fieldName:"decay",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),20:w.create({parent:this,fieldKey:20,fieldName:"sustain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),21:w.create({parent:this,fieldKey:21,fieldName:"glideTime",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),22:E.create({parent:this,fieldKey:22,fieldName:"voicingMode",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{values:[1,3,5]},"",1),24:w.create({parent:this,fieldKey:24,fieldName:"unisonDetune",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:1,max:1200,scaling:"exponential"},"ct",30),25:w.create({parent:this,fieldKey:25,fieldName:"unisonStereo",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),26:E.create({parent:this,fieldKey:26,fieldName:"filterOrder",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{values:[1,2,3,4]},"",1),27:w.create({parent:this,fieldKey:27,fieldName:"filterKeyboard",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","%"),30:_v.create({parent:this,fieldKey:30,fieldName:"lfo",deprecated:!1,pointerRules:f}),40:Mg.create({parent:this,fieldKey:40,fieldName:"oscillators",deprecated:!1,pointerRules:f},e=>Av.create(e),2),50:Pv.create({parent:this,fieldKey:50,fieldName:"noise",deprecated:!1,pointerRules:f}),99:E.create({parent:this,fieldKey:99,fieldName:"version",deprecated:!1,pointerRules:f},"any","")}}};var Sv=class r extends qe{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:f}),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f})}}};var nu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:Sv.create({parent:this,fieldKey:10,fieldName:"deprecatedDevice",deprecated:!0,pointerRules:f}),11:E.create({parent:this,fieldKey:11,fieldName:"channel",deprecated:!1,pointerRules:f},{min:0,max:15},"ch"),12:E.create({parent:this,fieldKey:12,fieldName:"deprecatedDelay",deprecated:!0,pointerRules:f},"any","ms",10),13:Y.hook({parent:this,fieldKey:13,fieldName:"parameters",deprecated:!1,pointerRules:{accepts:[c.Parameter],mandatory:!1,exclusive:!1}}),14:N.create({parent:this,fieldKey:14,fieldName:"device",deprecated:!1,pointerRules:f},c.MIDIDevice,!1)}}};var Tn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"root",deprecated:!1,pointerRules:f},c.MIDIDevice,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.MIDIDevice],mandatory:!0,exclusive:!1}}),3:C.create({parent:this,fieldKey:3,fieldName:"id",deprecated:!1,pointerRules:f}),4:C.create({parent:this,fieldKey:4,fieldName:"label",deprecated:!1,pointerRules:f}),5:E.create({parent:this,fieldKey:5,fieldName:"delayInMs",deprecated:!1,pointerRules:f},{min:0,max:500},"ms",10),6:k.create({parent:this,fieldKey:6,fieldName:"sendTransportMessages",deprecated:!1,pointerRules:f},!0)}}};var Rn=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"MIDIOutputParameterBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="MIDIOutputParameterBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitMIDIOutputParameterBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"owner",deprecated:!1,pointerRules:f},c.Parameter,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f},""),3:E.create({parent:this,fieldKey:3,fieldName:"controller",deprecated:!1,pointerRules:f},{min:0,max:127},"#",64),4:w.create({parent:this,fieldKey:4,fieldName:"value",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!0,exclusive:!1}},"unipolar","%")}}};var ou=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"SoundfontDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="SoundfontDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitSoundfontDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"file",deprecated:!1,pointerRules:f},c.SoundfontFile,!1),11:E.create({parent:this,fieldKey:11,fieldName:"presetIndex",deprecated:!1,pointerRules:f},{min:0,max:65535},"")}}};var au=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NanoDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NanoDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitNanoDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"volume",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",-3),15:N.create({parent:this,fieldKey:15,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!1),20:w.create({parent:this,fieldKey:20,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:8,scaling:"exponential"},"s",.1)}}};var su=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PlayfieldDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes"});constructor(e){super(e)}accept(e){return P(e.visitPlayfieldDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:Y.hook({parent:this,fieldKey:10,fieldName:"samples",deprecated:!1,pointerRules:{accepts:[c.Sample],mandatory:!1,exclusive:!1}})}}};var Za=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldSampleBox",pointerRules:{accepts:[c.Editing,c.SideChain,c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PlayfieldSampleBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"notes",copyable:!1});constructor(e){super(e)}accept(e){return P(e.visitPlayfieldSampleBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:10,fieldName:"device",deprecated:!1,pointerRules:f},c.Sample,!0),11:N.create({parent:this,fieldKey:11,fieldName:"file",deprecated:!1,pointerRules:f},c.AudioFile,!0),12:Y.hook({parent:this,fieldKey:12,fieldName:"midiEffects",deprecated:!1,pointerRules:{accepts:[c.MIDIEffectHost],mandatory:!1,exclusive:!1}}),13:Y.hook({parent:this,fieldKey:13,fieldName:"audioEffects",deprecated:!1,pointerRules:{accepts:[c.AudioEffectHost],mandatory:!1,exclusive:!1}}),15:E.create({parent:this,fieldKey:15,fieldName:"index",deprecated:!1,pointerRules:f},{min:0,max:127},"",60),20:C.create({parent:this,fieldKey:20,fieldName:"label",deprecated:!0,pointerRules:f}),21:C.create({parent:this,fieldKey:21,fieldName:"icon",deprecated:!1,pointerRules:f}),22:k.create({parent:this,fieldKey:22,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),23:k.create({parent:this,fieldKey:23,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),40:k.create({parent:this,fieldKey:40,fieldName:"mute",deprecated:!1,pointerRules:f}),41:k.create({parent:this,fieldKey:41,fieldName:"solo",deprecated:!1,pointerRules:f}),42:k.create({parent:this,fieldKey:42,fieldName:"exclude",deprecated:!1,pointerRules:f}),43:k.create({parent:this,fieldKey:43,fieldName:"polyphone",deprecated:!1,pointerRules:f}),44:E.create({parent:this,fieldKey:44,fieldName:"gate",deprecated:!1,pointerRules:f},{length:3},"",0),45:w.create({parent:this,fieldKey:45,fieldName:"pitch",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-1200,max:1200,scaling:"linear"},"ct"),46:w.create({parent:this,fieldKey:46,fieldName:"sampleStart",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",0),47:w.create({parent:this,fieldKey:47,fieldName:"sampleEnd",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%",1),48:w.create({parent:this,fieldKey:48,fieldName:"attack",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.001),49:w.create({parent:this,fieldKey:49,fieldName:"release",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:.001,max:5,scaling:"exponential"},"s",.02)}}};var lu=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"TapeDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain,c.Automation],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="TapeDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"instrument",content:"audio"});constructor(e){super(e)}accept(e){return P(e.visitTapeDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.InstrumentHost,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:C.create({parent:this,fieldKey:3,fieldName:"icon",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:w.create({parent:this,fieldKey:10,fieldName:"flutter",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),11:w.create({parent:this,fieldKey:11,fieldName:"wow",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),12:w.create({parent:this,fieldKey:12,fieldName:"noise",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%"),13:w.create({parent:this,fieldKey:13,fieldName:"saturation",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"unipolar","%")}}};var iv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ArpeggioDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ArpeggioDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitArpeggioDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:E.create({parent:this,fieldKey:10,fieldName:"modeIndex",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!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,exclusive:!1}},{length:17},"",9),13:w.create({parent:this,fieldKey:13,fieldName:"gate",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:1,max:16},"",1),15:w.create({parent:this,fieldKey:15,fieldName:"velocity",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"bipolar","",0)}}};var nv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"PitchDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="PitchDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitPitchDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:E.create({parent:this,fieldKey:10,fieldName:"semiTones",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:-36,max:36},"st",0),11:w.create({parent:this,fieldKey:11,fieldName:"cents",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!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,exclusive:!1}},{min:-7,max:7},"oct",0)}}};var ov=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ZeitgeistDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ZeitgeistDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"midi-effect"});constructor(e){super(e)}accept(e){return P(e.visitZeitgeistDeviceBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.MIDIEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:N.create({parent:this,fieldKey:10,fieldName:"groove",deprecated:!1,pointerRules:f},c.Groove,!0)}}};var av=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"NeuralAmpDeviceBox",pointerRules:{accepts:[c.Device,c.Selection,c.MetaData,c.SideChain],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="NeuralAmpDeviceBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({type:"device",deviceType:"audio-effect"});constructor(e){super(e)}accept(e){return P(e.visitNeuralAmpDeviceBox,this)}get tags(){return r.Tags}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 modelJson(){return this.getField(10)}get inputGain(){return this.getField(11)}get outputGain(){return this.getField(12)}get mono(){return this.getField(13)}get mix(){return this.getField(14)}get model(){return this.getField(20)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"host",deprecated:!1,pointerRules:f},c.AudioEffectHost,!0),2:E.create({parent:this,fieldKey:2,fieldName:"index",deprecated:!1,pointerRules:f},"index",""),3:C.create({parent:this,fieldKey:3,fieldName:"label",deprecated:!1,pointerRules:f}),4:k.create({parent:this,fieldKey:4,fieldName:"enabled",deprecated:!1,pointerRules:f},!0),5:k.create({parent:this,fieldKey:5,fieldName:"minimized",deprecated:!1,pointerRules:f},!1),10:C.create({parent:this,fieldKey:10,fieldName:"modelJson",deprecated:!0,pointerRules:f}),11:w.create({parent:this,fieldKey:11,fieldName:"inputGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),12:w.create({parent:this,fieldKey:12,fieldName:"outputGain",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},"decibel","dB",0),13:k.create({parent:this,fieldKey:13,fieldName:"mono",deprecated:!1,pointerRules:f},!0),14:w.create({parent:this,fieldKey:14,fieldName:"mix",deprecated:!1,pointerRules:{accepts:[c.Modulation,c.Automation,c.MIDIControl],mandatory:!1,exclusive:!1}},{min:0,max:1,scaling:"linear"},"%",1),20:N.create({parent:this,fieldKey:20,fieldName:"model",deprecated:!1,pointerRules:f},c.NeuralAmpModel,!1)}}};var sv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ModularBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularBox,this)}get tags(){return r.Tags}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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ModularSetup,!0),2:Y.hook({parent:this,fieldKey:2,fieldName:"device",deprecated:!1,pointerRules:{accepts:[c.ModularSetup],mandatory:!0,exclusive:!1}}),3:Y.hook({parent:this,fieldKey:3,fieldName:"editing",deprecated:!1,pointerRules:{accepts:[c.Editing],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"modules",deprecated:!1,pointerRules:{accepts:[c.ModuleCollection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"connections",deprecated:!1,pointerRules:{accepts:[c.ConnectionCollection],mandatory:!1,exclusive:!1}}),13:C.create({parent:this,fieldKey:13,fieldName:"label",deprecated:!1,pointerRules:f})}}};var lv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleConnectionBox",pointerRules:f,resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleConnectionBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleConnectionBox,this)}get tags(){return r.Tags}get collection(){return this.getField(1)}get source(){return this.getField(2)}get target(){return this.getField(3)}initializeFields(){return{1:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ConnectionCollection,!0),2:N.create({parent:this,fieldKey:2,fieldName:"source",deprecated:!1,pointerRules:f},c.VoltageConnection,!0),3:N.create({parent:this,fieldKey:3,fieldName:"target",deprecated:!1,pointerRules:f},c.VoltageConnection,!0)}}};var Ji=class r extends qe{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:N.create({parent:this,fieldKey:1,fieldName:"collection",deprecated:!1,pointerRules:f},c.ModuleCollection,!0),2:C.create({parent:this,fieldKey:2,fieldName:"label",deprecated:!1,pointerRules:f}),3:E.create({parent:this,fieldKey:3,fieldName:"x",deprecated:!1,pointerRules:f},"any","x"),4:E.create({parent:this,fieldKey:4,fieldName:"y",deprecated:!1,pointerRules:f},"any","y"),5:k.create({parent:this,fieldKey:5,fieldName:"collapsed",deprecated:!1,pointerRules:f},!1),6:k.create({parent:this,fieldKey:6,fieldName:"removable",deprecated:!1,pointerRules:f},!0)}}};var cv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioInputBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularAudioInputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularAudioInputBox,this)}get tags(){return r.Tags}get attributes(){return this.getField(1)}get output(){return this.getField(10)}initializeFields(){return{1:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"output",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}})}}};var uv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioOutputBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModularAudioOutputBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModularAudioOutputBox,this)}get tags(){return r.Tags}get attributes(){return this.getField(1)}get input(){return this.getField(10)}initializeFields(){return{1:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"input",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}})}}};var dv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleDelayBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleDelayBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleDelayBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"time",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1,exclusive:!1}},{min:1,max:1e3,scaling:"exponential"},"ms",500)}}};var pv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleMultiplierBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleMultiplierBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleMultiplierBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInputX",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),11:Y.hook({parent:this,fieldKey:11,fieldName:"voltageInputY",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"multiplier",deprecated:!1,pointerRules:f},"unipolar","%")}}};var hv=class r extends M{static create(e,t,n){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleGainBox",pointerRules:{accepts:[c.Selection],mandatory:!1,exclusive:!1},resource:void 0,ephemeral:!1}),n)}static ClassName="ModuleGainBox";static Resource=void 0;static Ephemeral=!1;static Tags=Object.freeze({});constructor(e){super(e)}accept(e){return P(e.visitModuleGainBox,this)}get tags(){return r.Tags}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:Ji.create({parent:this,fieldKey:1,fieldName:"attributes",deprecated:!1,pointerRules:f}),10:Y.hook({parent:this,fieldKey:10,fieldName:"voltageInput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),12:Y.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",deprecated:!1,pointerRules:{accepts:[c.VoltageConnection],mandatory:!1,exclusive:!1}}),20:w.create({parent:this,fieldKey:20,fieldName:"gain",deprecated:!1,pointerRules:{accepts:[c.ParameterController],mandatory:!1,exclusive:!1}},"decibel","dB")}}};var Ev=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 fB=(r,e)=>{if(r===e)return 0;let t=r-e;return t===0?D(`Indices cannot be equal (${r}, ${e})`):t};var sa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ar=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fv,Cn,Ja,Bv,la,sr=class r{static create(e,t,n){return new r(e,t,n)}constructor(e,t,n){Fv.set(this,void 0),Cn.set(this,void 0),Ja.set(this,void 0),Bv.set(this,void 0),la.set(this,null),sa(this,Fv,e,"f"),sa(this,Cn,b.newSet(i=>i.adapter.uuid),"f"),sa(this,Ja,new ar,"f"),sa(this,Bv,e.pointerHub.catchupAndSubscribe({onAdded:i=>{sa(this,la,null,"f");let o=t(i.box),a=o.indexField.subscribe(()=>{sa(this,la,null,"f"),Ar(this,Ja,"f").proxy.onReorder(o)}),s=Ar(this,Cn,"f").add({adapter:o,subscription:a});V(s,`Could not add ${o}`),Ar(this,Ja,"f").proxy.onAdd(o)},onRemoved:i=>{sa(this,la,null,"f");let o=i.box.address.uuid,{adapter:a,subscription:s}=Ar(this,Cn,"f").removeByKey(o);s.terminate(),Ar(this,Ja,"f").proxy.onRemove(a)}},n),"f")}field(){return Ar(this,Fv,"f")}subscribe(e){return Ar(this,Ja,"f").subscribe(e)}catchupAndSubscribe(e){return Ar(this,Cn,"f").forEach(({adapter:t})=>e.onAdd(t)),this.subscribe(e)}getAdapterByIndex(e){let t=ct.exactMapped(this.adapters(),e,fB,n=>n.indexField.getValue());return t===-1?m.None:m.wrap(this.adapters()[t])}getAdapterById(e){return Ar(this,Cn,"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 Ar(this,la,"f")===null&&sa(this,la,Ar(this,Cn,"f").values().map(({adapter:e})=>e).sort((e,t)=>e.indexField.getValue()-t.indexField.getValue()),"f"),Ar(this,la,"f")}move(e,t){this.moveIndex(e.indexField.getValue(),t)}moveIndex(e,t){let n=this.adapters(),i=n[e];if(t<0){let o=be(e+t,0,n.length-1);for(let a=o;a<e;a++)n[a].indexField.setValue(a+1);i.indexField.setValue(o)}else if(t>1){let o=be(e+(t-1),0,n.length-1);for(let a=e;a<o;a++)n[a+1].indexField.setValue(a);i.indexField.setValue(o)}else console.warn(`moveIndex had no effect: startIndex: ${e}, delta: ${t}`)}size(){return Ar(this,Cn,"f").size()}isEmpty(){return this.size()===0}terminate(){sa(this,la,null,"f"),Ar(this,Cn,"f").forEach(({subscription:e})=>e.terminate()),Ar(this,Cn,"f").clear(),Ar(this,Ja,"f").terminate(),Ar(this,Bv,"f").terminate()}};Fv=new WeakMap,Cn=new WeakMap,Ja=new WeakMap,Bv=new WeakMap,la=new WeakMap;var li;(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 n=e.pointerHub.filter(c.ValueInterpolation).at(0)?.box;q(n)?(W0(n,Ua),n.slope.setValue(t.slope)):Ua.create(e.box.graph,b.generate(),i=>{i.slope.setValue(t.slope),i.event.refer(e)})}},r.read=e=>{let t=e.pointerHub.incoming().at(0)?.box;return q(t)?(W0(t,Ua),{type:"curve",slope:t.slope.getValue()}):e.getValue()===0?si.None:e.getValue()===1?si.Linear:D("Unknown Interpolation value")}})(li||(li={}));var Qa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ih,uu,$t,nh,Ya,oh,ca=class r{constructor(e,t){this.type="value-event",ih.set(this,new j),uu.set(this,void 0),$t.set(this,void 0),nh.set(this,void 0),Ya.set(this,void 0),oh.set(this,!1),Qa(this,uu,e,"f"),Qa(this,$t,t,"f"),Qa(this,nh,Xe(this,ih,"f").own(new sg(()=>li.read(Xe(this,$t,"f").interpolation))),"f");let n=()=>{Xe(this,nh,"f").invalidate(),this.collection.ifSome(i=>i.onEventPropertyChanged())};Xe(this,ih,"f").ownAll(Xe(this,$t,"f").subscribe(Ue.Children,i=>{if(!this.collection.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let o=this.collection.unwrap(),a=i.address.fieldKeys,s=U.equals(Xe(this,$t,"f").index.address.fieldKeys,a),l=U.equals(Xe(this,$t,"f").position.address.fieldKeys,a);s||l?o.requestSorting():o.onEventPropertyChanged()}}),Xe(this,$t,"f").interpolation.subscribe(n),Xe(this,$t,"f").interpolation.pointerHub.subscribe({onAdded:({box:i})=>{Xe(this,Ya,"f").terminate(),Qa(this,Ya,i.subscribe(Ue.Children,n),"f"),n()},onRemoved:()=>{Xe(this,Ya,"f").terminate(),Qa(this,Ya,ee.Empty,"f"),n()}})),Qa(this,Ya,Xe(this,$t,"f").interpolation.pointerHub.filter(c.ValueInterpolation).at(0)?.box.subscribe(Ue.Children,n)??ee.Empty,"f")}onSelected(){Qa(this,oh,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Qa(this,oh,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Xe(this,Ya,"f").terminate(),Xe(this,ih,"f").terminate()}get box(){return Xe(this,$t,"f")}get uuid(){return Xe(this,$t,"f").address.uuid}get address(){return Xe(this,$t,"f").address}get position(){return Xe(this,$t,"f").position.getValue()}get index(){return Xe(this,$t,"f").index.getValue()}set interpolation(e){li.write(Xe(this,$t,"f").interpolation,e)}get interpolation(){return Xe(this,nh,"f").get()}get value(){return Xe(this,$t,"f").value.getValue()}get isSelected(){return Xe(this,oh,"f")}get collection(){return Xe(this,$t,"f").events.targetVertex.map(e=>Xe(this,uu,"f").boxAdapters.adapterFor(e.box,_r))}copyTo(e){let t=e?.position??this.position,n=e?.index??this.index,i=Mn.create(Xe(this,uu,"f").boxGraph,b.generate(),o=>{o.position.setValue(t),o.index.setValue(n),o.events.refer(e?.events??this.collection.unwrap().box.events),o.value.setValue(e?.value??this.value)});return li.write(i.interpolation,e?.interpolation??this.interpolation),Xe(this,uu,"f").boxAdapters.adapterFor(i,r)}copyFrom(e){return Xe(this,$t,"f").position.setValue(e?.position??this.position),Xe(this,$t,"f").index.setValue(e?.index??this.index),Xe(this,$t,"f").events.refer(e?.events??this.collection.unwrap().box.events),Xe(this,$t,"f").value.setValue(e?.value??this.value),li.write(Xe(this,$t,"f").interpolation,e?.interpolation??this.interpolation),this}toString(){return`{ValueEventBoxAdapter position: ${this.position} index: ${this.index}}`}};ih=new WeakMap,uu=new WeakMap,$t=new WeakMap,nh=new WeakMap,Ya=new WeakMap,oh=new WeakMap;ca.Comparator=(r,e)=>{if(r===e)return D(`${r} is equal to itself`);let t=r.position-e.position;if(t!==0)return t;let n=r.index-e.index;return n!==0?n:D(`${r} and ${e} are identical in terms of comparison`)};var ah=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Qe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sh,lh,Xa,Qi,dl,du,ua,Nv,_r=class r{constructor(e,t){sh.add(this),lh.set(this,new j),Xa.set(this,void 0),Qi.set(this,void 0),dl.set(this,void 0),du.set(this,void 0),ua.set(this,void 0),ah(this,Xa,e,"f"),ah(this,Qi,t,"f"),ah(this,dl,new ce,"f"),ah(this,du,b.newSet(i=>i.uuid),"f"),ah(this,ua,ai.create(ca.Comparator),"f");let n=i=>{let o=he(i.accept({visitValueEventBox:a=>Qe(this,Xa,"f").boxAdapters.adapterFor(a,ca)}),`Could not find adapter for ${i}`);Qe(this,du,"f").add(o)&&(Qe(this,ua,"f").add(o),Qe(this,sh,"m",Nv).call(this))};Qe(this,Qi,"f").events.pointerHub.incoming().forEach(({box:i})=>n(i)),Qe(this,lh,"f").own(Qe(this,Qi,"f").events.pointerHub.subscribe({onAdded:({box:i})=>n(i),onRemoved:({box:{address:{uuid:i}}})=>{Qe(this,ua,"f").remove(Qe(this,du,"f").removeByKey(i)),Qe(this,sh,"m",Nv).call(this)}})),Qe(this,lh,"f").own(Qe(this,Qi,"f").owners.pointerHub.subscribe({onAdded:()=>Qe(this,dl,"f").notify(this),onRemoved:()=>Qe(this,dl,"f").notify(this)}))}valueAt(e,t){return Ig.valueAt(Qe(this,ua,"f"),e,t)}copy(){let e=Qe(this,Xa,"f").boxGraph,t=kn.create(e,b.generate());return Qe(this,ua,"f").asArray().forEach(n=>n.copyTo({events:t.events})),Qe(this,Xa,"f").boxAdapters.adapterFor(t,r)}cut(e,t=A.unipolar()){let n=this.events.lowerEqual(e),i=this.events.greaterEqual(e);if(i===null)return n===null?m.None:m.wrap(this.createEvent({position:e,value:n.value,index:n.index,interpolation:n.interpolation}));if(n===null)return m.wrap(this.createEvent({position:e,value:i.value,index:i.index,interpolation:i.interpolation}));if(n.position===e)return m.wrap(n);if(i.position===e)return m.wrap(i);if(n.interpolation.type==="none")return m.wrap(this.createEvent({position:e,value:n.value,index:n.index,interpolation:n.interpolation}));if(n.interpolation.type==="linear"){let{position:o}=n,{position:a}=i,s=t.x(n.value),l=t.x(i.value),u=lg(s,l,(e-o)/(a-o));return m.wrap(this.createEvent({position:e,value:t.y(u),index:0,interpolation:n.interpolation}))}if(n.interpolation.type==="curve"){let{position:o}=n,{position:a}=i,s=t.x(n.value),l=t.x(i.value),u=a-o,p=e-o,d=vr.byHalf(u,s,vr.valueAt({slope:n.interpolation.slope,steps:u,y0:s,y1:l},u*.5),l),h=vr.valueAt(d,p),g=vr.slopeByHalf(s,vr.valueAt(d,p*.5),h);return li.write(n.box.interpolation,si.Curve(g)),m.wrap(this.createEvent({position:e,value:t.y(h),index:0,interpolation:si.Curve(vr.slopeByHalf(h,vr.valueAt(d,(p+u)*.5),l))}))}return D("Unknown interpolation type")}subscribeChange(e){return Qe(this,dl,"f").subscribe(e)}createEvent({position:e,index:t,value:n,interpolation:i}){let o=Math.trunc(e),a=Qe(this,du,"f").values().find(l=>l.position===o&&l.index===t);if(q(a)&&a.box.isAttached())return a.box.value.setValue(n),li.write(a.box.interpolation,i),a;let s=Mn.create(Qe(this,Xa,"f").boxGraph,b.generate(),l=>{l.position.setValue(e),l.index.setValue(t),l.value.setValue(n),l.events.refer(Qe(this,Qi,"f").events)});return li.write(s.interpolation,i),Qe(this,Xa,"f").boxAdapters.adapterFor(s,ca)}requestSorting(){Qe(this,ua,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Qe(this,sh,"m",Nv).call(this)}terminate(){Qe(this,lh,"f").terminate()}get box(){return Qe(this,Qi,"f")}get uuid(){return Qe(this,Qi,"f").address.uuid}get address(){return Qe(this,Qi,"f").address}get numOwners(){return Qe(this,Qi,"f").owners.pointerHub.filter(c.ValueEventCollection).length}get events(){return Qe(this,ua,"f")}toString(){return`{ValueEventCollectionBox ${b.toString(Qe(this,Qi,"f").address.uuid)}}`}};lh=new WeakMap,Xa=new WeakMap,Qi=new WeakMap,dl=new WeakMap,du=new WeakMap,ua=new WeakMap,sh=new WeakSet,Nv=function(){Qe(this,dl,"f").notify(this)};var pl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ze=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hl,es,fl,Yt,ml,dh,ch,uh,pu,ts=class{constructor(e,t){hl.add(this),this.type="value-clip",es.set(this,new j),fl.set(this,void 0),Yt.set(this,void 0),ml.set(this,void 0),dh.set(this,void 0),ch.set(this,void 0),uh.set(this,ee.Empty),pl(this,fl,e,"f"),pl(this,Yt,t,"f"),pl(this,ch,!0,"f"),pl(this,ml,ze(this,es,"f").own(new Hi(!1)),"f"),pl(this,dh,ze(this,es,"f").own(new ce),"f"),ze(this,es,"f").own(ze(this,Yt,"f").pointerHub.subscribe({onAdded:()=>ze(this,hl,"m",pu).call(this),onRemoved:()=>ze(this,hl,"m",pu).call(this)})),ze(this,es,"f").own(ze(this,Yt,"f").subscribe(Ue.Children,n=>ze(this,hl,"m",pu).call(this))),ze(this,es,"f").own(ze(this,Yt,"f").events.catchupAndSubscribe(({targetVertex:n})=>{ze(this,uh,"f").terminate(),pl(this,uh,n.match({none:()=>ee.Empty,some:({box:i})=>ze(this,fl,"f").boxAdapters.adapterFor(i,_r).subscribeChange(()=>ze(this,hl,"m",pu).call(this))}),"f"),ze(this,hl,"m",pu).call(this)})),pl(this,ch,!1,"f")}valueAt(e,t){let n=this.optCollection;return n.isEmpty()?t:n.unwrap().valueAt(e%this.duration,t)}catchupAndSubscribeSelected(e){return ze(this,ml,"f").catchupAndSubscribe(e)}subscribeChange(e){return ze(this,dh,"f").subscribe(e)}accept(e){return P(e.visitValueClipBoxAdapter,this)}consolidate(){this.isMirrowed&&ze(this,Yt,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:ze(this,Yt,"f").events.targetVertex.unwrap();qc.create(ze(this,fl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(ze(this,Yt,"f").clips.targetVertex.unwrap()),n.events.refer(t)})}onSelected(){ze(this,ml,"f").setValue(!0)}onDeselected(){ze(this,ml,"f").setValue(!1)}get isSelected(){return ze(this,ml,"f").getValue()}terminate(){ze(this,uh,"f").terminate(),ze(this,es,"f").terminate()}get box(){return ze(this,Yt,"f")}get uuid(){return ze(this,Yt,"f").address.uuid}get address(){return ze(this,Yt,"f").address}get indexField(){return ze(this,Yt,"f").index}get duration(){return ze(this,Yt,"f").duration.getValue()}get mute(){return ze(this,Yt,"f").mute.getValue()}get hue(){return ze(this,Yt,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return ze(this,Yt,"f").events.targetVertex.map(e=>ze(this,fl,"f").boxAdapters.adapterFor(e.box,_r))}get label(){return ze(this,Yt,"f").label.getValue()}get trackBoxAdapter(){return ze(this,ch,"f")?m.None:ze(this,Yt,"f").clips.targetVertex.map(e=>ze(this,fl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{ValueClipBoxAdapter ${b.toString(ze(this,Yt,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};es=new WeakMap,fl=new WeakMap,Yt=new WeakMap,ml=new WeakMap,dh=new WeakMap,ch=new WeakMap,uh=new WeakMap,hl=new WeakSet,pu=function(){ze(this,dh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var mB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},hu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hA,gl,Iv,fu=class{constructor(e){this.type="transient-marker",hA.set(this,new j),gl.set(this,void 0),Iv.set(this,void 0),mB(this,gl,e,"f"),mB(this,Iv,new ce,"f")}get box(){return hu(this,gl,"f")}get uuid(){return hu(this,gl,"f").address.uuid}get address(){return hu(this,gl,"f").address}get position(){return hu(this,gl,"f").position.getValue()}subscribe(e){return hu(this,Iv,"f").subscribe(e)}terminate(){hu(this,hA,"f").terminate()}};hA=new WeakMap,gl=new WeakMap,Iv=new WeakMap;var ph=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Pr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Dv,hh,Po,fh,mu,Mv,On=class r{constructor(e,t){Dv.set(this,new j),hh.set(this,void 0),Po.set(this,void 0),fh.set(this,void 0),mu.set(this,void 0),Mv.set(this,void 0),ph(this,hh,e,"f"),ph(this,Po,t,"f"),ph(this,fh,b.newSet(({uuid:n})=>n),"f"),ph(this,mu,ai.create(r.Comparator),"f"),ph(this,Mv,Tg.memoizeAsync(async()=>{if(this.data.nonEmpty())return this.data.unwrap();let{promise:n,resolve:i,reject:o}=Promise.withResolvers(),a=this.getOrCreateLoader(),s=a.subscribe(l=>{l.type==="loaded"?(queueMicrotask(()=>s.terminate()),i(a.data.unwrap("State mismatch"))):l.type==="error"&&(queueMicrotask(()=>s.terminate()),o(new Error(l.reason)))});return n}),"f"),Pr(this,Dv,"f").ownAll(t.transientMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Pr(this,hh,"f").boxAdapters.adapterFor(n.box,fu);Pr(this,fh,"f").add(i)&&Pr(this,mu,"f").add(i)},onRemoved:({box:{address:{uuid:n}}})=>{Pr(this,mu,"f").remove(Pr(this,fh,"f").removeByKey(n))}}))}get box(){return Pr(this,Po,"f")}get uuid(){return Pr(this,Po,"f").address.uuid}get address(){return Pr(this,Po,"f").address}get startInSeconds(){return Pr(this,Po,"f").startInSeconds.getValue()}get endInSeconds(){return Pr(this,Po,"f").endInSeconds.getValue()}get transients(){return Pr(this,mu,"f")}get fileName(){return Pr(this,Po,"f").fileName.getValue()}get data(){return this.getOrCreateLoader().data}get peaks(){return this.getOrCreateLoader().peaks}get audioData(){return Pr(this,Mv,"f").call(this)}getOrCreateLoader(){return Pr(this,hh,"f").sampleManager.getOrCreate(Pr(this,Po,"f").address.uuid)}terminate(){Pr(this,Dv,"f").terminate()}};Dv=new WeakMap,hh=new WeakMap,Po=new WeakMap,fh=new WeakMap,mu=new WeakMap,Mv=new WeakMap;On.Comparator=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),D("Events at the same position: "+r.position+", "+e.position)):t};var mh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Gr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},gh,kv,$v,da,yh,vh,Tv,rs=class{constructor(e,t){gh.add(this),this.type="warp-marker",kv.set(this,new j),$v.set(this,void 0),da.set(this,void 0),yh.set(this,void 0),vh.set(this,!1),mh(this,$v,e,"f"),mh(this,da,t,"f"),mh(this,yh,new ce,"f"),Gr(this,kv,"f").own(t.subscribe(Ue.Children,()=>Gr(this,gh,"m",Tv).call(this)))}onSelected(){mh(this,vh,!0,"f"),this.optWarping.ifSome(e=>e.onChanged()),Gr(this,gh,"m",Tv).call(this)}onDeselected(){mh(this,vh,!1,"f"),Gr(this,gh,"m",Tv).call(this)}get box(){return Gr(this,da,"f")}get uuid(){return Gr(this,da,"f").address.uuid}get address(){return Gr(this,da,"f").address}get position(){return Gr(this,da,"f").position.getValue()}get seconds(){return Gr(this,da,"f").seconds.getValue()}get isSelected(){return Gr(this,vh,"f")}get optWarping(){return Gr(this,da,"f").owner.targetVertex.map(e=>Gr(this,$v,"f").boxAdapters.adapterFor(e.box,So.isAudioPlayMode))}get isAnchor(){return this.optWarping.mapOr(({warpMarkers:e})=>this===e.optAt(0)||this===e.optAt(e.length()-1),!1)}subscribe(e){return Gr(this,yh,"f").subscribe(e)}terminate(){Gr(this,kv,"f").terminate()}};kv=new WeakMap,$v=new WeakMap,da=new WeakMap,yh=new WeakMap,vh=new WeakMap,gh=new WeakSet,Tv=function(){Gr(this,yh,"f").notify(),this.optWarping.ifSome(e=>e.onChanged())};var Rv=(r,e)=>{let t=r.position-e.position;return t===0?(console.warn(r,e),D("Events at the same position: "+r.position+", "+e.position)):t};var xh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Tr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Cv,Ov,vl,yl,wh,gu,Eo=class{constructor(e,t){Cv.set(this,new j),Ov.set(this,void 0),vl.set(this,void 0),yl.set(this,void 0),wh.set(this,void 0),gu.set(this,void 0),xh(this,Ov,e,"f"),xh(this,vl,t,"f"),xh(this,yl,new ce,"f"),xh(this,wh,b.newSet(({uuid:n})=>n),"f"),xh(this,gu,ai.create(Rv),"f"),Tr(this,Cv,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Tr(this,Ov,"f").boxAdapters.adapterFor(n.box,rs);Tr(this,wh,"f").add(i)&&(Tr(this,gu,"f").add(i),Tr(this,yl,"f").notify())},onRemoved:({box:{address:{uuid:n}}})=>{Tr(this,gu,"f").remove(Tr(this,wh,"f").removeByKey(n)),Tr(this,yl,"f").notify()}}))}get box(){return Tr(this,vl,"f")}get uuid(){return Tr(this,vl,"f").address.uuid}get address(){return Tr(this,vl,"f").address}get warpMarkers(){return Tr(this,gu,"f")}clone(){let e=Qc.create(Tr(this,vl,"f").graph,b.generate());return this.warpMarkers.asArray().forEach(t=>La.create(e.graph,b.generate(),n=>{n.position.setValue(t.position),n.seconds.setValue(t.seconds),n.owner.refer(e.warpMarkers)})),e}subscribe(e){return Tr(this,yl,"f").subscribe(e)}onChanged(){Tr(this,yl,"f").notify()}terminate(){Tr(this,Cv,"f").terminate()}};Cv=new WeakMap,Ov=new WeakMap,vl=new WeakMap,yl=new WeakMap,wh=new WeakMap,gu=new WeakMap;var bh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Vv,zv,Vn,xl,Ah,vu,Fo=class{constructor(e,t){Vv.set(this,new j),zv.set(this,void 0),Vn.set(this,void 0),xl.set(this,void 0),Ah.set(this,void 0),vu.set(this,void 0),bh(this,zv,e,"f"),bh(this,Vn,t,"f"),bh(this,xl,new ce,"f"),bh(this,Ah,b.newSet(({uuid:n})=>n),"f"),bh(this,vu,ai.create(Rv),"f"),Xt(this,Vv,"f").ownAll(t.warpMarkers.pointerHub.catchupAndSubscribe({onAdded:n=>{let i=Xt(this,zv,"f").boxAdapters.adapterFor(n.box,rs);Xt(this,Ah,"f").add(i)&&(Xt(this,vu,"f").add(i),Xt(this,xl,"f").notify())},onRemoved:({box:{address:{uuid:n}}})=>{Xt(this,vu,"f").remove(Xt(this,Ah,"f").removeByKey(n)),Xt(this,xl,"f").notify()}}))}get box(){return Xt(this,Vn,"f")}get uuid(){return Xt(this,Vn,"f").address.uuid}get address(){return Xt(this,Vn,"f").address}get warpMarkers(){return Xt(this,vu,"f")}get playbackRate(){return Xt(this,Vn,"f").playbackRate.getValue()}get cents(){return Math.log2(Xt(this,Vn,"f").playbackRate.getValue())*1200}set cents(e){Xt(this,Vn,"f").playbackRate.setValue(be(2**(e/1200),.5,2))}get transientPlayMode(){return Gi(Xt(this,Vn,"f").transientPlayMode.getValue(),qa)}clone(){let e=Yc.create(Xt(this,Vn,"f").graph,b.generate(),t=>{t.transientPlayMode.setValue(this.transientPlayMode),t.playbackRate.setValue(this.playbackRate),t.warpMarkers});return this.warpMarkers.asArray().forEach(t=>La.create(e.graph,b.generate(),n=>{n.position.setValue(t.position),n.seconds.setValue(t.seconds),n.owner.refer(e.warpMarkers)})),e}subscribe(e){return Xt(this,xl,"f").subscribe(e)}onChanged(){Xt(this,xl,"f").notify()}terminate(){Xt(this,Vv,"f").terminate()}};Vv=new WeakMap,zv=new WeakMap,Vn=new WeakMap,xl=new WeakMap,Ah=new WeakMap,vu=new WeakMap;var So;(function(r){r.isAudioPlayMode=e=>e instanceof Eo||e instanceof Fo})(So||(So={}));var Si=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ve=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},wl,yu,bl,Tt,Al,_l,_h,Sh,Ph,Pl,xu,wu,bu,is=class{constructor(e,t){wl.add(this),this.type="audio-clip",yu.set(this,new j),bl.set(this,void 0),Tt.set(this,void 0),Al.set(this,void 0),_l.set(this,void 0),_h.set(this,void 0),Sh.set(this,void 0),Ph.set(this,void 0),Pl.set(this,m.None),xu.set(this,m.None),wu.set(this,ee.Empty),Si(this,bl,e,"f"),Si(this,Tt,t,"f"),Si(this,Ph,!0,"f"),Si(this,Al,new Mr,"f"),Si(this,_l,ve(this,yu,"f").own(new Hi(!1)),"f"),Si(this,_h,Ys.aware(e.tempoMap,t.timeBase,t.duration),"f"),Si(this,Sh,ve(this,yu,"f").own(new ce),"f"),ve(this,yu,"f").ownAll(ve(this,Tt,"f").pointerHub.subscribe({onAdded:()=>ve(this,wl,"m",bu).call(this),onRemoved:()=>ve(this,wl,"m",bu).call(this)}),ve(this,Tt,"f").playMode.catchupAndSubscribe(({targetVertex:n})=>{ve(this,wu,"f").terminate(),n.match({none:()=>ve(this,Al,"f").clear(),some:({box:i})=>{let o=ve(this,bl,"f").boxAdapters.adapterFor(i,So.isAudioPlayMode);Si(this,wu,o.subscribe(()=>ve(this,wl,"m",bu).call(this)),"f"),ve(this,Al,"f").wrap(o)}})}),ve(this,Tt,"f").file.catchupAndSubscribe(n=>{Si(this,Pl,n.targetVertex.map(i=>ve(this,bl,"f").boxAdapters.adapterFor(i.box,On)),"f"),ve(this,xu,"f").ifSome(i=>i.terminate()),Si(this,xu,ve(this,Pl,"f").map(i=>i.getOrCreateLoader().subscribe(()=>ve(this,wl,"m",bu).call(this))),"f")}),ve(this,Tt,"f").subscribe(Ue.Children,n=>ve(this,wl,"m",bu).call(this))),Si(this,Ph,!1,"f")}catchupAndSubscribeSelected(e){return ve(this,_l,"f").catchupAndSubscribe(e)}subscribeChange(e){return ve(this,Sh,"f").subscribe(e)}accept(e){return P(e.visitAudioClipBoxAdapter,this)}consolidate(){}clone(e){let t=this.observableOptPlayMode.map(n=>n.clone());Jc.create(ve(this,bl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.gain.setValue(this.gain.getValue()),n.timeBase.setValue(this.timeBase),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(ve(this,Tt,"f").clips.targetVertex.unwrap()),n.file.refer(ve(this,Tt,"f").file.targetVertex.unwrap()),n.events.refer(ve(this,Tt,"f").events.targetVertex.unwrap()),t.ifSome(i=>n.playMode.refer(i))})}onSelected(){ve(this,_l,"f").setValue(!0)}onDeselected(){ve(this,_l,"f").setValue(!1)}get isSelected(){return ve(this,_l,"f").getValue()}get box(){return ve(this,Tt,"f")}get uuid(){return ve(this,Tt,"f").address.uuid}get address(){return ve(this,Tt,"f").address}get indexField(){return ve(this,Tt,"f").index}get duration(){return ve(this,_h,"f").toPPQN(0)}set duration(e){ve(this,_h,"f").fromPPQN(e,0)}get mute(){return ve(this,Tt,"f").mute.getValue()}get hue(){return ve(this,Tt,"f").hue.getValue()}get gain(){return ve(this,Tt,"f").gain}get file(){return ve(this,Pl,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return ve(this,Al,"f")}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return m.None}get timeBase(){return Gi(ve(this,Tt,"f").timeBase.getValue(),Wr)}get waveformOffset(){return ve(this,Tt,"f").waveformOffset}get isPlayModeNoStretch(){return ve(this,Tt,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>pt(e,Eo)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>pt(e,Fo)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>So.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(ve(this,Pl,"f").isEmpty())return"No Audio File";let e=ve(this,Pl,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):ve(this,Tt,"f").label.getValue()}get trackBoxAdapter(){return ve(this,Ph,"f")?m.None:ve(this,Tt,"f").clips.targetVertex.map(e=>ve(this,bl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return!1}get canMirror(){return!1}get canResize(){return ve(this,Al,"f").nonEmpty()}terminate(){ve(this,xu,"f").ifSome(e=>e.terminate()),Si(this,xu,m.None,"f"),ve(this,wu,"f").terminate(),Si(this,wu,ee.Empty,"f"),ve(this,yu,"f").terminate()}toString(){return`{AudioClipBoxAdapter ${b.toString(ve(this,Tt,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};yu=new WeakMap,bl=new WeakMap,Tt=new WeakMap,Al=new WeakMap,_l=new WeakMap,_h=new WeakMap,Sh=new WeakMap,Ph=new WeakMap,Pl=new WeakMap,xu=new WeakMap,wu=new WeakMap,wl=new WeakSet,bu=function(){ve(this,Sh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var Eh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Wt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Au,lr,Uv,Fh,Sl=class r{constructor(e,t){this.type="note-event",Au.set(this,void 0),lr.set(this,void 0),Uv.set(this,void 0),Fh.set(this,!1),Eh(this,Au,e,"f"),Eh(this,lr,t,"f"),Eh(this,Uv,Wt(this,lr,"f").subscribe(Ue.Children,n=>{if(!this.collection.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.collection.unwrap(),o=n.address.fieldKeys,a=U.equals(Wt(this,lr,"f").pitch.address.fieldKeys,o),s=U.equals(Wt(this,lr,"f").position.address.fieldKeys,o);a||s?i.requestSorting():i.onEventPropertyChanged()}}),"f")}onSelected(){Eh(this,Fh,!0,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){Eh(this,Fh,!1,"f"),this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){Wt(this,Uv,"f").terminate()}get box(){return Wt(this,lr,"f")}get uuid(){return Wt(this,lr,"f").address.uuid}get address(){return Wt(this,lr,"f").address}get position(){return Wt(this,lr,"f").position.getValue()}get duration(){return Wt(this,lr,"f").duration.getValue()}get complete(){return this.position+this.duration}get velocity(){return Wt(this,lr,"f").velocity.getValue()}get pitch(){return Wt(this,lr,"f").pitch.getValue()}get cent(){return Wt(this,lr,"f").cent.getValue()}get chance(){return Wt(this,lr,"f").chance.getValue()}get playCount(){return Wt(this,lr,"f").playCount.getValue()}get playCurve(){return Wt(this,lr,"f").playCurve.getValue()}get isSelected(){return Wt(this,Fh,"f")}get collection(){return Wt(this,lr,"f").events.targetVertex.map(e=>Wt(this,Au,"f").boxAdapters.adapterFor(e.box,Yi))}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 Wt(this,Au,"f").boxAdapters.adapterFor(za.create(Wt(this,Au,"f").boxGraph,b.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 $r.curveFunc(e,this.playCurve)}canConsolidate(){return this.playCount>1}consolidate(){let e=this.playCount,t=this.collection.unwrap().box.events,n=U.create(i=>{let o=Math.floor(this.computeCurveValue(i/e)*this.duration),a=Math.floor(this.computeCurveValue((i+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 Wt(this,lr,"f").delete(),n}};Au=new WeakMap,lr=new WeakMap,Uv=new WeakMap,Fh=new WeakMap;var Bo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ne=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},pa,Bh,ns,zn,El,Nh,Ei,Lv,Kv,Wv,os,jv,Ih,Yi=class r{constructor(e,t){pa.add(this),Bh.set(this,new j),ns.set(this,void 0),zn.set(this,void 0),El.set(this,void 0),Nh.set(this,void 0),Ei.set(this,void 0),Lv.set(this,60),Kv.set(this,60),Wv.set(this,0),os.set(this,!1),Bo(this,ns,e,"f"),Bo(this,zn,t,"f"),Bo(this,El,new ce,"f"),Bo(this,Nh,b.newSet(n=>n.uuid),"f"),Bo(this,Ei,ai.create($r.Comparator),"f"),Ne(this,Bh,"f").own(Ne(this,zn,"f").events.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{let i=Ne(this,ns,"f").boxAdapters.adapterFor(n,Sl);Ne(this,Nh,"f").add(i)&&(Ne(this,Ei,"f").add(i),Ne(this,pa,"m",jv).call(this))},onRemoved:({box:{address:{uuid:n}}})=>{Ne(this,Ei,"f").remove(Ne(this,Nh,"f").removeByKey(n)),Ne(this,pa,"m",jv).call(this)}})),Ne(this,Bh,"f").own(Ne(this,zn,"f").owners.pointerHub.subscribe({onAdded:()=>Ne(this,El,"f").notify(this),onRemoved:()=>Ne(this,El,"f").notify(this)}))}copy(){let e=Ne(this,ns,"f").boxGraph,t=aa.create(e,b.generate());return Ne(this,Ei,"f").asArray().forEach(n=>n.copyTo({events:t.events})),Ne(this,ns,"f").boxAdapters.adapterFor(t,r)}createEvent({position:e,duration:t,velocity:n,pitch:i,chance:o,playCount:a,cent:s}){return Ne(this,ns,"f").boxAdapters.adapterFor(za.create(Ne(this,ns,"f").boxGraph,b.generate(),l=>{l.position.setValue(e),l.duration.setValue(t),l.velocity.setValue(n),l.pitch.setValue(i),l.chance.setValue(o),l.playCount.setValue(a),l.cent.setValue(s),l.events.refer(Ne(this,zn,"f").events)}),Sl)}subscribeChange(e){return Ne(this,El,"f").subscribe(e)}selectable(){return Ne(this,Ei,"f").asArray()}selectableAt(e){for(let t of Ne(this,Ei,"f").asArray())if(t.position<=e.u&&e.u<t.complete&&t.pitch===e.v)return ht.one(t);return ht.empty()}selectablesBetween(e,t){let n=[],i=Ne(this,Ei,"f").asArray(),o=Ne(this,Ei,"f").ceilFirstIndex(t.u);for(let a=0;a<o;a++){let s=i[a];s.complete>e.u&&s.pitch>=e.v&&s.pitch<=t.v&&n.push(s)}return n}requestSorting(){Ne(this,Ei,"f").onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){Ne(this,pa,"m",jv).call(this)}terminate(){Ne(this,Bh,"f").terminate()}get box(){return Ne(this,zn,"f")}get uuid(){return Ne(this,zn,"f").address.uuid}get address(){return Ne(this,zn,"f").address}get numOwners(){return Ne(this,zn,"f").owners.pointerHub.filter(c.NoteEventCollection).length}get events(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Ei,"f")}get minPitch(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Lv,"f")}get maxPitch(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Kv,"f")}get maxDuration(){return Ne(this,os,"f")||Ne(this,pa,"m",Ih).call(this),Ne(this,Wv,"f")}toString(){return`{NoteEventCollectionBox ${b.toString(Ne(this,zn,"f").address.uuid)}}`}};Bh=new WeakMap,ns=new WeakMap,zn=new WeakMap,El=new WeakMap,Nh=new WeakMap,Ei=new WeakMap,Lv=new WeakMap,Kv=new WeakMap,Wv=new WeakMap,os=new WeakMap,pa=new WeakSet,jv=function(){Bo(this,os,!1,"f"),Ne(this,El,"f").notify(this)},Ih=function(){let e=127,t=0,n=0;Ne(this,Ei,"f").asArray().forEach(({pitch:i,duration:o})=>{e=Math.min(e,i),t=Math.max(t,i),n=Math.max(n,o)}),Bo(this,Lv,e,"f"),Bo(this,Kv,t,"f"),Bo(this,Wv,n,"f"),Bo(this,os,!0,"f")};var Fl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ke=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Bl,_u,Nl,er,Il,kh,Dh,Mh,Pu,Su=class{constructor(e,t){Bl.add(this),this.type="note-clip",_u.set(this,new j),Nl.set(this,void 0),er.set(this,void 0),Il.set(this,void 0),kh.set(this,void 0),Dh.set(this,void 0),Mh.set(this,ee.Empty),Fl(this,Nl,e,"f"),Fl(this,er,t,"f"),Fl(this,Dh,!0,"f"),Fl(this,Il,Ke(this,_u,"f").own(new Hi(!1)),"f"),Fl(this,kh,Ke(this,_u,"f").own(new ce),"f"),Ke(this,_u,"f").ownAll(Ke(this,er,"f").pointerHub.subscribe({onAdded:()=>Ke(this,Bl,"m",Pu).call(this),onRemoved:()=>Ke(this,Bl,"m",Pu).call(this)}),Ke(this,er,"f").subscribe(Ue.Children,n=>Ke(this,Bl,"m",Pu).call(this)),Ke(this,er,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Ke(this,Mh,"f").terminate(),Fl(this,Mh,n.match({none:()=>ee.Empty,some:({box:i})=>Ke(this,Nl,"f").boxAdapters.adapterFor(i,Yi).subscribeChange(()=>Ke(this,Bl,"m",Pu).call(this))}),"f"),Ke(this,Bl,"m",Pu).call(this)})),Fl(this,Dh,!1,"f")}catchupAndSubscribeSelected(e){return Ke(this,Il,"f").catchupAndSubscribe(e)}subscribeChange(e){return Ke(this,kh,"f").subscribe(e)}accept(e){return P(e.visitNoteClipBoxAdapter,this)}consolidate(){this.isMirrowed&&Ke(this,er,"f").events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:Ke(this,er,"f").events.targetVertex.unwrap();Gc.create(Ke(this,Nl,"f").boxGraph,b.generate(),n=>{n.index.setValue(this.indexField.getValue()),n.label.setValue(this.label),n.hue.setValue(this.hue),n.duration.setValue(this.duration),n.mute.setValue(this.mute),n.clips.refer(Ke(this,er,"f").clips.targetVertex.unwrap()),n.events.refer(t)})}onSelected(){Ke(this,Il,"f").setValue(!0)}onDeselected(){Ke(this,Il,"f").setValue(!1)}get isSelected(){return Ke(this,Il,"f").getValue()}terminate(){Ke(this,Mh,"f").terminate(),Ke(this,_u,"f").terminate()}get box(){return Ke(this,er,"f")}get uuid(){return Ke(this,er,"f").address.uuid}get address(){return Ke(this,er,"f").address}get indexField(){return Ke(this,er,"f").index}get duration(){return Ke(this,er,"f").duration.getValue()}get mute(){return Ke(this,er,"f").mute.getValue()}get hue(){return Ke(this,er,"f").hue.getValue()}get events(){return this.optCollection.map(e=>e.events)}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return Ke(this,er,"f").events.targetVertex.map(e=>Ke(this,Nl,"f").boxAdapters.adapterFor(e.box,Yi))}get label(){return Ke(this,er,"f").label.getValue()}get trackBoxAdapter(){return Ke(this,Dh,"f")?m.None:Ke(this,er,"f").clips.targetVertex.map(e=>Ke(this,Nl,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{NoteClipBoxAdapter ${b.toString(Ke(this,er,"f").address.uuid)} d: ${J.toString(this.duration)}}`}};_u=new WeakMap,Nl=new WeakMap,er=new WeakMap,Il=new WeakMap,kh=new WeakMap,Dh=new WeakMap,Mh=new WeakMap,Bl=new WeakSet,Pu=function(){Ke(this,kh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()};var Zv={for:(r,e)=>he(e.accept({visitNoteClipBox:t=>r.adapterFor(t,Su),visitValueClipBox:t=>r.adapterFor(t,ts),visitAudioClipBox:t=>r.adapterFor(t,is)}),"")};var Gv=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},as=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qv,Eu,$h,Th,Hv=class{constructor(e,t){qv.set(this,void 0),Eu.set(this,void 0),$h.set(this,void 0),Th.set(this,void 0),Gv(this,qv,e,"f"),Gv(this,Eu,new j,"f"),Gv(this,$h,as(this,Eu,"f").own(new ce),"f"),Gv(this,Th,as(this,Eu,"f").own(sr.create(e.box.clips,n=>Zv.for(t,n),c.ClipCollection)),"f"),as(this,Th,"f").subscribe({onAdd:()=>this.dispatchChange(),onRemove:()=>this.dispatchChange(),onReorder:()=>this.dispatchChange()})}get trackBoxAdapter(){return as(this,qv,"f")}get collection(){return as(this,Th,"f")}dispatchChange(){as(this,$h,"f").notify()}subscribeChanges(e){return as(this,$h,"f").subscribe(e)}terminate(){as(this,Eu,"f").terminate()}};qv=new WeakMap,Eu=new WeakMap,$h=new WeakMap,Th=new WeakMap;var Ek=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qr,Jv=class{constructor(e){qr.set(this,void 0),Ek(this,qr,e,"f")}get inField(){return Xi(this,qr,"f").in}get outField(){return Xi(this,qr,"f").out}get inSlopeField(){return Xi(this,qr,"f").inSlope}get outSlopeField(){return Xi(this,qr,"f").outSlope}get in(){return Xi(this,qr,"f").in.getValue()}get out(){return Xi(this,qr,"f").out.getValue()}get inSlope(){return Xi(this,qr,"f").inSlope.getValue()}get outSlope(){return Xi(this,qr,"f").outSlope.getValue()}get hasFading(){return Ca.hasFading(this)}copyTo(e){e.in.setValue(this.in),e.out.setValue(this.out),e.inSlope.setValue(this.inSlope),e.outSlope.setValue(this.outSlope)}reset(){Xi(this,qr,"f").in.setValue(0),Xi(this,qr,"f").out.setValue(0),Xi(this,qr,"f").inSlope.setValue(.75),Xi(this,qr,"f").outSlope.setValue(.25)}};qr=new WeakMap;var zt=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},X=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fi,Rh,en,et,Fu,Bu,Nu,Ch,Un,Oh,Dl,Iu,Du,Mu,ku,$u,tn,ha=class r{constructor(e,t){Fi.add(this),this.type="audio-region",Rh.set(this,void 0),en.set(this,void 0),et.set(this,void 0),Fu.set(this,void 0),Bu.set(this,void 0),Nu.set(this,void 0),Ch.set(this,void 0),Un.set(this,void 0),Oh.set(this,void 0),Dl.set(this,m.None),Iu.set(this,ee.Empty),Du.set(this,ee.Empty),Mu.set(this,ee.Empty),ku.set(this,ee.Empty),$u.set(this,void 0),zt(this,en,e,"f"),zt(this,et,t,"f"),zt(this,Rh,new j,"f");let{timeBase:n,duration:i,loopDuration:o}=t;zt(this,Fu,Ys.aware(e.tempoMap,n,i),"f"),zt(this,Bu,Ys.aware(e.tempoMap,n,o),"f"),zt(this,Nu,new Mr,"f"),zt(this,Ch,new ce,"f"),zt(this,Un,new Jv(t.fading),"f"),zt(this,$u,!1,"f"),zt(this,Oh,!0,"f"),X(this,Rh,"f").ownAll(X(this,et,"f").pointerHub.subscribe({onAdded:()=>X(this,Fi,"m",tn).call(this),onRemoved:()=>X(this,Fi,"m",tn).call(this)}),X(this,et,"f").file.catchupAndSubscribe(a=>{zt(this,Dl,a.targetVertex.map(s=>X(this,en,"f").boxAdapters.adapterFor(s.box,On)),"f"),X(this,Iu,"f").terminate(),zt(this,Iu,X(this,Dl,"f").mapOr(s=>s.getOrCreateLoader().subscribe(()=>X(this,Fi,"m",tn).call(this)),ee.Empty),"f")}),X(this,et,"f").playMode.catchupAndSubscribe(({targetVertex:a})=>{X(this,Du,"f").terminate(),a.match({none:()=>X(this,Nu,"f").clear(),some:({box:s})=>{let l=X(this,en,"f").boxAdapters.adapterFor(s,So.isAudioPlayMode);zt(this,Du,l.subscribe(()=>X(this,Fi,"m",tn).call(this)),"f"),X(this,Nu,"f").wrap(l)}})}),X(this,et,"f").timeBase.catchupAndSubscribe(a=>{X(this,Mu,"f").terminate(),Gi(a.getValue(),Wr)===Wr.Seconds&&zt(this,Mu,e.tempoMap.subscribe(()=>X(this,Fi,"m",tn).call(this)),"f")}),X(this,et,"f").subscribe(Ue.Children,a=>{if(!this.trackBoxAdapter.isEmpty()&&(a.type==="primitive"||a.type==="pointer")){let s=this.trackBoxAdapter.unwrap();X(this,et,"f").position.address.equals(a.address)?(s.regions.onIndexingChanged(),X(this,Fi,"m",tn).call(this)):X(this,Fi,"m",tn).call(this)}}),X(this,et,"f").events.catchupAndSubscribe(({targetVertex:a})=>{X(this,ku,"f").terminate(),zt(this,ku,a.match({none:()=>ee.Empty,some:({box:s})=>X(this,en,"f").boxAdapters.adapterFor(s,_r).subscribeChange(()=>X(this,Fi,"m",tn).call(this))}),"f"),X(this,Fi,"m",tn).call(this)})),zt(this,Oh,!1,"f")}subscribeChange(e){return X(this,Ch,"f").subscribe(e)}accept(e){return P(e.visitAudioRegionBoxAdapter,this)}onSelected(){zt(this,$u,!0,"f"),X(this,Fi,"m",tn).call(this)}onDeselected(){zt(this,$u,!1,"f"),X(this,Fi,"m",tn).call(this)}get isSelected(){return X(this,$u,"f")}get box(){return X(this,et,"f")}get uuid(){return X(this,et,"f").address.uuid}get address(){return X(this,et,"f").address}get position(){return X(this,et,"f").position.getValue()}get duration(){return X(this,Fu,"f").toPPQN(this.position)}get complete(){return this.position+this.duration}get loopOffset(){return X(this,et,"f").loopOffset.getValue()}get loopDuration(){return X(this,Bu,"f").toPPQN(this.position)}resolveDuration(e){return X(this,Fu,"f").toPPQN(e)}resolveComplete(e){return e+this.resolveDuration(e)}resolveLoopDuration(e){return X(this,Bu,"f").toPPQN(e)}get offset(){return this.position-this.loopOffset}get mute(){return X(this,et,"f").mute.getValue()}get hue(){return X(this,et,"f").hue.getValue()}get gain(){return X(this,et,"f").gain}get fading(){return X(this,Un,"f")}get file(){return X(this,Dl,"f").unwrap("Cannot access file.")}get observableOptPlayMode(){return X(this,Nu,"f")}get timeBase(){return Gi(X(this,et,"f").timeBase.getValue(),Wr)}get waveformOffset(){return X(this,et,"f").waveformOffset}get isPlayModeNoStretch(){return X(this,et,"f").playMode.isEmpty()}get asPlayModePitchStretch(){return this.observableOptPlayMode.map(e=>pt(e,Eo)?e:null)}get asPlayModeTimeStretch(){return this.observableOptPlayMode.map(e=>pt(e,Fo)?e:null)}get optWarpMarkers(){return this.observableOptPlayMode.map(e=>So.isAudioPlayMode(e)?e.warpMarkers:null)}get label(){if(X(this,Dl,"f").isEmpty())return"No Audio File";let e=X(this,Dl,"f").unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):X(this,et,"f").label.getValue()}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}get trackBoxAdapter(){return X(this,et,"f").regions.targetVertex.map(e=>X(this,en,"f").boxAdapters.adapterFor(e.box,Vt))}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return X(this,et,"f").events.targetVertex.map(e=>X(this,en,"f").boxAdapters.adapterFor(e.box,_r))}set position(e){X(this,et,"f").position.setValue(e)}set duration(e){X(this,Fu,"f").fromPPQN(e,this.position);let t=X(this,Un,"f").in+X(this,Un,"f").out;if(t>e){let n=e/t;X(this,Un,"f").inField.setValue(X(this,Un,"f").in*n),X(this,Un,"f").outField.setValue(X(this,Un,"f").out*n)}}set loopOffset(e){X(this,et,"f").loopOffset.setValue(qs(e,this.loopDuration))}set loopDuration(e){X(this,Bu,"f").fromPPQN(e,this.position)}moveContentStart(e){let t=this.position,n=t+e;if(this.position=n,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e,this.timeBase===Wr.Seconds){let i=e>=0?X(this,en,"f").tempoMap.intervalToSeconds(t,n):-X(this,en,"f").tempoMap.intervalToSeconds(n,t);X(this,et,"f").waveformOffset.setValue(this.waveformOffset.getValue()+i)}else this.optWarpMarkers.ifSome(i=>i.asArray().forEach(o=>o.box.position.setValue(o.position-e)))}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners,i=this.observableOptPlayMode.map(a=>a.clone()),o=X(this,en,"f").boxAdapters.adapterFor(ja.create(X(this,en,"f").boxGraph,b.generate(),a=>{a.timeBase.setValue(X(this,et,"f").timeBase.getValue()),a.position.setValue(e?.position??X(this,et,"f").position.getValue()),a.regions.refer(e?.target??X(this,et,"f").regions.targetVertex.unwrap()),a.file.refer(X(this,et,"f").file.targetVertex.unwrap()),a.events.refer(n),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()),i.ifSome(s=>a.playMode.refer(s)),X(this,Un,"f").copyTo(a.fading)}),r);return o.loopDuration=e?.loopDuration??this.resolveLoopDuration(o.position),o.loopOffset=e?.loopOffset??this.loopOffset,o.duration=e?.duration??this.resolveDuration(o.position),o}consolidate(){}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){return m.None}terminate(){X(this,Iu,"f").terminate(),zt(this,Iu,ee.Empty,"f"),X(this,Mu,"f").terminate(),zt(this,Mu,ee.Empty,"f"),X(this,Du,"f").terminate(),zt(this,Du,ee.Empty,"f"),X(this,ku,"f").terminate(),zt(this,ku,ee.Empty,"f"),X(this,Rh,"f").terminate()}toString(){return`{AudioRegionBoxAdapter ${b.toString(X(this,et,"f").address.uuid)}}`}};Rh=new WeakMap,en=new WeakMap,et=new WeakMap,Fu=new WeakMap,Bu=new WeakMap,Nu=new WeakMap,Ch=new WeakMap,Un=new WeakMap,Oh=new WeakMap,Dl=new WeakMap,Iu=new WeakMap,Du=new WeakMap,Mu=new WeakMap,ku=new WeakMap,$u=new WeakMap,Fi=new WeakSet,tn=function(){X(this,Oh,"f")||(X(this,Ch,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange())};var fa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ie=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},No,Qv,Io,bt,Uh,Vh,Tu,zh,ma,ss=class r{constructor(e,t){No.add(this),this.type="note-region",Qv.set(this,new j),Io.set(this,void 0),bt.set(this,void 0),Uh.set(this,void 0),Vh.set(this,void 0),Tu.set(this,void 0),zh.set(this,ee.Empty),fa(this,Io,e,"f"),fa(this,bt,t,"f"),fa(this,Uh,new ce,"f"),fa(this,Tu,!1,"f"),fa(this,Vh,!0,"f"),Ie(this,Qv,"f").ownAll(Ie(this,bt,"f").pointerHub.subscribe({onAdded:()=>Ie(this,No,"m",ma).call(this),onRemoved:()=>Ie(this,No,"m",ma).call(this)}),Ie(this,bt,"f").subscribe(Ue.Children,n=>{if(!this.trackBoxAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackBoxAdapter.unwrap();Ie(this,bt,"f").position.address.equals(n.address)?(i.regions.onIndexingChanged(),Ie(this,No,"m",ma).call(this)):Ie(this,No,"m",ma).call(this)}}),Ie(this,bt,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Ie(this,zh,"f").terminate(),fa(this,zh,n.match({none:()=>ee.Empty,some:({box:i})=>Ie(this,Io,"f").boxAdapters.adapterFor(i,Yi).subscribeChange(()=>Ie(this,No,"m",ma).call(this))}),"f"),Ie(this,No,"m",ma).call(this)})),fa(this,Vh,!1,"f")}set position(e){Ie(this,bt,"f").position.setValue(e)}set duration(e){Ie(this,bt,"f").duration.setValue(e)}set loopOffset(e){Ie(this,bt,"f").loopOffset.setValue(e)}set loopDuration(e){Ie(this,bt,"f").loopDuration.setValue(e)}moveContentStart(e){this.optCollection.ifSome(t=>t.events.asArray().forEach(n=>n.box.position.setValue(n.position-e))),this.position=this.position+e,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e}subscribeChange(e){return Ie(this,Uh,"f").subscribe(e)}accept(e){return P(e.visitNoteRegionBoxAdapter,this)}onSelected(){fa(this,Tu,!0,"f"),Ie(this,No,"m",ma).call(this)}onDeselected(){fa(this,Tu,!1,"f"),Ie(this,No,"m",ma).call(this)}get isSelected(){return Ie(this,Tu,"f")}*iterateActiveNotesAt(e){let t=this.optCollection;if(t.isEmpty())return;let n=t.unwrap(),i=kr.globalToLocal(this,e);for(let o of n.events.iterateFrom(i-n.maxDuration)){if(i<o.position)return;i<o.complete&&(yield o.copyAsNoteEvent())}}terminate(){Ie(this,zh,"f").terminate(),Ie(this,Qv,"f").terminate()}get box(){return Ie(this,bt,"f")}get uuid(){return Ie(this,bt,"f").address.uuid}get address(){return Ie(this,bt,"f").address}get position(){return Ie(this,bt,"f").position.getValue()}get duration(){return Ie(this,bt,"f").duration.getValue()}get loopOffset(){return Ie(this,bt,"f").loopOffset.getValue()}get loopDuration(){return Ie(this,bt,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}resolveDuration(e){return this.duration}resolveComplete(e){return e+this.duration}resolveLoopDuration(e){return this.loopDuration}get mute(){return Ie(this,bt,"f").mute.getValue()}get hue(){return Ie(this,bt,"f").hue.getValue()}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return Ie(this,bt,"f").events.targetVertex.map(e=>Ie(this,Io,"f").boxAdapters.adapterFor(e.box,Yi))}get label(){return Ie(this,bt,"f").label.getValue()}get trackBoxAdapter(){return Ie(this,Vh,"f")?m.None:Ie(this,bt,"f").regions.targetVertex.map(e=>Ie(this,Io,"f").boxAdapters.adapterFor(e.box,Vt))}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"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return Ie(this,Io,"f").boxAdapters.adapterFor(cl.create(Ie(this,Io,"f").boxGraph,b.generate(),i=>{i.position.setValue(e?.position??this.position),i.duration.setValue(e?.duration??this.duration),i.loopOffset.setValue(e?.loopOffset??this.loopOffset),i.loopDuration.setValue(e?.loopDuration??this.loopDuration),i.hue.setValue(this.hue),i.label.setValue(this.label),i.mute.setValue(this.mute),i.events.refer(n),i.regions.refer(e?.target??Ie(this,bt,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.optCollection.ifSome(e=>{let t=Ie(this,Io,"f").boxGraph,n=aa.create(t,b.generate());e.events.asArray().forEach(i=>i.copyTo({events:n.events})),Ie(this,bt,"f").events.refer(n.owners)})}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return m.None;let t=Ie(this,Io,"f").boxGraph,n=e.toSorted(Ra.Comparator),i=U.getFirst(n,"Internal error (no first)"),o=U.getLast(n,"Internal error (no last)"),a=i.position,s=o.position+o.duration,l=i.trackBoxAdapter.unwrap(),u=aa.create(t,b.generate()),p=Array.from(l.regions.collection.iterateRange(a,s));return p.filter(d=>d.isSelected).forEach(d=>{let h=d;for(let{resultStart:g,resultEnd:v,rawStart:y}of kr.locateLoops(h,h.position,h.complete)){let x=Math.floor(g-y),B=Math.floor(v-y);for(let I of h.optCollection.unwrap().events.iterateRange(x,B))I.copyTo({position:I.position+y-i.position,events:u.events})}}),p.forEach(({box:d})=>d.delete()),m.wrap(cl.create(t,b.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 ${b.toString(Ie(this,bt,"f").address.uuid)} p: ${J.toString(this.position)}, c: ${J.toString(this.complete)}}`}};Qv=new WeakMap,Io=new WeakMap,bt=new WeakMap,Uh=new WeakMap,Vh=new WeakMap,Tu=new WeakMap,zh=new WeakMap,No=new WeakSet,ma=function(){Ie(this,Uh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var ga=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Se=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},jn,Ru,Do,At,Kh,Cu,jh,Lh,Mo,va=class r{constructor(e,t){jn.add(this),this.type="value-region",Ru.set(this,new j),Do.set(this,void 0),At.set(this,void 0),Kh.set(this,void 0),Cu.set(this,void 0),jh.set(this,void 0),Lh.set(this,ee.Empty),ga(this,Do,e,"f"),ga(this,At,t,"f"),ga(this,jh,!0,"f"),ga(this,Kh,new ce,"f"),ga(this,Cu,!1,"f"),Se(this,Ru,"f").own(Se(this,At,"f").pointerHub.subscribe({onAdded:()=>Se(this,jn,"m",Mo).call(this),onRemoved:()=>Se(this,jn,"m",Mo).call(this)})),Se(this,Ru,"f").own(Se(this,At,"f").subscribe(Ue.Children,n=>{if(!this.trackBoxAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackBoxAdapter.unwrap();Se(this,At,"f").position.address.equals(n.address)?(i.regions.onIndexingChanged(),Se(this,jn,"m",Mo).call(this)):Se(this,jn,"m",Mo).call(this)}})),Se(this,Ru,"f").own(Se(this,At,"f").events.catchupAndSubscribe(({targetVertex:n})=>{Se(this,Lh,"f").terminate(),ga(this,Lh,n.match({none:()=>ee.Empty,some:({box:i})=>Se(this,Do,"f").boxAdapters.adapterFor(i,_r).subscribeChange(()=>Se(this,jn,"m",Mo).call(this))}),"f"),Se(this,jn,"m",Mo).call(this)})),ga(this,jh,!1,"f")}valueAt(e,t){let n=this.optCollection;return n.isEmpty()?t:n.unwrap().valueAt(kr.globalToLocal(this,e),t)}incomingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let n=t.unwrap().events.greaterEqual(0);return q(n)&&n.position===0?n.value:this.valueAt(this.position,e)}outgoingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let n=t.unwrap();return(this.complete-this.offset)%this.loopDuration===0?n.valueAt(this.loopDuration,e):n.valueAt(kr.globalToLocal(this,this.complete),e)}subscribeChange(e){return Se(this,Kh,"f").subscribe(e)}accept(e){return P(e.visitValueRegionBoxAdapter,this)}onSelected(){ga(this,Cu,!0,"f"),Se(this,jn,"m",Mo).call(this)}onDeselected(){ga(this,Cu,!1,"f"),Se(this,jn,"m",Mo).call(this)}get isSelected(){return Se(this,Cu,"f")}onValuesPropertyChanged(){Se(this,jn,"m",Mo).call(this)}onValuesSortingChanged(){this.onValuesPropertyChanged()}terminate(){Se(this,Lh,"f").terminate(),Se(this,Ru,"f").terminate()}get box(){return Se(this,At,"f")}get uuid(){return Se(this,At,"f").address.uuid}get address(){return Se(this,At,"f").address}get position(){return Se(this,At,"f").position.getValue()}get duration(){return Se(this,At,"f").duration.getValue()}get loopOffset(){return Se(this,At,"f").loopOffset.getValue()}get loopDuration(){return Se(this,At,"f").loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}resolveDuration(e){return this.duration}resolveComplete(e){return e+this.duration}resolveLoopDuration(e){return this.loopDuration}get mute(){return Se(this,At,"f").mute.getValue()}get hue(){return Se(this,At,"f").hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return Se(this,At,"f").events.targetVertex.map(e=>Se(this,Do,"f").boxAdapters.adapterFor(e.box,_r))}get label(){return Se(this,At,"f").label.getValue()}get trackBoxAdapter(){return Se(this,jh,"f")?m.None:Se(this,At,"f").regions.targetVertex.map(e=>Se(this,Do,"f").boxAdapters.adapterFor(e.box,Vt))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}get canResize(){return!0}set position(e){Se(this,At,"f").position.setValue(e)}set duration(e){Se(this,At,"f").duration.setValue(e)}set loopOffset(e){Se(this,At,"f").loopOffset.setValue(e)}set loopDuration(e){Se(this,At,"f").loopDuration.setValue(e)}moveContentStart(e){this.optCollection.ifSome(t=>t.events.asArray().forEach(n=>n.box.position.setValue(n.position-e))),this.position=this.position+e,this.loopDuration=this.loopDuration-e,this.duration=this.duration-e}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),n=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return Se(this,Do,"f").boxAdapters.adapterFor(ul.create(Se(this,Do,"f").boxGraph,b.generate(),i=>{i.position.setValue(e?.position??this.position),i.duration.setValue(e?.duration??this.duration),i.loopOffset.setValue(e?.loopOffset??this.loopOffset),i.loopDuration.setValue(e?.loopDuration??this.loopDuration),i.hue.setValue(this.hue),i.label.setValue(this.label),i.mute.setValue(this.mute),i.events.refer(n),i.regions.refer(e?.target??Se(this,At,"f").regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.events.ifSome(e=>{let t=Se(this,Do,"f").boxGraph,n=kn.create(t,b.generate());e.asArray().forEach(i=>i.copyTo({events:n.events})),Se(this,At,"f").events.refer(n.owners)})}canFlatten(e){return e.length>0&&U.satisfy(e,(t,n)=>t.trackBoxAdapter.contains(n.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return m.None;let t=Se(this,Do,"f").boxGraph,n=e.toSorted(Ra.Comparator),i=U.getFirst(n,"Internal error (no first)"),o=U.getLast(n,"Internal error (no last)"),a=i.position,s=o.position+o.duration,l=i.trackBoxAdapter.unwrap(),u=Array.from(l.regions.collection.iterateRange(a,s)),p=[];u.filter(v=>v.isSelected).forEach(v=>{let y=v,x=y.optCollection.unwrap(),B=x.events;for(let{rawStart:I,regionStart:O,regionEnd:z}of kr.locateLoops(y,y.position,y.complete)){let $=O-I,ie=z-I,ne=B.greaterEqual($);if(!q(ne)||ne.position!==$){let W=B.lowerEqual($);q(W)&&p.push({position:O-a,value:x.valueAt($,0),interpolation:W.interpolation})}let le=!1;for(let W of B.iterateRange($,yr.MAX_VALUE)){let xe=W.position+I;if(xe<z)p.push({position:xe-a,value:W.value,interpolation:W.interpolation});else if(xe===z){p.push({position:xe-a,value:W.value,interpolation:si.None}),le=!0;break}else{p.push({position:z-a,value:x.valueAt(ie,0),interpolation:si.None}),le=!0;break}}le||p.push({position:z-a,value:x.valueAt(ie,0),interpolation:si.None})}});let d=[];for(let v of p){let y=d.length>0?d[d.length-1]:void 0;q(y)&&y.position===v.position&&y.value===v.value?d[d.length-1]=v:d.push(v)}let h=kn.create(t,b.generate()),g=0;for(;g<d.length;){let v=g+1;for(;v<d.length&&d[v].position===d[g].position;)v++;let y=d[g],x=d[v-1],B=Mn.create(t,b.generate(),I=>{I.position.setValue(y.position),I.index.setValue(0),I.value.setValue(y.value),I.events.refer(h.events)});if(li.write(B.interpolation,v-g>1?si.None:y.interpolation),v-g>1){let I=Mn.create(t,b.generate(),O=>{O.position.setValue(x.position),O.index.setValue(1),O.value.setValue(x.value),O.events.refer(h.events)});li.write(I.interpolation,x.interpolation)}g=v}return u.forEach(({box:v})=>v.delete()),m.wrap(ul.create(t,b.generate(),v=>{v.position.setValue(a),v.duration.setValue(s-a),v.loopDuration.setValue(s-a),v.loopOffset.setValue(0),v.hue.setValue(this.hue),v.mute.setValue(this.mute),v.label.setValue(this.label),v.events.refer(h.owners),v.regions.refer(l.box.regions)}))}toString(){return`{ValueRegionBoxAdapter ${b.toString(Se(this,At,"f").address.uuid)} p: ${J.toString(this.position)}, c: ${J.toString(this.complete)}}`}};Ru=new WeakMap,Do=new WeakMap,At=new WeakMap,Kh=new WeakMap,Cu=new WeakMap,jh=new WeakMap,Lh=new WeakMap,jn=new WeakSet,Mo=function(){Se(this,Kh,"f").notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()};var gB=(r,e)=>r.position-e.position,vB={for:(r,e)=>he(e.accept({visitNoteRegionBox:t=>r.adapterFor(t,ss),visitAudioRegionBox:t=>r.adapterFor(t,ha),visitValueRegionBox:t=>r.adapterFor(t,va)}),"")};var Ou=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Wh,Ml,Zh,Vu,kl,zu,Yv=class{constructor(e,t){Wh.set(this,void 0),Ml.set(this,void 0),Zh.set(this,void 0),Vu.set(this,void 0),kl.set(this,void 0),zu.set(this,void 0),Ou(this,Wh,e,"f"),Ou(this,Ml,new j,"f"),Ou(this,Zh,mr(this,Ml,"f").own(new ce),"f"),Ou(this,Vu,mr(this,Ml,"f").own(new ar),"f"),Ou(this,kl,Ra.create(gB),"f"),Ou(this,zu,b.newSet(n=>n.uuid),"f"),mr(this,Ml,"f").ownAll(mr(this,Wh,"f").box.regions.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{let i=vB.for(t,n),o=mr(this,zu,"f").add(i);V(o,`Cannot add ${n}`),mr(this,kl,"f").add(i),mr(this,Vu,"f").forEach(a=>a.onAdded(i)),this.dispatchChange()},onRemoved:({box:{address:{uuid:n}}})=>{let i=mr(this,zu,"f").removeByKey(n);mr(this,kl,"f").remove(i),mr(this,Vu,"f").forEach(o=>o.onRemoved(i)),this.dispatchChange()}},c.RegionCollection))}get trackBoxAdapter(){return mr(this,Wh,"f")}get collection(){return mr(this,kl,"f")}get adapters(){return mr(this,zu,"f")}onIndexingChanged(){mr(this,kl,"f").onIndexingChanged(),this.dispatchChange()}catchupAndSubscribe(e){return this.collection.asArray().forEach(e.onAdded),mr(this,Vu,"f").subscribe(e)}subscribeChanges(e){return mr(this,Zh,"f").subscribe(e)}dispatchChange(){mr(this,Zh,"f").notify()}terminate(){mr(this,Ml,"f").terminate()}};Wh=new WeakMap,Ml=new WeakMap,Zh=new WeakMap,Vu=new WeakMap,kl=new WeakMap,zu=new WeakMap;var me;(function(r){r[r.Undefined=0]="Undefined",r[r.Notes=1]="Notes",r[r.Audio=2]="Audio",r[r.Value=3]="Value"})(me||(me={}));(function(r){r.toLabelString=e=>{switch(e){case r.Audio:return"Audio";case r.Notes:return"Note";case r.Value:return"Automation";case r.Undefined:default:return"N/A"}},r.toIconSymbol=e=>{switch(e){case r.Audio:return He.Waveform;case r.Notes:return He.Piano;case r.Value:return He.Automation;case r.Undefined:return He.AudioBus;default:return He.Unknown}}})(me||(me={}));var Xv;(function(r){r.isDeviceBox=e=>e.tags.type==="device",r.isInstrumentDeviceBox=e=>r.isDeviceBox(e)&&e.tags.deviceType==="instrument",r.isEffectDeviceBox=e=>r.isDeviceBox(e)&&(e.tags.deviceType==="audio-effect"||e.tags.deviceType==="midi-effect"),r.lookupHostField=e=>q(e)&&"host"in e&&pt(e.host,N)?e.host:D(`Could not find 'host' field in '${e?.name}'`),r.lookupLabelField=e=>q(e)&&"label"in e&&pt(e.label,C)?e.label:D(`Could not find 'label' field in '${e?.name}'`),r.lookupEnabledField=e=>q(e)&&"enabled"in e&&pt(e.enabled,k)?e.enabled:D(`Could not find 'enabled' field in '${e?.name}'`),r.lookupMinimizedField=e=>q(e)&&"minimized"in e&&pt(e.minimized,k)?e.minimized:D(`Could not find 'minimized' field in '${e?.name}'`),r.lookupIndexField=e=>q(e)&&"index"in e&&pt(e.index,E)?e.index:D(`Could not find 'index' field in '${e?.name}'`)})(Xv||(Xv={}));var yB;(function(r){r.toTrackType=e=>{switch(e){case"midi":return me.Notes;case"audio":return me.Audio;default:return D()}}})(yB||(yB={}));var de;(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;V(U.satisfy(e,(i,o)=>i.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):D("unknown type")).map(({box:i})=>Xv.lookupIndexField(i)).filter(i=>e.some(o=>b.Comparator(o.uuid,i.address.uuid)!==0)).sort((i,o)=>i.getValue()-o.getValue()).forEach((i,o)=>i.setValue(o)),e.forEach(i=>i.box.delete())}})(de||(de={}));var ey=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Sr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Gh,ty,Ln,$l,ry,iy=class{constructor(e,t){Gh.set(this,void 0),ty.set(this,new ce),Ln.set(this,void 0),$l.set(this,void 0),ry.set(this,void 0),ey(this,Gh,e,"f"),ey(this,Ln,sr.create(e.box.tracks,n=>t.adapterFor(n,Vt),c.TrackCollection),"f"),ey(this,$l,b.newSet(({uuid:n})=>n),"f"),ey(this,ry,Sr(this,Ln,"f").catchupAndSubscribe({onAdd:n=>Sr(this,$l,"f").add({uuid:n.uuid,subscription:n.regions.subscribeChanges(()=>Sr(this,ty,"f").notify())}),onRemove:({uuid:n})=>Sr(this,$l,"f").removeByKey(n).subscription.terminate(),onReorder:n=>{}}),"f")}create(e,t,n){let i=Sr(this,Gh,"f").box.graph,o=Sr(this,Gh,"f").box.tracks;Zr.create(i,b.generate(),a=>{a.index.setValue(n??Sr(this,Ln,"f").getMinFreeIndex()),a.type.setValue(e),a.tracks.refer(o),a.target.refer(t)})}controls(e){return m.wrap(Sr(this,Ln,"f").adapters().find(t=>t.target.targetVertex.contains(e),!1))}delete(e){let t=Sr(this,Ln,"f").adapters(),n=t.indexOf(e);if(n===-1)return D(`Cannot delete ${e}. Does not exist.`);for(let i=n+1;i<t.length;i++)t[i].indexField.setValue(i-1);e.box.delete()}get collection(){return Sr(this,Ln,"f")}values(){return Sr(this,Ln,"f").adapters()}catchupAndSubscribe(e){return Sr(this,Ln,"f").catchupAndSubscribe(e)}subscribeAnyChange(e){return Sr(this,ty,"f").subscribe(e)}terminate(){Sr(this,Ln,"f").terminate(),Sr(this,ry,"f").terminate(),Sr(this,$l,"f").forEach(({subscription:e})=>e.terminate()),Sr(this,$l,"f").clear()}};Gh=new WeakMap,ty=new WeakMap,Ln=new WeakMap,$l=new WeakMap,ry=new WeakMap;var pe;(function(r){r.AudioBus="manuals/audio-bus",r.Arpeggio="manuals/devices/midi/arpeggio",r.Pitch="manuals/devices/midi/pitch",r.Velocity="manuals/devices/midi/velocity",r.Zeitgeist="manuals/devices/midi/zeitgeist",r.StereoTool="manuals/devices/audio/stereo-tool",r.Delay="manuals/devices/audio/delay",r.DattorroReverb="manuals/devices/audio/dattorro-reverb",r.Maximizer="manuals/devices/audio/maximizer",r.Compressor="manuals/devices/audio/compressor",r.Gate="manuals/devices/audio/gate",r.Reverb="manuals/devices/audio/cheap-reverb",r.Crusher="manuals/devices/audio/crusher",r.Fold="manuals/devices/audio/fold",r.Tidal="manuals/devices/audio/tidal",r.Revamp="manuals/devices/audio/revamp",r.Modular="manuals/devices/audio/modular",r.NeuralAmp="manuals/devices/audio/neural-amp",r.Tape="manuals/devices/instruments/tape",r.Nano="manuals/devices/instruments/nano",r.Playfield="manuals/devices/instruments/playfield",r.Vaporisateur="manuals/devices/instruments/vaporisateur",r.MIDIOutput="manuals/devices/instruments/midi-output",r.Soundfont="manuals/devices/instruments/soundfont"})(pe||(pe={}));var xB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Kn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ny,Bi,Hr=class{constructor(e,t){this.type="bus",this.accepts="audio",this.manualUrl=pe.AudioBus,ny.set(this,void 0),Bi.set(this,void 0),xB(this,ny,e,"f"),xB(this,Bi,t,"f")}catchupAndSubscribe(e){return e(this),Kn(this,Bi,"f").subscribe(Ue.Children,()=>e(this))}get uuid(){return Kn(this,Bi,"f").address.uuid}get address(){return Kn(this,Bi,"f").address}get box(){return Kn(this,Bi,"f")}get enabledField(){return Kn(this,Bi,"f").enabled}get minimizedField(){return Kn(this,Bi,"f").minimized}get iconField(){return Kn(this,Bi,"f").icon}get labelField(){return Kn(this,Bi,"f").label}get colorField(){return Kn(this,Bi,"f").color}get iconSymbol(){return He.fromName(this.iconField.getValue()??"audio-bus")}deviceHost(){return Kn(this,ny,"f").boxAdapters.adapterFor(Kn(this,Bi,"f").output.targetVertex.unwrap("No AudioUnitBox found").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}toString(){return`{${this.constructor.name}}`}};ny=new WeakMap,Bi=new WeakMap;var qh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Dt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ya,Uu,ju,Ni,Hh,oy=class{constructor(e,t){ya.set(this,void 0),Uu.set(this,void 0),ju.set(this,void 0),Ni.set(this,void 0),Hh.set(this,ee.Empty),qh(this,ya,new j,"f"),qh(this,Uu,Dt(this,ya,"f").own(new ce),"f"),qh(this,ju,Dt(this,ya,"f").own(new Hi(He.Unknown)),"f"),qh(this,Ni,Dt(this,ya,"f").own(new Mr),"f"),Dt(this,ya,"f").own(Dt(this,Ni,"f").subscribe(n=>{Dt(this,Hh,"f").terminate(),qh(this,Hh,n.match({none:()=>(Dt(this,Uu,"f").notify(m.None),ee.Empty),some:({labelField:i,iconField:o})=>ee.many(o.catchupAndSubscribe(a=>Dt(this,ju,"f").setValue(He.fromName(a.getValue()))),i.catchupAndSubscribe(a=>Dt(this,Uu,"f").notify(m.wrap(a.getValue()))))}),"f")})),Dt(this,ya,"f").own(e.catchupAndSubscribe({onAdded:({box:n,pointerType:i})=>{if(Dt(this,Ni,"f").nonEmpty()){let a=Dt(this,Ni,"f").unwrap();D(`AudioUnitInput already has an input. Existing: ${a.box.name}@${a.box.address.toString()} (type: ${a.type}), Incoming: ${n.name}@${n.address.toString()} (pointerType: ${String(i)})`)}let o=n instanceof $n?t.adapterFor(n,Hr):t.adapterFor(n,de.isInstrument);Dt(this,Ni,"f").unwrapOrNull()!==o&&Dt(this,Ni,"f").wrap(o)},onRemoved:({box:n})=>{V(Dt(this,Ni,"f").unwrap("Cannot remove").box.address.equals(n.address),"Unexpected value to remove"),Dt(this,Ni,"f").clear()}},c.InstrumentHost,c.AudioOutput))}adapter(){return Dt(this,Ni,"f")}subscribe(e){return Dt(this,Ni,"f").subscribe(e)}catchupAndSubscribe(e){return e(Dt(this,Ni,"f")),this.subscribe(e)}catchupAndSubscribeLabelChange(e){return e(this.label),Dt(this,Uu,"f").subscribe(e)}catchupAndSubscribeIconChange(e){return Dt(this,ju,"f").catchupAndSubscribe(e)}set label(e){this.adapter().ifSome(t=>t.labelField.setValue(e))}get label(){return this.adapter().map(e=>e.labelField.getValue())}set icon(e){this.adapter().ifSome(t=>t.iconField.setValue(He.toName(e)))}get icon(){return this.adapter().match({none:()=>He.Unknown,some:e=>He.fromName(e.iconField.getValue())})}get iconValue(){return Dt(this,ju,"f")}terminate(){Dt(this,ya,"f").terminate(),Dt(this,Hh,"f").terminate()}};ya=new WeakMap,Uu=new WeakMap,ju=new WeakMap,Ni=new WeakMap,Hh=new WeakMap;var wB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Tl=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ay,xa,we=class{constructor(e){ay.set(this,void 0),xa.set(this,void 0),wB(this,ay,e,"f"),wB(this,xa,Me.newSet(t=>t.address),"f")}terminate(){Tl(this,xa,"f").forEach(e=>e.terminate()),Tl(this,xa,"f").clear()}parameters(){return Tl(this,xa,"f").values()}parameterAt(e){return Tl(this,xa,"f").getOrThrow(e,()=>new Error(`No ParameterAdapter found at [${e.toString()}]`))}createParameter(e,t,n,i,o){let a=new Rl(Tl(this,ay,"f"),e,t,n,i,o),s=Tl(this,xa,"f").add(a);return V(s,`Could not add adapter for ${e}`),a}removeParameter(e){return Tl(this,xa,"f").removeByKey(e)}};ay=new WeakMap,xa=new WeakMap;var Cl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Et=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ol,rn,ls,Lu,sy,ly,Jh,Ku=class{constructor(e,t){Ol.set(this,void 0),rn.set(this,void 0),ls.set(this,void 0),Lu.set(this,void 0),sy.set(this,void 0),ly.set(this,void 0),Jh.set(this,ee.Empty),Cl(this,Ol,e,"f"),Cl(this,rn,t,"f"),Cl(this,ls,new j,"f"),Cl(this,Lu,Et(this,ls,"f").own(new ce),"f"),Et(this,ls,"f").own(t.targetBus.catchupAndSubscribe(()=>{Et(this,Jh,"f").terminate(),Cl(this,Jh,this.optTargetBus.match({none:()=>(Et(this,Lu,"f").notify(m.None),ee.Empty),some:n=>n.catchupAndSubscribe(i=>Et(this,Lu,"f").notify(m.wrap(i)))}),"f")})),Cl(this,sy,Et(this,ls,"f").own(new Rl(Et(this,Ol,"f"),Et(this,rn,"f").sendPan,A.bipolar(),_.percent({unit:"%",fractionDigits:0}),"panning")),"f"),Cl(this,ly,Et(this,ls,"f").own(new Rl(Et(this,Ol,"f"),Et(this,rn,"f").sendGain,A.DefaultDecibel,_.numeric({unit:"dB",fractionDigits:1}),"gain")),"f")}catchupAndSubscribeBusChanges(e){return e(this.optTargetBus),Et(this,Lu,"f").subscribe(e)}get uuid(){return Et(this,rn,"f").address.uuid}get address(){return Et(this,rn,"f").address}get box(){return Et(this,rn,"f")}get indexField(){return Et(this,rn,"f").index}get sendPan(){return Et(this,sy,"f")}get sendGain(){return Et(this,ly,"f")}get targetBus(){return Et(this,Ol,"f").boxAdapters.adapterFor(Et(this,rn,"f").targetBus.targetVertex.unwrap("no audioUnit").box,Hr)}get optTargetBus(){return Et(this,rn,"f").targetBus.targetVertex.flatMap(e=>m.wrap(e.box.accept({visitAudioBusBox:t=>Et(this,Ol,"f").boxAdapters.adapterFor(t,Hr)})))}delete(){Et(this,rn,"f").delete()}terminate(){Et(this,ls,"f").terminate(),Et(this,Jh,"f").terminate()}};Ol=new WeakMap,rn=new WeakMap,ls=new WeakMap,Lu=new WeakMap,sy=new WeakMap,ly=new WeakMap,Jh=new WeakMap;var Qh=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ko=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},cy,uy,Wu,Zu,Yh,dy=class{constructor(e,t){cy.set(this,void 0),uy.set(this,void 0),Wu.set(this,void 0),Zu.set(this,void 0),Yh.set(this,ee.Empty),Qh(this,cy,e,"f"),Qh(this,uy,t,"f"),Qh(this,Wu,new j,"f"),Qh(this,Zu,ko(this,Wu,"f").own(new ce),"f"),ko(this,Wu,"f").own(e.catchupAndSubscribe(()=>{ko(this,Yh,"f").terminate(),Qh(this,Yh,this.adapter.match({none:()=>(ko(this,Zu,"f").notify(m.None),ee.Empty),some:n=>n.catchupAndSubscribe(i=>ko(this,Zu,"f").notify(m.wrap(i)))}),"f")}))}subscribe(e){return ko(this,Zu,"f").subscribe(e)}catchupAndSubscribe(e){return e(this.adapter),this.subscribe(e)}get adapter(){return ko(this,cy,"f").targetVertex.flatMap(e=>m.wrap(e.box.accept({visitAudioBusBox:t=>ko(this,uy,"f").adapterFor(t,Hr)})))}terminate(){ko(this,Wu,"f").terminate(),ko(this,Yh,"f").terminate()}};cy=new WeakMap,uy=new WeakMap,Wu=new WeakMap,Zu=new WeakMap,Yh=new WeakMap;var wa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ge=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},py,bB,$o,Ii,Ut,zl,Gu,Vl,hy,Xh,fy,my,AB,_B,nn=class{constructor(e,t){py.add(this),this.class="device-host",$o.set(this,new j),Ii.set(this,void 0),Ut.set(this,void 0),zl.set(this,void 0),Gu.set(this,void 0),Vl.set(this,void 0),hy.set(this,void 0),Xh.set(this,void 0),fy.set(this,void 0),my.set(this,void 0),wa(this,Ii,e,"f"),wa(this,Ut,t,"f"),wa(this,zl,ge(this,$o,"f").own(new we(ge(this,Ii,"f"))),"f"),wa(this,Gu,ge(this,$o,"f").own(new iy(this,ge(this,Ii,"f").boxAdapters)),"f"),wa(this,Vl,ge(this,$o,"f").own(new oy(ge(this,Ut,"f").input.pointerHub,ge(this,Ii,"f").boxAdapters)),"f"),wa(this,hy,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").midiEffects,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,de.isMidiEffect),c.MIDIEffectHost)),"f"),wa(this,Xh,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").audioEffects,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,de.isAudioEffect),c.AudioEffectHost)),"f"),wa(this,fy,ge(this,$o,"f").own(sr.create(ge(this,Ut,"f").auxSends,n=>ge(this,Ii,"f").boxAdapters.adapterFor(n,Ku),c.AuxSend)),"f"),wa(this,my,ge(this,$o,"f").own(new dy(ge(this,Ut,"f").output,ge(this,Ii,"f").boxAdapters)),"f"),this.namedParameter=ge(this,py,"m",AB).call(this,t),ge(this,py,"m",_B).call(this)}get box(){return ge(this,Ut,"f")}get uuid(){return ge(this,Ut,"f").address.uuid}get address(){return ge(this,Ut,"f").address}get indexField(){return ge(this,Ut,"f").index}get type(){return ge(this,Ut,"f").type.getValue()}get captureBox(){return ge(this,Ut,"f").capture.targetVertex}get tracks(){return ge(this,Gu,"f")}get input(){return ge(this,Vl,"f")}get midiEffects(){return ge(this,hy,"f")}get audioEffects(){return ge(this,Xh,"f")}get inputAdapter(){return ge(this,Vl,"f").adapter()}get auxSends(){return ge(this,fy,"f")}get output(){return ge(this,my,"f")}get isBus(){return this.input.adapter().mapOr(e=>e.type==="bus",!1)}get isInstrument(){return this.input.adapter().mapOr(e=>e.type==="instrument",!1)}get isOutput(){return ge(this,Ut,"f").output.targetVertex.mapOr(e=>e.box.address.equals(ge(this,Ii,"f").rootBoxAdapter.address),!1)}get midiEffectsField(){return ge(this,Ut,"f").midiEffects}get inputField(){return ge(this,Ut,"f").input}get audioEffectsField(){return ge(this,Ut,"f").audioEffects}get tracksField(){return ge(this,Ut,"f").tracks}get minimizedField(){return ge(this,Vl,"f").adapter().unwrap().minimizedField}get isAudioUnit(){return!0}get label(){return ge(this,Vl,"f").adapter().mapOr(e=>e.labelField.getValue(),"")}deviceHost(){return this}audioUnitBoxAdapter(){return this}*labeledAudioOutputs(){let e=this.input.adapter();e.nonEmpty()&&(yield*e.unwrap().labeledAudioOutputs());for(let t of ge(this,Xh,"f").adapters())yield*t.labeledAudioOutputs();yield{address:this.address,label:"Channelstrip",children:()=>m.None}}indicesLimit(){let e=ge(this,Ii,"f").rootBoxAdapter.audioUnits.adapters(),t=this.indexField.getValue(),n=this.type,i=t,o=t;for(;i>0&&e[i-1].type===n;)i--;for(;o<e.length-1&&e[o+1].type===n;)o++;return[i,o+1]}move(e){ge(this,Ii,"f").rootBoxAdapter.audioUnits.move(this,e)}moveTrack(e,t){ge(this,Gu,"f").collection.move(e,t)}deleteTrack(e){ge(this,Gu,"f").delete(e)}toString(){return`{${this.constructor.name}}`}terminate(){ge(this,$o,"f").terminate()}};bB=nn,$o=new WeakMap,Ii=new WeakMap,Ut=new WeakMap,zl=new WeakMap,Gu=new WeakMap,Vl=new WeakMap,hy=new WeakMap,Xh=new WeakMap,fy=new WeakMap,my=new WeakMap,py=new WeakSet,AB=function(e){return{volume:ge(this,zl,"f").createParameter(e.volume,bB.VolumeMapper,_.decible,"volume"),panning:ge(this,zl,"f").createParameter(e.panning,A.bipolar(),_.panning,"panning",.5),mute:ge(this,zl,"f").createParameter(e.mute,A.bool,_.bool,"mute"),solo:ge(this,zl,"f").createParameter(e.solo,A.bool,_.bool,"solo")}},_B=function(){let e=this.address.toString(),t=ge(this,Ut,"f").capture.targetAddress.unwrapOrUndefined(),n=()=>`AudioUnit '${e}' must have a capture. AudioUnit is typed ${this.type} and has input ${ge(this,Ut,"f").input.pointerHub.incoming().at(0)?.box.name}, but capture is ${t}`;V(this.type!==Qt.Instrument||ge(this,Ut,"f").capture.targetAddress.nonEmpty(),n)};nn.VolumeMapper=A.decibel(-96,-9,6);var qu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},rt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},gy,on,Jr,Ul,vy,yy,ef,PB,SB,Vt=class{constructor(e,t){gy.add(this),on.set(this,void 0),Jr.set(this,void 0),Ul.set(this,void 0),vy.set(this,void 0),yy.set(this,void 0),ef.set(this,void 0),qu(this,on,e,"f"),qu(this,Jr,t,"f"),qu(this,Ul,new j,"f"),qu(this,vy,rt(this,Ul,"f").own(new Hv(this,e.boxAdapters)),"f"),qu(this,yy,rt(this,Ul,"f").own(new Yv(this,e.boxAdapters)),"f"),qu(this,ef,rt(this,Ul,"f").own(new Hi(-1)),"f")}catchupAndSubscribePath(e){let t=[m.None,m.None],n=()=>{t.every(i=>i.nonEmpty())?e(m.wrap(t.map(i=>i.unwrap()))):e(m.None)};return ee.many(rt(this,gy,"m",PB).call(this,i=>{t[0].equals(i)||(t[0]=i,n())}),rt(this,gy,"m",SB).call(this,i=>{t[1].equals(i)||(t[1]=i,n())}))}get context(){return rt(this,on,"f")}set targetName(e){rt(this,Jr,"f").target.targetVertex.ifSome(t=>{let n=t.box;if(n instanceof yt){rt(this,on,"f").boxAdapters.adapterFor(n,nn).input.adapter().ifSome(o=>o.labelField.setValue(e));return}rt(this,on,"f").boxAdapters.optAdapter(n).ifSome(i=>{"labelField"in i&&i.labelField instanceof C&&i.labelField.setValue(e)})})}get targetName(){return rt(this,Jr,"f").target.targetVertex.flatMap(e=>{let t=e.box;if(t instanceof yt)return rt(this,on,"f").boxAdapters.adapterFor(t,nn).input.label;let n=rt(this,on,"f").boxAdapters.optAdapter(t);if(n.nonEmpty()){let i=n.unwrap();if("labelField"in i&&i.labelField instanceof C)return m.wrap(i.labelField.getValue())}return m.wrap(t.name)})}terminate(){rt(this,Ul,"f").terminate()}get audioUnit(){return Ce(rt(this,Jr,"f").tracks.targetVertex.unwrap().box,yt)}get target(){return rt(this,Jr,"f").target}get clips(){return rt(this,vy,"f")}get regions(){return rt(this,yy,"f")}get enabled(){return rt(this,Jr,"f").enabled}get indexField(){return rt(this,Jr,"f").index}get type(){return rt(this,Jr,"f").type.getValue()}get box(){return rt(this,Jr,"f")}get uuid(){return rt(this,Jr,"f").address.uuid}get address(){return rt(this,Jr,"f").address}get listIndex(){return rt(this,ef,"f").getValue()}set listIndex(e){rt(this,ef,"f").setValue(e)}accepts(e){switch(e.type){case"audio-clip":return this.type===me.Audio;case"note-clip":return this.type===me.Notes;case"value-clip":return this.type===me.Value;case"audio-region":return this.type===me.Audio;case"note-region":return this.type===me.Notes;case"value-region":return this.type===me.Value}}valueAt(e,t){if(!this.enabled.getValue())return t;let n=t,i=rt(this,on,"f").clipSequencing.iterate(this.uuid,e,e+Ng);for(let{optClip:o,sectionFrom:a}of i)n=o.match({none:()=>{let s=this.regions.collection.lowerEqual(e,l=>!l.mute);if(s===null){let l=this.regions.collection.optAt(0);return pt(l,va)?l.incomingValue(t):t}else if(pt(s,va))return e<s.complete?s.valueAt(e,t):s.outgoingValue(t);return t},some:s=>a===e&&pt(s,ts)?s.valueAt(e,t):t});return n}};on=new WeakMap,Jr=new WeakMap,Ul=new WeakMap,vy=new WeakMap,yy=new WeakMap,ef=new WeakMap,gy=new WeakSet,PB=function(e){let t=rt(this,Jr,"f").target.targetVertex;if(t.nonEmpty()){let n=t.unwrap().box;if(n instanceof yt)return rt(this,on,"f").boxAdapters.adapterFor(n,nn).input.catchupAndSubscribeLabelChange(a=>e(a));let i=rt(this,on,"f").boxAdapters.optAdapter(n);if(i.nonEmpty()){let o=i.unwrap();if("labelField"in o&&o.labelField instanceof C)return o.labelField.catchupAndSubscribe(a=>e(m.wrap(a.getValue())))}return e(m.wrap(n.name)),ee.Empty}return e(m.None),ee.Empty},SB=function(e){let t=this.type;switch(t){case me.Audio:case me.Notes:return e(m.wrap(me[t])),ee.Empty;case me.Value:{let n=rt(this,Jr,"f").target.targetVertex.unwrap();if(n.isField())e(rt(this,on,"f").parameterFieldAdapters.opt(n.address).map(i=>i.name));else if(n.isBox())e(m.wrap(n.name));else return D("Illegal State. Vertex is not a field nor box.");return ee.Empty}case me.Undefined:return e(m.wrap("")),ee.Empty;default:return e(m.None),ee.Empty}};var Er=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},_e=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ba,Di,cs,jl,xy,wy,Ll,Kl,us,ds,Wl,Hu,tf,EB=[c.Automation,c.Modulation,c.MIDIControl,c.ParameterController],Rl=class{constructor(e,t,n,i,o,a){ba.set(this,void 0),Di.set(this,void 0),cs.set(this,void 0),jl.set(this,void 0),xy.set(this,void 0),wy.set(this,void 0),Ll.set(this,new j),Kl.set(this,void 0),us.set(this,void 0),ds.set(this,m.None),Wl.set(this,m.None),Hu.set(this,null),tf.set(this,!1),Er(this,ba,e,"f"),Er(this,Di,t,"f"),Er(this,cs,n,"f"),Er(this,jl,i,"f"),Er(this,xy,o,"f"),Er(this,wy,a??0,"f"),_e(this,Ll,"f").own(_e(this,ba,"f").parameterFieldAdapters.register(this)),Er(this,Kl,_e(this,Ll,"f").own(new ce),"f"),Er(this,us,new ar,"f"),_e(this,Ll,"f").own(_e(this,Di,"f").subscribe(()=>_e(this,Kl,"f").notify(this))),_e(this,Ll,"f").own(_e(this,Di,"f").pointerHub.catchupAndSubscribe({onAdded:s=>{_e(this,us,"f").proxy.onControlSourceAdd(fA(s.pointerType)),s.box.accept({visitTrackBox:l=>{V(_e(this,ds,"f").isEmpty(),"Already assigned");let u=_e(this,ba,"f").boxAdapters.adapterFor(l,Vt);Er(this,ds,m.wrap(u),"f"),_e(this,ba,"f").isMainThread&&Er(this,Wl,m.wrap(_e(this,ba,"f").liveStreamReceiver.subscribeFloat(_e(this,Di,"f").address,p=>{_e(this,Hu,"f")!==p&&(Er(this,Hu,p,"f"),_e(this,Kl,"f").notify(this))})),"f")}})},onRemoved:s=>{_e(this,us,"f").proxy.onControlSourceRemove(fA(s.pointerType)),s.box.accept({visitTrackBox:l=>{V(_e(this,ds,"f").unwrapOrNull()?.address?.equals(l.address)===!0,`Unknown ${l}`),Er(this,ds,m.None,"f"),_e(this,ba,"f").isMainThread&&(_e(this,Wl,"f").ifSome(u=>u.terminate()),Er(this,Wl,m.None,"f"),Er(this,Hu,null,"f"),_e(this,Kl,"f").notify(this))}})}},...EB)),t.getValue(),n.clamp(t.getValue())}registerMidiControl(){return _e(this,us,"f").proxy.onControlSourceAdd("midi"),Er(this,tf,!0,"f"),{terminate:()=>{Er(this,tf,!1,"f"),_e(this,us,"f").proxy.onControlSourceRemove("midi")}}}get field(){return _e(this,Di,"f")}get valueMapping(){return _e(this,cs,"f")}get stringMapping(){return _e(this,jl,"f")}get name(){return _e(this,xy,"f")}get anchor(){return _e(this,wy,"f")}get type(){return _e(this,Di,"f").type}get address(){return _e(this,Di,"f").address}get track(){return _e(this,ds,"f")}valueAt(e){let t=_e(this,ds,"f");if(t.nonEmpty()){let n=t.unwrap();if(n.enabled)return this.valueMapping.y(n.valueAt(e,this.getUnitValue()))}return this.getValue()}subscribe(e){return _e(this,Kl,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}catchupAndSubscribeControlSources(e){return _e(this,tf,"f")&&e.onControlSourceAdd("midi"),_e(this,Di,"f").pointerHub.filter(...EB).forEach(t=>e.onControlSourceAdd(fA(t.pointerType))),_e(this,us,"f").subscribe(e)}getValue(){return _e(this,Di,"f").getValue()}setValue(e){let t=this.getUnitValue();_e(this,Di,"f").setValue(e),_e(this,ba,"f").parameterFieldAdapters.notifyWrite(this,t)}setUnitValue(e){this.setValue(_e(this,cs,"f").y(e))}getUnitValue(){return _e(this,cs,"f").x(this.getValue())}getControlledValue(){return _e(this,cs,"f").y(this.getControlledUnitValue())}getControlledUnitValue(){return _e(this,Hu,"f")??this.getUnitValue()}getControlledPrintValue(){return _e(this,jl,"f").x(this.getControlledValue())}getPrintValue(){return _e(this,jl,"f").x(this.getValue())}setPrintValue(e){let t=_e(this,jl,"f").y(e);t.type==="unitValue"?this.setUnitValue(be(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(_e(this,cs,"f").clamp(_e(this,Di,"f").initValue))}terminate(){_e(this,Wl,"f").ifSome(e=>e.terminate()),Er(this,Wl,m.None,"f"),_e(this,Ll,"f").terminate()}};ba=new WeakMap,Di=new WeakMap,cs=new WeakMap,jl=new WeakMap,xy=new WeakMap,wy=new WeakMap,Ll=new WeakMap,Kl=new WeakMap,us=new WeakMap,ds=new WeakMap,Wl=new WeakMap,Hu=new WeakMap,tf=new WeakMap;var fA=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 D(`${r.toString()} is an unknown pointer type`)}};var mA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Wn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Aa,Zl,by,Ay=class{constructor(e,t,n){Aa.set(this,void 0),Zl.set(this,void 0),by.set(this,void 0),mA(this,Aa,b.newSet(i=>i.uuid),"f"),mA(this,Zl,new ar,"f"),mA(this,by,e.catchupAndSubscribe({onAdded:i=>{let o=t(i.box),a=Wn(this,Aa,"f").add(o);V(a,`Could not add ${o}`),Wn(this,Zl,"f").proxy.onAdd(o)},onRemoved:i=>{let o=i.box.address.uuid;Wn(this,Zl,"f").proxy.onRemove(Wn(this,Aa,"f").removeByKey(o))}},n),"f")}subscribe(e){return Wn(this,Zl,"f").subscribe(e)}catchupAndSubscribe(e){return Wn(this,Aa,"f").forEach(t=>e.onAdd(t)),this.subscribe(e)}adapters(){return Wn(this,Aa,"f").values()}size(){return Wn(this,Aa,"f").size()}isEmpty(){return this.size()===0}terminate(){Wn(this,Aa,"f").clear(),Wn(this,Zl,"f").terminate(),Wn(this,by,"f").terminate()}};Aa=new WeakMap,Zl=new WeakMap,by=new WeakMap;var gA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},_t=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},vA,ci,rf,an,Fr,FB,tr=class{constructor(e,t){vA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Delay,rf.set(this,void 0),an.set(this,void 0),Fr.set(this,void 0),gA(this,rf,e,"f"),gA(this,an,t,"f"),gA(this,Fr,new we(_t(this,rf,"f")),"f"),this.namedParameter=_t(this,vA,"m",FB).call(this,t)}get box(){return _t(this,an,"f")}get uuid(){return _t(this,an,"f").address.uuid}get address(){return _t(this,an,"f").address}get indexField(){return _t(this,an,"f").index}get labelField(){return _t(this,an,"f").label}get enabledField(){return _t(this,an,"f").enabled}get minimizedField(){return _t(this,an,"f").minimized}get host(){return _t(this,an,"f").host}deviceHost(){return _t(this,rf,"f").boxAdapters.adapterFor(_t(this,an,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){_t(this,Fr,"f").terminate()}};ci=tr,rf=new WeakMap,an=new WeakMap,Fr=new WeakMap,vA=new WeakSet,FB=function(e){return{preSyncTimeLeft:_t(this,Fr,"f").createParameter(e.preSyncTimeLeft,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"pre sync L"),preMillisTimeLeft:_t(this,Fr,"f").createParameter(e.preMillisTimeLeft,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"pre ms L"),preSyncTimeRight:_t(this,Fr,"f").createParameter(e.preSyncTimeRight,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"pre sync R"),preMillisTimeRight:_t(this,Fr,"f").createParameter(e.preMillisTimeRight,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"pre ms R"),delay:_t(this,Fr,"f").createParameter(e.delayMusical,A.linearInteger(0,ci.Fractions.length-1),ci.FractionsStringMapping,"delay"),millisTime:_t(this,Fr,"f").createParameter(e.delayMillis,A.powerByCenter(100,0,ci.MAX_MILLIS_TIME),_.numeric({unit:"ms",fractionDigits:1}),"ms"),feedback:_t(this,Fr,"f").createParameter(e.feedback,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"feedback"),cross:_t(this,Fr,"f").createParameter(e.cross,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"cross"),lfoSpeed:_t(this,Fr,"f").createParameter(e.lfoSpeed,A.exponential(ci.LFO_SPEED_MIN,ci.LFO_SPEED_MAX),_.numeric({unit:"Hz",fractionDigits:2}),"lfo speed"),lfoDepth:_t(this,Fr,"f").createParameter(e.lfoDepth,A.power(4,0,ci.LFO_DEPTH_MAX),_.numeric({unit:"ms",fractionDigits:1}),"lfo depth"),filter:_t(this,Fr,"f").createParameter(e.filter,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"filter",.5),dry:_t(this,Fr,"f").createParameter(e.dry,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"dry"),wet:_t(this,Fr,"f").createParameter(e.wet,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"wet")}};tr.Fractions=wr.builder().add([0,1]).add([1,128]).add([1,96]).add([1,64]).add([1,48]).add([1,32]).add([1,24]).add([3,64]).add([1,16]).add([1,12]).add([3,32]).add([1,8]).add([1,6]).add([3,16]).add([1,4]).add([5,16]).add([1,3]).add([3,8]).add([7,16]).add([1,2]).add([1,1]).asAscendingArray();tr.FractionsStringMapping=_.indices("",ci.Fractions.map(([r,e])=>r===0?"Off":`${r}/${e}`));tr.MAX_MILLIS_TIME=1e3;tr.LFO_SPEED_MIN=.1;tr.LFO_SPEED_MAX=5;tr.LFO_DEPTH_MAX=50;var yA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},cr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},xA,nf,sn,To,BB,Ju=class{constructor(e,t){xA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Reverb,nf.set(this,void 0),sn.set(this,void 0),To.set(this,void 0),yA(this,nf,e,"f"),yA(this,sn,t,"f"),yA(this,To,new we(cr(this,nf,"f")),"f"),this.namedParameter=cr(this,xA,"m",BB).call(this,t)}get box(){return cr(this,sn,"f")}get uuid(){return cr(this,sn,"f").address.uuid}get address(){return cr(this,sn,"f").address}get indexField(){return cr(this,sn,"f").index}get labelField(){return cr(this,sn,"f").label}get enabledField(){return cr(this,sn,"f").enabled}get minimizedField(){return cr(this,sn,"f").minimized}get host(){return cr(this,sn,"f").host}deviceHost(){return cr(this,nf,"f").boxAdapters.adapterFor(cr(this,sn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){cr(this,To,"f").terminate()}};nf=new WeakMap,sn=new WeakMap,To=new WeakMap,xA=new WeakSet,BB=function(e){return{decay:cr(this,To,"f").createParameter(e.decay,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"Room-Size"),preDelay:cr(this,To,"f").createParameter(e.preDelay,A.exponential(.001,.5),_.numeric({unit:"s",fractionDigits:1,unitPrefix:!0}),"Pre-Delay"),damp:cr(this,To,"f").createParameter(e.damp,A.unipolar(),_.numeric({unit:"%",fractionDigits:0}),"damping"),filter:cr(this,To,"f").createParameter(e.filter,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"filter"),dry:cr(this,To,"f").createParameter(e.dry,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"dry"),wet:cr(this,To,"f").createParameter(e.wet,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"wet")}};var wA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Zt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},AA,of,Mi,Zn,DB,Qu=class{constructor(e,t){AA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Revamp,of.set(this,void 0),Mi.set(this,void 0),Zn.set(this,void 0),wA(this,of,e,"f"),wA(this,Mi,t,"f"),wA(this,Zn,new we(Zt(this,of,"f")),"f"),this.namedParameter=Zt(this,AA,"m",DB).call(this,t)}get box(){return Zt(this,Mi,"f")}get uuid(){return Zt(this,Mi,"f").address.uuid}get address(){return Zt(this,Mi,"f").address}get indexField(){return Zt(this,Mi,"f").index}get labelField(){return Zt(this,Mi,"f").label}get enabledField(){return Zt(this,Mi,"f").enabled}get minimizedField(){return Zt(this,Mi,"f").minimized}get host(){return Zt(this,Mi,"f").host}get spectrum(){return Zt(this,Mi,"f").address.append(4095)}deviceHost(){return Zt(this,of,"f").boxAdapters.adapterFor(Zt(this,Mi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Zt(this,Zn,"f").terminate()}};of=new WeakMap,Mi=new WeakMap,Zn=new WeakMap,AA=new WeakSet,DB=function(e){return{highPass:NB(Zt(this,Zn,"f"),e.highPass,"High-Pass"),lowShelf:IB(Zt(this,Zn,"f"),e.lowShelf,"Low-Shelf"),lowBell:bA(Zt(this,Zn,"f"),e.lowBell,"Low-Bell"),midBell:bA(Zt(this,Zn,"f"),e.midBell,"Mid-Bell"),highBell:bA(Zt(this,Zn,"f"),e.highBell,"High-Bell"),highShelf:IB(Zt(this,Zn,"f"),e.highShelf,"High-Shelf"),lowPass:NB(Zt(this,Zn,"f"),e.lowPass,"Low-Pass")}};var _A=A.exponential(20,2e4),MB=A.linear(-24,24),kB=A.exponential(.01,10),NB=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),order:r.createParameter(e.order,A.linearInteger(0,3),_.indices("db",["12","24","36","48"]),`${t} Order`),q:r.createParameter(e.q,kB,_.numeric({fractionDigits:3}),`${t} Q`)}),IB=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,MB,_.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5)}),bA=(r,e,t)=>({enabled:r.createParameter(e.enabled,A.bool,_.bool,"enabled"),frequency:r.createParameter(e.frequency,_A,_.numeric({unit:"Hz",fractionDigits:0}),`${t} Freq`),gain:r.createParameter(e.gain,MB,_.numeric({unit:"db",fractionDigits:1,bipolar:!0}),`${t} Gain`,.5),q:r.createParameter(e.q,kB,_.numeric({fractionDigits:3}),`${t} Q`)});var $B=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ui=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},_y,Py,di,ps=class{constructor(e,t){this.type="marker-event",_y.set(this,new j),Py.set(this,void 0),di.set(this,void 0),$B(this,Py,e,"f"),$B(this,di,t,"f"),ui(this,_y,"f").own(ui(this,di,"f").subscribe(Ue.Children,n=>{if(!this.trackAdapter.isEmpty()&&(n.type==="primitive"||n.type==="pointer")){let i=this.trackAdapter.unwrap();ui(this,di,"f").position.address.equals(n.address)?i.onSortingChanged():i.dispatchChange()}}))}get box(){return ui(this,di,"f")}get uuid(){return ui(this,di,"f").address.uuid}get address(){return ui(this,di,"f").address}get position(){return ui(this,di,"f").position.getValue()}get plays(){return ui(this,di,"f").plays.getValue()}get hue(){return ui(this,di,"f").hue.getValue()}get label(){return ui(this,di,"f").label.getValue()}get trackAdapter(){return ui(this,di,"f").track.targetVertex.map(e=>ui(this,Py,"f").boxAdapters.adapterFor(e.box,ln).markerTrack)}terminate(){ui(this,_y,"f").terminate()}toString(){return`{MarkerBoxAdapter ${b.toString(ui(this,di,"f").address.uuid).substring(0,4)}, plays: ${this.plays}`}};_y=new WeakMap,Py=new WeakMap,di=new WeakMap;ps.Comparator=(r,e)=>r.position-e.position;var af=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},cn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sf,Yu,lf,Gl,Sy,Ey=class{constructor(e,t){sf.set(this,void 0),Yu.set(this,void 0),lf.set(this,void 0),Gl.set(this,void 0),Sy.set(this,void 0),af(this,sf,e,"f"),af(this,Yu,t,"f"),this.changeNotifier=new ce,af(this,lf,b.newSet(n=>n.uuid),"f"),af(this,Gl,ai.create(ps.Comparator),"f"),af(this,Sy,cn(this,Yu,"f").markers.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>{if(n instanceof Xc){let i=cn(this,sf,"f").boxAdapters.adapterFor(n,ps),o=cn(this,lf,"f").add(i);V(o,"Could not add adapter"),cn(this,Gl,"f").add(i),this.dispatchChange()}},onRemoved:({box:{address:{uuid:n}}})=>{cn(this,Gl,"f").remove(cn(this,lf,"f").removeByKey(n)),this.dispatchChange()}}),"f")}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return cn(this,sf,"f")}get enabled(){return cn(this,Yu,"f").enabled.getValue()}get events(){return cn(this,Gl,"f")}get object(){return cn(this,Yu,"f")}dispatchChange(){this.changeNotifier.notify()}onSortingChanged(){cn(this,Gl,"f").onIndexingChanged(),this.dispatchChange()}terminate(){cn(this,Sy,"f").terminate()}};sf=new WeakMap,Yu=new WeakMap,lf=new WeakMap,Gl=new WeakMap,Sy=new WeakMap;var TB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ki=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Fy,By,$i,ql=class{constructor(e,t){this.type="signature-event",Fy.set(this,new j),By.set(this,void 0),$i.set(this,void 0),TB(this,By,e,"f"),TB(this,$i,t,"f"),ki(this,Fy,"f").own(ki(this,$i,"f").subscribe(Ue.Children,n=>this.trackAdapter.ifSome(i=>i.dispatchChange())))}get box(){return ki(this,$i,"f")}get uuid(){return ki(this,$i,"f").address.uuid}get address(){return ki(this,$i,"f").address}get index(){return ki(this,$i,"f").index.getValue()}get indexField(){return ki(this,$i,"f").index}get relativePosition(){return ki(this,$i,"f").relativePosition.getValue()}get nominator(){return ki(this,$i,"f").nominator.getValue()}get denominator(){return ki(this,$i,"f").denominator.getValue()}get trackAdapter(){return ki(this,$i,"f").events.targetVertex.map(e=>ki(this,By,"f").boxAdapters.adapterFor(e.box,ln).signatureTrack)}terminate(){ki(this,Fy,"f").terminate()}toString(){return`{SignatureEventBoxAdapter ${this.nominator}/${this.denominator}}`}};Fy=new WeakMap,By=new WeakMap,$i=new WeakMap;ql.Comparator=(r,e)=>r.index-e.index;var Ny=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ft=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Hl,cf,uf,Jl,_a,hs,RB,df,Iy=class{constructor(e,t,n){Hl.add(this),cf.set(this,new j),uf.set(this,void 0),Jl.set(this,void 0),_a.set(this,void 0),hs.set(this,void 0),Ny(this,uf,e,"f"),Ny(this,Jl,t,"f"),Ny(this,_a,n,"f"),this.changeNotifier=new ce,Ny(this,hs,Ft(this,cf,"f").own(sr.create(Ft(this,_a,"f").events,i=>e.boxAdapters.adapterFor(i,ql),c.SignatureAutomation)),"f"),Ft(this,cf,"f").ownAll(Ft(this,Jl,"f").subscribe(()=>this.dispatchChange()),Ft(this,_a,"f").enabled.subscribe(()=>this.dispatchChange()),Ft(this,hs,"f").subscribe({onAdd:i=>this.changeNotifier.notify(),onRemove:i=>this.changeNotifier.notify(),onReorder:i=>this.changeNotifier.notify()}))}subscribe(e){return this.changeNotifier.subscribe(e)}get context(){return Ft(this,uf,"f")}get enabled(){return Ft(this,_a,"f").enabled.getValue()}get object(){return Ft(this,_a,"f")}get size(){return Ft(this,hs,"f").size()}get storageSignature(){let{nominator:e,denominator:t}=Ft(this,Jl,"f");return[e.getValue(),t.getValue()]}nonEmpty(){return Ft(this,hs,"f").size()>0}dispatchChange(){this.changeNotifier.notify()}signatureAt(e){e=Math.max(0,e);let t=this.storageSignature;for(let{accumulatedPpqn:n,nominator:i,denominator:o}of this.iterateAll()){if(n>e)break;t=[i,o]}return t}*iterateAll(){let e=0,t=0,[n,i]=this.storageSignature;if(yield{index:-1,accumulatedPpqn:e,accumulatedBars:t,nominator:n,denominator:i},!!Ft(this,_a,"f").enabled.getValue())for(let o of Ft(this,hs,"f").adapters())e+=J.fromSignature(n,i)*o.relativePosition,t+=o.relativePosition,n=o.nominator,i=o.denominator,yield{index:o.index,accumulatedPpqn:e,accumulatedBars:t,nominator:n,denominator:i}}changeSignature(e,t){let n=Array.from(this.iterateAll()).slice(1),i=n.map(l=>l.accumulatedPpqn);Ft(this,Jl,"f").nominator.setValue(e),Ft(this,Jl,"f").denominator.setValue(t);let o=0,a=0,s=J.fromSignature(e,t);for(let l=0;l<n.length;l++){let u=n[l],p=this.adapterAt(u.index);if(p.isEmpty())continue;let h=(i[l]-o)/s,g=Math.floor(h),v=h-g;a+=v;let y=g;a>=1&&(y++,a--),y=Math.max(1,y),p.unwrap().box.relativePosition.setValue(y),o+=y*s,s=J.fromSignature(u.nominator,u.denominator)}}deleteAdapter(e){let t=e.index,n=Array.from(this.iterateAll()).slice(1),i=n.findIndex(g=>g.index===t);if(i===-1)return;let o=n.slice(i+1),a=o.map(g=>g.accumulatedPpqn),s=i>0?n[i-1]:null,[l,u]=s!==null?[s.nominator,s.denominator]:this.storageSignature,p=s!==null?s.accumulatedPpqn:0;e.box.delete();let d=p,h=J.fromSignature(l,u);for(let g=0;g<o.length;g++){let v=o[g],y=this.adapterAt(v.index);if(y.isEmpty())continue;let B=(a[g]-d)/h,I=Math.max(1,Math.round(B));y.unwrap().box.relativePosition.setValue(I),d+=I*h,h=J.fromSignature(v.nominator,v.denominator)}}createEvent(e,t,n){let i=Array.from(this.iterateAll()),o=i[0],a=0;for(let y=1;y<i.length&&!(i[y].accumulatedPpqn>e);y++)o=i[y],a=y;let s=J.fromSignature(o.nominator,o.denominator),l=(e-o.accumulatedPpqn)/s,u=Math.max(1,Math.round(l)),p=o.index+1,d=i.slice(a+1),h=o.accumulatedPpqn+u*s,g=J.fromSignature(t,n),v=d.map(y=>({event:y,adapter:this.adapterAt(y.index)})).filter(({adapter:y})=>y.nonEmpty()).map(({event:y,adapter:x})=>({event:y,adapter:x.unwrap()}));for(let y=0;y<v.length;y++){let{event:x,adapter:B}=v[y];if(B.box.index.setValue(x.index+1),y===0){let I=(x.accumulatedPpqn-h)/g;B.box.relativePosition.setValue(Math.max(1,Math.round(I)))}}Hc.create(Ft(this,uf,"f").boxGraph,b.generate(),y=>{y.index.setValue(p),y.relativePosition.setValue(u),y.nominator.setValue(t),y.denominator.setValue(n),y.events.refer(Ft(this,_a,"f").events)})}adapterAt(e){return Ft(this,hs,"f").getAdapterByIndex(e)}moveEvent(e,t){let n=Array.from(this.iterateAll()).slice(1),i=n.findIndex(h=>h.index===e.index);if(i===-1)return;let o=n[i];if(t===o.accumulatedPpqn)return;let a=n.map(h=>h.accumulatedBars),s=Ft(this,Hl,"m",RB).call(this,t,o.index);if(s===o.accumulatedBars)return;let l=[...a];l[i]=s;let u=l.map((h,g)=>({bar:h,i:g})).sort((h,g)=>h.bar-g.bar).map(h=>h.i),p=n.map(h=>this.adapterAt(h.index).unwrap());for(let h=0;h<u.length;h++)p[u[h]].box.index.setValue(h);let d=0;for(let h=0;h<u.length;h++){let g=u[h],v=p[g],y=l[g],x=Math.max(1,y-d);v.box.relativePosition.setValue(x),d=y}}floorToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.floor((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}ceilToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.ceil((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}roundToBar(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.round((e-t.accumulatedPpqn)/n);return t.accumulatedPpqn+i*n}barLengthAt(e){let[t,n]=this.signatureAt(e);return J.fromSignature(t,n)}getBarInterval(e){let{event:t,barPpqn:n}=Ft(this,Hl,"m",df).call(this,e),i=Math.floor((e-t.accumulatedPpqn)/n),o=t.accumulatedPpqn+i*n;return{position:o,complete:o+n}}terminate(){Ft(this,cf,"f").terminate()}};cf=new WeakMap,uf=new WeakMap,Jl=new WeakMap,_a=new WeakMap,hs=new WeakMap,Hl=new WeakSet,RB=function(e,t){let n=null;for(let a of this.iterateAll())if(a.index!==t){if(a.accumulatedPpqn>e)break;n=a}if(uo(n)){let[a,s]=this.storageSignature,l=J.fromSignature(a,s);return Math.max(1,Math.round(e/l))}let i=J.fromSignature(n.nominator,n.denominator),o=Math.round((e-n.accumulatedPpqn)/i);return Math.max(1,n.accumulatedBars+o)},df=function(e){let t=null;for(let n of this.iterateAll()){if(n.accumulatedPpqn>e)break;t=n}if(uo(t)){let[n,i]=this.storageSignature;return{event:{index:-1,accumulatedPpqn:0,accumulatedBars:0,nominator:n,denominator:i},barPpqn:J.fromSignature(n,i)}}return{event:t,barPpqn:J.fromSignature(t.nominator,t.denominator)}};var pf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},jt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hf,Ro,Dy,My,Pa,ff,ky,ln=class{constructor(e,t){hf.set(this,new j),Ro.set(this,void 0),Dy.set(this,void 0),My.set(this,void 0),Pa.set(this,void 0),ff.set(this,void 0),ky.set(this,()=>{let{tempoTrack:{enabled:s}}=jt(this,Ro,"f");return s.getValue()?jt(this,Pa,"f").isEmpty()?m.None:jt(this,Pa,"f").unwrap().events.isEmpty()?m.None:jt(this,Pa,"f"):m.None}),pf(this,Ro,t,"f"),pf(this,Dy,new Ey(e,t.markerTrack),"f"),pf(this,My,new Iy(e,t.signature,t.signatureTrack),"f"),pf(this,Pa,new Mr,"f"),pf(this,ff,new ce,"f");let n=jt(this,hf,"f").own(new j),i=()=>jt(this,ff,"f").notify(jt(this,ky,"f").call(this)),{tempoTrack:{events:o,enabled:a}}=t;jt(this,hf,"f").own(o.catchupAndSubscribe(({targetVertex:s})=>{n.terminate(),s.match({none:()=>jt(this,Pa,"f").clear(),some:({box:l})=>{let u=e.boxAdapters.adapterFor(l,_r);jt(this,Pa,"f").wrap(u),n.ownAll(u.subscribeChange(i),a.subscribe(i))}})}))}catchupAndSubscribeTempoAutomation(e){return e(jt(this,ky,"f").call(this)),jt(this,ff,"f").subscribe(e)}get box(){return jt(this,Ro,"f")}get uuid(){return jt(this,Ro,"f").address.uuid}get address(){return jt(this,Ro,"f").address}get markerTrack(){return jt(this,Dy,"f")}get signatureTrack(){return jt(this,My,"f")}get tempoTrackEvents(){return jt(this,Pa,"f")}get signature(){let{nominator:e,denominator:t}=jt(this,Ro,"f").signature;return[e.getValue(),t.getValue()]}get signatureDuration(){let{nominator:e,denominator:t}=jt(this,Ro,"f").signature;return J.fromSignature(e.getValue(),t.getValue())}catchupAndSubscribeSignature(e){return e(this.signature),jt(this,Ro,"f").signature.subscribe(()=>e(this.signature))}terminate(){jt(this,hf,"f").terminate()}};hf=new WeakMap,Ro=new WeakMap,Dy=new WeakMap,My=new WeakMap,Pa=new WeakMap,ff=new WeakMap,ky=new WeakMap;var Fk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},fs,ms=class{constructor(e,t){fs.set(this,void 0),Fk(this,fs,t,"f")}get box(){return mf(this,fs,"f")}get uuid(){return mf(this,fs,"f").address.uuid}get address(){return mf(this,fs,"f").address}get source(){return mf(this,fs,"f").source.targetVertex.unwrap("Insufficient Vertex")}get target(){return mf(this,fs,"f").target.targetVertex.unwrap("Insufficient Vertex")}terminate(){}};fs=new WeakMap;var Ql=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},un=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$y,Yl,Xl,Ty,Ry,gf,dn=class{constructor(e,t){$y.set(this,void 0),Yl.set(this,void 0),Xl.set(this,void 0),Ty.set(this,void 0),Ry.set(this,void 0),gf.set(this,!1),Ql(this,$y,e,"f"),Ql(this,Yl,t,"f"),Ql(this,Xl,new j,"f"),Ql(this,Ty,t.attributes,"f"),Ql(this,Ry,un(this,Xl,"f").own(new we(e)),"f")}get inputs(){throw new Error("Method not implemented.")}get outputs(){throw new Error("Method not implemented.")}own(e){return un(this,Xl,"f").own(e)}ownAll(...e){un(this,Xl,"f").ownAll(...e)}onSelected(){Ql(this,gf,!0,"f")}onDeselected(){Ql(this,gf,!1,"f")}isSelected(){return un(this,gf,"f")}get box(){return un(this,Yl,"f")}get attributes(){return un(this,Ty,"f")}get uuid(){return un(this,Yl,"f").address.uuid}get address(){return un(this,Yl,"f").address}get parameters(){return un(this,Ry,"f")}get modular(){return un(this,$y,"f").boxAdapters.adapterFor(un(this,Yl,"f").attributes.collection.targetVertex.unwrap().box,gs)}terminate(){un(this,Xl,"f").terminate()}};$y=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,Ty=new WeakMap,Ry=new WeakMap,gf=new WeakMap;var Cy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Sa=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Oy,vs,vf,Vy,Rr;(function(r){r.Input="input",r.Output="output"})(Rr||(Rr={}));var Cr=class r{static create(e,t,n,i){return new r(e,t,n,i??t.fieldName)}constructor(e,t,n,i){Oy.set(this,void 0),vs.set(this,void 0),vf.set(this,void 0),Vy.set(this,void 0),Cy(this,Oy,e,"f"),Cy(this,vs,t,"f"),Cy(this,vf,n,"f"),Cy(this,Vy,i,"f")}matches(e){return this.direction!==e.direction&&this.field.pointerRules.accepts.some(t=>e.field.pointerRules.accepts.some(n=>n===t))}get connections(){return Sa(this,vs,"f").pointerHub.isEmpty()?U.empty():Sa(this,vs,"f").pointerHub.filter(c.VoltageConnection).map(({box:e})=>Sa(this,Oy,"f").adapterFor(e,ms))}get field(){return Sa(this,vs,"f")}get address(){return Sa(this,vs,"f").address}get direction(){return Sa(this,vf,"f")}get name(){return Sa(this,Vy,"f")}toString(){return`{ModuleConnectorAdapter address: ${Sa(this,vs,"f").address.toString()}, direction: ${Sa(this,vf,"f")}}`}};Oy=new WeakMap,vs=new WeakMap,vf=new WeakMap,Vy=new WeakMap;var PA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},yf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zy,xf,wf,Xu=class extends dn{constructor(e,t){super(e,t),zy.set(this,void 0),xf.set(this,void 0),wf.set(this,void 0),PA(this,zy,this.parameters.createParameter(t.time,A.exponential(1,1e4),_.numeric({unit:"ms"}),"Time"),"f"),PA(this,xf,Cr.create(e.boxAdapters,t.voltageInput,Rr.Input,"Input"),"f"),PA(this,wf,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Output"),"f")}get parameterTime(){return yf(this,zy,"f")}get voltageInput(){return yf(this,xf,"f")}get voltageOutput(){return yf(this,wf,"f")}get inputs(){return[yf(this,xf,"f")]}get outputs(){return[yf(this,wf,"f")]}};zy=new WeakMap,xf=new WeakMap,wf=new WeakMap;var Bk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},CB=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},bf,ed=class extends dn{constructor(e,t){super(e,t),bf.set(this,void 0),Bk(this,bf,Cr.create(e.boxAdapters,t.input,Rr.Input,"Input"),"f")}get voltageInput(){return CB(this,bf,"f")}get inputs(){return[CB(this,bf,"f")]}get outputs(){return U.empty()}};bf=new WeakMap;var SA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Af=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Uy,_f,Pf,td=class extends dn{constructor(e,t){super(e,t),Uy.set(this,void 0),_f.set(this,void 0),Pf.set(this,void 0),SA(this,Uy,this.parameters.createParameter(t.gain,A.DefaultDecibel,_.numeric({unit:"db"}),"Gain"),"f"),SA(this,_f,Cr.create(e.boxAdapters,t.voltageInput,Rr.Input,"Input"),"f"),SA(this,Pf,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Output"),"f")}get parameterGain(){return Af(this,Uy,"f")}get voltageInput(){return Af(this,_f,"f")}get voltageOutput(){return Af(this,Pf,"f")}get inputs(){return[Af(this,_f,"f")]}get outputs(){return[Af(this,Pf,"f")]}};Uy=new WeakMap,_f=new WeakMap,Pf=new WeakMap;var EA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},FA=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},jy,Ly,Ky,rd=class extends dn{constructor(e,t){super(e,t),jy.set(this,void 0),Ly.set(this,void 0),Ky.set(this,void 0),EA(this,jy,Cr.create(e.boxAdapters,t.voltageInputX,Rr.Input,"X"),"f"),EA(this,Ly,Cr.create(e.boxAdapters,t.voltageInputY,Rr.Input,"Y"),"f"),EA(this,Ky,Cr.create(e.boxAdapters,t.voltageOutput,Rr.Output,"Result"),"f")}get inputs(){return[FA(this,jy,"f"),FA(this,Ly,"f")]}get outputs(){return[FA(this,Ky,"f")]}};jy=new WeakMap,Ly=new WeakMap,Ky=new WeakMap;var Nk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},OB=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Sf,id=class extends dn{constructor(e,t){super(e,t),Sf.set(this,void 0),Nk(this,Sf,Cr.create(e.boxAdapters,t.output,Rr.Output,"Output"),"f")}get voltageOutput(){return OB(this,Sf,"f")}get inputs(){return U.empty()}get outputs(){return[OB(this,Sf,"f")]}};Sf=new WeakMap;var nd;(function(r){r.isVertexOfModule=e=>e.box.accept({visitModuleGainBox:()=>!0,visitModuleDelayBox:()=>!0,visitModuleMultiplierBox:()=>!0,visitModularAudioInputBox:()=>!0,visitModularAudioOutputBox:()=>!0})??!1,r.adapterFor=(e,t)=>he(t.accept({visitModuleGainBox:n=>e.adapterFor(n,td),visitModuleDelayBox:n=>e.adapterFor(n,Xu),visitModuleMultiplierBox:n=>e.adapterFor(n,rd),visitModularAudioInputBox:n=>e.adapterFor(n,id),visitModularAudioOutputBox:n=>e.adapterFor(n,ed)}),`Could not find ModuleAdapter for ${t.name}`)})(nd||(nd={}));var VB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ec=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Wy,Zy,tc,BA,od=class{constructor(e,t){Wy.add(this),Zy.set(this,void 0),tc.set(this,void 0),VB(this,Zy,e,"f"),VB(this,tc,t,"f")}get box(){return ec(this,tc,"f")}get uuid(){return ec(this,tc,"f").address.uuid}get address(){return ec(this,tc,"f").address}get moduleAdapter(){return nd.adapterFor(ec(this,Zy,"f").boxAdapters,ec(this,Wy,"a",BA).box)}get parameterAdapter(){return this.moduleAdapter.parameters.parameterAt(ec(this,Wy,"a",BA).address)}terminate(){}};Zy=new WeakMap,tc=new WeakMap,Wy=new WeakSet,BA=function(){return ec(this,tc,"f").parameter.targetVertex.unwrap("Parameter not assigned")};var zB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ad,hi,ys=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Modular,ad.set(this,void 0),hi.set(this,void 0),zB(this,ad,e,"f"),zB(this,hi,t,"f")}get box(){return pi(this,hi,"f")}get uuid(){return pi(this,hi,"f").address.uuid}get address(){return pi(this,hi,"f").address}get indexField(){return pi(this,hi,"f").index}get labelField(){return pi(this,hi,"f").label}get enabledField(){return pi(this,hi,"f").enabled}get minimizedField(){return pi(this,hi,"f").minimized}get host(){return pi(this,hi,"f").host}parameterAt(e){return D("Not yet implemented")}deviceHost(){return pi(this,ad,"f").boxAdapters.adapterFor(pi(this,hi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}modular(){return pi(this,ad,"f").boxAdapters.adapterFor(pi(this,hi,"f").modularSetup.targetVertex.unwrap("No Modular found").box,gs)}elements(){return pi(this,hi,"f").userInterface.elements.pointerHub.filter(c.DeviceUserInterface).map(e=>pi(this,ad,"f").boxAdapters.adapterFor(e.box,od))}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}};ad=new WeakMap,hi=new WeakMap;var Ef=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ot=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},sd,xs,ld,Ti,rc,ic,gs=class{constructor(e,t){sd.set(this,new j),xs.set(this,void 0),ld.set(this,void 0),Ti.set(this,void 0),rc.set(this,void 0),ic.set(this,void 0),Ef(this,ld,e,"f"),Ef(this,Ti,t,"f"),Ef(this,xs,ot(this,sd,"f").own(new ar),"f"),Ef(this,rc,b.newSet(s=>s.uuid),"f"),Ef(this,ic,b.newSet(s=>s.uuid),"f");let n=s=>{let l=nd.adapterFor(ot(this,ld,"f").boxAdapters,s.box);ot(this,rc,"f").add(l)&&ot(this,xs,"f").proxy.onModuleAdded(l)},i=s=>ot(this,xs,"f").proxy.onModuleRemoved(ot(this,rc,"f").removeByKey(s.address.uuid)),o=s=>{let l=ot(this,ld,"f").boxAdapters.adapterFor(s.box,ms);ot(this,ic,"f").add(l)&&ot(this,xs,"f").proxy.onConnectionAdded(l)},a=s=>ot(this,xs,"f").proxy.onConnectionRemoved(ot(this,ic,"f").removeByKey(s.address.uuid));ot(this,Ti,"f").modules.pointerHub.filter(c.ModuleCollection).forEach(n),ot(this,Ti,"f").connections.pointerHub.filter(c.ConnectionCollection).forEach(o),ot(this,sd,"f").own(ot(this,Ti,"f").modules.pointerHub.subscribe({onAdded:n,onRemoved:i},c.ModuleCollection)),ot(this,sd,"f").own(ot(this,Ti,"f").connections.pointerHub.subscribe({onAdded:o,onRemoved:a},c.ConnectionCollection))}catchupAndSubscribe(e){return K0(e.onModuleAdded,t=>ot(this,rc,"f").forEach(n=>t(n))),K0(e.onConnectionAdded,t=>ot(this,ic,"f").forEach(n=>t(n))),ot(this,xs,"f").subscribe(e)}get box(){return ot(this,Ti,"f")}get address(){return ot(this,Ti,"f").address}get uuid(){return ot(this,Ti,"f").address.uuid}get editingField(){return ot(this,Ti,"f").editing}get labelField(){return ot(this,Ti,"f").label}get modules(){return ot(this,rc,"f").values()}get connections(){return ot(this,ic,"f").values()}get device(){return ot(this,ld,"f").boxAdapters.adapterFor(he(ot(this,Ti,"f").device.pointerHub.incoming().at(0),"No device found").box,ys)}terminate(){console.debug(`terminate ${this}`),ot(this,sd,"f").terminate()}};sd=new WeakMap,xs=new WeakMap,ld=new WeakMap,Ti=new WeakMap,rc=new WeakMap,ic=new WeakMap;var Ff=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Qr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},NA,ud,Bf,Gy,cd,If,qy,Nf,Hy,UB,Co=class{constructor(e,t){NA.add(this),this.type="groove-adapter",Bf.set(this,new j),Gy.set(this,void 0),cd.set(this,void 0),If.set(this,void 0),qy.set(this,new _g({duration:()=>Qr(this,Hy,"f"),fx:n=>q0(n,Qr(this,Nf,"f")),fy:n=>q0(n,1-Qr(this,Nf,"f"))})),Nf.set(this,0),Hy.set(this,J.SemiQuaver*2),Ff(this,Gy,e,"f"),Ff(this,cd,t,"f"),Ff(this,If,Qr(this,Bf,"f").own(new we(Qr(this,Gy,"f"))),"f"),this.namedParameter=Qr(this,NA,"m",UB).call(this,t),Qr(this,Bf,"f").ownAll(this.namedParameter.duration.catchupAndSubscribe(n=>Ff(this,Hy,n.getValue(),"f")),this.namedParameter.amount.catchupAndSubscribe(n=>Ff(this,Nf,HF(n.getValue(),.01),"f")))}unwarp(e){return Qr(this,qy,"f").unwarp(e)}warp(e){return Qr(this,qy,"f").warp(e)}get box(){return Qr(this,cd,"f")}get uuid(){return Qr(this,cd,"f").address.uuid}get address(){return Qr(this,cd,"f").address}terminate(){Qr(this,Bf,"f").terminate()}};ud=Co,Bf=new WeakMap,Gy=new WeakMap,cd=new WeakMap,If=new WeakMap,qy=new WeakMap,Nf=new WeakMap,Hy=new WeakMap,NA=new WeakSet,UB=function(e){return{duration:Qr(this,If,"f").createParameter(e.duration,A.values(ud.DurationPPQNs),_.values("",ud.DurationPPQNs,ud.DurationStrings),"duration"),amount:Qr(this,If,"f").createParameter(e.amount,A.unipolar(),_.percent({fractionDigits:0}),"amount")}};Co.Durations=[[1,8],[1,4],[1,4],[1,2],[1,1],[2,1],[4,1],[8,1],[16,1]];Co.DurationPPQNs=ud.Durations.map(([r,e])=>J.fromSignature(r,e));Co.DurationStrings=ud.Durations.map(([r,e])=>`${r}/${e}`);var dd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Rt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Oo,ws,pd,Jy,Qy,Df,Mf,IA,bs=class{constructor(e,t,n,i,o){Oo.set(this,void 0),ws.set(this,void 0),pd.set(this,void 0),Jy.set(this,void 0),Qy.set(this,void 0),Df.set(this,new j),Mf.set(this,void 0),IA.set(this,m.None),dd(this,Oo,e,"f"),dd(this,ws,t,"f"),dd(this,pd,n,"f"),dd(this,Jy,i,"f"),dd(this,Qy,o??0,"f"),dd(this,Mf,Rt(this,Df,"f").own(new ce),"f"),Rt(this,Df,"f").own(Rt(this,Oo,"f").subscribe(()=>Rt(this,Mf,"f").notify(this))),e.getValue(),t.clamp(e.getValue())}get field(){return Rt(this,Oo,"f")}get valueMapping(){return Rt(this,ws,"f")}get stringMapping(){return Rt(this,pd,"f")}get name(){return Rt(this,Jy,"f")}get anchor(){return Rt(this,Qy,"f")}get type(){return Rt(this,Oo,"f").type}get address(){return Rt(this,Oo,"f").address}get track(){return Rt(this,IA,"f")}subscribe(e){return Rt(this,Mf,"f").subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}getValue(){return Rt(this,Oo,"f").getValue()}setValue(e){Rt(this,Oo,"f").setValue(Rt(this,ws,"f").clamp(e))}setUnitValue(e){this.setValue(Rt(this,ws,"f").y(e))}getUnitValue(){return Rt(this,ws,"f").x(this.getValue())}getPrintValue(){return Rt(this,pd,"f").x(this.getValue())}setPrintValue(e){let t=Rt(this,pd,"f").y(e);t.type==="unitValue"?this.setUnitValue(be(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(Rt(this,ws,"f").clamp(Rt(this,Oo,"f").initValue))}terminate(){Rt(this,Df,"f").terminate()}};Oo=new WeakMap,ws=new WeakMap,pd=new WeakMap,Jy=new WeakMap,Qy=new WeakMap,Df=new WeakMap,Mf=new WeakMap,IA=new WeakMap;var hd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Vo,Yy,Xy,ex,tx,rx,ix=class{constructor(e){Vo.set(this,void 0),Yy.set(this,void 0),Xy.set(this,void 0),ex.set(this,void 0),tx.set(this,void 0),rx.set(this,void 0),hd(this,Vo,e,"f"),hd(this,Yy,new bs(pn(this,Vo,"f").keyboard,A.values([88,76,61,49]),_.numeric({fractionDigits:1}),"Keyboard Type"),"f"),hd(this,Xy,new bs(pn(this,Vo,"f").timeRangeInQuarters,A.exponential(1,64),_.numeric({fractionDigits:1}),"Time-Range"),"f"),hd(this,ex,new bs(pn(this,Vo,"f").noteScale,A.exponential(.5,2),_.numeric({fractionDigits:1}),"Note Scale"),"f"),hd(this,tx,new bs(pn(this,Vo,"f").noteLabels,A.bool,_.bool,"Note Labels"),"f"),hd(this,rx,new bs(pn(this,Vo,"f").transpose,A.linearInteger(-48,48),_.numeric({fractionDigits:0}),"Transpose"),"f")}subscribe(e){return pn(this,Vo,"f").box.subscribe(Ue.Children,()=>e(this))}get object(){return pn(this,Vo,"f")}get keyboard(){return pn(this,Yy,"f")}get timeRangeInQuarters(){return pn(this,Xy,"f")}get noteScale(){return pn(this,ex,"f")}get noteLabels(){return pn(this,tx,"f")}get transpose(){return pn(this,rx,"f")}};Vo=new WeakMap,Yy=new WeakMap,Xy=new WeakMap,ex=new WeakMap,tx=new WeakMap,rx=new WeakMap;var kf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},rr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},nc,Ri,oc,nx,ox,fd=class{constructor(e,t){nc.set(this,void 0),Ri.set(this,void 0),oc.set(this,void 0),nx.set(this,void 0),ox.set(this,void 0),kf(this,nc,e,"f"),kf(this,Ri,t,"f"),kf(this,oc,sr.create(rr(this,Ri,"f").audioUnits,n=>rr(this,nc,"f").boxAdapters.adapterFor(n,nn),c.AudioUnits),"f"),kf(this,nx,new Ay(rr(this,Ri,"f").audioBusses.pointerHub,n=>rr(this,nc,"f").boxAdapters.adapterFor(n,Hr),c.AudioBusses),"f"),kf(this,ox,new ix(rr(this,Ri,"f").pianoMode),"f")}get uuid(){return rr(this,Ri,"f").address.uuid}get address(){return rr(this,Ri,"f").address}get box(){return rr(this,Ri,"f")}get audioBusses(){return rr(this,nx,"f")}get audioUnits(){return rr(this,oc,"f")}get clips(){return rr(this,oc,"f").adapters().flatMap(e=>e.tracks.collection.adapters()).flatMap(e=>e.clips.collection.adapters())}get groove(){return rr(this,nc,"f").boxAdapters.adapterFor(rr(this,Ri,"f").groove.targetVertex.unwrap("no groove").box,Co)}get timeline(){return rr(this,nc,"f").boxAdapters.adapterFor(rr(this,Ri,"f").timeline.targetVertex.unwrap("no timeline").box,ln)}get pianoMode(){return rr(this,ox,"f")}get created(){return new Date(rr(this,Ri,"f").created.getValue())}get midiOutputDevices(){return rr(this,Ri,"f").outputMidiDevices.pointerHub.incoming().map(({box:e})=>Ce(e,Tn))}*labeledAudioOutputs(){for(let e of rr(this,oc,"f").adapters())yield{label:e.label,address:e.address,children:()=>m.wrap(e.labeledAudioOutputs())}}terminate(){rr(this,oc,"f").terminate()}};nc=new WeakMap,Ri=new WeakMap,oc=new WeakMap,nx=new WeakMap,ox=new WeakMap;var DA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Or=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},MA,$f,Gn,As,jB,md=class{constructor(e,t){MA.add(this),this.type="instrument",this.accepts="audio",this.manualUrl=pe.Tape,$f.set(this,void 0),Gn.set(this,void 0),As.set(this,void 0),DA(this,$f,e,"f"),DA(this,Gn,t,"f"),DA(this,As,new we(Or(this,$f,"f")),"f"),this.namedParameter=Or(this,MA,"m",jB).call(this,t)}get box(){return Or(this,Gn,"f")}get uuid(){return Or(this,Gn,"f").address.uuid}get address(){return Or(this,Gn,"f").address}get labelField(){return Or(this,Gn,"f").label}get iconField(){return Or(this,Gn,"f").icon}get defaultTrackType(){return me.Audio}get enabledField(){return Or(this,Gn,"f").enabled}get minimizedField(){return Or(this,Gn,"f").minimized}get acceptsMidiEvents(){return!1}deviceHost(){return Or(this,$f,"f").boxAdapters.adapterFor(Or(this,Gn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Or(this,As,"f").terminate()}};$f=new WeakMap,Gn=new WeakMap,As=new WeakMap,MA=new WeakSet,jB=function(e){return{flutter:Or(this,As,"f").createParameter(e.flutter,A.unipolar(),_.percent(),"flutter"),wow:Or(this,As,"f").createParameter(e.wow,A.unipolar(),_.percent(),"wow"),noise:Or(this,As,"f").createParameter(e.noise,A.unipolar(),_.percent(),"noise"),saturation:Or(this,As,"f").createParameter(e.saturation,A.unipolar(),_.percent(),"saturation")}};var zo=(()=>{let t=[1,2,3,4],n=["12","24","36","48"],i=[ut.sine,ut.triangle,ut.saw,ut.square],o=["Sine","Triangle","Saw","Square"];return{MIN_CUTOFF:20,MAX_CUTOFF:2e4,CUTOFF_VALUE_MAPPING:A.exponential(20,2e4),CUTOFF_STRING_MAPPING:_.numeric({unit:"Hz"}),FILTER_ORDER_VALUES:t,FILTER_ORDER_STRINGS:n,FILTER_ORDER_VALUE_MAPPING:A.values(t),FILTER_ORDER_STRING_MAPPING:_.values("db",t,n),LFO_WAVEFORM_VALUES:i,LFO_WAVEFORM_STRINGS:o,LFO_WAVEFORM_VALUE_MAPPING:A.values(i),LFO_WAVEFORM_STRING_MAPPING:_.values("",i,o)}})();var kA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},We=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$A,Tf,qn,it,LB,gd=class{constructor(e,t){$A.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Vaporisateur,Tf.set(this,void 0),qn.set(this,void 0),it.set(this,void 0),kA(this,Tf,e,"f"),kA(this,qn,t,"f"),kA(this,it,new we(We(this,Tf,"f")),"f"),this.namedParameter=We(this,$A,"m",LB).call(this,t)}get box(){return We(this,qn,"f")}get uuid(){return We(this,qn,"f").address.uuid}get address(){return We(this,qn,"f").address}get labelField(){return We(this,qn,"f").label}get iconField(){return We(this,qn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return We(this,qn,"f").enabled}get minimizedField(){return We(this,qn,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return We(this,Tf,"f").boxAdapters.adapterFor(We(this,qn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){We(this,it,"f").terminate()}};Tf=new WeakMap,qn=new WeakMap,it=new WeakMap,$A=new WeakSet,LB=function(e){let t=[_o.Monophonic,_o.Polyphonic];return{oscillators:e.oscillators.fields().map(n=>({waveform:We(this,it,"f").createParameter(n.waveform,A.linearInteger(0,3),_.indices("",["Sine","Triangle","Sawtooth","Square"]),"Waveform"),volume:We(this,it,"f").createParameter(n.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"Volume"),octave:We(this,it,"f").createParameter(n.octave,A.linearInteger(-3,3),_.numeric({unit:"oct"}),"Octave",.5),tune:We(this,it,"f").createParameter(n.tune,A.linear(-1200,1200),_.numeric({unit:"ct",fractionDigits:0}),"Tune",.5)})),noise:{volume:We(this,it,"f").createParameter(e.noise.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"Volume"),attack:We(this,it,"f").createParameter(e.noise.attack,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Attack"),hold:We(this,it,"f").createParameter(e.noise.hold,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Hold"),release:We(this,it,"f").createParameter(e.noise.release,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Release")},filterOrder:We(this,it,"f").createParameter(e.filterOrder,zo.FILTER_ORDER_VALUE_MAPPING,zo.FILTER_ORDER_STRING_MAPPING,"Flt. Order"),cutoff:We(this,it,"f").createParameter(e.cutoff,zo.CUTOFF_VALUE_MAPPING,zo.CUTOFF_STRING_MAPPING,"Flt. Cutoff"),resonance:We(this,it,"f").createParameter(e.resonance,A.exponential(.01,10),_.numeric({unit:"q",fractionDigits:3}),"Flt. Q"),attack:We(this,it,"f").createParameter(e.attack,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Attack"),decay:We(this,it,"f").createParameter(e.decay,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Decay"),sustain:We(this,it,"f").createParameter(e.sustain,A.unipolar(),_.percent({fractionDigits:1}),"Sustain"),release:We(this,it,"f").createParameter(e.release,A.exponential(.001,5),_.numeric({unit:"s",fractionDigits:3}),"Release"),filterEnvelope:We(this,it,"f").createParameter(e.filterEnvelope,A.bipolar(),_.percent({fractionDigits:1}),"Flt. Env.",.5),filterKeyboard:We(this,it,"f").createParameter(e.filterKeyboard,A.bipolar(),_.percent({fractionDigits:1}),"Flt. Kbd.",.5),voicingMode:We(this,it,"f").createParameter(e.voicingMode,A.values(t),_.values("",t,["mono","poly"]),"Play Mode",.5),glideTime:We(this,it,"f").createParameter(e.glideTime,A.unipolar(),_.percent({fractionDigits:1}),"Glide time",0),unisonCount:We(this,it,"f").createParameter(e.unisonCount,A.values([1,3,5]),_.values("#",[1,3,5],[1,3,5].map(n=>String(n))),"Unisono",0),unisonDetune:We(this,it,"f").createParameter(e.unisonDetune,A.exponential(1,1200),_.numeric({unit:"ct",fractionDigits:0}),"Detune",0),unisonStereo:We(this,it,"f").createParameter(e.unisonStereo,A.unipolar(),_.percent({fractionDigits:0}),"Stereo",0),lfoWaveform:We(this,it,"f").createParameter(e.lfo.waveform,zo.LFO_WAVEFORM_VALUE_MAPPING,zo.LFO_WAVEFORM_STRING_MAPPING,"LFO Shape",0),lfoRate:We(this,it,"f").createParameter(e.lfo.rate,A.exponential(1e-4,30),_.numeric({unit:"Hz",fractionDigits:1,unitPrefix:!0}),"Rate",0),lfoTargetTune:We(this,it,"f").createParameter(e.lfo.targetTune,A.bipolar(),_.percent({fractionDigits:1}),"Vibrato \u29BF",.5),lfoTargetVolume:We(this,it,"f").createParameter(e.lfo.targetVolume,A.bipolar(),_.percent({fractionDigits:1}),"Tremolo \u29BF",.5),lfoTargetCutoff:We(this,it,"f").createParameter(e.lfo.targetCutoff,A.bipolar(),_.percent({fractionDigits:1}),"Cutoff \u29BF",.5)}};var TA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ur=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},RA,ax,Rf,hn,Uo,KB,Hn=class{constructor(e,t){RA.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Arpeggio,Rf.set(this,void 0),hn.set(this,void 0),Uo.set(this,void 0),TA(this,Rf,e,"f"),TA(this,hn,t,"f"),TA(this,Uo,new we(ur(this,Rf,"f")),"f"),this.namedParameter=ur(this,RA,"m",KB).call(this,t)}get box(){return ur(this,hn,"f")}get uuid(){return ur(this,hn,"f").address.uuid}get address(){return ur(this,hn,"f").address}get indexField(){return ur(this,hn,"f").index}get labelField(){return ur(this,hn,"f").label}get enabledField(){return ur(this,hn,"f").enabled}get minimizedField(){return ur(this,hn,"f").minimized}get host(){return ur(this,hn,"f").host}deviceHost(){return ur(this,Rf,"f").boxAdapters.adapterFor(ur(this,hn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){ur(this,Uo,"f").terminate()}};ax=Hn,Rf=new WeakMap,hn=new WeakMap,Uo=new WeakMap,RA=new WeakSet,KB=function(e){return{modeIndex:ur(this,Uo,"f").createParameter(e.modeIndex,A.linearInteger(0,2),_.indices("",["Up","Down","UpDown"]),"mode"),numOctaves:ur(this,Uo,"f").createParameter(e.numOctaves,A.linearInteger(1,5),_.numeric({unit:"",fractionDigits:0}),"Octaves"),rate:ur(this,Uo,"f").createParameter(e.rateIndex,A.linearInteger(0,ax.RateFractions.length-1),ax.RateStringMapping,"Rate"),gate:ur(this,Uo,"f").createParameter(e.gate,A.linear(0,2),_.percent({fractionDigits:0}),"Gate"),repeat:ur(this,Uo,"f").createParameter(e.repeat,A.linearInteger(1,16),_.numeric({fractionDigits:0}),"Repeat"),velocity:ur(this,Uo,"f").createParameter(e.velocity,A.bipolar(),_.percent({fractionDigits:0,bipolar:!1}),"Velocity")}};Hn.RateFractions=wr.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();Hn.RateStringMapping=_.indices("",ax.RateFractions.map(([r,e])=>`${r}/${e}`));var CA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Vr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},OA,Cf,fn,ac,WB,vd=class{constructor(e,t){OA.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Pitch,Cf.set(this,void 0),fn.set(this,void 0),ac.set(this,void 0),CA(this,Cf,e,"f"),CA(this,fn,t,"f"),CA(this,ac,new we(Vr(this,Cf,"f")),"f"),this.namedParameter=Vr(this,OA,"m",WB).call(this,t)}get box(){return Vr(this,fn,"f")}get uuid(){return Vr(this,fn,"f").address.uuid}get address(){return Vr(this,fn,"f").address}get indexField(){return Vr(this,fn,"f").index}get labelField(){return Vr(this,fn,"f").label}get enabledField(){return Vr(this,fn,"f").enabled}get minimizedField(){return Vr(this,fn,"f").minimized}get host(){return Vr(this,fn,"f").host}deviceHost(){return Vr(this,Cf,"f").boxAdapters.adapterFor(Vr(this,fn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){Vr(this,ac,"f").terminate()}};Cf=new WeakMap,fn=new WeakMap,ac=new WeakMap,OA=new WeakSet,WB=function(e){return{octaves:Vr(this,ac,"f").createParameter(e.octaves,A.linearInteger(-7,7),_.numeric({unit:"oct",fractionDigits:0}),"octaves"),semiTones:Vr(this,ac,"f").createParameter(e.semiTones,A.linearInteger(-36,36),_.numeric({unit:"st",fractionDigits:0}),"semi-tones"),cent:Vr(this,ac,"f").createParameter(e.cents,A.linear(-50,50),_.numeric({unit:"cents",fractionDigits:1}),"cents")}};var VA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},fi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zA,Of,Jn,yd,ZB,xd=class{constructor(e,t){zA.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Nano,Of.set(this,void 0),Jn.set(this,void 0),yd.set(this,void 0),VA(this,Of,e,"f"),VA(this,Jn,t,"f"),VA(this,yd,new we(fi(this,Of,"f")),"f"),this.namedParameter=fi(this,zA,"m",ZB).call(this,t)}get box(){return fi(this,Jn,"f")}get uuid(){return fi(this,Jn,"f").address.uuid}get address(){return fi(this,Jn,"f").address}get labelField(){return fi(this,Jn,"f").label}get iconField(){return fi(this,Jn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return fi(this,Jn,"f").enabled}get minimizedField(){return fi(this,Jn,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return fi(this,Of,"f").boxAdapters.adapterFor(fi(this,Jn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){fi(this,yd,"f").terminate()}};Of=new WeakMap,Jn=new WeakMap,yd=new WeakMap,zA=new WeakSet,ZB=function(e){return{volume:fi(this,yd,"f").createParameter(e.volume,A.DefaultDecibel,_.numeric({unit:"db",fractionDigits:1}),"volume"),release:fi(this,yd,"f").createParameter(e.release,A.exponential(.001,8),_.numeric({unit:"s",fractionDigits:3}),"release")}};var wd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ae=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},UA,sc,_s,Te,sx,Vf,Ci,lc,GB,bd=class{constructor(e,t){UA.add(this),this.class="device-host",this.accepts=!1,this.type="instrument",this.manualUrl="manuals/devices/instruments/playfield",sc.set(this,new j),_s.set(this,void 0),Te.set(this,void 0),sx.set(this,void 0),Vf.set(this,void 0),Ci.set(this,void 0),lc.set(this,m.None),wd(this,_s,e,"f"),wd(this,Te,t,"f"),wd(this,sx,ae(this,sc,"f").own(sr.create(ae(this,Te,"f").midiEffects,n=>ae(this,_s,"f").boxAdapters.adapterFor(n,de.isMidiEffect),c.MIDIEffectHost)),"f"),wd(this,Vf,ae(this,sc,"f").own(sr.create(ae(this,Te,"f").audioEffects,n=>ae(this,_s,"f").boxAdapters.adapterFor(n,de.isAudioEffect),c.AudioEffectHost)),"f"),wd(this,Ci,ae(this,sc,"f").own(new we(ae(this,_s,"f"))),"f"),this.namedParameter=ae(this,UA,"m",GB).call(this,t),ae(this,sc,"f").own(ae(this,Te,"f").file.catchupAndSubscribe(n=>{wd(this,lc,n.targetVertex.map(({box:i})=>ae(this,_s,"f").boxAdapters.adapterFor(i,On)),"f"),ae(this,lc,"f").unwrapOrNull()?.getOrCreateLoader()}))}get box(){return ae(this,Te,"f")}get uuid(){return ae(this,Te,"f").address.uuid}get address(){return ae(this,Te,"f").address}get peakAddress(){return ae(this,Te,"f").address.append(1001)}get indexField(){return ae(this,Te,"f").index}get gate(){return ae(this,Te,"f").gate.getValue()}get exclude(){return ae(this,Te,"f").exclude.getValue()}get label(){return`${this.device().labelField.getValue()} > ${ae(this,lc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get fileLabel(){return`${ae(this,lc,"f").mapOr(e=>e.box.fileName.getValue(),"No file")}`}get iconField(){return ae(this,Te,"f").icon}get defaultTrackType(){return me.Notes}get acceptsMidiEvents(){return!0}get midiEffectsField(){return ae(this,Te,"f").midiEffects}get inputField(){return this.audioUnitBoxAdapter().box.input}get audioEffectsField(){return ae(this,Te,"f").audioEffects}get tracksField(){return this.audioUnitBoxAdapter().box.tracks}get isAudioUnit(){return!1}file(){return ae(this,lc,"f")}fileUUID(){return ae(this,Te,"f").file.targetAddress.unwrap().uuid}resetParameters(){ae(this,Te,"f").mute.reset(),ae(this,Te,"f").solo.reset(),ae(this,Te,"f").exclude.reset(),ae(this,Te,"f").polyphone.reset(),ae(this,Te,"f").pitch.reset(),ae(this,Te,"f").attack.reset(),ae(this,Te,"f").release.reset(),ae(this,Te,"f").sampleStart.reset(),ae(this,Te,"f").sampleEnd.reset(),ae(this,Te,"f").gate.reset()}copyToIndex(e){Za.create(ae(this,Te,"f").graph,b.generate(),t=>{t.file.refer(ae(this,Te,"f").file.targetVertex.unwrap()),t.device.refer(ae(this,Te,"f").device.targetVertex.unwrap()),t.index.setValue(e),t.mute.setValue(ae(this,Te,"f").mute.getValue()),t.solo.setValue(ae(this,Te,"f").solo.getValue()),t.sampleStart.setValue(ae(this,Te,"f").sampleStart.getValue()),t.sampleEnd.setValue(ae(this,Te,"f").sampleEnd.getValue()),t.attack.setValue(ae(this,Te,"f").attack.getValue()),t.release.setValue(ae(this,Te,"f").release.getValue()),t.pitch.setValue(ae(this,Te,"f").pitch.getValue()),t.exclude.setValue(ae(this,Te,"f").exclude.getValue()),t.gate.setValue(ae(this,Te,"f").gate.getValue())})}get midiEffects(){return ae(this,sx,"f")}get inputAdapter(){return m.wrap(this)}get audioEffects(){return ae(this,Vf,"f")}get labelField(){return Ce(ae(this,Te,"f").file.targetVertex.unwrap().box,br).fileName}get enabledField(){return ae(this,Te,"f").enabled}get minimizedField(){return ae(this,Te,"f").minimized}device(){return ae(this,_s,"f").boxAdapters.adapterFor(ae(this,Te,"f").device.targetVertex.unwrap().box,Ps)}deviceHost(){return this.device().deviceHost()}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.fileLabel,children:()=>m.None};for(let e of ae(this,Vf,"f").adapters())yield*e.labeledAudioOutputs()}terminate(){ae(this,sc,"f").terminate()}};sc=new WeakMap,_s=new WeakMap,Te=new WeakMap,sx=new WeakMap,Vf=new WeakMap,Ci=new WeakMap,lc=new WeakMap,UA=new WeakSet,GB=function(e){return{gate:ae(this,Ci,"f").createParameter(e.gate,A.linearInteger(0,2),_.indices("",["Off","On","Loop"]),"Gate"),mute:ae(this,Ci,"f").createParameter(e.mute,A.bool,_.bool,"Mute"),solo:ae(this,Ci,"f").createParameter(e.solo,A.bool,_.bool,"Solo"),polyphone:ae(this,Ci,"f").createParameter(e.polyphone,A.bool,_.bool,"Polyphone"),exclude:ae(this,Ci,"f").createParameter(e.exclude,A.bool,_.bool,"Exclude"),pitch:ae(this,Ci,"f").createParameter(e.pitch,A.linear(-1200,1200),_.numeric({unit:"cents",bipolar:!0,fractionDigits:0}),"Pitch",0),sampleStart:ae(this,Ci,"f").createParameter(e.sampleStart,A.unipolar(),_.percent(),"Start",0),sampleEnd:ae(this,Ci,"f").createParameter(e.sampleEnd,A.unipolar(),_.percent(),"End",1),attack:ae(this,Ci,"f").createParameter(e.attack,A.exponential(.001,5),_.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Attack"),release:ae(this,Ci,"f").createParameter(e.release,A.exponential(.001,5),_.numeric({unit:"s",unitPrefix:!0,fractionDigits:1}),"Release")}};var lx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Yr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ad,Qn,_d,cx,Ps=class{constructor(e,t){this.type="instrument",this.accepts="midi",this.manualUrl=pe.Playfield,Ad.set(this,void 0),Qn.set(this,void 0),_d.set(this,void 0),cx.set(this,void 0),lx(this,Ad,e,"f"),lx(this,Qn,t,"f"),lx(this,_d,sr.create(t.samples,n=>e.boxAdapters.adapterFor(n,bd),c.Sample),"f"),lx(this,cx,new we(Yr(this,Ad,"f")),"f")}reset(){Yr(this,_d,"f").adapters().forEach(e=>e.box.delete())}get box(){return Yr(this,Qn,"f")}get uuid(){return Yr(this,Qn,"f").address.uuid}get address(){return Yr(this,Qn,"f").address}get labelField(){return Yr(this,Qn,"f").label}get iconField(){return Yr(this,Qn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return Yr(this,Qn,"f").enabled}get minimizedField(){return Yr(this,Qn,"f").minimized}get acceptsMidiEvents(){return!0}get samples(){return Yr(this,_d,"f")}get context(){return Yr(this,Ad,"f")}deviceHost(){return Yr(this,Ad,"f").boxAdapters.adapterFor(Yr(this,Qn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None};for(let e of Yr(this,_d,"f").adapters())yield{address:e.address,label:e.fileLabel,children:()=>m.wrap(e.labeledAudioOutputs())}}terminate(){Yr(this,cx,"f").terminate()}};Ad=new WeakMap,Qn=new WeakMap,_d=new WeakMap,cx=new WeakMap;var jA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},dr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},LA,zf,mn,jo,qB,Pd=class{constructor(e,t){LA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.StereoTool,zf.set(this,void 0),mn.set(this,void 0),jo.set(this,void 0),jA(this,zf,e,"f"),jA(this,mn,t,"f"),jA(this,jo,new we(dr(this,zf,"f")),"f"),this.namedParameter=dr(this,LA,"m",qB).call(this,t)}get box(){return dr(this,mn,"f")}get uuid(){return dr(this,mn,"f").address.uuid}get address(){return dr(this,mn,"f").address}get indexField(){return dr(this,mn,"f").index}get labelField(){return dr(this,mn,"f").label}get enabledField(){return dr(this,mn,"f").enabled}get minimizedField(){return dr(this,mn,"f").minimized}get host(){return dr(this,mn,"f").host}deviceHost(){return dr(this,zf,"f").boxAdapters.adapterFor(dr(this,mn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){dr(this,jo,"f").terminate()}};zf=new WeakMap,mn=new WeakMap,jo=new WeakMap,LA=new WeakSet,qB=function(e){return{volume:dr(this,jo,"f").createParameter(e.volume,A.decibel(-72,0,12),_.numeric({unit:"db",fractionDigits:1}),"Volume"),panning:dr(this,jo,"f").createParameter(e.panning,A.bipolar(),_.panning,"Panning",.5),stereo:dr(this,jo,"f").createParameter(e.stereo,A.bipolar(),_.numeric({unit:"%",fractionDigits:0}),"stereo",.5),invertL:dr(this,jo,"f").createParameter(e.invertL,A.bool,_.bool,"Invert Left"),invertR:dr(this,jo,"f").createParameter(e.invertR,A.bool,_.bool,"Invert Right"),swap:dr(this,jo,"f").createParameter(e.swap,A.bool,_.bool,"Swap")}};var cc;(function(r){r.checkType=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="groove-adapter"})(cc||(cc={}));var HB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Sd,gi,Ed=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Zeitgeist,Sd.set(this,void 0),gi.set(this,void 0),HB(this,Sd,e,"f"),HB(this,gi,t,"f"),this.groove()}get box(){return mi(this,gi,"f")}get uuid(){return mi(this,gi,"f").address.uuid}get address(){return mi(this,gi,"f").address}get indexField(){return mi(this,gi,"f").index}get labelField(){return mi(this,gi,"f").label}get enabledField(){return mi(this,gi,"f").enabled}get minimizedField(){return mi(this,gi,"f").minimized}get host(){return mi(this,gi,"f").host}deviceHost(){return mi(this,Sd,"f").boxAdapters.adapterFor(mi(this,gi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}groove(){return mi(this,Sd,"f").boxAdapters.adapterFor(mi(this,gi,"f").groove.targetVertex.unwrap("no groove").box,cc.checkType)}catchupAndSubscribeGroove(e){return mi(this,gi,"f").groove.catchupAndSubscribe(t=>e(mi(this,Sd,"f").boxAdapters.adapterFor(t.targetVertex.unwrap("No groove found").box,cc.checkType)))}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};Sd=new WeakMap,gi=new WeakMap;var JB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Yn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ux,Oi,Fd=class{constructor(e,t){this.type="audio-effect",this.accepts="audio",this.manualUrl="",ux.set(this,void 0),Oi.set(this,void 0),JB(this,ux,e,"f"),JB(this,Oi,t,"f")}get box(){return Yn(this,Oi,"f")}get uuid(){return Yn(this,Oi,"f").address.uuid}get address(){return Yn(this,Oi,"f").address}get indexField(){return Yn(this,Oi,"f").index}get labelField(){return Yn(this,Oi,"f").label}get enabledField(){return Yn(this,Oi,"f").enabled}get minimizedField(){return Yn(this,Oi,"f").minimized}get host(){return Yn(this,Oi,"f").host}get commentField(){return Yn(this,Oi,"f").comment}deviceHost(){return Yn(this,ux,"f").boxAdapters.adapterFor(Yn(this,Oi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){}};ux=new WeakMap,Oi=new WeakMap;var QB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xn=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},dx,Vi,Bd=class{constructor(e,t){this.type="midi-effect",this.accepts="midi",this.manualUrl="",dx.set(this,void 0),Vi.set(this,void 0),QB(this,dx,e,"f"),QB(this,Vi,t,"f")}get box(){return Xn(this,Vi,"f")}get uuid(){return Xn(this,Vi,"f").address.uuid}get address(){return Xn(this,Vi,"f").address}get indexField(){return Xn(this,Vi,"f").index}get labelField(){return Xn(this,Vi,"f").label}get enabledField(){return Xn(this,Vi,"f").enabled}get minimizedField(){return Xn(this,Vi,"f").minimized}get host(){return Xn(this,Vi,"f").host}get commentField(){return Xn(this,Vi,"f").comment}deviceHost(){return Xn(this,dx,"f").boxAdapters.adapterFor(Xn(this,Vi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}};dx=new WeakMap,Vi=new WeakMap;var Ss=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ze=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},KA,WA,Uf,vi,px,Nd,eo,gn,Id,YB,ZA,Dd=class{constructor(e,t){KA.add(this),this.type="instrument",this.accepts="midi",this.manualUrl=pe.Soundfont,WA.set(this,new j),Uf.set(this,void 0),vi.set(this,void 0),px.set(this,void 0),Nd.set(this,void 0),eo.set(this,void 0),gn.set(this,void 0),Id.set(this,ee.Empty),ZA.set(this,n=>n.match({none:()=>{Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear()},some:i=>i.soundfont.match({none:()=>{Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear(),Ze(this,Id,"f").terminate(),Ss(this,Id,i.subscribe(o=>{if(o.type==="loaded"){let a=i.soundfont.unwrap();Ze(this,gn,"f").wrap(a.presets[this.presetIndex]??a.presets[0]),Ze(this,eo,"f").wrap(a)}else o.type==="error"?(Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear()):o.type==="idle"&&(Ze(this,gn,"f").clear(),Ze(this,eo,"f").clear())}),"f")},some:o=>{Ze(this,eo,"f").wrap(o),Ze(this,gn,"f").wrap(o.presets[this.presetIndex]??o.presets[0])}})})),Ss(this,Uf,e,"f"),Ss(this,vi,t,"f"),Ss(this,px,new we(Ze(this,Uf,"f")),"f"),this.namedParameter=Ze(this,KA,"m",YB).call(this,t),Ss(this,Nd,new Mr,"f"),Ss(this,eo,new Mr,"f"),Ss(this,gn,new Mr,"f"),Ze(this,WA,"f").ownAll(Ze(this,Nd,"f").subscribe(Ze(this,ZA,"f")),Ze(this,vi,"f").file.catchupAndSubscribe(({targetVertex:n})=>Ze(this,Nd,"f").wrapOption(n.map(({box:i})=>e.soundfontManager.getOrCreate(i.address.uuid)))),Ze(this,vi,"f").presetIndex.catchupAndSubscribe(n=>Ze(this,eo,"f").match({none:()=>Ze(this,gn,"f").clear(),some:i=>Ze(this,gn,"f").wrap(i.presets[n.getValue()]??i.presets[0])})))}get loader(){return Ze(this,Nd,"f")}get soundfont(){return Ze(this,eo,"f")}get preset(){return Ze(this,gn,"f")}get presetIndex(){return Ze(this,vi,"f").presetIndex.getValue()}get box(){return Ze(this,vi,"f")}get uuid(){return Ze(this,vi,"f").address.uuid}get address(){return Ze(this,vi,"f").address}get labelField(){return Ze(this,vi,"f").label}get iconField(){return Ze(this,vi,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return Ze(this,vi,"f").enabled}get minimizedField(){return Ze(this,vi,"f").minimized}get acceptsMidiEvents(){return!0}deviceHost(){return Ze(this,Uf,"f").boxAdapters.adapterFor(Ze(this,vi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Ze(this,Id,"f").terminate(),Ss(this,Id,ee.Empty,"f"),Ze(this,px,"f").terminate()}};WA=new WeakMap,Uf=new WeakMap,vi=new WeakMap,px=new WeakMap,Nd=new WeakMap,eo=new WeakMap,gn=new WeakMap,Id=new WeakMap,ZA=new WeakMap,KA=new WeakSet,YB=function(e){return{}};var XB=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},jf=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hx,uc,fx=class{constructor(e,t){hx.set(this,void 0),uc.set(this,void 0),XB(this,hx,e,"f"),XB(this,uc,t,"f")}get box(){return jf(this,uc,"f")}get uuid(){return jf(this,uc,"f").address.uuid}get address(){return jf(this,uc,"f").address}get soundfont(){return this.getOrCreateLoader().soundfont}getOrCreateLoader(){return jf(this,hx,"f").soundfontManager.getOrCreate(jf(this,uc,"f").address.uuid)}terminate(){}};hx=new WeakMap,uc=new WeakMap;var GA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},yi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qA,Lf,vn,Kf,eN,Md=class{constructor(e,t){qA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Maximizer,Lf.set(this,void 0),vn.set(this,void 0),Kf.set(this,void 0),GA(this,Lf,e,"f"),GA(this,vn,t,"f"),GA(this,Kf,new we(yi(this,Lf,"f")),"f"),this.namedParameter=yi(this,qA,"m",eN).call(this,t)}get box(){return yi(this,vn,"f")}get uuid(){return yi(this,vn,"f").address.uuid}get address(){return yi(this,vn,"f").address}get indexField(){return yi(this,vn,"f").index}get labelField(){return yi(this,vn,"f").label}get enabledField(){return yi(this,vn,"f").enabled}get minimizedField(){return yi(this,vn,"f").minimized}get host(){return yi(this,vn,"f").host}deviceHost(){return yi(this,Lf,"f").boxAdapters.adapterFor(yi(this,vn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){yi(this,Kf,"f").terminate()}};Lf=new WeakMap,vn=new WeakMap,Kf=new WeakMap,qA=new WeakSet,eN=function(e){return{threshold:yi(this,Kf,"f").createParameter(e.threshold,A.linear(-24,0),_.decible,"Threshold")}};var HA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Pt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},JA,Wf,zi,zr,tN,kd=class{constructor(e,t){JA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Compressor,Wf.set(this,void 0),zi.set(this,void 0),zr.set(this,void 0),HA(this,Wf,e,"f"),HA(this,zi,t,"f"),HA(this,zr,new we(Pt(this,Wf,"f")),"f"),this.namedParameter=Pt(this,JA,"m",tN).call(this,t)}get box(){return Pt(this,zi,"f")}get uuid(){return Pt(this,zi,"f").address.uuid}get address(){return Pt(this,zi,"f").address}get indexField(){return Pt(this,zi,"f").index}get labelField(){return Pt(this,zi,"f").label}get enabledField(){return Pt(this,zi,"f").enabled}get minimizedField(){return Pt(this,zi,"f").minimized}get host(){return Pt(this,zi,"f").host}get sideChain(){return Pt(this,zi,"f").sideChain}deviceHost(){return Pt(this,Wf,"f").boxAdapters.adapterFor(Pt(this,zi,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Pt(this,zr,"f").terminate()}};Wf=new WeakMap,zi=new WeakMap,zr=new WeakMap,JA=new WeakSet,tN=function(e){return{lookahead:Pt(this,zr,"f").createParameter(e.lookahead,A.bool,_.bool,"Lookahead"),automakeup:Pt(this,zr,"f").createParameter(e.automakeup,A.bool,_.bool,"Auto Makeup"),autoattack:Pt(this,zr,"f").createParameter(e.autoattack,A.bool,_.bool,"Auto Attack"),autorelease:Pt(this,zr,"f").createParameter(e.autorelease,A.bool,_.bool,"Auto Release"),inputgain:Pt(this,zr,"f").createParameter(e.inputgain,A.linear(-30,30),_.decible,"Input Gain"),threshold:Pt(this,zr,"f").createParameter(e.threshold,A.linear(-60,0),_.decible,"Threshold"),ratio:Pt(this,zr,"f").createParameter(e.ratio,A.exponential(1,24),_.numeric({fractionDigits:1}),"Ratio"),knee:Pt(this,zr,"f").createParameter(e.knee,A.linear(0,24),_.decible,"Knee"),attack:Pt(this,zr,"f").createParameter(e.attack,A.linear(0,100),_.numeric({unit:"ms",fractionDigits:1}),"Attack Time"),release:Pt(this,zr,"f").createParameter(e.release,A.linear(5,1500),_.numeric({unit:"ms",fractionDigits:1}),"Release Time"),makeup:Pt(this,zr,"f").createParameter(e.makeup,A.linear(-40,40),_.decible,"Makeup Gain"),mix:Pt(this,zr,"f").createParameter(e.mix,A.unipolar(),_.percent(),"Dry/Wet")}};var QA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Gt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},YA,Zf,Ui,to,rN,$d=class{constructor(e,t){YA.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Gate,Zf.set(this,void 0),Ui.set(this,void 0),to.set(this,void 0),QA(this,Zf,e,"f"),QA(this,Ui,t,"f"),QA(this,to,new we(Gt(this,Zf,"f")),"f"),this.namedParameter=Gt(this,YA,"m",rN).call(this,t)}get box(){return Gt(this,Ui,"f")}get uuid(){return Gt(this,Ui,"f").address.uuid}get address(){return Gt(this,Ui,"f").address}get indexField(){return Gt(this,Ui,"f").index}get labelField(){return Gt(this,Ui,"f").label}get enabledField(){return Gt(this,Ui,"f").enabled}get minimizedField(){return Gt(this,Ui,"f").minimized}get host(){return Gt(this,Ui,"f").host}get sideChain(){return Gt(this,Ui,"f").sideChain}deviceHost(){return Gt(this,Zf,"f").boxAdapters.adapterFor(Gt(this,Ui,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Gt(this,to,"f").terminate()}};Zf=new WeakMap,Ui=new WeakMap,to=new WeakMap,YA=new WeakSet,rN=function(e){return{inverse:Gt(this,to,"f").createParameter(e.inverse,A.bool,_.bool,"Inverse"),threshold:Gt(this,to,"f").createParameter(e.threshold,A.linear(-80,0),_.decible,"Threshold"),return:Gt(this,to,"f").createParameter(e.return,A.linear(0,24),_.decible,"Return"),attack:Gt(this,to,"f").createParameter(e.attack,A.linear(0,50),_.numeric({unit:"ms",fractionDigits:1}),"Attack"),hold:Gt(this,to,"f").createParameter(e.hold,A.linear(0,500),_.numeric({unit:"ms",fractionDigits:1}),"Hold"),release:Gt(this,to,"f").createParameter(e.release,A.linear(1,2e3),_.numeric({unit:"ms",fractionDigits:1}),"Release"),floor:Gt(this,to,"f").createParameter(e.floor,A.decibel(-72,-12,0),_.decible,"Floor")}};var XA=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Br=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},e_,Gf,yn,Es,iN,Td=class{constructor(e,t){e_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Crusher,Gf.set(this,void 0),yn.set(this,void 0),Es.set(this,void 0),XA(this,Gf,e,"f"),XA(this,yn,t,"f"),XA(this,Es,new we(Br(this,Gf,"f")),"f"),this.namedParameter=Br(this,e_,"m",iN).call(this,t)}get box(){return Br(this,yn,"f")}get uuid(){return Br(this,yn,"f").address.uuid}get address(){return Br(this,yn,"f").address}get indexField(){return Br(this,yn,"f").index}get labelField(){return Br(this,yn,"f").label}get enabledField(){return Br(this,yn,"f").enabled}get minimizedField(){return Br(this,yn,"f").minimized}get host(){return Br(this,yn,"f").host}deviceHost(){return Br(this,Gf,"f").boxAdapters.adapterFor(Br(this,yn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Br(this,Es,"f").terminate()}};Gf=new WeakMap,yn=new WeakMap,Es=new WeakMap,e_=new WeakSet,iN=function(e){return{crush:Br(this,Es,"f").createParameter(e.crush,A.unipolar(),_.percent(),"Crush"),bits:Br(this,Es,"f").createParameter(e.bits,A.linearInteger(1,16),_.numeric(),"Bits"),boost:Br(this,Es,"f").createParameter(e.boost,A.linear(0,24),_.decible,"Boost"),mix:Br(this,Es,"f").createParameter(e.mix,A.exponential(.001,1),_.percent(),"Mix")}};var t_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},r_,qf,xn,Rd,nN,Cd=class{constructor(e,t){r_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Fold,qf.set(this,void 0),xn.set(this,void 0),Rd.set(this,void 0),t_(this,qf,e,"f"),t_(this,xn,t,"f"),t_(this,Rd,new we(Xr(this,qf,"f")),"f"),this.namedParameter=Xr(this,r_,"m",nN).call(this,t)}get box(){return Xr(this,xn,"f")}get uuid(){return Xr(this,xn,"f").address.uuid}get address(){return Xr(this,xn,"f").address}get indexField(){return Xr(this,xn,"f").index}get labelField(){return Xr(this,xn,"f").label}get enabledField(){return Xr(this,xn,"f").enabled}get minimizedField(){return Xr(this,xn,"f").minimized}get host(){return Xr(this,xn,"f").host}deviceHost(){return Xr(this,qf,"f").boxAdapters.adapterFor(Xr(this,xn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Xr(this,Rd,"f").terminate()}};qf=new WeakMap,xn=new WeakMap,Rd=new WeakMap,r_=new WeakSet,nN=function(e){return{drive:Xr(this,Rd,"f").createParameter(e.drive,A.linear(0,30),_.decible,"Drive"),volume:Xr(this,Rd,"f").createParameter(e.volume,A.linear(-18,0),_.decible,"Volume")}};var mx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ir=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Hf,Jf,wn,Od,Vd,zd=class{constructor(e,t){Hf.set(this,new j),this.type="instrument",this.accepts="midi",this.manualUrl=pe.MIDIOutput,Jf.set(this,void 0),wn.set(this,void 0),Od.set(this,void 0),Vd.set(this,void 0),mx(this,Jf,e,"f"),mx(this,wn,t,"f"),mx(this,Od,new Mr,"f"),mx(this,Vd,ir(this,Hf,"f").own(new we(ir(this,Jf,"f"))),"f"),ir(this,Hf,"f").ownAll(t.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:n})=>ir(this,Vd,"f").createParameter(Ce(n,Rn).value,A.unipolar(),_.percent({fractionDigits:1}),"",0),onRemoved:({box:n})=>ir(this,Vd,"f").removeParameter(Ce(n,Rn).value.address)}),ir(this,wn,"f").device.catchupAndSubscribe(({targetVertex:n})=>n.match({none:()=>ir(this,Od,"f").clear(),some:({box:i})=>ir(this,Od,"f").wrap(Ce(i,Tn))})))}get box(){return ir(this,wn,"f")}get uuid(){return ir(this,wn,"f").address.uuid}get address(){return ir(this,wn,"f").address}get labelField(){return ir(this,wn,"f").label}get iconField(){return ir(this,wn,"f").icon}get defaultTrackType(){return me.Notes}get enabledField(){return ir(this,wn,"f").enabled}get minimizedField(){return ir(this,wn,"f").minimized}get acceptsMidiEvents(){return!0}get parameters(){return ir(this,Vd,"f")}get midiDevice(){return ir(this,Od,"f")}deviceHost(){return ir(this,Jf,"f").boxAdapters.adapterFor(ir(this,wn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){ir(this,Hf,"f").terminate()}};Hf=new WeakMap,Jf=new WeakMap,wn=new WeakMap,Od=new WeakMap,Vd=new WeakMap;var gx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},qt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},i_,Qf,bn,Lo,Yf,oN,Ud=class{constructor(e,t){i_.add(this),this.type="midi-effect",this.accepts="midi",this.manualUrl=pe.Velocity,Qf.set(this,void 0),bn.set(this,void 0),Lo.set(this,void 0),Yf.set(this,void 0),gx(this,Qf,e,"f"),gx(this,bn,t,"f"),gx(this,Lo,new we(qt(this,Qf,"f")),"f"),gx(this,Yf,Rc.create(),"f"),this.namedParameter=qt(this,i_,"m",oN).call(this,t)}computeVelocity(e,t){let{magnetPosition:n,magnetStrength:i,randomSeed:o,randomAmount:a,offset:s,mix:l}=this.namedParameter;qt(this,Yf,"f").setSeed(o.valueAt(e)+e);let u=t+(n.valueAt(e)-t)*i.valueAt(e),p=(qt(this,Yf,"f").uniform()*2-1)*a.valueAt(e),d=s.valueAt(e),h=l.valueAt(e);return t*(1-h)+qi(u+p+d)*h}get box(){return qt(this,bn,"f")}get uuid(){return qt(this,bn,"f").address.uuid}get address(){return qt(this,bn,"f").address}get indexField(){return qt(this,bn,"f").index}get labelField(){return qt(this,bn,"f").label}get enabledField(){return qt(this,bn,"f").enabled}get minimizedField(){return qt(this,bn,"f").minimized}get host(){return qt(this,bn,"f").host}deviceHost(){return qt(this,Qf,"f").boxAdapters.adapterFor(qt(this,bn,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){qt(this,Lo,"f").terminate()}};Qf=new WeakMap,bn=new WeakMap,Lo=new WeakMap,Yf=new WeakMap,i_=new WeakSet,oN=function(e){return{magnetPosition:qt(this,Lo,"f").createParameter(e.magnetPosition,A.unipolar(),_.percent(),"Position"),magnetStrength:qt(this,Lo,"f").createParameter(e.magnetStrength,A.unipolar(),_.percent(),"Strength"),randomSeed:qt(this,Lo,"f").createParameter(e.randomSeed,A.linearInteger(0,65535),_.numeric({unit:"",fractionDigits:0}),"Seed"),randomAmount:qt(this,Lo,"f").createParameter(e.randomAmount,A.unipolar(),_.percent(),"Amount"),offset:qt(this,Lo,"f").createParameter(e.offset,A.bipolar(),_.percent(),"Offset"),mix:qt(this,Lo,"f").createParameter(e.mix,A.unipolar(),_.percent(),"Mix")}};var n_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},o_,a_,Xf,An,Ko,aN,ro=class{constructor(e,t){o_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.Tidal,Xf.set(this,void 0),An.set(this,void 0),Ko.set(this,void 0),n_(this,Xf,e,"f"),n_(this,An,t,"f"),n_(this,Ko,new we(pr(this,Xf,"f")),"f"),this.namedParameter=pr(this,o_,"m",aN).call(this,t)}get box(){return pr(this,An,"f")}get uuid(){return pr(this,An,"f").address.uuid}get address(){return pr(this,An,"f").address}get indexField(){return pr(this,An,"f").index}get labelField(){return pr(this,An,"f").label}get enabledField(){return pr(this,An,"f").enabled}get minimizedField(){return pr(this,An,"f").minimized}get host(){return pr(this,An,"f").host}deviceHost(){return pr(this,Xf,"f").boxAdapters.adapterFor(pr(this,An,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){pr(this,Ko,"f").terminate()}};a_=ro,Xf=new WeakMap,An=new WeakMap,Ko=new WeakMap,o_=new WeakSet,aN=function(e){let{RateFractions:t,RateStringMapping:n}=a_;return{slope:pr(this,Ko,"f").createParameter(e.slope,A.bipolar(),_.percent({fractionDigits:1}),"Slope",.5),symmetry:pr(this,Ko,"f").createParameter(e.symmetry,A.unipolar(),_.percent({fractionDigits:1,bipolar:!0}),"Symmetry",.5),rate:pr(this,Ko,"f").createParameter(e.rate,A.values(t.map((i,o)=>o)),n,"Rate",0),depth:pr(this,Ko,"f").createParameter(e.depth,A.unipolar(),_.percent({fractionDigits:1}),"Depth",0),offset:pr(this,Ko,"f").createParameter(e.offset,A.linear(-180,180),_.numeric({unit:"\xB0",fractionDigits:0}),"Offset",.5),channelOffset:pr(this,Ko,"f").createParameter(e.channelOffset,A.linear(-180,180),_.numeric({unit:"\xB0",fractionDigits:0}),"Ch. Offset",.5)}};ro.RateFractions=wr.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();ro.RateStringMapping=_.indices("",a_.RateFractions.map(([r,e])=>`${r}/${e}`));var s_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Bt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},l_,em,_n,Ur,sN,jd=class{constructor(e,t){l_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.DattorroReverb,em.set(this,void 0),_n.set(this,void 0),Ur.set(this,void 0),s_(this,em,e,"f"),s_(this,_n,t,"f"),s_(this,Ur,new we(Bt(this,em,"f")),"f"),this.namedParameter=Bt(this,l_,"m",sN).call(this,t)}get box(){return Bt(this,_n,"f")}get uuid(){return Bt(this,_n,"f").address.uuid}get address(){return Bt(this,_n,"f").address}get indexField(){return Bt(this,_n,"f").index}get labelField(){return Bt(this,_n,"f").label}get enabledField(){return Bt(this,_n,"f").enabled}get minimizedField(){return Bt(this,_n,"f").minimized}get host(){return Bt(this,_n,"f").host}deviceHost(){return Bt(this,em,"f").boxAdapters.adapterFor(Bt(this,_n,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Bt(this,Ur,"f").terminate()}};em=new WeakMap,_n=new WeakMap,Ur=new WeakMap,l_=new WeakSet,sN=function(e){return{preDelay:Bt(this,Ur,"f").createParameter(e.preDelay,A.linear(0,1e3),_.numeric({unit:e.preDelay.unit}),"Pre-Delay"),bandwidth:Bt(this,Ur,"f").createParameter(e.bandwidth,A.unipolar(),_.percent(),"Bandwidth"),inputDiffusion1:Bt(this,Ur,"f").createParameter(e.inputDiffusion1,A.unipolar(),_.percent(),"Tank 1"),inputDiffusion2:Bt(this,Ur,"f").createParameter(e.inputDiffusion2,A.unipolar(),_.percent(),"Tank 2"),decay:Bt(this,Ur,"f").createParameter(e.decay,A.unipolar(),_.percent(),"Decay"),decayDiffusion1:Bt(this,Ur,"f").createParameter(e.decayDiffusion1,A.unipolar(),_.percent(),"Tank 1"),decayDiffusion2:Bt(this,Ur,"f").createParameter(e.decayDiffusion2,A.unipolar(),_.percent(),"Tank 2"),damping:Bt(this,Ur,"f").createParameter(e.damping,A.unipolar(),_.percent(),"Damping"),excursionRate:Bt(this,Ur,"f").createParameter(e.excursionRate,A.unipolar(),_.numeric({unit:e.excursionRate.unit}),"Rate"),excursionDepth:Bt(this,Ur,"f").createParameter(e.excursionDepth,A.unipolar(),_.numeric({unit:e.excursionDepth.unit}),"Depth"),wet:Bt(this,Ur,"f").createParameter(e.wet,A.DefaultDecibel,_.decible,"Wet"),dry:Bt(this,Ur,"f").createParameter(e.dry,A.DefaultDecibel,_.decible,"Dry")}};var lN=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ld=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},c_,Ea,Kd=class{constructor(e,t){c_.set(this,void 0),Ea.set(this,void 0),lN(this,c_,e,"f"),lN(this,Ea,t,"f")}get box(){return Ld(this,Ea,"f")}get uuid(){return Ld(this,Ea,"f").address.uuid}get address(){return Ld(this,Ea,"f").address}get labelField(){return Ld(this,Ea,"f").label}get modelField(){return Ld(this,Ea,"f").model}getModelJson(){return Ld(this,Ea,"f").model.getValue()}terminate(){}};c_=new WeakMap,Ea=new WeakMap;var u_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Lt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},d_,Wd,Nr,dc,cN,Zd=class{constructor(e,t){d_.add(this),this.type="audio-effect",this.accepts="audio",this.manualUrl=pe.NeuralAmp,Wd.set(this,void 0),Nr.set(this,void 0),dc.set(this,void 0),u_(this,Wd,e,"f"),u_(this,Nr,t,"f"),u_(this,dc,new we(Lt(this,Wd,"f")),"f"),this.namedParameter=Lt(this,d_,"m",cN).call(this,t)}get box(){return Lt(this,Nr,"f")}get uuid(){return Lt(this,Nr,"f").address.uuid}get address(){return Lt(this,Nr,"f").address}get indexField(){return Lt(this,Nr,"f").index}get labelField(){return Lt(this,Nr,"f").label}get enabledField(){return Lt(this,Nr,"f").enabled}get minimizedField(){return Lt(this,Nr,"f").minimized}get host(){return Lt(this,Nr,"f").host}get modelField(){return Lt(this,Nr,"f").model}get monoField(){return Lt(this,Nr,"f").mono}get spectrum(){return Lt(this,Nr,"f").address.append(4095)}getModelAdapter(){let e=Lt(this,Nr,"f").model.targetVertex;return e.isEmpty()?m.None:m.wrap(Lt(this,Wd,"f").boxAdapters.adapterFor(e.unwrap().box,Kd))}getModelJson(){let e=this.getModelAdapter();return e.nonEmpty()?e.unwrap().getModelJson():Lt(this,Nr,"f").modelJson.getValue()}deviceHost(){return Lt(this,Wd,"f").boxAdapters.adapterFor(Lt(this,Nr,"f").host.targetVertex.unwrap("no device-host").box,de.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}*labeledAudioOutputs(){yield{address:this.address,label:this.labelField.getValue(),children:()=>m.None}}terminate(){Lt(this,dc,"f").terminate()}};Wd=new WeakMap,Nr=new WeakMap,dc=new WeakMap,d_=new WeakSet,cN=function(e){return{inputGain:Lt(this,dc,"f").createParameter(e.inputGain,A.decibel(-72,0,12),_.numeric({unit:"dB",fractionDigits:1}),"input"),outputGain:Lt(this,dc,"f").createParameter(e.outputGain,A.decibel(-72,0,12),_.numeric({unit:"dB",fractionDigits:1}),"output"),mix:Lt(this,dc,"f").createParameter(e.mix,A.linear(0,1),_.percent(),"Mix")}};var vx=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},oe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},p_,ue,Wo,tm,yx,uN,xx=class{constructor(e){p_.add(this),ue.set(this,void 0),Wo.set(this,void 0),tm.set(this,void 0),yx.set(this,void 0),vx(this,ue,e,"f"),vx(this,Wo,b.newSet(t=>t.uuid),"f"),vx(this,tm,new Set,"f"),vx(this,yx,oe(this,ue,"f").boxGraph.subscribeToAllUpdates({onUpdate:t=>{if(t.type==="delete"){let n=oe(this,Wo,"f").getOrNull(t.uuid);q(n)&&(oe(this,tm,"f").add(n.box),oe(this,Wo,"f").removeByValue(n).terminate())}}}),"f")}terminate(){oe(this,Wo,"f").values().forEach(e=>e.terminate()),oe(this,Wo,"f").clear(),oe(this,yx,"f").terminate()}adapterFor(e,t){if(oe(this,tm,"f").has(e))return D(`Cannot resolve adapter for already deleted box: ${e}`);let n=oe(this,Wo,"f").getOrNull(e.address.uuid);if(n===null){n=oe(this,p_,"m",uN).call(this,e);let i=oe(this,Wo,"f").add(n);V(i,`Could not add adapter for ${e}`)}return typeof t=="function"?Object.hasOwn(t,"prototype")?n instanceof t?n:D(`${n} is not instance of ${t}`):t(n)?n:D(`${n} did not pass custom type guard`):D("Unknown checkType method")}optAdapter(e){return oe(this,Wo,"f").opt(e.address.uuid)}};ue=new WeakMap,Wo=new WeakMap,tm=new WeakMap,yx=new WeakMap,p_=new WeakSet,uN=function(e){return he(e.accept({visitArpeggioDeviceBox:t=>new Hn(oe(this,ue,"f"),t),visitAudioBusBox:t=>new Hr(oe(this,ue,"f"),t),visitAudioClipBox:t=>new is(oe(this,ue,"f"),t),visitAudioFileBox:t=>new On(oe(this,ue,"f"),t),visitAudioTimeStretchBox:t=>new Fo(oe(this,ue,"f"),t),visitAudioPitchStretchBox:t=>new Eo(oe(this,ue,"f"),t),visitTransientMarkerBox:t=>new fu(t),visitWarpMarkerBox:t=>new rs(oe(this,ue,"f"),t),visitAudioRegionBox:t=>new ha(oe(this,ue,"f"),t),visitAudioUnitBox:t=>new nn(oe(this,ue,"f"),t),visitAuxSendBox:t=>new Ku(oe(this,ue,"f"),t),visitMaximizerDeviceBox:t=>new Md(oe(this,ue,"f"),t),visitCompressorDeviceBox:t=>new kd(oe(this,ue,"f"),t),visitGateDeviceBox:t=>new $d(oe(this,ue,"f"),t),visitCrusherDeviceBox:t=>new Td(oe(this,ue,"f"),t),visitDattorroReverbDeviceBox:t=>new jd(oe(this,ue,"f"),t),visitDelayDeviceBox:t=>new tr(oe(this,ue,"f"),t),visitDeviceInterfaceKnobBox:t=>new od(oe(this,ue,"f"),t),visitTidalDeviceBox:t=>new ro(oe(this,ue,"f"),t),visitFoldDeviceBox:t=>new Cd(oe(this,ue,"f"),t),visitGrooveShuffleBox:t=>new Co(oe(this,ue,"f"),t),visitMarkerBox:t=>new ps(oe(this,ue,"f"),t),visitSignatureEventBox:t=>new ql(oe(this,ue,"f"),t),visitMIDIOutputDeviceBox:t=>new zd(oe(this,ue,"f"),t),visitModularAudioInputBox:t=>new id(oe(this,ue,"f"),t),visitModularAudioOutputBox:t=>new ed(oe(this,ue,"f"),t),visitModularBox:t=>new gs(oe(this,ue,"f"),t),visitModularDeviceBox:t=>new ys(oe(this,ue,"f"),t),visitModuleConnectionBox:t=>new ms(oe(this,ue,"f"),t),visitModuleDelayBox:t=>new Xu(oe(this,ue,"f"),t),visitModuleGainBox:t=>new td(oe(this,ue,"f"),t),visitModuleMultiplierBox:t=>new rd(oe(this,ue,"f"),t),visitNanoDeviceBox:t=>new xd(oe(this,ue,"f"),t),visitNeuralAmpDeviceBox:t=>new Zd(oe(this,ue,"f"),t),visitNeuralAmpModelBox:t=>new Kd(oe(this,ue,"f"),t),visitNoteClipBox:t=>new Su(oe(this,ue,"f"),t),visitNoteEventBox:t=>new Sl(oe(this,ue,"f"),t),visitNoteEventCollectionBox:t=>new Yi(oe(this,ue,"f"),t),visitNoteRegionBox:t=>new ss(oe(this,ue,"f"),t),visitPitchDeviceBox:t=>new vd(oe(this,ue,"f"),t),visitPlayfieldDeviceBox:t=>new Ps(oe(this,ue,"f"),t),visitPlayfieldSampleBox:t=>new bd(oe(this,ue,"f"),t),visitRevampDeviceBox:t=>new Qu(oe(this,ue,"f"),t),visitReverbDeviceBox:t=>new Ju(oe(this,ue,"f"),t),visitRootBox:t=>new fd(oe(this,ue,"f"),t),visitSoundfontDeviceBox:t=>new Dd(oe(this,ue,"f"),t),visitSoundfontFileBox:t=>new fx(oe(this,ue,"f"),t),visitStereoToolDeviceBox:t=>new Pd(oe(this,ue,"f"),t),visitTapeDeviceBox:t=>new md(oe(this,ue,"f"),t),visitTimelineBox:t=>new ln(oe(this,ue,"f"),t),visitTrackBox:t=>new Vt(oe(this,ue,"f"),t),visitUnknownAudioEffectDeviceBox:t=>new Fd(oe(this,ue,"f"),t),visitUnknownMidiEffectDeviceBox:t=>new Bd(oe(this,ue,"f"),t),visitValueClipBox:t=>new ts(oe(this,ue,"f"),t),visitValueEventBox:t=>new ca(oe(this,ue,"f"),t),visitValueEventCollectionBox:t=>new _r(oe(this,ue,"f"),t),visitValueRegionBox:t=>new va(oe(this,ue,"f"),t),visitVaporisateurDeviceBox:t=>new gd(oe(this,ue,"f"),t),visitVelocityDeviceBox:t=>new Ud(oe(this,ue,"f"),t),visitZeitgeistDeviceBox:t=>new Ed(oe(this,ue,"f"),t)}),`Could not find factory for ${e}`)};var Gd;(function(r){r.PEAKS=Me.compose(b.Lowest).append(0),r.SPECTRUM=Me.compose(b.Lowest).append(1),r.WAVEFORM=Me.compose(b.Lowest).append(2)})(Gd||(Gd={}));var dN;(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,n=i=>{let o=t.get(i)??0,a=i;for(;t.has(a);)o++,a=`${i} ${o}`;return t.set(i,o),t.set(a,1),a};Object.keys(e).forEach(i=>{let o=e[i];o.fileName=n(r.sanitizeFileName(o.fileName))})}})(dN||(dN={}));var wx=512,pN=xr.createBuilder({position:xr.float,bpm:xr.float,playbackTimestamp:xr.float,countInBeatsRemaining:xr.float,isPlaying:xr.bool,isCountingIn:xr.bool,isRecording:xr.bool,perfIndex:xr.int32,perfBuffer:xr.floats(wx)});var hN;(function(r){r.store=(e,t,n)=>{if(n==="")return D("MetaData.store: origin must be unique to your app.");let i=e.pointerHub.filter(c.MetaData).map(({box:a})=>a).find(a=>a instanceof Dn&&a.origin.getValue()===n),o=a=>{a.target.refer(e),a.origin.setValue(n),a.value.setValue(JSON.stringify(t))};Zs(i)?o(i):Dn.create(e.graph,b.generate(),o)},r.read=(e,t)=>{if(t==="")return D("MetaData.read: origin must be unique to your app.");let n=e.pointerHub.filter(c.MetaData).map(({box:i})=>i).find(i=>i instanceof Dn&&i.origin.getValue()===t);if(Zs(n)){let{status:i,value:o,error:a}=ho(()=>JSON.parse(n.value.getValue()));if(i==="success")return o;console.warn(a)}return null},r.clear=(e,t)=>{if(t==="")return D("MetaData.clear: origin must be unique to your app.");e.pointerHub.filter(c.MetaData).map(({box:n})=>n).filter(n=>n instanceof Dn&&n.origin.getValue()===t).forEach(n=>n.delete())},r.catchupAndSubscribe=(e,t,n)=>{if(t==="")return D("MetaData.catchupAndSubscribe: origin must be unique to your app.");let i=b.newSet(s=>s.uuid),o=s=>{let{status:l,value:u,error:p}=ho(()=>JSON.parse(s.value.getValue()));l==="success"?n(m.wrap(u)):(console.warn(p),n(m.None))},a=e.pointerHub.catchupAndSubscribe({onAdded:({box:s})=>{if(!(s instanceof Dn)||s.origin.getValue()!==t)return;let l=s.value.catchupAndSubscribe(()=>o(s));i.add({uuid:s.address.uuid,subscription:l})},onRemoved:({box:s})=>{if(!(s instanceof Dn)||s.origin.getValue()!==t)return;i.removeByKey(s.address.uuid).subscription.terminate(),n(m.None)}},c.MetaData);return{terminate:()=>{a.terminate(),i.forEach(({subscription:s})=>s.terminate()),i.clear()}}}})(hN||(hN={}));var h_=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Fs=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},bx,Ax,_x,pc,Pn=class{constructor(e,t){bx.set(this,new j),Ax.set(this,void 0),_x.set(this,void 0),pc.set(this,void 0),h_(this,Ax,e,"f"),h_(this,_x,t,"f"),h_(this,pc,new St(128),"f"),Fs(this,bx,"f").own(Fs(this,Ax,"f").broadcastIntegers(Fs(this,_x,"f"),new Int32Array(Fs(this,pc,"f").buffer),n=>{}))}noteOn(e){e>=0&&e<128&&Fs(this,pc,"f").setBit(e,!0)}noteOff(e){e>=0&&e<128&&Fs(this,pc,"f").setBit(e,!1)}reset(){}clear(){Fs(this,pc,"f").clear()}terminate(){Fs(this,bx,"f").terminate()}toString(){return`{${this.constructor.name}}`}};bx=new WeakMap,Ax=new WeakMap,_x=new WeakMap,pc=new WeakMap;var Nt;(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 n=r.readParam1(t)&127,i=r.readParam2(t)&127,o=n|i<<7;return 8192>=o?o/8192-1:(o-8191)/8192},r.asValue=t=>{let n=r.readParam2(t);return n>64?.5+(n-63)/128:n<64?n/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,n,i)=>new Uint8Array([e.NoteOn|t,n,i]),r.noteOff=(t,n)=>new Uint8Array([e.NoteOff|t,n,0]),r.control=(t,n,i)=>new Uint8Array([e.Controller|t,n&127,i&127]),r.position=(t,n)=>new Uint8Array([e.Position,t&127,n&127]),r.positionInPPQN=t=>{let n=Math.floor(t/96),i=n&127,o=n>>7&127;return new Uint8Array([e.Position,i,o])},r.accept=(t,n)=>{uo(t)||(r.isNoteOn(t)?P(n.noteOn,r.readPitch(t),r.readVelocity(t)):r.isNoteOff(t)?P(n.noteOff,r.readPitch(t)):r.isPitchWheel(t)?P(n.pitchBend,r.asPitchBend(t)):r.isController(t)?P(n.controller,r.readParam1(t),r.readParam2(t)/127):r.isClock(t)?P(n.clock):r.isStart(t)?P(n.start):r.isContinue(t)?P(n.continue):r.isStop(t)?P(n.stop):r.isPosition(t)&&P(n.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"})(Nt||(Nt={}));var Fa;(function(r){r.on=(e,t,n)=>({type:"note-on",uuid:e,pitch:t,velocity:n}),r.off=(e,t)=>({type:"note-off",uuid:e,pitch:t}),r.audition=(e,t,n,i)=>({type:"note-audition",uuid:e,pitch:t,duration:n,velocity:i}),r.isOn=e=>e.type==="note-on",r.isOff=e=>e.type==="note-off",r.isAudition=e=>e.type==="note-audition",r.fromEvent=(e,t)=>{let n=e.data;if(Nt.isNoteOn(n)){let i=Nt.readPitch(n),o=Nt.readVelocity(n);return{type:"note-on",uuid:t,pitch:i,velocity:o}}else if(Nt.isNoteOff(n)){let i=Nt.readPitch(n);return{type:"note-off",uuid:t,pitch:i}}return D("Unknown MIDI event")}})(Fa||(Fa={}));var fN;(function(r){r.start=(e,t,n,i=1)=>{let o=!0;return e(Fa.on(t,n,i)),{terminate:()=>{o&&(e(Fa.off(t,n)),o=!1)}}}})(fN||(fN={}));var Ik,Dk,Mk,kk,$k;Ik=new WeakMap,Dk=new WeakMap,Mk=new WeakMap,kk=new WeakMap,$k=new WeakMap;var mN=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},qd=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},hc,rm,Px=class{constructor(){hc.set(this,void 0),rm.set(this,void 0),mN(this,hc,Me.newSet(e=>e.field.address),"f"),mN(this,rm,new ce,"f")}register(e){return qd(this,hc,"f").add(e),{terminate:()=>qd(this,hc,"f").removeByValue(e)}}get(e){return qd(this,hc,"f").get(e)}opt(e){return qd(this,hc,"f").opt(e)}subscribeWrites(e){return qd(this,rm,"f").subscribe(e)}notifyWrite(e,t){qd(this,rm,"f").notify({adapter:e,previousUnitValue:t})}};hc=new WeakMap,rm=new WeakMap;var io={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})??D("Could not cast to AnyRegionBox"),isLoopableRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1};var im={min:30,max:1e3};var Sx;(function(r){r.isTimeSignatureValid=(e,t)=>!Number.isInteger(e)||e<1||e>31?fo.err("Numerator needs to be a interger between 1 and 31"):!Number.isInteger(t)||t<1||t>32||t&t-1?fo.err("Denominator must be a power of two between 1 and 32"):fo.ok([e,t]),r.clampBpm=e=>Number.isFinite(e)?be(e,im.min,im.max):120,r.hasOverlappingRegions=e=>e.boxes().some(t=>t.accept({visitTrackBox:n=>{for(let[i,o]of U.iterateAdjacent(n.regions.pointerHub.incoming().map(({box:a})=>io.asRegionBox(a)).sort(({position:a},{position:s})=>a.getValue()-s.getValue()))){if(i instanceof ja&&i.timeBase.getValue()===Wr.Seconds)return!1;if(i.position.getValue()+i.duration.getValue()>o.position.getValue())return!0}return!1}})??!1)})(Sx||(Sx={}));var gN;(function(r){r.parseTimeSignature=e=>{let[t,n]=e.split("/"),i=parseInt(t,10),o=parseInt(n,10);return Sx.isTimeSignatureValid(i,o)}})(gN||(gN={}));var Ex;(function(r){r.reader=({sab:e,numChunks:t,numberOfChannels:n,bufferSize:i},o)=>{let a=!0,s=new Int32Array(e,0,2),l=new Float32Array(e,8),u=new Float32Array(n*i),p=typeof document>"u",d=()=>{if(!a)return;let h=Atomics.load(s,1),g=Atomics.load(s,0);if(h===g){if(p)Atomics.wait(s,0,g);else{setTimeout(d,1);return}g=Atomics.load(s,0)}for(;h!==g;){let v=h*n*i;u.set(l.subarray(v,v+n*i));let y=[];for(let x=0;x<n;x++){let B=x*i,I=B+i;y.push(u.slice(B,I))}if(h=(h+1)%t,Atomics.store(s,1,h),!a)return;o(y)}d()};return d(),{stop:()=>a=!1}},r.writer=({sab:e,numChunks:t,numberOfChannels:n,bufferSize:i})=>{let o=new Int32Array(e,0,2),a=new Float32Array(e,8);return Object.freeze({write:s=>{if(s.length!==n)return;for(let p of s)if(p.length!==i)return D("Each channel buffer must contain 'bufferSize' samples");let l=Atomics.load(o,0),u=l*n*i;s.forEach((p,d)=>a.set(p,u+d*i)),Atomics.store(o,0,(l+1)%t),Atomics.notify(o,0)}})}})(Ex||(Ex={}));var f_={isRegion:r=>io.isRegionBox(r.box),isLoopableRegion:r=>io.isLoopableRegionBox(r.box)};var Tk=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ye=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},no,Fx,ji,Bs,Ns,m_,nm,Bx,Nx=class{constructor(e){no.add(this),Fx.set(this,new j),ji.set(this,void 0),Bs.set(this,[]),Ns.set(this,[]),Tk(this,ji,e,"f"),Ye(this,Fx,"f").ownAll(e.box.bpm.subscribe(()=>Ye(this,no,"m",m_).call(this)),e.catchupAndSubscribeTempoAutomation(()=>Ye(this,no,"m",m_).call(this)))}terminate(){Ye(this,Fx,"f").terminate()}getTempoAt(e){let t=Ye(this,ji,"f").box.bpm.getValue();return Ye(this,ji,"f").tempoTrackEvents.mapOr(n=>n.valueAt(e,t),t)}ppqnToSeconds(e){return e<0?-Ye(this,no,"m",nm).call(this,-e):Ye(this,no,"m",nm).call(this,e)}secondsToPPQN(e){return Ye(this,no,"m",Bx).call(this,e)}intervalToSeconds(e,t){return e>=t?0:Ye(this,no,"m",nm).call(this,t)-Ye(this,no,"m",nm).call(this,e)}intervalToPPQN(e,t){if(e>=t)return 0;let n=Ye(this,no,"m",Bx).call(this,e);return Ye(this,no,"m",Bx).call(this,t)-n}subscribe(e){let t=new j;return t.ownAll(Ye(this,ji,"f").box.bpm.subscribe(()=>e(this)),Ye(this,ji,"f").catchupAndSubscribeTempoAutomation(()=>e(this))),t}};Fx=new WeakMap,ji=new WeakMap,Bs=new WeakMap,Ns=new WeakMap,no=new WeakSet,m_=function(){Ye(this,Bs,"f").length=0,Ye(this,Ns,"f").length=0;let e=Ye(this,ji,"f").tempoTrackEvents;if(e.isEmpty())return;let t=e.unwrap();if(t.events.isEmpty())return;let n=t.events.asArray(),i=Ye(this,ji,"f").box.bpm.getValue(),o=[{ppqn:0,seconds:0,bpm:t.valueAt(0,i)}],a=0,s=0;for(let u of n){let p=u.position;if(!(p<=s)){for(;s<p;){let d=t.valueAt(s,i),h=Dc(s,na),g=h<=s?h+na:h,v=Math.min(g,p);a+=J.pulsesToSeconds(v-s,d),s=v}o.push({ppqn:p,seconds:a,bpm:t.valueAt(p,i)})}}Ye(this,Bs,"f").push(...o);let l=o.slice().sort((u,p)=>u.seconds-p.seconds);Ye(this,Ns,"f").push(...l)},nm=function(e){if(e<=0)return 0;let t=Ye(this,ji,"f").box.bpm.getValue(),n=Ye(this,ji,"f").tempoTrackEvents;if(n.isEmpty())return J.pulsesToSeconds(e,t);let i=n.unwrap();if(i.events.isEmpty())return J.pulsesToSeconds(e,t);let o=0,a=0;if(Ye(this,Bs,"f").length>0){let u=ct.rightMostMapped(Ye(this,Bs,"f"),e,$a,p=>p.ppqn);if(u>=0){let p=Ye(this,Bs,"f")[u];if(o=p.ppqn,a=p.seconds,u===Ye(this,Bs,"f").length-1)return a+J.pulsesToSeconds(e-o,p.bpm)}}let s=a,l=o;for(;l<e;){let u=i.valueAt(l,t),p=Dc(l,na),d=p<=l?p+na:p,h=Math.min(d,e);s+=J.pulsesToSeconds(h-l,u),l=h}return s},Bx=function(e){if(e<=0)return 0;let t=Ye(this,ji,"f").box.bpm.getValue(),n=Ye(this,ji,"f").tempoTrackEvents;if(n.isEmpty())return J.secondsToPulses(e,t);let i=n.unwrap();if(i.events.isEmpty())return J.secondsToPulses(e,t);let o=0,a=0;if(Ye(this,Ns,"f").length>0){let u=ct.rightMostMapped(Ye(this,Ns,"f"),e,$a,p=>p.seconds);if(u>=0){let p=Ye(this,Ns,"f")[u];if(o=p.ppqn,a=p.seconds,u===Ye(this,Ns,"f").length-1)return o+J.secondsToPulses(e-a,p.bpm)}}let s=a,l=o;for(;s<e;){let u=i.valueAt(l,t),p=Dc(l,na),d=p<=l?p+na:p,h=d-l,g=J.pulsesToSeconds(h,u);if(s+g>=e){let v=e-s;l+=J.secondsToPulses(v,u);break}s+=g,l=d}return l};var Zo;(function(r){r[r.Off=0]="Off",r[r.On=1]="On",r[r.Loop=2]="Loop"})(Zo||(Zo={}));var Rk,Ck,Ok,Vk;Rk=new WeakMap,Ck=new WeakMap,Ok=new WeakMap,Vk=new WeakMap;var zk,Uk,jk,Lk;zk=new WeakMap,Uk=new WeakMap,jk=new WeakMap,Lk=new WeakMap;var Le={};Xo(Le,{$brand:()=>Ix,$input:()=>T1,$output:()=>$1,NEVER:()=>g_,TimePrecision:()=>V1,ZodAny:()=>BE,ZodArray:()=>ME,ZodBase64:()=>ib,ZodBase64URL:()=>nb,ZodBigInt:()=>Pp,ZodBigIntFormat:()=>sb,ZodBoolean:()=>_p,ZodCIDRv4:()=>tb,ZodCIDRv6:()=>rb,ZodCUID:()=>qw,ZodCUID2:()=>Hw,ZodCatch:()=>eF,ZodCodec:()=>mb,ZodCustom:()=>Rm,ZodCustomStringFormat:()=>bp,ZodDate:()=>Dm,ZodDefault:()=>qE,ZodDiscriminatedUnion:()=>$E,ZodE164:()=>ob,ZodEmail:()=>Ww,ZodEmoji:()=>Zw,ZodEnum:()=>xp,ZodError:()=>vR,ZodExactOptional:()=>WE,ZodFile:()=>LE,ZodFirstPartyTypeKind:()=>pF,ZodFunction:()=>cF,ZodGUID:()=>Em,ZodIPv4:()=>Xw,ZodIPv6:()=>eb,ZodISODate:()=>Vw,ZodISODateTime:()=>Ow,ZodISODuration:()=>Uw,ZodISOTime:()=>zw,ZodIntersection:()=>TE,ZodIssueCode:()=>xR,ZodJWT:()=>ab,ZodKSUID:()=>Yw,ZodLazy:()=>aF,ZodLiteral:()=>jE,ZodMAC:()=>bE,ZodMap:()=>zE,ZodNaN:()=>rF,ZodNanoID:()=>Gw,ZodNever:()=>IE,ZodNonOptional:()=>hb,ZodNull:()=>EE,ZodNullable:()=>GE,ZodNumber:()=>Ap,ZodNumberFormat:()=>bc,ZodObject:()=>km,ZodOptional:()=>pb,ZodPipe:()=>fb,ZodPrefault:()=>JE,ZodPromise:()=>lF,ZodReadonly:()=>iF,ZodRealError:()=>bi,ZodRecord:()=>Tm,ZodSet:()=>UE,ZodString:()=>wp,ZodStringFormat:()=>mt,ZodSuccess:()=>XE,ZodSymbol:()=>PE,ZodTemplateLiteral:()=>oF,ZodTransform:()=>KE,ZodTuple:()=>CE,ZodType:()=>Oe,ZodULID:()=>Jw,ZodURL:()=>Im,ZodUUID:()=>Jo,ZodUndefined:()=>SE,ZodUnion:()=>$m,ZodUnknown:()=>NE,ZodVoid:()=>DE,ZodXID:()=>Qw,ZodXor:()=>kE,_ZodString:()=>Kw,_default:()=>HE,_function:()=>HD,any:()=>FD,array:()=>Mm,base64:()=>uD,base64url:()=>dD,bigint:()=>AD,boolean:()=>_E,catch:()=>tF,check:()=>JD,cidrv4:()=>lD,cidrv6:()=>cD,clone:()=>ei,codec:()=>ZD,coerce:()=>hF,config:()=>Kt,core:()=>Ia,cuid:()=>eD,cuid2:()=>tD,custom:()=>QD,date:()=>ND,decode:()=>fE,decodeAsync:()=>gE,describe:()=>YD,discriminatedUnion:()=>TD,e164:()=>pD,email:()=>KI,emoji:()=>YI,encode:()=>hE,encodeAsync:()=>mE,endsWith:()=>cp,enum:()=>ub,exactOptional:()=>ZE,file:()=>jD,flattenError:()=>hm,float32:()=>yD,float64:()=>xD,formatError:()=>fm,fromJSONSchema:()=>oM,function:()=>HD,getErrorMap:()=>bR,globalRegistry:()=>Ir,gt:()=>qo,gte:()=>ti,guid:()=>WI,hash:()=>vD,hex:()=>gD,hostname:()=>mD,httpUrl:()=>QI,includes:()=>sp,instanceof:()=>eM,int:()=>Lw,int32:()=>wD,int64:()=>_D,intersection:()=>RE,ipv4:()=>oD,ipv6:()=>sD,iso:()=>yp,json:()=>rM,jwt:()=>hD,keyof:()=>ID,ksuid:()=>nD,lazy:()=>sF,length:()=>xc,literal:()=>UD,locales:()=>Am,looseObject:()=>kD,looseRecord:()=>CD,lowercase:()=>op,lt:()=>Go,lte:()=>Ki,mac:()=>aD,map:()=>OD,maxLength:()=>yc,maxSize:()=>Rs,meta:()=>XD,mime:()=>up,minLength:()=>Na,minSize:()=>Ho,multipleOf:()=>Ts,nan:()=>WD,nanoid:()=>XI,nativeEnum:()=>zD,negative:()=>Bw,never:()=>lb,nonnegative:()=>Iw,nonoptional:()=>YE,nonpositive:()=>Nw,normalize:()=>dp,null:()=>FE,nullable:()=>Bm,nullish:()=>LD,number:()=>AE,object:()=>DD,optional:()=>Fm,overwrite:()=>ao,parse:()=>cE,parseAsync:()=>uE,partialRecord:()=>RD,pipe:()=>Nm,positive:()=>Fw,prefault:()=>QE,preprocess:()=>iM,prettifyError:()=>B_,promise:()=>qD,property:()=>Dw,readonly:()=>nF,record:()=>VE,refine:()=>uF,regex:()=>np,regexes:()=>En,registry:()=>aw,safeDecode:()=>yE,safeDecodeAsync:()=>wE,safeEncode:()=>vE,safeEncodeAsync:()=>xE,safeParse:()=>dE,safeParseAsync:()=>pE,set:()=>VD,setErrorMap:()=>wR,size:()=>vc,slugify:()=>mp,startsWith:()=>lp,strictObject:()=>MD,string:()=>jw,stringFormat:()=>fD,stringbool:()=>tM,success:()=>KD,superRefine:()=>dF,symbol:()=>SD,templateLiteral:()=>GD,toJSONSchema:()=>Tw,toLowerCase:()=>hp,toUpperCase:()=>fp,transform:()=>db,treeifyError:()=>F_,trim:()=>pp,tuple:()=>OE,uint32:()=>bD,uint64:()=>PD,ulid:()=>rD,undefined:()=>ED,union:()=>cb,unknown:()=>wc,uppercase:()=>ap,url:()=>JI,util:()=>G,uuid:()=>ZI,uuidv4:()=>GI,uuidv6:()=>qI,uuidv7:()=>HI,void:()=>BD,xid:()=>iD,xor:()=>$D});var Ia={};Xo(Ia,{$ZodAny:()=>r1,$ZodArray:()=>s1,$ZodAsyncError:()=>oo,$ZodBase64:()=>ZP,$ZodBase64URL:()=>GP,$ZodBigInt:()=>Xx,$ZodBigIntFormat:()=>YP,$ZodBoolean:()=>ym,$ZodCIDRv4:()=>LP,$ZodCIDRv6:()=>KP,$ZodCUID:()=>DP,$ZodCUID2:()=>MP,$ZodCatch:()=>S1,$ZodCheck:()=>xt,$ZodCheckBigIntFormat:()=>sP,$ZodCheckEndsWith:()=>xP,$ZodCheckGreaterThan:()=>Zx,$ZodCheckIncludes:()=>vP,$ZodCheckLengthEquals:()=>hP,$ZodCheckLessThan:()=>Wx,$ZodCheckLowerCase:()=>mP,$ZodCheckMaxLength:()=>dP,$ZodCheckMaxSize:()=>lP,$ZodCheckMimeType:()=>bP,$ZodCheckMinLength:()=>pP,$ZodCheckMinSize:()=>cP,$ZodCheckMultipleOf:()=>oP,$ZodCheckNumberFormat:()=>aP,$ZodCheckOverwrite:()=>AP,$ZodCheckProperty:()=>wP,$ZodCheckRegex:()=>fP,$ZodCheckSizeEquals:()=>uP,$ZodCheckStartsWith:()=>yP,$ZodCheckStringFormat:()=>rp,$ZodCheckUpperCase:()=>gP,$ZodCodec:()=>wm,$ZodCustom:()=>k1,$ZodCustomStringFormat:()=>JP,$ZodDate:()=>a1,$ZodDefault:()=>b1,$ZodDiscriminatedUnion:()=>u1,$ZodE164:()=>qP,$ZodEmail:()=>FP,$ZodEmoji:()=>NP,$ZodEncodeError:()=>Is,$ZodEnum:()=>m1,$ZodError:()=>pm,$ZodExactOptional:()=>x1,$ZodFile:()=>v1,$ZodFunction:()=>I1,$ZodGUID:()=>SP,$ZodIPv4:()=>zP,$ZodIPv6:()=>UP,$ZodISODate:()=>CP,$ZodISODateTime:()=>RP,$ZodISODuration:()=>VP,$ZodISOTime:()=>OP,$ZodIntersection:()=>d1,$ZodJWT:()=>HP,$ZodKSUID:()=>TP,$ZodLazy:()=>M1,$ZodLiteral:()=>g1,$ZodMAC:()=>jP,$ZodMap:()=>h1,$ZodNaN:()=>E1,$ZodNanoID:()=>IP,$ZodNever:()=>n1,$ZodNonOptional:()=>_1,$ZodNull:()=>t1,$ZodNullable:()=>w1,$ZodNumber:()=>Yx,$ZodNumberFormat:()=>QP,$ZodObject:()=>LN,$ZodObjectJIT:()=>l1,$ZodOptional:()=>tw,$ZodPipe:()=>F1,$ZodPrefault:()=>A1,$ZodPromise:()=>D1,$ZodReadonly:()=>B1,$ZodRealError:()=>wi,$ZodRecord:()=>p1,$ZodRegistry:()=>ow,$ZodSet:()=>f1,$ZodString:()=>gc,$ZodStringFormat:()=>ft,$ZodSuccess:()=>P1,$ZodSymbol:()=>XP,$ZodTemplateLiteral:()=>N1,$ZodTransform:()=>y1,$ZodTuple:()=>ew,$ZodType:()=>De,$ZodULID:()=>kP,$ZodURL:()=>BP,$ZodUUID:()=>EP,$ZodUndefined:()=>e1,$ZodUnion:()=>xm,$ZodUnknown:()=>i1,$ZodVoid:()=>o1,$ZodXID:()=>$P,$ZodXor:()=>c1,$brand:()=>Ix,$constructor:()=>S,$input:()=>T1,$output:()=>$1,Doc:()=>vm,JSONSchema:()=>jI,JSONSchemaGenerator:()=>Rw,NEVER:()=>g_,TimePrecision:()=>V1,_any:()=>aS,_array:()=>hS,_base64:()=>_w,_base64url:()=>Pw,_bigint:()=>X1,_boolean:()=>Q1,_catch:()=>cR,_check:()=>UI,_cidrv4:()=>bw,_cidrv6:()=>Aw,_coercedBigint:()=>eS,_coercedBoolean:()=>Y1,_coercedDate:()=>dS,_coercedNumber:()=>W1,_coercedString:()=>C1,_cuid:()=>fw,_cuid2:()=>mw,_custom:()=>mS,_date:()=>uS,_decode:()=>Rx,_decodeAsync:()=>Ox,_default:()=>aR,_discriminatedUnion:()=>qT,_e164:()=>Sw,_email:()=>sw,_emoji:()=>pw,_encode:()=>Tx,_encodeAsync:()=>Cx,_endsWith:()=>cp,_enum:()=>eR,_file:()=>fS,_float32:()=>G1,_float64:()=>q1,_gt:()=>qo,_gte:()=>ti,_guid:()=>_m,_includes:()=>sp,_int:()=>Z1,_int32:()=>H1,_int64:()=>tS,_intersection:()=>HT,_ipv4:()=>xw,_ipv6:()=>ww,_isoDate:()=>U1,_isoDateTime:()=>z1,_isoDuration:()=>L1,_isoTime:()=>j1,_jwt:()=>Ew,_ksuid:()=>yw,_lazy:()=>hR,_length:()=>xc,_literal:()=>rR,_lowercase:()=>op,_lt:()=>Go,_lte:()=>Ki,_mac:()=>O1,_map:()=>YT,_max:()=>Ki,_maxLength:()=>yc,_maxSize:()=>Rs,_mime:()=>up,_min:()=>ti,_minLength:()=>Na,_minSize:()=>Ho,_multipleOf:()=>Ts,_nan:()=>pS,_nanoid:()=>hw,_nativeEnum:()=>tR,_negative:()=>Bw,_never:()=>lS,_nonnegative:()=>Iw,_nonoptional:()=>sR,_nonpositive:()=>Nw,_normalize:()=>dp,_null:()=>oS,_nullable:()=>oR,_number:()=>K1,_optional:()=>nR,_overwrite:()=>ao,_parse:()=>Yd,_parseAsync:()=>Xd,_pipe:()=>uR,_positive:()=>Fw,_promise:()=>fR,_property:()=>Dw,_readonly:()=>dR,_record:()=>QT,_refine:()=>gS,_regex:()=>np,_safeDecode:()=>zx,_safeDecodeAsync:()=>jx,_safeEncode:()=>Vx,_safeEncodeAsync:()=>Ux,_safeParse:()=>ep,_safeParseAsync:()=>tp,_set:()=>XT,_size:()=>vc,_slugify:()=>mp,_startsWith:()=>lp,_string:()=>R1,_stringFormat:()=>gp,_stringbool:()=>wS,_success:()=>lR,_superRefine:()=>vS,_symbol:()=>iS,_templateLiteral:()=>pR,_toLowerCase:()=>hp,_toUpperCase:()=>fp,_transform:()=>iR,_trim:()=>pp,_tuple:()=>JT,_uint32:()=>J1,_uint64:()=>rS,_ulid:()=>gw,_undefined:()=>nS,_union:()=>ZT,_unknown:()=>sS,_uppercase:()=>ap,_url:()=>Pm,_uuid:()=>lw,_uuidv4:()=>cw,_uuidv6:()=>uw,_uuidv7:()=>dw,_void:()=>cS,_xid:()=>vw,_xor:()=>GT,clone:()=>ei,config:()=>Kt,createStandardJSONSchemaMethod:()=>vp,createToJSONSchemaMethod:()=>bS,decode:()=>v$,decodeAsync:()=>x$,describe:()=>yS,encode:()=>g$,encodeAsync:()=>y$,extractDefs:()=>Os,finalize:()=>Vs,flattenError:()=>hm,formatError:()=>fm,globalConfig:()=>om,globalRegistry:()=>Ir,initializeContext:()=>Cs,isValidBase64:()=>WP,isValidBase64URL:()=>VN,isValidJWT:()=>zN,locales:()=>Am,meta:()=>xS,parse:()=>kx,parseAsync:()=>$x,prettifyError:()=>B_,process:()=>at,regexes:()=>En,registry:()=>aw,safeDecode:()=>b$,safeDecodeAsync:()=>_$,safeEncode:()=>w$,safeEncodeAsync:()=>A$,safeParse:()=>N_,safeParseAsync:()=>I_,toDotPath:()=>bN,toJSONSchema:()=>Tw,treeifyError:()=>F_,util:()=>G,version:()=>_P});var g_=Object.freeze({status:"aborted"});function S(r,e,t){function n(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 h=p[d];h in s||(s[h]=u[h].bind(s))}}let i=t?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:r});function a(s){var l;let u=t?.Parent?new o:this;n(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let p of u._zod.deferred)p();return u}return Object.defineProperty(a,"init",{value:n}),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 Ix=Symbol("zod_brand"),oo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Is=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},om={};function Kt(r){return r&&Object.assign(om,r),om}var G={};Xo(G,{BIGINT_FORMAT_RANGES:()=>E_,Class:()=>y_,NUMBER_FORMAT_RANGES:()=>S_,aborted:()=>$s,allowsEval:()=>b_,assert:()=>qk,assertEqual:()=>Kk,assertIs:()=>Zk,assertNever:()=>Gk,assertNotEqual:()=>Wk,assignProp:()=>Ms,base64ToUint8Array:()=>yN,base64urlToUint8Array:()=>d$,cached:()=>Jd,captureStackTrace:()=>Mx,cleanEnum:()=>u$,cleanRegex:()=>lm,clone:()=>ei,cloneDef:()=>Jk,createTransparentProxy:()=>r$,defineLazy:()=>je,esc:()=>Dx,escapeRegex:()=>Sn,extend:()=>o$,finalizeIssue:()=>xi,floatSafeRemainder:()=>x_,getElementAtPath:()=>Qk,getEnumValues:()=>sm,getLengthableOrigin:()=>dm,getParsedType:()=>t$,getSizableOrigin:()=>um,hexToUint8Array:()=>h$,isObject:()=>fc,isPlainObject:()=>ks,issue:()=>Qd,joinValues:()=>T,jsonStringifyReplacer:()=>Hd,merge:()=>s$,mergeDefs:()=>Ba,normalizeParams:()=>H,nullish:()=>Ds,numKeys:()=>e$,objectClone:()=>Hk,omit:()=>n$,optionalKeys:()=>P_,parsedType:()=>Z,partial:()=>l$,pick:()=>i$,prefixIssues:()=>Li,primitiveTypes:()=>__,promiseAllObject:()=>Yk,propertyKeyTypes:()=>cm,randomString:()=>Xk,required:()=>c$,safeExtend:()=>a$,shallowClone:()=>A_,slugify:()=>w_,stringifyPrimitive:()=>K,uint8ArrayToBase64:()=>xN,uint8ArrayToBase64url:()=>p$,uint8ArrayToHex:()=>f$,unwrapMessage:()=>am});function Kk(r){return r}function Wk(r){return r}function Zk(r){}function Gk(r){throw new Error("Unexpected value in exhaustive check")}function qk(r){}function sm(r){let e=Object.values(r).filter(n=>typeof n=="number");return Object.entries(r).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function T(r,e="|"){return r.map(t=>K(t)).join(e)}function Hd(r,e){return typeof e=="bigint"?e.toString():e}function Jd(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function Ds(r){return r==null}function lm(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}function x_(r,e){let t=(r.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=t>i?t:i,a=Number.parseInt(r.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var vN=Symbol("evaluating");function je(r,e,t){let n;Object.defineProperty(r,e,{get(){if(n!==vN)return n===void 0&&(n=vN,n=t()),n},set(i){Object.defineProperty(r,e,{value:i})},configurable:!0})}function Hk(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function Ms(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Ba(...r){let e={};for(let t of r){let n=Object.getOwnPropertyDescriptors(t);Object.assign(e,n)}return Object.defineProperties({},e)}function Jk(r){return Ba(r._zod.def)}function Qk(r,e){return e?e.reduce((t,n)=>t?.[n],r):r}function Yk(r){let e=Object.keys(r),t=e.map(n=>r[n]);return Promise.all(t).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function Xk(r=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let n=0;n<r;n++)t+=e[Math.floor(Math.random()*e.length)];return t}function Dx(r){return JSON.stringify(r)}function w_(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mx="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function fc(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var b_=Jd(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function ks(r){if(fc(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(fc(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function A_(r){return ks(r)?{...r}:Array.isArray(r)?[...r]:r}function e$(r){let e=0;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}var t$=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}`)}},cm=new Set(["string","number","symbol"]),__=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Sn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(r,e,t){let n=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(n._zod.parent=r),n}function H(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 r$(r){let e;return new Proxy({},{get(t,n,i){return e??(e=r()),Reflect.get(e,n,i)},set(t,n,i,o){return e??(e=r()),Reflect.set(e,n,i,o)},has(t,n){return e??(e=r()),Reflect.has(e,n)},deleteProperty(t,n){return e??(e=r()),Reflect.deleteProperty(e,n)},ownKeys(t){return e??(e=r()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(t,n){return e??(e=r()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(t,n,i){return e??(e=r()),Reflect.defineProperty(e,n,i)}})}function K(r){return typeof r=="bigint"?r.toString()+"n":typeof r=="string"?`"${r}"`:`${r}`}function P_(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}var S_={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]},E_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function i$(r,e){let t=r._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Ba(r._zod.def,{get shape(){let a={};for(let s in e){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=t.shape[s])}return Ms(this,"shape",a),a},checks:[]});return ei(r,o)}function n$(r,e){let t=r._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Ba(r._zod.def,{get shape(){let a={...r._zod.def.shape};for(let s in e){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return Ms(this,"shape",a),a},checks:[]});return ei(r,o)}function o$(r,e){if(!ks(e))throw new Error("Invalid input to extend: expected a plain object");let t=r._zod.def.checks;if(t&&t.length>0){let o=r._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ba(r._zod.def,{get shape(){let o={...r._zod.def.shape,...e};return Ms(this,"shape",o),o}});return ei(r,i)}function a$(r,e){if(!ks(e))throw new Error("Invalid input to safeExtend: expected a plain object");let t=Ba(r._zod.def,{get shape(){let n={...r._zod.def.shape,...e};return Ms(this,"shape",n),n}});return ei(r,t)}function s$(r,e){let t=Ba(r._zod.def,{get shape(){let n={...r._zod.def.shape,...e._zod.def.shape};return Ms(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return ei(r,t)}function l$(r,e,t){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Ba(e._zod.def,{get shape(){let s=e._zod.def.shape,l={...s};if(t)for(let u in t){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=r?new r({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)l[u]=r?new r({type:"optional",innerType:s[u]}):s[u];return Ms(this,"shape",l),l},checks:[]});return ei(e,a)}function c$(r,e,t){let n=Ba(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};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:i[a]}))}else for(let a in i)o[a]=new r({type:"nonoptional",innerType:i[a]});return Ms(this,"shape",o),o}});return ei(e,n)}function $s(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 Li(r,e){return e.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(r),t})}function am(r){return typeof r=="string"?r:r?.message}function xi(r,e,t){let n={...r,path:r.path??[]};if(!r.message){let i=am(r.inst?._zod.def?.error?.(r))??am(e?.error?.(r))??am(t.customError?.(r))??am(t.localeError?.(r))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function um(r){return r instanceof Set?"set":r instanceof Map?"map":r instanceof File?"file":"unknown"}function dm(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}function Z(r){let e=typeof r;switch(e){case"number":return Number.isNaN(r)?"nan":"number";case"object":{if(r===null)return"null";if(Array.isArray(r))return"array";let t=r;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return e}function Qd(...r){let[e,t,n]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:n}:{...e}}function u$(r){return Object.entries(r).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function yN(r){let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function xN(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function d$(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return yN(e+t)}function p$(r){return xN(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function h$(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 n=0;n<e.length;n+=2)t[n/2]=Number.parseInt(e.slice(n,n+2),16);return t}function f$(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}var y_=class{constructor(...e){}};var wN=(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,Hd,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},pm=S("$ZodError",wN),wi=S("$ZodError",wN,{Parent:Error});function hm(r,e=t=>t.message){let t={},n=[];for(let i of r.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}function fm(r,e=t=>t.message){let t={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({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 n(r),t}function F_(r,e=t=>t.message){let t={errors:[]},n=(i,o=[])=>{var a,s;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>n({issues:u},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({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 h=u[d],g=d===u.length-1;typeof h=="string"?(p.properties??(p.properties={}),(a=p.properties)[h]??(a[h]={errors:[]}),p=p.properties[h]):(p.items??(p.items=[]),(s=p.items)[h]??(s[h]={errors:[]}),p=p.items[h]),g&&p.errors.push(e(l)),d++}}};return n(r),t}function bN(r){let e=[],t=r.map(n=>typeof n=="object"?n.key:n);for(let n of t)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function B_(r){let e=[],t=[...r.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of t)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${bN(n.path)}`);return e.join(`
4
4
  `)}var Yd=r=>(e,t,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise)throw new oo;if(a.issues.length){let s=new(i?.Err??r)(a.issues.map(l=>xi(l,o,Kt())));throw Mx(s,i?.callee),s}return a.value},kx=Yd(wi),Xd=r=>async(e,t,n,i)=>{let o=n?Object.assign(n,{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(i?.Err??r)(a.issues.map(l=>xi(l,o,Kt())));throw Mx(s,i?.callee),s}return a.value},$x=Xd(wi),ep=r=>(e,t,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:t,issues:[]},i);if(o instanceof Promise)throw new oo;return o.issues.length?{success:!1,error:new(r??pm)(o.issues.map(a=>xi(a,i,Kt())))}:{success:!0,data:o.value}},N_=ep(wi),tp=r=>async(e,t,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:t,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new r(o.issues.map(a=>xi(a,i,Kt())))}:{success:!0,data:o.value}},I_=tp(wi),Tx=r=>(e,t,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yd(r)(e,t,i)},g$=Tx(wi),Rx=r=>(e,t,n)=>Yd(r)(e,t,n),v$=Rx(wi),Cx=r=>async(e,t,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xd(r)(e,t,i)},y$=Cx(wi),Ox=r=>async(e,t,n)=>Xd(r)(e,t,n),x$=Ox(wi),Vx=r=>(e,t,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ep(r)(e,t,i)},w$=Vx(wi),zx=r=>(e,t,n)=>ep(r)(e,t,n),b$=zx(wi),Ux=r=>async(e,t,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tp(r)(e,t,i)},A$=Ux(wi),jx=r=>async(e,t,n)=>tp(r)(e,t,n),_$=jx(wi);var En={};Xo(En,{base64:()=>Z_,base64url:()=>Lx,bigint:()=>Y_,boolean:()=>eP,browserEmail:()=>D$,cidrv4:()=>K_,cidrv6:()=>W_,cuid:()=>D_,cuid2:()=>M_,date:()=>q_,datetime:()=>J_,domain:()=>$$,duration:()=>C_,e164:()=>G_,email:()=>V_,emoji:()=>z_,extendedDuration:()=>P$,guid:()=>O_,hex:()=>T$,hostname:()=>k$,html5Email:()=>B$,idnEmail:()=>I$,integer:()=>X_,ipv4:()=>U_,ipv6:()=>j_,ksuid:()=>T_,lowercase:()=>iP,mac:()=>L_,md5_base64:()=>C$,md5_base64url:()=>O$,md5_hex:()=>R$,nanoid:()=>R_,null:()=>tP,number:()=>Kx,rfc5322Email:()=>N$,sha1_base64:()=>z$,sha1_base64url:()=>U$,sha1_hex:()=>V$,sha256_base64:()=>L$,sha256_base64url:()=>K$,sha256_hex:()=>j$,sha384_base64:()=>Z$,sha384_base64url:()=>G$,sha384_hex:()=>W$,sha512_base64:()=>H$,sha512_base64url:()=>J$,sha512_hex:()=>q$,string:()=>Q_,time:()=>H_,ulid:()=>k_,undefined:()=>rP,unicodeEmail:()=>AN,uppercase:()=>nP,uuid:()=>mc,uuid4:()=>S$,uuid6:()=>E$,uuid7:()=>F$,xid:()=>$_});var D_=/^[cC][^\s-]{8,}$/,M_=/^[0-9a-z]+$/,k_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$_=/^[0-9a-vA-V]{20}$/,T_=/^[A-Za-z0-9]{27}$/,R_=/^[a-zA-Z0-9_-]{21}$/,C_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,P$=/^[-+]?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)?)??$/,O_=/^([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})$/,mc=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)$/,S$=mc(4),E$=mc(6),F$=mc(7),V_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,B$=/^[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])?)*$/,N$=/^(([^<>()\[\]\\.,;:\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,}))$/,AN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,I$=AN,D$=/^[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])?)*$/,M$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function z_(){return new RegExp(M$,"u")}var U_=/^(?:(?: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])$/,j_=/^(([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}|:))$/,L_=r=>{let e=Sn(r??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},K_=/^((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])$/,W_=/^(([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])$/,Z_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lx=/^[A-Za-z0-9_-]*$/,k$=/^(?=.{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])?)*\.?$/,$$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,G_=/^\+[1-9]\d{6,14}$/,_N="(?:(?:\\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])))",q_=new RegExp(`^${_N}$`);function PN(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 H_(r){return new RegExp(`^${PN(r)}$`)}function J_(r){let e=PN({precision:r.precision}),t=["Z"];r.local&&t.push(""),r.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${t.join("|")})`;return new RegExp(`^${_N}T(?:${n})$`)}var Q_=r=>{let e=r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Y_=/^-?\d+n?$/,X_=/^-?\d+$/,Kx=/^-?\d+(?:\.\d+)?$/,eP=/^(?:true|false)$/i,tP=/^null$/i;var rP=/^undefined$/i;var iP=/^[^A-Z]*$/,nP=/^[^a-z]*$/,T$=/^[0-9a-fA-F]*$/;function mm(r,e){return new RegExp(`^[A-Za-z0-9+/]{${r}}${e}$`)}function gm(r){return new RegExp(`^[A-Za-z0-9_-]{${r}}$`)}var R$=/^[0-9a-fA-F]{32}$/,C$=mm(22,"=="),O$=gm(22),V$=/^[0-9a-fA-F]{40}$/,z$=mm(27,"="),U$=gm(27),j$=/^[0-9a-fA-F]{64}$/,L$=mm(43,"="),K$=gm(43),W$=/^[0-9a-fA-F]{96}$/,Z$=mm(64,""),G$=gm(64),q$=/^[0-9a-fA-F]{128}$/,H$=mm(86,"=="),J$=gm(86);var xt=S("$ZodCheck",(r,e)=>{var t;r._zod??(r._zod={}),r._zod.def=e,(t=r._zod).onattach??(t.onattach=[])}),EN={number:"number",bigint:"bigint",object:"date"},Wx=S("$ZodCheckLessThan",(r,e)=>{xt.init(r,e);let t=EN[typeof e.value];r._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),r._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}}),Zx=S("$ZodCheckGreaterThan",(r,e)=>{xt.init(r,e);let t=EN[typeof e.value];r._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),r._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}}),oP=S("$ZodCheckMultipleOf",(r,e)=>{xt.init(r,e),r._zod.onattach.push(t=>{var n;(n=t._zod.bag).multipleOf??(n.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):x_(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})}}),aP=S("$ZodCheckNumberFormat",(r,e)=>{xt.init(r,e),e.format=e.format||"float64";let t=e.format?.includes("int"),n=t?"int":"number",[i,o]=S_[e.format];r._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=i,s.maximum=o,t&&(s.pattern=X_)}),r._zod.check=a=>{let s=a.value;if(t){if(!Number.isInteger(s)){a.issues.push({expected:n,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:n,inclusive:!0,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:n,inclusive:!0,continue:!e.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:r,continue:!e.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:r,continue:!e.abort})}}),sP=S("$ZodCheckBigIntFormat",(r,e)=>{xt.init(r,e);let[t,n]=E_[e.format];r._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,o.minimum=t,o.maximum=n}),r._zod.check=i=>{let o=i.value;o<t&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:t,inclusive:!0,inst:r,continue:!e.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:r,continue:!e.abort})}}),lP=S("$ZodCheckMaxSize",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.size!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),r._zod.check=n=>{let i=n.value;i.size<=e.maximum||n.issues.push({origin:um(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:r,continue:!e.abort})}}),cP=S("$ZodCheckMinSize",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.size!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),r._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:um(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:r,continue:!e.abort})}}),uP=S("$ZodCheckSizeEquals",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.size!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),r._zod.check=n=>{let i=n.value,o=i.size;if(o===e.size)return;let a=o>e.size;n.issues.push({origin:um(i),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:r,continue:!e.abort})}}),dP=S("$ZodCheckMaxLength",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.length!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),r._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let a=dm(i);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:r,continue:!e.abort})}}),pP=S("$ZodCheckMinLength",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.length!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),r._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let a=dm(i);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:r,continue:!e.abort})}}),hP=S("$ZodCheckLengthEquals",(r,e)=>{var t;xt.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!Ds(i)&&i.length!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),r._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let a=dm(i),s=o>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:r,continue:!e.abort})}}),rp=S("$ZodCheckStringFormat",(r,e)=>{var t,n;xt.init(r,e),r._zod.onattach.push(i=>{let o=i._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=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:r,continue:!e.abort})}):(n=r._zod).check??(n.check=()=>{})}),fP=S("$ZodCheckRegex",(r,e)=>{rp.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})}}),mP=S("$ZodCheckLowerCase",(r,e)=>{e.pattern??(e.pattern=iP),rp.init(r,e)}),gP=S("$ZodCheckUpperCase",(r,e)=>{e.pattern??(e.pattern=nP),rp.init(r,e)}),vP=S("$ZodCheckIncludes",(r,e)=>{xt.init(r,e);let t=Sn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=n,r._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),r._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:r,continue:!e.abort})}}),yP=S("$ZodCheckStartsWith",(r,e)=>{xt.init(r,e);let t=new RegExp(`^${Sn(e.prefix)}.*`);e.pattern??(e.pattern=t),r._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),r._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:r,continue:!e.abort})}}),xP=S("$ZodCheckEndsWith",(r,e)=>{xt.init(r,e);let t=new RegExp(`.*${Sn(e.suffix)}$`);e.pattern??(e.pattern=t),r._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),r._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:r,continue:!e.abort})}});function SN(r,e,t){r.issues.length&&e.issues.push(...Li(t,r.issues))}var wP=S("$ZodCheckProperty",(r,e)=>{xt.init(r,e),r._zod.check=t=>{let n=e.schema._zod.run({value:t.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>SN(i,t,e.property));SN(n,t,e.property)}}),bP=S("$ZodCheckMimeType",(r,e)=>{xt.init(r,e);let t=new Set(e.mime);r._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),r._zod.check=n=>{t.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:r,continue:!e.abort})}}),AP=S("$ZodCheckOverwrite",(r,e)=>{xt.init(r,e),r._zod.check=t=>{t.value=e.tx(t.value)}});var vm=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 n=e.split(`
5
5
  `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...t,i.join(`
6
6
  `))}};var _P={major:4,minor:3,patch:6};var De=S("$ZodType",(r,e)=>{var t;r??(r={}),r._zod.def=e,r._zod.bag=r._zod.bag||{},r._zod.version=_P;let n=[...r._zod.def.checks??[]];r._zod.traits.has("$ZodCheck")&&n.unshift(r);for(let i of n)for(let o of i._zod.onattach)o(r);if(n.length===0)(t=r._zod).deferred??(t.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let i=(a,s,l)=>{let u=$s(a),p;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new oo;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,a.issues.length!==h&&(u||(u=$s(a,h)))});else{if(a.issues.length===h)continue;u||(u=$s(a,h))}}return p?p.then(()=>a):a},o=(a,s,l)=>{if($s(a))return a.aborted=!0,a;let u=i(s,n,l);if(u instanceof Promise){if(l.async===!1)throw new oo;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 oo;return l.then(u=>i(u,n,s))}return i(l,n,s)}}je(r,"~standard",()=>({validate:i=>{try{let o=N_(r,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return I_(r,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),gc=S("$ZodString",(r,e)=>{De.init(r,e),r._zod.pattern=[...r?._zod.bag?.patterns??[]].pop()??Q_(r._zod.bag),r._zod.parse=(t,n)=>{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}}),ft=S("$ZodStringFormat",(r,e)=>{rp.init(r,e),gc.init(r,e)}),SP=S("$ZodGUID",(r,e)=>{e.pattern??(e.pattern=O_),ft.init(r,e)}),EP=S("$ZodUUID",(r,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=mc(n))}else e.pattern??(e.pattern=mc());ft.init(r,e)}),FP=S("$ZodEmail",(r,e)=>{e.pattern??(e.pattern=V_),ft.init(r,e)}),BP=S("$ZodURL",(r,e)=>{ft.init(r,e),r._zod.check=t=>{try{let n=t.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:t.value=n;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:r,continue:!e.abort})}}}),NP=S("$ZodEmoji",(r,e)=>{e.pattern??(e.pattern=z_()),ft.init(r,e)}),IP=S("$ZodNanoID",(r,e)=>{e.pattern??(e.pattern=R_),ft.init(r,e)}),DP=S("$ZodCUID",(r,e)=>{e.pattern??(e.pattern=D_),ft.init(r,e)}),MP=S("$ZodCUID2",(r,e)=>{e.pattern??(e.pattern=M_),ft.init(r,e)}),kP=S("$ZodULID",(r,e)=>{e.pattern??(e.pattern=k_),ft.init(r,e)}),$P=S("$ZodXID",(r,e)=>{e.pattern??(e.pattern=$_),ft.init(r,e)}),TP=S("$ZodKSUID",(r,e)=>{e.pattern??(e.pattern=T_),ft.init(r,e)}),RP=S("$ZodISODateTime",(r,e)=>{e.pattern??(e.pattern=J_(e)),ft.init(r,e)}),CP=S("$ZodISODate",(r,e)=>{e.pattern??(e.pattern=q_),ft.init(r,e)}),OP=S("$ZodISOTime",(r,e)=>{e.pattern??(e.pattern=H_(e)),ft.init(r,e)}),VP=S("$ZodISODuration",(r,e)=>{e.pattern??(e.pattern=C_),ft.init(r,e)}),zP=S("$ZodIPv4",(r,e)=>{e.pattern??(e.pattern=U_),ft.init(r,e),r._zod.bag.format="ipv4"}),UP=S("$ZodIPv6",(r,e)=>{e.pattern??(e.pattern=j_),ft.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})}}}),jP=S("$ZodMAC",(r,e)=>{e.pattern??(e.pattern=L_(e.delimiter)),ft.init(r,e),r._zod.bag.format="mac"}),LP=S("$ZodCIDRv4",(r,e)=>{e.pattern??(e.pattern=K_),ft.init(r,e)}),KP=S("$ZodCIDRv6",(r,e)=>{e.pattern??(e.pattern=W_),ft.init(r,e),r._zod.check=t=>{let n=t.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;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://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:r,continue:!e.abort})}}});function WP(r){if(r==="")return!0;if(r.length%4!==0)return!1;try{return atob(r),!0}catch{return!1}}var ZP=S("$ZodBase64",(r,e)=>{e.pattern??(e.pattern=Z_),ft.init(r,e),r._zod.bag.contentEncoding="base64",r._zod.check=t=>{WP(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:r,continue:!e.abort})}});function VN(r){if(!Lx.test(r))return!1;let e=r.replace(/[-_]/g,n=>n==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return WP(t)}var GP=S("$ZodBase64URL",(r,e)=>{e.pattern??(e.pattern=Lx),ft.init(r,e),r._zod.bag.contentEncoding="base64url",r._zod.check=t=>{VN(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:r,continue:!e.abort})}}),qP=S("$ZodE164",(r,e)=>{e.pattern??(e.pattern=G_),ft.init(r,e)});function zN(r,e=null){try{let t=r.split(".");if(t.length!==3)return!1;let[n]=t;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var HP=S("$ZodJWT",(r,e)=>{ft.init(r,e),r._zod.check=t=>{zN(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:r,continue:!e.abort})}}),JP=S("$ZodCustomStringFormat",(r,e)=>{ft.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})}}),Yx=S("$ZodNumber",(r,e)=>{De.init(r,e),r._zod.pattern=r._zod.bag.pattern??Kx,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}let i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:r,...o?{received:o}:{}}),t}}),QP=S("$ZodNumberFormat",(r,e)=>{aP.init(r,e),Yx.init(r,e)}),ym=S("$ZodBoolean",(r,e)=>{De.init(r,e),r._zod.pattern=eP,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=!!t.value}catch{}let i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:r}),t}}),Xx=S("$ZodBigInt",(r,e)=>{De.init(r,e),r._zod.pattern=Y_,r._zod.parse=(t,n)=>{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}}),YP=S("$ZodBigIntFormat",(r,e)=>{sP.init(r,e),Xx.init(r,e)}),XP=S("$ZodSymbol",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;return typeof i=="symbol"||t.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:r}),t}}),e1=S("$ZodUndefined",(r,e)=>{De.init(r,e),r._zod.pattern=rP,r._zod.values=new Set([void 0]),r._zod.optin="optional",r._zod.optout="optional",r._zod.parse=(t,n)=>{let i=t.value;return typeof i>"u"||t.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:r}),t}}),t1=S("$ZodNull",(r,e)=>{De.init(r,e),r._zod.pattern=tP,r._zod.values=new Set([null]),r._zod.parse=(t,n)=>{let i=t.value;return i===null||t.issues.push({expected:"null",code:"invalid_type",input:i,inst:r}),t}}),r1=S("$ZodAny",(r,e)=>{De.init(r,e),r._zod.parse=t=>t}),i1=S("$ZodUnknown",(r,e)=>{De.init(r,e),r._zod.parse=t=>t}),n1=S("$ZodNever",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:r}),t)}),o1=S("$ZodVoid",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;return typeof i>"u"||t.issues.push({expected:"void",code:"invalid_type",input:i,inst:r}),t}}),a1=S("$ZodDate",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=new Date(t.value)}catch{}let i=t.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:r}),t}});function BN(r,e,t){r.issues.length&&e.issues.push(...Li(t,r.issues)),e.value[t]=r.value}var s1=S("$ZodArray",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:r}),t;t.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],l=e.element._zod.run({value:s,issues:[]},n);l instanceof Promise?o.push(l.then(u=>BN(u,t,a))):BN(l,t,a)}return o.length?Promise.all(o).then(()=>t):t}});function Qx(r,e,t,n,i){if(r.issues.length){if(i&&!(t in n))return;e.issues.push(...Li(t,r.issues))}r.value===void 0?t in n&&(e.value[t]=void 0):e.value[t]=r.value}function UN(r){let e=Object.keys(r.shape);for(let n of e)if(!r.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let t=P_(r.shape);return{...r,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function jN(r,e,t,n,i,o){let a=[],s=i.keySet,l=i.catchall._zod,u=l.def.type,p=l.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let h=l.run({value:e[d],issues:[]},n);h instanceof Promise?r.push(h.then(g=>Qx(g,t,d,e,p))):Qx(h,t,d,e,p)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),r.length?Promise.all(r).then(()=>t):t}var LN=S("$ZodObject",(r,e)=>{if(De.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 n=Jd(()=>UN(e));je(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 i=fc,o=e.catchall,a;r._zod.parse=(s,l)=>{a??(a=n.value);let u=s.value;if(!i(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:r}),s;s.value={};let p=[],d=a.shape;for(let h of a.keys){let g=d[h],v=g._zod.optout==="optional",y=g._zod.run({value:u[h],issues:[]},l);y instanceof Promise?p.push(y.then(x=>Qx(x,s,h,u,v))):Qx(y,s,h,u,v)}return o?jN(p,u,s,l,n.value,r):p.length?Promise.all(p).then(()=>s):s}}),l1=S("$ZodObjectJIT",(r,e)=>{LN.init(r,e);let t=r._zod.parse,n=Jd(()=>UN(e)),i=h=>{let g=new vm(["shape","payload","ctx"]),v=n.value,y=O=>{let z=Dx(O);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};g.write("const input = payload.value;");let x=Object.create(null),B=0;for(let O of v.keys)x[O]=`key_${B++}`;g.write("const newResult = {};");for(let O of v.keys){let z=x[O],$=Dx(O),ne=h[O]?._zod?.optout==="optional";g.write(`const ${z} = ${y(O)};`),ne?g.write(`
@@ -39,8 +39,8 @@ var vk=Object.defineProperty;var Xo=(r,e)=>{for(var t in e)vk(r,t,{get:e[t],enum
39
39
 
40
40
  `)}g.write("payload.value = newResult;"),g.write("return payload;");let I=g.compile();return(O,z)=>I(h,O,z)},o,a=fc,s=!om.jitless,u=s&&b_.value,p=e.catchall,d;r._zod.parse=(h,g)=>{d??(d=n.value);let v=h.value;return a(v)?s&&u&&g?.async===!1&&g.jitless!==!0?(o||(o=i(e.shape)),h=o(h,g),p?jN([],v,h,g,d,r):h):t(h,g):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:r}),h)}});function NN(r,e,t,n){for(let o of r)if(o.issues.length===0)return e.value=o.value,e;let i=r.filter(o=>!$s(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:r.map(o=>o.issues.map(a=>xi(a,n,Kt())))}),e)}var xm=S("$ZodUnion",(r,e)=>{De.init(r,e),je(r._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),je(r._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),je(r._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),je(r._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>lm(o.source)).join("|")})$`)}});let t=e.options.length===1,n=e.options[0]._zod.run;r._zod.parse=(i,o)=>{if(t)return n(i,o);let a=!1,s=[];for(let l of e.options){let u=l._zod.run({value:i.value,issues:[]},o);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(l=>NN(l,i,r,o)):NN(s,i,r,o)}});function IN(r,e,t,n){let i=r.filter(o=>o.issues.length===0);return i.length===1?(e.value=i[0].value,e):(i.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:r.map(o=>o.issues.map(a=>xi(a,n,Kt())))}):e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:[],inclusive:!1}),e)}var c1=S("$ZodXor",(r,e)=>{xm.init(r,e),e.inclusive=!1;let t=e.options.length===1,n=e.options[0]._zod.run;r._zod.parse=(i,o)=>{if(t)return n(i,o);let a=!1,s=[];for(let l of e.options){let u=l._zod.run({value:i.value,issues:[]},o);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(l=>IN(l,i,r,o)):IN(s,i,r,o)}}),u1=S("$ZodDiscriminatedUnion",(r,e)=>{e.inclusive=!1,xm.init(r,e);let t=r._zod.parse;je(r._zod,"propValues",()=>{let i={};for(let o of e.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[s,l]of Object.entries(a)){i[s]||(i[s]=new Set);for(let u of l)i[s].add(u)}}return i});let n=Jd(()=>{let i=e.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let l of s){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});r._zod.parse=(i,o)=>{let a=i.value;if(!fc(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:r}),i;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(i,o):e.unionFallback?t(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:r}),i)}}),d1=S("$ZodIntersection",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value,o=e.left._zod.run({value:i,issues:[]},n),a=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,u])=>DN(t,l,u)):DN(t,o,a)}});function PP(r,e){if(r===e)return{valid:!0,data:r};if(r instanceof Date&&e instanceof Date&&+r==+e)return{valid:!0,data:r};if(ks(r)&&ks(e)){let t=Object.keys(e),n=Object.keys(r).filter(o=>t.indexOf(o)!==-1),i={...r,...e};for(let o of n){let a=PP(r[o],e[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return{valid:!1,mergeErrorPath:[]};let t=[];for(let n=0;n<r.length;n++){let i=r[n],o=e[n],a=PP(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};t.push(a.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function DN(r,e,t){let n=new Map,i;for(let s of e.issues)if(s.code==="unrecognized_keys"){i??(i=s);for(let l of s.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else r.issues.push(s);for(let s of t.issues)if(s.code==="unrecognized_keys")for(let l of s.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else r.issues.push(s);let o=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&i&&r.issues.push({...i,keys:o}),$s(r))return r;let a=PP(e.value,t.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return r.value=a.data,r}var ew=S("$ZodTuple",(r,e)=>{De.init(r,e);let t=e.items;r._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:r,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...t].reverse().findIndex(p=>p._zod.optin!=="optional"),l=s===-1?0:t.length-s;if(!e.rest){let p=o.length>t.length,d=o.length<l-1;if(p||d)return n.issues.push({...p?{code:"too_big",maximum:t.length,inclusive:!0}:{code:"too_small",minimum:t.length},input:o,inst:r,origin:"array"}),n}let u=-1;for(let p of t){if(u++,u>=o.length&&u>=l)continue;let d=p._zod.run({value:o[u],issues:[]},i);d instanceof Promise?a.push(d.then(h=>Gx(h,n,u))):Gx(d,n,u)}if(e.rest){let p=o.slice(t.length);for(let d of p){u++;let h=e.rest._zod.run({value:d,issues:[]},i);h instanceof Promise?a.push(h.then(g=>Gx(g,n,u))):Gx(h,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Gx(r,e,t){r.issues.length&&e.issues.push(...Li(t,r.issues)),e.value[t]=r.value}var p1=S("$ZodRecord",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!ks(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:r}),t;let o=[],a=e.keyType._zod.values;if(a){t.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let p=e.valueType._zod.run({value:i[u],issues:[]},n);p instanceof Promise?o.push(p.then(d=>{d.issues.length&&t.issues.push(...Li(u,d.issues)),t.value[u]=d.value})):(p.issues.length&&t.issues.push(...Li(u,p.issues)),t.value[u]=p.value)}let l;for(let u in i)s.has(u)||(l=l??[],l.push(u));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:r,keys:l})}else{t.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let l=e.keyType._zod.run({value:s,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Kx.test(s)&&l.issues.length){let d=e.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){e.mode==="loose"?t.value[s]=i[s]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>xi(d,n,Kt())),input:s,path:[s],inst:r});continue}let p=e.valueType._zod.run({value:i[s],issues:[]},n);p instanceof Promise?o.push(p.then(d=>{d.issues.length&&t.issues.push(...Li(s,d.issues)),t.value[l.value]=d.value})):(p.issues.length&&t.issues.push(...Li(s,p.issues)),t.value[l.value]=p.value)}}return o.length?Promise.all(o).then(()=>t):t}}),h1=S("$ZodMap",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!(i instanceof Map))return t.issues.push({expected:"map",code:"invalid_type",input:i,inst:r}),t;let o=[];t.value=new Map;for(let[a,s]of i){let l=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);l instanceof Promise||u instanceof Promise?o.push(Promise.all([l,u]).then(([p,d])=>{MN(p,d,t,a,i,r,n)})):MN(l,u,t,a,i,r,n)}return o.length?Promise.all(o).then(()=>t):t}});function MN(r,e,t,n,i,o,a){r.issues.length&&(cm.has(typeof n)?t.issues.push(...Li(n,r.issues)):t.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:r.issues.map(s=>xi(s,a,Kt()))})),e.issues.length&&(cm.has(typeof n)?t.issues.push(...Li(n,e.issues)):t.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:e.issues.map(s=>xi(s,a,Kt()))})),t.value.set(r.value,e.value)}var f1=S("$ZodSet",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!(i instanceof Set))return t.issues.push({input:i,inst:r,expected:"set",code:"invalid_type"}),t;let o=[];t.value=new Set;for(let a of i){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(l=>kN(l,t))):kN(s,t)}return o.length?Promise.all(o).then(()=>t):t}});function kN(r,e){r.issues.length&&e.issues.push(...r.issues),e.value.add(r.value)}var m1=S("$ZodEnum",(r,e)=>{De.init(r,e);let t=sm(e.entries),n=new Set(t);r._zod.values=n,r._zod.pattern=new RegExp(`^(${t.filter(i=>cm.has(typeof i)).map(i=>typeof i=="string"?Sn(i):i.toString()).join("|")})$`),r._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:t,input:a,inst:r}),i}}),g1=S("$ZodLiteral",(r,e)=>{if(De.init(r,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let t=new Set(e.values);r._zod.values=t,r._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Sn(n):n?Sn(n.toString()):String(n)).join("|")})$`),r._zod.parse=(n,i)=>{let o=n.value;return t.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:r}),n}}),v1=S("$ZodFile",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;return i instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:i,inst:r}),t}}),y1=S("$ZodTransform",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new Is(r.constructor.name);let i=e.transform(t.value,t);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(t.value=a,t));if(i instanceof Promise)throw new oo;return t.value=i,t}});function $N(r,e){return r.issues.length&&e===void 0?{issues:[],value:void 0}:r}var tw=S("$ZodOptional",(r,e)=>{De.init(r,e),r._zod.optin="optional",r._zod.optout="optional",je(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),je(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${lm(t.source)})?$`):void 0}),r._zod.parse=(t,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>$N(o,t.value)):$N(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,n)}}),x1=S("$ZodExactOptional",(r,e)=>{tw.init(r,e),je(r._zod,"values",()=>e.innerType._zod.values),je(r._zod,"pattern",()=>e.innerType._zod.pattern),r._zod.parse=(t,n)=>e.innerType._zod.run(t,n)}),w1=S("$ZodNullable",(r,e)=>{De.init(r,e),je(r._zod,"optin",()=>e.innerType._zod.optin),je(r._zod,"optout",()=>e.innerType._zod.optout),je(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${lm(t.source)}|null)$`):void 0}),je(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),r._zod.parse=(t,n)=>t.value===null?t:e.innerType._zod.run(t,n)}),b1=S("$ZodDefault",(r,e)=>{De.init(r,e),r._zod.optin="optional",je(r._zod,"values",()=>e.innerType._zod.values),r._zod.parse=(t,n)=>{if(n.direction==="backward")return e.innerType._zod.run(t,n);if(t.value===void 0)return t.value=e.defaultValue,t;let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>TN(o,e)):TN(i,e)}});function TN(r,e){return r.value===void 0&&(r.value=e.defaultValue),r}var A1=S("$ZodPrefault",(r,e)=>{De.init(r,e),r._zod.optin="optional",je(r._zod,"values",()=>e.innerType._zod.values),r._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,n))}),_1=S("$ZodNonOptional",(r,e)=>{De.init(r,e),je(r._zod,"values",()=>{let t=e.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),r._zod.parse=(t,n)=>{let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>RN(o,r)):RN(i,r)}});function RN(r,e){return!r.issues.length&&r.value===void 0&&r.issues.push({code:"invalid_type",expected:"nonoptional",input:r.value,inst:e}),r}var P1=S("$ZodSuccess",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new Is("ZodSuccess");let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>(t.value=o.issues.length===0,t)):(t.value=i.issues.length===0,t)}}),S1=S("$ZodCatch",(r,e)=>{De.init(r,e),je(r._zod,"optin",()=>e.innerType._zod.optin),je(r._zod,"optout",()=>e.innerType._zod.optout),je(r._zod,"values",()=>e.innerType._zod.values),r._zod.parse=(t,n)=>{if(n.direction==="backward")return e.innerType._zod.run(t,n);let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>(t.value=o.value,o.issues.length&&(t.value=e.catchValue({...t,error:{issues:o.issues.map(a=>xi(a,n,Kt()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(o=>xi(o,n,Kt()))},input:t.value}),t.issues=[]),t)}}),E1=S("$ZodNaN",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>((typeof t.value!="number"||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:r,expected:"nan",code:"invalid_type"}),t)}),F1=S("$ZodPipe",(r,e)=>{De.init(r,e),je(r._zod,"values",()=>e.in._zod.values),je(r._zod,"optin",()=>e.in._zod.optin),je(r._zod,"optout",()=>e.out._zod.optout),je(r._zod,"propValues",()=>e.in._zod.propValues),r._zod.parse=(t,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(t,n);return o instanceof Promise?o.then(a=>qx(a,e.in,n)):qx(o,e.in,n)}let i=e.in._zod.run(t,n);return i instanceof Promise?i.then(o=>qx(o,e.out,n)):qx(i,e.out,n)}});function qx(r,e,t){return r.issues.length?(r.aborted=!0,r):e._zod.run({value:r.value,issues:r.issues},t)}var wm=S("$ZodCodec",(r,e)=>{De.init(r,e),je(r._zod,"values",()=>e.in._zod.values),je(r._zod,"optin",()=>e.in._zod.optin),je(r._zod,"optout",()=>e.out._zod.optout),je(r._zod,"propValues",()=>e.in._zod.propValues),r._zod.parse=(t,n)=>{if((n.direction||"forward")==="forward"){let o=e.in._zod.run(t,n);return o instanceof Promise?o.then(a=>Hx(a,e,n)):Hx(o,e,n)}else{let o=e.out._zod.run(t,n);return o instanceof Promise?o.then(a=>Hx(a,e,n)):Hx(o,e,n)}}});function Hx(r,e,t){if(r.issues.length)return r.aborted=!0,r;if((t.direction||"forward")==="forward"){let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>Jx(r,o,e.out,t)):Jx(r,i,e.out,t)}else{let i=e.reverseTransform(r.value,r);return i instanceof Promise?i.then(o=>Jx(r,o,e.in,t)):Jx(r,i,e.in,t)}}function Jx(r,e,t,n){return r.issues.length?(r.aborted=!0,r):t._zod.run({value:e,issues:r.issues},n)}var B1=S("$ZodReadonly",(r,e)=>{De.init(r,e),je(r._zod,"propValues",()=>e.innerType._zod.propValues),je(r._zod,"values",()=>e.innerType._zod.values),je(r._zod,"optin",()=>e.innerType?._zod?.optin),je(r._zod,"optout",()=>e.innerType?._zod?.optout),r._zod.parse=(t,n)=>{if(n.direction==="backward")return e.innerType._zod.run(t,n);let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(CN):CN(i)}});function CN(r){return r.value=Object.freeze(r.value),r}var N1=S("$ZodTemplateLiteral",(r,e)=>{De.init(r,e);let t=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;t.push(i.slice(o,a))}else if(n===null||__.has(typeof n))t.push(Sn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);r._zod.pattern=new RegExp(`^${t.join("")}$`),r._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:r,expected:"string",code:"invalid_type"}),n):(r._zod.pattern.lastIndex=0,r._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:r,code:"invalid_format",format:e.format??"template_literal",pattern:r._zod.pattern.source}),n)}),I1=S("$ZodFunction",(r,e)=>(De.init(r,e),r._def=e,r._zod.def=e,r.implement=t=>{if(typeof t!="function")throw new Error("implement() must be called with a function");return function(...n){let i=r._def.input?kx(r._def.input,n):n,o=Reflect.apply(t,this,i);return r._def.output?kx(r._def.output,o):o}},r.implementAsync=t=>{if(typeof t!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=r._def.input?await $x(r._def.input,n):n,o=await Reflect.apply(t,this,i);return r._def.output?await $x(r._def.output,o):o}},r._zod.parse=(t,n)=>typeof t.value!="function"?(t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:r}),t):(r._def.output&&r._def.output._zod.def.type==="promise"?t.value=r.implementAsync(t.value):t.value=r.implement(t.value),t),r.input=(...t)=>{let n=r.constructor;return Array.isArray(t[0])?new n({type:"function",input:new ew({type:"tuple",items:t[0],rest:t[1]}),output:r._def.output}):new n({type:"function",input:t[0],output:r._def.output})},r.output=t=>{let n=r.constructor;return new n({type:"function",input:r._def.input,output:t})},r)),D1=S("$ZodPromise",(r,e)=>{De.init(r,e),r._zod.parse=(t,n)=>Promise.resolve(t.value).then(i=>e.innerType._zod.run({value:i,issues:[]},n))}),M1=S("$ZodLazy",(r,e)=>{De.init(r,e),je(r._zod,"innerType",()=>e.getter()),je(r._zod,"pattern",()=>r._zod.innerType?._zod?.pattern),je(r._zod,"propValues",()=>r._zod.innerType?._zod?.propValues),je(r._zod,"optin",()=>r._zod.innerType?._zod?.optin??void 0),je(r._zod,"optout",()=>r._zod.innerType?._zod?.optout??void 0),r._zod.parse=(t,n)=>r._zod.innerType._zod.run(t,n)}),k1=S("$ZodCustom",(r,e)=>{xt.init(r,e),De.init(r,e),r._zod.parse=(t,n)=>t,r._zod.check=t=>{let n=t.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>ON(o,t,n,r));ON(i,t,n,r)}});function ON(r,e,t,n){if(!r){let i={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Qd(i))}}var Am={};Xo(Am,{ar:()=>KN,az:()=>WN,be:()=>GN,bg:()=>qN,ca:()=>HN,cs:()=>JN,da:()=>QN,de:()=>YN,en:()=>rw,eo:()=>XN,es:()=>eI,fa:()=>tI,fi:()=>rI,fr:()=>iI,frCA:()=>nI,he:()=>oI,hu:()=>aI,hy:()=>lI,id:()=>cI,is:()=>uI,it:()=>dI,ja:()=>pI,ka:()=>hI,kh:()=>fI,km:()=>iw,ko:()=>mI,lt:()=>vI,mk:()=>yI,ms:()=>xI,nl:()=>wI,no:()=>bI,ota:()=>AI,pl:()=>PI,ps:()=>_I,pt:()=>SI,ru:()=>FI,sl:()=>BI,sv:()=>NI,ta:()=>II,th:()=>DI,tr:()=>MI,ua:()=>kI,uk:()=>nw,ur:()=>$I,uz:()=>TI,vi:()=>RI,yo:()=>VI,zhCN:()=>CI,zhTW:()=>OI});var Y$=()=>{let r={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(i){return r[i]??null}let t={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${i.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`}case"invalid_value":return i.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${K(i.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${i.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${i.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${i.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${t[o.format]??i.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${i.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${i.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${i.keys.length>1?"\u0629":""}: ${T(i.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function KN(){return{localeError:Y$()}}var X$=()=>{let r={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(i){return r[i]??null}let t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${i.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${s}`}case"invalid_value":return i.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${K(i.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${o}${i.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${o}${i.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${t[o.format]??i.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${i.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${i.keys.length>1?"lar":""}: ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${i.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function WN(){return{localeError:X$()}}function ZN(r,e,t,n){let i=Math.abs(r),o=i%10,a=i%100;return a>=11&&a<=19?n:o===1?e:o>=2&&o<=4?t:n}var eT=()=>{let r={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(i){return r[i]??null}let t={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},n={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${i.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${K(i.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);if(a){let s=Number(i.maximum),l=ZN(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${i.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);if(a){let s=Number(i.minimum),l=ZN(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${i.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${t[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${i.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${T(i.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${i.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function GN(){return{localeError:eT()}}var tT=()=>{let r={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(i){return r[i]??null}let t={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${K(i.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${i.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${i.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${t[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${i.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u043E\u0432\u0435":""}: ${T(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function qN(){return{localeError:tT()}}var rT=()=>{let r={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(i){return r[i]??null}let t={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${i.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${s}`}case"invalid_value":return i.values.length===1?`Valor inv\xE0lid: s'esperava ${K(i.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${T(i.values," o ")}`;case"too_big":{let o=i.inclusive?"com a m\xE0xim":"menys de",a=e(i.origin);return a?`Massa gran: s'esperava que ${i.origin??"el valor"} contingu\xE9s ${o} ${i.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"com a m\xEDnim":"m\xE9s de",a=e(i.origin);return a?`Massa petit: s'esperava que ${i.origin} contingu\xE9s ${o} ${i.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${t[o.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${i.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${i.origin}`;default:return"Entrada inv\xE0lida"}}};function HN(){return{localeError:rT()}}var iT=()=>{let r={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(i){return r[i]??null}let t={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},n={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${i.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${s}`}case"invalid_value":return i.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${K(i.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${o}${i.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${o}${i.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${t[o.format]??i.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${i.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${T(i.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${i.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${i.origin}`;default:return"Neplatn\xFD vstup"}}};function JN(){return{localeError:iT()}}var nT=()=>{let r={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function e(i){return r[i]??null}let t={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ugyldigt input: forventede instanceof ${i.expected}, fik ${s}`:`Ugyldigt input: forventede ${o}, fik ${s}`}case"invalid_value":return i.values.length===1?`Ugyldig v\xE6rdi: forventede ${K(i.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin),s=n[i.origin]??i.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${o} ${i.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin),s=n[i.origin]??i.origin;return a?`For lille: forventede ${s} ${a.verb} ${o} ${i.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${t[o.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${T(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${i.origin}`;default:return"Ugyldigt input"}}};function QN(){return{localeError:nT()}}var oT=()=>{let r={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(i){return r[i]??null}let t={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},n={nan:"NaN",number:"Zahl",array:"Array"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${i.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${s}`}case"invalid_value":return i.values.length===1?`Ung\xFCltige Eingabe: erwartet ${K(i.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ist`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ist`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${t[o.format]??i.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${T(i.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${i.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${i.origin}`;default:return"Ung\xFCltige Eingabe"}}};function YN(){return{localeError:oT()}}var aT=()=>{let r={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(i){return r[i]??null}let t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${K(i.values[0])}`:`Invalid option: expected one of ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${t[o.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function rw(){return{localeError:aT()}}var sT=()=>{let r={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(i){return r[i]??null}let t={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},n={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${i.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${s}`}case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${K(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${o}${i.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${o}${i.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${t[o.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};function XN(){return{localeError:sT()}}var lT=()=>{let r={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(i){return r[i]??null}let t={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${i.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${s}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: se esperaba ${K(i.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin),s=n[i.origin]??i.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${o}${i.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin),s=n[i.origin]??i.origin;return a?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${o}${i.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} fuera ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${t[o.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n[i.origin]??i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n[i.origin]??i.origin}`;default:return"Entrada inv\xE1lida"}}};function eI(){return{localeError:lT()}}var cT=()=>{let r={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(i){return r[i]??null}let t={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${i.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return i.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${K(i.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${T(i.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${t[o.format]??i.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${i.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${i.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${T(i.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${i.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${i.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function tI(){return{localeError:cT()}}var uT=()=>{let r={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(i){return r[i]??null}let t={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Virheellinen tyyppi: odotettiin instanceof ${i.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${s}`}case"invalid_value":return i.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${K(i.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${o}${i.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${o}${i.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${t[o.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${T(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function rI(){return{localeError:uT()}}var dT=()=>{let r={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return r[i]??null}let t={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={nan:"NaN",number:"nombre",array:"tableau"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : instanceof ${i.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${s} re\xE7u`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : ${K(i.values[0])} attendu`:`Option invalide : une valeur parmi ${T(i.values,"|")} attendue`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Trop grand : ${i.origin??"valeur"} doit ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i.origin??"valeur"} doit \xEAtre ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Trop petit : ${i.origin} doit ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Trop petit : ${i.origin} doit \xEAtre ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${t[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${T(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}};function iI(){return{localeError:dT()}}var pT=()=>{let r={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return r[i]??null}let t={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : attendu instanceof ${i.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${s}`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : attendu ${K(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"\u2264":"<",a=e(i.origin);return a?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${o}${i.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"\u2265":">",a=e(i.origin);return a?`Trop petit : attendu que ${i.origin} ait ${o}${i.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${i.origin} soit ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${t[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${T(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}};function nI(){return{localeError:pT()}}var hT=()=>{let r={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},t=u=>u?r[u]:void 0,n=u=>{let p=t(u);return p?p.label:u??r.unknown.label},i=u=>`\u05D4${n(u)}`,o=u=>(t(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",a=u=>u?e[u]??null:null,s={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let p=u.expected,d=l[p??""]??n(p),h=Z(u.input),g=l[h]??r[h]?.label??h;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${g}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${g}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${K(u.values[0])}`;let p=u.values.map(g=>K(g));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${p[0]} \u05D0\u05D5 ${p[1]}`;let d=p[p.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${p.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let p=a(u.origin),d=i(u.origin??"value");if(u.origin==="string")return`${p?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${p?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let v=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${v}`}if(u.origin==="array"||u.origin==="set"){let v=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",y=u.inclusive?`${u.maximum} ${p?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${p?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let h=u.inclusive?"<=":"<",g=o(u.origin??"value");return p?.unit?`${p.longLabel} \u05DE\u05D3\u05D9: ${d} ${g} ${h}${u.maximum.toString()} ${p.unit}`:`${p?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${g} ${h}${u.maximum.toString()}`}case"too_small":{let p=a(u.origin),d=i(u.origin??"value");if(u.origin==="string")return`${p?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${p?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let v=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${v}`}if(u.origin==="array"||u.origin==="set"){let v=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let x=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${x}`}let y=u.inclusive?`${u.minimum} ${p?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${p?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${v} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let h=u.inclusive?">=":">",g=o(u.origin??"value");return p?.unit?`${p.shortLabel} \u05DE\u05D3\u05D9: ${d} ${g} ${h}${u.minimum.toString()} ${p.unit}`:`${p?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${g} ${h}${u.minimum.toString()}`}case"invalid_format":{let p=u;if(p.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${p.prefix}"`;if(p.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${p.suffix}"`;if(p.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${p.includes}"`;if(p.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${p.pattern}`;let d=s[p.format],h=d?.label??p.format,v=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${h} \u05DC\u05D0 ${v}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${T(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${i(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function oI(){return{localeError:hT()}}var fT=()=>{let r={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(i){return r[i]??null}let t={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},n={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${i.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return i.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${K(i.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`T\xFAl nagy: ${i.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${i.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${i.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} m\xE9rete t\xFAl kicsi ${o}${i.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} t\xFAl kicsi ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${t[o.format]??i.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${i.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${i.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${i.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function aI(){return{localeError:fT()}}function sI(r,e,t){return Math.abs(r)===1?e:t}function ip(r){if(!r)return"";let e=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],t=r[r.length-1];return r+(e.includes(t)?"\u0576":"\u0568")}var mT=()=>{let r={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function e(i){return r[i]??null}let t={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},n={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${i.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`}case"invalid_value":return i.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${K(i.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);if(a){let s=Number(i.maximum),l=sI(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ip(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${i.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ip(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);if(a){let s=Number(i.minimum),l=sI(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ip(i.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${i.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ip(i.origin)} \u056C\u056B\u0576\u056B ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${t[o.format]??i.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${i.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${i.keys.length>1?"\u0576\u0565\u0580":""}. ${T(i.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${ip(i.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${ip(i.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function lI(){return{localeError:mT()}}var gT=()=>{let r={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(i){return r[i]??null}let t={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Input tidak valid: diharapkan instanceof ${i.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${o}, diterima ${s}`}case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${K(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${o}${i.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Terlalu kecil: diharapkan ${i.origin} memiliki ${o}${i.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${t[o.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}};function cI(){return{localeError:gT()}}var vT=()=>{let r={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(i){return r[i]??null}let t={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},n={nan:"NaN",number:"n\xFAmer",array:"fylki"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${i.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return i.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${K(i.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} hafi ${o}${i.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} s\xE9 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} hafi ${o}${i.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} s\xE9 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${t[o.format]??i.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${T(i.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${i.origin}`;default:return"Rangt gildi"}}};function uI(){return{localeError:vT()}}var yT=()=>{let r={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(i){return r[i]??null}let t={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"numero",array:"vettore"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Input non valido: atteso instanceof ${i.expected}, ricevuto ${s}`:`Input non valido: atteso ${o}, ricevuto ${s}`}case"invalid_value":return i.values.length===1?`Input non valido: atteso ${K(i.values[0])}`:`Opzione non valida: atteso uno tra ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Troppo grande: ${i.origin??"valore"} deve avere ${o}${i.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Troppo piccolo: ${i.origin} deve avere ${o}${i.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${i.origin} deve essere ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${t[o.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${T(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}};function dI(){return{localeError:yT()}}var xT=()=>{let r={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(i){return r[i]??null}let t={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},n={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${i.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return i.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${K(i.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${T(i.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=i.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=e(i.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${a.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=i.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=e(i.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${a.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${t[o.format]??i.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${i.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${i.keys.length>1?"\u7FA4":""}: ${T(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function pI(){return{localeError:xT()}}var wT=()=>{let r={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(i){return r[i]??null}let t={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},n={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${i.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`}case"invalid_value":return i.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${K(i.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${T(i.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${i.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${i.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${T(i.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${i.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${i.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function hI(){return{localeError:wT()}}var bT=()=>{let r={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(i){return r[i]??null}let t={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},n={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${i.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`}case"invalid_value":return i.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${K(i.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${i.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${o} ${i.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${i.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${T(i.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function iw(){return{localeError:bT()}}function fI(){return iw()}var AT=()=>{let r={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(i){return r[i]??null}let t={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${i.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return i.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${K(i.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${T(i.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=i.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(i.origin),l=s?.unit??"\uC694\uC18C";return s?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()}${l} ${o}${a}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()} ${o}${a}`}case"too_small":{let o=i.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(i.origin),l=s?.unit??"\uC694\uC18C";return s?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()}${l} ${o}${a}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()} ${o}${a}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${t[o.format]??i.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${i.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${T(i.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${i.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${i.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function mI(){return{localeError:AT()}}var bm=r=>r.charAt(0).toUpperCase()+r.slice(1);function gI(r){let e=Math.abs(r),t=e%10,n=e%100;return n>=11&&n<=19||t===0?"many":t===1?"one":"few"}var _T=()=>{let r={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(i,o,a,s){let l=r[i]??null;return l===null?l:{unit:l.unit[o],verb:l.verb[s][a?"inclusive":"notInclusive"]}}let t={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},n={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${i.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${o}`}case"invalid_value":return i.values.length===1?`Privalo b\u016Bti ${K(i.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${T(i.values,"|")} pasirinkim\u0173`;case"too_big":{let o=n[i.origin]??i.origin,a=e(i.origin,gI(Number(i.maximum)),i.inclusive??!1,"smaller");if(a?.verb)return`${bm(o??i.origin??"reik\u0161m\u0117")} ${a.verb} ${i.maximum.toString()} ${a.unit??"element\u0173"}`;let s=i.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${bm(o??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${i.maximum.toString()} ${a?.unit}`}case"too_small":{let o=n[i.origin]??i.origin,a=e(i.origin,gI(Number(i.minimum)),i.inclusive??!1,"bigger");if(a?.verb)return`${bm(o??i.origin??"reik\u0161m\u0117")} ${a.verb} ${i.minimum.toString()} ${a.unit??"element\u0173"}`;let s=i.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${bm(o??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${i.minimum.toString()} ${a?.unit}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${t[o.format]??i.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${T(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=n[i.origin]??i.origin;return`${bm(o??i.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function vI(){return{localeError:_T()}}var PT=()=>{let r={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(i){return r[i]??null}let t={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},n={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${i.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${K(i.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${i.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${i.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${t[o.format]??i.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${T(i.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${i.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${i.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function yI(){return{localeError:PT()}}var ST=()=>{let r={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(i){return r[i]??null}let t={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"nombor"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Input tidak sah: dijangka instanceof ${i.expected}, diterima ${s}`:`Input tidak sah: dijangka ${o}, diterima ${s}`}case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${K(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Terlalu besar: dijangka ${i.origin??"nilai"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Terlalu kecil: dijangka ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${t[o.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${T(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}};function xI(){return{localeError:ST()}}var ET=()=>{let r={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function e(i){return r[i]??null}let t={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},n={nan:"NaN",number:"getal"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ongeldige invoer: verwacht instanceof ${i.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${o}, ontving ${s}`}case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${K(i.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin),s=i.origin==="date"?"laat":i.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${i.origin??"waarde"} ${o}${i.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${i.origin??"waarde"} ${o}${i.maximum.toString()} is`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin),s=i.origin==="date"?"vroeg":i.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${i.origin} ${o}${i.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${i.origin} ${o}${i.minimum.toString()} is`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${t[o.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}};function wI(){return{localeError:ET()}}var FT=()=>{let r={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(i){return r[i]??null}let t={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"tall",array:"liste"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ugyldig input: forventet instanceof ${i.expected}, fikk ${s}`:`Ugyldig input: forventet ${o}, fikk ${s}`}case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${K(i.values[0])}`:`Ugyldig valg: forventet en av ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${o}${i.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`For lite(n): forventet ${i.origin} til \xE5 ha ${o}${i.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${i.origin} til \xE5 ha ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${t[o.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${T(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}};function bI(){return{localeError:FT()}}var BT=()=>{let r={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(i){return r[i]??null}let t={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},n={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`F\xE2sit giren: umulan instanceof ${i.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${s}`}case"invalid_value":return i.values.length===1?`F\xE2sit giren: umulan ${K(i.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${o}${i.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${o}${i.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${o}${i.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${o}${i.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=i;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${t[o.format]??i.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${i.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${i.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function AI(){return{localeError:BT()}}var NT=()=>{let r={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(i){return r[i]??null}let t={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${i.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return i.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${K(i.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${T(i.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} \u0648\u064A`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${t[o.format]??i.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${i.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${i.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${T(i.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${i.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${i.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function _I(){return{localeError:NT()}}var IT=()=>{let r={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(i){return r[i]??null}let t={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},n={nan:"NaN",number:"liczba",array:"tablica"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${i.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${s}`}case"invalid_value":return i.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${K(i.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${i.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${i.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${t[o.format]??i.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${i.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${i.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function PI(){return{localeError:IT()}}var DT=()=>{let r={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(i){return r[i]??null}let t={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",number:"n\xFAmero",null:"nulo"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Tipo inv\xE1lido: esperado instanceof ${i.expected}, recebido ${s}`:`Tipo inv\xE1lido: esperado ${o}, recebido ${s}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: esperado ${K(i.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${o}${i.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Muito pequeno: esperado que ${i.origin} tivesse ${o}${i.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${t[o.format]??i.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${T(i.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${i.origin}`;default:return"Campo inv\xE1lido"}}};function SI(){return{localeError:DT()}}function EI(r,e,t,n){let i=Math.abs(r),o=i%10,a=i%100;return a>=11&&a<=19?n:o===1?e:o>=2&&o<=4?t:n}var MT=()=>{let r={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(i){return r[i]??null}let t={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${K(i.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);if(a){let s=Number(i.maximum),l=EI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${i.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);if(a){let s=Number(i.minimum),l=EI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${i.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${i.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0438":""}: ${T(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function FI(){return{localeError:MT()}}var kT=()=>{let r={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(i){return r[i]??null}let t={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},n={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${i.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${s}`}case"invalid_value":return i.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${K(i.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} imelo ${o}${i.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${i.origin} imelo ${o}${i.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${t[o.format]??i.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${T(i.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}};function BI(){return{localeError:kT()}}var $T=()=>{let r={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(i){return r[i]??null}let t={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},n={nan:"NaN",number:"antal",array:"lista"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${i.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${s}`}case"invalid_value":return i.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${K(i.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${i.origin??"v\xE4rdet"} att ha ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${t[o.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${T(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${i.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function NI(){return{localeError:$T()}}var TT=()=>{let r={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(i){return r[i]??null}let t={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${i.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`}case"invalid_value":return i.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${K(i.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${T(i.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${i.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${i.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${o}${i.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${o}${i.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${i.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${i.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function II(){return{localeError:TT()}}var RT=()=>{let r={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(i){return r[i]??null}let t={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},n={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${i.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`}case"invalid_value":return i.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${K(i.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=e(i.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=e(i.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${t[o.format]??i.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${i.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${T(i.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function DI(){return{localeError:RT()}}var CT=()=>{let r={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(i){return r[i]??null}let t={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${i.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${s}`}case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${K(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${o}${i.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${o}${i.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${t[o.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function MI(){return{localeError:CT()}}var OT=()=>{let r={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(i){return r[i]??null}let t={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${i.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${K(i.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} \u0431\u0443\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0456":""}: ${T(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${i.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function nw(){return{localeError:OT()}}function kI(){return nw()}var VT=()=>{let r={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(i){return r[i]??null}let t={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},n={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${i.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return i.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${K(i.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${T(i.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${i.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${i.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u06D2 ${o}${i.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u0627 ${o}${i.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${i.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${i.keys.length>1?"\u0632":""}: ${T(i.keys,"\u060C ")}`;case"invalid_key":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function $I(){return{localeError:VT()}}var zT=()=>{let r={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"}};function e(i){return r[i]??null}let t={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},n={nan:"NaN",number:"raqam",array:"massiv"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${i.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${s}`}case"invalid_value":return i.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${K(i.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Juda katta: kutilgan ${i.origin??"qiymat"} ${o}${i.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${i.origin??"qiymat"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Juda kichik: kutilgan ${i.origin} ${o}${i.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${t[o.format]??i.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${i.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${i.keys.length>1?"lar":""}: ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${i.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function TI(){return{localeError:zT()}}var UT=()=>{let r={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(i){return r[i]??null}let t={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},n={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${i.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return i.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${K(i.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${t[o.format]??i.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${i.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${T(i.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function RI(){return{localeError:UT()}}var jT=()=>{let r={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(i){return r[i]??null}let t={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},n={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${i.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return i.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${K(i.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${o}${i.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${o}${i.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${t[o.format]??i.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${i.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${T(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${i.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function CI(){return{localeError:jT()}}var LT=()=>{let r={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(i){return r[i]??null}let t={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${i.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return i.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${K(i.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${o}${i.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${o}${i.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${t[o.format]??i.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${i.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${i.keys.length>1?"\u5011":""}\uFF1A${T(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function OI(){return{localeError:LT()}}var KT=()=>{let r={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(i){return r[i]??null}let t={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},n={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=Z(i.input),s=n[a]??a;return/^[A-Z]/.test(i.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${i.expected}, \xE0m\u1ECD\u0300 a r\xED ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return i.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${K(i.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${T(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=e(i.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin??"iye"} ${a.verb} ${o}${i.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${i.maximum}`}case"too_small":{let o=i.inclusive?">=":">",a=e(i.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin} ${a.verb} ${o}${i.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${i.minimum}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${t[o.format]??i.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${i.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${T(i.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function VI(){return{localeError:KT()}}var zI,$1=Symbol("ZodOutput"),T1=Symbol("ZodInput"),ow=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function aw(){return new ow}(zI=globalThis).__zod_globalRegistry??(zI.__zod_globalRegistry=aw());var Ir=globalThis.__zod_globalRegistry;function R1(r,e){return new r({type:"string",...H(e)})}function C1(r,e){return new r({type:"string",coerce:!0,...H(e)})}function sw(r,e){return new r({type:"string",format:"email",check:"string_format",abort:!1,...H(e)})}function _m(r,e){return new r({type:"string",format:"guid",check:"string_format",abort:!1,...H(e)})}function lw(r,e){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,...H(e)})}function cw(r,e){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(e)})}function uw(r,e){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(e)})}function dw(r,e){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(e)})}function Pm(r,e){return new r({type:"string",format:"url",check:"string_format",abort:!1,...H(e)})}function pw(r,e){return new r({type:"string",format:"emoji",check:"string_format",abort:!1,...H(e)})}function hw(r,e){return new r({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(e)})}function fw(r,e){return new r({type:"string",format:"cuid",check:"string_format",abort:!1,...H(e)})}function mw(r,e){return new r({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(e)})}function gw(r,e){return new r({type:"string",format:"ulid",check:"string_format",abort:!1,...H(e)})}function vw(r,e){return new r({type:"string",format:"xid",check:"string_format",abort:!1,...H(e)})}function yw(r,e){return new r({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(e)})}function xw(r,e){return new r({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(e)})}function ww(r,e){return new r({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(e)})}function O1(r,e){return new r({type:"string",format:"mac",check:"string_format",abort:!1,...H(e)})}function bw(r,e){return new r({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(e)})}function Aw(r,e){return new r({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(e)})}function _w(r,e){return new r({type:"string",format:"base64",check:"string_format",abort:!1,...H(e)})}function Pw(r,e){return new r({type:"string",format:"base64url",check:"string_format",abort:!1,...H(e)})}function Sw(r,e){return new r({type:"string",format:"e164",check:"string_format",abort:!1,...H(e)})}function Ew(r,e){return new r({type:"string",format:"jwt",check:"string_format",abort:!1,...H(e)})}var V1={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function z1(r,e){return new r({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(e)})}function U1(r,e){return new r({type:"string",format:"date",check:"string_format",...H(e)})}function j1(r,e){return new r({type:"string",format:"time",check:"string_format",precision:null,...H(e)})}function L1(r,e){return new r({type:"string",format:"duration",check:"string_format",...H(e)})}function K1(r,e){return new r({type:"number",checks:[],...H(e)})}function W1(r,e){return new r({type:"number",coerce:!0,checks:[],...H(e)})}function Z1(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"safeint",...H(e)})}function G1(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"float32",...H(e)})}function q1(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"float64",...H(e)})}function H1(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"int32",...H(e)})}function J1(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"uint32",...H(e)})}function Q1(r,e){return new r({type:"boolean",...H(e)})}function Y1(r,e){return new r({type:"boolean",coerce:!0,...H(e)})}function X1(r,e){return new r({type:"bigint",...H(e)})}function eS(r,e){return new r({type:"bigint",coerce:!0,...H(e)})}function tS(r,e){return new r({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...H(e)})}function rS(r,e){return new r({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...H(e)})}function iS(r,e){return new r({type:"symbol",...H(e)})}function nS(r,e){return new r({type:"undefined",...H(e)})}function oS(r,e){return new r({type:"null",...H(e)})}function aS(r){return new r({type:"any"})}function sS(r){return new r({type:"unknown"})}function lS(r,e){return new r({type:"never",...H(e)})}function cS(r,e){return new r({type:"void",...H(e)})}function uS(r,e){return new r({type:"date",...H(e)})}function dS(r,e){return new r({type:"date",coerce:!0,...H(e)})}function pS(r,e){return new r({type:"nan",...H(e)})}function Go(r,e){return new Wx({check:"less_than",...H(e),value:r,inclusive:!1})}function Ki(r,e){return new Wx({check:"less_than",...H(e),value:r,inclusive:!0})}function qo(r,e){return new Zx({check:"greater_than",...H(e),value:r,inclusive:!1})}function ti(r,e){return new Zx({check:"greater_than",...H(e),value:r,inclusive:!0})}function Fw(r){return qo(0,r)}function Bw(r){return Go(0,r)}function Nw(r){return Ki(0,r)}function Iw(r){return ti(0,r)}function Ts(r,e){return new oP({check:"multiple_of",...H(e),value:r})}function Rs(r,e){return new lP({check:"max_size",...H(e),maximum:r})}function Ho(r,e){return new cP({check:"min_size",...H(e),minimum:r})}function vc(r,e){return new uP({check:"size_equals",...H(e),size:r})}function yc(r,e){return new dP({check:"max_length",...H(e),maximum:r})}function Na(r,e){return new pP({check:"min_length",...H(e),minimum:r})}function xc(r,e){return new hP({check:"length_equals",...H(e),length:r})}function np(r,e){return new fP({check:"string_format",format:"regex",...H(e),pattern:r})}function op(r){return new mP({check:"string_format",format:"lowercase",...H(r)})}function ap(r){return new gP({check:"string_format",format:"uppercase",...H(r)})}function sp(r,e){return new vP({check:"string_format",format:"includes",...H(e),includes:r})}function lp(r,e){return new yP({check:"string_format",format:"starts_with",...H(e),prefix:r})}function cp(r,e){return new xP({check:"string_format",format:"ends_with",...H(e),suffix:r})}function Dw(r,e,t){return new wP({check:"property",property:r,schema:e,...H(t)})}function up(r,e){return new bP({check:"mime_type",mime:r,...H(e)})}function ao(r){return new AP({check:"overwrite",tx:r})}function dp(r){return ao(e=>e.normalize(r))}function pp(){return ao(r=>r.trim())}function hp(){return ao(r=>r.toLowerCase())}function fp(){return ao(r=>r.toUpperCase())}function mp(){return ao(r=>w_(r))}function hS(r,e,t){return new r({type:"array",element:e,...H(t)})}function ZT(r,e,t){return new r({type:"union",options:e,...H(t)})}function GT(r,e,t){return new r({type:"union",options:e,inclusive:!1,...H(t)})}function qT(r,e,t,n){return new r({type:"union",options:t,discriminator:e,...H(n)})}function HT(r,e,t){return new r({type:"intersection",left:e,right:t})}function JT(r,e,t,n){let i=t instanceof De,o=i?n:t,a=i?t:null;return new r({type:"tuple",items:e,rest:a,...H(o)})}function QT(r,e,t,n){return new r({type:"record",keyType:e,valueType:t,...H(n)})}function YT(r,e,t,n){return new r({type:"map",keyType:e,valueType:t,...H(n)})}function XT(r,e,t){return new r({type:"set",valueType:e,...H(t)})}function eR(r,e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new r({type:"enum",entries:n,...H(t)})}function tR(r,e,t){return new r({type:"enum",entries:e,...H(t)})}function rR(r,e,t){return new r({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}function fS(r,e){return new r({type:"file",...H(e)})}function iR(r,e){return new r({type:"transform",transform:e})}function nR(r,e){return new r({type:"optional",innerType:e})}function oR(r,e){return new r({type:"nullable",innerType:e})}function aR(r,e,t){return new r({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A_(t)}})}function sR(r,e,t){return new r({type:"nonoptional",innerType:e,...H(t)})}function lR(r,e){return new r({type:"success",innerType:e})}function cR(r,e,t){return new r({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function uR(r,e,t){return new r({type:"pipe",in:e,out:t})}function dR(r,e){return new r({type:"readonly",innerType:e})}function pR(r,e,t){return new r({type:"template_literal",parts:e,...H(t)})}function hR(r,e){return new r({type:"lazy",getter:e})}function fR(r,e){return new r({type:"promise",innerType:e})}function mS(r,e,t){let n=H(t);return n.abort??(n.abort=!0),new r({type:"custom",check:"custom",fn:e,...n})}function gS(r,e,t){return new r({type:"custom",check:"custom",fn:e,...H(t)})}function vS(r){let e=UI(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(Qd(n,t.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(Qd(i))}},r(t.value,t)));return e}function UI(r,e){let t=new xt({check:"custom",...H(e)});return t._zod.check=r,t}function yS(r){let e=new xt({check:"describe"});return e._zod.onattach=[t=>{let n=Ir.get(t)??{};Ir.add(t,{...n,description:r})}],e._zod.check=()=>{},e}function xS(r){let e=new xt({check:"meta"});return e._zod.onattach=[t=>{let n=Ir.get(t)??{};Ir.add(t,{...n,...r})}],e._zod.check=()=>{},e}function wS(r,e){let t=H(e),n=t.truthy??["true","1","yes","on","y","enabled"],i=t.falsy??["false","0","no","off","n","disabled"];t.case!=="sensitive"&&(n=n.map(g=>typeof g=="string"?g.toLowerCase():g),i=i.map(g=>typeof g=="string"?g.toLowerCase():g));let o=new Set(n),a=new Set(i),s=r.Codec??wm,l=r.Boolean??ym,u=r.String??gc,p=new u({type:"string",error:t.error}),d=new l({type:"boolean",error:t.error}),h=new s({type:"pipe",in:p,out:d,transform:(g,v)=>{let y=g;return t.case!=="sensitive"&&(y=y.toLowerCase()),o.has(y)?!0:a.has(y)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:v.value,inst:h,continue:!1}),{})},reverseTransform:(g,v)=>g===!0?n[0]||"true":i[0]||"false",error:t.error});return h}function gp(r,e,t,n={}){let i=H(n),o={...H(n),check:"string_format",type:"string",format:e,fn:typeof t=="function"?t:s=>t.test(s),...i};return t instanceof RegExp&&(o.pattern=t),new r(o)}function Cs(r){let e=r?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:r.processors??{},metadataRegistry:r?.metadata??Ir,target:e,unrepresentable:r?.unrepresentable??"throw",override:r?.override??(()=>{}),io:r?.io??"output",counter:0,seen:new Map,cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0}}function at(r,e,t={path:[],schemaPath:[]}){var n;let i=r._zod.def,o=e.seen.get(r);if(o)return o.count++,t.schemaPath.includes(r)&&(o.cycle=t.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(r,a);let s=r._zod.toJSONSchema?.();if(s)a.schema=s;else{let p={...t,schemaPath:[...t.schemaPath,r],path:t.path};if(r._zod.processJSONSchema)r._zod.processJSONSchema(e,a.schema,p);else{let h=a.schema,g=e.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(r,e,h,p)}let d=r._zod.parent;d&&(a.ref||(a.ref=d),at(d,e,p),e.seen.get(d).isParent=!0)}let l=e.metadataRegistry.get(r);return l&&Object.assign(a.schema,l),e.io==="input"&&ri(r)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(r).schema}function Os(r,e){let t=r.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of r.seen.entries()){let s=r.metadataRegistry.get(a[0])?.id;if(s){let l=n.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let i=a=>{let s=r.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let d=r.external.registry.get(a[0])?.id,h=r.external.uri??(v=>v);if(d)return{ref:h(d)};let g=a[1].defId??a[1].schema.id??`schema${r.counter++}`;return a[1].defId=g,{defId:g,ref:`${h("__shared")}#/${s}/${g}`}}if(a[1]===t)return{ref:"#"};let u=`#/${s}/`,p=a[1].schema.id??`__schema${r.counter++}`;return{defId:p,ref:u+p}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:u}=i(a);s.def={...s.schema},u&&(s.defId=u);let p=s.schema;for(let d in p)delete p[d];p.$ref=l};if(r.cycles==="throw")for(let a of r.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
41
41
 
42
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of r.seen.entries()){let s=a[1];if(e===a[0]){o(a);continue}if(r.external){let u=r.external.registry.get(a[0])?.id;if(e!==a[0]&&u){o(a);continue}}if(r.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&r.reused==="ref"){o(a);continue}}}function Vs(r,e){let t=r.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=r.seen.get(a);if(s.ref===null)return;let l=s.def??s.schema,u={...l},p=s.ref;if(s.ref=null,p){n(p);let h=r.seen.get(p),g=h.schema;if(g.$ref&&(r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Object.assign(l,g),Object.assign(l,u),a._zod.parent===p)for(let y in l)y==="$ref"||y==="allOf"||y in u||delete l[y];if(g.$ref&&h.def)for(let y in l)y==="$ref"||y==="allOf"||y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y])&&delete l[y]}let d=a._zod.parent;if(d&&d!==p){n(d);let h=r.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(let g in l)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(l[g])===JSON.stringify(h.def[g])&&delete l[g]}r.override({zodSchema:a,jsonSchema:l,path:s.path??[]})};for(let a of[...r.seen.entries()].reverse())n(a[0]);let i={};if(r.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":r.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":r.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":r.target,r.external?.uri){let a=r.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=r.external.uri(a)}Object.assign(i,t.def??t.schema);let o=r.external?.defs??{};for(let a of r.seen.entries()){let s=a[1];s.def&&s.defId&&(o[s.defId]=s.def)}r.external||Object.keys(o).length>0&&(r.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:vp(e,"input",r.processors),output:vp(e,"output",r.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ri(r,e){let t=e??{seen:new Set};if(t.seen.has(r))return!1;t.seen.add(r);let n=r._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ri(n.element,t);if(n.type==="set")return ri(n.valueType,t);if(n.type==="lazy")return ri(n.getter(),t);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ri(n.innerType,t);if(n.type==="intersection")return ri(n.left,t)||ri(n.right,t);if(n.type==="record"||n.type==="map")return ri(n.keyType,t)||ri(n.valueType,t);if(n.type==="pipe")return ri(n.in,t)||ri(n.out,t);if(n.type==="object"){for(let i in n.shape)if(ri(n.shape[i],t))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(ri(i,t))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(ri(i,t))return!0;return!!(n.rest&&ri(n.rest,t))}return!1}var bS=(r,e={})=>t=>{let n=Cs({...t,processors:e});return at(r,n),Os(n,r),Vs(n,r)},vp=(r,e,t={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=Cs({...i??{},target:o,io:e,processors:t});return at(r,a),Os(a,r),Vs(a,r)};var mR={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},AS=(r,e,t,n)=>{let i=t;i.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:u}=r._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=mR[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){let p=[...l];p.length===1?i.pattern=p[0].source:p.length>1&&(i.allOf=[...p.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},_S=(r,e,t,n)=>{let i=t,{minimum:o,maximum:a,format:s,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:p}=r._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof p=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=p,i.exclusiveMinimum=!0):i.exclusiveMinimum=p),typeof o=="number"&&(i.minimum=o,typeof p=="number"&&e.target!=="draft-04"&&(p>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},PS=(r,e,t,n)=>{t.type="boolean"},SS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ES=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},FS=(r,e,t,n)=>{e.target==="openapi-3.0"?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},BS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},NS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},IS=(r,e,t,n)=>{t.not={}},DS=(r,e,t,n)=>{},MS=(r,e,t,n)=>{},kS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},$S=(r,e,t,n)=>{let i=r._zod.def,o=sm(i.entries);o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),t.enum=o},TS=(r,e,t,n)=>{let i=r._zod.def,o=[];for(let a of i.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];t.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[a]:t.const=a}else o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),o.every(a=>typeof a=="boolean")&&(t.type="boolean"),o.every(a=>a===null)&&(t.type="null"),t.enum=o},RS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},CS=(r,e,t,n)=>{let i=t,o=r._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},OS=(r,e,t,n)=>{let i=t,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:l}=r._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),l?l.length===1?(o.contentMediaType=l[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(i,o)},VS=(r,e,t,n)=>{t.type="boolean"},zS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},US=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},jS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},LS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},KS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},WS=(r,e,t,n)=>{let i=t,o=r._zod.def,{minimum:a,maximum:s}=r._zod.bag;typeof a=="number"&&(i.minItems=a),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=at(o.element,e,{...n,path:[...n.path,"items"]})},ZS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="object",i.properties={};let a=o.shape;for(let u in a)i.properties[u]=at(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),l=new Set([...s].filter(u=>{let p=o.shape[u]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=at(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},kw=(r,e,t,n)=>{let i=r._zod.def,o=i.inclusive===!1,a=i.options.map((s,l)=>at(s,e,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));o?t.oneOf=a:t.anyOf=a},GS=(r,e,t,n)=>{let i=r._zod.def,o=at(i.left,e,{...n,path:[...n.path,"allOf",0]}),a=at(i.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];t.allOf=l},qS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((h,g)=>at(h,e,{...n,path:[...n.path,a,g]})),u=o.rest?at(o.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=l,u&&(i.items=u)):e.target==="openapi-3.0"?(i.items={anyOf:l},u&&i.items.anyOf.push(u),i.minItems=l.length,u||(i.maxItems=l.length)):(i.items=l,u&&(i.additionalItems=u));let{minimum:p,maximum:d}=r._zod.bag;typeof p=="number"&&(i.minItems=p),typeof d=="number"&&(i.maxItems=d)},HS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let p=at(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of l)i.patternProperties[d.source]=p}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=at(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=at(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let p=[...u].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(i.required=p)}},JS=(r,e,t,n)=>{let i=r._zod.def,o=at(i.innerType,e,n),a=e.seen.get(r);e.target==="openapi-3.0"?(a.ref=i.innerType,t.nullable=!0):t.anyOf=[o,{type:"null"}]},QS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},YS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},XS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},eE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a},tE=(r,e,t,n)=>{let i=r._zod.def,o=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;at(o,e,n);let a=e.seen.get(r);a.ref=o},rE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,t.readOnly=!0},iE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},$w=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},nE=(r,e,t,n)=>{let i=r._zod.innerType;at(i,e,n);let o=e.seen.get(r);o.ref=i},Mw={string:AS,number:_S,boolean:PS,bigint:SS,symbol:ES,null:FS,undefined:BS,void:NS,never:IS,any:DS,unknown:MS,date:kS,enum:$S,literal:TS,nan:RS,template_literal:CS,file:OS,success:VS,custom:zS,function:US,transform:jS,map:LS,set:KS,array:WS,object:ZS,union:kw,intersection:GS,tuple:qS,record:HS,nullable:JS,nonoptional:QS,default:YS,prefault:XS,catch:eE,pipe:tE,readonly:rE,promise:iE,optional:$w,lazy:nE};function Tw(r,e){if("_idmap"in r){let n=r,i=Cs({...e,processors:Mw}),o={};for(let l of n._idmap.entries()){let[u,p]=l;at(p,i)}let a={},s={registry:n,uri:e?.uri,defs:o};i.external=s;for(let l of n._idmap.entries()){let[u,p]=l;Os(i,p),a[u]=Vs(i,p)}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let t=Cs({...e,processors:Mw});return at(r,t),Os(t,r),Vs(t,r)}var Rw=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=Cs({processors:Mw,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return at(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),Os(this.ctx,e);let n=Vs(this.ctx,e),{"~standard":i,...o}=n;return o}};var jI={};var Sm={};Xo(Sm,{ZodAny:()=>BE,ZodArray:()=>ME,ZodBase64:()=>ib,ZodBase64URL:()=>nb,ZodBigInt:()=>Pp,ZodBigIntFormat:()=>sb,ZodBoolean:()=>_p,ZodCIDRv4:()=>tb,ZodCIDRv6:()=>rb,ZodCUID:()=>qw,ZodCUID2:()=>Hw,ZodCatch:()=>eF,ZodCodec:()=>mb,ZodCustom:()=>Rm,ZodCustomStringFormat:()=>bp,ZodDate:()=>Dm,ZodDefault:()=>qE,ZodDiscriminatedUnion:()=>$E,ZodE164:()=>ob,ZodEmail:()=>Ww,ZodEmoji:()=>Zw,ZodEnum:()=>xp,ZodExactOptional:()=>WE,ZodFile:()=>LE,ZodFunction:()=>cF,ZodGUID:()=>Em,ZodIPv4:()=>Xw,ZodIPv6:()=>eb,ZodIntersection:()=>TE,ZodJWT:()=>ab,ZodKSUID:()=>Yw,ZodLazy:()=>aF,ZodLiteral:()=>jE,ZodMAC:()=>bE,ZodMap:()=>zE,ZodNaN:()=>rF,ZodNanoID:()=>Gw,ZodNever:()=>IE,ZodNonOptional:()=>hb,ZodNull:()=>EE,ZodNullable:()=>GE,ZodNumber:()=>Ap,ZodNumberFormat:()=>bc,ZodObject:()=>km,ZodOptional:()=>pb,ZodPipe:()=>fb,ZodPrefault:()=>JE,ZodPromise:()=>lF,ZodReadonly:()=>iF,ZodRecord:()=>Tm,ZodSet:()=>UE,ZodString:()=>wp,ZodStringFormat:()=>mt,ZodSuccess:()=>XE,ZodSymbol:()=>PE,ZodTemplateLiteral:()=>oF,ZodTransform:()=>KE,ZodTuple:()=>CE,ZodType:()=>Oe,ZodULID:()=>Jw,ZodURL:()=>Im,ZodUUID:()=>Jo,ZodUndefined:()=>SE,ZodUnion:()=>$m,ZodUnknown:()=>NE,ZodVoid:()=>DE,ZodXID:()=>Qw,ZodXor:()=>kE,_ZodString:()=>Kw,_default:()=>HE,_function:()=>HD,any:()=>FD,array:()=>Mm,base64:()=>uD,base64url:()=>dD,bigint:()=>AD,boolean:()=>_E,catch:()=>tF,check:()=>JD,cidrv4:()=>lD,cidrv6:()=>cD,codec:()=>ZD,cuid:()=>eD,cuid2:()=>tD,custom:()=>QD,date:()=>ND,describe:()=>YD,discriminatedUnion:()=>TD,e164:()=>pD,email:()=>KI,emoji:()=>YI,enum:()=>ub,exactOptional:()=>ZE,file:()=>jD,float32:()=>yD,float64:()=>xD,function:()=>HD,guid:()=>WI,hash:()=>vD,hex:()=>gD,hostname:()=>mD,httpUrl:()=>QI,instanceof:()=>eM,int:()=>Lw,int32:()=>wD,int64:()=>_D,intersection:()=>RE,ipv4:()=>oD,ipv6:()=>sD,json:()=>rM,jwt:()=>hD,keyof:()=>ID,ksuid:()=>nD,lazy:()=>sF,literal:()=>UD,looseObject:()=>kD,looseRecord:()=>CD,mac:()=>aD,map:()=>OD,meta:()=>XD,nan:()=>WD,nanoid:()=>XI,nativeEnum:()=>zD,never:()=>lb,nonoptional:()=>YE,null:()=>FE,nullable:()=>Bm,nullish:()=>LD,number:()=>AE,object:()=>DD,optional:()=>Fm,partialRecord:()=>RD,pipe:()=>Nm,prefault:()=>QE,preprocess:()=>iM,promise:()=>qD,readonly:()=>nF,record:()=>VE,refine:()=>uF,set:()=>VD,strictObject:()=>MD,string:()=>jw,stringFormat:()=>fD,stringbool:()=>tM,success:()=>KD,superRefine:()=>dF,symbol:()=>SD,templateLiteral:()=>GD,transform:()=>db,tuple:()=>OE,uint32:()=>bD,uint64:()=>PD,ulid:()=>rD,undefined:()=>ED,union:()=>cb,unknown:()=>wc,url:()=>JI,uuid:()=>ZI,uuidv4:()=>GI,uuidv6:()=>qI,uuidv7:()=>HI,void:()=>BD,xid:()=>iD,xor:()=>$D});var Cw={};Xo(Cw,{endsWith:()=>cp,gt:()=>qo,gte:()=>ti,includes:()=>sp,length:()=>xc,lowercase:()=>op,lt:()=>Go,lte:()=>Ki,maxLength:()=>yc,maxSize:()=>Rs,mime:()=>up,minLength:()=>Na,minSize:()=>Ho,multipleOf:()=>Ts,negative:()=>Bw,nonnegative:()=>Iw,nonpositive:()=>Nw,normalize:()=>dp,overwrite:()=>ao,positive:()=>Fw,property:()=>Dw,regex:()=>np,size:()=>vc,slugify:()=>mp,startsWith:()=>lp,toLowerCase:()=>hp,toUpperCase:()=>fp,trim:()=>pp,uppercase:()=>ap});var yp={};Xo(yp,{ZodISODate:()=>Vw,ZodISODateTime:()=>Ow,ZodISODuration:()=>Uw,ZodISOTime:()=>zw,date:()=>aE,datetime:()=>oE,duration:()=>lE,time:()=>sE});var Ow=S("ZodISODateTime",(r,e)=>{RP.init(r,e),mt.init(r,e)});function oE(r){return z1(Ow,r)}var Vw=S("ZodISODate",(r,e)=>{CP.init(r,e),mt.init(r,e)});function aE(r){return U1(Vw,r)}var zw=S("ZodISOTime",(r,e)=>{OP.init(r,e),mt.init(r,e)});function sE(r){return j1(zw,r)}var Uw=S("ZodISODuration",(r,e)=>{VP.init(r,e),mt.init(r,e)});function lE(r){return L1(Uw,r)}var LI=(r,e)=>{pm.init(r,e),r.name="ZodError",Object.defineProperties(r,{format:{value:t=>fm(r,t)},flatten:{value:t=>hm(r,t)},addIssue:{value:t=>{r.issues.push(t),r.message=JSON.stringify(r.issues,Hd,2)}},addIssues:{value:t=>{r.issues.push(...t),r.message=JSON.stringify(r.issues,Hd,2)}},isEmpty:{get(){return r.issues.length===0}}})},vR=S("ZodError",LI),bi=S("ZodError",LI,{Parent:Error});var cE=Yd(bi),uE=Xd(bi),dE=ep(bi),pE=tp(bi),hE=Tx(bi),fE=Rx(bi),mE=Cx(bi),gE=Ox(bi),vE=Vx(bi),yE=zx(bi),xE=Ux(bi),wE=jx(bi);var Oe=S("ZodType",(r,e)=>(De.init(r,e),Object.assign(r["~standard"],{jsonSchema:{input:vp(r,"input"),output:vp(r,"output")}}),r.toJSONSchema=bS(r,{}),r.def=e,r.type=e.type,Object.defineProperty(r,"_def",{value:e}),r.check=(...t)=>r.clone(G.mergeDefs(e,{checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),r.with=r.check,r.clone=(t,n)=>ei(r,t,n),r.brand=()=>r,r.register=(t,n)=>(t.add(r,n),r),r.parse=(t,n)=>cE(r,t,n,{callee:r.parse}),r.safeParse=(t,n)=>dE(r,t,n),r.parseAsync=async(t,n)=>uE(r,t,n,{callee:r.parseAsync}),r.safeParseAsync=async(t,n)=>pE(r,t,n),r.spa=r.safeParseAsync,r.encode=(t,n)=>hE(r,t,n),r.decode=(t,n)=>fE(r,t,n),r.encodeAsync=async(t,n)=>mE(r,t,n),r.decodeAsync=async(t,n)=>gE(r,t,n),r.safeEncode=(t,n)=>vE(r,t,n),r.safeDecode=(t,n)=>yE(r,t,n),r.safeEncodeAsync=async(t,n)=>xE(r,t,n),r.safeDecodeAsync=async(t,n)=>wE(r,t,n),r.refine=(t,n)=>r.check(uF(t,n)),r.superRefine=t=>r.check(dF(t)),r.overwrite=t=>r.check(ao(t)),r.optional=()=>Fm(r),r.exactOptional=()=>ZE(r),r.nullable=()=>Bm(r),r.nullish=()=>Fm(Bm(r)),r.nonoptional=t=>YE(r,t),r.array=()=>Mm(r),r.or=t=>cb([r,t]),r.and=t=>RE(r,t),r.transform=t=>Nm(r,db(t)),r.default=t=>HE(r,t),r.prefault=t=>QE(r,t),r.catch=t=>tF(r,t),r.pipe=t=>Nm(r,t),r.readonly=()=>nF(r),r.describe=t=>{let n=r.clone();return Ir.add(n,{description:t}),n},Object.defineProperty(r,"description",{get(){return Ir.get(r)?.description},configurable:!0}),r.meta=(...t)=>{if(t.length===0)return Ir.get(r);let n=r.clone();return Ir.add(n,t[0]),n},r.isOptional=()=>r.safeParse(void 0).success,r.isNullable=()=>r.safeParse(null).success,r.apply=t=>t(r),r)),Kw=S("_ZodString",(r,e)=>{gc.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>AS(r,n,i,o);let t=r._zod.bag;r.format=t.format??null,r.minLength=t.minimum??null,r.maxLength=t.maximum??null,r.regex=(...n)=>r.check(np(...n)),r.includes=(...n)=>r.check(sp(...n)),r.startsWith=(...n)=>r.check(lp(...n)),r.endsWith=(...n)=>r.check(cp(...n)),r.min=(...n)=>r.check(Na(...n)),r.max=(...n)=>r.check(yc(...n)),r.length=(...n)=>r.check(xc(...n)),r.nonempty=(...n)=>r.check(Na(1,...n)),r.lowercase=n=>r.check(op(n)),r.uppercase=n=>r.check(ap(n)),r.trim=()=>r.check(pp()),r.normalize=(...n)=>r.check(dp(...n)),r.toLowerCase=()=>r.check(hp()),r.toUpperCase=()=>r.check(fp()),r.slugify=()=>r.check(mp())}),wp=S("ZodString",(r,e)=>{gc.init(r,e),Kw.init(r,e),r.email=t=>r.check(sw(Ww,t)),r.url=t=>r.check(Pm(Im,t)),r.jwt=t=>r.check(Ew(ab,t)),r.emoji=t=>r.check(pw(Zw,t)),r.guid=t=>r.check(_m(Em,t)),r.uuid=t=>r.check(lw(Jo,t)),r.uuidv4=t=>r.check(cw(Jo,t)),r.uuidv6=t=>r.check(uw(Jo,t)),r.uuidv7=t=>r.check(dw(Jo,t)),r.nanoid=t=>r.check(hw(Gw,t)),r.guid=t=>r.check(_m(Em,t)),r.cuid=t=>r.check(fw(qw,t)),r.cuid2=t=>r.check(mw(Hw,t)),r.ulid=t=>r.check(gw(Jw,t)),r.base64=t=>r.check(_w(ib,t)),r.base64url=t=>r.check(Pw(nb,t)),r.xid=t=>r.check(vw(Qw,t)),r.ksuid=t=>r.check(yw(Yw,t)),r.ipv4=t=>r.check(xw(Xw,t)),r.ipv6=t=>r.check(ww(eb,t)),r.cidrv4=t=>r.check(bw(tb,t)),r.cidrv6=t=>r.check(Aw(rb,t)),r.e164=t=>r.check(Sw(ob,t)),r.datetime=t=>r.check(oE(t)),r.date=t=>r.check(aE(t)),r.time=t=>r.check(sE(t)),r.duration=t=>r.check(lE(t))});function jw(r){return R1(wp,r)}var mt=S("ZodStringFormat",(r,e)=>{ft.init(r,e),Kw.init(r,e)}),Ww=S("ZodEmail",(r,e)=>{FP.init(r,e),mt.init(r,e)});function KI(r){return sw(Ww,r)}var Em=S("ZodGUID",(r,e)=>{SP.init(r,e),mt.init(r,e)});function WI(r){return _m(Em,r)}var Jo=S("ZodUUID",(r,e)=>{EP.init(r,e),mt.init(r,e)});function ZI(r){return lw(Jo,r)}function GI(r){return cw(Jo,r)}function qI(r){return uw(Jo,r)}function HI(r){return dw(Jo,r)}var Im=S("ZodURL",(r,e)=>{BP.init(r,e),mt.init(r,e)});function JI(r){return Pm(Im,r)}function QI(r){return Pm(Im,{protocol:/^https?$/,hostname:En.domain,...G.normalizeParams(r)})}var Zw=S("ZodEmoji",(r,e)=>{NP.init(r,e),mt.init(r,e)});function YI(r){return pw(Zw,r)}var Gw=S("ZodNanoID",(r,e)=>{IP.init(r,e),mt.init(r,e)});function XI(r){return hw(Gw,r)}var qw=S("ZodCUID",(r,e)=>{DP.init(r,e),mt.init(r,e)});function eD(r){return fw(qw,r)}var Hw=S("ZodCUID2",(r,e)=>{MP.init(r,e),mt.init(r,e)});function tD(r){return mw(Hw,r)}var Jw=S("ZodULID",(r,e)=>{kP.init(r,e),mt.init(r,e)});function rD(r){return gw(Jw,r)}var Qw=S("ZodXID",(r,e)=>{$P.init(r,e),mt.init(r,e)});function iD(r){return vw(Qw,r)}var Yw=S("ZodKSUID",(r,e)=>{TP.init(r,e),mt.init(r,e)});function nD(r){return yw(Yw,r)}var Xw=S("ZodIPv4",(r,e)=>{zP.init(r,e),mt.init(r,e)});function oD(r){return xw(Xw,r)}var bE=S("ZodMAC",(r,e)=>{jP.init(r,e),mt.init(r,e)});function aD(r){return O1(bE,r)}var eb=S("ZodIPv6",(r,e)=>{UP.init(r,e),mt.init(r,e)});function sD(r){return ww(eb,r)}var tb=S("ZodCIDRv4",(r,e)=>{LP.init(r,e),mt.init(r,e)});function lD(r){return bw(tb,r)}var rb=S("ZodCIDRv6",(r,e)=>{KP.init(r,e),mt.init(r,e)});function cD(r){return Aw(rb,r)}var ib=S("ZodBase64",(r,e)=>{ZP.init(r,e),mt.init(r,e)});function uD(r){return _w(ib,r)}var nb=S("ZodBase64URL",(r,e)=>{GP.init(r,e),mt.init(r,e)});function dD(r){return Pw(nb,r)}var ob=S("ZodE164",(r,e)=>{qP.init(r,e),mt.init(r,e)});function pD(r){return Sw(ob,r)}var ab=S("ZodJWT",(r,e)=>{HP.init(r,e),mt.init(r,e)});function hD(r){return Ew(ab,r)}var bp=S("ZodCustomStringFormat",(r,e)=>{JP.init(r,e),mt.init(r,e)});function fD(r,e,t={}){return gp(bp,r,e,t)}function mD(r){return gp(bp,"hostname",En.hostname,r)}function gD(r){return gp(bp,"hex",En.hex,r)}function vD(r,e){let t=e?.enc??"hex",n=`${r}_${t}`,i=En[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return gp(bp,n,i,e)}var Ap=S("ZodNumber",(r,e)=>{Yx.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>_S(r,n,i,o),r.gt=(n,i)=>r.check(qo(n,i)),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.lt=(n,i)=>r.check(Go(n,i)),r.lte=(n,i)=>r.check(Ki(n,i)),r.max=(n,i)=>r.check(Ki(n,i)),r.int=n=>r.check(Lw(n)),r.safe=n=>r.check(Lw(n)),r.positive=n=>r.check(qo(0,n)),r.nonnegative=n=>r.check(ti(0,n)),r.negative=n=>r.check(Go(0,n)),r.nonpositive=n=>r.check(Ki(0,n)),r.multipleOf=(n,i)=>r.check(Ts(n,i)),r.step=(n,i)=>r.check(Ts(n,i)),r.finite=()=>r;let t=r._zod.bag;r.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,r.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,r.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),r.isFinite=!0,r.format=t.format??null});function AE(r){return K1(Ap,r)}var bc=S("ZodNumberFormat",(r,e)=>{QP.init(r,e),Ap.init(r,e)});function Lw(r){return Z1(bc,r)}function yD(r){return G1(bc,r)}function xD(r){return q1(bc,r)}function wD(r){return H1(bc,r)}function bD(r){return J1(bc,r)}var _p=S("ZodBoolean",(r,e)=>{ym.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>PS(r,t,n,i)});function _E(r){return Q1(_p,r)}var Pp=S("ZodBigInt",(r,e)=>{Xx.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>SS(r,n,i,o),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.gt=(n,i)=>r.check(qo(n,i)),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.lt=(n,i)=>r.check(Go(n,i)),r.lte=(n,i)=>r.check(Ki(n,i)),r.max=(n,i)=>r.check(Ki(n,i)),r.positive=n=>r.check(qo(BigInt(0),n)),r.negative=n=>r.check(Go(BigInt(0),n)),r.nonpositive=n=>r.check(Ki(BigInt(0),n)),r.nonnegative=n=>r.check(ti(BigInt(0),n)),r.multipleOf=(n,i)=>r.check(Ts(n,i));let t=r._zod.bag;r.minValue=t.minimum??null,r.maxValue=t.maximum??null,r.format=t.format??null});function AD(r){return X1(Pp,r)}var sb=S("ZodBigIntFormat",(r,e)=>{YP.init(r,e),Pp.init(r,e)});function _D(r){return tS(sb,r)}function PD(r){return rS(sb,r)}var PE=S("ZodSymbol",(r,e)=>{XP.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>ES(r,t,n,i)});function SD(r){return iS(PE,r)}var SE=S("ZodUndefined",(r,e)=>{e1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>BS(r,t,n,i)});function ED(r){return nS(SE,r)}var EE=S("ZodNull",(r,e)=>{t1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>FS(r,t,n,i)});function FE(r){return oS(EE,r)}var BE=S("ZodAny",(r,e)=>{r1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>DS(r,t,n,i)});function FD(){return aS(BE)}var NE=S("ZodUnknown",(r,e)=>{i1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>MS(r,t,n,i)});function wc(){return sS(NE)}var IE=S("ZodNever",(r,e)=>{n1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>IS(r,t,n,i)});function lb(r){return lS(IE,r)}var DE=S("ZodVoid",(r,e)=>{o1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>NS(r,t,n,i)});function BD(r){return cS(DE,r)}var Dm=S("ZodDate",(r,e)=>{a1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>kS(r,n,i,o),r.min=(n,i)=>r.check(ti(n,i)),r.max=(n,i)=>r.check(Ki(n,i));let t=r._zod.bag;r.minDate=t.minimum?new Date(t.minimum):null,r.maxDate=t.maximum?new Date(t.maximum):null});function ND(r){return uS(Dm,r)}var ME=S("ZodArray",(r,e)=>{s1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>WS(r,t,n,i),r.element=e.element,r.min=(t,n)=>r.check(Na(t,n)),r.nonempty=t=>r.check(Na(1,t)),r.max=(t,n)=>r.check(yc(t,n)),r.length=(t,n)=>r.check(xc(t,n)),r.unwrap=()=>r.element});function Mm(r,e){return hS(ME,r,e)}function ID(r){let e=r._zod.def.shape;return ub(Object.keys(e))}var km=S("ZodObject",(r,e)=>{l1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>ZS(r,t,n,i),G.defineLazy(r,"shape",()=>e.shape),r.keyof=()=>ub(Object.keys(r._zod.def.shape)),r.catchall=t=>r.clone({...r._zod.def,catchall:t}),r.passthrough=()=>r.clone({...r._zod.def,catchall:wc()}),r.loose=()=>r.clone({...r._zod.def,catchall:wc()}),r.strict=()=>r.clone({...r._zod.def,catchall:lb()}),r.strip=()=>r.clone({...r._zod.def,catchall:void 0}),r.extend=t=>G.extend(r,t),r.safeExtend=t=>G.safeExtend(r,t),r.merge=t=>G.merge(r,t),r.pick=t=>G.pick(r,t),r.omit=t=>G.omit(r,t),r.partial=(...t)=>G.partial(pb,r,t[0]),r.required=(...t)=>G.required(hb,r,t[0])});function DD(r,e){let t={type:"object",shape:r??{},...G.normalizeParams(e)};return new km(t)}function MD(r,e){return new km({type:"object",shape:r,catchall:lb(),...G.normalizeParams(e)})}function kD(r,e){return new km({type:"object",shape:r,catchall:wc(),...G.normalizeParams(e)})}var $m=S("ZodUnion",(r,e)=>{xm.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>kw(r,t,n,i),r.options=e.options});function cb(r,e){return new $m({type:"union",options:r,...G.normalizeParams(e)})}var kE=S("ZodXor",(r,e)=>{$m.init(r,e),c1.init(r,e),r._zod.processJSONSchema=(t,n,i)=>kw(r,t,n,i),r.options=e.options});function $D(r,e){return new kE({type:"union",options:r,inclusive:!1,...G.normalizeParams(e)})}var $E=S("ZodDiscriminatedUnion",(r,e)=>{$m.init(r,e),u1.init(r,e)});function TD(r,e,t){return new $E({type:"union",options:e,discriminator:r,...G.normalizeParams(t)})}var TE=S("ZodIntersection",(r,e)=>{d1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>GS(r,t,n,i)});function RE(r,e){return new TE({type:"intersection",left:r,right:e})}var CE=S("ZodTuple",(r,e)=>{ew.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>qS(r,t,n,i),r.rest=t=>r.clone({...r._zod.def,rest:t})});function OE(r,e,t){let n=e instanceof De,i=n?t:e,o=n?e:null;return new CE({type:"tuple",items:r,rest:o,...G.normalizeParams(i)})}var Tm=S("ZodRecord",(r,e)=>{p1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>HS(r,t,n,i),r.keyType=e.keyType,r.valueType=e.valueType});function VE(r,e,t){return new Tm({type:"record",keyType:r,valueType:e,...G.normalizeParams(t)})}function RD(r,e,t){let n=ei(r);return n._zod.values=void 0,new Tm({type:"record",keyType:n,valueType:e,...G.normalizeParams(t)})}function CD(r,e,t){return new Tm({type:"record",keyType:r,valueType:e,mode:"loose",...G.normalizeParams(t)})}var zE=S("ZodMap",(r,e)=>{h1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>LS(r,t,n,i),r.keyType=e.keyType,r.valueType=e.valueType,r.min=(...t)=>r.check(Ho(...t)),r.nonempty=t=>r.check(Ho(1,t)),r.max=(...t)=>r.check(Rs(...t)),r.size=(...t)=>r.check(vc(...t))});function OD(r,e,t){return new zE({type:"map",keyType:r,valueType:e,...G.normalizeParams(t)})}var UE=S("ZodSet",(r,e)=>{f1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>KS(r,t,n,i),r.min=(...t)=>r.check(Ho(...t)),r.nonempty=t=>r.check(Ho(1,t)),r.max=(...t)=>r.check(Rs(...t)),r.size=(...t)=>r.check(vc(...t))});function VD(r,e){return new UE({type:"set",valueType:r,...G.normalizeParams(e)})}var xp=S("ZodEnum",(r,e)=>{m1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>$S(r,n,i,o),r.enum=e.entries,r.options=Object.values(e.entries);let t=new Set(Object.keys(e.entries));r.extract=(n,i)=>{let o={};for(let a of n)if(t.has(a))o[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new xp({...e,checks:[],...G.normalizeParams(i),entries:o})},r.exclude=(n,i)=>{let o={...e.entries};for(let a of n)if(t.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new xp({...e,checks:[],...G.normalizeParams(i),entries:o})}});function ub(r,e){let t=Array.isArray(r)?Object.fromEntries(r.map(n=>[n,n])):r;return new xp({type:"enum",entries:t,...G.normalizeParams(e)})}function zD(r,e){return new xp({type:"enum",entries:r,...G.normalizeParams(e)})}var jE=S("ZodLiteral",(r,e)=>{g1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>TS(r,t,n,i),r.values=new Set(e.values),Object.defineProperty(r,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function UD(r,e){return new jE({type:"literal",values:Array.isArray(r)?r:[r],...G.normalizeParams(e)})}var LE=S("ZodFile",(r,e)=>{v1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>OS(r,t,n,i),r.min=(t,n)=>r.check(Ho(t,n)),r.max=(t,n)=>r.check(Rs(t,n)),r.mime=(t,n)=>r.check(up(Array.isArray(t)?t:[t],n))});function jD(r){return fS(LE,r)}var KE=S("ZodTransform",(r,e)=>{y1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>jS(r,t,n,i),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new Is(r.constructor.name);t.addIssue=o=>{if(typeof o=="string")t.issues.push(G.issue(o,t.value,e));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=t.value),a.inst??(a.inst=r),t.issues.push(G.issue(a))}};let i=e.transform(t.value,t);return i instanceof Promise?i.then(o=>(t.value=o,t)):(t.value=i,t)}});function db(r){return new KE({type:"transform",transform:r})}var pb=S("ZodOptional",(r,e)=>{tw.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>$w(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function Fm(r){return new pb({type:"optional",innerType:r})}var WE=S("ZodExactOptional",(r,e)=>{x1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>$w(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function ZE(r){return new WE({type:"optional",innerType:r})}var GE=S("ZodNullable",(r,e)=>{w1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>JS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function Bm(r){return new GE({type:"nullable",innerType:r})}function LD(r){return Fm(Bm(r))}var qE=S("ZodDefault",(r,e)=>{b1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>YS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType,r.removeDefault=r.unwrap});function HE(r,e){return new qE({type:"default",innerType:r,get defaultValue(){return typeof e=="function"?e():G.shallowClone(e)}})}var JE=S("ZodPrefault",(r,e)=>{A1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>XS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function QE(r,e){return new JE({type:"prefault",innerType:r,get defaultValue(){return typeof e=="function"?e():G.shallowClone(e)}})}var hb=S("ZodNonOptional",(r,e)=>{_1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>QS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function YE(r,e){return new hb({type:"nonoptional",innerType:r,...G.normalizeParams(e)})}var XE=S("ZodSuccess",(r,e)=>{P1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>VS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function KD(r){return new XE({type:"success",innerType:r})}var eF=S("ZodCatch",(r,e)=>{S1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>eE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType,r.removeCatch=r.unwrap});function tF(r,e){return new eF({type:"catch",innerType:r,catchValue:typeof e=="function"?e:()=>e})}var rF=S("ZodNaN",(r,e)=>{E1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>RS(r,t,n,i)});function WD(r){return pS(rF,r)}var fb=S("ZodPipe",(r,e)=>{F1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>tE(r,t,n,i),r.in=e.in,r.out=e.out});function Nm(r,e){return new fb({type:"pipe",in:r,out:e})}var mb=S("ZodCodec",(r,e)=>{fb.init(r,e),wm.init(r,e)});function ZD(r,e,t){return new mb({type:"pipe",in:r,out:e,transform:t.decode,reverseTransform:t.encode})}var iF=S("ZodReadonly",(r,e)=>{B1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>rE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function nF(r){return new iF({type:"readonly",innerType:r})}var oF=S("ZodTemplateLiteral",(r,e)=>{N1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>CS(r,t,n,i)});function GD(r,e){return new oF({type:"template_literal",parts:r,...G.normalizeParams(e)})}var aF=S("ZodLazy",(r,e)=>{M1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>nE(r,t,n,i),r.unwrap=()=>r._zod.def.getter()});function sF(r){return new aF({type:"lazy",getter:r})}var lF=S("ZodPromise",(r,e)=>{D1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>iE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function qD(r){return new lF({type:"promise",innerType:r})}var cF=S("ZodFunction",(r,e)=>{I1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>US(r,t,n,i)});function HD(r){return new cF({type:"function",input:Array.isArray(r?.input)?OE(r?.input):r?.input??Mm(wc()),output:r?.output??wc()})}var Rm=S("ZodCustom",(r,e)=>{k1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>zS(r,t,n,i)});function JD(r){let e=new xt({check:"custom"});return e._zod.check=r,e}function QD(r,e){return mS(Rm,r??(()=>!0),e)}function uF(r,e={}){return gS(Rm,r,e)}function dF(r){return vS(r)}var YD=yS,XD=xS;function eM(r,e={}){let t=new Rm({type:"custom",check:"custom",fn:n=>n instanceof r,abort:!0,...G.normalizeParams(e)});return t._zod.bag.Class=r,t._zod.check=n=>{n.value instanceof r||n.issues.push({code:"invalid_type",expected:r.name,input:n.value,inst:t,path:[...t._zod.def.path??[]]})},t}var tM=(...r)=>wS({Codec:mb,Boolean:_p,String:wp},...r);function rM(r){let e=sF(()=>cb([jw(r),AE(),_E(),FE(),Mm(e),VE(jw(),e)]));return e}function iM(r,e){return Nm(db(r),e)}var xR={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function wR(r){Kt({customError:r})}function bR(){return Kt().customError}var pF;pF||(pF={});var re={...Sm,...Cw,iso:yp},AR=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function _R(r,e){let t=r.$schema;return t==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":t==="http://json-schema.org/draft-07/schema#"?"draft-7":t==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function PR(r,e){if(!r.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let t=r.slice(1).split("/").filter(Boolean);if(t.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===n){let i=t[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${r}`);return e.defs[i]}throw new Error(`Reference not found: ${r}`)}function nM(r,e){if(r.not!==void 0){if(typeof r.not=="object"&&Object.keys(r.not).length===0)return re.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(r.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(r.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(r.if!==void 0||r.then!==void 0||r.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(r.dependentSchemas!==void 0||r.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let i=r.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return re.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let o=PR(i,e),a=jr(o,e);return e.refs.set(i,a),e.processing.delete(i),a}if(r.enum!==void 0){let i=r.enum;if(e.version==="openapi-3.0"&&r.nullable===!0&&i.length===1&&i[0]===null)return re.null();if(i.length===0)return re.never();if(i.length===1)return re.literal(i[0]);if(i.every(a=>typeof a=="string"))return re.enum(i);let o=i.map(a=>re.literal(a));return o.length<2?o[0]:re.union([o[0],o[1],...o.slice(2)])}if(r.const!==void 0)return re.literal(r.const);let t=r.type;if(Array.isArray(t)){let i=t.map(o=>{let a={...r,type:o};return nM(a,e)});return i.length===0?re.never():i.length===1?i[0]:re.union(i)}if(!t)return re.any();let n;switch(t){case"string":{let i=re.string();if(r.format){let o=r.format;o==="email"?i=i.check(re.email()):o==="uri"||o==="uri-reference"?i=i.check(re.url()):o==="uuid"||o==="guid"?i=i.check(re.uuid()):o==="date-time"?i=i.check(re.iso.datetime()):o==="date"?i=i.check(re.iso.date()):o==="time"?i=i.check(re.iso.time()):o==="duration"?i=i.check(re.iso.duration()):o==="ipv4"?i=i.check(re.ipv4()):o==="ipv6"?i=i.check(re.ipv6()):o==="mac"?i=i.check(re.mac()):o==="cidr"?i=i.check(re.cidrv4()):o==="cidr-v6"?i=i.check(re.cidrv6()):o==="base64"?i=i.check(re.base64()):o==="base64url"?i=i.check(re.base64url()):o==="e164"?i=i.check(re.e164()):o==="jwt"?i=i.check(re.jwt()):o==="emoji"?i=i.check(re.emoji()):o==="nanoid"?i=i.check(re.nanoid()):o==="cuid"?i=i.check(re.cuid()):o==="cuid2"?i=i.check(re.cuid2()):o==="ulid"?i=i.check(re.ulid()):o==="xid"?i=i.check(re.xid()):o==="ksuid"&&(i=i.check(re.ksuid()))}typeof r.minLength=="number"&&(i=i.min(r.minLength)),typeof r.maxLength=="number"&&(i=i.max(r.maxLength)),r.pattern&&(i=i.regex(new RegExp(r.pattern))),n=i;break}case"number":case"integer":{let i=t==="integer"?re.number().int():re.number();typeof r.minimum=="number"&&(i=i.min(r.minimum)),typeof r.maximum=="number"&&(i=i.max(r.maximum)),typeof r.exclusiveMinimum=="number"?i=i.gt(r.exclusiveMinimum):r.exclusiveMinimum===!0&&typeof r.minimum=="number"&&(i=i.gt(r.minimum)),typeof r.exclusiveMaximum=="number"?i=i.lt(r.exclusiveMaximum):r.exclusiveMaximum===!0&&typeof r.maximum=="number"&&(i=i.lt(r.maximum)),typeof r.multipleOf=="number"&&(i=i.multipleOf(r.multipleOf)),n=i;break}case"boolean":{n=re.boolean();break}case"null":{n=re.null();break}case"object":{let i={},o=r.properties||{},a=new Set(r.required||[]);for(let[l,u]of Object.entries(o)){let p=jr(u,e);i[l]=a.has(l)?p:p.optional()}if(r.propertyNames){let l=jr(r.propertyNames,e),u=r.additionalProperties&&typeof r.additionalProperties=="object"?jr(r.additionalProperties,e):re.any();if(Object.keys(i).length===0){n=re.record(l,u);break}let p=re.object(i).passthrough(),d=re.looseRecord(l,u);n=re.intersection(p,d);break}if(r.patternProperties){let l=r.patternProperties,u=Object.keys(l),p=[];for(let h of u){let g=jr(l[h],e),v=re.string().regex(new RegExp(h));p.push(re.looseRecord(v,g))}let d=[];if(Object.keys(i).length>0&&d.push(re.object(i).passthrough()),d.push(...p),d.length===0)n=re.object({}).passthrough();else if(d.length===1)n=d[0];else{let h=re.intersection(d[0],d[1]);for(let g=2;g<d.length;g++)h=re.intersection(h,d[g]);n=h}break}let s=re.object(i);r.additionalProperties===!1?n=s.strict():typeof r.additionalProperties=="object"?n=s.catchall(jr(r.additionalProperties,e)):n=s.passthrough();break}case"array":{let i=r.prefixItems,o=r.items;if(i&&Array.isArray(i)){let a=i.map(l=>jr(l,e)),s=o&&typeof o=="object"&&!Array.isArray(o)?jr(o,e):void 0;s?n=re.tuple(a).rest(s):n=re.tuple(a),typeof r.minItems=="number"&&(n=n.check(re.minLength(r.minItems))),typeof r.maxItems=="number"&&(n=n.check(re.maxLength(r.maxItems)))}else if(Array.isArray(o)){let a=o.map(l=>jr(l,e)),s=r.additionalItems&&typeof r.additionalItems=="object"?jr(r.additionalItems,e):void 0;s?n=re.tuple(a).rest(s):n=re.tuple(a),typeof r.minItems=="number"&&(n=n.check(re.minLength(r.minItems))),typeof r.maxItems=="number"&&(n=n.check(re.maxLength(r.maxItems)))}else if(o!==void 0){let a=jr(o,e),s=re.array(a);typeof r.minItems=="number"&&(s=s.min(r.minItems)),typeof r.maxItems=="number"&&(s=s.max(r.maxItems)),n=s}else n=re.array(re.any());break}default:throw new Error(`Unsupported type: ${t}`)}return r.description&&(n=n.describe(r.description)),r.default!==void 0&&(n=n.default(r.default)),n}function jr(r,e){if(typeof r=="boolean")return r?re.any():re.never();let t=nM(r,e),n=r.type||r.enum!==void 0||r.const!==void 0;if(r.anyOf&&Array.isArray(r.anyOf)){let s=r.anyOf.map(u=>jr(u,e)),l=re.union(s);t=n?re.intersection(t,l):l}if(r.oneOf&&Array.isArray(r.oneOf)){let s=r.oneOf.map(u=>jr(u,e)),l=re.xor(s);t=n?re.intersection(t,l):l}if(r.allOf&&Array.isArray(r.allOf))if(r.allOf.length===0)t=n?t:re.any();else{let s=n?t:jr(r.allOf[0],e),l=n?0:1;for(let u=l;u<r.allOf.length;u++)s=re.intersection(s,jr(r.allOf[u],e));t=s}r.nullable===!0&&e.version==="openapi-3.0"&&(t=re.nullable(t)),r.readOnly===!0&&(t=re.readonly(t));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of o)s in r&&(i[s]=r[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in r&&(i[s]=r[s]);for(let s of Object.keys(r))AR.has(s)||(i[s]=r[s]);return Object.keys(i).length>0&&e.registry.add(t,i),t}function oM(r,e){if(typeof r=="boolean")return r?re.any():re.never();let t=_R(r,e?.defaultTarget),n=r.$defs||r.definitions||{},i={version:t,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??Ir};return jr(r,i)}var hF={};Xo(hF,{bigint:()=>BR,boolean:()=>FR,date:()=>NR,number:()=>ER,string:()=>SR});function SR(r){return C1(wp,r)}function ER(r){return W1(Ap,r)}function FR(r){return Y1(_p,r)}function BR(r){return eS(Pp,r)}function NR(r){return dS(Dm,r)}Kt(rw());var sM=[1,2,4,8],lM=[1,2,3,4,5,6,7,8],cM=["disable-track","mute-region"],uM=["all","previous-only"],IR=typeof location<"u"&&(location.hostname==="localhost"||location.hostname==="dev.opendaw.studio"),dM=Le.object({metronome:Le.object({enabled:Le.boolean(),beatSubDivision:Le.union(sM.map(r=>Le.literal(r))),gain:Le.number().min(Number.NEGATIVE_INFINITY).max(0),monophonic:Le.boolean()}).default({enabled:!1,beatSubDivision:1,gain:-6,monophonic:!0}),playback:Le.object({timestampEnabled:Le.boolean(),pauseOnLoopDisabled:Le.boolean(),truncateNotesAtRegionEnd:Le.boolean()}).default({timestampEnabled:!0,pauseOnLoopDisabled:!1,truncateNotesAtRegionEnd:!1}),recording:Le.object({countInBars:Le.union(lM.map(r=>Le.literal(r))),allowTakes:Le.boolean(),olderTakeAction:Le.union(cM.map(r=>Le.literal(r))),olderTakeScope:Le.union(uM.map(r=>Le.literal(r)))}).default({countInBars:1,allowTakes:IR,olderTakeAction:"mute-region",olderTakeScope:"previous-only"})}),aM;(function(r){r.BeatSubDivisionOptions=sM,r.RecordingCountInBars=lM,r.OlderTakeActionOptions=cM,r.OlderTakeScopeOptions=uM})(aM||(aM={}));var Sp={[Qt.Instrument]:0,[Qt.Aux]:1,[Qt.Bus]:2,[Qt.Output]:3};var gb;(function(r){r.create=({boxGraph:e,mandatoryBoxes:{rootBox:t,primaryAudioBus:n}},i,o,a)=>{let s=a??r.orderAndGetIndex(t,i);return console.debug(`createAudioUnit type: ${i}, insertIndex: ${s}`),yt.create(e,b.generate(),l=>{l.collection.refer(t.audioUnits),l.output.refer(n.input),l.index.setValue(s),l.type.setValue(i),o.ifSome(u=>l.capture.refer(u))})},r.orderAndGetIndex=(e,t)=>{let n=Wc.collectIndexedBoxes(e.audioUnits,yt),i=Sp[t],o=0;for(;o<n.length&&!(Sp[n[o].type.getValue()]>i);o++);let a=o;for(;o<n.length;)n[o].index.setValue(++o);return a},r.trackTypeToCapture=(e,t)=>{switch(t){case me.Audio:return m.wrap(Ka.create(e,b.generate()));case me.Notes:return m.wrap(Wa.create(e,b.generate()));default:return m.None}}})(gb||(gb={}));var pM;(function(r){r.create=(e,t,n,i,o)=>{console.debug(`createAudioBus '${t}', type: ${i}, color: ${o}`);let{boxGraph:a,mandatoryBoxes:{rootBox:s}}=e;V(s.isAttached(),"rootBox not attached");let l=b.generate(),u=$n.create(a,l,d=>{d.collection.refer(s.audioBusses),d.label.setValue(t),d.icon.setValue(He.toName(n)),d.color.setValue(o.toString())}),p=gb.create(e,i,m.None);return Zr.create(a,b.generate(),d=>{d.tracks.refer(p.tracks),d.target.refer(p),d.index.setValue(0),d.type.setValue(me.Undefined)}),u.output.refer(p.input),u}})(pM||(pM={}));var hM;(function(r){r.forAudioType=e=>{switch(e){case Qt.Output:return Ga.blue;case Qt.Aux:return Ga.purple;case Qt.Bus:return Ga.orange;case Qt.Instrument:return Ga.green;default:return Ga.dark}},r.forTrackType=e=>{switch(e){case me.Audio:return 200;case me.Notes:return 45;case me.Value:return 156;default:return 0}}})(hM||(hM={}));var fM;(function(r){r.Tape={defaultName:"Tape",defaultIcon:He.Tape,description:"Plays audio regions & clips",manualPage:pe.Tape,trackType:me.Audio,create:(n,i,o,a,s)=>lu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.toName(a)),l.flutter.setValue(.2),l.wow.setValue(.05),l.noise.setValue(.02),l.saturation.setValue(.5),l.host.refer(i)})},r.Nano={defaultName:"Nano",defaultIcon:He.NanoWave,description:"Simple sampler",manualPage:pe.Nano,trackType:me.Notes,create:(n,i,o,a,s)=>{let l;if(q(s))l=s;else{let u=b.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3"),p=5.34;l=n.findBox(u).unwrapOrElse(()=>br.create(n,u,d=>{d.fileName.setValue("Rhode"),d.endInSeconds.setValue(p)}))}return au.create(n,b.generate(),u=>{u.label.setValue(o),u.icon.setValue(He.toName(a)),u.file.refer(l),u.host.refer(i)})}},r.Playfield={defaultName:"Playfield",defaultIcon:He.Playfield,description:"Drum computer",manualPage:pe.Playfield,trackType:me.Notes,create:(n,i,o,a,s)=>{let l=su.create(n,b.generate(),u=>{u.label.setValue(o),u.icon.setValue(He.toName(a)),u.host.refer(i)});return q(s)&&s.filter(({note:u,uuid:p,name:d,durationInSeconds:h,exclude:g})=>{let v=e(n,p,d,h);Za.create(n,b.generate(),y=>{y.device.refer(l.samples),y.file.refer(v),y.index.setValue(u),y.exclude.setValue(g)})}),l}},r.Vaporisateur={defaultName:"Vaporisateur",defaultIcon:He.Piano,description:"Classic subtractive synthesizer",manualPage:pe.Vaporisateur,trackType:me.Notes,create:(n,i,o,a,s)=>iu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.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(_o.Polyphonic),l.lfo.rate.setInitValue(1),l.oscillators.fields()[0].waveform.setInitValue(ut.saw),l.oscillators.fields()[0].volume.setInitValue(-6),l.oscillators.fields()[1].volume.setInitValue(Number.NEGATIVE_INFINITY),l.oscillators.fields()[1].waveform.setInitValue(ut.square),l.host.refer(i),l.version.setValue(2)})},r.MIDIOutput={defaultName:"MIDIOutput",defaultIcon:He.Midi,description:"MIDI Output",manualPage:pe.MIDIOutput,trackType:me.Notes,create:(n,i,o,a,s)=>nu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.toName(a)),l.host.refer(i)})},r.Soundfont={defaultName:"Soundfont",defaultIcon:He.SoundFont,description:"Soundfont Player",manualPage:pe.Soundfont,trackType:me.Notes,create:(n,i,o,a,s)=>{s??(s={uuid:"d9f51577-2096-4671-9067-27ca2e12b329",name:"Upright Piano KW"});let l=s.uuid,u=b.parse(l),p=t(n,u,s.name);return ou.create(n,b.generate(),d=>{d.label.setValue(o),d.icon.setValue(He.toName(a)),d.host.refer(i),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=(n,i,o,a)=>n.findBox(i).unwrapOrElse(()=>br.create(n,i,s=>{s.fileName.setValue(o),s.endInSeconds.setValue(a)})),t=(n,i,o)=>n.findBox(i).unwrapOrElse(()=>Ao.create(n,i,a=>a.fileName.setValue(o)))})(fM||(fM={}));var zs;(function(r){r.empty=n=>{let i=new nl(m.wrap(ol.create)),o=new Date().toISOString();console.debug(`New Project created on ${o}`),i.beginTransaction();let a=tu.create(i,b.generate(),h=>{h.label.setValue("Groove Shuffle")}),s=Zc.create(i,b.generate(),h=>{h.groove.refer(a),h.created.setValue(o)}),l=$n.create(i,b.generate(),h=>{h.collection.refer(s.audioBusses),h.label.setValue("Output"),h.icon.setValue(He.toName(He.SpeakerHeadphone)),h.color.setValue(Ga.blue.toString())}),u=yt.create(i,b.generate(),h=>{h.type.setValue(Qt.Output),h.collection.refer(s.audioUnits),h.output.refer(s.outputDevice),h.index.setValue(0)});n.createOutputCompressor&&ru.create(i,b.generate(),h=>{h.label.setValue("Master Compressor"),h.index.setValue(0),h.host.refer(u.audioEffects),h.threshold.setValue(0),h.ratio.setValue(24)});let p=ll.create(i,b.generate());kn.create(i,b.generate(),h=>p.tempoTrack.events.refer(h.owners)),s.timeline.refer(p.root),l.output.refer(u.input);let d=[];if(n.createDefaultUser){let h=sl.create(i,b.generate());h.root.refer(s.users),d.push(h)}return i.endTransaction(),{boxGraph:i,mandatoryBoxes:{rootBox:s,primaryAudioBus:l,primaryAudioOutputUnit:u,timelineBox:p,userInterfaceBoxes:d}}},r.encode=n=>{let i=or.create();i.writeInt(1330660686),i.writeInt(2);let o=n.toArrayBuffer();return i.writeInt(o.byteLength),i.writeBytes(new Int8Array(o)),i.toArrayBuffer()},r.decode=n=>{let i=new wt(n);V(i.readInt()===1330660686,"Corrupt header. Probably not an openDAW project file."),V(i.readInt()===2,"Deprecated Format");let o=i.readInt(),a=new Int8Array(o);i.readBytes(a);let s=new nl(m.wrap(ol.create));return s.fromArrayBuffer(a.buffer),{boxGraph:s,mandatoryBoxes:r.findMandatoryBoxes(s)}},r.findMandatoryBoxes=n=>{let i=n.boxes().find(o=>o.accept({visitRootBox:()=>!0}));if(q(i)){let o=Ce(i.outputDevice.pointerHub.incoming().at(0)?.box,yt),a=Ce(o.input.pointerHub.incoming().at(0)?.box,$n),s=Ce(i.timeline.targetVertex.unwrap("TimelineBox not found").box,ll),l=i.users.pointerHub.incoming().map(({box:u})=>Ce(u,sl));return{rootBox:i,primaryAudioBus:a,primaryAudioOutputUnit:o,timelineBox:s,userInterfaceBoxes:l}}return D("Could not find mandatory boxes")}})(zs||(zs={}));var nr;(function(r){let e=({graph:n},{graph:i})=>n===i,t=(n,i)=>n.index.getValue()-i.index.getValue();r.excludeTimelinePredicate=n=>n.accept({visitTrackBox:()=>!0})===!0,r.shouldExclude=n=>n.ephemeral||n.name===eu.ClassName,r.generateMap=(n,i,o,a)=>{let s=b.newSet(({source:l})=>l);return s.addMany([...n.filter(({output:{targetAddress:l}})=>l.nonEmpty()).map(l=>({source:l.output.targetAddress.unwrap().uuid,target:a})),...n.map(l=>({source:l.collection.targetAddress.unwrap("AudioUnitBox was not connected to a RootBox").uuid,target:o})),...n.map(l=>({source:l.address.uuid,target:b.generate()})),...i.map(l=>({source:l.address.uuid,target:l.resource==="preserved"?l.address.uuid:b.generate()}))]),s},r.copyBoxes=(n,i,o,a)=>{let s=b.newSet(u=>u);a.forEach(u=>{u.resource==="preserved"&&i.findBox(u.address.uuid).nonEmpty()&&s.add(u.address.uuid)});let l=u=>{for(let[p,d]of u.outgoingEdges())if(p.mandatory&&!d.isBox()&&s.hasKey(d.uuid))return!0;return!1};N.decodeWith({map:(u,p)=>p.map(d=>n.opt(d.uuid).match({none:()=>d,some:({target:h})=>d.moveTo(h)}))},()=>{o.forEach(u=>{let p=new wt(u.toArrayBuffer()),d=n.get(u.address.uuid).target;i.createBox(u.name,d,h=>h.read(p))}),a.forEach(u=>{if(s.hasKey(u.address.uuid)||l(u))return;let p=new wt(u.toArrayBuffer()),d=n.get(u.address.uuid).target;i.createBox(u.name,d,h=>h.read(p))})})},r.reorderAudioUnits=(n,i,o)=>i.toSorted(t).map(a=>Ce(o.graph.findBox(n.get(a.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt)).forEach(a=>Wc.collectIndexedBoxes(o.audioUnits,yt).toSorted((s,l)=>{let u=Sp[s.type.getValue()],p=Sp[l.type.getValue()],d=u-p;return d===0?l===a?-1:1:d}).forEach((s,l)=>s.index.setValue(l))),r.extractRegions=(n,{boxGraph:i,mandatoryBoxes:{primaryAudioBus:o,rootBox:a}},s=0)=>{V(U.satisfy(n,e),"Region smust be from the same BoxGraph");let l=new Set(n),u=new Set,p=new $c;n.forEach(B=>{let I=Ce(B.regions.targetVertex.unwrap().box,Zr);u.add(I);let O=Ce(I.tracks.targetVertex.unwrap().box,yt);p.add(O,I)}),console.debug(`Found ${p.keyCount()} audioUnits`),console.debug(`Found ${u.size} tracks`);let d=[...p.keys()],h=B=>r.shouldExclude(B)||pt(B,Zr)&&!u.has(B)||io.isRegionBox(B)&&!l.has(B),g=Array.from(d[0].graph.dependenciesOf(d,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:h}).boxes),v=r.generateMap(d,g,a.audioUnits.address.uuid,o.address.uuid);r.copyBoxes(v,i,d,g),r.reorderAudioUnits(v,d,a),p.forEach((B,I)=>[...I].sort(t).forEach((O,z)=>{let $=i.findBox(v.get(O.address.uuid).target).unwrap("Target Track has not been copied");Ce($,Zr).index.setValue(z)}));let y=n.reduce((B,I)=>Math.min(B,I.position.getValue()),Number.MAX_VALUE),x=s-y;n.forEach(B=>{let I=i.findBox(v.get(B.address.uuid).target).unwrap("Target Track has not been copied"),{position:O}=io.asRegionBox(I);O.setValue(O.getValue()+x)})}})(nr||(nr={}));var mM;(function(r){r.transfer=(e,{boxGraph:t,mandatoryBoxes:{primaryAudioBus:n,rootBox:i}},o={})=>{let a=u=>nr.shouldExclude(u)||o?.excludeTimeline===!0&&nr.excludeTimelinePredicate(u),s=Array.from(e[0].graph.dependenciesOf(e,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:a}).boxes),l=nr.generateMap(e,s,i.audioUnits.address.uuid,n.address.uuid);return nr.copyBoxes(l,t,e,s),nr.reorderAudioUnits(l,e,i),e.map(u=>Ce(i.graph.findBox(l.get(u.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt))}})(mM||(mM={}));var gM;(function(r){r.transfer=(e,t,n,i=!0)=>{let o=t.graph,a=b.newSet(h=>h.address.uuid);a.add(e);for(let h of e.graph.dependenciesOf(e,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:g=>g.ephemeral}).boxes)a.add(h);let s=b.newSet(h=>h);a.forEach(h=>{h.resource==="preserved"&&o.findBox(h.address.uuid).nonEmpty()&&s.add(h.address.uuid)});let l=h=>{if(h.resource==="preserved"&&s.hasKey(h.address.uuid))return!0;for(let[,g]of h.outgoingEdges())if(s.hasKey(g.uuid)&&!g.isBox())return!0;return!1},u=a.values().filter(h=>!l(h)),p=b.newSet(h=>h.source);u.forEach(h=>{p.add({source:h.address.uuid,target:h.resource==="preserved"?h.address.uuid:b.generate()})}),s.forEach(h=>p.add({source:h,target:h}));let d=null;return N.decodeWith({map:(h,g)=>{let v=g.flatMap(y=>p.opt(y.uuid).map(x=>y.moveTo(x.target)));return v.nonEmpty()?v:h.pointerType===c.RegionCollection?m.wrap(t.regions.address):h.pointerType===c.ClipCollection?m.wrap(t.clips.address):m.None}},()=>u.forEach(h=>{let g=new wt(h.toArrayBuffer()),v=p.get(h.address.uuid).target;o.createBox(h.name,v,y=>{if(y.read(g),io.isRegionBox(y)){let x=io.asRegionBox(y);x.position.setValue(n),d=x}})})),i&&e.delete(),he(d,"Failed to create region copy")}})(gM||(gM={}));var Us;(function(r){r.MAGIC_HEADER_OPEN=1330664005,r.FORMAT_VERSION=1})(Us||(Us={}));var vM;(function(r){r.decode=(e,t)=>{let n=new wt(e.slice(0,8));if(n.readInt()!==Us.MAGIC_HEADER_OPEN){Oc.info({headline:"Could Not Import Preset",message:"Invalid preset file"}).then();return}if(n.readInt()!==Us.FORMAT_VERSION){Oc.info({headline:"Could Not Import Preset",message:"Invalid preset version"}).then();return}let i=new nl(m.wrap(ol.create));try{i.fromArrayBuffer(e.slice(8))}catch(d){Oc.info({headline:"Could Not Import Preset",message:String(d)}).then();return}let o=i.boxes().filter(d=>pt(d,yt)).filter(d=>d.type.getValue()!==Qt.Output),a=d=>nr.shouldExclude(d)||nr.excludeTimelinePredicate(d),s=Array.from(i.dependenciesOf(o,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:a}).boxes),{mandatoryBoxes:{rootBox:l,primaryAudioBus:u}}=t,p=nr.generateMap(o,s,l.audioUnits.address.uuid,u.address.uuid);nr.copyBoxes(p,t.boxGraph,o,s),nr.reorderAudioUnits(p,o,l),o.map(d=>Ce(l.graph.findBox(p.get(d.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt)).filter(d=>d.type.getValue()!==Qt.Output).forEach(d=>{let h=d.input.pointerHub.incoming().at(0)?.box;q(h)&&d.capture.targetVertex.ifSome(({box:g})=>{g instanceof Wa?Zr.create(t.boxGraph,b.generate(),v=>{v.index.setValue(0),v.type.setValue(me.Notes),v.target.refer(d),v.tracks.refer(d.tracks)}):g instanceof Ka&&Zr.create(t.boxGraph,b.generate(),v=>{v.index.setValue(0),v.type.setValue(me.Audio),v.target.refer(d),v.tracks.refer(d.tracks)})})})},r.replaceAudioUnit=(e,t,n)=>{console.debug("ReplaceAudioUnit with preset...");let i=zs.empty({createDefaultUser:!1,createOutputCompressor:!1}),o=i.boxGraph,a=t.graph;o.beginTransaction(),r.decode(e,i),o.endTransaction();let s=i.mandatoryBoxes.rootBox.audioUnits.pointerHub.incoming().map(({box:x})=>Ce(x,yt)).find(x=>x.type.getValue()!==Qt.Output);if(ng(s))return fo.err("Preset contains no valid audio unit. Please send the file to the developers.");let l=s.capture.targetVertex.mapOr(({box:x})=>x.name,""),u=t.capture.targetVertex.mapOr(({box:x})=>x.name,"");if(l!==u)return fo.err("Cannot replace incompatible instruments");let p=n?.keepMIDIEffects!==!0,d=n?.keepAudioEffects!==!0;console.debug("replaceMIDIEffects",p),console.debug("replaceAudioEffects",d),he(t.input.pointerHub.incoming().at(0)?.box,"Target has no input").delete(),p?t.midiEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()):(o.beginTransaction(),s.midiEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()),o.endTransaction()),d?t.audioEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()):(o.beginTransaction(),s.audioEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()),o.endTransaction());let h=x=>x.accept({visitTrackBox:B=>!0,visitCaptureMidiBox:B=>!0,visitCaptureAudioBox:B=>!0})===!0,g=b.newSet(({source:x})=>x),v=Array.from(o.dependenciesOf(s,{excludeBox:h,alwaysFollowMandatory:!1}).boxes);g.addMany([{source:s.address.uuid,target:t.address.uuid},...v.map(({address:{uuid:x},name:B})=>({source:x,target:B===br.ClassName||B===Ao.ClassName?x:b.generate()}))]);let y=b.newSet(x=>x);return v.forEach(x=>{(x instanceof br||x instanceof Ao)&&a.findBox(x.address.uuid).nonEmpty()&&y.add(x.address.uuid)}),N.decodeWith({map:(x,B)=>B.map(I=>g.opt(I.uuid).match({none:()=>I,some:({target:O})=>I.moveTo(O)}))},()=>{v.forEach(x=>{if((x instanceof br||x instanceof Ao)&&y.opt(x.address.uuid).nonEmpty())return;let B=new wt(x.toArrayBuffer()),I=x.name,O=g.get(x.address.uuid).target;a.createBox(I,O,z=>z.read(B))})}),fo.Ok}})(vM||(vM={}));var yM;(function(r){r.encode=e=>{let t=or.create();t.writeInt(Us.MAGIC_HEADER_OPEN),t.writeInt(Us.FORMAT_VERSION);let n=zs.empty({createOutputCompressor:!1,createDefaultUser:!1}),{boxGraph:i,mandatoryBoxes:{rootBox:o,primaryAudioBus:a}}=n,s=[e],l=d=>nr.shouldExclude(d)||nr.excludeTimelinePredicate(d);i.beginTransaction();let u=Array.from(e.graph.dependenciesOf(s,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:l}).boxes),p=nr.generateMap(s,u,o.audioUnits.address.uuid,a.address.uuid);return nr.copyBoxes(p,i,s,u),nr.reorderAudioUnits(p,s,o),i.endTransaction(),console.debug("SAVING..."),i.debugBoxes(),U.concatArrayBuffers(t.toArrayBuffer(),i.toArrayBuffer())}})(yM||(yM={}));var xM;(function(r){r.existingInstrumentNames=e=>e.audioUnits.pointerHub.incoming().map(({box:t})=>{let n=Ce(t,yt).input.pointerHub.incoming().at(0);if(n===void 0)return"N/A";let i=n.box;return"label"in i&&i.label instanceof C?i.label.getValue():"N/A"})})(xM||(xM={}));var wM=Le.object({name:Le.string(),bpm:Le.number(),duration:Le.number(),sample_rate:Le.number(),origin:Le.enum(["openDAW","recording","import"])});var cne=wM.extend({uuid:b.zType(Le)});var DR,MR,kR,$R,TR,RR;DR=new WeakMap,MR=new WeakMap,kR=new WeakMap,$R=new WeakMap,TR=new WeakMap,RR=new WeakMap;var Ep=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},CR,OR,fF,mF,gF,VR,zR;OR=new WeakMap,fF=new WeakMap,mF=new WeakMap,gF=new WeakMap,VR=new WeakMap,CR=new WeakSet,zR=function(e){return e.pointerHub.catchupAndSubscribe({onAdded:t=>{let n=Ce(t.box,al);V(n.isAttached(),"SelectionBox is not attached");let i=n.selectable.targetVertex.unwrap(()=>`SelectionBox has no target (${n.selectable.targetAddress.unwrapOrUndefined()?.toString()??"No address"})`),o={box:n,selectable:i};Ep(this,gF,"f").proxy.onSelected(i),V(Ep(this,fF,"f").add(o),"Could not add to entityMap"),V(Ep(this,mF,"f").add(o),"Could not add to selectableMap")},onRemoved:t=>{let n=Ce(t.box,al),i=Ep(this,fF,"f").removeByKey(n.address.uuid);V(i.box===n,"Broken selection");let o=i.selectable;Ep(this,gF,"f").proxy.onDeselected(o),Ep(this,mF,"f").removeByKey(o.address)}},c.Selection)};var bM=Le.object({name:Le.string(),size:Le.number().int(),url:Le.string(),license:Le.string(),origin:Le.enum(["openDAW","import"])});var Pne=bM.extend({uuid:b.zType(Le)});var AM;(function(r){r.cut=(e,t,n)=>{if(!(e.position>=t||t>=e.complete))if(f_.isLoopableRegion(e)){let{position:i,complete:o,loopOffset:a,loopDuration:s}=e;e.duration=t-i,e.copyTo({position:t,duration:o-t,loopOffset:qs(a+(t-i),s),consolidate:n})}else return D("Not yet implemented")},r.clip=(e,t,n)=>{if(f_.isLoopableRegion(e)){let{position:i,complete:o,loopOffset:a,loopDuration:s}=e;if(o-n<=0)return D(`duration will zero or negative(${o-n})`);e.duration=t-i,e.copyTo({position:n,duration:o-n,loopOffset:qs(a+(n-i),s)})}else return D("Not yet implemented")}})(AM||(AM={}));var js;(function(r){r[r.Float=0]="Float",r[r.FloatArray=1]="FloatArray",r[r.Integer=2]="Integer",r[r.IntegerArray=3]="IntegerArray",r[r.ByteArray=4]="ByteArray"})(js||(js={}));var Cm;(function(r){r[r.WRITE=0]="WRITE",r[r.READ=1]="READ"})(Cm||(Cm={}));var Fp;(function(r){r[r.ID=15793935]="ID",r[r.START=15790320]="START",r[r.END=986895]="END"})(Fp||(Fp={}));var vb=class r{static create(e,t){return new r(e.channel(t))}#e=[];#t=new SharedArrayBuffer(1);#r=new Int8Array(this.#t);#i;#n=or.create(0);#o=m.None;#a=m.None;#s=m.None;#l=-1;#c=-1;#u=!1;#p=!1;#d=0;constructor(e){this.#i=In.sender(e,({dispatchAndForget:t})=>new class{sendShareLock(n){t(this.sendShareLock,n)}sendUpdateData(n){t(this.sendUpdateData,n)}sendUpdateStructure(n){t(this.sendUpdateStructure,n)}})}flush(){let e=this.#f();if(e.nonEmpty()){this.#p||(this.#i.sendShareLock(this.#t),this.#p=!0),this.#i.sendUpdateStructure(e.unwrap());let t=this.#e.length,n=this.#h(),i=t+n;if(this.#o.isEmpty()||this.#o.unwrap().byteLength<i||t!==this.#d){let a=mo(i),s=new SharedArrayBuffer(a);this.#a=m.wrap(new Uint8Array(s,0,t)),this.#n=or.use(s,t),this.#o=m.wrap(s),this.#d=t,this.#i.sendUpdateData(s)}}this.#o.isEmpty()||Atomics.load(this.#r,0)===Cm.WRITE&&(this.#m(this.#n),this.#n.position=0,Atomics.store(this.#r,0,Cm.READ))}broadcastFloat(e,t){return this.#v(new class{type=js.Float;address=e;capacity=8;put(n,i){n.writeFloat(t())}})}broadcastInteger(e,t){return this.#v(new class{type=js.Integer;address=e;capacity=8;put(n,i){n.writeInt(t())}})}broadcastFloats(e,t,n){return this.#v(new class{type=js.FloatArray;address=e;capacity=4+(t.byteLength<<2);put(i,o){n?.(o),i.writeInt(t.length);for(let a of t)i.writeFloat(a)}})}broadcastIntegers(e,t,n){return this.#v(new class{type=js.IntegerArray;address=e;capacity=4+(t.byteLength<<2);put(i,o){n(o),i.writeInt(t.length),t.forEach(a=>i.writeInt(a))}})}broadcastByteArray(e,t,n){return this.#v(new class{type=js.ByteArray;address=e;capacity=4+t.byteLength;put(i,o){n(o),i.writeInt(t.byteLength),i.writeBytes(t)}})}#f(){if(this.#u){try{this.#s=m.wrap(this.#A())}catch(e){throw e}this.#u=!1}if(this.#s.nonEmpty()){let e=this.#s;return this.#s=m.None,e}return m.None}#h(){return this.#c===-1&&(this.#c=this.#g()+12),this.#c}terminate(){U.clear(this.#e),this.#s=m.None,this.#u=!1,this.#c=0}#m(e){V(!this.#u&&this.#s.isEmpty(),"Cannot flush while update is available");let t=this.#h();V(e.remaining>=t,"Insufficient data"),e.writeInt(this.#l),e.writeInt(Fp.START);let n=this.#a;for(let i=0;i<this.#e.length;i++){let o=n.nonEmpty()&&n.unwrap()[i]!==0;this.#e[i].put(e,o)}e.writeInt(Fp.END)}#g(){return this.#e.reduce((e,t)=>e+t.capacity,0)}#v(e){return this.#e.push(e),this.#w(),{terminate:()=>{U.removeOpt(this.#e,e),this.#w()}}}#w(){this.#c=-1,this.#u=!0}#A(){let e=or.create();e.writeInt(Fp.ID),e.writeInt(++this.#l),e.writeInt(this.#e.length);for(let{address:t,type:n}of this.#e)t.write(e),e.writeByte(n);return e.toArrayBuffer()}};var Om=class{#e=new j;#t;constructor(e,t){this.#t=this.#e.own(new hg(t)),this.#e.own(In.executor(e,{updateSettings:n=>this.#t.update(n)}))}get settings(){return this.#t.data}catchupAndSubscribe(e,...t){return this.#t.catchupAndSubscribe(e,...t)}terminate(){this.#e.terminate(),this.#t.terminate()}};var Bp;(e=>e.create=(t,n,i,o)=>0|(t?1:0)|(n?2:0)|(i?4:0)|(o?8:0))(Bp||={});var Be=class r{static PEAK_DECAY=Math.exp(-1/(sampleRate*.25));static RMS_WINDOW=Math.floor(sampleRate*.1);#e;#t;#r;#i;#n;#o=0;#a=0;#s=0;#l=0;constructor(e,t){this.#e=e,this.#t=t,this.#r=new Float32Array(4),this.#i=U.create(()=>new Lc(r.RMS_WINDOW),2),this.#n=this.#e.broadcastFloats(this.#t,this.#r,n=>{this.#r[0]=this.#o,this.#r[1]=this.#a,this.#r[2]=this.#s,this.#r[3]=this.#l})}clear(){this.#i[0].clear(),this.#i[1].clear(),this.#o=0,this.#a=0}process(e,t,n=0,i=fe){let o=i-n,a=r.PEAK_DECAY**o,s=0,l=0;for(let u=n;u<i;u++){let p=Math.abs(e[u]),d=Math.abs(t[u]);p>s&&(s=p),d>l&&(l=d)}this.#o=Math.max(s,this.#o*a),this.#a=Math.max(l,this.#a*a),this.#s=this.#i[0].processBlock(e,n,i),this.#l=this.#i[1].processBlock(t,n,i)}processStereo([e,t],n=0,i=fe){this.process(e,t,n,i)}terminate(){this.#n.terminate()}};var yb=class{#e=new j;#t;#r;#i;#n=m.None;#o;constructor(e,t){this.#t=e,this.#r=t,this.#i=new ce,this.#o=this.#r.getValue(),this.#e.own(this.#r.subscribe(n=>{this.#o=n.getValue(),this.#i.notify(this)}))}get adapter(){return this.#r}get address(){return this.#r.address}subscribe(e){return this.#i.subscribe(e)}getValue(){return this.#o}getUnitValue(){return this.#r.valueMapping.x(this.#o)}onStartAutomation(){V(this.#n.isEmpty(),"Already broadcasting"),this.#n=m.wrap(this.#t.broadcaster.broadcastFloat(this.#r.address,()=>this.getUnitValue()))}updateAutomation(e){let t=this.#r.valueAt(e);return this.#o!==t?(this.#o=t,!0):!1}onStopAutomation(){V(this.#n.nonEmpty(),"Never started broadcasting"),this.#n.unwrap().terminate(),this.#n=m.None,this.#o=this.#r.getValue(),this.#i.notify(this)}own(e){return this.#e.own(e)}ownAll(...e){this.#e.ownAll(...e)}spawn(){return this.#e.spawn()}terminate(){this.#e.terminate()}};var Np=class{#e;constructor(){this.#e=new dg}add(e,t){this.#e.add(e,t)}get(e){return this.#e.get(e)}forEach(e){return this.#e.forEach(e)}clear(){this.#e.clear()}};var gr=class{#e=new j;#t;#r;#i;#n;#o=m.None;constructor(e){this.#t=e,this.#r=new Np,this.#i=[],this.#n=[]}parameterChanged(e,t){return D(`Got update event for ${e}, but has no parameter change method`)}get context(){return this.#t}get eventInput(){return this.#r}bindParameter(e){let t=new yb(this.#t,e);return t.ownAll(e.field.pointerHub.catchupAndSubscribe({onAdded:n=>{this.#o.isEmpty()&&(this.#o=m.wrap(this.#t.updateClock.addEventOutput(this.#r))),this.#n.push(t),t.onStartAutomation()},onRemoved:n=>{U.remove(this.#n,t),this.#n.length===0&&(this.#o.ifSome(i=>i.terminate()),this.#o=m.None),t.onStopAutomation()}},c.Automation),t.subscribe(()=>this.parameterChanged(t))),this.#i.push(t),t}updateParameters(e,t){this.#n.forEach(n=>{n.updateAutomation(e)&&this.parameterChanged(n,t)})}readAllParameters(){this.#i.forEach(e=>this.parameterChanged(e,0))}own(e){return this.#e.own(e)}ownAll(...e){return this.#e.ownAll(...e)}spawn(){return this.#e.spawn()}terminate(){this.#o.ifSome(e=>e.terminate()),this.#o=m.None,this.#i.length=0,this.#e.terminate()}toString(){return`{${this.constructor.name}}`}};var Vm;(e=>e.isOfType=t=>t.type==="update-event")(Vm||={});var xb=class extends gr{#e=[];constructor(e){super(e),this.own(this.context.registerProcessor(this))}reset(){this.eventInput.clear()}addEventOutput(e){return this.#e.push(e),{terminate:()=>U.remove(this.#e,e)}}process({blocks:e}){e.forEach(({p0:t,p1:n,flags:i},o)=>{if(St.every(i,1))for(let a of Oa.iterate(t,n,Ng)){let s={type:"update-event",position:a};this.#e.forEach(l=>l.add(o,s))}})}toString(){return`{${this.constructor.name}}`}};var Ve=class extends gr{constructor(e){super(e)}process({blocks:e}){e.forEach(t=>{this.introduceBlock(t);let{index:n,p0:i,s0:o,s1:a,bpm:s}=t,l=null,u=o;for(let p of this.eventInput.get(n)){let d=p.position-i,h=Math.abs(d)<1e-7?o:o+Math.floor(J.pulsesToSamples(d,s,sampleRate));V(o<=h&&h<=a,()=>`${h} out of bounds. event: ${p.position} (${p.type}), p0: ${i}`),l?.forEach(g=>this.handleEvent(g)),l=null,u<h&&(this.processAudio(t,u,h),u=h),Vm.isOfType(p)?this.updateParameters(p.position,o/sampleRate+J.pulsesToSeconds(p.position-i,s)):(l??=[]).push(p)}l?.forEach(p=>this.handleEvent(p)),l=null,u<a&&this.processAudio(t,u,a)}),this.eventInput.clear(),this.finishProcess()}introduceBlock(e){}handleEvent(e){return D(`${this} received an event but has no accepting method.`)}finishProcess(){}};var UR=50,jR=250,wb=class r{static FilterMapping=A.exponential(20/sampleRate,2e4/sampleRate);#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d=0;#f=0;#h=0;#m=0;#g=0;#v=0;feedback=.5;cross=0;lfoPhaseIncr=0;#w=0;lfoDepth=0;wet=.75;dry=.75;#A=!1;constructor(e){let t=mo(e);this.#e=t,this.#t=t-1,this.#r=[new Float32Array(t),new Float32Array(t)],this.#i=[new Jt,new Jt],this.#n=new vo,this.#o=Math.floor(.25*sampleRate),this.#a=new Wp(e,this.#o),this.#s=new Wp(e,this.#o),this.#l=[new Float32Array(128),new Float32Array(128)],this.#c=new Pi(.003,sampleRate),this.#u=Math.exp(-1/(sampleRate*UR)),this.#p=Math.exp(-1/(sampleRate*jR))}reset(){this.#f=0,this.#a.clear(),this.#s.clear(),this.#A&&(this.#i.forEach(e=>e.reset()),this.#r.forEach(e=>e.fill(0)),this.#A=!1,this.#v=0,this.#w=0),this.#_()}set preDelayLeftOffset(e){this.#a.offset=Math.max(0,Math.min(e,this.#e-1))}set preDelayRightOffset(e){this.#s.offset=Math.max(0,Math.min(e,this.#e-1))}set offset(e){(e<0||e>=this.#e)&&D(`DelayDeviceDsp offset ${e} out of bounds [0, ${this.#e})`),this.#h!==e&&(this.#h=e,this.#A?this.#E():this.#_())}get offset(){return this.#h}set filter(e){e===0?this.#n.identity():e>0?this.#n.setHighpassParams(r.FilterMapping.y(e)):e<0&&this.#n.setLowpassParams(r.FilterMapping.y(1+e))}setLfoDepth(e){this.lfoDepth=e}process(e,t,n,i){let o=e[0],a=e[1],s=t[0],l=t[1];this.#a.process(this.#l[0],o,n,i),this.#s.process(this.#l[1],a,n,i);let u=this.cross,p=1-u,d=this.#t,h=this.#e,g=this.feedback,v=this.wet,y=this.dry,x=this.#n,[B,I]=this.#i,[O,z]=this.#r,[$,ie]=this.#l;for(let ne=n;ne<i;++ne){this.#g>0?(this.#d+=this.#m,this.#g--):this.#d=this.#h;let le=this.#c.process(this.lfoDepth),W=2*Math.abs(this.#w-.5)*le;this.#w+=this.lfoPhaseIncr,this.#w>=1&&(this.#w-=1);let xe=this.#f-(this.#d+le-W);xe<0&&(xe+=h);let se=xe|0,Ee=se+1&d,Re=xe-se,st=O[se&d],gt=z[se&d],ye=st+Re*(O[Ee]-st),ke=gt+Re*(z[Ee]-gt),lt=Math.max(Math.abs(ye),Math.abs(ke));this.#v=lt>this.#v?this.#u*(this.#v-lt)+lt:this.#p*(this.#v-lt)+lt,this.#v>1&&(ye/=this.#v,ke/=this.#v);let Lr=B.processFrame(x,(ye*p+ke*u)*.96),Wi=I.processFrame(x,(ke*p+ye*u)*.96);O[this.#f]=$[ne]+Lr*g+1e-18-1e-18,z[this.#f]=ie[ne]+Wi*g+1e-18-1e-18,s[ne]=o[ne]*y+Lr*v,l[ne]=a[ne]*y+Wi*v,this.#f=this.#f+1&d,O[this.#f]=0,z[this.#f]=0}this.#A=!0}#_(){this.#d=this.#h,this.#g=0}#E(){this.#h!==this.#d&&(this.#g=this.#o,this.#m=(this.#h-this.#d)/this.#g)}};var bb=class r extends Ve{static ID=0;#e=r.ID++;#t;parameterPreSyncTimeLeft;parameterPreMillisTimeLeft;parameterPreSyncTimeRight;parameterPreMillisTimeRight;parameterDelay;parameterMillisTime;parameterFeedback;parameterCross;parameterLfoSpeed;parameterLfoDepth;parameterFilter;parameterDry;parameterWet;#r;#i;#n;#o=m.None;#a=!0;#s=!0;#l=!0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address));let{namedParameter:n}=t;this.parameterPreSyncTimeLeft=this.own(this.bindParameter(n.preSyncTimeLeft)),this.parameterPreMillisTimeLeft=this.own(this.bindParameter(n.preMillisTimeLeft)),this.parameterPreSyncTimeRight=this.own(this.bindParameter(n.preSyncTimeRight)),this.parameterPreMillisTimeRight=this.own(this.bindParameter(n.preMillisTimeRight)),this.parameterDelay=this.own(this.bindParameter(n.delay)),this.parameterMillisTime=this.own(this.bindParameter(n.millisTime)),this.parameterFeedback=this.own(this.bindParameter(n.feedback)),this.parameterCross=this.own(this.bindParameter(n.cross)),this.parameterLfoSpeed=this.own(this.bindParameter(n.lfoSpeed)),this.parameterLfoDepth=this.own(this.bindParameter(n.lfoDepth)),this.parameterFilter=this.own(this.bindParameter(n.filter)),this.parameterDry=this.own(this.bindParameter(n.dry)),this.parameterWet=this.own(this.bindParameter(n.wet));let{Fractions:i}=tr,o=wr.toPPQN(i[i.length-1]),a=J.pulsesToSamples(o,im.min,sampleRate),s=tr.MAX_MILLIS_TIME*.001*sampleRate,l=tr.LFO_DEPTH_MAX*.001*sampleRate,u=a+s+l;this.#n=new wb(Math.ceil(u)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#n.reset(),this.#i.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio({bpm:e,flags:t},n,i){if(this.#o.isEmpty())return;let o=St.some(t,8);if(this.#s||o){let u=this.parameterPreSyncTimeLeft.getValue(),p=tr.Fractions[u],d=J.pulsesToSamples(wr.toPPQN(p),e,sampleRate),h=this.parameterPreMillisTimeLeft.getValue()*.001*sampleRate;this.#n.preDelayLeftOffset=d+h,this.#s=!1}if(this.#l||o){let u=this.parameterPreSyncTimeRight.getValue(),p=tr.Fractions[u],d=J.pulsesToSamples(wr.toPPQN(p),e,sampleRate),h=this.parameterPreMillisTimeRight.getValue()*.001*sampleRate;this.#n.preDelayRightOffset=d+h,this.#l=!1}if(this.#a||o){let u=this.parameterDelay.getValue(),p=wr.toPPQN(tr.Fractions[u]),d=J.pulsesToSamples(p,e,sampleRate),h=this.parameterMillisTime.getValue()*.001*sampleRate;this.#n.offset=d+h,this.#a=!1}let s=this.#o.unwrap().channels(),l=this.#r.channels();this.#n.process(s,l,n,i),this.#i.process(l[0],l[1],n,i)}parameterChanged(e){e===this.parameterPreSyncTimeLeft||e===this.parameterPreMillisTimeLeft?this.#s=!0:e===this.parameterPreSyncTimeRight||e===this.parameterPreMillisTimeRight?this.#l=!0:e===this.parameterDelay||e===this.parameterMillisTime?this.#a=!0:e===this.parameterFeedback?this.#n.feedback=this.parameterFeedback.getValue():e===this.parameterCross?this.#n.cross=this.parameterCross.getValue():e===this.parameterLfoSpeed?this.#n.lfoPhaseIncr=this.parameterLfoSpeed.getValue()/sampleRate:e===this.parameterLfoDepth?this.#n.setLfoDepth(this.parameterLfoDepth.getValue()*.001*sampleRate):e===this.parameterFilter?this.#n.filter=this.parameterFilter.getValue():(e===this.parameterDry||e===this.parameterWet)&&(this.#n.dry=Pe(this.parameterDry.getValue()),this.#n.wet=Pe(this.parameterWet.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})}`}};var zm=class r extends gr{static ID=0;#e=r.ID++;#t;#r;#i;#n=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing))}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#n=m.wrap(e),{terminate:()=>this.#n=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}process(e){if(this.#n.isEmpty())return;let t=this.#n.unwrap(),[n,i]=t.channels(),[o,a]=this.#r.channels();for(let s=0;s<fe;s++)o[s]=n[s],a[s]=i[s];this.#i.process(o,a)}parameterChanged(e){}toString(){return`{${this.constructor.name} (${this.#e})`}};var Ip=class r extends gr{static ID=0;#e=r.ID++;#t;#r;#i;#n;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=[],this.own(e.registerProcessor(this))}get noteEventTarget(){return m.None}get incoming(){return this}get outgoing(){return this}get uuid(){return this.#t.uuid}reset(){this.#i.clear(),this.#r.clear()}addAudioSource(e){return this.#n.push(e),{terminate:()=>{U.remove(this.#n,e),this.#r.clear()}}}get adapter(){return this.#t}get audioOutput(){return this.#r}process(e){this.#r.clear();let[t,n]=this.#r.channels();for(let i of this.#n){let[o,a]=i.channels();for(let s=0;s<fe;s++)t[s]+=o[s],n[s]+=a[s]}this.#r.assertSanity(),this.#i.process(this.#r.getChannel(0),this.#r.getChannel(1))}parameterChanged(e){}toString(){return`{${this.constructor.name} (${this.#e})}`}};var Fe;(s=>{s.Comparator=(l,u)=>{let p=l.position-u.position;return p!==0?p:l.type==="note-complete-event"?-1:u.type==="note-complete-event"?1:0},s.start=(l,u,p,d,h=0)=>({type:"note-event",position:l,duration:u,pitch:p,velocity:d,cent:h,id:++a}),s.startWith=(l,u,p)=>({type:"note-event",position:u??l.position,duration:p??l.duration,pitch:l.pitch,cent:l.cent,velocity:l.velocity,id:++a}),s.stop=({id:l,pitch:u},p)=>({type:"note-complete-event",position:p,pitch:u,id:l}),s.isStart=l=>l.type==="note-event"&&"id"in l&&typeof l.id=="number",s.isStop=l=>l.type==="note-complete-event";let a=0})(Fe||={});var Qo=class{#e=new j;#t;#r;#i;#n=m.None;constructor(e,t,n){this.#t=e,this.#r=this.#e.own(new Pn(t,n)),this.#i=new Array(16)}setNoteEventSource(e){return V(this.#n.isEmpty(),"NoteEventSource already set"),this.#n=m.wrap(e),this.#t.reset(),ee.create(()=>{this.#n=m.None,this.#t.reset()})}introduceBlock({index:e,p0:t,p1:n,flags:i}){if(!this.#n.isEmpty()){for(let o of this.#n.unwrap().processNotes(t,n,i))this.#i.push(o);this.#i.sort(Fe.Comparator).forEach(o=>{o.pitch>=0&&o.pitch<=127&&(this.#t.eventInput.add(e,o),this.#o(o))}),this.#i.length=0}}clear(){}terminate(){this.#e.terminate()}#o(e){Fe.isStart(e)?this.#r.noteOn(e.pitch):Fe.isStop(e)&&this.#r.noteOff(e.pitch)}};var vF;(e=>e.NotSet={start:()=>D("VoicingStrategy.start"),stop:()=>D("VoicingStrategy.stop"),forceStop:()=>ea,process:()=>D("VoicingStrategy.process"),reset:ea,processing:()=>U.empty()})(vF||={});var Ab=class{#e;#t=[];constructor(e=vF.NotSet){this.#e=e}set strategy(e){this.#t.push(this.#e),this.#e.forceStop(),this.#e=e}get strategy(){return this.#e}start(e){this.#e.start(e)}stop(e){this.#e.stop(e)}process(e,t,n,i){this.#e.process(e,t,n,i);for(let o=this.#t.length-1;o>=0;o--)this.#t[o].process(e,t,n,i)&&this.#t.splice(o,1)}reset(){this.#t.forEach(e=>e.reset()),this.#t.length=0,this.#e.reset()}};var _b=class{#e;#t=[];#r=[];constructor(e){this.#e=e}start(e){let t=NaN;for(let o=0;o<this.#r.length;o++){let a=this.#r[o];if(!a.gate){t=a.currentFrequency,this.#r.splice(o,1);break}}let n=this.#e.computeFrequency(e),i=this.#e.create();isNaN(t)?i.start(e,n,1,0):(i.start(e,t,1,0),i.startGlide(n,this.#e.glideTime)),this.#r.push(i),this.#t.push(i)}stop(e){this.#t.find(t=>t.id===e)?.stop()}forceStop(){this.#t.forEach(e=>e.forceStop())}reset(){this.#t.length=0,this.#r.length=0}process(e,t,n,i){e.clear(n,i);for(let o=this.#t.length-1;o>=0;o--){let a=this.#t[o];a.process(e,t,n,i)&&(U.removeIf(this.#r,s=>s===a),this.#t.splice(o,1))}return this.#t.length===0}processing(){return this.#t}};var Pb=class{#e;#t=[];#r=[];#i=null;#n=null;constructor(e){this.#e=e}start(e){if(this.#r.push(e),q(this.#i)&&this.#i.gate){this.#i.startGlide(this.#e.computeFrequency(e),this.#e.glideTime);return}let t=NaN;q(this.#n)&&(t=this.#n.currentFrequency,this.#n.forceStop());let n=this.#e.create(),i=this.#e.computeFrequency(e);isNaN(t)?n.start(e,i,1,0):(n.start(e,t,1,0),n.startGlide(i,this.#e.glideTime)),this.#i=n,this.#n=n,this.#t.push(n)}stop(e){let t=this.#r.findIndex(n=>n.id===e);if(t!==-1&&(this.#r.splice(t,1),!!q(this.#i))){if(t===this.#r.length){let n=this.#r.at(-1);if(q(n)){this.#i.startGlide(this.#e.computeFrequency(n),this.#e.glideTime);return}}this.#r.length===0&&(this.#i.stop(),this.#i=null)}}forceStop(){this.#t.forEach(e=>e.forceStop())}reset(){this.#r.length=0,this.#t.length=0,this.#i=null,this.#n=null}process(e,t,n,i){e.clear(n,i);for(let o=this.#t.length-1;o>=0;o--){let a=this.#t[o];a.process(e,t,n,i)&&(this.#t.splice(o,1),a===this.#i&&(this.#i=null),a===this.#n&&(this.#n=null))}return this.#t.length===0}processing(){return this.#t}};var Um=class{#e;#t=[];#r=new jc;#i;gate=!0;id=-1;constructor(e,t){this.#e=e,this.#i=t}get currentFrequency(){return this.#r.currentFrequency()}start(e,t,n,i){if(this.id=e.id,this.#r.init(t),this.#i===1){let o=this.#e();o.start(e,t,n,i),this.#t.push(o)}else for(let o=0;o<this.#i;++o){let a=o/(this.#i-1)*2-1,s=this.#e(),l=(1-Math.abs(i))*a+i;s.start(e,t,n/Math.sqrt(this.#i),l),this.#t.push(s)}}startGlide(e,t){this.#r.glideTo(e,t),this.#t.forEach(n=>n.startGlide(e,t))}process(e,t,n,i){this.#r.advance(t.bpm,n,i);for(let o=this.#t.length-1;o>=0;o--)this.#t[o].process(e,t,n,i)&&this.#t.splice(o,1);return this.#t.length===0}stop(){this.#t.forEach(e=>e.stop()),this.gate=!1}forceStop(){this.#t.forEach(e=>e.forceStop()),this.gate=!1}processing(){return this.#t}};var[_M,PM,yF,SM,EM,Sb,FM,BM,Eb]=YF(Float32Array,fe),jm=class{device;oscA;oscB;lfo;filter;env;glide;gainASmooth;gainBSmooth;gainVcaSmooth;#e=Gs("NoteEvent not set");#t=1;#r=1;id=-1;phase=0;filter_keyboard_delta=0;constructor(e){this.device=e,this.oscA=new qp(sampleRate),this.oscB=new qp(sampleRate),this.lfo=new Pg(sampleRate),this.filter=new vg(zo.MIN_CUTOFF,zo.MAX_CUTOFF,sampleRate),this.filter.order=1,this.env=new zc(sampleRate),this.env.set(this.device.env_attack,this.device.env_decay,this.device.env_sustain,this.device.env_release),this.env.gateOn(),this.glide=new jc,this.gainASmooth=new Pi(.003,sampleRate),this.gainBSmooth=new Pi(.003,sampleRate),this.gainVcaSmooth=new Pi(.003,sampleRate)}start(e,t,n,i){this.#e=e,this.#t=n,this.#r=i,this.filter_keyboard_delta=Sg.keyboardTracking(e.pitch,this.device.parameterFilterKeyboard.getValue()),this.glide.init(t)}stop(){this.env.gateOff()}forceStop(){this.env.forceStop()}startGlide(e,t){this.glide.glideTo(e,t)}get gate(){return this.env.gate}get currentFrequency(){return this.glide.currentFrequency()}process(e,{bpm:t},n,i){let{gainOscA:o,gainOscB:a,oscA_waveform:s,oscB_waveform:l,flt_cutoff:u,flt_resonance:p,flt_env_amount:d,flt_order:h,frequencyAMultiplier:g,frequencyBMultiplier:v,parameterLfoShape:y,parameterLfoRate:x,parameterLfoTargetTune:B,parameterLfoTargetCutoff:I,parameterLfoTargetVolume:O,parameterUnisonDetune:z,parameterUnisonStereo:$}=this.device,ie=Uc(this.#e.velocity)*this.#t,ne=2**(this.#r*(z.getValue()/1200)),le=this.#r*$.getValue(),[W,xe]=oa.panningToGains(le,xo.Linear),[se,Ee]=e.channels();yF.fill(ne,n,i),this.glide.process(yF,t,n,i),this.lfo.fill(FM,y.getValue(),x.getValue(),n,i),this.env.process(Sb,n,i);let Re=B.getValue(),st=I.getValue(),gt=O.getValue();for(let ye=n;ye<i;ye++){let ke=FM[ye];BM[ye]=u+this.filter_keyboard_delta+Sb[ye]*d+ke*st,Sb[ye]*=qi(ie+ke*gt);let lt=yF[ye]*2**(ke*Re);SM[ye]=lt*g,EM[ye]=lt*v}this.oscA.generateFromFrequencies(_M,SM,s,n,i),this.oscB.generateFromFrequencies(PM,EM,l,n,i);for(let ye=n;ye<i;ye++)Eb[ye]=_M[ye]*this.gainASmooth.process(o)+PM[ye]*this.gainBSmooth.process(a);this.filter.order=h,this.filter.process(Eb,Eb,BM,p,n,i);for(let ye=n;ye<i;ye++){let ke=this.gainVcaSmooth.process(qi(Sb[ye])),lt=Eb[ye]*ke;if(se[ye]+=lt*W,Ee[ye]+=lt*xe,this.env.complete&&ke<mg)return!0}return!1}};var Fb=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$;gainOscA=1;gainOscB=1;frequencyAMultiplier=1;frequencyBMultiplier=1;env_attack=1;env_decay=1;env_sustain=1;env_release=1;oscA_waveform=ut.sine;oscB_waveform=ut.sine;flt_cutoff=1;flt_resonance=Math.SQRT1_2;flt_env_amount=0;flt_order=1;#T=0;#N=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Ab,this.#r=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#i=new Ae,this.#n=new Bg(sampleRate),this.#o=this.own(new Be(e.broadcaster,t.address));let{box:n,namedParameter:i}=this.#e,{oscillators:o}=i;this.#a=this.own(this.bindParameter(o[0].waveform)),this.#s=this.own(this.bindParameter(o[0].octave)),this.#l=this.own(this.bindParameter(o[0].tune)),this.#c=this.own(this.bindParameter(o[0].volume)),this.#u=this.own(this.bindParameter(o[1].waveform)),this.#p=this.own(this.bindParameter(o[1].octave)),this.#d=this.own(this.bindParameter(o[1].tune)),this.#f=this.own(this.bindParameter(o[1].volume)),this.#h=this.own(this.bindParameter(i.attack)),this.#m=this.own(this.bindParameter(i.decay)),this.#g=this.own(this.bindParameter(i.sustain)),this.#v=this.own(this.bindParameter(i.release)),this.#w=this.own(this.bindParameter(i.cutoff)),this.#A=this.own(this.bindParameter(i.resonance)),this.#_=this.own(this.bindParameter(i.filterEnvelope)),this.#E=this.own(this.bindParameter(i.filterOrder)),this.#F=this.own(this.bindParameter(i.filterKeyboard)),this.#b=this.own(this.bindParameter(i.glideTime)),this.#y=this.own(this.bindParameter(i.voicingMode)),this.#x=this.own(this.bindParameter(i.unisonCount)),this.#S=this.own(this.bindParameter(i.unisonDetune)),this.#I=this.own(this.bindParameter(i.unisonStereo)),this.#M=this.own(this.bindParameter(i.lfoWaveform)),this.#k=this.own(this.bindParameter(i.lfoRate)),this.#D=this.own(this.bindParameter(i.lfoTargetTune)),this.#B=this.own(this.bindParameter(i.lfoTargetCutoff)),this.#$=this.own(this.bindParameter(i.lfoTargetVolume));let a=new Float32Array(32);this.ownAll(n.enabled.catchupAndSubscribe(s=>{this.#N=s.getValue(),this.#N||this.reset()}),e.broadcaster.broadcastFloats(t.address.append(0),a,s=>{if(!s)return;let l=0;this.#t.strategy.processing().forEach(u=>{let d=Ce(u,Um).processing().at(0);d instanceof jm&&(a[l++]=d.env.phase),a.length-1}),a[l]=-1}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing)),this.readAllParameters()}computeFrequency(e){return Kp(e.pitch+e.cent/100,440)}get glideTime(){return this.#T}get parameterFilterKeyboard(){return this.#F}get parameterLfoShape(){return this.#M}get parameterLfoRate(){return this.#k}get parameterLfoTargetTune(){return this.#D}get parameterLfoTargetCutoff(){return this.#B}get parameterLfoTargetVolume(){return this.#$}get parameterUnisonDetune(){return this.#S}get parameterUnisonStereo(){return this.#I}create(){return new Um(()=>new jm(this),this.#x.getValue())}get noteEventTarget(){return m.wrap(this)}introduceBlock(e){this.#r.introduceBlock(e)}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#o.clear(),this.#t.reset(),this.#i.clear(),this.eventInput.clear()}get uuid(){return this.#e.uuid}get audioOutput(){return this.#i}get adapter(){return this.#e}handleEvent(e){Fe.isStart(e)?this.#t.start(e):Fe.isStop(e)&&this.#t.stop(e.id)}processAudio(e,t,n){this.#N&&(this.#t.process(this.#i,e,t,n),this.#n.replace(this.#i,t,n))}parameterChanged(e){if(e===this.#c)this.gainOscA=Pe(this.#c.getValue());else if(e===this.#f)this.gainOscB=Pe(this.#f.getValue());else if(e===this.#s||e===this.#l)this.frequencyAMultiplier=2**(this.#s.getValue()+this.#l.getValue()/1200);else if(e===this.#p||e===this.#d)this.frequencyBMultiplier=2**(this.#p.getValue()+this.#d.getValue()/1200);else if(e===this.#h)this.env_attack=this.#h.getValue();else if(e===this.#m)this.env_decay=this.#m.getValue();else if(e===this.#g)this.env_sustain=this.#g.getValue();else if(e===this.#v)this.env_release=this.#v.getValue();else if(e===this.#a)this.oscA_waveform=Gi(this.#a.getValue(),ut);else if(e===this.#u)this.oscB_waveform=Gi(this.#u.getValue(),ut);else if(e===this.#w)this.flt_cutoff=this.#w.getUnitValue();else if(e===this.#A)this.flt_resonance=this.#A.getValue();else if(e===this.#_)this.flt_env_amount=this.#_.getValue();else if(e===this.#E)this.flt_order=this.#E.getValue();else if(e===this.#b)this.#T=this.#b.getValue()*J.Bar;else if(e===this.#y){let t=this.#y.getValue();switch(t){case _o.Monophonic:{this.#t.strategy=new Pb(this);return}case _o.Polyphonic:{this.#t.strategy=new _b(this);return}default:return D(`Unknown VoicingMode '${t}'`)}}}finishProcess(){this.#i.assertSanity(),this.#o.process(this.#i.getChannel(0),this.#i.getChannel(1))}toString(){return"{VaporisateurDevice}"}};var Ac=class{#e;#t;#r;#i;#n;#o;#a=0;#s;#l=0;constructor(e,t,n=0,i=0){this.#e=e,this.#t=t,this.#r=Math.round(.02*sampleRate),this.#o=n,this.#s=i,this.#o>=t.numberOfFrames?(this.#i=2,this.#n=0):n===0?(this.#i=1,this.#n=0):(this.#i=0,this.#n=1)}get readPosition(){return this.#o}done(){return this.#i===2}isFadingOut(){return this.#i===0&&this.#n<0}startFadeOut(e){this.#i!==2&&!(this.#i===0&&this.#n<0)&&(this.#i=0,this.#n=-1,this.#a=0,this.#l=e)}process(e,t,n){let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#r,d=s-p,h=this.#s,g=this.#l,v=this.#i,y=this.#n,x=this.#o,B=this.#a;for(let I=0;I<t&&v!==2;I++){if(I<h)continue;let O=e+I,z;if(v===0&&y>0)z=B/p,++B>=p&&(v=1,B=0,y=0);else if(v===0&&y<0){if(I<g)z=1;else if(z=1-B/p,++B>=p){v=2;break}}else z=1;if(x>=0&&x<s){let $=z*n[I];i[O]+=l[x]*$,o[O]+=u[x]*$}x++,v===1&&x>=d&&(v=0,y=-1,B=0)}this.#i=v,this.#n=y,this.#o=x,this.#a=B,this.#s=0,this.#l=0}};var Ks=class{#e;#t;#r;#i;#n;#o;#a=0;#s;#l;#c=0;constructor(e,t,n,i,o=0,a=0){this.#e=e,this.#t=t,this.#r=n,this.#s=i,this.#o=o,this.#l=a,this.#o>=t.numberOfFrames?(this.#i=2,this.#n=0):o===0?(this.#i=1,this.#n=0):(this.#i=0,this.#n=1)}get readPosition(){return this.#o}done(){return this.#i===2}isFadingOut(){return this.#i===0&&this.#n<0}startFadeOut(e){this.#i!==2&&!(this.#i===0&&this.#n<0)&&(this.#i=0,this.#n=-1,this.#a=0,this.#c=e)}setPlaybackRate(e){this.#s=e}process(e,t,n){let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#r,d=this.#s,h=s-p*d,g=this.#l,v=this.#c,y=this.#i,x=this.#n,B=this.#o,I=this.#a;for(let O=0;O<t&&y!==2;O++){if(O<g)continue;let z=e+O,$;if(y===0&&x>0)$=I/p,++I>=p&&(y=1,I=0,x=0);else if(y===0&&x<0){if(O<v)$=1;else if($=1-I/p,++I>=p){y=2;break}}else $=1;let ie=B|0;if(ie>=0&&ie<s-1){let ne=B-ie,le=l[ie],W=u[ie],xe=$*n[O];i[z]+=(le+ne*(l[ie+1]-le))*xe,o[z]+=(W+ne*(u[ie+1]-W))*xe}B+=d,y===1&&B>=h&&(y=0,x=-1,I=0)}this.#i=y,this.#n=x,this.#o=B,this.#a=I,this.#l=0,this.#c=0}};var Dp=class{#e;#t;#r;#i;#n;#o;#a=1;#s=0;#l=0;#c=0;#u=0;#p=0;constructor(e,t,n,i,o,a,s){this.#e=e,this.#t=t,this.#r=o,this.#o=i,this.#i=Math.round(.02*s),this.#n=1/this.#i,this.#c=n,this.#u=a,this.#p=0,n>0?(this.#a=0,this.#s=1,this.#l=0):(this.#a=1,this.#s=0,this.#l=0)}done(){return this.#a===2}isFadingOut(){return this.#a===0&&this.#s<0}readPosition(){return this.#c}segmentEnd(){return this.#o}setSegmentEnd(e){this.#o=e}startFadeOut(e){if(this.#a!==2&&!(this.#a===0&&this.#s<0)){if(this.#a===0&&this.#s>0){let t=this.#l*this.#n;this.#l=this.#i*(1-t)}else this.#l=0;this.#a=0,this.#s=-1,this.#p=e}}process(e,t,n){if(this.#a===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,d=this.#n,h=this.#r,g=this.#p,v=this.#a,y=this.#s,x=this.#l,B=this.#c;for(let I=this.#u;I<t&&v!==2;I++){let O=e+I,z;if(v===0){if(y>0)z=x*d,x+=1,x>=p&&(v=1,x=0,y=0);else if(I<g)z=1;else if(z=1-x*d,x+=1,x>=p){v=2;break}}else z=1;let $=B|0;if($>=0&&$<s-1){let ie=B-$,ne=l[$],le=u[$],W=z*n[I];i[O]+=(ne+ie*(l[$+1]-ne))*W,o[O]+=(le+ie*(u[$+1]-le))*W}B+=h}this.#a=v,this.#s=y,this.#l=x,this.#c=B,this.#u=0,this.#p=0}};var Nb=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u=1;#p=0;#d=0;#f=0;#h=0;#m=0;#g=0;#v=0;constructor(e,t,n,i,o,a,s,l){this.#e=e,this.#t=t,this.#r=o,this.#c=i;let u=.01*s,p=.02*s;this.#i=n+u,this.#n=i-p,this.#o=Math.round(.02*s),this.#a=1/this.#o,this.#s=Math.round(.01*s),this.#l=1/this.#s,this.#f=l??n,this.#g=a,this.#v=0,this.#h=0,this.#m=0,l!==void 0||n>0?(this.#u=0,this.#p=1,this.#d=0):(this.#u=1,this.#p=0,this.#d=0),this.#i>=this.#n&&(this.#u=2)}done(){return this.#u===2}isFadingOut(){return this.#u===0&&this.#p<0}readPosition(){return this.#f}segmentEnd(){return this.#c}setSegmentEnd(e){this.#c=e}startFadeOut(e){if(this.#u!==2&&!(this.#u===0&&this.#p<0)){if(this.#u===0&&this.#p>0){let t=this.#d*this.#a;this.#d=this.#o*(1-t)}else this.#d=0;this.#u=0,this.#p=-1,this.#v=e}}process(e,t,n){if(this.#u===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,h=this.#n-this.#s,g=this.#o,v=this.#a,y=this.#s,x=this.#l,B=this.#r,I=this.#v,O=this.#u,z=this.#p,$=this.#d,ie=this.#f,ne=this.#h,le=this.#m;for(let W=this.#g;W<t&&O!==2;W++){let xe=e+W,se;if(O===0){if(z>0)se=$*v,$+=1,$>=g&&(O=1,$=0,z=0);else if(W<I)se=1;else if(se=1-$*v,$+=1,$>=g){O=2;break}}else se=1;let Ee=0,Re=0,st=ie|0;if(st>=0&&st<s-1){let ye=ie-st,ke=l[st],lt=u[st];Ee=ke+ye*(l[st+1]-ke),Re=lt+ye*(u[st+1]-lt)}if(ne===0&&ie>=h&&(ne=1,le=p),ne>0){let ye=le|0;if(ye>=0&&ye<s-1){let ke=le-ye,lt=l[ye],Lr=u[ye],Wi=lt+ke*(l[ye+1]-lt),Ws=Lr+ke*(u[ye+1]-Lr),so=ne*x;Ee=Ee*(1-so)+Wi*so,Re=Re*(1-so)+Ws*so}le+=B,ne+=1,ne>=y&&(ie=le,ne=0)}let gt=se*n[W];i[xe]+=Ee*gt,o[xe]+=Re*gt,ie+=B}this.#u=O,this.#p=z,this.#d=$,this.#f=ie,this.#h=ne,this.#m=le,this.#g=0,this.#v=0}};var Lm=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=1;#u=0;#p=0;#d=0;#f=1;#h=0;#m=0;#g=0;#v=0;constructor(e,t,n,i,o,a,s,l){this.#e=e,this.#t=t,this.#r=o,this.#l=i;let u=.01*s,p=.02*s;this.#i=n+u,this.#n=i-p,this.#o=Math.round(.02*s),this.#a=1/this.#o,this.#s=Math.round(.01*s),this.#d=l?.position??n,this.#f=l?.direction??1,this.#g=a,this.#v=0,this.#h=0,this.#m=0,l!==void 0||n>0?(this.#c=0,this.#u=1,this.#p=0):(this.#c=1,this.#u=0,this.#p=0),this.#i>=this.#n&&(this.#c=2)}done(){return this.#c===2}isFadingOut(){return this.#c===0&&this.#u<0}readPosition(){return this.#d}segmentEnd(){return this.#l}setSegmentEnd(e){this.#l=e}startFadeOut(e){if(this.#c!==2&&!(this.#c===0&&this.#u<0)){if(this.#c===0&&this.#u>0){let t=this.#p*this.#a;this.#p=this.#o*(1-t)}else this.#p=0;this.#c=0,this.#u=-1,this.#v=e}}process(e,t,n){if(this.#c===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,d=this.#n,h=d-this.#s,g=p+this.#s,v=this.#o,y=this.#a,x=this.#s,B=this.#r,I=this.#v,O=this.#c,z=this.#u,$=this.#p,ie=this.#d,ne=this.#f,le=this.#h,W=this.#m;for(let xe=this.#g;xe<t&&O!==2;xe++){let se=e+xe,Ee;if(O===0){if(z>0)Ee=$*y,$+=1,$>=v&&(O=1,$=0,z=0);else if(xe<I)Ee=1;else if(Ee=1-$*y,$+=1,$>=v){O=2;break}}else Ee=1;let Re=0,st=0,gt=ie|0;if(gt>=0&&gt<s-1){let ke=ie-gt,lt=l[gt],Lr=u[gt];Re=lt+ke*(l[gt+1]-lt),st=Lr+ke*(u[gt+1]-Lr)}if(le===0&&(ne>0&&ie>=h?(le=1,W=d):ne<0&&ie<=g&&(le=1,W=p)),le>0){let ke=W|0;if(ke>=0&&ke<s-1){let lt=W-ke,Lr=l[ke],Wi=u[ke],Ws=Lr+lt*(l[ke+1]-Lr),so=Wi+lt*(u[ke+1]-Wi),Ec=le/x,Fn=Math.cos(Ec*Math.PI*.5),Mt=Math.sin(Ec*Math.PI*.5);Re=Re*Fn+Ws*Mt,st=st*Fn+so*Mt}W-=ne*B,le+=1,le>=x&&(ie=W,ne=-ne,le=0)}let ye=Ee*n[xe];i[se]+=Re*ye,o[se]+=st*ye,ie+=ne*B}this.#c=O,this.#u=z,this.#p=$,this.#d=ie,this.#f=ne,this.#h=le,this.#m=W,this.#g=0,this.#v=0}};var Ib=class{#e=[];#t=-1;#r=0;constructor(){}get voiceCount(){return this.#e.length}reset(){for(let e of this.#e)e.startFadeOut(0);this.#t=-1,this.#r=0}process(e,t,n,i,o,a,s,l){let{p0:u,p1:p,bpm:d,flags:h}=a,g=i.warpMarkers,v=i.transientPlayMode,y=i.playbackRate,{sampleRate:x,numberOfFrames:B}=t,I=B/x;St.some(h,2)&&this.reset();let O=p-u,z=a.s0,ie=a.s1-z,ne=(s.resultStart-u)/O,le=(s.resultEnd-u)/O,W=z+ie*ne|0,se=(z+ie*le|0)-W,Ee=g.first(),Re=g.last();if(!Ct(Ee)||!Ct(Re))return;let st=s.resultStart-s.rawStart;if(st<Ee.position||st>=Re.position)return;let gt=st+O,ye=this.#o(gt,g);if(!Ct(ye))return;let ke=ye+o;if(ke<0||ke>=I)return;let lt=this.#o(st,g)??0,Lr=ye-lt,Wi=O/(960*d/60),Ws=Wi>0?Lr/Wi:1,so=.02*Ws*y*(t.sampleRate/x),Ec=ke+so,Fn=n.floorLastIndex(Ec);if(Fn<this.#t&&this.reset(),Fn>this.#t&&Fn>=0){let Mt=n.optAt(Fn);Ct(Mt)&&(this.#i(e,t,n,g,v,y,o,d,x,Fn,Mt.position),this.#t=Fn)}for(let Mt of this.#e){if(!(Mt instanceof Dp)||Mt.done()||Mt.isFadingOut())continue;let Bn=Mt.readPosition(),Fc=Mt.segmentEnd();if(Bn>=Fc){Mt.startFadeOut(0);continue}if(v!==qa.Once){let Bc=this.#n(n,this.#t,t);if(Ct(Bc)){let{startSamples:qm,endSamples:Nc,hasNext:$0,nextTransientFileSeconds:Hm}=Bc,lo=Nc-qm,Tp=Number.POSITIVE_INFINITY;if($0){let Yo=n.optAt(this.#t);if(Ct(Yo)){let kF=Yo.position-o,T0=this.#a(kF,g),Qm=Hm-o,R0=this.#a(Qm,g)-T0;Tp=J.pulsesToSeconds(R0,d)*x}}let Jm=Tp*y,Rp=lo/Jm;if(!(Rp>=.99&&Rp<=1.01)&&Jm>lo){Mt.startFadeOut(0);let Yo=this.#s(e,t,qm,Nc,y,0,x,v,!0,Bn);Ct(Yo)&&this.#e.push(Yo);continue}}}let Da=(Fc-Bn)/y;if(Da<se){let Bc=Math.max(0,Math.floor(Da));Mt.startFadeOut(Bc)}}for(let Mt of this.#e)Mt.process(W,se,l);for(let Mt=this.#e.length-1;Mt>=0;Mt--)this.#e[Mt].done()&&this.#e.splice(Mt,1)}#i(e,t,n,i,o,a,s,l,u,p,d){let h=this.#n(n,p,t);if(!Ct(h))return;let{startSamples:g,endSamples:v,hasNext:y,nextTransientFileSeconds:x}=h,B=v-g,I=Number.POSITIVE_INFINITY;if(y){let Re=d-s,st=this.#a(Re,i),gt=x-s,ke=this.#a(gt,i)-st;I=J.pulsesToSeconds(ke,l)*u}let O=.02*u,z=.02*t.sampleRate*a,$=null;for(let Re of this.#e){if(Re.done()||!(Re instanceof Dp))continue;let gt=Re.readPosition()+z-g;if(!(Math.abs(gt)>=O)){this.#r+=gt,Math.abs(this.#r)<O?($=Re,Re.setSegmentEnd(v)):this.#r=0;break}}if(Ct($)){for(let Re of this.#e)Re!==$&&!Re.done()&&Re.startFadeOut(0);return}for(let Re of this.#e)Re.done()||Re.startFadeOut(0);let ie=I*a,ne=B/ie,W=!(ne>=.99&&ne<=1.01)&&ie>B,xe=.02*t.sampleRate*a,se=p===0?g:Math.max(0,g-xe),Ee=this.#s(e,t,se,v,a,0,u,o,W);Ct(Ee)&&this.#e.push(Ee),this.#r=0}#n(e,t,n){let i=e.optAt(t);if(!Ct(i))return null;let o=e.optAt(t+1);return{startSamples:i.position*n.sampleRate,endSamples:Ct(o)?o.position*n.sampleRate:n.numberOfFrames,hasNext:Ct(o),nextTransientFileSeconds:Ct(o)?o.position:Number.POSITIVE_INFINITY}}#o(e,t){for(let n=0;n<t.length()-1;n++){let i=t.optAt(n),o=t.optAt(n+1);if(!(!Ct(i)||!Ct(o))&&e>=i.position&&e<o.position){let a=(e-i.position)/(o.position-i.position);return i.seconds+a*(o.seconds-i.seconds)}}return null}#a(e,t){for(let i=0;i<t.length()-1;i++){let o=t.optAt(i),a=t.optAt(i+1);if(!(!Ct(o)||!Ct(a))&&e>=o.seconds&&e<a.seconds){let s=(e-o.seconds)/(a.seconds-o.seconds);return o.position+s*(a.position-o.position)}}let n=t.last();return Ct(n)&&e>=n.seconds?n.position:0}#s(e,t,n,i,o,a,s,l,u,p){return n>=i?null:l===qa.Once||!u?new Dp(e,t,n,i,o,a,s):l===qa.Repeat?new Nb(e,t,n,i,o,a,s,p):q(p)?new Lm(e,t,n,i,o,a,s,{position:p,direction:1}):new Lm(e,t,n,i,o,a,s)}};var Db=class extends gr{#e;#t;#r;#i;#n=new Float32Array(fe);#o=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Ae(2),this.#r=this.own(new Be(e.broadcaster,t.address)),this.#i=b.newSet(({adapter:{uuid:n}})=>n),this.ownAll(this.#e.box.enabled.catchupAndSubscribe(n=>{this.#o=n.getValue(),this.#o||this.reset()}),this.#e.deviceHost().audioUnitBoxAdapter().tracks.catchupAndSubscribe({onAdd:n=>this.#i.add({adapter:n,voices:[],sequencer:new Ib}),onRemove:n=>this.#i.removeByKey(n.uuid),onReorder:n=>{}}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this.outgoing))}get noteEventTarget(){return m.None}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}get audioOutput(){return this.#t}reset(){this.#r.clear(),this.#t.clear(),this.eventInput.clear(),this.#i.forEach(e=>{e.voices=[],e.sequencer.reset()})}process({blocks:e}){if(!this.#o)return;this.#t.clear(0,fe),this.#i.forEach(i=>e.forEach(o=>this.#a(i,o))),this.#t.assertSanity();let[t,n]=this.#t.channels();this.#r.process(t,n)}parameterChanged(e){}#a(e,t){let{adapter:n}=e;if(n.type!==me.Audio||!n.enabled.getValue()){e.voices.forEach(l=>l.startFadeOut(0)),e.sequencer.reset();return}let{p0:i,p1:o,flags:a}=t;if(!St.every(a,5))return;let s=this.context.clipSequencing.iterate(n.uuid,i,o);for(let{optClip:l,sectionFrom:u,sectionTo:p}of s)l.match({none:()=>{for(let d of n.regions.collection.iterateRange(i,o)){if(d.mute||!pt(d,ha))continue;let h=d.file,g=h.getOrCreateLoader().data;if(g.isEmpty())return;let v=d.waveformOffset.getValue(),y=d.asPlayModeTimeStretch;if(y.nonEmpty()){let x=h.transients;if(x.length()<2)return;for(let B of kr.locateLoops(d,i,o)){let I=y.unwrap();this.#u(e,t,B,g.unwrap(),I,x,v,d.fading,d.position,d.duration)}}else for(let x of kr.locateLoops(d,i,o))this.#s(e,t,x,d,g.unwrap())}},some:d=>{if(!pt(d,is))return;let h=d.file,g=h.getOrCreateLoader().data;if(g.isEmpty())return;let v=d.asPlayModeTimeStretch;if(v.nonEmpty()){let y=v.unwrap(),x=h.transients;if(x.length()<2)return;for(let B of kr.locateLoops({position:0,loopDuration:d.duration,loopOffset:0,complete:Number.POSITIVE_INFINITY},u,p))this.#u(e,t,B,g.unwrap(),y,x,d.waveformOffset.getValue(),null,0,d.duration)}else for(let y of kr.locateLoops({position:0,loopDuration:d.duration,loopOffset:0,complete:Number.POSITIVE_INFINITY},u,p))this.#s(e,t,y,d,g.unwrap())}})}#s(e,t,n,i,o){let{p0:a,p1:s,s0:l,s1:u,flags:p}=t,d=u-l,h=s-a,g=(n.resultStart-a)/h,v=(n.resultEnd-a)/h,y=l+d*g,x=l+d*v,B=x-y|0,I=i.waveformOffset.getValue();V(l<=y&&x<=u,()=>`Out of bounds ${y}, ${x}`),St.some(p,2)&&(e.voices.forEach(z=>z.startFadeOut(0)),e.sequencer.reset());let O=i.asPlayModePitchStretch;if(i.isPlayModeNoStretch){let $=(this.context.tempoMap.intervalToSeconds(n.rawStart,n.resultStart)+I)*o.sampleRate|0;this.#l(e,o,$,0)}else if(O.isEmpty()){let z=o.numberOfFrames,ie=(n.resultEndValue-n.resultStartValue)*z,ne=(n.resultEnd-n.resultStart)/h*d,le=ie/ne,W=n.resultStartValue*o.numberOfFrames+I*o.sampleRate;this.#c(e,o,le,W,0)}else{let $=O.unwrap().warpMarkers,ie=$.first(),ne=$.last();if(ie===null||ne===null){e.voices.forEach(Ee=>Ee.startFadeOut(0));return}let le=n.resultStart-n.rawStart;if(le<ie.position||le>=ne.position){e.voices.forEach(Ee=>Ee.startFadeOut(0));return}let W=this.#d(le,n.resultStartValue,$),xe=this.#p(le,$,o.sampleRate,h,d),se=(W+I)*o.sampleRate;this.#c(e,o,xe,se,0)}if(pt(i,ha)&&i.fading.hasFading){let z=i.position,$=i.duration,ie=n.resultStart-z,ne=n.resultEnd-z;Ca.fillGainBuffer(this.#n,ie,ne,$,B,i.fading)}else this.#n.fill(1,0,B);for(let z of e.voices)z.process(y|0,B,this.#n);e.voices=e.voices.filter(z=>!z.done())}#l(e,t,n,i){let o=Math.round(.02*t.sampleRate),a=!1;for(let s of e.voices)s instanceof Ac&&!s.isFadingOut()?Math.abs(s.readPosition-n)>o?s.startFadeOut(i):a=!0:s.startFadeOut(i);a||e.voices.push(new Ac(this.#t,t,n,i))}#c(e,t,n,i,o){let a=Math.round(.02*t.sampleRate);if(e.voices.length===0)e.voices.push(new Ks(this.#t,t,a,n,i,o));else{let s=!1;for(let l of e.voices)if(l instanceof Ks){if(l.isFadingOut())continue;Math.abs(l.readPosition-i)>a?l.startFadeOut(o):(l.setPlaybackRate(n),s=!0)}else l.startFadeOut(o);s||e.voices.push(new Ks(this.#t,t,a,n,i,o))}}#u(e,t,n,i,o,a,s,l,u,p){for(let ie of e.voices)(ie instanceof Ks||ie instanceof Ac)&&ie.startFadeOut(0);let{p0:d,p1:h,s0:g,s1:v}=t,y=v-g,x=h-d,B=(n.resultStart-d)/x,I=(n.resultEnd-d)/x,O=g+y*B,$=g+y*I-O|0;if(l!==null&&Ca.hasFading(l)){let ie=n.resultStart-u,ne=n.resultEnd-u;Ca.fillGainBuffer(this.#n,ie,ne,p,$,l)}else this.#n.fill(1,0,$);e.sequencer.process(this.#t,i,a,o,s,t,n,this.#n),e.voices=e.voices.filter(ie=>(ie instanceof Ks||ie instanceof Ac)&&!ie.done())}#p(e,t,n,i,o){let a=t.floorLastIndex(e),s=t.optAt(a),l=t.optAt(a+1);if(s===null||l===null)return 1;let u=l.position-s.position,h=(l.seconds-s.seconds)*n/u,g=o/i;return h/g}#d(e,t,n){let i=n.floorLastIndex(e),o=n.optAt(i),a=n.optAt(i+1);if(o===null||a===null)return t;let s=(e-o.position)/(a.position-o.position);return o.seconds+s*(a.seconds-o.seconds)}};var Ai=class extends gr{process({blocks:e}){e.forEach(t=>{this.introduceBlock(t);let{index:n,p0:i,p1:o,s0:a,bpm:s}=t,l=null,u=i;for(let p of this.eventInput.get(n))l?.forEach(d=>this.handleEvent(t,d)),l=null,u<p.position&&(this.processEvents(t,u,p.position),u=p.position),Vm.isOfType(p)?this.updateParameters(p.position,a/sampleRate+J.pulsesToSeconds(p.position-i,s)):(l??=[]).push(p);l?.forEach(p=>this.handleEvent(t,p)),l=null,u<o&&this.processEvents(t,u,o)}),this.eventInput.clear()}introduceBlock(e){}};var Mp;(t=>(t.create=()=>({mult:1,add:0}),t.apply=(n,i)=>i*n.mult+n.add))(Mp||={});var Mb=Object.freeze([{name:"up",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=t%a,u=Math.floor(t%s/a),p=r[l];return Fe.start(n,i,p.pitch+u*12,Mp.apply(o,p.velocity))}},{name:"down",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=a-1-t%a,u=e-1-Math.floor(t%s/a),p=r[l];return Fe.start(n,i,p.pitch+u*12,Mp.apply(o,p.velocity))}},{name:"up-down",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=Math.max(1,s*2-2),u=t%l,p=u<s?u:l-u,d=p%a,h=Math.floor(p/a),g=r[d];return Fe.start(n,i,g.pitch+h*12,Mp.apply(o,g.velocity))}}]);var kb=class extends Ai{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=Mp.create();#u=m.None;#p=Mb[0];#d=NaN;#f=1;#h=1;#m=1;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Qs,this.#i=this.own(this.bindParameter(t.namedParameter.modeIndex)),this.#n=this.own(this.bindParameter(t.namedParameter.rate)),this.#o=this.own(this.bindParameter(t.namedParameter.gate)),this.#a=this.own(this.bindParameter(t.namedParameter.repeat)),this.#s=this.own(this.bindParameter(t.namedParameter.numOctaves)),this.#l=this.own(this.bindParameter(t.namedParameter.velocity)),this.ownAll(e.registerProcessor(this)),this.readAllParameters()}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}get noteEventTarget(){return m.wrap(this)}setNoteEventSource(e){return V(this.#u.isEmpty(),"NoteEventSource already set"),this.#u=m.wrap(e),ee.create(()=>this.#u=m.None)}*processNotes(e,t,n){if(this.#r.nonEmpty())if(St.every(n,2))for(let o of this.#r.releaseAll())yield Fe.stop(o,e);else for(let o of this.#r.releaseLinearCompleted(t))yield Fe.stop(o,o.position+o.duration);if(this.#u.nonEmpty()){let i=this.#u.unwrap();for(let a of i.processNotes(e,t,n));let o=!St.every(n,1);for(let{position:a,index:s}of Oa.iterateWithIndex(e,t,this.#d)){let l=Array.from(i.iterateActiveNotesAt(a,o));if(l.length===0)continue;let u=Math.floor(s/this.#h),p=Math.max(1,Math.floor(this.#d*this.#f)),d=this.#p.run(l,this.#m,u,a,p,this.#c);this.#r.addAndRetain({...d}),yield d}for(let a of this.#r.releaseLinearCompleted(t))yield Fe.stop(a,a.position+a.duration)}}*iterateActiveNotesAt(e,t){this.#u.isEmpty()||t||(yield*this.#r.overlapping(e,$r.Comparator))}reset(){this.#t.length=0,this.#r.clear(),this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){if(e===this.#i)this.#p=Mb.at(this.#i.getValue())??Mb[0];else if(e===this.#n)this.#d=wr.toPPQN(Hn.RateFractions[this.#n.getValue()]);else if(e===this.#o)this.#f=this.#o.getValue();else if(e===this.#a)this.#h=this.#a.getValue();else if(e===this.#s)this.#m=this.#s.getValue();else if(e===this.#l){let t=this.#l.getValue();t<=0?(this.#c.add=1+t,this.#c.mult=0):(this.#c.add=1-t,this.#c.mult=t)}}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var $b=class extends Ai{#e;#t;#r;#i;#n;#o=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.#r=this.own(this.bindParameter(t.namedParameter.octaves)),this.#i=this.own(this.bindParameter(t.namedParameter.semiTones)),this.#n=this.own(this.bindParameter(t.namedParameter.cent)),this.own(e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#o.isEmpty(),"NoteEventSource already set"),this.#o=m.wrap(e),ee.create(()=>this.#o=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#o.isEmpty())for(let i of this.#o.unwrap().processNotes(e,t,n))if(Fe.isStart(i)){this.#t.noteOn(i.pitch);let{cent:o,octaves:a,semiTones:s}=this.#e.namedParameter;yield _i.overwrite(i,{pitch:i.pitch+a.valueAt(i.position)*12+s.valueAt(i.position),cent:i.cent+o.valueAt(i.position)})}else this.#t.noteOff(i.pitch),yield i}*iterateActiveNotesAt(e,t){if(!this.#o.isEmpty()){for(let n of this.#o.unwrap().iterateActiveNotesAt(e,t))if(n.type==="note-event"){let{cent:i,octaves:o,semiTones:a}=this.#e.namedParameter;yield _i.overwrite(n,{pitch:n.pitch+o.valueAt(n.position)*12+a.valueAt(n.position),cent:n.cent+i.valueAt(n.position)})}}}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var Tb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$;#T;#N;#R;#C;#O=m.None;#V=!1;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new ka,this.#o=new Float32Array(this.#n.numBins()),this.#a=U.create(()=>new vo,7),this.#s=[new Ta(4),new Ta(4)],this.#l=[new Ta(4),new Ta(4)],this.#c=[this.#l,[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],this.#s],this.#u=U.create(()=>!0,7);let n=this.#t.namedParameter;this.#p=this.own(this.bindParameter(n.highPass.enabled)),this.#f=this.own(this.bindParameter(n.highPass.q)),this.#d=this.own(this.bindParameter(n.highPass.frequency)),this.#h=this.own(this.bindParameter(n.highPass.order)),this.#m=this.own(this.bindParameter(n.lowShelf.enabled)),this.#g=this.own(this.bindParameter(n.lowShelf.frequency)),this.#v=this.own(this.bindParameter(n.lowShelf.gain)),this.#w=this.own(this.bindParameter(n.lowBell.enabled)),this.#A=this.own(this.bindParameter(n.lowBell.frequency)),this.#_=this.own(this.bindParameter(n.lowBell.gain)),this.#E=this.own(this.bindParameter(n.lowBell.q)),this.#F=this.own(this.bindParameter(n.midBell.enabled)),this.#b=this.own(this.bindParameter(n.midBell.frequency)),this.#y=this.own(this.bindParameter(n.midBell.gain)),this.#x=this.own(this.bindParameter(n.midBell.q)),this.#S=this.own(this.bindParameter(n.highBell.enabled)),this.#I=this.own(this.bindParameter(n.highBell.frequency)),this.#M=this.own(this.bindParameter(n.highBell.gain)),this.#k=this.own(this.bindParameter(n.highBell.q)),this.#D=this.own(this.bindParameter(n.highShelf.enabled)),this.#B=this.own(this.bindParameter(n.highShelf.frequency)),this.#$=this.own(this.bindParameter(n.highShelf.gain)),this.#T=this.own(this.bindParameter(n.lowPass.enabled)),this.#N=this.own(this.bindParameter(n.lowPass.frequency)),this.#R=this.own(this.bindParameter(n.lowPass.q)),this.#C=this.own(this.bindParameter(n.lowPass.order)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.spectrum,this.#o,i=>{this.#V=i,i&&(this.#o.set(this.#n.bins()),this.#n.decay=!0)})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#r.clear(),this.#c.forEach(e=>e.forEach(t=>t.reset())),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#O=m.wrap(e),{terminate:()=>this.#O=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#O.isEmpty())return;let[i,o]=this.#r.channels(),a=this.#O.unwrap();if(this.#u.some(s=>s)){let[s,l]=a.channels();this.#a.forEach((u,p)=>{if(this.#u[p]){let[d,h]=this.#c[p];d.process(u,s,i,t,n),h.process(u,l,o,t,n),s=i,l=o}})}else{let[s,l]=a.channels();for(let u=t;u<n;u++)i[u]=s[u],o[u]=l[u]}this.#i.process(i,o,t,n),this.#V&&this.#n.process(i,o,t,n)}parameterChanged(e){if(e===this.#C){let n=this.#C.getValue()+1;this.#s[0].order=n,this.#s[1].order=n}else if(e===this.#h){let n=this.#h.getValue()+1;this.#l[0].order=n,this.#l[1].order=n}else if(e===this.#d||e===this.#f){let t=this.#d.getValue(),n=this.#f.getValue();this.#a[0].setHighpassParams(t/sampleRate,n)}else if(e===this.#g||e===this.#v){let t=this.#g.getValue(),n=this.#v.getValue();this.#a[1].setLowShelfParams(t/sampleRate,n)}else if(e===this.#A||e===this.#_||e===this.#E){let t=this.#A.getValue(),n=this.#_.getValue(),i=this.#E.getValue();this.#a[2].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#b||e===this.#y||e===this.#x){let t=this.#b.getValue(),n=this.#y.getValue(),i=this.#x.getValue();this.#a[3].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#I||e===this.#M||e===this.#k){let t=this.#I.getValue(),n=this.#M.getValue(),i=this.#k.getValue();this.#a[4].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#B||e===this.#$){let t=this.#B.getValue(),n=this.#$.getValue();this.#a[5].setHighShelfParams(t/sampleRate,n)}else if(e===this.#N||e===this.#R){let t=this.#N.getValue(),n=this.#R.getValue();this.#a[6].setLowpassParams(t/sampleRate,n)}else e===this.#p?this.#u[0]=this.#p.getValue():e===this.#m?this.#u[1]=this.#m.getValue():e===this.#w?this.#u[2]=this.#w.getValue():e===this.#F?this.#u[3]=this.#F.getValue():e===this.#S?this.#u[4]=this.#S.getValue():e===this.#D?this.#u[5]=this.#D.getValue():e===this.#T&&(this.#u[6]=this.#T.getValue())}toString(){return`{${this.constructor.name} (${this.#e})`}};var Rb=class{roomSize;damp;predelayInSamples;wetGain;dryGain;#e=new Float32Array(2048);#t=new Float32Array(2048);#r=new Float32Array(2048);#i=new Float32Array(2048);#n=new Float32Array(2048);#o=new Float32Array(2048);#a=new Float32Array(2048);#s=new Float32Array(2048);#l=new Float32Array(1024);#c=new Float32Array(512);#u=new Float32Array(512);#p=new Float32Array(256);#d=new Float32Array(2048);#f=new Float32Array(2048);#h=new Float32Array(2048);#m=new Float32Array(2048);#g=new Float32Array(2048);#v=new Float32Array(2048);#w=new Float32Array(2048);#A=new Float32Array(2048);#_=new Float32Array(1024);#E=new Float32Array(512);#F=new Float32Array(512);#b=new Float32Array(256);#y;#x;#S=0;#I=0;#M=0;#k=0;#D=0;#B=0;#$=0;#T=0;#N=0;#R=0;#C=0;#O=0;#V=0;#W=0;#U=0;#j=0;#z=0;#L=0;#Z=0;#G=0;#q=0;#H=0;#J=0;#Q=0;#K=0;#X=0;#ee=0;#te=0;#re=0;#ie=0;#ne=0;#oe=0;#ae=0;#se=0;#le=0;#ce=0;#ue=0;#de=0;#pe=0;#he=0;#P=0;#Y=0;constructor(e=.5){this.#y=mo(Math.ceil(e*sampleRate)),this.#x=new Float32Array(this.#y<<1),this.damp=0,this.roomSize=.5,this.wetGain=.3333,this.dryGain=1-this.wetGain,this.#P=0,this.#Y=0,this.predelayInSamples=.008*sampleRate,this.clearHistory()}clear(){this.#P=0,this.#Y=0,this.clearHistory(),this.clearBuffers()}process(e,t,n,i){let[o,a]=t.channels(),[s,l]=e.channels(),u=.4*this.damp,p=1-u,d=.7+.28*this.roomSize;for(let h=n;h<i;++h){let g=o[h],v=a[h],y=this.#Y-this.predelayInSamples;y<0&&(y+=this.#y);let x;x=y<<1;let B=.01,I=this.#x[x]*B,O=this.#x[x+1]*B;x=this.#Y<<1,this.#x[x]=g,this.#x[x+1]=v,this.#Y=this.#Y+1&this.#y-1;let z=this.#P&2047;this.#S=p*this.#I+u*this.#S,this.#e[z]=I+d*this.#S,this.#I=this.#e[this.#P-1617&2047],this.#M=p*this.#k+u*this.#M,this.#t[z]=I+d*this.#M,this.#k=this.#t[this.#P-1557&2047],this.#D=p*this.#B+u*this.#D,this.#r[z]=I+d*this.#D,this.#B=this.#r[this.#P-1491&2047],this.#$=p*this.#T+u*this.#$,this.#i[z]=I+d*this.#$,this.#T=this.#i[this.#P-1422&2047],this.#N=p*this.#R+u*this.#N,this.#n[z]=I+d*this.#N,this.#R=this.#n[this.#P-1356&2047],this.#C=p*this.#O+u*this.#C,this.#o[z]=I+d*this.#C,this.#O=this.#o[this.#P-1277&2047],this.#V=p*this.#W+u*this.#V,this.#a[z]=I+d*this.#V,this.#W=this.#a[this.#P-1188&2047],this.#U=p*this.#j+u*this.#U,this.#s[z]=I+d*this.#U,this.#j=this.#s[this.#P-1116&2047];let $=this.#j+this.#W+this.#O+this.#R+this.#T+this.#B+this.#k+this.#I,ie=this.#z-$,ne=this.#L-ie,le=this.#Z-ne;this.#l[this.#P&1023]=$+.5*this.#z,this.#z=this.#l[this.#P-556&1023],this.#c[this.#P&511]=ie+.5*this.#L,this.#L=this.#c[this.#P-441&511],this.#u[this.#P&511]=ne+.5*this.#Z,this.#Z=this.#u[this.#P-341&511],this.#p[this.#P&255]=le+.5*this.#G,this.#G=this.#p[this.#P-225&255],s[h]=this.dryGain*g+this.wetGain*(this.#G-le),this.#q=p*this.#H+u*this.#q,this.#d[z]=O+d*this.#q,this.#H=this.#d[this.#P-1640&2047],this.#J=p*this.#Q+u*this.#J,this.#f[z]=O+d*this.#J,this.#Q=this.#f[this.#P-1580&2047],this.#K=p*this.#X+u*this.#K,this.#h[z]=O+d*this.#K,this.#X=this.#h[this.#P-1514&2047],this.#ee=p*this.#te+u*this.#ee,this.#m[z]=O+d*this.#ee,this.#te=this.#m[this.#P-1445&2047],this.#re=p*this.#ie+u*this.#re,this.#g[z]=O+d*this.#re,this.#ie=this.#g[this.#P-1379&2047],this.#ne=p*this.#oe+u*this.#ne,this.#v[z]=O+d*this.#ne,this.#oe=this.#v[this.#P-1300&2047],this.#ae=p*this.#se+u*this.#ae,this.#w[z]=O+d*this.#ae,this.#se=this.#w[this.#P-1211&2047],this.#le=p*this.#ce+u*this.#le,this.#A[z]=O+d*this.#le,this.#ce=this.#A[this.#P-1139&2047];let W=this.#ce+this.#se+this.#oe+this.#ie+this.#te+this.#X+this.#Q+this.#H,xe=this.#ue-W,se=this.#de-xe,Ee=this.#pe-se;this.#_[this.#P&1023]=W+.5*this.#ue,this.#ue=this.#_[this.#P-579&1023],this.#E[this.#P&511]=xe+.5*this.#de,this.#de=this.#E[this.#P-464&511],this.#F[this.#P&511]=se+.5*this.#pe,this.#pe=this.#F[this.#P-364&511],this.#b[this.#P&255]=Ee+.5*this.#he,this.#he=this.#b[this.#P-248&255],l[h]=this.dryGain*v+this.wetGain*(this.#he-Ee),this.#P++}}clearBuffers(){this.#e.fill(0),this.#t.fill(0),this.#r.fill(0),this.#i.fill(0),this.#n.fill(0),this.#o.fill(0),this.#a.fill(0),this.#s.fill(0),this.#l.fill(0),this.#c.fill(0),this.#u.fill(0),this.#p.fill(0),this.#d.fill(0),this.#f.fill(0),this.#h.fill(0),this.#m.fill(0),this.#g.fill(0),this.#v.fill(0),this.#w.fill(0),this.#A.fill(0),this.#_.fill(0),this.#E.fill(0),this.#F.fill(0),this.#b.fill(0),this.#x.fill(0)}clearHistory(){this.#S=0,this.#I=0,this.#M=0,this.#k=0,this.#D=0,this.#B=0,this.#$=0,this.#T=0,this.#N=0,this.#R=0,this.#C=0,this.#O=0,this.#V=0,this.#W=0,this.#U=0,this.#j=0,this.#z=0,this.#L=0,this.#Z=0,this.#G=0,this.#q=0,this.#H=0,this.#J=0,this.#Q=0,this.#K=0,this.#X=0,this.#ee=0,this.#te=0,this.#re=0,this.#ie=0,this.#ne=0,this.#oe=0,this.#ae=0,this.#se=0,this.#le=0,this.#ce=0,this.#ue=0,this.#de=0,this.#pe=0,this.#he=0}};var Cb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new Rb;let{decay:n,preDelay:i,damp:o,wet:a,dry:s}=this.#t.namedParameter;this.#o=this.own(this.bindParameter(n)),this.#a=this.own(this.bindParameter(i)),this.#s=this.own(this.bindParameter(o)),this.#l=this.own(this.bindParameter(a)),this.#c=this.own(this.bindParameter(s)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#u=m.wrap(e),{terminate:()=>this.#u=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#u.isEmpty())return;this.#n.process(this.#r,this.#u.unwrap(),t,n);let[i,o]=this.#r.channels();this.#i.process(i,o,t,n)}parameterChanged(e){this.#o===e?this.#n.roomSize=this.#o.getValue():this.#a===e?this.#n.predelayInSamples=Math.ceil(this.#a.getValue()*sampleRate):this.#s===e?this.#n.damp=this.#s.getValue():this.#l===e?this.#n.wetGain=Pe(this.#l.getValue()):this.#c===e&&(this.#n.dryGain=Pe(this.#c.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})`}};var Ob=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s=!0;gain=1;release=1;loader=m.None;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Ae,this.#i=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#n=this.own(new Be(e.broadcaster,t.address)),this.#o=this.own(this.bindParameter(this.#e.namedParameter.volume)),this.#a=this.own(this.bindParameter(this.#e.namedParameter.release)),this.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#s=n.getValue(),this.#s||this.reset()}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),t.box.file.catchupAndSubscribe(n=>this.loader=n.targetVertex.map(({box:i})=>e.sampleManager.getOrCreate(i.address.uuid)))),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}get noteEventTarget(){return m.wrap(this)}introduceBlock(e){this.#i.introduceBlock(e)}setNoteEventSource(e){return this.#i.setNoteEventSource(e)}reset(){this.#t.length=0,this.#r.clear(),this.eventInput.clear(),this.#i.clear(),this.#n.clear()}get uuid(){return this.#e.uuid}get audioOutput(){return this.#r}get adapter(){return this.#e}handleEvent(e){Fe.isStart(e)?this.#t.push(new AF(this,e)):Fe.isStop(e)&&this.#t.find(t=>t.event().id===e.id)?.stop()}processAudio(e,t,n){if(this.#s){this.#r.clear(t,n);for(let i=this.#t.length-1;i>=0;i--)this.#t[i].processAdd(this.#r,t,n)&&this.#t.splice(i,1)}}parameterChanged(e){e===this.#o?this.gain=Pe(this.#o.getValue()):e===this.#a&&(this.release=this.#a.getValue()*sampleRate)}finishProcess(){this.#r.assertSanity(),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1))}terminate(){super.terminate(),this.loader=m.None}toString(){return"{NanoDevice}"}},AF=class{#e;#t;#r=1;#i=0;#n=.003*sampleRate|0;#o=0;#a=Number.POSITIVE_INFINITY;constructor(e,t){this.#e=e,this.#t=t,this.#r=Math.pow(2,(t.pitch+t.cent/100)/12-5)}event(){return this.#t}stop(){this.#a=this.#o}processAdd(e,t,n){let i=this.#e.loader;if(i.isEmpty())return!0;let o=i.unwrap();return o.data.isEmpty()?!0:this.processSimple(e.channels(),o.data.unwrap(),t,n)}processSimple(e,t,n,i){let[o,a]=e,s=t.frames[0],l=t.frames[1]??s,u=t.numberOfFrames,p=t.sampleRate/sampleRate,d=this.#e.gain*this.#t.velocity,h=this.#e.release,g=1/h;for(let v=n;v<i;v++){let y=this.#i|0;if(y>=u-1)return!0;let x=this.#i-y,B=this.#o<this.#n?this.#o/this.#n:1,I=(Math.min(1-(this.#o-this.#a)*g,1)*B)**2,O=s[y]*(1-x)+s[y+1]*x,z=l[y]*(1-x)+l[y+1]*x;if(o[v]+=O*d*I,a[v]+=z*d*I,this.#i+=this.#r*p,++this.#o-this.#a>h)return!0}return!1}};var Vb=class extends Ai{#e;#t;#r=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Qo(this,e.broadcaster,t.adapter.audioUnitBoxAdapter().address),this.own(e.registerProcessor(this)),this.readAllParameters()}setEnabled(e){this.#r=e,e||this.reset()}introduceBlock(e){this.#t.introduceBlock(e)}setNoteEventSource(e){return this.#t.setNoteEventSource(e)}reset(){this.eventInput.clear(),this.#t.clear()}processEvents(e,t,n){}handleEvent({index:e},t){this.#r&&(Fe.isStart(t)?this.#e.optSampleProcessor(t.pitch).ifSome(({eventInput:n})=>n.add(e,t)):Fe.isStop(t)&&this.#e.optSampleProcessor(t.pitch).ifSome(({eventInput:n})=>n.add(e,t)))}toString(){return"{PlayfieldSequencer}"}};var zb=class extends Ve{#e;#t;#r;#i;#n;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=this.own(new Be(e.broadcaster,t.adapter.address)),this.#i=[],this.#n=new Np,this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.adapter.address,this.#t,this.outgoing)),this.readAllParameters()}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}setAudioSource(e){return this.#i.push(e),{terminate:()=>{U.remove(this.#i,e),this.#t.clear()}}}get audioOutput(){return this.#t}get eventInput(){return this.#n}processAudio(e,t,n){}reset(){this.#r.clear()}finishProcess(){this.#t.clear();let[e,t]=this.#t.channels();for(let n of this.#i){let[i,o]=n.channels();for(let a=0;a<fe;a++)e[a]+=i[a],t[a]+=o[a]}this.#t.assertSanity(),this.#r.process(this.#t.getChannel(0),this.#t.getChannel(1))}toString(){return"{PlayfieldMixProcessor}"}};var Ub=class r{static create(e,t,n,i){return new r(e,t,n,i)}#e=new j;#t;#r;#i=[];#n=!0;constructor(e,t,n,i){this.#t=b.newSet(({device:o})=>o.uuid),this.#r=this.#e.own(new j),this.#e.ownAll(t.catchupAndSubscribe({onAdd:o=>{this.invalidateWiring();let a=Km.create(e,o.box),s=this.#t.add({device:a,subscription:a.adapter().enabledField.subscribe(()=>this.invalidateWiring())});V(s,"Could not add.")},onRemove:o=>{this.invalidateWiring();let{device:a,subscription:s}=this.#t.removeByKey(o.uuid);s.terminate(),a.terminate()},onReorder:o=>this.invalidateWiring()}),e.subscribeProcessPhase(o=>{if(o===0&&this.#n){let a=n;U.replace(this.#i,t.adapters().map(({uuid:s})=>this.#t.get(s).device));for(let s of this.#i)s.adapter().enabledField.getValue()&&(this.#r.own(s.setAudioSource(a.audioOutput)),this.#r.own(e.registerEdge(a.outgoing,s.incoming)),a=s);this.#r.own(i.setAudioSource(a.audioOutput)),this.#r.own(e.registerEdge(a.outgoing,i.incoming)),this.#n=!1}}))}invalidateWiring(){this.#r.terminate(),this.#n=!0}terminate(){this.#e.terminate(),this.#t.forEach(({device:e})=>e.terminate()),this.#t.clear(),this.#i=[]}toString(){return`{${this.constructor.name}}`}};var Wm=Math.floor(.005*sampleRate),jb=class{#e;#t;#r;#i;#n;#o;#a=0;#s=Number.POSITIVE_INFINITY;#l;#c;#u;#p;#d;#f;#h=!0;#m=!1;constructor(e,t,n,i){this.#e=e,this.#t=t,this.#i=n,this.#r=i,this.#n=e.gate,this.#o=Uc(this.#r.velocity);let{attack:o,release:a,sampleStart:s,sampleEnd:l}=this.#t;this.#l=o.getValue()*sampleRate,this.#c=a.getValue()*sampleRate,this.#u=(n.numberOfFrames-1)*s.getValue(),this.#p=(n.numberOfFrames-1)*l.getValue(),this.#d=this.#u,this.#f=0}get sample(){return this.#e}get event(){return this.#r}get position(){return this.#d}get envelope(){return this.#f}release(e=!1){this.#h&&(e?(this.#c=Wm,this.#g(),this.#h=!1):this.#n!==Zo.Off&&this.#g())}processAdd(e,t,n){let[i,o]=e,{frames:a,numberOfFrames:s}=this.#i,l=a[0],u=a[1]??l,{pitch:p}=this.#t,d=this.#p-this.#u,h=Math.sign(d),g=this.#i.sampleRate/sampleRate*h*2**(p.getValue()/1200),v=0;for(let y=t;y<n;y++){let x=this.#d|0,B=this.#d-x,I=l[x]*(1-B)+(l[x+1]??0)*B,O=u[x]*(1-B)+(u[x+1]??0)*B;if(v=Math.min(this.#a/this.#l,1-(this.#a-(this.#s+this.#l))/this.#c,1),this.#d+=g,h>0){if(this.#n===Zo.Off){if(this.#d>=s)return!0;!this.#m&&this.#d>=this.#p&&this.#g()}else if(this.#n===Zo.On){if(this.#d>=this.#p-Wm){if(this.#d>=this.#p)return!0;v*=(this.#p-this.#d)/Wm}}else if(this.#n===Zo.Loop)for(;this.#d>=this.#p;)this.#d-=d}else if(h<0){if(this.#n===Zo.Off){if(this.#d<=0)return!0;!this.#m&&this.#d<=this.#p&&this.#g()}else if(this.#n===Zo.On){if(this.#d<=this.#p+Wm){if(this.#d<=this.#p)return!0;v*=(this.#p-this.#d)/Wm}}else if(this.#n===Zo.Loop)for(;this.#d<=this.#p;)this.#d-=d}if(++this.#a-this.#s>this.#l+this.#c)return!0;v*=this.#o*v,i[y]+=I*v,o[y]+=O*v}return this.#f=v,!1}toString(){return"{PlayfieldSampleVoice}"}#g(){this.#m||(this.#m=!0,this.#s=this.#a<this.#l?this.#a-this.#l:this.#a)}};var Lb=class extends Ve{#e;#t;#r;#i;#n;#o;constructor(e,t,n,i){super(e),this.#e=t,this.#t=n,this.#r=[],this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,n.peakAddress));let{sampleStart:o,sampleEnd:a,attack:s,release:l,pitch:u}=n.namedParameter;this.#o=Object.freeze({sampleStart:this.own(this.bindParameter(o)),sampleEnd:this.own(this.bindParameter(a)),attack:this.own(this.bindParameter(s)),release:this.own(this.bindParameter(l)),pitch:this.own(this.bindParameter(u))});let p=new Float32Array(16);this.ownAll(Ub.create(e,n.audioEffects,this,i),e.broadcaster.broadcastFloats(n.address,p,d=>{if(!d)return;let h=this.#r.length<p.length?this.#r:this.#r.slice(0,p.length);h.forEach(({position:g},v)=>p[v]=g),p[h.length]=-1}),e.audioOutputBufferRegistry.register(n.address,this.#i,this.outgoing),e.registerProcessor(this)),this.readAllParameters()}get uuid(){return this.#t.uuid}get incoming(){return this}get outgoing(){return this}get audioOutput(){return this.#i}get adapter(){return this.#t}handleEvent(e){if(Fe.isStart(e)){let t=this.#t.file().flatMap(p=>p.getOrCreateLoader().data);if(t.isEmpty())return;let{mute:n,solo:i,polyphone:o,exclude:a}=this.#t.namedParameter,s=n.getValue(),l=i.getValue();if(s||this.#e.hasSolo()&&!l)return;o.getValue()||this.#r.forEach(p=>p.release(!0)),a.getValue()&&this.#e.stopExcludeOthers(this.#t),this.#r.push(new jb(this.#t,this.#o,t.unwrap(),e))}else Fe.isStop(e)&&this.#r.find(t=>t.event.id===e.id)?.release()}processAudio(e,t,n){this.#i.clear(t,n);for(let i=this.#r.length-1;i>=0;i--)this.#r[i].processAdd(this.#i.channels(),t,n)&&this.#r.splice(i,1)}forceStop(){this.#r.forEach(e=>e.release(!0))}parameterChanged(e){}reset(){this.#r.length=0,this.#i.clear(),this.#n.clear()}finishProcess(){this.#i.assertSanity(),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1))}toString(){return`{PlayfieldSampleProcessor note: ${this.#t.indexField.getValue()}}`}};var Kb=class{#e=new j;#t;#r;#i;#n;#o=!0;constructor(e,t){this.#t=t,this.#r=this.#e.own(new Vb(e,this)),this.#i=this.#e.own(new zb(e,this)),this.#n=b.newSet(n=>n.uuid),this.#e.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#o=n.getValue(),this.#r.setEnabled(this.#o),this.#o||this.#i.reset()}),t.samples.catchupAndSubscribe({onAdd:n=>{let i=new Lb(e,this,n,this.#i);this.#n.add({uuid:n.uuid,processor:i,terminable:e.registerEdge(this.#r,i)}),e.sampleManager.getOrCreate(n.fileUUID())},onRemove:n=>{let{terminable:i,processor:o}=this.#n.removeByKey(n.uuid);i.terminate(),o.terminate()},onReorder:n=>{}}),{terminate:()=>{this.#n.forEach(({terminable:n,processor:i})=>{n.terminate(),i.terminate()}),this.#n.clear()}})}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get noteEventTarget(){return m.wrap(this)}get incoming(){return this.#r}get outgoing(){return this.#i}optSampleProcessor(e){return this.#t.samples.getAdapterByIndex(e).flatMap(t=>this.#n.opt(t.uuid)).map(t=>t.processor)}hasSolo(){return this.#t.samples.adapters().some(e=>e.namedParameter.solo.getValue())}stopExcludeOthers(e){for(let t of this.#t.samples.adapters())t.exclude&&t!==e&&this.#n.opt(t.uuid).ifSome(({processor:n})=>n.forceStop())}get uuid(){return this.#t.uuid}get adapter(){return this.#t}get audioOutput(){return this.#i.audioOutput}parameterChanged(e){}terminate(){this.#e.terminate()}toString(){return"{PlayfieldDeviceProcessor}"}};var Wb=class extends Ve{#e;#t;#r;#i=fr.stereoMatrix(sampleRate);#n={gain:0,panning:0,stereo:0,invertL:!1,invertR:!1,swap:!1};#o;#a;#s;#l;#c;#u;#p=m.None;#d=xo.Linear;#f=!0;#h=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=this.own(new Be(e.broadcaster,t.address)),this.#o=this.own(this.bindParameter(t.namedParameter.volume)),this.#a=this.own(this.bindParameter(t.namedParameter.panning)),this.#s=this.own(this.bindParameter(t.namedParameter.stereo)),this.#l=this.own(this.bindParameter(t.namedParameter.invertL)),this.#c=this.own(this.bindParameter(t.namedParameter.invertR)),this.#u=this.own(this.bindParameter(t.namedParameter.swap)),this.ownAll(t.box.panningMixing.catchupAndSubscribe(n=>{this.#d=n.getValue(),this.#f=!0}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#t.clear(),this.eventInput.clear(),this.#h=!1}get uuid(){return this.#e.uuid}get audioOutput(){return this.#t}setAudioSource(e){return this.#p=m.wrap(e),{terminate:()=>this.#p=m.None}}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}processAudio(e,t,n){if(this.#p.isEmpty())return;this.#f&&(this.#i.update(this.#n,this.#d,this.#h),this.#f=!1);let i=this.#p.unwrap().channels(),o=this.#t.channels();this.#i.processFrames(i,o,t,n),this.#r.processStereo(o,t,n),this.#h=!0}parameterChanged(e){switch(e){case this.#o:this.#n.gain=Pe(this.#o.getValue()),this.#f=!0;return;case this.#a:this.#n.panning=this.#a.getValue(),this.#f=!0;return;case this.#s:this.#n.stereo=this.#s.getValue(),this.#f=!0;return;case this.#l:this.#n.invertL=this.#l.getValue(),this.#f=!0;return;case this.#c:this.#n.invertR=this.#c.getValue(),this.#f=!0;return;case this.#u:this.#n.swap=this.#u.getValue(),this.#f=!0;return}}toString(){return`{${this.constructor.name}}`}};var Zb=class extends Ai{#e;#t;#r=m.None;#i=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.ownAll(t.box.groove.catchupAndSubscribe(n=>{this.#r.ifSome(i=>i.terminate()),this.#r=m.wrap(n.targetVertex.isEmpty()?null:e.boxAdapters.adapterFor(n.targetVertex.unwrap().box,cc.checkType))}),ee.create(()=>{this.#r.ifSome(n=>n.terminate()),this.#r=m.None}),e.registerProcessor(this))}get uuid(){return this.#e.uuid}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}setNoteEventSource(e){return V(this.#i.isEmpty(),"NoteEventSource already set"),this.#i=m.wrap(e),ee.create(()=>this.#i=m.None)}*processNotes(e,t,n){if(this.#i.isEmpty())return;let i=this.#i.unwrap(),o=this.#r.mapOr(zp,Gp.Identity);for(let a of i.processNotes(o.unwarp(e),o.unwarp(t),n))Fe.isStart(a)?this.#t.noteOn(a.pitch):this.#t.noteOff(a.pitch),yield _i.overwrite(a,{position:be(o.warp(a.position),e,t)})}*iterateActiveNotesAt(e,t){if(this.#i.isEmpty())return;let n=this.#i.unwrap(),i=this.#r.mapOr(zp,Gp.Identity);for(let o of n.iterateActiveNotesAt(i.unwarp(e),t))yield _i.overwrite(o,{position:i.warp(o.position)})}reset(){this.eventInput.clear()}parameterChanged(e){}handleEvent(e,t){}processEvents(e,t,n){}};var Gb=class extends Ai{#e;#t;#r=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.own(e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#r.isEmpty(),"NoteEventSource already set"),this.#r=m.wrap(e),ee.create(()=>this.#r=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#r.isEmpty())for(let i of this.#r.unwrap().processNotes(e,t,n))yield i}*iterateActiveNotesAt(e,t){if(!this.#r.isEmpty())for(let n of this.#r.unwrap().iterateActiveNotesAt(e,t))yield n}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var qb=(r,e)=>(r[e]??r[e.toString()])?.value,$p=(r,e,t)=>qb(e,t)??qb(r,t),NM=new Float32Array(fe),Hb=class{event;sampleData;envelope;#e;rootKey;sampleRate;loopStart;loopEnd;pan;shouldLoop;playbackPosition=0;isReleasing=!1;constructor(e,t,n,i){this.event=e;let o=t.generators,a=n?.generators,s=qb(a,53)??0,l=n?.sample??i.samples[s];this.sampleData=l.data,this.rootKey=qb(a,58)??l?.header.originalPitch??60,this.sampleRate=l?.header.sampleRate??sampleRate,this.loopStart=l?.header.startLoop??0,this.loopEnd=l?.header.endLoop??this.sampleData.length;let u=$p(o,a,54)??0;this.shouldLoop=u===1||u===3,this.pan=($p(o,a,17)??0)/1e3;let p=$p(o,a,34),d=$p(o,a,36),h=$p(o,a,37),g=$p(o,a,38),v=Zs(p)?Math.pow(2,p/1200):.005,y=Zs(d)?Math.pow(2,d/1200):.005,x=1-(h??0)/1e3,B=Zs(g)?Math.pow(2,g/1200):.005;this.envelope=new zc(sampleRate),this.envelope.set(v,y,x,B),this.envelope.gateOn(),this.#e=new Pi(.003,sampleRate)}release(){this.isReleasing=!0,this.envelope.gateOff()}processAdd(e,t,n){let o=Kp(this.event.pitch+this.event.cent/100,440)/Kp(this.rootKey,440)*(this.sampleRate/sampleRate),a=Uc(this.event.velocity),s=Math.cos((this.pan+1)*Math.PI/4),l=Math.sin((this.pan+1)*Math.PI/4);this.envelope.process(NM,t,n);let u=e.getChannel(0),p=e.getChannel(1);for(let d=t;d<n;d++){let h=Math.floor(this.playbackPosition),v=this.#t(h)/32768*a*this.#e.process(NM[d]);if(u[d]+=v*s,p[d]+=v*l,this.playbackPosition+=o,this.shouldLoop)this.playbackPosition>=this.loopEnd&&this.loopEnd>this.loopStart&&(this.playbackPosition=this.loopStart+(this.playbackPosition-this.loopEnd));else if(this.playbackPosition>=this.sampleData.length-1)return!0}return this.envelope.complete&&this.#e.value<mg}#t(e){if(e>=this.sampleData.length-1)return this.sampleData[this.sampleData.length-1];let t=this.playbackPosition-e;return this.sampleData[e]*(1-t)+this.sampleData[e+1]*t}};var Jb=class extends Ve{#e;#t;#r;#i;#n;#o=m.None;#a=!0;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,t.address)),this.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#a=n.getValue(),this.#a||this.reset()}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing),t.box.file.catchupAndSubscribe(n=>this.#o=n.targetVertex.map(({box:i})=>e.soundfontManager.getOrCreate(i.address.uuid))))}introduceBlock(e){this.#r.introduceBlock(e)}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get noteEventTarget(){return m.wrap(this)}get incoming(){return this}get outgoing(){return this}get uuid(){return this.#e.uuid}get audioOutput(){return this.#i}get adapter(){return this.#e}reset(){this.#r.clear(),this.#n.clear(),this.#t.length=0,this.#i.clear(),this.eventInput.clear()}handleEvent(e){if(!this.#a)return;let t=this.#o.flatMap(i=>i.soundfont);if(t.isEmpty())return;let n=t.unwrap();if(Fe.isStart(e)){let i=n.presets[this.#e.presetIndex]??n.presets[0];if(ng(i)){console.warn("No preset available");return}let o=0;for(let a of i.zones){let s=Math.round(e.velocity*127);if(this.#s(e.pitch,s,a)){let l=a.instrument.zones;for(let u=0;u<l.length;u++){let p=l[u];this.#s(e.pitch,s,p)&&(this.#t.push(new Hb(e,a,p,n)),o++)}}}}else Fe.isStop(e)&&this.#t.forEach(i=>{i.event.id===e.id&&i.release()})}processAudio(e,t,n){if(this.#a){this.#i.clear(t,n);for(let i=this.#t.length-1;i>=0;i--)this.#t[i].processAdd(this.#i,t,n)&&this.#t.splice(i,1)}}finishProcess(){this.#a&&(this.#i.assertSanity(),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1)))}terminate(){super.terminate(),this.#o=m.None}toString(){return"{SoundfontDevice}"}#s(e,t,n){return this.#l(n.generators[44]?.range,t)&&this.#l(n.generators[43]?.range,e)}#l(e,t){return Ic(e)||t>=e.lo&&t<=e.hi}};var KR=.2,WR=.005,IM=-.001,Qb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterThreshold;#o;#a;#s=new Float32Array(1);#l;#c;#u=0;#p=0;#d=0;#f=0;#h=!0;#m=!1;#g=0;#v=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address.append(1))),this.#n=this.own(new Be(e.broadcaster,t.address)),this.#l=Math.exp(-1/(sampleRate*KR)),this.#a=fr.linear(sampleRate,.01),this.#c=Math.ceil(WR*sampleRate)|0,this.#o=[new Float32Array(this.#c),new Float32Array(this.#c)];let{threshold:n}=t.namedParameter;this.parameterThreshold=this.own(this.bindParameter(n)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#s,()=>{this.#s[0]=this.#g,this.#g=0}),t.box.lookahead.catchupAndSubscribe(()=>{this.#h=t.box.lookahead.getValue(),this.#u=0,this.#p=0})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#m=!1,this.#i.clear(),this.#n.clear(),this.#r.clear(),this.eventInput.clear(),this.#u=0,this.#p=0,this.#d=0,this.#f=0,this.#o[0].fill(0),this.#o[1].fill(0),this.#g=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#v=m.wrap(e),{terminate:()=>this.#v=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#v.isEmpty())return;let i=this.#v.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1);if(this.#h){let u=this.#o,p=this.#c,d=u[0],h=u[1];for(let g=t;g<n;g++){let v=o[g],y=a[g],x=Math.max(Math.abs(v),Math.abs(y));x>this.#d?(this.#d=x,this.#f=this.#c):this.#f>0?this.#f--:this.#d=x,this.#p<this.#d?this.#p=Math.min(this.#d,this.#p+this.#d/this.#c):this.#p=this.#d+this.#l*(this.#p-this.#d);let B=this.#a.moveAndGet(),I=Math.min(0,B-yo(this.#p)),O=Pe(I)*Pe(IM-B),z=d[this.#u]*O,$=h[this.#u]*O;s[g]=be(z,-1,1),l[g]=be($,-1,1),d[this.#u]=v,h[this.#u]=y,this.#u=(this.#u+1)%p,I<this.#g&&(this.#g=I)}}else for(let u=t;u<n;u++){let p=o[u],d=a[u],h=Math.max(Math.abs(p),Math.abs(d));h>this.#d?(this.#d=h,this.#f=this.#c):this.#f>0?this.#f--:this.#d=h,this.#p<this.#d?this.#p=Math.min(this.#d,this.#p+this.#d/this.#c):this.#p=this.#d+this.#l*(this.#p-this.#d);let g=this.#a.moveAndGet(),v=Math.min(0,g-yo(this.#p)),y=Pe(v)*Pe(IM-g),x=p*y,B=d*y;s[u]=x,l[u]=B,v<this.#g&&(this.#g=v)}this.#i.process(o,a,t,n),this.#n.process(s,l,t,n),this.#m=!0}parameterChanged(e){e===this.parameterThreshold&&this.#a.set(this.parameterThreshold.getValue(),this.#m)}toString(){return`{${this.constructor.name} (${this.#e})}`}};var DM=r=>r>0?20*Math.log10(r):-100,MM=r=>Math.pow(10,r*.05);var Yb=class{#e=.08;#t=1;#r;#i;#n=0;#o=.14;#a=0;#s=.14;#l=0;#c=0;#u=0;constructor(e){this.#r=Math.exp(-1/(e*.2)),this.#i=1-this.#r}process(e,t,n){this.#l===0&&(this.#l=e[0]),this.#c===0&&(this.#c=e[0]),this.#a=0,this.#s=0;for(let o=t;o<n;++o){let a=e[o]*e[o];this.#l=Math.max(a,this.#r*this.#l+this.#i*a),this.#c=this.#r*this.#c+this.#i*a;let s=this.#l/this.#c;this.#u=s>0?s:0,this.#u>0&&(this.#n=2*(this.#e/this.#u),this.#o=2*(this.#t/this.#u)-this.#n,this.#a+=this.#n,this.#s+=this.#o)}let i=n-t;this.#a/=i,this.#s/=i}getAvgAttack(){return this.#a}getAvgRelease(){return this.#s}};var Xb=class{#e=[];#t;#r;#i;#n=0;constructor(e,t,n,i){this.#i=i,this.#r=Math.floor(e*t),this.#t=n+this.#r;for(let o=0;o<i;o++)this.#e[o]=new Float32Array(this.#t);this.#n=0}process(e,t,n){if(this.#r===0)return;let i=(this.#n-this.#r+this.#t)%this.#t;for(let o=0;o<this.#i;o++){let a=e.getChannel(o),s=this.#n,l=i;for(let u=t;u<n;u++){let p=this.#e[o][l];this.#e[o][s]=a[u],a[u]=p,s=(s+1)%this.#t,l=(l+1)%this.#t}}this.#n=(this.#n+(n-t))%this.#t}};var e0=class{#e=-20;#t=2;#r=6;#i=3;#n=-.5;setThreshold(e){this.#e=e}setRatio(e){this.#t!==e&&(this.#t=e,this.#t>23.9&&(this.#t=-1/0),this.#n=1/e-1)}setKnee(e){e!==this.#r&&(this.#r=e,this.#i=e/2)}applyCompression(e){let t=e-this.#e;return t<=-this.#i?0:t>-this.#i&&t<=this.#i?.5*this.#n*((t+this.#i)*(t+this.#i))/this.#r:this.#n*t}applyCompressionToBuffer(e,t,n){for(let i=t;i<n;++i){let o=Math.max(Math.abs(e[i]),1e-6),a=DM(o);e[i]=this.applyCompression(a)}}};var _c=class{#e;#t=1;#r=0;#i=0;#n=!0;constructor(e){this.#e=e,this.#t=1,this.#r=1-this.#t}process(e){this.#n&&(this.#i=e,this.#n=!1),this.#i=this.#t*e+this.#r*this.#i}setAlpha(e){this.#t=e,this.#r=1-this.#t}setAlphaWithTime(e){this.#t=Math.exp(-1/(this.#e*e)),this.#r=1-this.#t}getState(){return this.#i}};var t0=class{#e;#t;#r;#i;#n=.01;#o=0;#a=.14;#s=0;#l=0;#c=0;#u=!1;#p=!1;constructor(e){this.#e=e,this.#t=new Yb(e),this.#r=new _c(e),this.#i=new _c(e),this.#o=Math.exp(-1/(e*this.#n)),this.#s=Math.exp(-1/(e*this.#a)),this.#l=0,this.#c=0}setAttack(e){e!==this.#n&&(this.#n=e,this.#o=Math.exp(-1/(this.#e*this.#n)))}setRelease(e){e!==this.#a&&(this.#a=e,this.#s=Math.exp(-1/(this.#e*this.#a)))}setAutoAttack(e){this.#u=e}setAutoRelease(e){this.#p=e}#d(e){return e<this.#l?this.#l=this.#o*this.#l+(1-this.#o)*e:this.#l=this.#s*this.#l+(1-this.#s)*e,this.#l}applyBallistics(e,t,n){for(let i=t;i<n;++i)e[i]=this.#d(e[i])}processCrestFactor(e,t,n){(this.#u||this.#p)&&(this.#t.process(e,t,n),this.#r.process(this.#t.getAvgAttack()),this.#i.process(this.#t.getAvgRelease()),this.#u&&this.setAttack(this.#r.getState()),this.#p&&this.setRelease(this.#i.getState()))}};var r0=class{#e;#t;#r;#i=0;#n=0;constructor(e,t,n){this.#t=Math.floor(e*t),this.#r=n+this.#t,this.#e=new Float32Array(this.#r),this.#i=0}process(e,t,n){this.#o(e,t,n),this.#s(),this.#a(e,t,n)}#o(e,t,n){for(let i=t;i<n;i++)this.#e[this.#i]=e[i],this.#i=(this.#i+1)%this.#r;this.#n=n-t}#a(e,t,n){let i=this.#i-this.#n-this.#t;i<0&&(i+=this.#r);for(let o=t;o<n;o++)e[o]=this.#e[i],i=(i+1)%this.#r}#s(){let e=this.#i-1;e<0&&(e+=this.#r);let t=0,n=0;for(let o=0;o<this.#n;o++){let a=this.#e[e];a>t?(this.#e[e]=t,t+=n):(n=-a/this.#t,t=a+n),e=e-1,e<0&&(e+=this.#r)}let i=!1;for(let o=0;o<this.#t&&!i;o++){if(this.#e[e]>t)this.#e[e]=t,t+=n;else{i=!0;break}e=e-1,e<0&&(e+=this.#r)}}};var i0=class r extends Ve{static PEAK_DECAY_PER_SAMPLE=Math.exp(-1/(sampleRate*.5));static ID=0;#e=r.ID++;#t;parameterLookahead;parameterAutomakeup;parameterAutoattack;parameterAutorelease;parameterInputgain;parameterThreshold;parameterRatio;parameterKnee;parameterAttack;parameterRelease;parameterMakeup;parameterMix;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p=.005;#d;#f;#h=new j;#m=m.None;#g=m.None;#v=!1;#w=!1;#A=!1;#_=!1;#E=!1;#F=-10;#b=2;#y=6;#x=2;#S=140;#I=0;#M=1;#k=0;#D=0;#B=0;#$=0;#T=!1;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#d=new Float32Array([Number.NEGATIVE_INFINITY,0,Number.NEGATIVE_INFINITY]),this.#f=fr.linear(sampleRate);let{lookahead:n,automakeup:i,autoattack:o,autorelease:a,inputgain:s,threshold:l,ratio:u,knee:p,attack:d,release:h,makeup:g,mix:v}=t.namedParameter;this.parameterLookahead=this.own(this.bindParameter(n)),this.parameterAutomakeup=this.own(this.bindParameter(i)),this.parameterAutoattack=this.own(this.bindParameter(o)),this.parameterAutorelease=this.own(this.bindParameter(a)),this.parameterInputgain=this.own(this.bindParameter(s)),this.parameterThreshold=this.own(this.bindParameter(l)),this.parameterRatio=this.own(this.bindParameter(u)),this.parameterKnee=this.own(this.bindParameter(p)),this.parameterAttack=this.own(this.bindParameter(d)),this.parameterRelease=this.own(this.bindParameter(h)),this.parameterMakeup=this.own(this.bindParameter(g)),this.parameterMix=this.own(this.bindParameter(v)),this.#n=new t0(sampleRate),this.#o=new e0,this.#a=new Xb(sampleRate,.005,fe,2),this.#s=new r0(sampleRate,this.#p,fe),this.#l=new _c(sampleRate),this.#l.setAlpha(.03),this.#c=new Float32Array(fe),this.#u=[new Float32Array(fe),new Float32Array(fe)],this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#d,y=>{this.#d[0]=yo(this.#D),this.#d[1]=this.#$,this.#d[2]=yo(this.#B)}),t.sideChain.catchupAndSubscribe(()=>{this.#h.terminate(),this.#g=m.None,this.#v=!0}),e.subscribeProcessPhase(y=>{y===0&&this.#v&&(this.#v=!1,t.sideChain.targetVertex.map(({box:x})=>x.address).ifSome(x=>{e.audioOutputBufferRegistry.resolve(x).ifSome(B=>{this.#g=m.wrap(B.buffer),this.#h.own(e.registerEdge(B.processor,this.incoming))})}))}),this.#h),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#T=!1,this.#r.clear(),this.#i.clear(),this.eventInput.clear(),this.#c.fill(0),this.#u[0].fill(0),this.#u[1].fill(0),this.#k=0,this.#D=0,this.#B=0,this.#$=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#m=m.wrap(e),{terminate:()=>this.#m=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#m.isEmpty())return;let i=this.#m.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1);for(let u=t;u<n;u++){let p=this.#f.moveAndGet();s[u]=o[u]*p,l[u]=a[u]*p}if(this.#c.fill(0,t,n),this.#g.nonEmpty()){let u=this.#g.unwrap(),p=u.getChannel(0),d=u.getChannel(1);for(let h=t;h<n;h++)this.#c[h]=Math.max(Math.abs(p[h]),Math.abs(d[h]))}else for(let u=t;u<n;u++)this.#c[u]=Math.max(Math.abs(s[u]),Math.abs(l[u]));for(let u=t;u<n;u++){let p=this.#c[u];this.#D<=p?this.#D=p:this.#D*=r.PEAK_DECAY_PER_SAMPLE}this.#n.processCrestFactor(this.#c,t,n),this.#o.applyCompressionToBuffer(this.#c,t,n),this.#n.applyBallistics(this.#c,t,n),this.#$=this.#c[n-1],this.#k=this.#N(this.#c,t,n),this.#w&&(this.#a.process(this.#r,t,n),this.#s.process(this.#c,t,n));for(let u=t;u<n;u++)this.#c[u]=MM(this.#c[u]+this.#I+this.#k);for(let u=t;u<n;u++)this.#u[0][u]=s[u],this.#u[1][u]=l[u];for(let u=t;u<n;u++)s[u]*=this.#c[u],l[u]*=this.#c[u];for(let u=t;u<n;u++){let p=s[u]*this.#M+this.#u[0][u]*(1-this.#M),d=l[u]*this.#M+this.#u[1][u]*(1-this.#M),h=Math.max(Math.abs(p),Math.abs(d));this.#B<=h?this.#B=h:this.#B*=r.PEAK_DECAY_PER_SAMPLE,s[u]=p,l[u]=d}this.#i.process(s,l,t,n),this.#T=!0}#N(e,t,n){let i=0;for(let o=t;o<n;o++)i+=e[o];return this.#l.process(-i/(n-t)),this.#A?this.#l.getState():0}parameterChanged(e){e===this.parameterLookahead?this.#w=this.parameterLookahead.getValue():e===this.parameterAutomakeup?this.#A=this.parameterAutomakeup.getValue():e===this.parameterAutoattack?(this.#_=this.parameterAutoattack.getValue(),this.#n.setAutoAttack(this.#_),this.#_||this.#n.setAttack(this.#x*.001)):e===this.parameterAutorelease?(this.#E=this.parameterAutorelease.getValue(),this.#n.setAutoRelease(this.#E),this.#E||this.#n.setRelease(this.#S*.001)):e===this.parameterInputgain?this.#f.set(Pe(this.parameterInputgain.getValue()),this.#T):e===this.parameterThreshold?(this.#F=this.parameterThreshold.getValue(),this.#o.setThreshold(this.#F)):e===this.parameterRatio?(this.#b=this.parameterRatio.getValue(),this.#o.setRatio(this.#b)):e===this.parameterKnee?(this.#y=this.parameterKnee.getValue(),this.#o.setKnee(this.#y)):e===this.parameterAttack?(this.#x=this.parameterAttack.getValue(),this.#_||this.#n.setAttack(this.#x*.001)):e===this.parameterRelease?(this.#S=this.parameterRelease.getValue(),this.#E||this.#n.setRelease(this.#S*.001)):e===this.parameterMakeup?this.#I=this.parameterMakeup.getValue():e===this.parameterMix&&(this.#M=this.parameterMix.getValue())}toString(){return`{${this.constructor.name} (${this.#e})}`}};var n0=class r extends Ve{static PEAK_DECAY_PER_SAMPLE=Math.exp(-1/(sampleRate*.01));static ID=0;#e=r.ID++;#t;parameterInverse;parameterThreshold;parameterReturn;parameterAttack;parameterHold;parameterRelease;parameterFloor;#r;#i;#n;#o=new j;#a=m.None;#s=m.None;#l=!1;#c=!1;#u=-40;#p=6;#d=.5;#f=50;#h=100;#m=-80;#g=Pe(-40);#v=Pe(-46);#w=Pe(-80);#A=0;#_=0;#E=0;#F=0;#b=0;#y=!1;#x=0;#S=0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new Float32Array([Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY]);let{inverse:n,threshold:i,return:o,attack:a,hold:s,release:l,floor:u}=t.namedParameter;this.parameterInverse=this.own(this.bindParameter(n)),this.parameterThreshold=this.own(this.bindParameter(i)),this.parameterReturn=this.own(this.bindParameter(o)),this.parameterAttack=this.own(this.bindParameter(a)),this.parameterHold=this.own(this.bindParameter(s)),this.parameterRelease=this.own(this.bindParameter(l)),this.parameterFloor=this.own(this.bindParameter(u)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#n,p=>{this.#n[0]=yo(this.#x),this.#n[1]=yo(this.#S),this.#n[2]=yo(this.#F)}),t.sideChain.catchupAndSubscribe(()=>{this.#o.terminate(),this.#s=m.None,this.#l=!0}),e.subscribeProcessPhase(p=>{p===0&&this.#l&&(this.#l=!1,t.sideChain.targetVertex.map(({box:d})=>d.address).ifSome(d=>{e.audioOutputBufferRegistry.resolve(d).ifSome(h=>{this.#s=m.wrap(h.buffer),this.#o.own(e.registerEdge(h.processor,this.incoming))})}))}),this.#o),this.readAllParameters(),this.#I()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#i.clear(),this.eventInput.clear(),this.#F=0,this.#b=0,this.#y=!1,this.#x=0,this.#S=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#a=m.wrap(e),{terminate:()=>this.#a=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#a.isEmpty())return;let i=this.#a.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1),u=this.#s.nonEmpty(),p=u?this.#s.unwrap().getChannel(0):o,d=u?this.#s.unwrap().getChannel(1):a;for(let h=t;h<n;h++){let g=Math.max(Math.abs(p[h]),Math.abs(d[h]));this.#x<=g?this.#x=g:this.#x*=r.PEAK_DECAY_PER_SAMPLE,this.#x>=this.#g?(this.#y=!0,this.#b=this.#A):this.#y&&this.#b>0?this.#b--:this.#x<this.#v&&(this.#y=!1);let v=this.#c!==this.#y?1:0;v>this.#F?this.#F=this.#_*this.#F+(1-this.#_)*v:this.#F=this.#E*this.#F+(1-this.#E)*v;let y=this.#w+(1-this.#w)*this.#F,x=o[h]*y,B=a[h]*y;s[h]=x,l[h]=B;let I=Math.max(Math.abs(x),Math.abs(B));this.#S<=I?this.#S=I:this.#S*=r.PEAK_DECAY_PER_SAMPLE}this.#i.process(s,l,t,n)}parameterChanged(e){e===this.parameterInverse?this.#c=this.parameterInverse.getValue():e===this.parameterThreshold?(this.#u=this.parameterThreshold.getValue(),this.#g=Pe(this.#u),this.#v=Pe(this.#u-this.#p)):e===this.parameterReturn?(this.#p=this.parameterReturn.getValue(),this.#v=Pe(this.#u-this.#p)):e===this.parameterAttack?(this.#d=this.parameterAttack.getValue(),this.#I()):e===this.parameterHold?(this.#f=this.parameterHold.getValue(),this.#A=Math.round(this.#f*.001*sampleRate)|0):e===this.parameterRelease?(this.#h=this.parameterRelease.getValue(),this.#I()):e===this.parameterFloor&&(this.#m=this.parameterFloor.getValue(),this.#w=Pe(this.#m))}#I(){let e=this.#d*.001,t=this.#h*.001;this.#_=Math.exp(-1/(sampleRate*e)),this.#E=Math.exp(-1/(sampleRate*t)),this.#A=Math.round(this.#f*.001*sampleRate)|0}toString(){return`{${this.constructor.name} (${this.#e})}`}};var o0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterCrusherRate;parameterBitDepth;parameterBoost;parameterMix;#o=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=new yg(sampleRate),this.#n=this.own(new Be(e.broadcaster,t.address));let{crush:n,bits:i,boost:o,mix:a}=t.namedParameter;this.parameterCrusherRate=this.own(this.bindParameter(n)),this.parameterBitDepth=this.own(this.bindParameter(i)),this.parameterBoost=this.own(this.bindParameter(o)),this.parameterMix=this.own(this.bindParameter(a)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.reset(),this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#o.isEmpty())return;let i=this.#o.unwrap();this.#i.process(i.channels(),this.#r.channels(),t,n),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1),t,n)}parameterChanged(e){e===this.parameterCrusherRate?this.#i.setCrush(1-this.parameterCrusherRate.getValue()):e===this.parameterBitDepth?this.#i.setBitDepth(this.parameterBitDepth.getValue()):e===this.parameterBoost?this.#i.setBoost(this.parameterBoost.getValue()):e===this.parameterMix&&this.#i.setMix(this.parameterMix.getValue())}toString(){return`{${this.constructor.name} (${this.#e})`}};var ZR=[2,4,8],kM=8,a0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterDrive;parameterVolume;#o=m.None;#a=!1;#s;#l;#c;#u;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=[new Float32Array(fe*kM),new Float32Array(fe*kM)],this.#n=this.own(new Be(e.broadcaster,t.address));let{drive:n,volume:i}=t.namedParameter;this.parameterDrive=this.own(this.bindParameter(n)),this.parameterVolume=this.own(this.bindParameter(i)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),t.box.overSampling.catchupAndSubscribe(o=>{let a=ZR[o.getValue()];this.#s=new Fg(a),this.#c=fr.linear(sampleRate*a),this.#c.set(Pe(this.parameterDrive.getValue()),this.#a),this.#u=fr.linear(sampleRate*a),this.#u.set(Pe(this.parameterVolume.getValue()),this.#a),this.#l=a})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){console.debug("reset"),this.#a=!1,this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#o.isEmpty())return;this.#s.upsample(this.#o.unwrap().channels(),this.#i,t,n);let i=(n-t)*this.#l,[o,a]=this.#i;for(let s=0;s<i;s++){let l=this.#u.moveAndGet(),u=this.#c.moveAndGet();o[s]=rA(o[s]*u)*l,a[s]=rA(a[s]*u)*l}this.#s.downsample(this.#i,this.#r.channels(),t,n),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1),t,n),this.#a=!0}parameterChanged(e){e===this.parameterDrive?this.#c.set(Pe(this.parameterDrive.getValue()),this.#a):e===this.parameterVolume&&this.#u.set(Pe(this.parameterVolume.getValue()),this.#a)}toString(){return`{${this.constructor.name} (${this.#e})`}};var s0=class extends Ve{#e;#t;#r=[];#i;#n;#o=!0;#a=m.None;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#i=[];let{midiDevice:n,box:i,parameters:o}=t;this.#n=i.channel.getValue(),this.ownAll(i.enabled.catchupAndSubscribe(a=>{this.#o=a.getValue(),this.#o||this.reset()}),i.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:a})=>this.#i.push(this.bindParameter(o.parameterAt(Ce(a,Rn).value.address))),onRemoved:({box:a})=>U.removeIf(this.#i,s=>s.address===Ce(a,Rn).value.address)}),i.channel.subscribe(a=>{n.ifSome(s=>this.#r.forEach(l=>e.sendMIDIData(s.id.getValue(),Nt.noteOff(this.#n,l),s.delayInMs.getValue()))),this.#r.length=0,this.#n=a.getValue()}),e.registerProcessor(this)),this.readAllParameters()}get noteEventTarget(){return m.wrap(this)}introduceBlock({p0:e,p1:t,s0:n,flags:i,bpm:o}){if(this.#a.isEmpty()||!this.#o)return;let{box:{channel:a,device:s}}=this.#e,l=s.targetVertex.match({none:()=>m.None,some:({box:p})=>m.wrap(Ce(p,Tn))}),u=l.mapOr(p=>p.delayInMs.getValue(),0);for(let p of this.#a.unwrap().processNotes(e,t,i))if(p.pitch>=0&&p.pitch<=127){let d=n/sampleRate,h=J.pulsesToSeconds(p.position-e,o),g=(d+h)*1e3+u,v=a.getValue();if(Fe.isStart(p)){let y=Math.round(p.velocity*127);this.#r.push(p.pitch),l.ifSome(x=>this.context.sendMIDIData(x.id.getValue(),Nt.noteOn(v,p.pitch,y),g))}else if(Fe.isStop(p)){let y=this.#r.indexOf(p.pitch);y>-1&&this.#r.splice(y,1),l.ifSome(x=>this.context.sendMIDIData(x.id.getValue(),Nt.noteOff(v,p.pitch),g))}}}setNoteEventSource(e){return this.#a=m.wrap(e),ee.create(()=>this.#a=m.None)}get incoming(){return this}get outgoing(){return this}reset(){}get uuid(){return this.#e.uuid}get audioOutput(){return this.#t}get adapter(){return this.#e}handleEvent(e){}processAudio(e,t,n){}parameterChanged(e,t=0){let{box:{channel:n,device:i}}=this.#e;if(i.isEmpty()||!this.#o)return;let{id:o,delayInMs:a}=Ce(i.targetVertex.unwrap().box,Tn),s=t*1e3*a.getValue(),l=Ce(e.adapter.field.box,Rn).controller.getValue(),u=Math.round(e.getValue()*127),p=Nt.control(n.getValue(),l,u);this.context.sendMIDIData(o.getValue(),p,s)}finishProcess(){}toString(){return"{MIDIOutputDeviceProcessor}"}};var l0=class extends Ai{#e;#t;#r;#i=m.None;#n;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.#r=new Int32Array(1024),this.#n=0;let{magnetPosition:n,magnetStrength:i,randomSeed:o,randomAmount:a,offset:s,mix:l}=t.namedParameter;this.ownAll(this.bindParameter(n),this.bindParameter(i),this.bindParameter(o),this.bindParameter(a),this.bindParameter(s),this.bindParameter(l),e.broadcaster.broadcastIntegers(t.address.append(0),this.#r,u=>{this.#r[this.#n]=0,this.#n=0}),e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#i.isEmpty(),"NoteEventSource already set"),this.#i=m.wrap(e),ee.create(()=>this.#i=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#i.isEmpty())for(let i of this.#i.unwrap().processNotes(e,t,n))if(Fe.isStart(i)){this.#t.noteOn(i.pitch);let o=this.#e.computeVelocity(i.position,i.velocity);this.#r[this.#n++]=Math.round(i.velocity*127)|Math.round(o*127)<<8|65536,yield _i.overwrite(i,{velocity:o})}else this.#t.noteOff(i.pitch),yield i}*iterateActiveNotesAt(e,t){if(!this.#i.isEmpty())for(let n of this.#i.unwrap().iterateActiveNotesAt(e,t))n.type==="note-event"&&(yield _i.overwrite(n,{velocity:this.#e.computeVelocity(n.position,n.velocity)}))}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var c0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f=m.None;#h=!0;#m=0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new xg,this.#o=new Pi(.003,sampleRate),this.#a=new Pi(.003,sampleRate);let{rate:n,depth:i,slope:o,symmetry:a,offset:s,channelOffset:l}=t.namedParameter;this.#s=this.bindParameter(n),this.#l=this.bindParameter(i),this.#c=this.bindParameter(o),this.#u=this.bindParameter(a),this.#p=this.bindParameter(s),this.#d=this.bindParameter(l),this.ownAll(e.broadcaster.broadcastFloat(t.address.append(0),()=>this.#m),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#m=0,this.#h=!0,this.#i.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#f=m.wrap(e),{terminate:()=>this.#f=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio({p0:e,bpm:t,flags:n},i,o){if(this.#f.isEmpty())return;let a=this.#f.unwrap(),[s,l]=a.channels(),[u,p]=this.#r.channels();this.#h&&(this.#n.set(this.#l.getValue(),this.#c.getValue(),this.#u.getValue()),this.#h=!1);let{RateFractions:d}=ro,h=J.samplesToPulses(1,t,sampleRate),v=1/wr.toPPQN(d[this.#s.getValue()]),y=this.#p.getValue()/360,x=y+this.#d.getValue()/360;for(let B=i;B<o;B++){let I=(e+B*h)*v+y,O=(e+B*h)*v+x;u[B]=s[B]*this.#o.process(this.#n.compute(I-Math.floor(I))),p[B]=l[B]*this.#a.process(this.#n.compute(O-Math.floor(O)))}this.#i.process(u,p),St.every(n,5)&&(this.#m=(e+(o-i)*h)*v)}parameterChanged(e){(e===this.#l||e===this.#c||e===this.#u)&&(this.#h=!0)}toString(){return`{${this.constructor.name} (${this.#e})`}};var u0=class{#e;#t=[];#r;#i;#n;#o=0;#a=0;#s=0;#l=0;#c=0;#u=0;#p=.9999;#d=.75;#f=.625;#h=.5;#m=.7;#g=.5;#v=.005;#w=.5;#A=.7;#_=.3;#E=.6;constructor(e){this.#e=e,this.#n=e+1,this.#r=new Float32Array(this.#n),[.004771345,.003595309,.012734787,.009307483,.022579886,.149625349,.060481839,.1249958,.030509727,.141695508,.089244313,.106280031].forEach(i=>this.#F(i));let n=[.008937872,.099929438,.064278754,.067067639,.066866033,.006283391,.035818689,.011861161,.121870905,.041262054,.08981553,.070931756,.011256342,.004065724];this.#i=Int16Array.from(n,i=>Math.round(i*e))}#F(e){let t=Math.round(e*this.#e),n=2**Math.ceil(Math.log2(t));this.#t.push([new Float32Array(n),t-1,0,n-1])}#b(e,t){return this.#t[e][0][this.#t[e][1]]=t}#y(e){return this.#t[e][0][this.#t[e][2]]}#x(e,t){let n=this.#t[e];return n[0][n[2]+t&n[3]]}#S(e,t){let n=this.#t[e],i=t-~~t,o=~~t+n[2]-1,a=n[3],s=n[0][o++&a],l=n[0][o++&a],u=n[0][o++&a],p=n[0][o&a],d=(3*(l-u)-s+p)*.5,h=2*u+s-(5*l+p)*.5,g=(u-s)*.5;return((d*i+h)*i+g)*i+l}set preDelayMs(e){this.#u=Math.floor(e/1e3*this.#e)}set bandwidth(e){this.#p=e*.9999}set inputDiffusion1(e){this.#d=e}set inputDiffusion2(e){this.#f=e}set decay(e){this.#h=e}set decayDiffusion1(e){this.#m=e*.999999}set decayDiffusion2(e){this.#g=e*.999999}set damping(e){this.#v=e}set excursionRate(e){this.#w=e*2}set excursionDepth(e){this.#A=e*2}set wetGain(e){this.#_=e}set dryGain(e){this.#E=e}reset(){this.#r.fill(0),this.#t.forEach(e=>e[0].fill(0)),this.#o=0,this.#a=0,this.#s=0,this.#l=0,this.#c=0}process(e,t,n,i){let o=this.#u,a=this.#p,s=this.#d,l=this.#f,u=this.#h,p=this.#m,d=this.#g,h=1-this.#v,g=this.#w/this.#e,v=this.#A*this.#e/1e3,y=this.#_*.6,x=this.#E,B=e[0],I=e[1],O=t[0],z=t[1];for(let $=n;$<i;$++){let ie=B[$],ne=I[$];this.#r[this.#o]=(ie+ne)*.5,O[$]=ie*x,z[$]=ne*x;let le=this.#r[(this.#n+this.#o-o)%this.#n];this.#a+=a*(le-this.#a);let W=this.#b(0,this.#a-s*this.#y(0));W=this.#b(1,s*(W-this.#y(1))+this.#y(0)),W=this.#b(2,s*W+this.#y(1)-l*this.#y(2)),W=this.#b(3,l*(W-this.#y(3))+this.#y(2));let xe=l*W+this.#y(3),se=v*(1+Math.cos(this.#c*6.28)),Ee=v*(1+Math.sin(this.#c*6.2847)),Re=this.#b(4,xe+u*this.#y(11)+p*this.#S(4,se));this.#b(5,this.#S(4,se)-p*Re),this.#s+=h*(this.#y(5)-this.#s),Re=this.#b(6,u*this.#s-d*this.#y(6)),this.#b(7,this.#y(6)+d*Re),Re=this.#b(8,xe+u*this.#y(7)+p*this.#S(8,Ee)),this.#b(9,this.#S(8,Ee)-p*Re),this.#l+=h*(this.#y(9)-this.#l),Re=this.#b(10,u*this.#l-d*this.#y(10)),this.#b(11,this.#y(10)+d*Re);let st=this.#x(9,this.#i[0])+this.#x(9,this.#i[1])-this.#x(10,this.#i[2])+this.#x(11,this.#i[3])-this.#x(5,this.#i[4])-this.#x(6,this.#i[5])-this.#x(7,this.#i[6]),gt=this.#x(5,this.#i[7])+this.#x(5,this.#i[8])-this.#x(6,this.#i[9])+this.#x(7,this.#i[10])-this.#x(9,this.#i[11])-this.#x(10,this.#i[12])-this.#x(11,this.#i[13]);O[$]+=st*y,z[$]+=gt*y,this.#c+=g,this.#o=(this.#o+1)%this.#n;for(let ye=0;ye<this.#t.length;ye++){let ke=this.#t[ye];ke[1]=ke[1]+1&ke[3],ke[2]=ke[2]+1&ke[3]}}}};var d0=class r extends Ve{static ID=0;#e=r.ID++;#t;parameterPreDelay;parameterBandwidth;parameterInputDiffusion1;parameterInputDiffusion2;parameterDecay;parameterDecayDiffusion1;parameterDecayDiffusion2;parameterDamping;parameterExcursionRate;parameterExcursionDepth;parameterWet;parameterDry;#r;#i;#n;#o=m.None;constructor(e,t){super(e),this.#t=t,this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,t.address)),this.#r=new u0(sampleRate);let{preDelay:n,bandwidth:i,inputDiffusion1:o,inputDiffusion2:a,decay:s,decayDiffusion1:l,decayDiffusion2:u,damping:p,excursionRate:d,excursionDepth:h,wet:g,dry:v}=t.namedParameter;this.parameterPreDelay=this.own(this.bindParameter(n)),this.parameterBandwidth=this.own(this.bindParameter(i)),this.parameterInputDiffusion1=this.own(this.bindParameter(o)),this.parameterInputDiffusion2=this.own(this.bindParameter(a)),this.parameterDecay=this.own(this.bindParameter(s)),this.parameterDecayDiffusion1=this.own(this.bindParameter(l)),this.parameterDecayDiffusion2=this.own(this.bindParameter(u)),this.parameterDamping=this.own(this.bindParameter(p)),this.parameterExcursionRate=this.own(this.bindParameter(d)),this.parameterExcursionDepth=this.own(this.bindParameter(h)),this.parameterWet=this.own(this.bindParameter(g)),this.parameterDry=this.own(this.bindParameter(v)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.reset(),this.#i.clear(),this.#n.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#i}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#o.isEmpty())return;let i=this.#o.unwrap();this.#r.process(i.channels(),this.#i.channels(),t,n),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1),t,n)}parameterChanged(e){e===this.parameterPreDelay?this.#r.preDelayMs=this.parameterPreDelay.getValue():e===this.parameterBandwidth?this.#r.bandwidth=this.parameterBandwidth.getValue():e===this.parameterInputDiffusion1?this.#r.inputDiffusion1=this.parameterInputDiffusion1.getValue():e===this.parameterInputDiffusion2?this.#r.inputDiffusion2=this.parameterInputDiffusion2.getValue():e===this.parameterDecay?this.#r.decay=this.parameterDecay.getValue():e===this.parameterDecayDiffusion1?this.#r.decayDiffusion1=this.parameterDecayDiffusion1.getValue():e===this.parameterDecayDiffusion2?this.#r.decayDiffusion2=this.parameterDecayDiffusion2.getValue():e===this.parameterDamping?this.#r.damping=this.parameterDamping.getValue():e===this.parameterExcursionRate?this.#r.excursionRate=this.parameterExcursionRate.getValue():e===this.parameterExcursionDepth?this.#r.excursionDepth=this.parameterExcursionDepth.getValue():e===this.parameterWet?this.#r.wetGain=Pe(this.parameterWet.getValue()):e===this.parameterDry&&(this.#r.dryGain=Pe(this.parameterDry.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})}`}};var p0=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},tt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},It,Pc,Sc,Zm,Gm=class r{constructor(e,t=128){if(It.set(this,void 0),Pc.set(this,void 0),Sc.set(this,void 0),Zm.set(this,void 0),p0(this,It,e,"f"),p0(this,Zm,t,"f"),p0(this,Pc,e._malloc(t*4),"f"),p0(this,Sc,e._malloc(t*4),"f"),tt(this,Pc,"f")===0||tt(this,Sc,"f")===0)throw new Error("Failed to allocate audio buffers")}static async create(e,t=128){let n=await e();return new r(n,t)}static fromModule(e,t=128){return new r(e,t)}dispose(){tt(this,It,"f")._free(tt(this,Pc,"f")),tt(this,It,"f")._free(tt(this,Sc,"f"))}createInstance(){return tt(this,It,"f")._nam_createInstance()}destroyInstance(e){tt(this,It,"f")._nam_destroyInstance(e)}getInstanceCount(){return tt(this,It,"f")._nam_getInstanceCount()}loadModel(e,t){let n=tt(this,It,"f").lengthBytesUTF8(t)+1,i=tt(this,It,"f")._malloc(n);if(i===0)return!1;try{return tt(this,It,"f").stringToUTF8(t,i,n),tt(this,It,"f")._nam_loadModel(e,i)}finally{tt(this,It,"f")._free(i)}}unloadModel(e){tt(this,It,"f")._nam_unloadModel(e)}hasModel(e){return tt(this,It,"f")._nam_hasModel(e)}process(e,t,n){let i=Math.min(t.length,n.length,tt(this,Zm,"f")),o=tt(this,Pc,"f")>>2,a=tt(this,Sc,"f")>>2;tt(this,It,"f").HEAPF32.set(t.subarray(0,i),o),tt(this,It,"f")._nam_process(e,tt(this,Pc,"f"),tt(this,Sc,"f"),i),n.set(tt(this,It,"f").HEAPF32.subarray(a,a+i))}processInPlace(e,t){this.process(e,t,t)}setSampleRate(e){tt(this,It,"f")._nam_setSampleRate(e)}getSampleRate(){return tt(this,It,"f")._nam_getSampleRate()}setMaxBufferSize(e){tt(this,It,"f")._nam_setMaxBufferSize(e)}getMaxBufferSize(){return tt(this,It,"f")._nam_getMaxBufferSize()}getModelLoudness(e){return tt(this,It,"f")._nam_getModelLoudness(e)}hasModelLoudness(e){return tt(this,It,"f")._nam_hasModelLoudness(e)}reset(e){tt(this,It,"f")._nam_reset(e)}get bufferSize(){return tt(this,Zm,"f")}};It=new WeakMap,Pc=new WeakMap,Sc=new WeakMap,Zm=new WeakMap;var _F;(function(r){r.parse=e=>JSON.parse(e)})(_F||(_F={}));var GR=(()=>{var r=import.meta.url;return function(e={}){var t=e,n,i;t.ready=new Promise((F,R)=>{n=F,i=R});var o=Object.assign({},t),a=[],s="./this.program",l=(F,R)=>{throw R},u=typeof window=="object",p=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function g(F){return t.locateFile?t.locateFile(F,h):h+F}var v,y,x;(u||p)&&(p?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h.indexOf("blob:")!==0?h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):h="",v=F=>{var R=new XMLHttpRequest;return R.open("GET",F,!1),R.send(null),R.responseText},p&&(x=F=>{var R=new XMLHttpRequest;return R.open("GET",F,!1),R.responseType="arraybuffer",R.send(null),new Uint8Array(R.response)}),y=(F,R,L)=>{var te=new XMLHttpRequest;te.open("GET",F,!0),te.responseType="arraybuffer",te.onload=()=>{if(te.status==200||te.status==0&&te.response){R(te.response);return}L()},te.onerror=L,te.send(null)});var B=t.print||console.log.bind(console),I=t.printErr||console.error.bind(console);Object.assign(t,o),o=null,t.arguments&&(a=t.arguments),t.thisProgram&&(s=t.thisProgram),t.quit&&(l=t.quit);var O;t.wasmBinary&&(O=t.wasmBinary),typeof WebAssembly!="object"&&Nc("no native wasm support detected");var z,$=!1,ie,ne,le,W,xe,se,Ee,Re,st;function gt(){var F=z.buffer;t.HEAP8=ne=new Int8Array(F),t.HEAP16=W=new Int16Array(F),t.HEAPU8=le=new Uint8Array(F),t.HEAPU16=xe=new Uint16Array(F),t.HEAP32=se=new Int32Array(F),t.HEAPU32=Ee=new Uint32Array(F),t.HEAPF32=Re=new Float32Array(F),t.HEAPF64=st=new Float64Array(F)}var ye=[],ke=[],lt=[],Lr=!1;function Wi(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Ec(t.preRun.shift());Yo(ye)}function Ws(){Lr=!0,Yo(ke)}function so(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Mt(t.postRun.shift());Yo(lt)}function Ec(F){ye.unshift(F)}function Fn(F){ke.unshift(F)}function Mt(F){lt.unshift(F)}var Bn=0,Fc=null,Da=null;function Bc(F){Bn++,t.monitorRunDependencies?.(Bn)}function qm(F){if(Bn--,t.monitorRunDependencies?.(Bn),Bn==0&&(Fc!==null&&(clearInterval(Fc),Fc=null),Da)){var R=Da;Da=null,R()}}function Nc(F){t.onAbort?.(F),F="Aborted("+F+")",I(F),$=!0,ie=1,F+=". Build with -sASSERTIONS for more info.";var R=new WebAssembly.RuntimeError(F);throw i(R),R}var $0="data:application/octet-stream;base64,",Hm=F=>F.startsWith($0),lo;t.locateFile?(lo="nam.wasm",Hm(lo)||(lo=g(lo))):lo=new URL("nam.wasm",import.meta.url).href;function Tp(F){if(F==lo&&O)return new Uint8Array(O);if(x)return x(F);throw"both async and sync fetching of the wasm failed"}function Jm(F){return!O&&(u||p)&&typeof fetch=="function"?fetch(F,{credentials:"same-origin"}).then(R=>{if(!R.ok)throw"failed to load wasm binary file at '"+F+"'";return R.arrayBuffer()}).catch(()=>Tp(F)):Promise.resolve().then(()=>Tp(F))}function Rp(F,R,L){return Jm(F).then(te=>WebAssembly.instantiate(te,R)).then(te=>te).then(L,te=>{I(`failed to asynchronously prepare wasm: ${te}`),Nc(te)})}function DF(F,R,L,te){return!F&&typeof WebAssembly.instantiateStreaming=="function"&&!Hm(R)&&typeof fetch=="function"?fetch(R,{credentials:"same-origin"}).then(Je=>{var nt=WebAssembly.instantiateStreaming(Je,L);return nt.then(te,function(Ge){return I(`wasm streaming compile failed: ${Ge}`),I("falling back to ArrayBuffer instantiation"),Rp(R,L,te)})}):Rp(R,L,te)}function MF(){var F={a:JM};function R(te,Je){return vt=te.exports,z=vt.h,gt(),Fn(vt.i),qm("wasm-instantiate"),vt}Bc("wasm-instantiate");function L(te){R(te.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(F,R)}catch(te){I(`Module.instantiateWasm callback failed with error: ${te}`),i(te)}return DF(O,lo,F,L).catch(i),{}}var Yo=F=>{for(;F.length>0;)F.shift()(t)},kF=t.noExitRuntime||!0;function T0(F){this.excPtr=F,this.ptr=F-24,this.set_type=function(R){Ee[this.ptr+4>>2]=R},this.get_type=function(){return Ee[this.ptr+4>>2]},this.set_destructor=function(R){Ee[this.ptr+8>>2]=R},this.get_destructor=function(){return Ee[this.ptr+8>>2]},this.set_caught=function(R){R=R?1:0,ne[this.ptr+12>>0]=R},this.get_caught=function(){return ne[this.ptr+12>>0]!=0},this.set_rethrown=function(R){R=R?1:0,ne[this.ptr+13>>0]=R},this.get_rethrown=function(){return ne[this.ptr+13>>0]!=0},this.init=function(R,L){this.set_adjusted_ptr(0),this.set_type(R),this.set_destructor(L)},this.set_adjusted_ptr=function(R){Ee[this.ptr+16>>2]=R},this.get_adjusted_ptr=function(){return Ee[this.ptr+16>>2]},this.get_exception_ptr=function(){var R=ZF(this.get_type());if(R)return Ee[this.excPtr>>2];var L=this.get_adjusted_ptr();return L!==0?L:this.excPtr}}var Qm=0,$F=0,R0=(F,R,L)=>{var te=new T0(F);throw te.init(R,L),Qm=F,$F++,Qm},TF=()=>{Nc("")},$M=(F,R,L)=>le.copyWithin(F,R,R+L),TM=()=>536870912,RM=F=>{var R=z.buffer,L=(F-R.byteLength+65535)/65536;try{return z.grow(L),gt(),1}catch{}},CM=F=>{var R=le.length;F>>>=0;var L=TM();if(F>L)return!1;for(var te=(hr,ni)=>hr+(ni-hr%ni)%ni,Je=1;Je<=4;Je*=2){var nt=R*(1+.2/Je);nt=Math.min(nt,F+100663296);var Ge=Math.min(L,te(Math.max(F,nt),65536)),dt=RM(Ge);if(dt)return!0}return!1},C0={},OM=()=>s||"./this.program",Cp=()=>{if(!Cp.strings){var F=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",R={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:F,_:OM()};for(var L in C0)C0[L]===void 0?delete R[L]:R[L]=C0[L];var te=[];for(var L in R)te.push(`${L}=${R[L]}`);Cp.strings=te}return Cp.strings},VM=(F,R)=>{for(var L=0;L<F.length;++L)ne[R++>>0]=F.charCodeAt(L);ne[R>>0]=0},RF=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,zM=(F,R,L)=>{for(var te=R+L,Je=R;F[Je]&&!(Je>=te);)++Je;if(Je-R>16&&F.buffer&&RF)return RF.decode(F.subarray(R,Je));for(var nt="";R<Je;){var Ge=F[R++];if(!(Ge&128)){nt+=String.fromCharCode(Ge);continue}var dt=F[R++]&63;if((Ge&224)==192){nt+=String.fromCharCode((Ge&31)<<6|dt);continue}var hr=F[R++]&63;if((Ge&240)==224?Ge=(Ge&15)<<12|dt<<6|hr:Ge=(Ge&7)<<18|dt<<12|hr<<6|F[R++]&63,Ge<65536)nt+=String.fromCharCode(Ge);else{var ni=Ge-65536;nt+=String.fromCharCode(55296|ni>>10,56320|ni&1023)}}return nt},Ym=(F,R)=>F?zM(le,F,R):"",O0={varargs:void 0,get(){var F=se[+O0.varargs>>2];return O0.varargs+=4,F},getp(){return O0.get()},getStr(F){var R=Ym(F);return R}},UM=(F,R)=>{var L=0;return Cp().forEach((te,Je)=>{var nt=R+L;Ee[F+Je*4>>2]=nt,VM(te,nt),L+=te.length+1}),0},jM=(F,R)=>{var L=Cp();Ee[F>>2]=L.length;var te=0;return L.forEach(Je=>te+=Je.length+1),Ee[R>>2]=te,0},Xm=F=>F%4===0&&(F%100!==0||F%400===0),LM=(F,R)=>{for(var L=0,te=0;te<=R;L+=F[te++]);return L},CF=[31,29,31,30,31,30,31,31,30,31,30,31],OF=[31,28,31,30,31,30,31,31,30,31,30,31],KM=(F,R)=>{for(var L=new Date(F.getTime());R>0;){var te=Xm(L.getFullYear()),Je=L.getMonth(),nt=(te?CF:OF)[Je];if(R>nt-L.getDate())R-=nt-L.getDate()+1,L.setDate(1),Je<11?L.setMonth(Je+1):(L.setMonth(0),L.setFullYear(L.getFullYear()+1));else return L.setDate(L.getDate()+R),L}return L},V0=F=>{for(var R=0,L=0;L<F.length;++L){var te=F.charCodeAt(L);te<=127?R++:te<=2047?R+=2:te>=55296&&te<=57343?(R+=4,++L):R+=3}return R},VF=(F,R,L,te)=>{if(!(te>0))return 0;for(var Je=L,nt=L+te-1,Ge=0;Ge<F.length;++Ge){var dt=F.charCodeAt(Ge);if(dt>=55296&&dt<=57343){var hr=F.charCodeAt(++Ge);dt=65536+((dt&1023)<<10)|hr&1023}if(dt<=127){if(L>=nt)break;R[L++]=dt}else if(dt<=2047){if(L+1>=nt)break;R[L++]=192|dt>>6,R[L++]=128|dt&63}else if(dt<=65535){if(L+2>=nt)break;R[L++]=224|dt>>12,R[L++]=128|dt>>6&63,R[L++]=128|dt&63}else{if(L+3>=nt)break;R[L++]=240|dt>>18,R[L++]=128|dt>>12&63,R[L++]=128|dt>>6&63,R[L++]=128|dt&63}}return R[L]=0,L-Je};function WM(F,R,L){var te=L>0?L:V0(F)+1,Je=new Array(te),nt=VF(F,Je,0,Je.length);return R&&(Je.length=nt),Je}var zF=(F,R)=>{ne.set(F,R)},ZM=(F,R,L,te)=>{var Je=Ee[te+40>>2],nt={tm_sec:se[te>>2],tm_min:se[te+4>>2],tm_hour:se[te+8>>2],tm_mday:se[te+12>>2],tm_mon:se[te+16>>2],tm_year:se[te+20>>2],tm_wday:se[te+24>>2],tm_yday:se[te+28>>2],tm_isdst:se[te+32>>2],tm_gmtoff:se[te+36>>2],tm_zone:Je?Ym(Je):""},Ge=Ym(L),dt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var hr in dt)Ge=Ge.replace(new RegExp(hr,"g"),dt[hr]);var ni=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],co=["January","February","March","April","May","June","July","August","September","October","November","December"];function Op(Q,$e,Zi){for(var oi=typeof Q=="number"?Q.toString():Q||"";oi.length<$e;)oi=Zi[0]+oi;return oi}function Kr(Q,$e){return Op(Q,$e,"0")}function tg(Q,$e){function Zi(rg){return rg<0?-1:rg>0?1:0}var oi;return(oi=Zi(Q.getFullYear()-$e.getFullYear()))===0&&(oi=Zi(Q.getMonth()-$e.getMonth()))===0&&(oi=Zi(Q.getDate()-$e.getDate())),oi}function Dr(Q){switch(Q.getDay()){case 0:return new Date(Q.getFullYear()-1,11,29);case 1:return Q;case 2:return new Date(Q.getFullYear(),0,3);case 3:return new Date(Q.getFullYear(),0,2);case 4:return new Date(Q.getFullYear(),0,1);case 5:return new Date(Q.getFullYear()-1,11,31);case 6:return new Date(Q.getFullYear()-1,11,30)}}function Ma(Q){var $e=KM(new Date(Q.tm_year+1900,0,1),Q.tm_yday),Zi=new Date($e.getFullYear(),0,4),oi=new Date($e.getFullYear()+1,0,4),rg=Dr(Zi),gk=Dr(oi);return tg(rg,$e)<=0?tg(gk,$e)<=0?$e.getFullYear()+1:$e.getFullYear():$e.getFullYear()-1}var qF={"%a":Q=>ni[Q.tm_wday].substring(0,3),"%A":Q=>ni[Q.tm_wday],"%b":Q=>co[Q.tm_mon].substring(0,3),"%B":Q=>co[Q.tm_mon],"%C":Q=>{var $e=Q.tm_year+1900;return Kr($e/100|0,2)},"%d":Q=>Kr(Q.tm_mday,2),"%e":Q=>Op(Q.tm_mday,2," "),"%g":Q=>Ma(Q).toString().substring(2),"%G":Q=>Ma(Q),"%H":Q=>Kr(Q.tm_hour,2),"%I":Q=>{var $e=Q.tm_hour;return $e==0?$e=12:$e>12&&($e-=12),Kr($e,2)},"%j":Q=>Kr(Q.tm_mday+LM(Xm(Q.tm_year+1900)?CF:OF,Q.tm_mon-1),3),"%m":Q=>Kr(Q.tm_mon+1,2),"%M":Q=>Kr(Q.tm_min,2),"%n":()=>`
43
- `,"%p":Q=>Q.tm_hour>=0&&Q.tm_hour<12?"AM":"PM","%S":Q=>Kr(Q.tm_sec,2),"%t":()=>" ","%u":Q=>Q.tm_wday||7,"%U":Q=>{var $e=Q.tm_yday+7-Q.tm_wday;return Kr(Math.floor($e/7),2)},"%V":Q=>{var $e=Math.floor((Q.tm_yday+7-(Q.tm_wday+6)%7)/7);if((Q.tm_wday+371-Q.tm_yday-2)%7<=2&&$e++,$e){if($e==53){var oi=(Q.tm_wday+371-Q.tm_yday)%7;oi!=4&&(oi!=3||!Xm(Q.tm_year))&&($e=1)}}else{$e=52;var Zi=(Q.tm_wday+7-Q.tm_yday-1)%7;(Zi==4||Zi==5&&Xm(Q.tm_year%400-1))&&$e++}return Kr($e,2)},"%w":Q=>Q.tm_wday,"%W":Q=>{var $e=Q.tm_yday+7-(Q.tm_wday+6)%7;return Kr(Math.floor($e/7),2)},"%y":Q=>(Q.tm_year+1900).toString().substring(2),"%Y":Q=>Q.tm_year+1900,"%z":Q=>{var $e=Q.tm_gmtoff,Zi=$e>=0;return $e=Math.abs($e)/60,$e=$e/60*100+$e%60,(Zi?"+":"-")+("0000"+$e).slice(-4)},"%Z":Q=>Q.tm_zone,"%%":()=>"%"};Ge=Ge.replace(/%%/g,"\0\0");for(var hr in qF)Ge.includes(hr)&&(Ge=Ge.replace(new RegExp(hr,"g"),qF[hr](nt)));Ge=Ge.replace(/\0\0/g,"%");var U0=WM(Ge,!1);return U0.length>R?0:(zF(U0,F),U0.length-1)},GM=(F,R,L,te,Je)=>ZM(F,R,L,te),UF=F=>{var R=t["_"+F];return R},jF=(F,R,L)=>VF(F,le,R,L),qM=F=>{var R=V0(F)+1,L=z0(R);return jF(F,L,R),L},LF=(F,R,L,te,Je)=>{var nt={string:Dr=>{var Ma=0;return Dr!=null&&Dr!==0&&(Ma=qM(Dr)),Ma},array:Dr=>{var Ma=z0(Dr.length);return zF(Dr,Ma),Ma}};function Ge(Dr){return R==="string"?Ym(Dr):R==="boolean"?!!Dr:Dr}var dt=UF(F),hr=[],ni=0;if(te)for(var co=0;co<te.length;co++){var Op=nt[L[co]];Op?(ni===0&&(ni=KF()),hr[co]=Op(te[co])):hr[co]=te[co]}var Kr=dt.apply(null,hr);function tg(Dr){return ni!==0&&WF(ni),Ge(Dr)}return Kr=tg(Kr),Kr},HM=(F,R,L,te)=>{var Je=!L||L.every(Ge=>Ge==="number"||Ge==="boolean"),nt=R!=="string";return nt&&Je&&!te?UF(F):function(){return LF(F,R,L,arguments,te)}},JM={a:R0,b:TF,g:$M,f:CM,d:UM,e:jM,c:GM},vt=MF(),QM=()=>(QM=vt.i)(),YM=t._nam_createInstance=()=>(YM=t._nam_createInstance=vt.j)(),XM=t._nam_destroyInstance=F=>(XM=t._nam_destroyInstance=vt.k)(F),ek=t._nam_getInstanceCount=()=>(ek=t._nam_getInstanceCount=vt.l)(),tk=t._nam_loadModel=(F,R)=>(tk=t._nam_loadModel=vt.m)(F,R),rk=t._nam_unloadModel=F=>(rk=t._nam_unloadModel=vt.n)(F),ik=t._nam_hasModel=F=>(ik=t._nam_hasModel=vt.o)(F),nk=t._nam_process=(F,R,L,te)=>(nk=t._nam_process=vt.p)(F,R,L,te),ok=t._nam_setSampleRate=F=>(ok=t._nam_setSampleRate=vt.q)(F),ak=t._nam_getSampleRate=()=>(ak=t._nam_getSampleRate=vt.r)(),sk=t._nam_setMaxBufferSize=F=>(sk=t._nam_setMaxBufferSize=vt.s)(F),lk=t._nam_getMaxBufferSize=()=>(lk=t._nam_getMaxBufferSize=vt.t)(),ck=t._nam_getModelLoudness=F=>(ck=t._nam_getModelLoudness=vt.u)(F),uk=t._nam_hasModelLoudness=F=>(uk=t._nam_hasModelLoudness=vt.v)(F),dk=t._nam_reset=F=>(dk=t._nam_reset=vt.w)(F),pk=t._free=F=>(pk=t._free=vt.x)(F),hk=t._malloc=F=>(hk=t._malloc=vt.y)(F),fk=()=>(fk=vt.__errno_location)(),KF=()=>(KF=vt.A)(),WF=F=>(WF=vt.B)(F),z0=F=>(z0=vt.C)(F),mk=F=>(mk=vt.__cxa_increment_exception_refcount)(F),ZF=F=>(ZF=vt.D)(F);t.ccall=LF,t.cwrap=HM,t.stringToUTF8=jF,t.lengthBytesUTF8=V0;var eg;Da=function F(){eg||GF(),eg||(Da=F)};function GF(){if(Bn>0||(Wi(),Bn>0))return;function F(){eg||(eg=!0,t.calledRun=!0,!$&&(Ws(),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),so()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),F()},1)):F()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return GF(),e.ready}})(),PF=GR;var h0=class r extends Ve{static ID=0;static#e=m.None;static#t=null;static async fetchWasm(e){return this.#e.nonEmpty()?this.#e.unwrap():q(this.#t)?this.#t:(this.#t=(async()=>{let t=await e.fetchNamWasm(),n=await PF({wasmBinary:t,locateFile:()=>""}),i=Gm.fromModule(n);return i.setSampleRate(sampleRate),this.#e=m.wrap(i),this.#t=null,i})(),this.#t)}#r=r.ID++;#i;#n;parameterInputGain;parameterOutputGain;parameterMix;#o;#a;#s;#l;#c;#u;#p=!1;#d="";#f=m.None;#h=[-1,-1];#m=!1;#g=1;#v=1;#w=!0;#A=1;#_=!1;constructor(e,t){super(e),this.#i=e,this.#n=t,this.#o=new Ae,this.#a=this.own(new Be(e.broadcaster,t.address)),this.#s=new ka({decay:.96}),this.#l=new Float32Array(this.#s.numBins()),this.#c=[new Float32Array(fe),new Float32Array(fe)],this.#u=[new Float32Array(fe),new Float32Array(fe)];let{namedParameter:n}=t;this.parameterInputGain=this.own(this.bindParameter(n.inputGain)),this.parameterOutputGain=this.own(this.bindParameter(n.outputGain)),this.parameterMix=this.own(this.bindParameter(n.mix)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#o,this.outgoing),t.modelField.catchupAndSubscribe(()=>this.#y()),t.monoField.catchupAndSubscribe(o=>this.#b(o.getValue())),e.broadcaster.broadcastFloats(t.spectrum,this.#l,o=>{this.#p=o,o&&(this.#l.set(this.#s.bins()),this.#s.decay=!0)})),this.#E(),this.readAllParameters(),t.getModelJson().length>0&&e.awaitResource(r.fetchWasm(e.engineToClient))}get incoming(){return this}get outgoing(){return this}reset(){if(this.#o.clear(),this.#a.clear(),this.eventInput.clear(),this.#_)return;let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();for(let n of this.#h)if(n>=0)try{t.reset(n)}catch(i){console.error("NAM reset failed:",i)}}}get uuid(){return this.#n.uuid}get audioOutput(){return this.#o}setAudioSource(e){return this.#f=m.wrap(e),{terminate:()=>this.#f=m.None}}index(){return this.#n.indexField.getValue()}adapter(){return this.#n}handleEvent(e){}processAudio(e,t,n){if(this.#_||this.#f.isEmpty())return;let[i,o]=this.#f.unwrap().channels(),[a,s]=this.#o.channels(),l=n-t,u=r.#e;if(u.isEmpty()||!this.#m||this.#h[0]<0){for(let $=t;$<n;$++)a[$]=i[$],s[$]=o[$];this.#a.process(a,s,t,n);return}let p=u.unwrap(),[d,h]=this.#c,[g,v]=this.#u,[y,x]=this.#h,B=this.#g,I=this.#v,O=this.#A,z=1-O;if(this.#w){for(let $=0;$<l;$++)d[$]=(i[t+$]+o[t+$])*.5*B;p.process(y,d.subarray(0,l),g.subarray(0,l));for(let $=0;$<l;$++){let ie=g[$]*I;a[t+$]=i[t+$]*z+ie*O,s[t+$]=o[t+$]*z+ie*O}}else{for(let $=0;$<l;$++)d[$]=i[t+$]*B,h[$]=o[t+$]*B;p.process(y,d.subarray(0,l),g.subarray(0,l)),p.process(x,h.subarray(0,l),v.subarray(0,l));for(let $=0;$<l;$++)a[t+$]=i[t+$]*z+g[$]*I*O,s[t+$]=o[t+$]*z+v[$]*I*O}this.#a.process(a,s,t,n),this.#p&&this.#s.process(a,s,t,n)}parameterChanged(e){e===this.parameterInputGain?this.#g=Pe(this.parameterInputGain.getValue()):e===this.parameterOutputGain?this.#v=Pe(this.parameterOutputGain.getValue()):e===this.parameterMix&&(this.#A=this.parameterMix.getValue())}terminate(){this.#_=!0,super.terminate(),this.#F()}toString(){return`{${this.constructor.name} (${this.#r})}`}#E(){let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();this.#h[0]<0&&(this.#h[0]=t.createInstance()),!this.#w&&this.#h[1]<0&&(this.#h[1]=t.createInstance())}}#F(){let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();for(let n=0;n<2;n++)if(this.#h[n]>=0){try{t.unloadModel(this.#h[n]),t.destroyInstance(this.#h[n])}catch(i){console.error("NAM destroyInstance failed:",i)}this.#h[n]=-1}}this.#m=!1}#b(e){if(this.#_)return;this.#w=e;let t=r.#e;if(t.isEmpty())return;let n=t.unwrap();if(e){if(this.#h[1]>=0){try{n.unloadModel(this.#h[1]),n.destroyInstance(this.#h[1])}catch(i){console.error("NAM destroyInstance failed in onMonoChanged:",i)}this.#h[1]=-1}}else if(this.#h[1]<0&&(this.#h[1]=n.createInstance(),this.#d.length>0))try{n.loadModel(this.#h[1],this.#d)}catch(i){console.error("NAM loadModel failed in onMonoChanged:",i)}}#y(){this.#x(this.#n.getModelJson())}#x(e){if(this.#_)return;this.#d=e,r.#e.nonEmpty()?(this.#E(),this.#S()):r.fetchWasm(this.#i.engineToClient).then(()=>{this.#_||(this.#E(),this.#S())}).catch(n=>console.error("Failed to load NAM WASM:",n))}#S(){if(this.#_)return;let e=r.#e;if(e.isEmpty()){this.#m=!1;return}if(this.#h[0]<0&&this.#E(),this.#h[0]<0){this.#m=!1;return}let t=e.unwrap();if(this.#d.length===0){for(let n of this.#h)n>=0&&t.unloadModel(n);this.#m=!1;return}try{this.#m=t.loadModel(this.#h[0],this.#d),this.#h[1]>=0&&(this.#m=this.#m&&t.loadModel(this.#h[1],this.#d))}catch(n){console.error("NAM loadModel failed:",n),this.#m=!1}}};var SF;(e=>e.create=(t,n)=>n.accept({visitAudioBusBox:i=>new Ip(t,t.boxAdapters.adapterFor(i,Hr)),visitVaporisateurDeviceBox:i=>new Fb(t,t.boxAdapters.adapterFor(i,gd)),visitNanoDeviceBox:i=>new Ob(t,t.boxAdapters.adapterFor(i,xd)),visitTapeDeviceBox:i=>new Db(t,t.boxAdapters.adapterFor(i,md)),visitPlayfieldDeviceBox:i=>new Kb(t,t.boxAdapters.adapterFor(i,Ps)),visitSoundfontDeviceBox:i=>new Jb(t,t.boxAdapters.adapterFor(i,Dd)),visitMIDIOutputDeviceBox:i=>new s0(t,t.boxAdapters.adapterFor(i,zd))}))(SF||={});var EF;(e=>e.create=(t,n)=>he(n.accept({visitUnknownMidiEffectDeviceBox:i=>new Gb(t,t.boxAdapters.adapterFor(i,Bd)),visitArpeggioDeviceBox:i=>new kb(t,t.boxAdapters.adapterFor(i,Hn)),visitPitchDeviceBox:i=>new $b(t,t.boxAdapters.adapterFor(i,vd)),visitVelocityDeviceBox:i=>new l0(t,t.boxAdapters.adapterFor(i,Ud)),visitZeitgeistDeviceBox:i=>new Zb(t,t.boxAdapters.adapterFor(i,Ed))}),`Could not create midi-effect for'${n.name}'`))(EF||={});var Km;(e=>e.create=(t,n)=>he(n.accept({visitUnknownAudioEffectDeviceBox:i=>new zm(t,t.boxAdapters.adapterFor(i,Fd)),visitStereoToolDeviceBox:i=>new Wb(t,t.boxAdapters.adapterFor(i,Pd)),visitMaximizerDeviceBox:i=>new Qb(t,t.boxAdapters.adapterFor(i,Md)),visitCompressorDeviceBox:i=>new i0(t,t.boxAdapters.adapterFor(i,kd)),visitGateDeviceBox:i=>new n0(t,t.boxAdapters.adapterFor(i,$d)),visitDelayDeviceBox:i=>new bb(t,t.boxAdapters.adapterFor(i,tr)),visitDattorroReverbDeviceBox:i=>new d0(t,t.boxAdapters.adapterFor(i,jd)),visitTidalDeviceBox:i=>new c0(t,t.boxAdapters.adapterFor(i,ro)),visitCrusherDeviceBox:i=>new o0(t,t.boxAdapters.adapterFor(i,Td)),visitFoldDeviceBox:i=>new a0(t,t.boxAdapters.adapterFor(i,Cd)),visitReverbDeviceBox:i=>new Cb(t,t.boxAdapters.adapterFor(i,Ju)),visitRevampDeviceBox:i=>new Tb(t,t.boxAdapters.adapterFor(i,Qu)),visitModularDeviceBox:i=>new zm(t,t.boxAdapters.adapterFor(i,ys)),visitNeuralAmpDeviceBox:i=>new h0(t,t.boxAdapters.adapterFor(i,Zd))}),`Could not create audio-effect for'${n.name}'`))(Km||={});var f0=class extends Ve{#e;#t;#r;#i;#n;#o;#a=m.None;#s=!0;#l=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=fr.linear(sampleRate),this.#i=fr.linear(sampleRate),this.#n=this.own(this.bindParameter(t.sendGain)),this.#o=this.own(this.bindParameter(t.sendPan)),this.own(e.registerProcessor(this)),this.readAllParameters()}reset(){this.#t.clear()}get adapter(){return this.#e}setAudioSource(e){return this.#a=m.wrap(e),{terminate:()=>this.#a=m.None}}get audioOutput(){return this.#t}processAudio(e,t,n){if(this.#a.isEmpty())return;if(this.#s){let u=Pe(this.#n.getValue()),p=this.#o.getValue();this.#r.set((1-Math.max(0,p))*u,this.#l),this.#i.set((1+Math.min(0,p))*u,this.#l),this.#s=!1}let i=this.#t.getChannel(0),o=this.#t.getChannel(1),a=this.#a.unwrap(),s=a.getChannel(0),l=a.getChannel(1);if(this.#r.isInterpolating()||this.#i.isInterpolating())for(let u=t;u<n;u++)i[u]=s[u]*this.#r.moveAndGet(),o[u]=l[u]*this.#i.moveAndGet();else{let u=this.#r.get(),p=this.#i.get();for(let d=t;d<n;d++)i[d]=s[d]*u,o[d]=l[d]*p}this.#l=!0}parameterChanged(e){this.#s=!0}};var m0=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s;#l=fr.linear(sampleRate);#c=fr.linear(sampleRate);#u=fr.linear(sampleRate);#p=m.None;#d=!0;#f=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=[new Float32Array(fe),new Float32Array(fe)],this.#i=this.own(new Be(e.broadcaster,this.#e.address)),this.#n=this.own(this.bindParameter(this.#e.namedParameter.volume)),this.#o=this.own(this.bindParameter(this.#e.namedParameter.panning)),this.#a=this.own(this.bindParameter(this.#e.namedParameter.mute)),this.#s=this.own(this.bindParameter(this.#e.namedParameter.solo)),this.ownAll(e.registerProcessor(this),e.mixer.attachChannelStrip(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this)),this.readAllParameters()}reset(){this.#i.clear(),this.#t.clear(),this.#r[0].fill(0),this.#r[1].fill(0),this.#f=!1}get isMute(){return this.#a.getValue()}get isSolo(){return this.#s.getValue()}get adapter(){return this.#e}get audioOutput(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#p.isEmpty())return;if(this.#d){let d=this.context.mixer;d.updateSolo();let h=this.isSolo||d.isVirtualSolo(this),g=this.isMute||d.hasChannelSolo()&&!h&&!this.#e.isOutput,v=Pe(this.#n.getValue()),y=this.#o.getValue();this.#l.set((1-Math.max(0,y))*v,this.#f),this.#c.set((1+Math.min(0,y))*v,this.#f),this.#u.set(g?0:1,this.#f),this.#d=!1}let i=this.#p.unwrap(),[o,a]=i.channels(),[s,l]=this.#t.channels(),[u,p]=this.#r;if(this.#l.isInterpolating()||this.#c.isInterpolating()||this.#u.isInterpolating())for(let d=t;d<n;d++){let h=this.#u.moveAndGet(),g=o[d]*this.#l.moveAndGet(),v=a[d]*this.#c.moveAndGet();s[d]=g*h,l[d]=v*h,u[d]=g,p[d]=v}else{let d=this.#l.get(),h=this.#c.get(),g=this.#u.get();for(let v=t;v<n;v++){let y=o[v]*d,x=a[v]*h;u[v]=y,p[v]=x,s[v]=y*g,l[v]=x*g}}this.#i.process(u,p,t,n),this.#f=!0}finishProcess(){this.#t.assertSanity()}parameterChanged(e){e===this.#n?this.requestGainUpdate():e===this.#o?this.requestGainUpdate():e===this.#a?this.requestGainUpdate():e===this.#s&&this.context.mixer.onChannelStripSoloChanged(this)}requestGainUpdate(){this.#d=!0}requestSoloUpdate(){this.#d=!0}setAudioSource(e){return this.#p=m.wrap(e),{terminate:()=>this.#p=m.None}}toString(){return`{${this.constructor.name}}`}};var g0=class extends gr{#e=m.None;#t=m.None;constructor(e){super(e)}setAudioSource(e){return this.#e=m.wrap(e),{terminate:()=>this.#e=m.None}}setChannels(e){this.#t=m.wrap(e)}clearChannels(){this.#t=m.None}get isActive(){return this.#t.nonEmpty()}reset(){}process(e){if(this.#e.isEmpty()||this.#t.isEmpty())return;let[t,n]=this.#e.unwrap().channels(),i=this.#t.unwrap(),o=this.context.getMonitoringChannel(i[0]);if(o.isEmpty())return;let a=o.unwrap(),s=i.length===2?this.context.getMonitoringChannel(i[1]).unwrapOrElse(a):a;for(let l=0;l<fe;l++)t[l]+=a[l],n[l]+=s[l]}};var v0=class{#e=new j;#t;#r;#i;#n;#o;#a;#s=[];#l=!1;#c=m.None;constructor(e,t){this.#t=e,this.#r=t,this.#i=b.newSet(n=>n.adapter.uuid),this.#n=this.#e.own(new m0(this.#t.context,this.#t.adapter)),this.#o=b.newSet(({device:n})=>n.uuid),this.#a=new j,this.#e.ownAll(this.#t.adapter.audioEffects.catchupAndSubscribe({onAdd:n=>{this.invalidateWiring();let i=Km.create(this.#t.context,n.box),o=this.#o.add({device:i,subscription:i.adapter().enabledField.subscribe(()=>{i.incoming.reset(),i.outgoing.reset(),this.invalidateWiring()})});V(o,"Could not add.")},onRemove:n=>{this.invalidateWiring();let{device:i,subscription:o}=this.#o.removeByKey(n.uuid);o.terminate(),i.terminate()},onReorder:n=>this.invalidateWiring()}),this.#t.adapter.auxSends.catchupAndSubscribe({onAdd:n=>{this.invalidateWiring();let i=this.#i.add(new f0(this.#t.context,n));V(i,"Could not add.")},onRemove:({uuid:n})=>{this.invalidateWiring(),this.#i.removeByKey(n).terminate()},onReorder:n=>{}}),this.#t.adapter.output.catchupAndSubscribe(n=>this.invalidateWiring()),this.#t.context.subscribeProcessPhase(n=>{n===0&&this.#l&&(this.#u(),this.#l=!1)}),this.#a)}get channelStrip(){return this.#n}invalidateWiring(){this.#a.terminate(),this.#l=!0}setMonitoringChannels(e){if(!this.#t.input().isEmpty()){if(this.#c.isEmpty()){let n=new g0(this.#t.context);this.#t.context.registerProcessor(n),this.#c=m.wrap(n)}this.#c.unwrap().setChannels(e),this.invalidateWiring()}}clearMonitoringChannels(){this.#c.ifSome(e=>{e.clearChannels(),this.invalidateWiring()})}terminate(){this.#c.ifSome(e=>e.terminate()),this.#e.terminate(),this.#o.forEach(({device:e})=>e.terminate()),this.#o.clear(),this.#s=[]}toString(){return`{${this.constructor.name}}`}#u(){let e=this.#t.context,t=this.#t.input();if(t.isEmpty())return;let n=this.#t.adapter.isOutput,i=this.#t.adapter.output.adapter.map(s=>e.getAudioUnit(s.deviceHost().uuid).inputAsAudioBus());if(this.#r.useInstrumentOutput){if(i.nonEmpty()&&!n){let s=t.unwrap(),l=i.unwrap();this.#a.own(l.addAudioSource(s.audioOutput)),this.#a.own(e.registerEdge(s.outgoing,l))}return}if(i.isEmpty()&&!n)return;let o=t.unwrap(),a=o.outgoing;if(this.#c.nonEmpty()&&this.#c.unwrap().isActive){let s=this.#c.unwrap();this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(o.outgoing,s)),a=s}if(this.#r.includeAudioEffects){U.replace(this.#s,this.#t.adapter.audioEffects.adapters().map(({uuid:s})=>this.#o.get(s).device));for(let s of this.#s)s.adapter().enabledField.getValue()&&(this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(a,s.incoming)),o=s,a=s.outgoing)}if(this.#r.includeSends&&this.#i.forEach(s=>{let l=e.getAudioUnit(s.adapter.targetBus.deviceHost().uuid);this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(l.inputAsAudioBus().addAudioSource(s.audioOutput)),this.#a.own(e.registerEdge(a,s)),this.#a.own(e.registerEdge(s,l.inputAsAudioBus()))}),this.#a.own(this.#n.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(a,this.#n)),i.nonEmpty()&&!n){let s=i.unwrap();this.#a.own(s.addAudioSource(this.#n.audioOutput)),this.#a.own(e.registerEdge(this.#n,s))}}};var y0=class{#e=new j;#t;#r;#i;#n;#o;#a;#s;constructor(e,t){this.#t=e,this.#r=t,this.#i=Rc.create(268431651),this.#n=new Set,this.#o=[],this.#a=new Qs,this.#s=new Qs,this.#e.ownAll(this.#t.subscribeProcessPhase(n=>{if(n===1)for(let i of this.#n)i.gate||this.#n.delete(i)}))}get uuid(){return this.#r.uuid}terminate(){this.#e.terminate()}pushRawNoteOn(e,t){this.#n.add({pitch:e,velocity:t,gate:!0,running:m.None})}pushRawNoteOff(e){for(let t of this.#n)if(t.running.isEmpty())this.#n.delete(t);else if(t.pitch===e){t.gate=!1;return}}auditionNote(e,t,n){this.#o.push({pitch:e,duration:t,velocity:n})}*processNotes(e,t,n){let i=St.every(n,5),o=St.every(n,2);if(this.#s.nonEmpty()&&(!i||o?yield*this.#p(e):yield*this.#d(e,t)),this.#a.nonEmpty())if(o)for(let a of this.#a.releaseAll())yield Fe.stop(a,e);else for(let a of this.#a.releaseLinearCompleted(t)){let s=be(a.position+a.duration,e,t);yield Fe.stop(a,s)}if(this.#n.size>0)for(let a of this.#n){if(a.running.isEmpty()){let{pitch:s,velocity:l}=a,u=Number.POSITIVE_INFINITY,p=Fe.start(e,u,s,l);a.running=m.wrap(p),yield p}a.gate||(this.#n.delete(a),yield Fe.stop(a.running.unwrap("raw note never started"),e))}if(this.#o.length>0){for(let a of this.#a.releaseAll())yield Fe.stop(a,e);for(let{pitch:a,duration:s,velocity:l}of this.#o){let u=Fe.start(e,s,a,l);this.#a.addAndRetain({...u}),yield u}this.#o.length=0}if(i){let a=this.#r.tracks.collection.adapters().filter(s=>s.type===me.Notes&&s.enabled.getValue());for(let s of a){let l=this.#t.clipSequencing.iterate(s.uuid,e,t);for(let{optClip:u,sectionFrom:p,sectionTo:d}of l)u.isEmpty()?yield*this.#c(s,p,d):yield*this.#l(u.unwrap(),p,d)}yield*this.#d(e,t)}}*iterateActiveNotesAt(e,t){if(this.#n.size>0)for(let{pitch:n,velocity:i}of this.#n)yield{type:"note-event",position:e,duration:Number.POSITIVE_INFINITY,pitch:n,velocity:i,cent:0};yield*this.#a.overlapping(e,$r.Comparator),!t&&(yield*this.#s.overlapping(e,$r.Comparator))}reset(){this.#n.clear(),this.#s.clear(),this.#o.length=0,this.#a.clear()}toString(){return`{${this.constructor.name}}`}*#l(e,t,n){if(e.optCollection.isEmpty())return;let i=this.#t.preferences.settings.playback.truncateNotesAtRegionEnd,o=e.optCollection.unwrap(),a=e.duration,s=ta(t,a),l=s+a,u=i?a:Number.POSITIVE_INFINITY;n>l?(yield*this.#u(o,t-s,l-s,s,u),yield*this.#u(o,0,n-l,l,u)):yield*this.#u(o,t-s,n-s,s,u)}*#c(e,t,n){let i=this.#t.preferences.settings.playback.truncateNotesAtRegionEnd;for(let o of e.regions.collection.iterateRange(t,n)){if(this.#t.ignoresRegion(o.address.uuid)||o.mute||!pt(o,ss))continue;let a=o.optCollection;if(a.isEmpty())continue;let s=a.unwrap();for(let{resultStart:l,resultEnd:u,rawStart:p,rawEnd:d}of kr.locateLoops(o,t,n)){let h=i?Math.min(d,o.complete):Number.POSITIVE_INFINITY;yield*this.#u(s,l-p,u-p,p,h-p)}}}*#u(e,t,n,i,o){for(let a of e.events.iterateRange(t-e.maxDuration,n)){if(!$r.isOfType(a))continue;let{position:s,duration:l,chance:u,playCount:p,playCurve:d}=a;if(!(u<100&&this.#i.nextDouble(0,100)>u)){if(p>1){let h=$r.inverseCurveFunc((t-s)/l,d),g=$r.inverseCurveFunc((n-s)/l,d),v=Math.floor(h*p),y=v/p;for(;y<g;){if(y>=h){let x=$r.curveFunc(y,d)*l;if(x>=l)break;let B=$r.curveFunc(y+1/p,d)*l,I=Fe.startWith(a,s+x+i,B-x);this.#s.addAndRetain({...I}),yield I}y=++v/p}}else if(t<=s&&s<n){let h=Math.min(a.duration,o-s),g=Fe.startWith(a,s+i,h);this.#s.addAndRetain({...g}),yield g}}}}*#p(e){for(let t of this.#s.releaseAll())yield Fe.stop(t,e)}*#d(e,t){for(let n of this.#s.releaseLinearCompleted(t)){let i=be(n.position+n.duration,e,t);yield Fe.stop(n,i)}}};var x0=class{#e=new j;#t;#r;#i;#n;#o=!1;constructor(e){this.#t=e,this.#r=this.#e.own(new y0(this.#t.context,this.#t.adapter)),this.#i=b.newSet(({device:t})=>t.uuid),this.#n=this.#e.own(new j),this.#e.ownAll(this.#t.adapter.midiEffects.catchupAndSubscribe({onAdd:t=>{this.invalidateWiring();let n=EF.create(this.#t.context,t.box),i=this.#i.add({device:n,subscription:n.adapter().enabledField.subscribe(()=>{n.reset(),this.invalidateWiring()})});V(i,"Could not add.")},onRemove:t=>{this.invalidateWiring();let{device:n,subscription:i}=this.#i.removeByKey(t.uuid);i.terminate(),n.terminate()},onReorder:t=>this.invalidateWiring()}),this.#t.context.subscribeProcessPhase(t=>{t===0&&this.#o&&(this.#a(),this.#o=!1)}))}get noteSequencer(){return this.#r}invalidateWiring(){this.#n.terminate(),this.#o=!0}terminate(){this.#e.terminate()}toString(){return`{${this.constructor.name}}`}#a(){let e=this.#t.input().flatMap(i=>i.noteEventTarget);if(e.isEmpty())return;let t=e.unwrap(),n=this.#r;this.#t.adapter.midiEffects.adapters().map(i=>this.#i.get(i.uuid).device).forEach(i=>{i.adapter().enabledField.getValue()&&(this.#n.ownAll(i.setNoteEventSource(n),this.#t.context.registerEdge(i,t.incoming)),n=i)}),this.#n.own(t.setNoteEventSource(n))}};var w0=class r{static ID=0;#e=r.ID++;#t=new j;#r;#i;#n;#o;#a=m.None;#s;constructor(e,t,n){this.#r=e,this.#i=t,this.#s=n.useInstrumentOutput,this.#n=this.#t.own(new x0(this)),this.#o=this.#t.own(new v0(this,n)),this.#t.ownAll(this.#i.input.catchupAndSubscribe(i=>{this.#n.invalidateWiring(),this.#o.invalidateWiring(),this.#a.ifSome(o=>o.terminate()),this.#a=i.flatMap(o=>m.wrap(SF.create(e,o.box.box)))}))}input(){return this.#a}inputAsAudioBus(){return Ce(this.#a.unwrap("No input available"),Ip)}audioOutput(){return this.#s?this.#a.unwrap().audioOutput:this.#o.channelStrip.audioOutput}get midiDeviceChain(){return this.#n}get audioDeviceChain(){return this.#o}get context(){return this.#r}get adapter(){return this.#i}invalidateWiring(){this.#o.invalidateWiring()}setMonitoringChannels(e){this.#o.setMonitoringChannels(e)}clearMonitoringChannels(){this.#o.clearMonitoringChannels()}terminate(){this.#t.terminate(),this.#a.ifSome(e=>e.terminate()),this.#a=m.None}toString(){return`{${this.constructor.name}(${this.#e})}`}};var b0=class{#e;#t;#r;#i=!1;constructor(){this.#e=b.newSet(e=>e.adapter.uuid),this.#t=new Set,this.#r=new Set}attachChannelStrip(e){return this.#e.add(e),ee.many(e.adapter.input.subscribe(()=>this.#n()),e.adapter.output.subscribe(()=>this.#n()),{terminate:()=>{this.#t.delete(e),this.#e.removeByValue(e),this.#n()}})}onChannelStripSoloChanged(e){e.isSolo?this.#t.add(e):this.#t.delete(e),this.#n()}hasChannelSolo(){return this.#t.size>0}isVirtualSolo(e){return this.#r.has(e)}#n(){this.#i||(this.#i=!0,this.#e.forEach(e=>e.requestSoloUpdate()))}updateSolo(){if(!this.#i)return;this.#r.clear();let e=new Set,t=new Set,n=o=>{e.has(o)||(e.add(o),o.adapter.input.adapter().ifSome(a=>{a.type==="bus"&&a.box.input.pointerHub.filter(c.AudioOutput).map(s=>he(s.box.accept({visitAudioUnitBox:({address:{uuid:l}})=>this.#e.get(l),visitAuxSendBox:({audioUnit:{targetVertex:l}})=>this.#e.get(l.unwrap().address.uuid)}),"Could not resolve channel-strip")).forEach(s=>{s.isSolo||this.#r.add(s),n(s)})}))},i=o=>{t.has(o)||(t.add(o),o.adapter.output.adapter.ifSome(a=>{let s=this.#e.get(a.audioUnitBoxAdapter().uuid);s.isSolo||(this.#r.add(s),i(s))}))};this.#e.forEach(o=>{o.isSolo&&(n(o),i(o))}),this.#i=!1}};var A0=class r{static createDefaultClickSounds(){return[880,440].map(e=>{let t=Math.floor(.002*sampleRate),n=Math.floor(.05*sampleRate),i=t+n,o=gg.create(sampleRate,i,1);for(let a=0;a<i;a++){let s=Math.min(a/t,1-(a-t)/n),l=Math.sin(a/sampleRate*Nn*e)*s*s;o.frames[0][a]+=l}return o})}#e;#t=new Ae;#r=r.createDefaultClickSounds();#i=[];constructor(e){this.#e=e}loadClickSound(e,t){this.#r[e]=t}process({blocks:e}){let t=this.#e.timeInfo.metronomeEnabled,n=this.#e.timelineBoxAdapter.signatureTrack,i=this.#e.preferences.settings.metronome,{beatSubDivision:o,gain:a,monophonic:s}=i;e.forEach(({p0:l,p1:u,bpm:p,s0:d,s1:h,flags:g})=>{if(t&&St.every(g,1))for(let[v,y]of ht.pairWise(n.iterateAll())){let x=v.accumulatedPpqn,B=Ct(y)?y.accumulatedPpqn:1/0;if(B<=l)continue;if(x>=u&&v.index!==-1)break;let I=v.index===-1?l:Math.max(l,x),O=Math.min(u,B),z=v.denominator*o,$=J.fromSignature(1,z),ie=I-x,ne=Math.ceil(ie/$),le=x+ne*$;for(;le<O;){let W=Math.floor(J.pulsesToSamples(le-l,p,sampleRate)),se=Math.round((le-x)/$)%v.nominator===0?0:1;s&&this.#i.forEach(Ee=>Ee.fadeOut()),this.#i.push(new FF(this.#r[se],d+W,a)),le+=$}}this.#t.clear(d,h);for(let v=this.#i.length-1;v>=0;v--)this.#i[v].processAdd(this.#t,d,h)&&this.#i.splice(v,1)})}get output(){return this.#t}},FF=class r{static FadeOutDuration=Math.floor(.005*sampleRate)|0;#e;#t;#r=0;#i=0;#n=-1;constructor(e,t,n){V(t>=0&&t<fe,`${t} out of bounds`),this.#e=e,this.#t=n,this.#i=t}fadeOut(){this.#n<0&&(this.#n=0)}processAdd(e,t,n){let[i,o]=e.channels(),a=Pe(this.#t),{frames:s,numberOfChannels:l,numberOfFrames:u,sampleRate:p}=this.#e,d=s[0],h=s[l>1?1:0],g=p/sampleRate,v=this.#n>=0,y=1;for(let x=Math.max(this.#i,t);x<n;x++){let B=this.#r,I=B|0,O=B-I;if(v&&(y=1-this.#n/r.FadeOutDuration,++this.#n>=r.FadeOutDuration)||(i[x]+=(d[I]+O*(d[I+1]-d[I]))*a*y,o[x]+=(h[I]+O*(h[I+1]-h[I]))*a*y,this.#r+=g,this.#r>=u-1))return!0}return this.#i=0,!1}};var _0=class{#e;constructor(){this.#e=Me.newSet(({address:e})=>e)}register(e,t,n){return this.#e.add({address:e,buffer:t,processor:n}),{terminate:()=>this.#e.removeByKey(e)}}resolve(e){return this.#e.opt(e)}};var P0=class{#e=new j;#t;#r;#i=!1;#n=null;#o=!1;#a=0;#s=m.None;#l;constructor(e){this.#t=e;let{timelineBoxAdapter:t}=e,{box:{bpm:n},markerTrack:i}=t;this.#l=n.getValue(),i.subscribe(()=>this.#o=!0),this.#e.ownAll(n.subscribe(o=>{this.#s.isEmpty()&&(this.#l=o.getValue(),this.#i=!0)}),t.catchupAndSubscribeTempoAutomation(o=>{this.#s=o,o.isEmpty()&&(this.#l=n.getValue()),this.#i=!0})),this.#r=new $c}get bpm(){return this.#l}setCallback(e,t){return this.#r.add(e,t),ee.create(()=>this.#r.remove(e,t))}reset(){this.#i=!1,this.#o=!1,this.#a=0,this.#n=null}process(e){let t=!1,{timeInfo:n,timelineBoxAdapter:{box:i,markerTrack:o},preferences:{settings:a}}=this.#t,s=a.playback.pauseOnLoopDisabled,l=a.recording.allowTakes,u=n.transporting;if(u){let p=[],d=n.position,h=0,g=0,v=n.getLeapStateAndReset();for(;h<fe;){if(this.#o||v){this.#o=!1;let W=o.events.lowerEqual(d);(this.#n?.at(0)??null)!==W&&(this.#n=q(W)?[W,0]:null,t=!0)}if(v&&this.#s.nonEmpty()){let W=this.#s.unwrap().valueAt(d,this.#l);W!==this.#l&&(this.#l=W,this.#i=!0)}let y=fe-h,x=d+J.samplesToPulses(y,this.#l,sampleRate),B=null,I=Number.POSITIVE_INFINITY;if(o.enabled){let W=Array.from(ht.take(o.events.iterateFrom(d),2));if(W.length>0){let[xe,se]=W;this.#n===null?xe.position>=d&&xe.position<x&&(B={type:"marker",prev:xe,next:se},I=xe.position):q(se)&&se!==this.#n[0]&&xe.position<d&&se.position<x&&(B={type:"marker",prev:xe,next:se},I=se.position)}}let{isCountingIn:O}=this.#t.timeInfo,{from:z,to:$,enabled:ie}=i.loopArea;if(ie.getValue()&&!O&&(!n.isRecording||l)||s){let W=$.getValue();d<W&&x>W&&W<I&&(B={type:"loop",target:z.getValue()},I=W)}if(this.#r.keyCount()>0)for(let W of this.#r.keys())d<W&&x>W&&W<I&&(B={type:"callback",position:W,callbacks:this.#r.get(W)},I=W);if(this.#s.nonEmpty()&&!this.#s.unwrap().events.isEmpty()){let W=Dc(d,na);if(W>=d&&W<x&&W<I){let xe=this.#s.unwrap().valueAt(W,this.#l);xe!==this.#l&&(B={type:"tempo",position:W,bpm:xe},I=W)}}let le=!n.isCountingIn;if(B===null){let W=h+y;p.push({index:g++,p0:d,p1:x,s0:h,s1:W,bpm:this.#l,flags:Bp.create(u,v,le,this.#i)}),v=!1,d=x,h=W}else{let W=()=>{if(I>d){let se=h+J.pulsesToSamples(I-d,this.#l,sampleRate)|0;se>h&&(p.push({index:g++,p0:d,p1:I,s0:h,s1:se,bpm:this.#l,flags:Bp.create(u,v,le,this.#i)}),v=!1),d=I,h=se}},xe=()=>{if(h<fe){let se=h+J.pulsesToSamples(x-d,this.#l,sampleRate)|0;p.push({index:g++,p0:d,p1:I,s0:h,s1:se,bpm:this.#l,flags:Bp.create(!1,!1,!1,this.#i)}),h=se}};switch(B.type){case"loop":{W(),s?(this.#t.timeInfo.pause(),xe()):(d=B.target,v=!0);break}case"marker":{let{prev:se,next:Ee}=B;!q(this.#n)||this.#n[0]!==se?this.#n=[se,0]:++this.#n[1]<se.plays||se.plays===0?(W(),d=se.position,v=!0):this.#n=[Ee,0],t=!0;break}case"callback":{W(),B.callbacks.forEach(se=>se());break}case"tempo":{W(),this.#l=B.bpm,this.#i=!0;break}}}}e({blocks:p}),n.advanceTo(d),v=!1,this.#a=d,this.#i=!1}else{let p=n.getLeapStateAndReset();if((p||this.#i)&&this.#s.nonEmpty()){let v=this.#s.unwrap().valueAt(this.#t.timeInfo.position,this.#l);v!==this.#l&&(this.#l=v,this.#i=!0)}if(this.#o||p){this.#o=!1;let v=o.events.lowerEqual(n.position);v!==null&&this.#n?.at(0)!==v&&(this.#n=[v,0],t=!0)}let d=this.#a,h=d+J.samplesToPulses(fe,this.#l,sampleRate),g={blocks:[{index:0,p0:d,p1:h,s0:0,s1:fe,bpm:this.#l,flags:Bp.create(!1,!1,!1,this.#i)}]};e(g),this.#i=!1,this.#a=h}t&&this.#t.engineToClient.switchMarkerState(q(this.#n)?[this.#n[0].uuid,this.#n[1]]:null)}terminate(){this.#e.terminate()}};var BF=class{constructor(e,t){this.uuid=e;this.engineToClient=t;t.fetchAudio(e).then(n=>this.#t=m.wrap(n),console.warn)}peaks=m.None;#e={type:"idle"};#t=m.None;get data(){return this.#t}get state(){return this.#e}subscribe(e){return ee.Empty}invalidate(){}terminate(){this.#t=m.None}toString(){return"{SampleLoaderWorklet}"}},S0=class{#e;#t;constructor(e){this.#e=e,this.#t=b.newSet(({uuid:t})=>t)}record(e){}getOrCreate(e){return this.#t.getOrCreate(e,t=>new BF(t,this.#e))}remove(e){this.#t.removeByKey(e).terminate()}register(e){return ee.Empty}invalidate(e){}terminate(){this.#t.forEach(e=>e.terminate()),this.#t.clear()}};var E0=class{constructor(e){this.uuid=e}waiting=m.None;playing=m.None},F0=class{#e;#t;#r=[];#i=[];#n=[];constructor(e){this.#e=e,this.#e.subscribeToAllUpdatesImmediate({onUpdate:t=>{if(t.type==="delete"){let n=t.uuid;this.#t.opt(n).ifSome(i=>{i.playing.ifSome(o=>this.#a(o.uuid)),i.playing=m.None,i.waiting=m.None}),this.#t.forEach(i=>{i.playing.nonEmpty()&&b.equals(i.playing.unwrap().uuid,n)&&(i.playing=m.None,this.#a(n));let o=i.waiting.flatMap(zp);o.nonEmpty()&&b.equals(o.unwrap().uuid,n)&&(i.waiting=m.None)})}}}),this.#t=b.newSet(t=>t.uuid)}schedulePlay(e){e.trackBoxAdapter.ifSome(({uuid:t})=>{let n=this.#t.getOrCreate(t,o=>new E0(o));if(n.playing.nonEmpty()&&n.playing.unwrap()===e){console.debug(`${e} is already playing (ignore)`);return}let i=n.waiting.flatMap(o=>o);i.nonEmpty()&&(console.debug("obsolete",i.unwrap()),this.#n.push(i.unwrap().uuid),n.waiting=m.None),console.debug(`schedulePlay(${b.toString(n.uuid)} > ${e})`),U.removeOpt(this.#n,e.uuid),n.waiting=m.wrap(m.wrap(e))})}scheduleStop({uuid:e}){let t=this.#t.getOrCreate(e,i=>new E0(i)),n=t.waiting.flatMap(i=>i);n.nonEmpty()&&(console.debug("obsolete",n.unwrap()),this.#n.push(n.unwrap().uuid),t.waiting=m.None),t.playing.nonEmpty()&&(console.debug(`scheduleStop(${b.toString(e)})`),t.waiting=m.wrap(m.None))}reset(){this.#t.forEach(e=>{e.waiting.ifSome(t=>t.ifSome(n=>this.#n.push(n.uuid))),e.waiting=m.None,e.playing.ifSome(t=>this.#a(t.uuid)),e.playing=m.None}),this.#t.clear()}*iterate(e,t,n){let i=this.#t.getOrNull(e);if(i===null){yield{optClip:m.None,sectionFrom:t,sectionTo:n};return}if(i.waiting.nonEmpty()){let o=i.waiting.unwrap(),a=i.playing.mapOr(l=>l.duration,J.Bar),s=ta(n,a);s>=t?(t<s&&(yield{optClip:i.playing,sectionFrom:t,sectionTo:s}),i.waiting=m.None,i.playing.ifSome(l=>this.#a(l.uuid)),o.nonEmpty()?(i.playing=o,this.#o(o.unwrap().uuid)):i.playing=m.None,yield{optClip:i.playing,sectionFrom:s,sectionTo:n}):yield{optClip:i.playing,sectionFrom:t,sectionTo:n}}else if(i.playing.nonEmpty()){let o=i.playing.unwrap();if(o.box.triggerMode.loop.getValue())yield{optClip:i.playing,sectionFrom:t,sectionTo:n};else{let a=ta(t,o.duration)+o.duration;a<=n?(yield{optClip:i.playing,sectionFrom:t,sectionTo:a},i.playing=m.None,this.#a(o.uuid),a<n&&(yield{optClip:m.None,sectionFrom:a,sectionTo:n})):yield{optClip:i.playing,sectionFrom:t,sectionTo:n}}}else yield{optClip:m.None,sectionFrom:t,sectionTo:n}}changes(){if(this.#r.length>0||this.#i.length>0||this.#n.length>0){let e=m.wrap({started:this.#r.slice(),stopped:this.#i.slice(),obsolete:this.#n.slice()});return this.#r.length=0,this.#i.length=0,this.#n.length=0,e}return m.None}terminate(){this.#t.clear(),this.#r.length=0,this.#i.length=0,this.#n.length=0}#o(e){this.#r.push(e)}#a(e){this.#i.push(e)}};var NF;(e=>e.Default={includeAudioEffects:!0,includeSends:!0,useInstrumentOutput:!1})(NF||={});var IF=class{constructor(e,t){this.uuid=e;this.engineToClient=t;t.fetchSoundfont(e).then(n=>this.#t=m.wrap(n),console.warn)}peaks=m.None;#e={type:"idle"};#t=m.None;get soundfont(){return this.#t}get state(){return this.#e}subscribe(e){return ee.Empty}invalidate(){}toString(){return"{SoundfontLoaderWorklet}"}},B0=class{#e;#t;constructor(e){this.#e=e,this.#t=b.newSet(t=>t.uuid)}getOrCreate(e){return this.#t.getOrCreate(e,t=>new IF(t,this.#e))}remove(e){}invalidate(e){}};var N0=class r extends gr{static ClockRate=J.fromSignature(1,24*4);#e;#t;constructor(e,t){super(e),this.#e=t,this.#t=[],this.own(this.context.registerProcessor(this))}schedule(e){this.#t.push(e)}reset(){this.eventInput.clear()}process({blocks:e}){let t=this.#e.midiOutputDevices;if(t.length===0){this.#t.length=0;return}let n=t.filter(i=>i.sendTransportMessages.getValue()&&i.id.getValue()!=="");if(n.length===0){this.#t.length=0;return}n.forEach(i=>{let o=i.id.getValue(),a=i.delayInMs.getValue();this.#t.forEach(s=>this.context.sendMIDIData(o,s,a)),this.#t.length=0}),e.forEach(({p0:i,p1:o,s0:a,bpm:s,flags:l})=>{let u=a/sampleRate;if(St.every(l,1))for(let p of Oa.iterate(i,o,r.ClockRate)){let d=J.pulsesToSeconds(p-i,s);n.forEach(h=>{let g=h.id.getValue(),v=h.delayInMs.getValue(),y=(u+d)*1e3+v;this.context.sendMIDIData(g,Nt.Clock,y)})}})}toString(){return`{${this.constructor.name}}`}};var I0=class{#e;#t;#r;#i;#n=new Map;#o=[];constructor(e,t){this.#e=e,this.#t=new Uint32Array(t,0,2),this.#r=new Uint32Array(t,8),this.#i=(this.#r.length>>1)-1}send(e,t,n){let i=this.#n.get(e);if(Ic(i)){if(i=this.#o.length,i>=64)return console.error(`Too many MIDI devices: ${i}, max is 64`),!1;this.#n.set(e,i),this.#o.push(e),this.#e.postMessage({registerDevice:e,id:i})}let o=Atomics.load(this.#t,0),a=o+1&this.#i;if(a===Atomics.load(this.#t,1))return!1;let s=t.length,l=t[0]??0,u=t[1]??0,p=t[2]??0,d=s<<30|i<<24|l<<16|u<<8|p,h=n|0,g=o<<1;return this.#r[g]=d,this.#r[g+1]=h,Atomics.store(this.#t,0,a),this.#e.postMessage(null),!0}};var D0=class{#e;#t;#r=0;#i=0;#n=0;#o=0;constructor(e){this.#e=new Int32Array(e),this.#t=new Float64Array(e)}start(){let e=Atomics.load(this.#e,1),t=Atomics.load(this.#e,2),n=this.#t[2],i=this.#t[3];this.#a();let o=0;return this.#r>0&&this.#i===this.#r+1&&(o=this.#o-this.#n),this.#r=e,this.#i=t,this.#n=n,this.#o=i,o}end(){this.#a()}#a(){Atomics.add(this.#e,0,1),Atomics.notify(this.#e,0)}};var qR=!1,M0=class extends AudioWorkletProcessor{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$=new Set;#T=new Float32Array(wx);#N=m.None;#R=m.None;#C=[];#O=m.None;#V=m.None;#W=!1;#U=!0;#j=0;#z=0;#L=0;constructor({processorOptions:{syncStreamBuffer:e,controlFlagsBuffer:t,hrClockBuffer:n,project:i,exportConfiguration:o}}){super();let{boxGraph:a,mandatoryBoxes:{rootBox:s,timelineBox:l}}=zs.decode(i);this.#e=new j,this.#t=uB.for(this.port),this.#r=new Om(this.#t.channel("engine-preferences"),dM.parse({})),this.#i=a,this.#n=new Ev,this.#M=new Int32Array(t),this.#k=new D0(n),this.#o=In.sender(this.#t.channel("engine-to-client"),d=>new class{log(h){d.dispatchAndForget(this.log,h)}error(h){d.dispatchAndForget(this.error,h)}fetchAudio(h){return d.dispatchAndReturn(this.fetchAudio,h)}fetchSoundfont(h){return d.dispatchAndReturn(this.fetchSoundfont,h)}fetchNamWasm(){return d.dispatchAndReturn(this.fetchNamWasm)}notifyClipSequenceChanges(h){d.dispatchAndForget(this.notifyClipSequenceChanges,h)}switchMarkerState(h){d.dispatchAndForget(this.switchMarkerState,h)}ready(){d.dispatchAndForget(this.ready)}}),this.#s=this.#e.own(new S0(this.#o)),this.#l=new B0(this.#o),this.#c=b.newSet(d=>d.adapter.uuid),this.#f=new Px,this.#a=this.#e.own(new xx(this)),this.#p=this.#a.adapterFor(l,ln),this.#d=this.#e.own(new Nx(this.timelineBoxAdapter)),this.#u=this.#a.adapterFor(s,fd),this.#h=new bg,this.#m=new Ag(this.#h),this.#g=new ce,this.#v=new b0,this.#b=new A0(this),this.#y=new N0(this,this.#u),this.#x=new _0,this.#S=this.#e.own(new P0(this)),this.#B=b.newSet(d=>d),this.#I=Vc.writer(pN(),e,d=>{let{transporting:h,isCountingIn:g,isRecording:v,position:y}=this.#n,x=this.#p.box.signature.denominator.getValue();d.position=y,d.bpm=this.#S.bpm,d.playbackTimestamp=this.#z,d.countInBeatsRemaining=g?(this.#j-y)/J.fromSignature(1,x):0,d.isPlaying=h,d.isRecording=v,d.isCountingIn=g,d.perfBuffer.set(this.#T),d.perfIndex=this.#L}),this.#w=this.#e.own(vb.create(this.#t,"engine-live-data")),this.#_=new xb(this),this.#E=this.#e.own(new Be(this.#w,Gd.PEAKS)),this.#F=new ka;let u=new Float32Array(this.#F.numBins()),p=new Float32Array(this.#F.numBins());this.#e.own(this.#w.broadcastFloats(Gd.SPECTRUM,u,d=>{d&&(u.set(this.#F.bins()),this.#F.decay=!0)})),this.#e.own(this.#w.broadcastFloats(Gd.WAVEFORM,p,d=>{d&&p.set(this.#F.waveform())})),this.#A=this.#e.own(new F0(this.#i)),this.#e.ownAll(dB(this.#i,this.#t.channel("engine-sync")),this.#r.catchupAndSubscribe(d=>this.#n.metronomeEnabled=d,"metronome","enabled"),In.executor(this.#t.channel("engine-commands"),{play:()=>this.#Z(),stop:d=>this.#G(d),setPosition:d=>this.#q(d),prepareRecordingState:d=>this.#H(d),stopRecording:()=>this.#J(),queryLoadingComplete:()=>Promise.all(this.#$).then(()=>this.#i.boxes().every(d=>d.accept({visitAudioFileBox:h=>this.#s.getOrCreate(h.address.uuid).data.nonEmpty()&&h.pointerHub.nonEmpty()})??!0)),panic:()=>this.#W=!0,loadClickSound:(d,h)=>this.#b.loadClickSound(d,h),updateMonitoringMap:d=>{this.#c.forEach(h=>h.clearMonitoringChannels());for(let{uuid:h,channels:g}of d)this.optAudioUnit(h).ifSome(v=>v.setMonitoringChannels(g))},noteSignal:d=>{if(Fa.isOn(d)){let{uuid:h,pitch:g,velocity:v}=d;this.optAudioUnit(h).ifSome(y=>y.midiDeviceChain.noteSequencer.pushRawNoteOn(g,v))}else if(Fa.isOff(d)){let{uuid:h,pitch:g}=d;this.optAudioUnit(h).ifSome(v=>v.midiDeviceChain.noteSequencer.pushRawNoteOff(g))}else if(Fa.isAudition(d)){let{uuid:h,pitch:g,duration:v,velocity:y}=d;this.optAudioUnit(h).ifSome(x=>x.midiDeviceChain.noteSequencer.auditionNote(g,v,y))}},ignoreNoteRegion:d=>this.#B.add(d),scheduleClipPlay:d=>{d.forEach(h=>{let g=this.#i.findBox(h);if(g.isEmpty())console.warn(`Could not scheduleClipPlay. Cannot find clip: '${b.toString(h)}'`);else{let v=Zv.for(this.#a,g.unwrap());this.#A.schedulePlay(v)}}),this.#n.transporting=!0,this.#y.schedule(Nt.Start)},scheduleClipStop:d=>{d.forEach(h=>{let g=this.#i.findBox(h);g.isEmpty()?console.warn(`Could not scheduleClipStop. Cannot find track: '${b.toString(h)}'`):this.#A.scheduleStop(this.#a.adapterFor(g.unwrap(),Vt))})},setupMIDI:(d,h)=>{this.#V=m.wrap(new I0(d,h))},terminate:()=>{this.#O.ifSome(d=>d.terminate()),this.#O=m.None,this.#U=!1,this.#B.clear(),this.#c.forEach(d=>d.invalidateWiring()),this.#e.terminate(),this.#c.forEach(d=>d.terminate()),this.#c.clear()}}),this.#u.audioUnits.catchupAndSubscribe({onAdd:d=>{let h=b.toString(d.uuid),g=q(o?.[h])?o[h]:NF.Default,v=new w0(this,d,g),y=this.#c.add(v);if(V(y,`Could not add ${v}`),v.adapter.isOutput){V(this.#R.isEmpty(),"Output can only assigned once."),this.#R=m.wrap(v);return}},onRemove:({uuid:d})=>this.#c.removeByKey(d).terminate(),onReorder:ea}),(()=>{for(let d of this.#i.boxes())d instanceof br&&this.#s.getOrCreate(d.address.uuid);return this.#i.subscribeToAllUpdates({onUpdate:d=>{d instanceof rl&&d.name===br.ClassName?this.#s.getOrCreate(d.uuid):d instanceof il&&d.name===br.ClassName&&this.#s.remove(d.uuid)}})})()),this.#D=m.wrap(o).match({none:()=>U.empty(),some:d=>Object.keys(d).map(h=>this.#c.get(b.parse(h)))}),this.#o.ready(),console.log=(...d)=>this.#o.log(d.join(", "))}ignoresRegion(e){return this.#B.hasKey(e)}process(e,t){if(!this.#U)return!1;if(Atomics.load(this.#M,0)===1)return!0;try{return this.render(e,t)}catch(n){return console.debug(n),this.#U=!1,this.#o.error(n),this.terminate(),!1}}render(e,[t]){if(!this.#U)return!1;if(this.#W)return D("Manual Panic");this.#C=e[0]??[];let n=this.#k.start(),i=this.#n.metronomeEnabled;this.#g.notify(0),this.#N.isEmpty()&&(this.#m.update(),this.#N=m.wrap(this.#m.sorted().concat()),qR&&console.debug(`%cAudio-Graph%c
42
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of r.seen.entries()){let s=a[1];if(e===a[0]){o(a);continue}if(r.external){let u=r.external.registry.get(a[0])?.id;if(e!==a[0]&&u){o(a);continue}}if(r.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&r.reused==="ref"){o(a);continue}}}function Vs(r,e){let t=r.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=r.seen.get(a);if(s.ref===null)return;let l=s.def??s.schema,u={...l},p=s.ref;if(s.ref=null,p){n(p);let h=r.seen.get(p),g=h.schema;if(g.$ref&&(r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Object.assign(l,g),Object.assign(l,u),a._zod.parent===p)for(let y in l)y==="$ref"||y==="allOf"||y in u||delete l[y];if(g.$ref&&h.def)for(let y in l)y==="$ref"||y==="allOf"||y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y])&&delete l[y]}let d=a._zod.parent;if(d&&d!==p){n(d);let h=r.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(let g in l)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(l[g])===JSON.stringify(h.def[g])&&delete l[g]}r.override({zodSchema:a,jsonSchema:l,path:s.path??[]})};for(let a of[...r.seen.entries()].reverse())n(a[0]);let i={};if(r.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":r.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":r.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":r.target,r.external?.uri){let a=r.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=r.external.uri(a)}Object.assign(i,t.def??t.schema);let o=r.external?.defs??{};for(let a of r.seen.entries()){let s=a[1];s.def&&s.defId&&(o[s.defId]=s.def)}r.external||Object.keys(o).length>0&&(r.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:vp(e,"input",r.processors),output:vp(e,"output",r.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ri(r,e){let t=e??{seen:new Set};if(t.seen.has(r))return!1;t.seen.add(r);let n=r._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ri(n.element,t);if(n.type==="set")return ri(n.valueType,t);if(n.type==="lazy")return ri(n.getter(),t);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ri(n.innerType,t);if(n.type==="intersection")return ri(n.left,t)||ri(n.right,t);if(n.type==="record"||n.type==="map")return ri(n.keyType,t)||ri(n.valueType,t);if(n.type==="pipe")return ri(n.in,t)||ri(n.out,t);if(n.type==="object"){for(let i in n.shape)if(ri(n.shape[i],t))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(ri(i,t))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(ri(i,t))return!0;return!!(n.rest&&ri(n.rest,t))}return!1}var bS=(r,e={})=>t=>{let n=Cs({...t,processors:e});return at(r,n),Os(n,r),Vs(n,r)},vp=(r,e,t={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=Cs({...i??{},target:o,io:e,processors:t});return at(r,a),Os(a,r),Vs(a,r)};var mR={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},AS=(r,e,t,n)=>{let i=t;i.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:u}=r._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=mR[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){let p=[...l];p.length===1?i.pattern=p[0].source:p.length>1&&(i.allOf=[...p.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},_S=(r,e,t,n)=>{let i=t,{minimum:o,maximum:a,format:s,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:p}=r._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof p=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=p,i.exclusiveMinimum=!0):i.exclusiveMinimum=p),typeof o=="number"&&(i.minimum=o,typeof p=="number"&&e.target!=="draft-04"&&(p>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},PS=(r,e,t,n)=>{t.type="boolean"},SS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ES=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},FS=(r,e,t,n)=>{e.target==="openapi-3.0"?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},BS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},NS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},IS=(r,e,t,n)=>{t.not={}},DS=(r,e,t,n)=>{},MS=(r,e,t,n)=>{},kS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},$S=(r,e,t,n)=>{let i=r._zod.def,o=sm(i.entries);o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),t.enum=o},TS=(r,e,t,n)=>{let i=r._zod.def,o=[];for(let a of i.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];t.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[a]:t.const=a}else o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),o.every(a=>typeof a=="boolean")&&(t.type="boolean"),o.every(a=>a===null)&&(t.type="null"),t.enum=o},RS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},CS=(r,e,t,n)=>{let i=t,o=r._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},OS=(r,e,t,n)=>{let i=t,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:l}=r._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),l?l.length===1?(o.contentMediaType=l[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(i,o)},VS=(r,e,t,n)=>{t.type="boolean"},zS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},US=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},jS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},LS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},KS=(r,e,t,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},WS=(r,e,t,n)=>{let i=t,o=r._zod.def,{minimum:a,maximum:s}=r._zod.bag;typeof a=="number"&&(i.minItems=a),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=at(o.element,e,{...n,path:[...n.path,"items"]})},ZS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="object",i.properties={};let a=o.shape;for(let u in a)i.properties[u]=at(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),l=new Set([...s].filter(u=>{let p=o.shape[u]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=at(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},kw=(r,e,t,n)=>{let i=r._zod.def,o=i.inclusive===!1,a=i.options.map((s,l)=>at(s,e,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));o?t.oneOf=a:t.anyOf=a},GS=(r,e,t,n)=>{let i=r._zod.def,o=at(i.left,e,{...n,path:[...n.path,"allOf",0]}),a=at(i.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];t.allOf=l},qS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((h,g)=>at(h,e,{...n,path:[...n.path,a,g]})),u=o.rest?at(o.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=l,u&&(i.items=u)):e.target==="openapi-3.0"?(i.items={anyOf:l},u&&i.items.anyOf.push(u),i.minItems=l.length,u||(i.maxItems=l.length)):(i.items=l,u&&(i.additionalItems=u));let{minimum:p,maximum:d}=r._zod.bag;typeof p=="number"&&(i.minItems=p),typeof d=="number"&&(i.maxItems=d)},HS=(r,e,t,n)=>{let i=t,o=r._zod.def;i.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let p=at(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of l)i.patternProperties[d.source]=p}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=at(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=at(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let p=[...u].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(i.required=p)}},JS=(r,e,t,n)=>{let i=r._zod.def,o=at(i.innerType,e,n),a=e.seen.get(r);e.target==="openapi-3.0"?(a.ref=i.innerType,t.nullable=!0):t.anyOf=[o,{type:"null"}]},QS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},YS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},XS=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},eE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a},tE=(r,e,t,n)=>{let i=r._zod.def,o=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;at(o,e,n);let a=e.seen.get(r);a.ref=o},rE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType,t.readOnly=!0},iE=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},$w=(r,e,t,n)=>{let i=r._zod.def;at(i.innerType,e,n);let o=e.seen.get(r);o.ref=i.innerType},nE=(r,e,t,n)=>{let i=r._zod.innerType;at(i,e,n);let o=e.seen.get(r);o.ref=i},Mw={string:AS,number:_S,boolean:PS,bigint:SS,symbol:ES,null:FS,undefined:BS,void:NS,never:IS,any:DS,unknown:MS,date:kS,enum:$S,literal:TS,nan:RS,template_literal:CS,file:OS,success:VS,custom:zS,function:US,transform:jS,map:LS,set:KS,array:WS,object:ZS,union:kw,intersection:GS,tuple:qS,record:HS,nullable:JS,nonoptional:QS,default:YS,prefault:XS,catch:eE,pipe:tE,readonly:rE,promise:iE,optional:$w,lazy:nE};function Tw(r,e){if("_idmap"in r){let n=r,i=Cs({...e,processors:Mw}),o={};for(let l of n._idmap.entries()){let[u,p]=l;at(p,i)}let a={},s={registry:n,uri:e?.uri,defs:o};i.external=s;for(let l of n._idmap.entries()){let[u,p]=l;Os(i,p),a[u]=Vs(i,p)}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let t=Cs({...e,processors:Mw});return at(r,t),Os(t,r),Vs(t,r)}var Rw=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=Cs({processors:Mw,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return at(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),Os(this.ctx,e);let n=Vs(this.ctx,e),{"~standard":i,...o}=n;return o}};var jI={};var Sm={};Xo(Sm,{ZodAny:()=>BE,ZodArray:()=>ME,ZodBase64:()=>ib,ZodBase64URL:()=>nb,ZodBigInt:()=>Pp,ZodBigIntFormat:()=>sb,ZodBoolean:()=>_p,ZodCIDRv4:()=>tb,ZodCIDRv6:()=>rb,ZodCUID:()=>qw,ZodCUID2:()=>Hw,ZodCatch:()=>eF,ZodCodec:()=>mb,ZodCustom:()=>Rm,ZodCustomStringFormat:()=>bp,ZodDate:()=>Dm,ZodDefault:()=>qE,ZodDiscriminatedUnion:()=>$E,ZodE164:()=>ob,ZodEmail:()=>Ww,ZodEmoji:()=>Zw,ZodEnum:()=>xp,ZodExactOptional:()=>WE,ZodFile:()=>LE,ZodFunction:()=>cF,ZodGUID:()=>Em,ZodIPv4:()=>Xw,ZodIPv6:()=>eb,ZodIntersection:()=>TE,ZodJWT:()=>ab,ZodKSUID:()=>Yw,ZodLazy:()=>aF,ZodLiteral:()=>jE,ZodMAC:()=>bE,ZodMap:()=>zE,ZodNaN:()=>rF,ZodNanoID:()=>Gw,ZodNever:()=>IE,ZodNonOptional:()=>hb,ZodNull:()=>EE,ZodNullable:()=>GE,ZodNumber:()=>Ap,ZodNumberFormat:()=>bc,ZodObject:()=>km,ZodOptional:()=>pb,ZodPipe:()=>fb,ZodPrefault:()=>JE,ZodPromise:()=>lF,ZodReadonly:()=>iF,ZodRecord:()=>Tm,ZodSet:()=>UE,ZodString:()=>wp,ZodStringFormat:()=>mt,ZodSuccess:()=>XE,ZodSymbol:()=>PE,ZodTemplateLiteral:()=>oF,ZodTransform:()=>KE,ZodTuple:()=>CE,ZodType:()=>Oe,ZodULID:()=>Jw,ZodURL:()=>Im,ZodUUID:()=>Jo,ZodUndefined:()=>SE,ZodUnion:()=>$m,ZodUnknown:()=>NE,ZodVoid:()=>DE,ZodXID:()=>Qw,ZodXor:()=>kE,_ZodString:()=>Kw,_default:()=>HE,_function:()=>HD,any:()=>FD,array:()=>Mm,base64:()=>uD,base64url:()=>dD,bigint:()=>AD,boolean:()=>_E,catch:()=>tF,check:()=>JD,cidrv4:()=>lD,cidrv6:()=>cD,codec:()=>ZD,cuid:()=>eD,cuid2:()=>tD,custom:()=>QD,date:()=>ND,describe:()=>YD,discriminatedUnion:()=>TD,e164:()=>pD,email:()=>KI,emoji:()=>YI,enum:()=>ub,exactOptional:()=>ZE,file:()=>jD,float32:()=>yD,float64:()=>xD,function:()=>HD,guid:()=>WI,hash:()=>vD,hex:()=>gD,hostname:()=>mD,httpUrl:()=>QI,instanceof:()=>eM,int:()=>Lw,int32:()=>wD,int64:()=>_D,intersection:()=>RE,ipv4:()=>oD,ipv6:()=>sD,json:()=>rM,jwt:()=>hD,keyof:()=>ID,ksuid:()=>nD,lazy:()=>sF,literal:()=>UD,looseObject:()=>kD,looseRecord:()=>CD,mac:()=>aD,map:()=>OD,meta:()=>XD,nan:()=>WD,nanoid:()=>XI,nativeEnum:()=>zD,never:()=>lb,nonoptional:()=>YE,null:()=>FE,nullable:()=>Bm,nullish:()=>LD,number:()=>AE,object:()=>DD,optional:()=>Fm,partialRecord:()=>RD,pipe:()=>Nm,prefault:()=>QE,preprocess:()=>iM,promise:()=>qD,readonly:()=>nF,record:()=>VE,refine:()=>uF,set:()=>VD,strictObject:()=>MD,string:()=>jw,stringFormat:()=>fD,stringbool:()=>tM,success:()=>KD,superRefine:()=>dF,symbol:()=>SD,templateLiteral:()=>GD,transform:()=>db,tuple:()=>OE,uint32:()=>bD,uint64:()=>PD,ulid:()=>rD,undefined:()=>ED,union:()=>cb,unknown:()=>wc,url:()=>JI,uuid:()=>ZI,uuidv4:()=>GI,uuidv6:()=>qI,uuidv7:()=>HI,void:()=>BD,xid:()=>iD,xor:()=>$D});var Cw={};Xo(Cw,{endsWith:()=>cp,gt:()=>qo,gte:()=>ti,includes:()=>sp,length:()=>xc,lowercase:()=>op,lt:()=>Go,lte:()=>Ki,maxLength:()=>yc,maxSize:()=>Rs,mime:()=>up,minLength:()=>Na,minSize:()=>Ho,multipleOf:()=>Ts,negative:()=>Bw,nonnegative:()=>Iw,nonpositive:()=>Nw,normalize:()=>dp,overwrite:()=>ao,positive:()=>Fw,property:()=>Dw,regex:()=>np,size:()=>vc,slugify:()=>mp,startsWith:()=>lp,toLowerCase:()=>hp,toUpperCase:()=>fp,trim:()=>pp,uppercase:()=>ap});var yp={};Xo(yp,{ZodISODate:()=>Vw,ZodISODateTime:()=>Ow,ZodISODuration:()=>Uw,ZodISOTime:()=>zw,date:()=>aE,datetime:()=>oE,duration:()=>lE,time:()=>sE});var Ow=S("ZodISODateTime",(r,e)=>{RP.init(r,e),mt.init(r,e)});function oE(r){return z1(Ow,r)}var Vw=S("ZodISODate",(r,e)=>{CP.init(r,e),mt.init(r,e)});function aE(r){return U1(Vw,r)}var zw=S("ZodISOTime",(r,e)=>{OP.init(r,e),mt.init(r,e)});function sE(r){return j1(zw,r)}var Uw=S("ZodISODuration",(r,e)=>{VP.init(r,e),mt.init(r,e)});function lE(r){return L1(Uw,r)}var LI=(r,e)=>{pm.init(r,e),r.name="ZodError",Object.defineProperties(r,{format:{value:t=>fm(r,t)},flatten:{value:t=>hm(r,t)},addIssue:{value:t=>{r.issues.push(t),r.message=JSON.stringify(r.issues,Hd,2)}},addIssues:{value:t=>{r.issues.push(...t),r.message=JSON.stringify(r.issues,Hd,2)}},isEmpty:{get(){return r.issues.length===0}}})},vR=S("ZodError",LI),bi=S("ZodError",LI,{Parent:Error});var cE=Yd(bi),uE=Xd(bi),dE=ep(bi),pE=tp(bi),hE=Tx(bi),fE=Rx(bi),mE=Cx(bi),gE=Ox(bi),vE=Vx(bi),yE=zx(bi),xE=Ux(bi),wE=jx(bi);var Oe=S("ZodType",(r,e)=>(De.init(r,e),Object.assign(r["~standard"],{jsonSchema:{input:vp(r,"input"),output:vp(r,"output")}}),r.toJSONSchema=bS(r,{}),r.def=e,r.type=e.type,Object.defineProperty(r,"_def",{value:e}),r.check=(...t)=>r.clone(G.mergeDefs(e,{checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),r.with=r.check,r.clone=(t,n)=>ei(r,t,n),r.brand=()=>r,r.register=(t,n)=>(t.add(r,n),r),r.parse=(t,n)=>cE(r,t,n,{callee:r.parse}),r.safeParse=(t,n)=>dE(r,t,n),r.parseAsync=async(t,n)=>uE(r,t,n,{callee:r.parseAsync}),r.safeParseAsync=async(t,n)=>pE(r,t,n),r.spa=r.safeParseAsync,r.encode=(t,n)=>hE(r,t,n),r.decode=(t,n)=>fE(r,t,n),r.encodeAsync=async(t,n)=>mE(r,t,n),r.decodeAsync=async(t,n)=>gE(r,t,n),r.safeEncode=(t,n)=>vE(r,t,n),r.safeDecode=(t,n)=>yE(r,t,n),r.safeEncodeAsync=async(t,n)=>xE(r,t,n),r.safeDecodeAsync=async(t,n)=>wE(r,t,n),r.refine=(t,n)=>r.check(uF(t,n)),r.superRefine=t=>r.check(dF(t)),r.overwrite=t=>r.check(ao(t)),r.optional=()=>Fm(r),r.exactOptional=()=>ZE(r),r.nullable=()=>Bm(r),r.nullish=()=>Fm(Bm(r)),r.nonoptional=t=>YE(r,t),r.array=()=>Mm(r),r.or=t=>cb([r,t]),r.and=t=>RE(r,t),r.transform=t=>Nm(r,db(t)),r.default=t=>HE(r,t),r.prefault=t=>QE(r,t),r.catch=t=>tF(r,t),r.pipe=t=>Nm(r,t),r.readonly=()=>nF(r),r.describe=t=>{let n=r.clone();return Ir.add(n,{description:t}),n},Object.defineProperty(r,"description",{get(){return Ir.get(r)?.description},configurable:!0}),r.meta=(...t)=>{if(t.length===0)return Ir.get(r);let n=r.clone();return Ir.add(n,t[0]),n},r.isOptional=()=>r.safeParse(void 0).success,r.isNullable=()=>r.safeParse(null).success,r.apply=t=>t(r),r)),Kw=S("_ZodString",(r,e)=>{gc.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>AS(r,n,i,o);let t=r._zod.bag;r.format=t.format??null,r.minLength=t.minimum??null,r.maxLength=t.maximum??null,r.regex=(...n)=>r.check(np(...n)),r.includes=(...n)=>r.check(sp(...n)),r.startsWith=(...n)=>r.check(lp(...n)),r.endsWith=(...n)=>r.check(cp(...n)),r.min=(...n)=>r.check(Na(...n)),r.max=(...n)=>r.check(yc(...n)),r.length=(...n)=>r.check(xc(...n)),r.nonempty=(...n)=>r.check(Na(1,...n)),r.lowercase=n=>r.check(op(n)),r.uppercase=n=>r.check(ap(n)),r.trim=()=>r.check(pp()),r.normalize=(...n)=>r.check(dp(...n)),r.toLowerCase=()=>r.check(hp()),r.toUpperCase=()=>r.check(fp()),r.slugify=()=>r.check(mp())}),wp=S("ZodString",(r,e)=>{gc.init(r,e),Kw.init(r,e),r.email=t=>r.check(sw(Ww,t)),r.url=t=>r.check(Pm(Im,t)),r.jwt=t=>r.check(Ew(ab,t)),r.emoji=t=>r.check(pw(Zw,t)),r.guid=t=>r.check(_m(Em,t)),r.uuid=t=>r.check(lw(Jo,t)),r.uuidv4=t=>r.check(cw(Jo,t)),r.uuidv6=t=>r.check(uw(Jo,t)),r.uuidv7=t=>r.check(dw(Jo,t)),r.nanoid=t=>r.check(hw(Gw,t)),r.guid=t=>r.check(_m(Em,t)),r.cuid=t=>r.check(fw(qw,t)),r.cuid2=t=>r.check(mw(Hw,t)),r.ulid=t=>r.check(gw(Jw,t)),r.base64=t=>r.check(_w(ib,t)),r.base64url=t=>r.check(Pw(nb,t)),r.xid=t=>r.check(vw(Qw,t)),r.ksuid=t=>r.check(yw(Yw,t)),r.ipv4=t=>r.check(xw(Xw,t)),r.ipv6=t=>r.check(ww(eb,t)),r.cidrv4=t=>r.check(bw(tb,t)),r.cidrv6=t=>r.check(Aw(rb,t)),r.e164=t=>r.check(Sw(ob,t)),r.datetime=t=>r.check(oE(t)),r.date=t=>r.check(aE(t)),r.time=t=>r.check(sE(t)),r.duration=t=>r.check(lE(t))});function jw(r){return R1(wp,r)}var mt=S("ZodStringFormat",(r,e)=>{ft.init(r,e),Kw.init(r,e)}),Ww=S("ZodEmail",(r,e)=>{FP.init(r,e),mt.init(r,e)});function KI(r){return sw(Ww,r)}var Em=S("ZodGUID",(r,e)=>{SP.init(r,e),mt.init(r,e)});function WI(r){return _m(Em,r)}var Jo=S("ZodUUID",(r,e)=>{EP.init(r,e),mt.init(r,e)});function ZI(r){return lw(Jo,r)}function GI(r){return cw(Jo,r)}function qI(r){return uw(Jo,r)}function HI(r){return dw(Jo,r)}var Im=S("ZodURL",(r,e)=>{BP.init(r,e),mt.init(r,e)});function JI(r){return Pm(Im,r)}function QI(r){return Pm(Im,{protocol:/^https?$/,hostname:En.domain,...G.normalizeParams(r)})}var Zw=S("ZodEmoji",(r,e)=>{NP.init(r,e),mt.init(r,e)});function YI(r){return pw(Zw,r)}var Gw=S("ZodNanoID",(r,e)=>{IP.init(r,e),mt.init(r,e)});function XI(r){return hw(Gw,r)}var qw=S("ZodCUID",(r,e)=>{DP.init(r,e),mt.init(r,e)});function eD(r){return fw(qw,r)}var Hw=S("ZodCUID2",(r,e)=>{MP.init(r,e),mt.init(r,e)});function tD(r){return mw(Hw,r)}var Jw=S("ZodULID",(r,e)=>{kP.init(r,e),mt.init(r,e)});function rD(r){return gw(Jw,r)}var Qw=S("ZodXID",(r,e)=>{$P.init(r,e),mt.init(r,e)});function iD(r){return vw(Qw,r)}var Yw=S("ZodKSUID",(r,e)=>{TP.init(r,e),mt.init(r,e)});function nD(r){return yw(Yw,r)}var Xw=S("ZodIPv4",(r,e)=>{zP.init(r,e),mt.init(r,e)});function oD(r){return xw(Xw,r)}var bE=S("ZodMAC",(r,e)=>{jP.init(r,e),mt.init(r,e)});function aD(r){return O1(bE,r)}var eb=S("ZodIPv6",(r,e)=>{UP.init(r,e),mt.init(r,e)});function sD(r){return ww(eb,r)}var tb=S("ZodCIDRv4",(r,e)=>{LP.init(r,e),mt.init(r,e)});function lD(r){return bw(tb,r)}var rb=S("ZodCIDRv6",(r,e)=>{KP.init(r,e),mt.init(r,e)});function cD(r){return Aw(rb,r)}var ib=S("ZodBase64",(r,e)=>{ZP.init(r,e),mt.init(r,e)});function uD(r){return _w(ib,r)}var nb=S("ZodBase64URL",(r,e)=>{GP.init(r,e),mt.init(r,e)});function dD(r){return Pw(nb,r)}var ob=S("ZodE164",(r,e)=>{qP.init(r,e),mt.init(r,e)});function pD(r){return Sw(ob,r)}var ab=S("ZodJWT",(r,e)=>{HP.init(r,e),mt.init(r,e)});function hD(r){return Ew(ab,r)}var bp=S("ZodCustomStringFormat",(r,e)=>{JP.init(r,e),mt.init(r,e)});function fD(r,e,t={}){return gp(bp,r,e,t)}function mD(r){return gp(bp,"hostname",En.hostname,r)}function gD(r){return gp(bp,"hex",En.hex,r)}function vD(r,e){let t=e?.enc??"hex",n=`${r}_${t}`,i=En[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return gp(bp,n,i,e)}var Ap=S("ZodNumber",(r,e)=>{Yx.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>_S(r,n,i,o),r.gt=(n,i)=>r.check(qo(n,i)),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.lt=(n,i)=>r.check(Go(n,i)),r.lte=(n,i)=>r.check(Ki(n,i)),r.max=(n,i)=>r.check(Ki(n,i)),r.int=n=>r.check(Lw(n)),r.safe=n=>r.check(Lw(n)),r.positive=n=>r.check(qo(0,n)),r.nonnegative=n=>r.check(ti(0,n)),r.negative=n=>r.check(Go(0,n)),r.nonpositive=n=>r.check(Ki(0,n)),r.multipleOf=(n,i)=>r.check(Ts(n,i)),r.step=(n,i)=>r.check(Ts(n,i)),r.finite=()=>r;let t=r._zod.bag;r.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,r.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,r.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),r.isFinite=!0,r.format=t.format??null});function AE(r){return K1(Ap,r)}var bc=S("ZodNumberFormat",(r,e)=>{QP.init(r,e),Ap.init(r,e)});function Lw(r){return Z1(bc,r)}function yD(r){return G1(bc,r)}function xD(r){return q1(bc,r)}function wD(r){return H1(bc,r)}function bD(r){return J1(bc,r)}var _p=S("ZodBoolean",(r,e)=>{ym.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>PS(r,t,n,i)});function _E(r){return Q1(_p,r)}var Pp=S("ZodBigInt",(r,e)=>{Xx.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>SS(r,n,i,o),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.gt=(n,i)=>r.check(qo(n,i)),r.gte=(n,i)=>r.check(ti(n,i)),r.min=(n,i)=>r.check(ti(n,i)),r.lt=(n,i)=>r.check(Go(n,i)),r.lte=(n,i)=>r.check(Ki(n,i)),r.max=(n,i)=>r.check(Ki(n,i)),r.positive=n=>r.check(qo(BigInt(0),n)),r.negative=n=>r.check(Go(BigInt(0),n)),r.nonpositive=n=>r.check(Ki(BigInt(0),n)),r.nonnegative=n=>r.check(ti(BigInt(0),n)),r.multipleOf=(n,i)=>r.check(Ts(n,i));let t=r._zod.bag;r.minValue=t.minimum??null,r.maxValue=t.maximum??null,r.format=t.format??null});function AD(r){return X1(Pp,r)}var sb=S("ZodBigIntFormat",(r,e)=>{YP.init(r,e),Pp.init(r,e)});function _D(r){return tS(sb,r)}function PD(r){return rS(sb,r)}var PE=S("ZodSymbol",(r,e)=>{XP.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>ES(r,t,n,i)});function SD(r){return iS(PE,r)}var SE=S("ZodUndefined",(r,e)=>{e1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>BS(r,t,n,i)});function ED(r){return nS(SE,r)}var EE=S("ZodNull",(r,e)=>{t1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>FS(r,t,n,i)});function FE(r){return oS(EE,r)}var BE=S("ZodAny",(r,e)=>{r1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>DS(r,t,n,i)});function FD(){return aS(BE)}var NE=S("ZodUnknown",(r,e)=>{i1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>MS(r,t,n,i)});function wc(){return sS(NE)}var IE=S("ZodNever",(r,e)=>{n1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>IS(r,t,n,i)});function lb(r){return lS(IE,r)}var DE=S("ZodVoid",(r,e)=>{o1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>NS(r,t,n,i)});function BD(r){return cS(DE,r)}var Dm=S("ZodDate",(r,e)=>{a1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>kS(r,n,i,o),r.min=(n,i)=>r.check(ti(n,i)),r.max=(n,i)=>r.check(Ki(n,i));let t=r._zod.bag;r.minDate=t.minimum?new Date(t.minimum):null,r.maxDate=t.maximum?new Date(t.maximum):null});function ND(r){return uS(Dm,r)}var ME=S("ZodArray",(r,e)=>{s1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>WS(r,t,n,i),r.element=e.element,r.min=(t,n)=>r.check(Na(t,n)),r.nonempty=t=>r.check(Na(1,t)),r.max=(t,n)=>r.check(yc(t,n)),r.length=(t,n)=>r.check(xc(t,n)),r.unwrap=()=>r.element});function Mm(r,e){return hS(ME,r,e)}function ID(r){let e=r._zod.def.shape;return ub(Object.keys(e))}var km=S("ZodObject",(r,e)=>{l1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>ZS(r,t,n,i),G.defineLazy(r,"shape",()=>e.shape),r.keyof=()=>ub(Object.keys(r._zod.def.shape)),r.catchall=t=>r.clone({...r._zod.def,catchall:t}),r.passthrough=()=>r.clone({...r._zod.def,catchall:wc()}),r.loose=()=>r.clone({...r._zod.def,catchall:wc()}),r.strict=()=>r.clone({...r._zod.def,catchall:lb()}),r.strip=()=>r.clone({...r._zod.def,catchall:void 0}),r.extend=t=>G.extend(r,t),r.safeExtend=t=>G.safeExtend(r,t),r.merge=t=>G.merge(r,t),r.pick=t=>G.pick(r,t),r.omit=t=>G.omit(r,t),r.partial=(...t)=>G.partial(pb,r,t[0]),r.required=(...t)=>G.required(hb,r,t[0])});function DD(r,e){let t={type:"object",shape:r??{},...G.normalizeParams(e)};return new km(t)}function MD(r,e){return new km({type:"object",shape:r,catchall:lb(),...G.normalizeParams(e)})}function kD(r,e){return new km({type:"object",shape:r,catchall:wc(),...G.normalizeParams(e)})}var $m=S("ZodUnion",(r,e)=>{xm.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>kw(r,t,n,i),r.options=e.options});function cb(r,e){return new $m({type:"union",options:r,...G.normalizeParams(e)})}var kE=S("ZodXor",(r,e)=>{$m.init(r,e),c1.init(r,e),r._zod.processJSONSchema=(t,n,i)=>kw(r,t,n,i),r.options=e.options});function $D(r,e){return new kE({type:"union",options:r,inclusive:!1,...G.normalizeParams(e)})}var $E=S("ZodDiscriminatedUnion",(r,e)=>{$m.init(r,e),u1.init(r,e)});function TD(r,e,t){return new $E({type:"union",options:e,discriminator:r,...G.normalizeParams(t)})}var TE=S("ZodIntersection",(r,e)=>{d1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>GS(r,t,n,i)});function RE(r,e){return new TE({type:"intersection",left:r,right:e})}var CE=S("ZodTuple",(r,e)=>{ew.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>qS(r,t,n,i),r.rest=t=>r.clone({...r._zod.def,rest:t})});function OE(r,e,t){let n=e instanceof De,i=n?t:e,o=n?e:null;return new CE({type:"tuple",items:r,rest:o,...G.normalizeParams(i)})}var Tm=S("ZodRecord",(r,e)=>{p1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>HS(r,t,n,i),r.keyType=e.keyType,r.valueType=e.valueType});function VE(r,e,t){return new Tm({type:"record",keyType:r,valueType:e,...G.normalizeParams(t)})}function RD(r,e,t){let n=ei(r);return n._zod.values=void 0,new Tm({type:"record",keyType:n,valueType:e,...G.normalizeParams(t)})}function CD(r,e,t){return new Tm({type:"record",keyType:r,valueType:e,mode:"loose",...G.normalizeParams(t)})}var zE=S("ZodMap",(r,e)=>{h1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>LS(r,t,n,i),r.keyType=e.keyType,r.valueType=e.valueType,r.min=(...t)=>r.check(Ho(...t)),r.nonempty=t=>r.check(Ho(1,t)),r.max=(...t)=>r.check(Rs(...t)),r.size=(...t)=>r.check(vc(...t))});function OD(r,e,t){return new zE({type:"map",keyType:r,valueType:e,...G.normalizeParams(t)})}var UE=S("ZodSet",(r,e)=>{f1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>KS(r,t,n,i),r.min=(...t)=>r.check(Ho(...t)),r.nonempty=t=>r.check(Ho(1,t)),r.max=(...t)=>r.check(Rs(...t)),r.size=(...t)=>r.check(vc(...t))});function VD(r,e){return new UE({type:"set",valueType:r,...G.normalizeParams(e)})}var xp=S("ZodEnum",(r,e)=>{m1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(n,i,o)=>$S(r,n,i,o),r.enum=e.entries,r.options=Object.values(e.entries);let t=new Set(Object.keys(e.entries));r.extract=(n,i)=>{let o={};for(let a of n)if(t.has(a))o[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new xp({...e,checks:[],...G.normalizeParams(i),entries:o})},r.exclude=(n,i)=>{let o={...e.entries};for(let a of n)if(t.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new xp({...e,checks:[],...G.normalizeParams(i),entries:o})}});function ub(r,e){let t=Array.isArray(r)?Object.fromEntries(r.map(n=>[n,n])):r;return new xp({type:"enum",entries:t,...G.normalizeParams(e)})}function zD(r,e){return new xp({type:"enum",entries:r,...G.normalizeParams(e)})}var jE=S("ZodLiteral",(r,e)=>{g1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>TS(r,t,n,i),r.values=new Set(e.values),Object.defineProperty(r,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function UD(r,e){return new jE({type:"literal",values:Array.isArray(r)?r:[r],...G.normalizeParams(e)})}var LE=S("ZodFile",(r,e)=>{v1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>OS(r,t,n,i),r.min=(t,n)=>r.check(Ho(t,n)),r.max=(t,n)=>r.check(Rs(t,n)),r.mime=(t,n)=>r.check(up(Array.isArray(t)?t:[t],n))});function jD(r){return fS(LE,r)}var KE=S("ZodTransform",(r,e)=>{y1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>jS(r,t,n,i),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new Is(r.constructor.name);t.addIssue=o=>{if(typeof o=="string")t.issues.push(G.issue(o,t.value,e));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=t.value),a.inst??(a.inst=r),t.issues.push(G.issue(a))}};let i=e.transform(t.value,t);return i instanceof Promise?i.then(o=>(t.value=o,t)):(t.value=i,t)}});function db(r){return new KE({type:"transform",transform:r})}var pb=S("ZodOptional",(r,e)=>{tw.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>$w(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function Fm(r){return new pb({type:"optional",innerType:r})}var WE=S("ZodExactOptional",(r,e)=>{x1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>$w(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function ZE(r){return new WE({type:"optional",innerType:r})}var GE=S("ZodNullable",(r,e)=>{w1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>JS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function Bm(r){return new GE({type:"nullable",innerType:r})}function LD(r){return Fm(Bm(r))}var qE=S("ZodDefault",(r,e)=>{b1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>YS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType,r.removeDefault=r.unwrap});function HE(r,e){return new qE({type:"default",innerType:r,get defaultValue(){return typeof e=="function"?e():G.shallowClone(e)}})}var JE=S("ZodPrefault",(r,e)=>{A1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>XS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function QE(r,e){return new JE({type:"prefault",innerType:r,get defaultValue(){return typeof e=="function"?e():G.shallowClone(e)}})}var hb=S("ZodNonOptional",(r,e)=>{_1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>QS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function YE(r,e){return new hb({type:"nonoptional",innerType:r,...G.normalizeParams(e)})}var XE=S("ZodSuccess",(r,e)=>{P1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>VS(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function KD(r){return new XE({type:"success",innerType:r})}var eF=S("ZodCatch",(r,e)=>{S1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>eE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType,r.removeCatch=r.unwrap});function tF(r,e){return new eF({type:"catch",innerType:r,catchValue:typeof e=="function"?e:()=>e})}var rF=S("ZodNaN",(r,e)=>{E1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>RS(r,t,n,i)});function WD(r){return pS(rF,r)}var fb=S("ZodPipe",(r,e)=>{F1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>tE(r,t,n,i),r.in=e.in,r.out=e.out});function Nm(r,e){return new fb({type:"pipe",in:r,out:e})}var mb=S("ZodCodec",(r,e)=>{fb.init(r,e),wm.init(r,e)});function ZD(r,e,t){return new mb({type:"pipe",in:r,out:e,transform:t.decode,reverseTransform:t.encode})}var iF=S("ZodReadonly",(r,e)=>{B1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>rE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function nF(r){return new iF({type:"readonly",innerType:r})}var oF=S("ZodTemplateLiteral",(r,e)=>{N1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>CS(r,t,n,i)});function GD(r,e){return new oF({type:"template_literal",parts:r,...G.normalizeParams(e)})}var aF=S("ZodLazy",(r,e)=>{M1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>nE(r,t,n,i),r.unwrap=()=>r._zod.def.getter()});function sF(r){return new aF({type:"lazy",getter:r})}var lF=S("ZodPromise",(r,e)=>{D1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>iE(r,t,n,i),r.unwrap=()=>r._zod.def.innerType});function qD(r){return new lF({type:"promise",innerType:r})}var cF=S("ZodFunction",(r,e)=>{I1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>US(r,t,n,i)});function HD(r){return new cF({type:"function",input:Array.isArray(r?.input)?OE(r?.input):r?.input??Mm(wc()),output:r?.output??wc()})}var Rm=S("ZodCustom",(r,e)=>{k1.init(r,e),Oe.init(r,e),r._zod.processJSONSchema=(t,n,i)=>zS(r,t,n,i)});function JD(r){let e=new xt({check:"custom"});return e._zod.check=r,e}function QD(r,e){return mS(Rm,r??(()=>!0),e)}function uF(r,e={}){return gS(Rm,r,e)}function dF(r){return vS(r)}var YD=yS,XD=xS;function eM(r,e={}){let t=new Rm({type:"custom",check:"custom",fn:n=>n instanceof r,abort:!0,...G.normalizeParams(e)});return t._zod.bag.Class=r,t._zod.check=n=>{n.value instanceof r||n.issues.push({code:"invalid_type",expected:r.name,input:n.value,inst:t,path:[...t._zod.def.path??[]]})},t}var tM=(...r)=>wS({Codec:mb,Boolean:_p,String:wp},...r);function rM(r){let e=sF(()=>cb([jw(r),AE(),_E(),FE(),Mm(e),VE(jw(),e)]));return e}function iM(r,e){return Nm(db(r),e)}var xR={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function wR(r){Kt({customError:r})}function bR(){return Kt().customError}var pF;pF||(pF={});var re={...Sm,...Cw,iso:yp},AR=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function _R(r,e){let t=r.$schema;return t==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":t==="http://json-schema.org/draft-07/schema#"?"draft-7":t==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function PR(r,e){if(!r.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let t=r.slice(1).split("/").filter(Boolean);if(t.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===n){let i=t[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${r}`);return e.defs[i]}throw new Error(`Reference not found: ${r}`)}function nM(r,e){if(r.not!==void 0){if(typeof r.not=="object"&&Object.keys(r.not).length===0)return re.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(r.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(r.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(r.if!==void 0||r.then!==void 0||r.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(r.dependentSchemas!==void 0||r.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let i=r.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return re.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let o=PR(i,e),a=jr(o,e);return e.refs.set(i,a),e.processing.delete(i),a}if(r.enum!==void 0){let i=r.enum;if(e.version==="openapi-3.0"&&r.nullable===!0&&i.length===1&&i[0]===null)return re.null();if(i.length===0)return re.never();if(i.length===1)return re.literal(i[0]);if(i.every(a=>typeof a=="string"))return re.enum(i);let o=i.map(a=>re.literal(a));return o.length<2?o[0]:re.union([o[0],o[1],...o.slice(2)])}if(r.const!==void 0)return re.literal(r.const);let t=r.type;if(Array.isArray(t)){let i=t.map(o=>{let a={...r,type:o};return nM(a,e)});return i.length===0?re.never():i.length===1?i[0]:re.union(i)}if(!t)return re.any();let n;switch(t){case"string":{let i=re.string();if(r.format){let o=r.format;o==="email"?i=i.check(re.email()):o==="uri"||o==="uri-reference"?i=i.check(re.url()):o==="uuid"||o==="guid"?i=i.check(re.uuid()):o==="date-time"?i=i.check(re.iso.datetime()):o==="date"?i=i.check(re.iso.date()):o==="time"?i=i.check(re.iso.time()):o==="duration"?i=i.check(re.iso.duration()):o==="ipv4"?i=i.check(re.ipv4()):o==="ipv6"?i=i.check(re.ipv6()):o==="mac"?i=i.check(re.mac()):o==="cidr"?i=i.check(re.cidrv4()):o==="cidr-v6"?i=i.check(re.cidrv6()):o==="base64"?i=i.check(re.base64()):o==="base64url"?i=i.check(re.base64url()):o==="e164"?i=i.check(re.e164()):o==="jwt"?i=i.check(re.jwt()):o==="emoji"?i=i.check(re.emoji()):o==="nanoid"?i=i.check(re.nanoid()):o==="cuid"?i=i.check(re.cuid()):o==="cuid2"?i=i.check(re.cuid2()):o==="ulid"?i=i.check(re.ulid()):o==="xid"?i=i.check(re.xid()):o==="ksuid"&&(i=i.check(re.ksuid()))}typeof r.minLength=="number"&&(i=i.min(r.minLength)),typeof r.maxLength=="number"&&(i=i.max(r.maxLength)),r.pattern&&(i=i.regex(new RegExp(r.pattern))),n=i;break}case"number":case"integer":{let i=t==="integer"?re.number().int():re.number();typeof r.minimum=="number"&&(i=i.min(r.minimum)),typeof r.maximum=="number"&&(i=i.max(r.maximum)),typeof r.exclusiveMinimum=="number"?i=i.gt(r.exclusiveMinimum):r.exclusiveMinimum===!0&&typeof r.minimum=="number"&&(i=i.gt(r.minimum)),typeof r.exclusiveMaximum=="number"?i=i.lt(r.exclusiveMaximum):r.exclusiveMaximum===!0&&typeof r.maximum=="number"&&(i=i.lt(r.maximum)),typeof r.multipleOf=="number"&&(i=i.multipleOf(r.multipleOf)),n=i;break}case"boolean":{n=re.boolean();break}case"null":{n=re.null();break}case"object":{let i={},o=r.properties||{},a=new Set(r.required||[]);for(let[l,u]of Object.entries(o)){let p=jr(u,e);i[l]=a.has(l)?p:p.optional()}if(r.propertyNames){let l=jr(r.propertyNames,e),u=r.additionalProperties&&typeof r.additionalProperties=="object"?jr(r.additionalProperties,e):re.any();if(Object.keys(i).length===0){n=re.record(l,u);break}let p=re.object(i).passthrough(),d=re.looseRecord(l,u);n=re.intersection(p,d);break}if(r.patternProperties){let l=r.patternProperties,u=Object.keys(l),p=[];for(let h of u){let g=jr(l[h],e),v=re.string().regex(new RegExp(h));p.push(re.looseRecord(v,g))}let d=[];if(Object.keys(i).length>0&&d.push(re.object(i).passthrough()),d.push(...p),d.length===0)n=re.object({}).passthrough();else if(d.length===1)n=d[0];else{let h=re.intersection(d[0],d[1]);for(let g=2;g<d.length;g++)h=re.intersection(h,d[g]);n=h}break}let s=re.object(i);r.additionalProperties===!1?n=s.strict():typeof r.additionalProperties=="object"?n=s.catchall(jr(r.additionalProperties,e)):n=s.passthrough();break}case"array":{let i=r.prefixItems,o=r.items;if(i&&Array.isArray(i)){let a=i.map(l=>jr(l,e)),s=o&&typeof o=="object"&&!Array.isArray(o)?jr(o,e):void 0;s?n=re.tuple(a).rest(s):n=re.tuple(a),typeof r.minItems=="number"&&(n=n.check(re.minLength(r.minItems))),typeof r.maxItems=="number"&&(n=n.check(re.maxLength(r.maxItems)))}else if(Array.isArray(o)){let a=o.map(l=>jr(l,e)),s=r.additionalItems&&typeof r.additionalItems=="object"?jr(r.additionalItems,e):void 0;s?n=re.tuple(a).rest(s):n=re.tuple(a),typeof r.minItems=="number"&&(n=n.check(re.minLength(r.minItems))),typeof r.maxItems=="number"&&(n=n.check(re.maxLength(r.maxItems)))}else if(o!==void 0){let a=jr(o,e),s=re.array(a);typeof r.minItems=="number"&&(s=s.min(r.minItems)),typeof r.maxItems=="number"&&(s=s.max(r.maxItems)),n=s}else n=re.array(re.any());break}default:throw new Error(`Unsupported type: ${t}`)}return r.description&&(n=n.describe(r.description)),r.default!==void 0&&(n=n.default(r.default)),n}function jr(r,e){if(typeof r=="boolean")return r?re.any():re.never();let t=nM(r,e),n=r.type||r.enum!==void 0||r.const!==void 0;if(r.anyOf&&Array.isArray(r.anyOf)){let s=r.anyOf.map(u=>jr(u,e)),l=re.union(s);t=n?re.intersection(t,l):l}if(r.oneOf&&Array.isArray(r.oneOf)){let s=r.oneOf.map(u=>jr(u,e)),l=re.xor(s);t=n?re.intersection(t,l):l}if(r.allOf&&Array.isArray(r.allOf))if(r.allOf.length===0)t=n?t:re.any();else{let s=n?t:jr(r.allOf[0],e),l=n?0:1;for(let u=l;u<r.allOf.length;u++)s=re.intersection(s,jr(r.allOf[u],e));t=s}r.nullable===!0&&e.version==="openapi-3.0"&&(t=re.nullable(t)),r.readOnly===!0&&(t=re.readonly(t));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of o)s in r&&(i[s]=r[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in r&&(i[s]=r[s]);for(let s of Object.keys(r))AR.has(s)||(i[s]=r[s]);return Object.keys(i).length>0&&e.registry.add(t,i),t}function oM(r,e){if(typeof r=="boolean")return r?re.any():re.never();let t=_R(r,e?.defaultTarget),n=r.$defs||r.definitions||{},i={version:t,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??Ir};return jr(r,i)}var hF={};Xo(hF,{bigint:()=>BR,boolean:()=>FR,date:()=>NR,number:()=>ER,string:()=>SR});function SR(r){return C1(wp,r)}function ER(r){return W1(Ap,r)}function FR(r){return Y1(_p,r)}function BR(r){return eS(Pp,r)}function NR(r){return dS(Dm,r)}Kt(rw());var sM=[1,2,4,8],lM=[1,2,3,4,5,6,7,8],cM=["disable-track","mute-region"],uM=["all","previous-only"],dM=Le.object({metronome:Le.object({enabled:Le.boolean(),beatSubDivision:Le.union(sM.map(r=>Le.literal(r))),gain:Le.number().min(Number.NEGATIVE_INFINITY).max(0),monophonic:Le.boolean()}).default({enabled:!1,beatSubDivision:1,gain:-6,monophonic:!0}),playback:Le.object({timestampEnabled:Le.boolean(),pauseOnLoopDisabled:Le.boolean(),truncateNotesAtRegionEnd:Le.boolean()}).default({timestampEnabled:!0,pauseOnLoopDisabled:!1,truncateNotesAtRegionEnd:!1}),recording:Le.object({countInBars:Le.union(lM.map(r=>Le.literal(r))),allowTakes:Le.boolean(),olderTakeAction:Le.union(cM.map(r=>Le.literal(r))),olderTakeScope:Le.union(uM.map(r=>Le.literal(r)))}).default({countInBars:1,allowTakes:!0,olderTakeAction:"mute-region",olderTakeScope:"previous-only"})}),aM;(function(r){r.BeatSubDivisionOptions=sM,r.RecordingCountInBars=lM,r.OlderTakeActionOptions=cM,r.OlderTakeScopeOptions=uM})(aM||(aM={}));var Sp={[Qt.Instrument]:0,[Qt.Aux]:1,[Qt.Bus]:2,[Qt.Output]:3};var gb;(function(r){r.create=({boxGraph:e,mandatoryBoxes:{rootBox:t,primaryAudioBusBox:n}},i,o,a)=>{let s=a??r.orderAndGetIndex(t,i);return console.debug(`createAudioUnit type: ${i}, insertIndex: ${s}`),yt.create(e,b.generate(),l=>{l.collection.refer(t.audioUnits),l.output.refer(n.input),l.index.setValue(s),l.type.setValue(i),o.ifSome(u=>l.capture.refer(u))})},r.orderAndGetIndex=(e,t)=>{let n=Wc.collectIndexedBoxes(e.audioUnits,yt),i=Sp[t],o=0;for(;o<n.length&&!(Sp[n[o].type.getValue()]>i);o++);let a=o;for(;o<n.length;)n[o].index.setValue(++o);return a},r.trackTypeToCapture=(e,t)=>{switch(t){case me.Audio:return m.wrap(Ka.create(e,b.generate()));case me.Notes:return m.wrap(Wa.create(e,b.generate()));default:return m.None}}})(gb||(gb={}));var pM;(function(r){r.create=(e,t,n,i,o)=>{console.debug(`createAudioBus '${t}', type: ${i}, color: ${o}`);let{boxGraph:a,mandatoryBoxes:{rootBox:s}}=e;V(s.isAttached(),"rootBox not attached");let l=b.generate(),u=$n.create(a,l,d=>{d.collection.refer(s.audioBusses),d.label.setValue(t),d.icon.setValue(He.toName(n)),d.color.setValue(o.toString())}),p=gb.create(e,i,m.None);return Zr.create(a,b.generate(),d=>{d.tracks.refer(p.tracks),d.target.refer(p),d.index.setValue(0),d.type.setValue(me.Undefined)}),u.output.refer(p.input),u}})(pM||(pM={}));var hM;(function(r){r.forAudioType=e=>{switch(e){case Qt.Output:return Ga.blue;case Qt.Aux:return Ga.purple;case Qt.Bus:return Ga.orange;case Qt.Instrument:return Ga.green;default:return Ga.dark}},r.forTrackType=e=>{switch(e){case me.Audio:return 200;case me.Notes:return 45;case me.Value:return 156;default:return 0}}})(hM||(hM={}));var fM;(function(r){r.Tape={defaultName:"Tape",defaultIcon:He.Tape,description:"Plays audio regions & clips",manualPage:pe.Tape,trackType:me.Audio,create:(n,i,o,a,s)=>lu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.toName(a)),l.flutter.setValue(.2),l.wow.setValue(.05),l.noise.setValue(.02),l.saturation.setValue(.5),l.host.refer(i)})},r.Nano={defaultName:"Nano",defaultIcon:He.NanoWave,description:"Simple sampler",manualPage:pe.Nano,trackType:me.Notes,create:(n,i,o,a,s)=>{let l;if(q(s))l=s;else{let u=b.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3"),p=5.34;l=n.findBox(u).unwrapOrElse(()=>br.create(n,u,d=>{d.fileName.setValue("Rhode"),d.endInSeconds.setValue(p)}))}return au.create(n,b.generate(),u=>{u.label.setValue(o),u.icon.setValue(He.toName(a)),u.file.refer(l),u.host.refer(i)})}},r.Playfield={defaultName:"Playfield",defaultIcon:He.Playfield,description:"Drum computer",manualPage:pe.Playfield,trackType:me.Notes,create:(n,i,o,a,s)=>{let l=su.create(n,b.generate(),u=>{u.label.setValue(o),u.icon.setValue(He.toName(a)),u.host.refer(i)});return q(s)&&s.filter(({note:u,uuid:p,name:d,durationInSeconds:h,exclude:g})=>{let v=e(n,p,d,h);Za.create(n,b.generate(),y=>{y.device.refer(l.samples),y.file.refer(v),y.index.setValue(u),y.exclude.setValue(g)})}),l}},r.Vaporisateur={defaultName:"Vaporisateur",defaultIcon:He.Piano,description:"Classic subtractive synthesizer",manualPage:pe.Vaporisateur,trackType:me.Notes,create:(n,i,o,a,s)=>iu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.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(_o.Polyphonic),l.lfo.rate.setInitValue(1),l.oscillators.fields()[0].waveform.setInitValue(ut.saw),l.oscillators.fields()[0].volume.setInitValue(-6),l.oscillators.fields()[1].volume.setInitValue(Number.NEGATIVE_INFINITY),l.oscillators.fields()[1].waveform.setInitValue(ut.square),l.host.refer(i),l.version.setValue(2)})},r.MIDIOutput={defaultName:"MIDIOutput",defaultIcon:He.Midi,description:"MIDI Output",manualPage:pe.MIDIOutput,trackType:me.Notes,create:(n,i,o,a,s)=>nu.create(n,b.generate(),l=>{l.label.setValue(o),l.icon.setValue(He.toName(a)),l.host.refer(i)})},r.Soundfont={defaultName:"Soundfont",defaultIcon:He.SoundFont,description:"Soundfont Player",manualPage:pe.Soundfont,trackType:me.Notes,create:(n,i,o,a,s)=>{s??(s={uuid:"d9f51577-2096-4671-9067-27ca2e12b329",name:"Upright Piano KW"});let l=s.uuid,u=b.parse(l),p=t(n,u,s.name);return ou.create(n,b.generate(),d=>{d.label.setValue(o),d.icon.setValue(He.toName(a)),d.host.refer(i),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=(n,i,o,a)=>n.findBox(i).unwrapOrElse(()=>br.create(n,i,s=>{s.fileName.setValue(o),s.endInSeconds.setValue(a)})),t=(n,i,o)=>n.findBox(i).unwrapOrElse(()=>Ao.create(n,i,a=>a.fileName.setValue(o)))})(fM||(fM={}));var zs;(function(r){r.empty=n=>{let i=new nl(m.wrap(ol.create)),o=new Date().toISOString();console.debug(`New Project created on ${o}`),i.beginTransaction();let a=tu.create(i,b.generate(),h=>{h.label.setValue("Groove Shuffle")}),s=Zc.create(i,b.generate(),h=>{h.groove.refer(a),h.created.setValue(o)}),l=$n.create(i,b.generate(),h=>{h.collection.refer(s.audioBusses),h.label.setValue("Output"),h.icon.setValue(He.toName(He.SpeakerHeadphone)),h.color.setValue(Ga.blue.toString())}),u=yt.create(i,b.generate(),h=>{h.type.setValue(Qt.Output),h.collection.refer(s.audioUnits),h.output.refer(s.outputDevice),h.index.setValue(0)});n.createOutputCompressor&&ru.create(i,b.generate(),h=>{h.label.setValue("Master Compressor"),h.index.setValue(0),h.host.refer(u.audioEffects),h.threshold.setValue(0),h.ratio.setValue(24)});let p=ll.create(i,b.generate());kn.create(i,b.generate(),h=>p.tempoTrack.events.refer(h.owners)),s.timeline.refer(p.root),l.output.refer(u.input);let d=[];if(n.createDefaultUser){let h=sl.create(i,b.generate());h.root.refer(s.users),d.push(h)}return i.endTransaction(),{boxGraph:i,mandatoryBoxes:{rootBox:s,primaryAudioBusBox:l,primaryAudioUnitBox:u,timelineBox:p,userInterfaceBoxes:d}}},r.encode=n=>{let i=or.create();i.writeInt(1330660686),i.writeInt(2);let o=n.toArrayBuffer();return i.writeInt(o.byteLength),i.writeBytes(new Int8Array(o)),i.toArrayBuffer()},r.decode=n=>{let i=new wt(n);V(i.readInt()===1330660686,"Corrupt header. Probably not an openDAW project file."),V(i.readInt()===2,"Deprecated Format");let o=i.readInt(),a=new Int8Array(o);i.readBytes(a);let s=new nl(m.wrap(ol.create));return s.fromArrayBuffer(a.buffer),{boxGraph:s,mandatoryBoxes:r.findMandatoryBoxes(s)}},r.findMandatoryBoxes=n=>{let i=n.boxes().find(o=>o.accept({visitRootBox:()=>!0}));if(q(i)){let o=Ce(i.outputDevice.pointerHub.incoming().at(0)?.box,yt),a=Ce(o.input.pointerHub.incoming().at(0)?.box,$n),s=Ce(i.timeline.targetVertex.unwrap("TimelineBox not found").box,ll),l=i.users.pointerHub.incoming().map(({box:u})=>Ce(u,sl));return{rootBox:i,primaryAudioBusBox:a,primaryAudioUnitBox:o,timelineBox:s,userInterfaceBoxes:l}}return D("Could not find mandatory boxes")}})(zs||(zs={}));var nr;(function(r){let e=({graph:n},{graph:i})=>n===i,t=(n,i)=>n.index.getValue()-i.index.getValue();r.excludeTimelinePredicate=n=>n.accept({visitTrackBox:()=>!0})===!0,r.shouldExclude=n=>n.ephemeral||n.name===eu.ClassName,r.generateMap=(n,i,o,a)=>{let s=b.newSet(({source:l})=>l);return s.addMany([...n.filter(({output:{targetAddress:l}})=>l.nonEmpty()).map(l=>({source:l.output.targetAddress.unwrap().uuid,target:a})),...n.map(l=>({source:l.collection.targetAddress.unwrap("AudioUnitBox was not connected to a RootBox").uuid,target:o})),...n.map(l=>({source:l.address.uuid,target:b.generate()})),...i.map(l=>({source:l.address.uuid,target:l.resource==="preserved"?l.address.uuid:b.generate()}))]),s},r.copyBoxes=(n,i,o,a)=>{let s=b.newSet(u=>u);a.forEach(u=>{u.resource==="preserved"&&i.findBox(u.address.uuid).nonEmpty()&&s.add(u.address.uuid)});let l=u=>{for(let[p,d]of u.outgoingEdges())if(p.mandatory&&!d.isBox()&&s.hasKey(d.uuid))return!0;return!1};N.decodeWith({map:(u,p)=>p.map(d=>n.opt(d.uuid).match({none:()=>d,some:({target:h})=>d.moveTo(h)}))},()=>{o.forEach(u=>{let p=new wt(u.toArrayBuffer()),d=n.get(u.address.uuid).target;i.createBox(u.name,d,h=>h.read(p))}),a.forEach(u=>{if(s.hasKey(u.address.uuid)||l(u))return;let p=new wt(u.toArrayBuffer()),d=n.get(u.address.uuid).target;i.createBox(u.name,d,h=>h.read(p))})})},r.reorderAudioUnits=(n,i,o)=>i.toSorted(t).map(a=>Ce(o.graph.findBox(n.get(a.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt)).forEach(a=>Wc.collectIndexedBoxes(o.audioUnits,yt).toSorted((s,l)=>{let u=Sp[s.type.getValue()],p=Sp[l.type.getValue()],d=u-p;return d===0?l===a?-1:1:d}).forEach((s,l)=>s.index.setValue(l))),r.extractRegions=(n,{boxGraph:i,mandatoryBoxes:{primaryAudioBusBox:o,rootBox:a}},s=0)=>{V(U.satisfy(n,e),"Region smust be from the same BoxGraph");let l=new Set(n),u=new Set,p=new $c;n.forEach(B=>{let I=Ce(B.regions.targetVertex.unwrap().box,Zr);u.add(I);let O=Ce(I.tracks.targetVertex.unwrap().box,yt);p.add(O,I)}),console.debug(`Found ${p.keyCount()} audioUnits`),console.debug(`Found ${u.size} tracks`);let d=[...p.keys()],h=B=>r.shouldExclude(B)||pt(B,Zr)&&!u.has(B)||io.isRegionBox(B)&&!l.has(B),g=Array.from(d[0].graph.dependenciesOf(d,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:h}).boxes),v=r.generateMap(d,g,a.audioUnits.address.uuid,o.address.uuid);r.copyBoxes(v,i,d,g),r.reorderAudioUnits(v,d,a),p.forEach((B,I)=>[...I].sort(t).forEach((O,z)=>{let $=i.findBox(v.get(O.address.uuid).target).unwrap("Target Track has not been copied");Ce($,Zr).index.setValue(z)}));let y=n.reduce((B,I)=>Math.min(B,I.position.getValue()),Number.MAX_VALUE),x=s-y;n.forEach(B=>{let I=i.findBox(v.get(B.address.uuid).target).unwrap("Target Track has not been copied"),{position:O}=io.asRegionBox(I);O.setValue(O.getValue()+x)})}})(nr||(nr={}));var mM;(function(r){r.transfer=(e,{boxGraph:t,mandatoryBoxes:{primaryAudioBusBox:n,rootBox:i}},o={})=>{let a=u=>nr.shouldExclude(u)||o?.excludeTimeline===!0&&nr.excludeTimelinePredicate(u),s=Array.from(e[0].graph.dependenciesOf(e,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:a}).boxes),l=nr.generateMap(e,s,i.audioUnits.address.uuid,n.address.uuid);return nr.copyBoxes(l,t,e,s),nr.reorderAudioUnits(l,e,i),e.map(u=>Ce(i.graph.findBox(l.get(u.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt))}})(mM||(mM={}));var gM;(function(r){r.transfer=(e,t,n,i=!0)=>{let o=t.graph,a=b.newSet(h=>h.address.uuid);a.add(e);for(let h of e.graph.dependenciesOf(e,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:g=>g.ephemeral}).boxes)a.add(h);let s=b.newSet(h=>h);a.forEach(h=>{h.resource==="preserved"&&o.findBox(h.address.uuid).nonEmpty()&&s.add(h.address.uuid)});let l=h=>{if(h.resource==="preserved"&&s.hasKey(h.address.uuid))return!0;for(let[,g]of h.outgoingEdges())if(s.hasKey(g.uuid)&&!g.isBox())return!0;return!1},u=a.values().filter(h=>!l(h)),p=b.newSet(h=>h.source);u.forEach(h=>{p.add({source:h.address.uuid,target:h.resource==="preserved"?h.address.uuid:b.generate()})}),s.forEach(h=>p.add({source:h,target:h}));let d=null;return N.decodeWith({map:(h,g)=>{let v=g.flatMap(y=>p.opt(y.uuid).map(x=>y.moveTo(x.target)));return v.nonEmpty()?v:h.pointerType===c.RegionCollection?m.wrap(t.regions.address):h.pointerType===c.ClipCollection?m.wrap(t.clips.address):m.None}},()=>u.forEach(h=>{let g=new wt(h.toArrayBuffer()),v=p.get(h.address.uuid).target;o.createBox(h.name,v,y=>{if(y.read(g),io.isRegionBox(y)){let x=io.asRegionBox(y);x.position.setValue(n),d=x}})})),i&&e.delete(),he(d,"Failed to create region copy")}})(gM||(gM={}));var Us;(function(r){r.MAGIC_HEADER_OPEN=1330664005,r.FORMAT_VERSION=1})(Us||(Us={}));var vM;(function(r){r.decode=(e,t)=>{let n=new wt(e.slice(0,8));if(n.readInt()!==Us.MAGIC_HEADER_OPEN){Oc.info({headline:"Could Not Import Preset",message:"Invalid preset file"}).then();return}if(n.readInt()!==Us.FORMAT_VERSION){Oc.info({headline:"Could Not Import Preset",message:"Invalid preset version"}).then();return}let i=new nl(m.wrap(ol.create));try{i.fromArrayBuffer(e.slice(8))}catch(d){Oc.info({headline:"Could Not Import Preset",message:String(d)}).then();return}let o=i.boxes().filter(d=>pt(d,yt)).filter(d=>d.type.getValue()!==Qt.Output),a=d=>nr.shouldExclude(d)||nr.excludeTimelinePredicate(d),s=Array.from(i.dependenciesOf(o,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:a}).boxes),{mandatoryBoxes:{rootBox:l,primaryAudioBusBox:u}}=t,p=nr.generateMap(o,s,l.audioUnits.address.uuid,u.address.uuid);nr.copyBoxes(p,t.boxGraph,o,s),nr.reorderAudioUnits(p,o,l),o.map(d=>Ce(l.graph.findBox(p.get(d.address.uuid).target).unwrap("Target AudioUnit has not been copied"),yt)).filter(d=>d.type.getValue()!==Qt.Output).forEach(d=>{let h=d.input.pointerHub.incoming().at(0)?.box;q(h)&&d.capture.targetVertex.ifSome(({box:g})=>{g instanceof Wa?Zr.create(t.boxGraph,b.generate(),v=>{v.index.setValue(0),v.type.setValue(me.Notes),v.target.refer(d),v.tracks.refer(d.tracks)}):g instanceof Ka&&Zr.create(t.boxGraph,b.generate(),v=>{v.index.setValue(0),v.type.setValue(me.Audio),v.target.refer(d),v.tracks.refer(d.tracks)})})})},r.replaceAudioUnit=(e,t,n)=>{console.debug("ReplaceAudioUnit with preset...");let i=zs.empty({createDefaultUser:!1,createOutputCompressor:!1}),o=i.boxGraph,a=t.graph;o.beginTransaction(),r.decode(e,i),o.endTransaction();let s=i.mandatoryBoxes.rootBox.audioUnits.pointerHub.incoming().map(({box:x})=>Ce(x,yt)).find(x=>x.type.getValue()!==Qt.Output);if(ng(s))return fo.err("Preset contains no valid audio unit. Please send the file to the developers.");let l=s.capture.targetVertex.mapOr(({box:x})=>x.name,""),u=t.capture.targetVertex.mapOr(({box:x})=>x.name,"");if(l!==u)return fo.err("Cannot replace incompatible instruments");let p=n?.keepMIDIEffects!==!0,d=n?.keepAudioEffects!==!0;console.debug("replaceMIDIEffects",p),console.debug("replaceAudioEffects",d),he(t.input.pointerHub.incoming().at(0)?.box,"Target has no input").delete(),p?t.midiEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()):(o.beginTransaction(),s.midiEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()),o.endTransaction()),d?t.audioEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()):(o.beginTransaction(),s.audioEffects.pointerHub.incoming().forEach(({box:x})=>x.delete()),o.endTransaction());let h=x=>x.accept({visitTrackBox:B=>!0,visitCaptureMidiBox:B=>!0,visitCaptureAudioBox:B=>!0})===!0,g=b.newSet(({source:x})=>x),v=Array.from(o.dependenciesOf(s,{excludeBox:h,alwaysFollowMandatory:!1}).boxes);g.addMany([{source:s.address.uuid,target:t.address.uuid},...v.map(({address:{uuid:x},name:B})=>({source:x,target:B===br.ClassName||B===Ao.ClassName?x:b.generate()}))]);let y=b.newSet(x=>x);return v.forEach(x=>{(x instanceof br||x instanceof Ao)&&a.findBox(x.address.uuid).nonEmpty()&&y.add(x.address.uuid)}),N.decodeWith({map:(x,B)=>B.map(I=>g.opt(I.uuid).match({none:()=>I,some:({target:O})=>I.moveTo(O)}))},()=>{v.forEach(x=>{if((x instanceof br||x instanceof Ao)&&y.opt(x.address.uuid).nonEmpty())return;let B=new wt(x.toArrayBuffer()),I=x.name,O=g.get(x.address.uuid).target;a.createBox(I,O,z=>z.read(B))})}),fo.Ok}})(vM||(vM={}));var yM;(function(r){r.encode=e=>{let t=or.create();t.writeInt(Us.MAGIC_HEADER_OPEN),t.writeInt(Us.FORMAT_VERSION);let n=zs.empty({createOutputCompressor:!1,createDefaultUser:!1}),{boxGraph:i,mandatoryBoxes:{rootBox:o,primaryAudioBusBox:a}}=n,s=[e],l=d=>nr.shouldExclude(d)||nr.excludeTimelinePredicate(d);i.beginTransaction();let u=Array.from(e.graph.dependenciesOf(s,{alwaysFollowMandatory:!0,stopAtResources:!0,excludeBox:l}).boxes),p=nr.generateMap(s,u,o.audioUnits.address.uuid,a.address.uuid);return nr.copyBoxes(p,i,s,u),nr.reorderAudioUnits(p,s,o),i.endTransaction(),console.debug("SAVING..."),i.debugBoxes(),U.concatArrayBuffers(t.toArrayBuffer(),i.toArrayBuffer())}})(yM||(yM={}));var xM;(function(r){r.existingInstrumentNames=e=>e.audioUnits.pointerHub.incoming().map(({box:t})=>{let n=Ce(t,yt).input.pointerHub.incoming().at(0);if(n===void 0)return"N/A";let i=n.box;return"label"in i&&i.label instanceof C?i.label.getValue():"N/A"})})(xM||(xM={}));var wM=Le.object({name:Le.string(),bpm:Le.number(),duration:Le.number(),sample_rate:Le.number(),origin:Le.enum(["openDAW","recording","import"])});var lne=wM.extend({uuid:b.zType(Le)});var IR,DR,MR,kR,$R,TR;IR=new WeakMap,DR=new WeakMap,MR=new WeakMap,kR=new WeakMap,$R=new WeakMap,TR=new WeakMap;var Ep=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},RR,CR,fF,mF,gF,OR,VR;CR=new WeakMap,fF=new WeakMap,mF=new WeakMap,gF=new WeakMap,OR=new WeakMap,RR=new WeakSet,VR=function(e){return e.pointerHub.catchupAndSubscribe({onAdded:t=>{let n=Ce(t.box,al);V(n.isAttached(),"SelectionBox is not attached");let i=n.selectable.targetVertex.unwrap(()=>`SelectionBox has no target (${n.selectable.targetAddress.unwrapOrUndefined()?.toString()??"No address"})`),o={box:n,selectable:i};Ep(this,gF,"f").proxy.onSelected(i),V(Ep(this,fF,"f").add(o),"Could not add to entityMap"),V(Ep(this,mF,"f").add(o),"Could not add to selectableMap")},onRemoved:t=>{let n=Ce(t.box,al),i=Ep(this,fF,"f").removeByKey(n.address.uuid);V(i.box===n,"Broken selection");let o=i.selectable;Ep(this,gF,"f").proxy.onDeselected(o),Ep(this,mF,"f").removeByKey(o.address)}},c.Selection)};var bM=Le.object({name:Le.string(),size:Le.number().int(),url:Le.string(),license:Le.string(),origin:Le.enum(["openDAW","import"])});var _ne=bM.extend({uuid:b.zType(Le)});var AM;(function(r){r.cut=(e,t,n)=>{if(!(e.position>=t||t>=e.complete))if(f_.isLoopableRegion(e)){let{position:i,complete:o,loopOffset:a,loopDuration:s}=e;e.duration=t-i,e.copyTo({position:t,duration:o-t,loopOffset:qs(a+(t-i),s),consolidate:n})}else return D("Not yet implemented")},r.clip=(e,t,n)=>{if(f_.isLoopableRegion(e)){let{position:i,complete:o,loopOffset:a,loopDuration:s}=e;if(o-n<=0)return D(`duration will zero or negative(${o-n})`);e.duration=t-i,e.copyTo({position:n,duration:o-n,loopOffset:qs(a+(n-i),s)})}else return D("Not yet implemented")}})(AM||(AM={}));var js;(function(r){r[r.Float=0]="Float",r[r.FloatArray=1]="FloatArray",r[r.Integer=2]="Integer",r[r.IntegerArray=3]="IntegerArray",r[r.ByteArray=4]="ByteArray"})(js||(js={}));var Cm;(function(r){r[r.WRITE=0]="WRITE",r[r.READ=1]="READ"})(Cm||(Cm={}));var Fp;(function(r){r[r.ID=15793935]="ID",r[r.START=15790320]="START",r[r.END=986895]="END"})(Fp||(Fp={}));var vb=class r{static create(e,t){return new r(e.channel(t))}#e=[];#t=new SharedArrayBuffer(1);#r=new Int8Array(this.#t);#i;#n=or.create(0);#o=m.None;#a=m.None;#s=m.None;#l=-1;#c=-1;#u=!1;#p=!1;#d=0;constructor(e){this.#i=In.sender(e,({dispatchAndForget:t})=>new class{sendShareLock(n){t(this.sendShareLock,n)}sendUpdateData(n){t(this.sendUpdateData,n)}sendUpdateStructure(n){t(this.sendUpdateStructure,n)}})}flush(){let e=this.#f();if(e.nonEmpty()){this.#p||(this.#i.sendShareLock(this.#t),this.#p=!0),this.#i.sendUpdateStructure(e.unwrap());let t=this.#e.length,n=this.#h(),i=t+n;if(this.#o.isEmpty()||this.#o.unwrap().byteLength<i||t!==this.#d){let a=mo(i),s=new SharedArrayBuffer(a);this.#a=m.wrap(new Uint8Array(s,0,t)),this.#n=or.use(s,t),this.#o=m.wrap(s),this.#d=t,this.#i.sendUpdateData(s)}}this.#o.isEmpty()||Atomics.load(this.#r,0)===Cm.WRITE&&(this.#m(this.#n),this.#n.position=0,Atomics.store(this.#r,0,Cm.READ))}broadcastFloat(e,t){return this.#v(new class{type=js.Float;address=e;capacity=8;put(n,i){n.writeFloat(t())}})}broadcastInteger(e,t){return this.#v(new class{type=js.Integer;address=e;capacity=8;put(n,i){n.writeInt(t())}})}broadcastFloats(e,t,n){return this.#v(new class{type=js.FloatArray;address=e;capacity=4+(t.byteLength<<2);put(i,o){n?.(o),i.writeInt(t.length);for(let a of t)i.writeFloat(a)}})}broadcastIntegers(e,t,n){return this.#v(new class{type=js.IntegerArray;address=e;capacity=4+(t.byteLength<<2);put(i,o){n(o),i.writeInt(t.length),t.forEach(a=>i.writeInt(a))}})}broadcastByteArray(e,t,n){return this.#v(new class{type=js.ByteArray;address=e;capacity=4+t.byteLength;put(i,o){n(o),i.writeInt(t.byteLength),i.writeBytes(t)}})}#f(){if(this.#u){try{this.#s=m.wrap(this.#A())}catch(e){throw e}this.#u=!1}if(this.#s.nonEmpty()){let e=this.#s;return this.#s=m.None,e}return m.None}#h(){return this.#c===-1&&(this.#c=this.#g()+12),this.#c}terminate(){U.clear(this.#e),this.#s=m.None,this.#u=!1,this.#c=0}#m(e){V(!this.#u&&this.#s.isEmpty(),"Cannot flush while update is available");let t=this.#h();V(e.remaining>=t,"Insufficient data"),e.writeInt(this.#l),e.writeInt(Fp.START);let n=this.#a;for(let i=0;i<this.#e.length;i++){let o=n.nonEmpty()&&n.unwrap()[i]!==0;this.#e[i].put(e,o)}e.writeInt(Fp.END)}#g(){return this.#e.reduce((e,t)=>e+t.capacity,0)}#v(e){return this.#e.push(e),this.#w(),{terminate:()=>{U.removeOpt(this.#e,e),this.#w()}}}#w(){this.#c=-1,this.#u=!0}#A(){let e=or.create();e.writeInt(Fp.ID),e.writeInt(++this.#l),e.writeInt(this.#e.length);for(let{address:t,type:n}of this.#e)t.write(e),e.writeByte(n);return e.toArrayBuffer()}};var Om=class{#e=new j;#t;constructor(e,t){this.#t=this.#e.own(new hg(t)),this.#e.own(In.executor(e,{updateSettings:n=>this.#t.update(n)}))}get settings(){return this.#t.data}catchupAndSubscribe(e,...t){return this.#t.catchupAndSubscribe(e,...t)}terminate(){this.#e.terminate(),this.#t.terminate()}};var Bp;(e=>e.create=(t,n,i,o)=>0|(t?1:0)|(n?2:0)|(i?4:0)|(o?8:0))(Bp||={});var Be=class r{static PEAK_DECAY=Math.exp(-1/(sampleRate*.25));static RMS_WINDOW=Math.floor(sampleRate*.1);#e;#t;#r;#i;#n;#o=0;#a=0;#s=0;#l=0;constructor(e,t){this.#e=e,this.#t=t,this.#r=new Float32Array(4),this.#i=U.create(()=>new Lc(r.RMS_WINDOW),2),this.#n=this.#e.broadcastFloats(this.#t,this.#r,n=>{this.#r[0]=this.#o,this.#r[1]=this.#a,this.#r[2]=this.#s,this.#r[3]=this.#l})}clear(){this.#i[0].clear(),this.#i[1].clear(),this.#o=0,this.#a=0}process(e,t,n=0,i=fe){let o=i-n,a=r.PEAK_DECAY**o,s=0,l=0;for(let u=n;u<i;u++){let p=Math.abs(e[u]),d=Math.abs(t[u]);p>s&&(s=p),d>l&&(l=d)}this.#o=Math.max(s,this.#o*a),this.#a=Math.max(l,this.#a*a),this.#s=this.#i[0].processBlock(e,n,i),this.#l=this.#i[1].processBlock(t,n,i)}processStereo([e,t],n=0,i=fe){this.process(e,t,n,i)}terminate(){this.#n.terminate()}};var yb=class{#e=new j;#t;#r;#i;#n=m.None;#o;constructor(e,t){this.#t=e,this.#r=t,this.#i=new ce,this.#o=this.#r.getValue(),this.#e.own(this.#r.subscribe(n=>{this.#o=n.getValue(),this.#i.notify(this)}))}get adapter(){return this.#r}get address(){return this.#r.address}subscribe(e){return this.#i.subscribe(e)}getValue(){return this.#o}getUnitValue(){return this.#r.valueMapping.x(this.#o)}onStartAutomation(){V(this.#n.isEmpty(),"Already broadcasting"),this.#n=m.wrap(this.#t.broadcaster.broadcastFloat(this.#r.address,()=>this.getUnitValue()))}updateAutomation(e){let t=this.#r.valueAt(e);return this.#o!==t?(this.#o=t,!0):!1}onStopAutomation(){V(this.#n.nonEmpty(),"Never started broadcasting"),this.#n.unwrap().terminate(),this.#n=m.None,this.#o=this.#r.getValue(),this.#i.notify(this)}own(e){return this.#e.own(e)}ownAll(...e){this.#e.ownAll(...e)}spawn(){return this.#e.spawn()}terminate(){this.#e.terminate()}};var Np=class{#e;constructor(){this.#e=new dg}add(e,t){this.#e.add(e,t)}get(e){return this.#e.get(e)}forEach(e){return this.#e.forEach(e)}clear(){this.#e.clear()}};var gr=class{#e=new j;#t;#r;#i;#n;#o=m.None;constructor(e){this.#t=e,this.#r=new Np,this.#i=[],this.#n=[]}parameterChanged(e,t){return D(`Got update event for ${e}, but has no parameter change method`)}get context(){return this.#t}get eventInput(){return this.#r}bindParameter(e){let t=new yb(this.#t,e);return t.ownAll(e.field.pointerHub.catchupAndSubscribe({onAdded:n=>{this.#o.isEmpty()&&(this.#o=m.wrap(this.#t.updateClock.addEventOutput(this.#r))),this.#n.push(t),t.onStartAutomation()},onRemoved:n=>{U.remove(this.#n,t),this.#n.length===0&&(this.#o.ifSome(i=>i.terminate()),this.#o=m.None),t.onStopAutomation()}},c.Automation),t.subscribe(()=>this.parameterChanged(t))),this.#i.push(t),t}updateParameters(e,t){this.#n.forEach(n=>{n.updateAutomation(e)&&this.parameterChanged(n,t)})}readAllParameters(){this.#i.forEach(e=>this.parameterChanged(e,0))}own(e){return this.#e.own(e)}ownAll(...e){return this.#e.ownAll(...e)}spawn(){return this.#e.spawn()}terminate(){this.#o.ifSome(e=>e.terminate()),this.#o=m.None,this.#i.length=0,this.#e.terminate()}toString(){return`{${this.constructor.name}}`}};var Vm;(e=>e.isOfType=t=>t.type==="update-event")(Vm||={});var xb=class extends gr{#e=[];constructor(e){super(e),this.own(this.context.registerProcessor(this))}reset(){this.eventInput.clear()}addEventOutput(e){return this.#e.push(e),{terminate:()=>U.remove(this.#e,e)}}process({blocks:e}){e.forEach(({p0:t,p1:n,flags:i},o)=>{if(St.every(i,1))for(let a of Oa.iterate(t,n,Ng)){let s={type:"update-event",position:a};this.#e.forEach(l=>l.add(o,s))}})}toString(){return`{${this.constructor.name}}`}};var Ve=class extends gr{constructor(e){super(e)}process({blocks:e}){e.forEach(t=>{this.introduceBlock(t);let{index:n,p0:i,s0:o,s1:a,bpm:s}=t,l=null,u=o;for(let p of this.eventInput.get(n)){let d=p.position-i,h=Math.abs(d)<1e-7?o:o+Math.floor(J.pulsesToSamples(d,s,sampleRate));V(o<=h&&h<=a,()=>`${h} out of bounds. event: ${p.position} (${p.type}), p0: ${i}`),l?.forEach(g=>this.handleEvent(g)),l=null,u<h&&(this.processAudio(t,u,h),u=h),Vm.isOfType(p)?this.updateParameters(p.position,o/sampleRate+J.pulsesToSeconds(p.position-i,s)):(l??=[]).push(p)}l?.forEach(p=>this.handleEvent(p)),l=null,u<a&&this.processAudio(t,u,a)}),this.eventInput.clear(),this.finishProcess()}introduceBlock(e){}handleEvent(e){return D(`${this} received an event but has no accepting method.`)}finishProcess(){}};var zR=50,UR=250,wb=class r{static FilterMapping=A.exponential(20/sampleRate,2e4/sampleRate);#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d=0;#f=0;#h=0;#m=0;#g=0;#v=0;feedback=.5;cross=0;lfoPhaseIncr=0;#w=0;lfoDepth=0;wet=.75;dry=.75;#A=!1;constructor(e){let t=mo(e);this.#e=t,this.#t=t-1,this.#r=[new Float32Array(t),new Float32Array(t)],this.#i=[new Jt,new Jt],this.#n=new vo,this.#o=Math.floor(.25*sampleRate),this.#a=new Wp(e,this.#o),this.#s=new Wp(e,this.#o),this.#l=[new Float32Array(128),new Float32Array(128)],this.#c=new Pi(.003,sampleRate),this.#u=Math.exp(-1/(sampleRate*zR)),this.#p=Math.exp(-1/(sampleRate*UR))}reset(){this.#f=0,this.#a.clear(),this.#s.clear(),this.#A&&(this.#i.forEach(e=>e.reset()),this.#r.forEach(e=>e.fill(0)),this.#A=!1,this.#v=0,this.#w=0),this.#_()}set preDelayLeftOffset(e){this.#a.offset=Math.max(0,Math.min(e,this.#e-1))}set preDelayRightOffset(e){this.#s.offset=Math.max(0,Math.min(e,this.#e-1))}set offset(e){(e<0||e>=this.#e)&&D(`DelayDeviceDsp offset ${e} out of bounds [0, ${this.#e})`),this.#h!==e&&(this.#h=e,this.#A?this.#E():this.#_())}get offset(){return this.#h}set filter(e){e===0?this.#n.identity():e>0?this.#n.setHighpassParams(r.FilterMapping.y(e)):e<0&&this.#n.setLowpassParams(r.FilterMapping.y(1+e))}setLfoDepth(e){this.lfoDepth=e}process(e,t,n,i){let o=e[0],a=e[1],s=t[0],l=t[1];this.#a.process(this.#l[0],o,n,i),this.#s.process(this.#l[1],a,n,i);let u=this.cross,p=1-u,d=this.#t,h=this.#e,g=this.feedback,v=this.wet,y=this.dry,x=this.#n,[B,I]=this.#i,[O,z]=this.#r,[$,ie]=this.#l;for(let ne=n;ne<i;++ne){this.#g>0?(this.#d+=this.#m,this.#g--):this.#d=this.#h;let le=this.#c.process(this.lfoDepth),W=2*Math.abs(this.#w-.5)*le;this.#w+=this.lfoPhaseIncr,this.#w>=1&&(this.#w-=1);let xe=this.#f-(this.#d+le-W);xe<0&&(xe+=h);let se=xe|0,Ee=se+1&d,Re=xe-se,st=O[se&d],gt=z[se&d],ye=st+Re*(O[Ee]-st),ke=gt+Re*(z[Ee]-gt),lt=Math.max(Math.abs(ye),Math.abs(ke));this.#v=lt>this.#v?this.#u*(this.#v-lt)+lt:this.#p*(this.#v-lt)+lt,this.#v>1&&(ye/=this.#v,ke/=this.#v);let Lr=B.processFrame(x,(ye*p+ke*u)*.96),Wi=I.processFrame(x,(ke*p+ye*u)*.96);O[this.#f]=$[ne]+Lr*g+1e-18-1e-18,z[this.#f]=ie[ne]+Wi*g+1e-18-1e-18,s[ne]=o[ne]*y+Lr*v,l[ne]=a[ne]*y+Wi*v,this.#f=this.#f+1&d,O[this.#f]=0,z[this.#f]=0}this.#A=!0}#_(){this.#d=this.#h,this.#g=0}#E(){this.#h!==this.#d&&(this.#g=this.#o,this.#m=(this.#h-this.#d)/this.#g)}};var bb=class r extends Ve{static ID=0;#e=r.ID++;#t;parameterPreSyncTimeLeft;parameterPreMillisTimeLeft;parameterPreSyncTimeRight;parameterPreMillisTimeRight;parameterDelay;parameterMillisTime;parameterFeedback;parameterCross;parameterLfoSpeed;parameterLfoDepth;parameterFilter;parameterDry;parameterWet;#r;#i;#n;#o=m.None;#a=!0;#s=!0;#l=!0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address));let{namedParameter:n}=t;this.parameterPreSyncTimeLeft=this.own(this.bindParameter(n.preSyncTimeLeft)),this.parameterPreMillisTimeLeft=this.own(this.bindParameter(n.preMillisTimeLeft)),this.parameterPreSyncTimeRight=this.own(this.bindParameter(n.preSyncTimeRight)),this.parameterPreMillisTimeRight=this.own(this.bindParameter(n.preMillisTimeRight)),this.parameterDelay=this.own(this.bindParameter(n.delay)),this.parameterMillisTime=this.own(this.bindParameter(n.millisTime)),this.parameterFeedback=this.own(this.bindParameter(n.feedback)),this.parameterCross=this.own(this.bindParameter(n.cross)),this.parameterLfoSpeed=this.own(this.bindParameter(n.lfoSpeed)),this.parameterLfoDepth=this.own(this.bindParameter(n.lfoDepth)),this.parameterFilter=this.own(this.bindParameter(n.filter)),this.parameterDry=this.own(this.bindParameter(n.dry)),this.parameterWet=this.own(this.bindParameter(n.wet));let{Fractions:i}=tr,o=wr.toPPQN(i[i.length-1]),a=J.pulsesToSamples(o,im.min,sampleRate),s=tr.MAX_MILLIS_TIME*.001*sampleRate,l=tr.LFO_DEPTH_MAX*.001*sampleRate,u=a+s+l;this.#n=new wb(Math.ceil(u)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#n.reset(),this.#i.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio({bpm:e,flags:t},n,i){if(this.#o.isEmpty())return;let o=St.some(t,8);if(this.#s||o){let u=this.parameterPreSyncTimeLeft.getValue(),p=tr.Fractions[u],d=J.pulsesToSamples(wr.toPPQN(p),e,sampleRate),h=this.parameterPreMillisTimeLeft.getValue()*.001*sampleRate;this.#n.preDelayLeftOffset=d+h,this.#s=!1}if(this.#l||o){let u=this.parameterPreSyncTimeRight.getValue(),p=tr.Fractions[u],d=J.pulsesToSamples(wr.toPPQN(p),e,sampleRate),h=this.parameterPreMillisTimeRight.getValue()*.001*sampleRate;this.#n.preDelayRightOffset=d+h,this.#l=!1}if(this.#a||o){let u=this.parameterDelay.getValue(),p=wr.toPPQN(tr.Fractions[u]),d=J.pulsesToSamples(p,e,sampleRate),h=this.parameterMillisTime.getValue()*.001*sampleRate;this.#n.offset=d+h,this.#a=!1}let s=this.#o.unwrap().channels(),l=this.#r.channels();this.#n.process(s,l,n,i),this.#i.process(l[0],l[1],n,i)}parameterChanged(e){e===this.parameterPreSyncTimeLeft||e===this.parameterPreMillisTimeLeft?this.#s=!0:e===this.parameterPreSyncTimeRight||e===this.parameterPreMillisTimeRight?this.#l=!0:e===this.parameterDelay||e===this.parameterMillisTime?this.#a=!0:e===this.parameterFeedback?this.#n.feedback=this.parameterFeedback.getValue():e===this.parameterCross?this.#n.cross=this.parameterCross.getValue():e===this.parameterLfoSpeed?this.#n.lfoPhaseIncr=this.parameterLfoSpeed.getValue()/sampleRate:e===this.parameterLfoDepth?this.#n.setLfoDepth(this.parameterLfoDepth.getValue()*.001*sampleRate):e===this.parameterFilter?this.#n.filter=this.parameterFilter.getValue():(e===this.parameterDry||e===this.parameterWet)&&(this.#n.dry=Pe(this.parameterDry.getValue()),this.#n.wet=Pe(this.parameterWet.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})}`}};var zm=class r extends gr{static ID=0;#e=r.ID++;#t;#r;#i;#n=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing))}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#n=m.wrap(e),{terminate:()=>this.#n=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}process(e){if(this.#n.isEmpty())return;let t=this.#n.unwrap(),[n,i]=t.channels(),[o,a]=this.#r.channels();for(let s=0;s<fe;s++)o[s]=n[s],a[s]=i[s];this.#i.process(o,a)}parameterChanged(e){}toString(){return`{${this.constructor.name} (${this.#e})`}};var Ip=class r extends gr{static ID=0;#e=r.ID++;#t;#r;#i;#n;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=[],this.own(e.registerProcessor(this))}get noteEventTarget(){return m.None}get incoming(){return this}get outgoing(){return this}get uuid(){return this.#t.uuid}reset(){this.#i.clear(),this.#r.clear()}addAudioSource(e){return this.#n.push(e),{terminate:()=>{U.remove(this.#n,e),this.#r.clear()}}}get adapter(){return this.#t}get audioOutput(){return this.#r}process(e){this.#r.clear();let[t,n]=this.#r.channels();for(let i of this.#n){let[o,a]=i.channels();for(let s=0;s<fe;s++)t[s]+=o[s],n[s]+=a[s]}this.#r.assertSanity(),this.#i.process(this.#r.getChannel(0),this.#r.getChannel(1))}parameterChanged(e){}toString(){return`{${this.constructor.name} (${this.#e})}`}};var Fe;(s=>{s.Comparator=(l,u)=>{let p=l.position-u.position;return p!==0?p:l.type==="note-complete-event"?-1:u.type==="note-complete-event"?1:0},s.start=(l,u,p,d,h=0)=>({type:"note-event",position:l,duration:u,pitch:p,velocity:d,cent:h,id:++a}),s.startWith=(l,u,p)=>({type:"note-event",position:u??l.position,duration:p??l.duration,pitch:l.pitch,cent:l.cent,velocity:l.velocity,id:++a}),s.stop=({id:l,pitch:u},p)=>({type:"note-complete-event",position:p,pitch:u,id:l}),s.isStart=l=>l.type==="note-event"&&"id"in l&&typeof l.id=="number",s.isStop=l=>l.type==="note-complete-event";let a=0})(Fe||={});var Qo=class{#e=new j;#t;#r;#i;#n=m.None;constructor(e,t,n){this.#t=e,this.#r=this.#e.own(new Pn(t,n)),this.#i=new Array(16)}setNoteEventSource(e){return V(this.#n.isEmpty(),"NoteEventSource already set"),this.#n=m.wrap(e),this.#t.reset(),ee.create(()=>{this.#n=m.None,this.#t.reset()})}introduceBlock({index:e,p0:t,p1:n,flags:i}){if(!this.#n.isEmpty()){for(let o of this.#n.unwrap().processNotes(t,n,i))this.#i.push(o);this.#i.sort(Fe.Comparator).forEach(o=>{o.pitch>=0&&o.pitch<=127&&(this.#t.eventInput.add(e,o),this.#o(o))}),this.#i.length=0}}clear(){}terminate(){this.#e.terminate()}#o(e){Fe.isStart(e)?this.#r.noteOn(e.pitch):Fe.isStop(e)&&this.#r.noteOff(e.pitch)}};var vF;(e=>e.NotSet={start:()=>D("VoicingStrategy.start"),stop:()=>D("VoicingStrategy.stop"),forceStop:()=>ea,process:()=>D("VoicingStrategy.process"),reset:ea,processing:()=>U.empty()})(vF||={});var Ab=class{#e;#t=[];constructor(e=vF.NotSet){this.#e=e}set strategy(e){this.#t.push(this.#e),this.#e.forceStop(),this.#e=e}get strategy(){return this.#e}start(e){this.#e.start(e)}stop(e){this.#e.stop(e)}process(e,t,n,i){this.#e.process(e,t,n,i);for(let o=this.#t.length-1;o>=0;o--)this.#t[o].process(e,t,n,i)&&this.#t.splice(o,1)}reset(){this.#t.forEach(e=>e.reset()),this.#t.length=0,this.#e.reset()}};var _b=class{#e;#t=[];#r=[];constructor(e){this.#e=e}start(e){let t=NaN;for(let o=0;o<this.#r.length;o++){let a=this.#r[o];if(!a.gate){t=a.currentFrequency,this.#r.splice(o,1);break}}let n=this.#e.computeFrequency(e),i=this.#e.create();isNaN(t)?i.start(e,n,1,0):(i.start(e,t,1,0),i.startGlide(n,this.#e.glideTime)),this.#r.push(i),this.#t.push(i)}stop(e){this.#t.find(t=>t.id===e)?.stop()}forceStop(){this.#t.forEach(e=>e.forceStop())}reset(){this.#t.length=0,this.#r.length=0}process(e,t,n,i){e.clear(n,i);for(let o=this.#t.length-1;o>=0;o--){let a=this.#t[o];a.process(e,t,n,i)&&(U.removeIf(this.#r,s=>s===a),this.#t.splice(o,1))}return this.#t.length===0}processing(){return this.#t}};var Pb=class{#e;#t=[];#r=[];#i=null;#n=null;constructor(e){this.#e=e}start(e){if(this.#r.push(e),q(this.#i)&&this.#i.gate){this.#i.startGlide(this.#e.computeFrequency(e),this.#e.glideTime);return}let t=NaN;q(this.#n)&&(t=this.#n.currentFrequency,this.#n.forceStop());let n=this.#e.create(),i=this.#e.computeFrequency(e);isNaN(t)?n.start(e,i,1,0):(n.start(e,t,1,0),n.startGlide(i,this.#e.glideTime)),this.#i=n,this.#n=n,this.#t.push(n)}stop(e){let t=this.#r.findIndex(n=>n.id===e);if(t!==-1&&(this.#r.splice(t,1),!!q(this.#i))){if(t===this.#r.length){let n=this.#r.at(-1);if(q(n)){this.#i.startGlide(this.#e.computeFrequency(n),this.#e.glideTime);return}}this.#r.length===0&&(this.#i.stop(),this.#i=null)}}forceStop(){this.#t.forEach(e=>e.forceStop())}reset(){this.#r.length=0,this.#t.length=0,this.#i=null,this.#n=null}process(e,t,n,i){e.clear(n,i);for(let o=this.#t.length-1;o>=0;o--){let a=this.#t[o];a.process(e,t,n,i)&&(this.#t.splice(o,1),a===this.#i&&(this.#i=null),a===this.#n&&(this.#n=null))}return this.#t.length===0}processing(){return this.#t}};var Um=class{#e;#t=[];#r=new jc;#i;gate=!0;id=-1;constructor(e,t){this.#e=e,this.#i=t}get currentFrequency(){return this.#r.currentFrequency()}start(e,t,n,i){if(this.id=e.id,this.#r.init(t),this.#i===1){let o=this.#e();o.start(e,t,n,i),this.#t.push(o)}else for(let o=0;o<this.#i;++o){let a=o/(this.#i-1)*2-1,s=this.#e(),l=(1-Math.abs(i))*a+i;s.start(e,t,n/Math.sqrt(this.#i),l),this.#t.push(s)}}startGlide(e,t){this.#r.glideTo(e,t),this.#t.forEach(n=>n.startGlide(e,t))}process(e,t,n,i){this.#r.advance(t.bpm,n,i);for(let o=this.#t.length-1;o>=0;o--)this.#t[o].process(e,t,n,i)&&this.#t.splice(o,1);return this.#t.length===0}stop(){this.#t.forEach(e=>e.stop()),this.gate=!1}forceStop(){this.#t.forEach(e=>e.forceStop()),this.gate=!1}processing(){return this.#t}};var[_M,PM,yF,SM,EM,Sb,FM,BM,Eb]=YF(Float32Array,fe),jm=class{device;oscA;oscB;lfo;filter;env;glide;gainASmooth;gainBSmooth;gainVcaSmooth;#e=Gs("NoteEvent not set");#t=1;#r=1;id=-1;phase=0;filter_keyboard_delta=0;constructor(e){this.device=e,this.oscA=new qp(sampleRate),this.oscB=new qp(sampleRate),this.lfo=new Pg(sampleRate),this.filter=new vg(zo.MIN_CUTOFF,zo.MAX_CUTOFF,sampleRate),this.filter.order=1,this.env=new zc(sampleRate),this.env.set(this.device.env_attack,this.device.env_decay,this.device.env_sustain,this.device.env_release),this.env.gateOn(),this.glide=new jc,this.gainASmooth=new Pi(.003,sampleRate),this.gainBSmooth=new Pi(.003,sampleRate),this.gainVcaSmooth=new Pi(.003,sampleRate)}start(e,t,n,i){this.#e=e,this.#t=n,this.#r=i,this.filter_keyboard_delta=Sg.keyboardTracking(e.pitch,this.device.parameterFilterKeyboard.getValue()),this.glide.init(t)}stop(){this.env.gateOff()}forceStop(){this.env.forceStop()}startGlide(e,t){this.glide.glideTo(e,t)}get gate(){return this.env.gate}get currentFrequency(){return this.glide.currentFrequency()}process(e,{bpm:t},n,i){let{gainOscA:o,gainOscB:a,oscA_waveform:s,oscB_waveform:l,flt_cutoff:u,flt_resonance:p,flt_env_amount:d,flt_order:h,frequencyAMultiplier:g,frequencyBMultiplier:v,parameterLfoShape:y,parameterLfoRate:x,parameterLfoTargetTune:B,parameterLfoTargetCutoff:I,parameterLfoTargetVolume:O,parameterUnisonDetune:z,parameterUnisonStereo:$}=this.device,ie=Uc(this.#e.velocity)*this.#t,ne=2**(this.#r*(z.getValue()/1200)),le=this.#r*$.getValue(),[W,xe]=oa.panningToGains(le,xo.Linear),[se,Ee]=e.channels();yF.fill(ne,n,i),this.glide.process(yF,t,n,i),this.lfo.fill(FM,y.getValue(),x.getValue(),n,i),this.env.process(Sb,n,i);let Re=B.getValue(),st=I.getValue(),gt=O.getValue();for(let ye=n;ye<i;ye++){let ke=FM[ye];BM[ye]=u+this.filter_keyboard_delta+Sb[ye]*d+ke*st,Sb[ye]*=qi(ie+ke*gt);let lt=yF[ye]*2**(ke*Re);SM[ye]=lt*g,EM[ye]=lt*v}this.oscA.generateFromFrequencies(_M,SM,s,n,i),this.oscB.generateFromFrequencies(PM,EM,l,n,i);for(let ye=n;ye<i;ye++)Eb[ye]=_M[ye]*this.gainASmooth.process(o)+PM[ye]*this.gainBSmooth.process(a);this.filter.order=h,this.filter.process(Eb,Eb,BM,p,n,i);for(let ye=n;ye<i;ye++){let ke=this.gainVcaSmooth.process(qi(Sb[ye])),lt=Eb[ye]*ke;if(se[ye]+=lt*W,Ee[ye]+=lt*xe,this.env.complete&&ke<mg)return!0}return!1}};var Fb=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$;gainOscA=1;gainOscB=1;frequencyAMultiplier=1;frequencyBMultiplier=1;env_attack=1;env_decay=1;env_sustain=1;env_release=1;oscA_waveform=ut.sine;oscB_waveform=ut.sine;flt_cutoff=1;flt_resonance=Math.SQRT1_2;flt_env_amount=0;flt_order=1;#T=0;#N=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Ab,this.#r=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#i=new Ae,this.#n=new Bg(sampleRate),this.#o=this.own(new Be(e.broadcaster,t.address));let{box:n,namedParameter:i}=this.#e,{oscillators:o}=i;this.#a=this.own(this.bindParameter(o[0].waveform)),this.#s=this.own(this.bindParameter(o[0].octave)),this.#l=this.own(this.bindParameter(o[0].tune)),this.#c=this.own(this.bindParameter(o[0].volume)),this.#u=this.own(this.bindParameter(o[1].waveform)),this.#p=this.own(this.bindParameter(o[1].octave)),this.#d=this.own(this.bindParameter(o[1].tune)),this.#f=this.own(this.bindParameter(o[1].volume)),this.#h=this.own(this.bindParameter(i.attack)),this.#m=this.own(this.bindParameter(i.decay)),this.#g=this.own(this.bindParameter(i.sustain)),this.#v=this.own(this.bindParameter(i.release)),this.#w=this.own(this.bindParameter(i.cutoff)),this.#A=this.own(this.bindParameter(i.resonance)),this.#_=this.own(this.bindParameter(i.filterEnvelope)),this.#E=this.own(this.bindParameter(i.filterOrder)),this.#F=this.own(this.bindParameter(i.filterKeyboard)),this.#b=this.own(this.bindParameter(i.glideTime)),this.#y=this.own(this.bindParameter(i.voicingMode)),this.#x=this.own(this.bindParameter(i.unisonCount)),this.#S=this.own(this.bindParameter(i.unisonDetune)),this.#I=this.own(this.bindParameter(i.unisonStereo)),this.#M=this.own(this.bindParameter(i.lfoWaveform)),this.#k=this.own(this.bindParameter(i.lfoRate)),this.#D=this.own(this.bindParameter(i.lfoTargetTune)),this.#B=this.own(this.bindParameter(i.lfoTargetCutoff)),this.#$=this.own(this.bindParameter(i.lfoTargetVolume));let a=new Float32Array(32);this.ownAll(n.enabled.catchupAndSubscribe(s=>{this.#N=s.getValue(),this.#N||this.reset()}),e.broadcaster.broadcastFloats(t.address.append(0),a,s=>{if(!s)return;let l=0;this.#t.strategy.processing().forEach(u=>{let d=Ce(u,Um).processing().at(0);d instanceof jm&&(a[l++]=d.env.phase),a.length-1}),a[l]=-1}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing)),this.readAllParameters()}computeFrequency(e){return Kp(e.pitch+e.cent/100,440)}get glideTime(){return this.#T}get parameterFilterKeyboard(){return this.#F}get parameterLfoShape(){return this.#M}get parameterLfoRate(){return this.#k}get parameterLfoTargetTune(){return this.#D}get parameterLfoTargetCutoff(){return this.#B}get parameterLfoTargetVolume(){return this.#$}get parameterUnisonDetune(){return this.#S}get parameterUnisonStereo(){return this.#I}create(){return new Um(()=>new jm(this),this.#x.getValue())}get noteEventTarget(){return m.wrap(this)}introduceBlock(e){this.#r.introduceBlock(e)}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#o.clear(),this.#t.reset(),this.#i.clear(),this.eventInput.clear()}get uuid(){return this.#e.uuid}get audioOutput(){return this.#i}get adapter(){return this.#e}handleEvent(e){Fe.isStart(e)?this.#t.start(e):Fe.isStop(e)&&this.#t.stop(e.id)}processAudio(e,t,n){this.#N&&(this.#t.process(this.#i,e,t,n),this.#n.replace(this.#i,t,n))}parameterChanged(e){if(e===this.#c)this.gainOscA=Pe(this.#c.getValue());else if(e===this.#f)this.gainOscB=Pe(this.#f.getValue());else if(e===this.#s||e===this.#l)this.frequencyAMultiplier=2**(this.#s.getValue()+this.#l.getValue()/1200);else if(e===this.#p||e===this.#d)this.frequencyBMultiplier=2**(this.#p.getValue()+this.#d.getValue()/1200);else if(e===this.#h)this.env_attack=this.#h.getValue();else if(e===this.#m)this.env_decay=this.#m.getValue();else if(e===this.#g)this.env_sustain=this.#g.getValue();else if(e===this.#v)this.env_release=this.#v.getValue();else if(e===this.#a)this.oscA_waveform=Gi(this.#a.getValue(),ut);else if(e===this.#u)this.oscB_waveform=Gi(this.#u.getValue(),ut);else if(e===this.#w)this.flt_cutoff=this.#w.getUnitValue();else if(e===this.#A)this.flt_resonance=this.#A.getValue();else if(e===this.#_)this.flt_env_amount=this.#_.getValue();else if(e===this.#E)this.flt_order=this.#E.getValue();else if(e===this.#b)this.#T=this.#b.getValue()*J.Bar;else if(e===this.#y){let t=this.#y.getValue();switch(t){case _o.Monophonic:{this.#t.strategy=new Pb(this);return}case _o.Polyphonic:{this.#t.strategy=new _b(this);return}default:return D(`Unknown VoicingMode '${t}'`)}}}finishProcess(){this.#i.assertSanity(),this.#o.process(this.#i.getChannel(0),this.#i.getChannel(1))}toString(){return"{VaporisateurDevice}"}};var Ac=class{#e;#t;#r;#i;#n;#o;#a=0;#s;#l=0;constructor(e,t,n=0,i=0){this.#e=e,this.#t=t,this.#r=Math.round(.02*sampleRate),this.#o=n,this.#s=i,this.#o>=t.numberOfFrames?(this.#i=2,this.#n=0):n===0?(this.#i=1,this.#n=0):(this.#i=0,this.#n=1)}get readPosition(){return this.#o}done(){return this.#i===2}isFadingOut(){return this.#i===0&&this.#n<0}startFadeOut(e){this.#i!==2&&!(this.#i===0&&this.#n<0)&&(this.#i=0,this.#n=-1,this.#a=0,this.#l=e)}process(e,t,n){let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#r,d=s-p,h=this.#s,g=this.#l,v=this.#i,y=this.#n,x=this.#o,B=this.#a;for(let I=0;I<t&&v!==2;I++){if(I<h)continue;let O=e+I,z;if(v===0&&y>0)z=B/p,++B>=p&&(v=1,B=0,y=0);else if(v===0&&y<0){if(I<g)z=1;else if(z=1-B/p,++B>=p){v=2;break}}else z=1;if(x>=0&&x<s){let $=z*n[I];i[O]+=l[x]*$,o[O]+=u[x]*$}x++,v===1&&x>=d&&(v=0,y=-1,B=0)}this.#i=v,this.#n=y,this.#o=x,this.#a=B,this.#s=0,this.#l=0}};var Ks=class{#e;#t;#r;#i;#n;#o;#a=0;#s;#l;#c=0;constructor(e,t,n,i,o=0,a=0){this.#e=e,this.#t=t,this.#r=n,this.#s=i,this.#o=o,this.#l=a,this.#o>=t.numberOfFrames?(this.#i=2,this.#n=0):o===0?(this.#i=1,this.#n=0):(this.#i=0,this.#n=1)}get readPosition(){return this.#o}done(){return this.#i===2}isFadingOut(){return this.#i===0&&this.#n<0}startFadeOut(e){this.#i!==2&&!(this.#i===0&&this.#n<0)&&(this.#i=0,this.#n=-1,this.#a=0,this.#c=e)}setPlaybackRate(e){this.#s=e}process(e,t,n){let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#r,d=this.#s,h=s-p*d,g=this.#l,v=this.#c,y=this.#i,x=this.#n,B=this.#o,I=this.#a;for(let O=0;O<t&&y!==2;O++){if(O<g)continue;let z=e+O,$;if(y===0&&x>0)$=I/p,++I>=p&&(y=1,I=0,x=0);else if(y===0&&x<0){if(O<v)$=1;else if($=1-I/p,++I>=p){y=2;break}}else $=1;let ie=B|0;if(ie>=0&&ie<s-1){let ne=B-ie,le=l[ie],W=u[ie],xe=$*n[O];i[z]+=(le+ne*(l[ie+1]-le))*xe,o[z]+=(W+ne*(u[ie+1]-W))*xe}B+=d,y===1&&B>=h&&(y=0,x=-1,I=0)}this.#i=y,this.#n=x,this.#o=B,this.#a=I,this.#l=0,this.#c=0}};var Dp=class{#e;#t;#r;#i;#n;#o;#a=1;#s=0;#l=0;#c=0;#u=0;#p=0;constructor(e,t,n,i,o,a,s){this.#e=e,this.#t=t,this.#r=o,this.#o=i,this.#i=Math.round(.02*s),this.#n=1/this.#i,this.#c=n,this.#u=a,this.#p=0,n>0?(this.#a=0,this.#s=1,this.#l=0):(this.#a=1,this.#s=0,this.#l=0)}done(){return this.#a===2}isFadingOut(){return this.#a===0&&this.#s<0}readPosition(){return this.#c}segmentEnd(){return this.#o}setSegmentEnd(e){this.#o=e}startFadeOut(e){if(this.#a!==2&&!(this.#a===0&&this.#s<0)){if(this.#a===0&&this.#s>0){let t=this.#l*this.#n;this.#l=this.#i*(1-t)}else this.#l=0;this.#a=0,this.#s=-1,this.#p=e}}process(e,t,n){if(this.#a===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,d=this.#n,h=this.#r,g=this.#p,v=this.#a,y=this.#s,x=this.#l,B=this.#c;for(let I=this.#u;I<t&&v!==2;I++){let O=e+I,z;if(v===0){if(y>0)z=x*d,x+=1,x>=p&&(v=1,x=0,y=0);else if(I<g)z=1;else if(z=1-x*d,x+=1,x>=p){v=2;break}}else z=1;let $=B|0;if($>=0&&$<s-1){let ie=B-$,ne=l[$],le=u[$],W=z*n[I];i[O]+=(ne+ie*(l[$+1]-ne))*W,o[O]+=(le+ie*(u[$+1]-le))*W}B+=h}this.#a=v,this.#s=y,this.#l=x,this.#c=B,this.#u=0,this.#p=0}};var Nb=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u=1;#p=0;#d=0;#f=0;#h=0;#m=0;#g=0;#v=0;constructor(e,t,n,i,o,a,s,l){this.#e=e,this.#t=t,this.#r=o,this.#c=i;let u=.01*s,p=.02*s;this.#i=n+u,this.#n=i-p,this.#o=Math.round(.02*s),this.#a=1/this.#o,this.#s=Math.round(.01*s),this.#l=1/this.#s,this.#f=l??n,this.#g=a,this.#v=0,this.#h=0,this.#m=0,l!==void 0||n>0?(this.#u=0,this.#p=1,this.#d=0):(this.#u=1,this.#p=0,this.#d=0),this.#i>=this.#n&&(this.#u=2)}done(){return this.#u===2}isFadingOut(){return this.#u===0&&this.#p<0}readPosition(){return this.#f}segmentEnd(){return this.#c}setSegmentEnd(e){this.#c=e}startFadeOut(e){if(this.#u!==2&&!(this.#u===0&&this.#p<0)){if(this.#u===0&&this.#p>0){let t=this.#d*this.#a;this.#d=this.#o*(1-t)}else this.#d=0;this.#u=0,this.#p=-1,this.#v=e}}process(e,t,n){if(this.#u===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,h=this.#n-this.#s,g=this.#o,v=this.#a,y=this.#s,x=this.#l,B=this.#r,I=this.#v,O=this.#u,z=this.#p,$=this.#d,ie=this.#f,ne=this.#h,le=this.#m;for(let W=this.#g;W<t&&O!==2;W++){let xe=e+W,se;if(O===0){if(z>0)se=$*v,$+=1,$>=g&&(O=1,$=0,z=0);else if(W<I)se=1;else if(se=1-$*v,$+=1,$>=g){O=2;break}}else se=1;let Ee=0,Re=0,st=ie|0;if(st>=0&&st<s-1){let ye=ie-st,ke=l[st],lt=u[st];Ee=ke+ye*(l[st+1]-ke),Re=lt+ye*(u[st+1]-lt)}if(ne===0&&ie>=h&&(ne=1,le=p),ne>0){let ye=le|0;if(ye>=0&&ye<s-1){let ke=le-ye,lt=l[ye],Lr=u[ye],Wi=lt+ke*(l[ye+1]-lt),Ws=Lr+ke*(u[ye+1]-Lr),so=ne*x;Ee=Ee*(1-so)+Wi*so,Re=Re*(1-so)+Ws*so}le+=B,ne+=1,ne>=y&&(ie=le,ne=0)}let gt=se*n[W];i[xe]+=Ee*gt,o[xe]+=Re*gt,ie+=B}this.#u=O,this.#p=z,this.#d=$,this.#f=ie,this.#h=ne,this.#m=le,this.#g=0,this.#v=0}};var Lm=class{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=1;#u=0;#p=0;#d=0;#f=1;#h=0;#m=0;#g=0;#v=0;constructor(e,t,n,i,o,a,s,l){this.#e=e,this.#t=t,this.#r=o,this.#l=i;let u=.01*s,p=.02*s;this.#i=n+u,this.#n=i-p,this.#o=Math.round(.02*s),this.#a=1/this.#o,this.#s=Math.round(.01*s),this.#d=l?.position??n,this.#f=l?.direction??1,this.#g=a,this.#v=0,this.#h=0,this.#m=0,l!==void 0||n>0?(this.#c=0,this.#u=1,this.#p=0):(this.#c=1,this.#u=0,this.#p=0),this.#i>=this.#n&&(this.#c=2)}done(){return this.#c===2}isFadingOut(){return this.#c===0&&this.#u<0}readPosition(){return this.#d}segmentEnd(){return this.#l}setSegmentEnd(e){this.#l=e}startFadeOut(e){if(this.#c!==2&&!(this.#c===0&&this.#u<0)){if(this.#c===0&&this.#u>0){let t=this.#p*this.#a;this.#p=this.#o*(1-t)}else this.#p=0;this.#c=0,this.#u=-1,this.#v=e}}process(e,t,n){if(this.#c===2)return;let[i,o]=this.#e.channels(),{frames:a,numberOfFrames:s}=this.#t,l=a[0],u=a.length===1?a[0]:a[1],p=this.#i,d=this.#n,h=d-this.#s,g=p+this.#s,v=this.#o,y=this.#a,x=this.#s,B=this.#r,I=this.#v,O=this.#c,z=this.#u,$=this.#p,ie=this.#d,ne=this.#f,le=this.#h,W=this.#m;for(let xe=this.#g;xe<t&&O!==2;xe++){let se=e+xe,Ee;if(O===0){if(z>0)Ee=$*y,$+=1,$>=v&&(O=1,$=0,z=0);else if(xe<I)Ee=1;else if(Ee=1-$*y,$+=1,$>=v){O=2;break}}else Ee=1;let Re=0,st=0,gt=ie|0;if(gt>=0&&gt<s-1){let ke=ie-gt,lt=l[gt],Lr=u[gt];Re=lt+ke*(l[gt+1]-lt),st=Lr+ke*(u[gt+1]-Lr)}if(le===0&&(ne>0&&ie>=h?(le=1,W=d):ne<0&&ie<=g&&(le=1,W=p)),le>0){let ke=W|0;if(ke>=0&&ke<s-1){let lt=W-ke,Lr=l[ke],Wi=u[ke],Ws=Lr+lt*(l[ke+1]-Lr),so=Wi+lt*(u[ke+1]-Wi),Ec=le/x,Fn=Math.cos(Ec*Math.PI*.5),Mt=Math.sin(Ec*Math.PI*.5);Re=Re*Fn+Ws*Mt,st=st*Fn+so*Mt}W-=ne*B,le+=1,le>=x&&(ie=W,ne=-ne,le=0)}let ye=Ee*n[xe];i[se]+=Re*ye,o[se]+=st*ye,ie+=ne*B}this.#c=O,this.#u=z,this.#p=$,this.#d=ie,this.#f=ne,this.#h=le,this.#m=W,this.#g=0,this.#v=0}};var Ib=class{#e=[];#t=-1;#r=0;constructor(){}get voiceCount(){return this.#e.length}reset(){for(let e of this.#e)e.startFadeOut(0);this.#t=-1,this.#r=0}process(e,t,n,i,o,a,s,l){let{p0:u,p1:p,bpm:d,flags:h}=a,g=i.warpMarkers,v=i.transientPlayMode,y=i.playbackRate,{sampleRate:x,numberOfFrames:B}=t,I=B/x;St.some(h,2)&&this.reset();let O=p-u,z=a.s0,ie=a.s1-z,ne=(s.resultStart-u)/O,le=(s.resultEnd-u)/O,W=z+ie*ne|0,se=(z+ie*le|0)-W,Ee=g.first(),Re=g.last();if(!Ct(Ee)||!Ct(Re))return;let st=s.resultStart-s.rawStart;if(st<Ee.position||st>=Re.position)return;let gt=st+O,ye=this.#o(gt,g);if(!Ct(ye))return;let ke=ye+o;if(ke<0||ke>=I)return;let lt=this.#o(st,g)??0,Lr=ye-lt,Wi=O/(960*d/60),Ws=Wi>0?Lr/Wi:1,so=.02*Ws*y*(t.sampleRate/x),Ec=ke+so,Fn=n.floorLastIndex(Ec);if(Fn<this.#t&&this.reset(),Fn>this.#t&&Fn>=0){let Mt=n.optAt(Fn);Ct(Mt)&&(this.#i(e,t,n,g,v,y,o,d,x,Fn,Mt.position),this.#t=Fn)}for(let Mt of this.#e){if(!(Mt instanceof Dp)||Mt.done()||Mt.isFadingOut())continue;let Bn=Mt.readPosition(),Fc=Mt.segmentEnd();if(Bn>=Fc){Mt.startFadeOut(0);continue}if(v!==qa.Once){let Bc=this.#n(n,this.#t,t);if(Ct(Bc)){let{startSamples:qm,endSamples:Nc,hasNext:$0,nextTransientFileSeconds:Hm}=Bc,lo=Nc-qm,Tp=Number.POSITIVE_INFINITY;if($0){let Yo=n.optAt(this.#t);if(Ct(Yo)){let kF=Yo.position-o,T0=this.#a(kF,g),Qm=Hm-o,R0=this.#a(Qm,g)-T0;Tp=J.pulsesToSeconds(R0,d)*x}}let Jm=Tp*y,Rp=lo/Jm;if(!(Rp>=.99&&Rp<=1.01)&&Jm>lo){Mt.startFadeOut(0);let Yo=this.#s(e,t,qm,Nc,y,0,x,v,!0,Bn);Ct(Yo)&&this.#e.push(Yo);continue}}}let Da=(Fc-Bn)/y;if(Da<se){let Bc=Math.max(0,Math.floor(Da));Mt.startFadeOut(Bc)}}for(let Mt of this.#e)Mt.process(W,se,l);for(let Mt=this.#e.length-1;Mt>=0;Mt--)this.#e[Mt].done()&&this.#e.splice(Mt,1)}#i(e,t,n,i,o,a,s,l,u,p,d){let h=this.#n(n,p,t);if(!Ct(h))return;let{startSamples:g,endSamples:v,hasNext:y,nextTransientFileSeconds:x}=h,B=v-g,I=Number.POSITIVE_INFINITY;if(y){let Re=d-s,st=this.#a(Re,i),gt=x-s,ke=this.#a(gt,i)-st;I=J.pulsesToSeconds(ke,l)*u}let O=.02*u,z=.02*t.sampleRate*a,$=null;for(let Re of this.#e){if(Re.done()||!(Re instanceof Dp))continue;let gt=Re.readPosition()+z-g;if(!(Math.abs(gt)>=O)){this.#r+=gt,Math.abs(this.#r)<O?($=Re,Re.setSegmentEnd(v)):this.#r=0;break}}if(Ct($)){for(let Re of this.#e)Re!==$&&!Re.done()&&Re.startFadeOut(0);return}for(let Re of this.#e)Re.done()||Re.startFadeOut(0);let ie=I*a,ne=B/ie,W=!(ne>=.99&&ne<=1.01)&&ie>B,xe=.02*t.sampleRate*a,se=p===0?g:Math.max(0,g-xe),Ee=this.#s(e,t,se,v,a,0,u,o,W);Ct(Ee)&&this.#e.push(Ee),this.#r=0}#n(e,t,n){let i=e.optAt(t);if(!Ct(i))return null;let o=e.optAt(t+1);return{startSamples:i.position*n.sampleRate,endSamples:Ct(o)?o.position*n.sampleRate:n.numberOfFrames,hasNext:Ct(o),nextTransientFileSeconds:Ct(o)?o.position:Number.POSITIVE_INFINITY}}#o(e,t){for(let n=0;n<t.length()-1;n++){let i=t.optAt(n),o=t.optAt(n+1);if(!(!Ct(i)||!Ct(o))&&e>=i.position&&e<o.position){let a=(e-i.position)/(o.position-i.position);return i.seconds+a*(o.seconds-i.seconds)}}return null}#a(e,t){for(let i=0;i<t.length()-1;i++){let o=t.optAt(i),a=t.optAt(i+1);if(!(!Ct(o)||!Ct(a))&&e>=o.seconds&&e<a.seconds){let s=(e-o.seconds)/(a.seconds-o.seconds);return o.position+s*(a.position-o.position)}}let n=t.last();return Ct(n)&&e>=n.seconds?n.position:0}#s(e,t,n,i,o,a,s,l,u,p){return n>=i?null:l===qa.Once||!u?new Dp(e,t,n,i,o,a,s):l===qa.Repeat?new Nb(e,t,n,i,o,a,s,p):q(p)?new Lm(e,t,n,i,o,a,s,{position:p,direction:1}):new Lm(e,t,n,i,o,a,s)}};var Db=class extends gr{#e;#t;#r;#i;#n=new Float32Array(fe);#o=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Ae(2),this.#r=this.own(new Be(e.broadcaster,t.address)),this.#i=b.newSet(({adapter:{uuid:n}})=>n),this.ownAll(this.#e.box.enabled.catchupAndSubscribe(n=>{this.#o=n.getValue(),this.#o||this.reset()}),this.#e.deviceHost().audioUnitBoxAdapter().tracks.catchupAndSubscribe({onAdd:n=>this.#i.add({adapter:n,voices:[],sequencer:new Ib}),onRemove:n=>this.#i.removeByKey(n.uuid),onReorder:n=>{}}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this.outgoing))}get noteEventTarget(){return m.None}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}get audioOutput(){return this.#t}reset(){this.#r.clear(),this.#t.clear(),this.eventInput.clear(),this.#i.forEach(e=>{e.voices=[],e.sequencer.reset()})}process({blocks:e}){if(!this.#o)return;this.#t.clear(0,fe),this.#i.forEach(i=>e.forEach(o=>this.#a(i,o))),this.#t.assertSanity();let[t,n]=this.#t.channels();this.#r.process(t,n)}parameterChanged(e){}#a(e,t){let{adapter:n}=e;if(n.type!==me.Audio||!n.enabled.getValue()){e.voices.forEach(l=>l.startFadeOut(0)),e.sequencer.reset();return}let{p0:i,p1:o,flags:a}=t;if(!St.every(a,5))return;let s=this.context.clipSequencing.iterate(n.uuid,i,o);for(let{optClip:l,sectionFrom:u,sectionTo:p}of s)l.match({none:()=>{for(let d of n.regions.collection.iterateRange(i,o)){if(d.mute||!pt(d,ha))continue;let h=d.file,g=h.getOrCreateLoader().data;if(g.isEmpty())return;let v=d.waveformOffset.getValue(),y=d.asPlayModeTimeStretch;if(y.nonEmpty()){let x=h.transients;if(x.length()<2)return;for(let B of kr.locateLoops(d,i,o)){let I=y.unwrap();this.#u(e,t,B,g.unwrap(),I,x,v,d.fading,d.position,d.duration)}}else for(let x of kr.locateLoops(d,i,o))this.#s(e,t,x,d,g.unwrap())}},some:d=>{if(!pt(d,is))return;let h=d.file,g=h.getOrCreateLoader().data;if(g.isEmpty())return;let v=d.asPlayModeTimeStretch;if(v.nonEmpty()){let y=v.unwrap(),x=h.transients;if(x.length()<2)return;for(let B of kr.locateLoops({position:0,loopDuration:d.duration,loopOffset:0,complete:Number.POSITIVE_INFINITY},u,p))this.#u(e,t,B,g.unwrap(),y,x,d.waveformOffset.getValue(),null,0,d.duration)}else for(let y of kr.locateLoops({position:0,loopDuration:d.duration,loopOffset:0,complete:Number.POSITIVE_INFINITY},u,p))this.#s(e,t,y,d,g.unwrap())}})}#s(e,t,n,i,o){let{p0:a,p1:s,s0:l,s1:u,flags:p}=t,d=u-l,h=s-a,g=(n.resultStart-a)/h,v=(n.resultEnd-a)/h,y=l+d*g,x=l+d*v,B=x-y|0,I=i.waveformOffset.getValue();V(l<=y&&x<=u,()=>`Out of bounds ${y}, ${x}`),St.some(p,2)&&(e.voices.forEach(z=>z.startFadeOut(0)),e.sequencer.reset());let O=i.asPlayModePitchStretch;if(i.isPlayModeNoStretch){let $=(this.context.tempoMap.intervalToSeconds(n.rawStart,n.resultStart)+I)*o.sampleRate|0;this.#l(e,o,$,0)}else if(O.isEmpty()){let z=o.numberOfFrames,ie=(n.resultEndValue-n.resultStartValue)*z,ne=(n.resultEnd-n.resultStart)/h*d,le=ie/ne,W=n.resultStartValue*o.numberOfFrames+I*o.sampleRate;this.#c(e,o,le,W,0)}else{let $=O.unwrap().warpMarkers,ie=$.first(),ne=$.last();if(ie===null||ne===null){e.voices.forEach(Ee=>Ee.startFadeOut(0));return}let le=n.resultStart-n.rawStart;if(le<ie.position||le>=ne.position){e.voices.forEach(Ee=>Ee.startFadeOut(0));return}let W=this.#d(le,n.resultStartValue,$),xe=this.#p(le,$,o.sampleRate,h,d),se=(W+I)*o.sampleRate;this.#c(e,o,xe,se,0)}if(pt(i,ha)&&i.fading.hasFading){let z=i.position,$=i.duration,ie=n.resultStart-z,ne=n.resultEnd-z;Ca.fillGainBuffer(this.#n,ie,ne,$,B,i.fading)}else this.#n.fill(1,0,B);for(let z of e.voices)z.process(y|0,B,this.#n);e.voices=e.voices.filter(z=>!z.done())}#l(e,t,n,i){let o=Math.round(.02*t.sampleRate),a=!1;for(let s of e.voices)s instanceof Ac&&!s.isFadingOut()?Math.abs(s.readPosition-n)>o?s.startFadeOut(i):a=!0:s.startFadeOut(i);a||e.voices.push(new Ac(this.#t,t,n,i))}#c(e,t,n,i,o){let a=Math.round(.02*t.sampleRate);if(e.voices.length===0)e.voices.push(new Ks(this.#t,t,a,n,i,o));else{let s=!1;for(let l of e.voices)if(l instanceof Ks){if(l.isFadingOut())continue;Math.abs(l.readPosition-i)>a?l.startFadeOut(o):(l.setPlaybackRate(n),s=!0)}else l.startFadeOut(o);s||e.voices.push(new Ks(this.#t,t,a,n,i,o))}}#u(e,t,n,i,o,a,s,l,u,p){for(let ie of e.voices)(ie instanceof Ks||ie instanceof Ac)&&ie.startFadeOut(0);let{p0:d,p1:h,s0:g,s1:v}=t,y=v-g,x=h-d,B=(n.resultStart-d)/x,I=(n.resultEnd-d)/x,O=g+y*B,$=g+y*I-O|0;if(l!==null&&Ca.hasFading(l)){let ie=n.resultStart-u,ne=n.resultEnd-u;Ca.fillGainBuffer(this.#n,ie,ne,p,$,l)}else this.#n.fill(1,0,$);e.sequencer.process(this.#t,i,a,o,s,t,n,this.#n),e.voices=e.voices.filter(ie=>(ie instanceof Ks||ie instanceof Ac)&&!ie.done())}#p(e,t,n,i,o){let a=t.floorLastIndex(e),s=t.optAt(a),l=t.optAt(a+1);if(s===null||l===null)return 1;let u=l.position-s.position,h=(l.seconds-s.seconds)*n/u,g=o/i;return h/g}#d(e,t,n){let i=n.floorLastIndex(e),o=n.optAt(i),a=n.optAt(i+1);if(o===null||a===null)return t;let s=(e-o.position)/(a.position-o.position);return o.seconds+s*(a.seconds-o.seconds)}};var Ai=class extends gr{process({blocks:e}){e.forEach(t=>{this.introduceBlock(t);let{index:n,p0:i,p1:o,s0:a,bpm:s}=t,l=null,u=i;for(let p of this.eventInput.get(n))l?.forEach(d=>this.handleEvent(t,d)),l=null,u<p.position&&(this.processEvents(t,u,p.position),u=p.position),Vm.isOfType(p)?this.updateParameters(p.position,a/sampleRate+J.pulsesToSeconds(p.position-i,s)):(l??=[]).push(p);l?.forEach(p=>this.handleEvent(t,p)),l=null,u<o&&this.processEvents(t,u,o)}),this.eventInput.clear()}introduceBlock(e){}};var Mp;(t=>(t.create=()=>({mult:1,add:0}),t.apply=(n,i)=>i*n.mult+n.add))(Mp||={});var Mb=Object.freeze([{name:"up",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=t%a,u=Math.floor(t%s/a),p=r[l];return Fe.start(n,i,p.pitch+u*12,Mp.apply(o,p.velocity))}},{name:"down",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=a-1-t%a,u=e-1-Math.floor(t%s/a),p=r[l];return Fe.start(n,i,p.pitch+u*12,Mp.apply(o,p.velocity))}},{name:"up-down",run:(r,e,t,n,i,o)=>{let a=r.length,s=a*e,l=Math.max(1,s*2-2),u=t%l,p=u<s?u:l-u,d=p%a,h=Math.floor(p/a),g=r[d];return Fe.start(n,i,g.pitch+h*12,Mp.apply(o,g.velocity))}}]);var kb=class extends Ai{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c=Mp.create();#u=m.None;#p=Mb[0];#d=NaN;#f=1;#h=1;#m=1;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Qs,this.#i=this.own(this.bindParameter(t.namedParameter.modeIndex)),this.#n=this.own(this.bindParameter(t.namedParameter.rate)),this.#o=this.own(this.bindParameter(t.namedParameter.gate)),this.#a=this.own(this.bindParameter(t.namedParameter.repeat)),this.#s=this.own(this.bindParameter(t.namedParameter.numOctaves)),this.#l=this.own(this.bindParameter(t.namedParameter.velocity)),this.ownAll(e.registerProcessor(this)),this.readAllParameters()}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}get noteEventTarget(){return m.wrap(this)}setNoteEventSource(e){return V(this.#u.isEmpty(),"NoteEventSource already set"),this.#u=m.wrap(e),ee.create(()=>this.#u=m.None)}*processNotes(e,t,n){if(this.#r.nonEmpty())if(St.every(n,2))for(let o of this.#r.releaseAll())yield Fe.stop(o,e);else for(let o of this.#r.releaseLinearCompleted(t))yield Fe.stop(o,o.position+o.duration);if(this.#u.nonEmpty()){let i=this.#u.unwrap();for(let a of i.processNotes(e,t,n));let o=!St.every(n,1);for(let{position:a,index:s}of Oa.iterateWithIndex(e,t,this.#d)){let l=Array.from(i.iterateActiveNotesAt(a,o));if(l.length===0)continue;let u=Math.floor(s/this.#h),p=Math.max(1,Math.floor(this.#d*this.#f)),d=this.#p.run(l,this.#m,u,a,p,this.#c);this.#r.addAndRetain({...d}),yield d}for(let a of this.#r.releaseLinearCompleted(t))yield Fe.stop(a,a.position+a.duration)}}*iterateActiveNotesAt(e,t){this.#u.isEmpty()||t||(yield*this.#r.overlapping(e,$r.Comparator))}reset(){this.#t.length=0,this.#r.clear(),this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){if(e===this.#i)this.#p=Mb.at(this.#i.getValue())??Mb[0];else if(e===this.#n)this.#d=wr.toPPQN(Hn.RateFractions[this.#n.getValue()]);else if(e===this.#o)this.#f=this.#o.getValue();else if(e===this.#a)this.#h=this.#a.getValue();else if(e===this.#s)this.#m=this.#s.getValue();else if(e===this.#l){let t=this.#l.getValue();t<=0?(this.#c.add=1+t,this.#c.mult=0):(this.#c.add=1-t,this.#c.mult=t)}}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var $b=class extends Ai{#e;#t;#r;#i;#n;#o=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.#r=this.own(this.bindParameter(t.namedParameter.octaves)),this.#i=this.own(this.bindParameter(t.namedParameter.semiTones)),this.#n=this.own(this.bindParameter(t.namedParameter.cent)),this.own(e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#o.isEmpty(),"NoteEventSource already set"),this.#o=m.wrap(e),ee.create(()=>this.#o=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#o.isEmpty())for(let i of this.#o.unwrap().processNotes(e,t,n))if(Fe.isStart(i)){this.#t.noteOn(i.pitch);let{cent:o,octaves:a,semiTones:s}=this.#e.namedParameter;yield _i.overwrite(i,{pitch:i.pitch+a.valueAt(i.position)*12+s.valueAt(i.position),cent:i.cent+o.valueAt(i.position)})}else this.#t.noteOff(i.pitch),yield i}*iterateActiveNotesAt(e,t){if(!this.#o.isEmpty()){for(let n of this.#o.unwrap().iterateActiveNotesAt(e,t))if(n.type==="note-event"){let{cent:i,octaves:o,semiTones:a}=this.#e.namedParameter;yield _i.overwrite(n,{pitch:n.pitch+o.valueAt(n.position)*12+a.valueAt(n.position),cent:n.cent+i.valueAt(n.position)})}}}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var Tb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$;#T;#N;#R;#C;#O=m.None;#V=!1;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new ka,this.#o=new Float32Array(this.#n.numBins()),this.#a=U.create(()=>new vo,7),this.#s=[new Ta(4),new Ta(4)],this.#l=[new Ta(4),new Ta(4)],this.#c=[this.#l,[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],[new Jt,new Jt],this.#s],this.#u=U.create(()=>!0,7);let n=this.#t.namedParameter;this.#p=this.own(this.bindParameter(n.highPass.enabled)),this.#f=this.own(this.bindParameter(n.highPass.q)),this.#d=this.own(this.bindParameter(n.highPass.frequency)),this.#h=this.own(this.bindParameter(n.highPass.order)),this.#m=this.own(this.bindParameter(n.lowShelf.enabled)),this.#g=this.own(this.bindParameter(n.lowShelf.frequency)),this.#v=this.own(this.bindParameter(n.lowShelf.gain)),this.#w=this.own(this.bindParameter(n.lowBell.enabled)),this.#A=this.own(this.bindParameter(n.lowBell.frequency)),this.#_=this.own(this.bindParameter(n.lowBell.gain)),this.#E=this.own(this.bindParameter(n.lowBell.q)),this.#F=this.own(this.bindParameter(n.midBell.enabled)),this.#b=this.own(this.bindParameter(n.midBell.frequency)),this.#y=this.own(this.bindParameter(n.midBell.gain)),this.#x=this.own(this.bindParameter(n.midBell.q)),this.#S=this.own(this.bindParameter(n.highBell.enabled)),this.#I=this.own(this.bindParameter(n.highBell.frequency)),this.#M=this.own(this.bindParameter(n.highBell.gain)),this.#k=this.own(this.bindParameter(n.highBell.q)),this.#D=this.own(this.bindParameter(n.highShelf.enabled)),this.#B=this.own(this.bindParameter(n.highShelf.frequency)),this.#$=this.own(this.bindParameter(n.highShelf.gain)),this.#T=this.own(this.bindParameter(n.lowPass.enabled)),this.#N=this.own(this.bindParameter(n.lowPass.frequency)),this.#R=this.own(this.bindParameter(n.lowPass.q)),this.#C=this.own(this.bindParameter(n.lowPass.order)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.spectrum,this.#o,i=>{this.#V=i,i&&(this.#o.set(this.#n.bins()),this.#n.decay=!0)})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#r.clear(),this.#c.forEach(e=>e.forEach(t=>t.reset())),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#O=m.wrap(e),{terminate:()=>this.#O=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#O.isEmpty())return;let[i,o]=this.#r.channels(),a=this.#O.unwrap();if(this.#u.some(s=>s)){let[s,l]=a.channels();this.#a.forEach((u,p)=>{if(this.#u[p]){let[d,h]=this.#c[p];d.process(u,s,i,t,n),h.process(u,l,o,t,n),s=i,l=o}})}else{let[s,l]=a.channels();for(let u=t;u<n;u++)i[u]=s[u],o[u]=l[u]}this.#i.process(i,o,t,n),this.#V&&this.#n.process(i,o,t,n)}parameterChanged(e){if(e===this.#C){let n=this.#C.getValue()+1;this.#s[0].order=n,this.#s[1].order=n}else if(e===this.#h){let n=this.#h.getValue()+1;this.#l[0].order=n,this.#l[1].order=n}else if(e===this.#d||e===this.#f){let t=this.#d.getValue(),n=this.#f.getValue();this.#a[0].setHighpassParams(t/sampleRate,n)}else if(e===this.#g||e===this.#v){let t=this.#g.getValue(),n=this.#v.getValue();this.#a[1].setLowShelfParams(t/sampleRate,n)}else if(e===this.#A||e===this.#_||e===this.#E){let t=this.#A.getValue(),n=this.#_.getValue(),i=this.#E.getValue();this.#a[2].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#b||e===this.#y||e===this.#x){let t=this.#b.getValue(),n=this.#y.getValue(),i=this.#x.getValue();this.#a[3].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#I||e===this.#M||e===this.#k){let t=this.#I.getValue(),n=this.#M.getValue(),i=this.#k.getValue();this.#a[4].setPeakingParams(t/sampleRate,i,n)}else if(e===this.#B||e===this.#$){let t=this.#B.getValue(),n=this.#$.getValue();this.#a[5].setHighShelfParams(t/sampleRate,n)}else if(e===this.#N||e===this.#R){let t=this.#N.getValue(),n=this.#R.getValue();this.#a[6].setLowpassParams(t/sampleRate,n)}else e===this.#p?this.#u[0]=this.#p.getValue():e===this.#m?this.#u[1]=this.#m.getValue():e===this.#w?this.#u[2]=this.#w.getValue():e===this.#F?this.#u[3]=this.#F.getValue():e===this.#S?this.#u[4]=this.#S.getValue():e===this.#D?this.#u[5]=this.#D.getValue():e===this.#T&&(this.#u[6]=this.#T.getValue())}toString(){return`{${this.constructor.name} (${this.#e})`}};var Rb=class{roomSize;damp;predelayInSamples;wetGain;dryGain;#e=new Float32Array(2048);#t=new Float32Array(2048);#r=new Float32Array(2048);#i=new Float32Array(2048);#n=new Float32Array(2048);#o=new Float32Array(2048);#a=new Float32Array(2048);#s=new Float32Array(2048);#l=new Float32Array(1024);#c=new Float32Array(512);#u=new Float32Array(512);#p=new Float32Array(256);#d=new Float32Array(2048);#f=new Float32Array(2048);#h=new Float32Array(2048);#m=new Float32Array(2048);#g=new Float32Array(2048);#v=new Float32Array(2048);#w=new Float32Array(2048);#A=new Float32Array(2048);#_=new Float32Array(1024);#E=new Float32Array(512);#F=new Float32Array(512);#b=new Float32Array(256);#y;#x;#S=0;#I=0;#M=0;#k=0;#D=0;#B=0;#$=0;#T=0;#N=0;#R=0;#C=0;#O=0;#V=0;#W=0;#U=0;#j=0;#z=0;#L=0;#Z=0;#G=0;#q=0;#H=0;#J=0;#Q=0;#K=0;#X=0;#ee=0;#te=0;#re=0;#ie=0;#ne=0;#oe=0;#ae=0;#se=0;#le=0;#ce=0;#ue=0;#de=0;#pe=0;#he=0;#P=0;#Y=0;constructor(e=.5){this.#y=mo(Math.ceil(e*sampleRate)),this.#x=new Float32Array(this.#y<<1),this.damp=0,this.roomSize=.5,this.wetGain=.3333,this.dryGain=1-this.wetGain,this.#P=0,this.#Y=0,this.predelayInSamples=.008*sampleRate,this.clearHistory()}clear(){this.#P=0,this.#Y=0,this.clearHistory(),this.clearBuffers()}process(e,t,n,i){let[o,a]=t.channels(),[s,l]=e.channels(),u=.4*this.damp,p=1-u,d=.7+.28*this.roomSize;for(let h=n;h<i;++h){let g=o[h],v=a[h],y=this.#Y-this.predelayInSamples;y<0&&(y+=this.#y);let x;x=y<<1;let B=.01,I=this.#x[x]*B,O=this.#x[x+1]*B;x=this.#Y<<1,this.#x[x]=g,this.#x[x+1]=v,this.#Y=this.#Y+1&this.#y-1;let z=this.#P&2047;this.#S=p*this.#I+u*this.#S,this.#e[z]=I+d*this.#S,this.#I=this.#e[this.#P-1617&2047],this.#M=p*this.#k+u*this.#M,this.#t[z]=I+d*this.#M,this.#k=this.#t[this.#P-1557&2047],this.#D=p*this.#B+u*this.#D,this.#r[z]=I+d*this.#D,this.#B=this.#r[this.#P-1491&2047],this.#$=p*this.#T+u*this.#$,this.#i[z]=I+d*this.#$,this.#T=this.#i[this.#P-1422&2047],this.#N=p*this.#R+u*this.#N,this.#n[z]=I+d*this.#N,this.#R=this.#n[this.#P-1356&2047],this.#C=p*this.#O+u*this.#C,this.#o[z]=I+d*this.#C,this.#O=this.#o[this.#P-1277&2047],this.#V=p*this.#W+u*this.#V,this.#a[z]=I+d*this.#V,this.#W=this.#a[this.#P-1188&2047],this.#U=p*this.#j+u*this.#U,this.#s[z]=I+d*this.#U,this.#j=this.#s[this.#P-1116&2047];let $=this.#j+this.#W+this.#O+this.#R+this.#T+this.#B+this.#k+this.#I,ie=this.#z-$,ne=this.#L-ie,le=this.#Z-ne;this.#l[this.#P&1023]=$+.5*this.#z,this.#z=this.#l[this.#P-556&1023],this.#c[this.#P&511]=ie+.5*this.#L,this.#L=this.#c[this.#P-441&511],this.#u[this.#P&511]=ne+.5*this.#Z,this.#Z=this.#u[this.#P-341&511],this.#p[this.#P&255]=le+.5*this.#G,this.#G=this.#p[this.#P-225&255],s[h]=this.dryGain*g+this.wetGain*(this.#G-le),this.#q=p*this.#H+u*this.#q,this.#d[z]=O+d*this.#q,this.#H=this.#d[this.#P-1640&2047],this.#J=p*this.#Q+u*this.#J,this.#f[z]=O+d*this.#J,this.#Q=this.#f[this.#P-1580&2047],this.#K=p*this.#X+u*this.#K,this.#h[z]=O+d*this.#K,this.#X=this.#h[this.#P-1514&2047],this.#ee=p*this.#te+u*this.#ee,this.#m[z]=O+d*this.#ee,this.#te=this.#m[this.#P-1445&2047],this.#re=p*this.#ie+u*this.#re,this.#g[z]=O+d*this.#re,this.#ie=this.#g[this.#P-1379&2047],this.#ne=p*this.#oe+u*this.#ne,this.#v[z]=O+d*this.#ne,this.#oe=this.#v[this.#P-1300&2047],this.#ae=p*this.#se+u*this.#ae,this.#w[z]=O+d*this.#ae,this.#se=this.#w[this.#P-1211&2047],this.#le=p*this.#ce+u*this.#le,this.#A[z]=O+d*this.#le,this.#ce=this.#A[this.#P-1139&2047];let W=this.#ce+this.#se+this.#oe+this.#ie+this.#te+this.#X+this.#Q+this.#H,xe=this.#ue-W,se=this.#de-xe,Ee=this.#pe-se;this.#_[this.#P&1023]=W+.5*this.#ue,this.#ue=this.#_[this.#P-579&1023],this.#E[this.#P&511]=xe+.5*this.#de,this.#de=this.#E[this.#P-464&511],this.#F[this.#P&511]=se+.5*this.#pe,this.#pe=this.#F[this.#P-364&511],this.#b[this.#P&255]=Ee+.5*this.#he,this.#he=this.#b[this.#P-248&255],l[h]=this.dryGain*v+this.wetGain*(this.#he-Ee),this.#P++}}clearBuffers(){this.#e.fill(0),this.#t.fill(0),this.#r.fill(0),this.#i.fill(0),this.#n.fill(0),this.#o.fill(0),this.#a.fill(0),this.#s.fill(0),this.#l.fill(0),this.#c.fill(0),this.#u.fill(0),this.#p.fill(0),this.#d.fill(0),this.#f.fill(0),this.#h.fill(0),this.#m.fill(0),this.#g.fill(0),this.#v.fill(0),this.#w.fill(0),this.#A.fill(0),this.#_.fill(0),this.#E.fill(0),this.#F.fill(0),this.#b.fill(0),this.#x.fill(0)}clearHistory(){this.#S=0,this.#I=0,this.#M=0,this.#k=0,this.#D=0,this.#B=0,this.#$=0,this.#T=0,this.#N=0,this.#R=0,this.#C=0,this.#O=0,this.#V=0,this.#W=0,this.#U=0,this.#j=0,this.#z=0,this.#L=0,this.#Z=0,this.#G=0,this.#q=0,this.#H=0,this.#J=0,this.#Q=0,this.#K=0,this.#X=0,this.#ee=0,this.#te=0,this.#re=0,this.#ie=0,this.#ne=0,this.#oe=0,this.#ae=0,this.#se=0,this.#le=0,this.#ce=0,this.#ue=0,this.#de=0,this.#pe=0,this.#he=0}};var Cb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new Rb;let{decay:n,preDelay:i,damp:o,wet:a,dry:s}=this.#t.namedParameter;this.#o=this.own(this.bindParameter(n)),this.#a=this.own(this.bindParameter(i)),this.#s=this.own(this.bindParameter(o)),this.#l=this.own(this.bindParameter(a)),this.#c=this.own(this.bindParameter(s)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.clear(),this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#u=m.wrap(e),{terminate:()=>this.#u=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#u.isEmpty())return;this.#n.process(this.#r,this.#u.unwrap(),t,n);let[i,o]=this.#r.channels();this.#i.process(i,o,t,n)}parameterChanged(e){this.#o===e?this.#n.roomSize=this.#o.getValue():this.#a===e?this.#n.predelayInSamples=Math.ceil(this.#a.getValue()*sampleRate):this.#s===e?this.#n.damp=this.#s.getValue():this.#l===e?this.#n.wetGain=Pe(this.#l.getValue()):this.#c===e&&(this.#n.dryGain=Pe(this.#c.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})`}};var Ob=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s=!0;gain=1;release=1;loader=m.None;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Ae,this.#i=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#n=this.own(new Be(e.broadcaster,t.address)),this.#o=this.own(this.bindParameter(this.#e.namedParameter.volume)),this.#a=this.own(this.bindParameter(this.#e.namedParameter.release)),this.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#s=n.getValue(),this.#s||this.reset()}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),t.box.file.catchupAndSubscribe(n=>this.loader=n.targetVertex.map(({box:i})=>e.sampleManager.getOrCreate(i.address.uuid)))),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}get noteEventTarget(){return m.wrap(this)}introduceBlock(e){this.#i.introduceBlock(e)}setNoteEventSource(e){return this.#i.setNoteEventSource(e)}reset(){this.#t.length=0,this.#r.clear(),this.eventInput.clear(),this.#i.clear(),this.#n.clear()}get uuid(){return this.#e.uuid}get audioOutput(){return this.#r}get adapter(){return this.#e}handleEvent(e){Fe.isStart(e)?this.#t.push(new AF(this,e)):Fe.isStop(e)&&this.#t.find(t=>t.event().id===e.id)?.stop()}processAudio(e,t,n){if(this.#s){this.#r.clear(t,n);for(let i=this.#t.length-1;i>=0;i--)this.#t[i].processAdd(this.#r,t,n)&&this.#t.splice(i,1)}}parameterChanged(e){e===this.#o?this.gain=Pe(this.#o.getValue()):e===this.#a&&(this.release=this.#a.getValue()*sampleRate)}finishProcess(){this.#r.assertSanity(),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1))}terminate(){super.terminate(),this.loader=m.None}toString(){return"{NanoDevice}"}},AF=class{#e;#t;#r=1;#i=0;#n=.003*sampleRate|0;#o=0;#a=Number.POSITIVE_INFINITY;constructor(e,t){this.#e=e,this.#t=t,this.#r=Math.pow(2,(t.pitch+t.cent/100)/12-5)}event(){return this.#t}stop(){this.#a=this.#o}processAdd(e,t,n){let i=this.#e.loader;if(i.isEmpty())return!0;let o=i.unwrap();return o.data.isEmpty()?!0:this.processSimple(e.channels(),o.data.unwrap(),t,n)}processSimple(e,t,n,i){let[o,a]=e,s=t.frames[0],l=t.frames[1]??s,u=t.numberOfFrames,p=t.sampleRate/sampleRate,d=this.#e.gain*this.#t.velocity,h=this.#e.release,g=1/h;for(let v=n;v<i;v++){let y=this.#i|0;if(y>=u-1)return!0;let x=this.#i-y,B=this.#o<this.#n?this.#o/this.#n:1,I=(Math.min(1-(this.#o-this.#a)*g,1)*B)**2,O=s[y]*(1-x)+s[y+1]*x,z=l[y]*(1-x)+l[y+1]*x;if(o[v]+=O*d*I,a[v]+=z*d*I,this.#i+=this.#r*p,++this.#o-this.#a>h)return!0}return!1}};var Vb=class extends Ai{#e;#t;#r=!0;constructor(e,t){super(e),this.#e=t,this.#t=new Qo(this,e.broadcaster,t.adapter.audioUnitBoxAdapter().address),this.own(e.registerProcessor(this)),this.readAllParameters()}setEnabled(e){this.#r=e,e||this.reset()}introduceBlock(e){this.#t.introduceBlock(e)}setNoteEventSource(e){return this.#t.setNoteEventSource(e)}reset(){this.eventInput.clear(),this.#t.clear()}processEvents(e,t,n){}handleEvent({index:e},t){this.#r&&(Fe.isStart(t)?this.#e.optSampleProcessor(t.pitch).ifSome(({eventInput:n})=>n.add(e,t)):Fe.isStop(t)&&this.#e.optSampleProcessor(t.pitch).ifSome(({eventInput:n})=>n.add(e,t)))}toString(){return"{PlayfieldSequencer}"}};var zb=class extends Ve{#e;#t;#r;#i;#n;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=this.own(new Be(e.broadcaster,t.adapter.address)),this.#i=[],this.#n=new Np,this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.adapter.address,this.#t,this.outgoing)),this.readAllParameters()}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}setAudioSource(e){return this.#i.push(e),{terminate:()=>{U.remove(this.#i,e),this.#t.clear()}}}get audioOutput(){return this.#t}get eventInput(){return this.#n}processAudio(e,t,n){}reset(){this.#r.clear()}finishProcess(){this.#t.clear();let[e,t]=this.#t.channels();for(let n of this.#i){let[i,o]=n.channels();for(let a=0;a<fe;a++)e[a]+=i[a],t[a]+=o[a]}this.#t.assertSanity(),this.#r.process(this.#t.getChannel(0),this.#t.getChannel(1))}toString(){return"{PlayfieldMixProcessor}"}};var Ub=class r{static create(e,t,n,i){return new r(e,t,n,i)}#e=new j;#t;#r;#i=[];#n=!0;constructor(e,t,n,i){this.#t=b.newSet(({device:o})=>o.uuid),this.#r=this.#e.own(new j),this.#e.ownAll(t.catchupAndSubscribe({onAdd:o=>{this.invalidateWiring();let a=Km.create(e,o.box),s=this.#t.add({device:a,subscription:a.adapter().enabledField.subscribe(()=>this.invalidateWiring())});V(s,"Could not add.")},onRemove:o=>{this.invalidateWiring();let{device:a,subscription:s}=this.#t.removeByKey(o.uuid);s.terminate(),a.terminate()},onReorder:o=>this.invalidateWiring()}),e.subscribeProcessPhase(o=>{if(o===0&&this.#n){let a=n;U.replace(this.#i,t.adapters().map(({uuid:s})=>this.#t.get(s).device));for(let s of this.#i)s.adapter().enabledField.getValue()&&(this.#r.own(s.setAudioSource(a.audioOutput)),this.#r.own(e.registerEdge(a.outgoing,s.incoming)),a=s);this.#r.own(i.setAudioSource(a.audioOutput)),this.#r.own(e.registerEdge(a.outgoing,i.incoming)),this.#n=!1}}))}invalidateWiring(){this.#r.terminate(),this.#n=!0}terminate(){this.#e.terminate(),this.#t.forEach(({device:e})=>e.terminate()),this.#t.clear(),this.#i=[]}toString(){return`{${this.constructor.name}}`}};var Wm=Math.floor(.005*sampleRate),jb=class{#e;#t;#r;#i;#n;#o;#a=0;#s=Number.POSITIVE_INFINITY;#l;#c;#u;#p;#d;#f;#h=!0;#m=!1;constructor(e,t,n,i){this.#e=e,this.#t=t,this.#i=n,this.#r=i,this.#n=e.gate,this.#o=Uc(this.#r.velocity);let{attack:o,release:a,sampleStart:s,sampleEnd:l}=this.#t;this.#l=o.getValue()*sampleRate,this.#c=a.getValue()*sampleRate,this.#u=(n.numberOfFrames-1)*s.getValue(),this.#p=(n.numberOfFrames-1)*l.getValue(),this.#d=this.#u,this.#f=0}get sample(){return this.#e}get event(){return this.#r}get position(){return this.#d}get envelope(){return this.#f}release(e=!1){this.#h&&(e?(this.#c=Wm,this.#g(),this.#h=!1):this.#n!==Zo.Off&&this.#g())}processAdd(e,t,n){let[i,o]=e,{frames:a,numberOfFrames:s}=this.#i,l=a[0],u=a[1]??l,{pitch:p}=this.#t,d=this.#p-this.#u,h=Math.sign(d),g=this.#i.sampleRate/sampleRate*h*2**(p.getValue()/1200),v=0;for(let y=t;y<n;y++){let x=this.#d|0,B=this.#d-x,I=l[x]*(1-B)+(l[x+1]??0)*B,O=u[x]*(1-B)+(u[x+1]??0)*B;if(v=Math.min(this.#a/this.#l,1-(this.#a-(this.#s+this.#l))/this.#c,1),this.#d+=g,h>0){if(this.#n===Zo.Off){if(this.#d>=s)return!0;!this.#m&&this.#d>=this.#p&&this.#g()}else if(this.#n===Zo.On){if(this.#d>=this.#p-Wm){if(this.#d>=this.#p)return!0;v*=(this.#p-this.#d)/Wm}}else if(this.#n===Zo.Loop)for(;this.#d>=this.#p;)this.#d-=d}else if(h<0){if(this.#n===Zo.Off){if(this.#d<=0)return!0;!this.#m&&this.#d<=this.#p&&this.#g()}else if(this.#n===Zo.On){if(this.#d<=this.#p+Wm){if(this.#d<=this.#p)return!0;v*=(this.#p-this.#d)/Wm}}else if(this.#n===Zo.Loop)for(;this.#d<=this.#p;)this.#d-=d}if(++this.#a-this.#s>this.#l+this.#c)return!0;v*=this.#o*v,i[y]+=I*v,o[y]+=O*v}return this.#f=v,!1}toString(){return"{PlayfieldSampleVoice}"}#g(){this.#m||(this.#m=!0,this.#s=this.#a<this.#l?this.#a-this.#l:this.#a)}};var Lb=class extends Ve{#e;#t;#r;#i;#n;#o;constructor(e,t,n,i){super(e),this.#e=t,this.#t=n,this.#r=[],this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,n.peakAddress));let{sampleStart:o,sampleEnd:a,attack:s,release:l,pitch:u}=n.namedParameter;this.#o=Object.freeze({sampleStart:this.own(this.bindParameter(o)),sampleEnd:this.own(this.bindParameter(a)),attack:this.own(this.bindParameter(s)),release:this.own(this.bindParameter(l)),pitch:this.own(this.bindParameter(u))});let p=new Float32Array(16);this.ownAll(Ub.create(e,n.audioEffects,this,i),e.broadcaster.broadcastFloats(n.address,p,d=>{if(!d)return;let h=this.#r.length<p.length?this.#r:this.#r.slice(0,p.length);h.forEach(({position:g},v)=>p[v]=g),p[h.length]=-1}),e.audioOutputBufferRegistry.register(n.address,this.#i,this.outgoing),e.registerProcessor(this)),this.readAllParameters()}get uuid(){return this.#t.uuid}get incoming(){return this}get outgoing(){return this}get audioOutput(){return this.#i}get adapter(){return this.#t}handleEvent(e){if(Fe.isStart(e)){let t=this.#t.file().flatMap(p=>p.getOrCreateLoader().data);if(t.isEmpty())return;let{mute:n,solo:i,polyphone:o,exclude:a}=this.#t.namedParameter,s=n.getValue(),l=i.getValue();if(s||this.#e.hasSolo()&&!l)return;o.getValue()||this.#r.forEach(p=>p.release(!0)),a.getValue()&&this.#e.stopExcludeOthers(this.#t),this.#r.push(new jb(this.#t,this.#o,t.unwrap(),e))}else Fe.isStop(e)&&this.#r.find(t=>t.event.id===e.id)?.release()}processAudio(e,t,n){this.#i.clear(t,n);for(let i=this.#r.length-1;i>=0;i--)this.#r[i].processAdd(this.#i.channels(),t,n)&&this.#r.splice(i,1)}forceStop(){this.#r.forEach(e=>e.release(!0))}parameterChanged(e){}reset(){this.#r.length=0,this.#i.clear(),this.#n.clear()}finishProcess(){this.#i.assertSanity(),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1))}toString(){return`{PlayfieldSampleProcessor note: ${this.#t.indexField.getValue()}}`}};var Kb=class{#e=new j;#t;#r;#i;#n;#o=!0;constructor(e,t){this.#t=t,this.#r=this.#e.own(new Vb(e,this)),this.#i=this.#e.own(new zb(e,this)),this.#n=b.newSet(n=>n.uuid),this.#e.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#o=n.getValue(),this.#r.setEnabled(this.#o),this.#o||this.#i.reset()}),t.samples.catchupAndSubscribe({onAdd:n=>{let i=new Lb(e,this,n,this.#i);this.#n.add({uuid:n.uuid,processor:i,terminable:e.registerEdge(this.#r,i)}),e.sampleManager.getOrCreate(n.fileUUID())},onRemove:n=>{let{terminable:i,processor:o}=this.#n.removeByKey(n.uuid);i.terminate(),o.terminate()},onReorder:n=>{}}),{terminate:()=>{this.#n.forEach(({terminable:n,processor:i})=>{n.terminate(),i.terminate()}),this.#n.clear()}})}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get noteEventTarget(){return m.wrap(this)}get incoming(){return this.#r}get outgoing(){return this.#i}optSampleProcessor(e){return this.#t.samples.getAdapterByIndex(e).flatMap(t=>this.#n.opt(t.uuid)).map(t=>t.processor)}hasSolo(){return this.#t.samples.adapters().some(e=>e.namedParameter.solo.getValue())}stopExcludeOthers(e){for(let t of this.#t.samples.adapters())t.exclude&&t!==e&&this.#n.opt(t.uuid).ifSome(({processor:n})=>n.forceStop())}get uuid(){return this.#t.uuid}get adapter(){return this.#t}get audioOutput(){return this.#i.audioOutput}parameterChanged(e){}terminate(){this.#e.terminate()}toString(){return"{PlayfieldDeviceProcessor}"}};var Wb=class extends Ve{#e;#t;#r;#i=fr.stereoMatrix(sampleRate);#n={gain:0,panning:0,stereo:0,invertL:!1,invertR:!1,swap:!1};#o;#a;#s;#l;#c;#u;#p=m.None;#d=xo.Linear;#f=!0;#h=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=this.own(new Be(e.broadcaster,t.address)),this.#o=this.own(this.bindParameter(t.namedParameter.volume)),this.#a=this.own(this.bindParameter(t.namedParameter.panning)),this.#s=this.own(this.bindParameter(t.namedParameter.stereo)),this.#l=this.own(this.bindParameter(t.namedParameter.invertL)),this.#c=this.own(this.bindParameter(t.namedParameter.invertR)),this.#u=this.own(this.bindParameter(t.namedParameter.swap)),this.ownAll(t.box.panningMixing.catchupAndSubscribe(n=>{this.#d=n.getValue(),this.#f=!0}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#t.clear(),this.eventInput.clear(),this.#h=!1}get uuid(){return this.#e.uuid}get audioOutput(){return this.#t}setAudioSource(e){return this.#p=m.wrap(e),{terminate:()=>this.#p=m.None}}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}processAudio(e,t,n){if(this.#p.isEmpty())return;this.#f&&(this.#i.update(this.#n,this.#d,this.#h),this.#f=!1);let i=this.#p.unwrap().channels(),o=this.#t.channels();this.#i.processFrames(i,o,t,n),this.#r.processStereo(o,t,n),this.#h=!0}parameterChanged(e){switch(e){case this.#o:this.#n.gain=Pe(this.#o.getValue()),this.#f=!0;return;case this.#a:this.#n.panning=this.#a.getValue(),this.#f=!0;return;case this.#s:this.#n.stereo=this.#s.getValue(),this.#f=!0;return;case this.#l:this.#n.invertL=this.#l.getValue(),this.#f=!0;return;case this.#c:this.#n.invertR=this.#c.getValue(),this.#f=!0;return;case this.#u:this.#n.swap=this.#u.getValue(),this.#f=!0;return}}toString(){return`{${this.constructor.name}}`}};var Zb=class extends Ai{#e;#t;#r=m.None;#i=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.ownAll(t.box.groove.catchupAndSubscribe(n=>{this.#r.ifSome(i=>i.terminate()),this.#r=m.wrap(n.targetVertex.isEmpty()?null:e.boxAdapters.adapterFor(n.targetVertex.unwrap().box,cc.checkType))}),ee.create(()=>{this.#r.ifSome(n=>n.terminate()),this.#r=m.None}),e.registerProcessor(this))}get uuid(){return this.#e.uuid}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}setNoteEventSource(e){return V(this.#i.isEmpty(),"NoteEventSource already set"),this.#i=m.wrap(e),ee.create(()=>this.#i=m.None)}*processNotes(e,t,n){if(this.#i.isEmpty())return;let i=this.#i.unwrap(),o=this.#r.mapOr(zp,Gp.Identity);for(let a of i.processNotes(o.unwarp(e),o.unwarp(t),n))Fe.isStart(a)?this.#t.noteOn(a.pitch):this.#t.noteOff(a.pitch),yield _i.overwrite(a,{position:be(o.warp(a.position),e,t)})}*iterateActiveNotesAt(e,t){if(this.#i.isEmpty())return;let n=this.#i.unwrap(),i=this.#r.mapOr(zp,Gp.Identity);for(let o of n.iterateActiveNotesAt(i.unwarp(e),t))yield _i.overwrite(o,{position:i.warp(o.position)})}reset(){this.eventInput.clear()}parameterChanged(e){}handleEvent(e,t){}processEvents(e,t,n){}};var Gb=class extends Ai{#e;#t;#r=m.None;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.own(e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#r.isEmpty(),"NoteEventSource already set"),this.#r=m.wrap(e),ee.create(()=>this.#r=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#r.isEmpty())for(let i of this.#r.unwrap().processNotes(e,t,n))yield i}*iterateActiveNotesAt(e,t){if(!this.#r.isEmpty())for(let n of this.#r.unwrap().iterateActiveNotesAt(e,t))yield n}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var qb=(r,e)=>(r[e]??r[e.toString()])?.value,$p=(r,e,t)=>qb(e,t)??qb(r,t),NM=new Float32Array(fe),Hb=class{event;sampleData;envelope;#e;rootKey;sampleRate;loopStart;loopEnd;pan;shouldLoop;playbackPosition=0;isReleasing=!1;constructor(e,t,n,i){this.event=e;let o=t.generators,a=n?.generators,s=qb(a,53)??0,l=n?.sample??i.samples[s];this.sampleData=l.data,this.rootKey=qb(a,58)??l?.header.originalPitch??60,this.sampleRate=l?.header.sampleRate??sampleRate,this.loopStart=l?.header.startLoop??0,this.loopEnd=l?.header.endLoop??this.sampleData.length;let u=$p(o,a,54)??0;this.shouldLoop=u===1||u===3,this.pan=($p(o,a,17)??0)/1e3;let p=$p(o,a,34),d=$p(o,a,36),h=$p(o,a,37),g=$p(o,a,38),v=Zs(p)?Math.pow(2,p/1200):.005,y=Zs(d)?Math.pow(2,d/1200):.005,x=1-(h??0)/1e3,B=Zs(g)?Math.pow(2,g/1200):.005;this.envelope=new zc(sampleRate),this.envelope.set(v,y,x,B),this.envelope.gateOn(),this.#e=new Pi(.003,sampleRate)}release(){this.isReleasing=!0,this.envelope.gateOff()}processAdd(e,t,n){let o=Kp(this.event.pitch+this.event.cent/100,440)/Kp(this.rootKey,440)*(this.sampleRate/sampleRate),a=Uc(this.event.velocity),s=Math.cos((this.pan+1)*Math.PI/4),l=Math.sin((this.pan+1)*Math.PI/4);this.envelope.process(NM,t,n);let u=e.getChannel(0),p=e.getChannel(1);for(let d=t;d<n;d++){let h=Math.floor(this.playbackPosition),v=this.#t(h)/32768*a*this.#e.process(NM[d]);if(u[d]+=v*s,p[d]+=v*l,this.playbackPosition+=o,this.shouldLoop)this.playbackPosition>=this.loopEnd&&this.loopEnd>this.loopStart&&(this.playbackPosition=this.loopStart+(this.playbackPosition-this.loopEnd));else if(this.playbackPosition>=this.sampleData.length-1)return!0}return this.envelope.complete&&this.#e.value<mg}#t(e){if(e>=this.sampleData.length-1)return this.sampleData[this.sampleData.length-1];let t=this.playbackPosition-e;return this.sampleData[e]*(1-t)+this.sampleData[e+1]*t}};var Jb=class extends Ve{#e;#t;#r;#i;#n;#o=m.None;#a=!0;constructor(e,t){super(e),this.#e=t,this.#t=[],this.#r=new Qo(this,e.broadcaster,t.audioUnitBoxAdapter().address),this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,t.address)),this.ownAll(t.box.enabled.catchupAndSubscribe(n=>{this.#a=n.getValue(),this.#a||this.reset()}),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing),t.box.file.catchupAndSubscribe(n=>this.#o=n.targetVertex.map(({box:i})=>e.soundfontManager.getOrCreate(i.address.uuid))))}introduceBlock(e){this.#r.introduceBlock(e)}setNoteEventSource(e){return this.#r.setNoteEventSource(e)}get noteEventTarget(){return m.wrap(this)}get incoming(){return this}get outgoing(){return this}get uuid(){return this.#e.uuid}get audioOutput(){return this.#i}get adapter(){return this.#e}reset(){this.#r.clear(),this.#n.clear(),this.#t.length=0,this.#i.clear(),this.eventInput.clear()}handleEvent(e){if(!this.#a)return;let t=this.#o.flatMap(i=>i.soundfont);if(t.isEmpty())return;let n=t.unwrap();if(Fe.isStart(e)){let i=n.presets[this.#e.presetIndex]??n.presets[0];if(ng(i)){console.warn("No preset available");return}let o=0;for(let a of i.zones){let s=Math.round(e.velocity*127);if(this.#s(e.pitch,s,a)){let l=a.instrument.zones;for(let u=0;u<l.length;u++){let p=l[u];this.#s(e.pitch,s,p)&&(this.#t.push(new Hb(e,a,p,n)),o++)}}}}else Fe.isStop(e)&&this.#t.forEach(i=>{i.event.id===e.id&&i.release()})}processAudio(e,t,n){if(this.#a){this.#i.clear(t,n);for(let i=this.#t.length-1;i>=0;i--)this.#t[i].processAdd(this.#i,t,n)&&this.#t.splice(i,1)}}finishProcess(){this.#a&&(this.#i.assertSanity(),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1)))}terminate(){super.terminate(),this.#o=m.None}toString(){return"{SoundfontDevice}"}#s(e,t,n){return this.#l(n.generators[44]?.range,t)&&this.#l(n.generators[43]?.range,e)}#l(e,t){return Ic(e)||t>=e.lo&&t<=e.hi}};var LR=.2,KR=.005,IM=-.001,Qb=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterThreshold;#o;#a;#s=new Float32Array(1);#l;#c;#u=0;#p=0;#d=0;#f=0;#h=!0;#m=!1;#g=0;#v=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address.append(1))),this.#n=this.own(new Be(e.broadcaster,t.address)),this.#l=Math.exp(-1/(sampleRate*LR)),this.#a=fr.linear(sampleRate,.01),this.#c=Math.ceil(KR*sampleRate)|0,this.#o=[new Float32Array(this.#c),new Float32Array(this.#c)];let{threshold:n}=t.namedParameter;this.parameterThreshold=this.own(this.bindParameter(n)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#s,()=>{this.#s[0]=this.#g,this.#g=0}),t.box.lookahead.catchupAndSubscribe(()=>{this.#h=t.box.lookahead.getValue(),this.#u=0,this.#p=0})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#m=!1,this.#i.clear(),this.#n.clear(),this.#r.clear(),this.eventInput.clear(),this.#u=0,this.#p=0,this.#d=0,this.#f=0,this.#o[0].fill(0),this.#o[1].fill(0),this.#g=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#v=m.wrap(e),{terminate:()=>this.#v=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#v.isEmpty())return;let i=this.#v.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1);if(this.#h){let u=this.#o,p=this.#c,d=u[0],h=u[1];for(let g=t;g<n;g++){let v=o[g],y=a[g],x=Math.max(Math.abs(v),Math.abs(y));x>this.#d?(this.#d=x,this.#f=this.#c):this.#f>0?this.#f--:this.#d=x,this.#p<this.#d?this.#p=Math.min(this.#d,this.#p+this.#d/this.#c):this.#p=this.#d+this.#l*(this.#p-this.#d);let B=this.#a.moveAndGet(),I=Math.min(0,B-yo(this.#p)),O=Pe(I)*Pe(IM-B),z=d[this.#u]*O,$=h[this.#u]*O;s[g]=be(z,-1,1),l[g]=be($,-1,1),d[this.#u]=v,h[this.#u]=y,this.#u=(this.#u+1)%p,I<this.#g&&(this.#g=I)}}else for(let u=t;u<n;u++){let p=o[u],d=a[u],h=Math.max(Math.abs(p),Math.abs(d));h>this.#d?(this.#d=h,this.#f=this.#c):this.#f>0?this.#f--:this.#d=h,this.#p<this.#d?this.#p=Math.min(this.#d,this.#p+this.#d/this.#c):this.#p=this.#d+this.#l*(this.#p-this.#d);let g=this.#a.moveAndGet(),v=Math.min(0,g-yo(this.#p)),y=Pe(v)*Pe(IM-g),x=p*y,B=d*y;s[u]=x,l[u]=B,v<this.#g&&(this.#g=v)}this.#i.process(o,a,t,n),this.#n.process(s,l,t,n),this.#m=!0}parameterChanged(e){e===this.parameterThreshold&&this.#a.set(this.parameterThreshold.getValue(),this.#m)}toString(){return`{${this.constructor.name} (${this.#e})}`}};var DM=r=>r>0?20*Math.log10(r):-100,MM=r=>Math.pow(10,r*.05);var Yb=class{#e=.08;#t=1;#r;#i;#n=0;#o=.14;#a=0;#s=.14;#l=0;#c=0;#u=0;constructor(e){this.#r=Math.exp(-1/(e*.2)),this.#i=1-this.#r}process(e,t,n){this.#l===0&&(this.#l=e[0]),this.#c===0&&(this.#c=e[0]),this.#a=0,this.#s=0;for(let o=t;o<n;++o){let a=e[o]*e[o];this.#l=Math.max(a,this.#r*this.#l+this.#i*a),this.#c=this.#r*this.#c+this.#i*a;let s=this.#l/this.#c;this.#u=s>0?s:0,this.#u>0&&(this.#n=2*(this.#e/this.#u),this.#o=2*(this.#t/this.#u)-this.#n,this.#a+=this.#n,this.#s+=this.#o)}let i=n-t;this.#a/=i,this.#s/=i}getAvgAttack(){return this.#a}getAvgRelease(){return this.#s}};var Xb=class{#e=[];#t;#r;#i;#n=0;constructor(e,t,n,i){this.#i=i,this.#r=Math.floor(e*t),this.#t=n+this.#r;for(let o=0;o<i;o++)this.#e[o]=new Float32Array(this.#t);this.#n=0}process(e,t,n){if(this.#r===0)return;let i=(this.#n-this.#r+this.#t)%this.#t;for(let o=0;o<this.#i;o++){let a=e.getChannel(o),s=this.#n,l=i;for(let u=t;u<n;u++){let p=this.#e[o][l];this.#e[o][s]=a[u],a[u]=p,s=(s+1)%this.#t,l=(l+1)%this.#t}}this.#n=(this.#n+(n-t))%this.#t}};var e0=class{#e=-20;#t=2;#r=6;#i=3;#n=-.5;setThreshold(e){this.#e=e}setRatio(e){this.#t!==e&&(this.#t=e,this.#t>23.9&&(this.#t=-1/0),this.#n=1/e-1)}setKnee(e){e!==this.#r&&(this.#r=e,this.#i=e/2)}applyCompression(e){let t=e-this.#e;return t<=-this.#i?0:t>-this.#i&&t<=this.#i?.5*this.#n*((t+this.#i)*(t+this.#i))/this.#r:this.#n*t}applyCompressionToBuffer(e,t,n){for(let i=t;i<n;++i){let o=Math.max(Math.abs(e[i]),1e-6),a=DM(o);e[i]=this.applyCompression(a)}}};var _c=class{#e;#t=1;#r=0;#i=0;#n=!0;constructor(e){this.#e=e,this.#t=1,this.#r=1-this.#t}process(e){this.#n&&(this.#i=e,this.#n=!1),this.#i=this.#t*e+this.#r*this.#i}setAlpha(e){this.#t=e,this.#r=1-this.#t}setAlphaWithTime(e){this.#t=Math.exp(-1/(this.#e*e)),this.#r=1-this.#t}getState(){return this.#i}};var t0=class{#e;#t;#r;#i;#n=.01;#o=0;#a=.14;#s=0;#l=0;#c=0;#u=!1;#p=!1;constructor(e){this.#e=e,this.#t=new Yb(e),this.#r=new _c(e),this.#i=new _c(e),this.#o=Math.exp(-1/(e*this.#n)),this.#s=Math.exp(-1/(e*this.#a)),this.#l=0,this.#c=0}setAttack(e){e!==this.#n&&(this.#n=e,this.#o=Math.exp(-1/(this.#e*this.#n)))}setRelease(e){e!==this.#a&&(this.#a=e,this.#s=Math.exp(-1/(this.#e*this.#a)))}setAutoAttack(e){this.#u=e}setAutoRelease(e){this.#p=e}#d(e){return e<this.#l?this.#l=this.#o*this.#l+(1-this.#o)*e:this.#l=this.#s*this.#l+(1-this.#s)*e,this.#l}applyBallistics(e,t,n){for(let i=t;i<n;++i)e[i]=this.#d(e[i])}processCrestFactor(e,t,n){(this.#u||this.#p)&&(this.#t.process(e,t,n),this.#r.process(this.#t.getAvgAttack()),this.#i.process(this.#t.getAvgRelease()),this.#u&&this.setAttack(this.#r.getState()),this.#p&&this.setRelease(this.#i.getState()))}};var r0=class{#e;#t;#r;#i=0;#n=0;constructor(e,t,n){this.#t=Math.floor(e*t),this.#r=n+this.#t,this.#e=new Float32Array(this.#r),this.#i=0}process(e,t,n){this.#o(e,t,n),this.#s(),this.#a(e,t,n)}#o(e,t,n){for(let i=t;i<n;i++)this.#e[this.#i]=e[i],this.#i=(this.#i+1)%this.#r;this.#n=n-t}#a(e,t,n){let i=this.#i-this.#n-this.#t;i<0&&(i+=this.#r);for(let o=t;o<n;o++)e[o]=this.#e[i],i=(i+1)%this.#r}#s(){let e=this.#i-1;e<0&&(e+=this.#r);let t=0,n=0;for(let o=0;o<this.#n;o++){let a=this.#e[e];a>t?(this.#e[e]=t,t+=n):(n=-a/this.#t,t=a+n),e=e-1,e<0&&(e+=this.#r)}let i=!1;for(let o=0;o<this.#t&&!i;o++){if(this.#e[e]>t)this.#e[e]=t,t+=n;else{i=!0;break}e=e-1,e<0&&(e+=this.#r)}}};var i0=class r extends Ve{static PEAK_DECAY_PER_SAMPLE=Math.exp(-1/(sampleRate*.5));static ID=0;#e=r.ID++;#t;parameterLookahead;parameterAutomakeup;parameterAutoattack;parameterAutorelease;parameterInputgain;parameterThreshold;parameterRatio;parameterKnee;parameterAttack;parameterRelease;parameterMakeup;parameterMix;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p=.005;#d;#f;#h=new j;#m=m.None;#g=m.None;#v=!1;#w=!1;#A=!1;#_=!1;#E=!1;#F=-10;#b=2;#y=6;#x=2;#S=140;#I=0;#M=1;#k=0;#D=0;#B=0;#$=0;#T=!1;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#d=new Float32Array([Number.NEGATIVE_INFINITY,0,Number.NEGATIVE_INFINITY]),this.#f=fr.linear(sampleRate);let{lookahead:n,automakeup:i,autoattack:o,autorelease:a,inputgain:s,threshold:l,ratio:u,knee:p,attack:d,release:h,makeup:g,mix:v}=t.namedParameter;this.parameterLookahead=this.own(this.bindParameter(n)),this.parameterAutomakeup=this.own(this.bindParameter(i)),this.parameterAutoattack=this.own(this.bindParameter(o)),this.parameterAutorelease=this.own(this.bindParameter(a)),this.parameterInputgain=this.own(this.bindParameter(s)),this.parameterThreshold=this.own(this.bindParameter(l)),this.parameterRatio=this.own(this.bindParameter(u)),this.parameterKnee=this.own(this.bindParameter(p)),this.parameterAttack=this.own(this.bindParameter(d)),this.parameterRelease=this.own(this.bindParameter(h)),this.parameterMakeup=this.own(this.bindParameter(g)),this.parameterMix=this.own(this.bindParameter(v)),this.#n=new t0(sampleRate),this.#o=new e0,this.#a=new Xb(sampleRate,.005,fe,2),this.#s=new r0(sampleRate,this.#p,fe),this.#l=new _c(sampleRate),this.#l.setAlpha(.03),this.#c=new Float32Array(fe),this.#u=[new Float32Array(fe),new Float32Array(fe)],this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#d,y=>{this.#d[0]=yo(this.#D),this.#d[1]=this.#$,this.#d[2]=yo(this.#B)}),t.sideChain.catchupAndSubscribe(()=>{this.#h.terminate(),this.#g=m.None,this.#v=!0}),e.subscribeProcessPhase(y=>{y===0&&this.#v&&(this.#v=!1,t.sideChain.targetVertex.map(({box:x})=>x.address).ifSome(x=>{e.audioOutputBufferRegistry.resolve(x).ifSome(B=>{this.#g=m.wrap(B.buffer),this.#h.own(e.registerEdge(B.processor,this.incoming))})}))}),this.#h),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#T=!1,this.#r.clear(),this.#i.clear(),this.eventInput.clear(),this.#c.fill(0),this.#u[0].fill(0),this.#u[1].fill(0),this.#k=0,this.#D=0,this.#B=0,this.#$=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#m=m.wrap(e),{terminate:()=>this.#m=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#m.isEmpty())return;let i=this.#m.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1);for(let u=t;u<n;u++){let p=this.#f.moveAndGet();s[u]=o[u]*p,l[u]=a[u]*p}if(this.#c.fill(0,t,n),this.#g.nonEmpty()){let u=this.#g.unwrap(),p=u.getChannel(0),d=u.getChannel(1);for(let h=t;h<n;h++)this.#c[h]=Math.max(Math.abs(p[h]),Math.abs(d[h]))}else for(let u=t;u<n;u++)this.#c[u]=Math.max(Math.abs(s[u]),Math.abs(l[u]));for(let u=t;u<n;u++){let p=this.#c[u];this.#D<=p?this.#D=p:this.#D*=r.PEAK_DECAY_PER_SAMPLE}this.#n.processCrestFactor(this.#c,t,n),this.#o.applyCompressionToBuffer(this.#c,t,n),this.#n.applyBallistics(this.#c,t,n),this.#$=this.#c[n-1],this.#k=this.#N(this.#c,t,n),this.#w&&(this.#a.process(this.#r,t,n),this.#s.process(this.#c,t,n));for(let u=t;u<n;u++)this.#c[u]=MM(this.#c[u]+this.#I+this.#k);for(let u=t;u<n;u++)this.#u[0][u]=s[u],this.#u[1][u]=l[u];for(let u=t;u<n;u++)s[u]*=this.#c[u],l[u]*=this.#c[u];for(let u=t;u<n;u++){let p=s[u]*this.#M+this.#u[0][u]*(1-this.#M),d=l[u]*this.#M+this.#u[1][u]*(1-this.#M),h=Math.max(Math.abs(p),Math.abs(d));this.#B<=h?this.#B=h:this.#B*=r.PEAK_DECAY_PER_SAMPLE,s[u]=p,l[u]=d}this.#i.process(s,l,t,n),this.#T=!0}#N(e,t,n){let i=0;for(let o=t;o<n;o++)i+=e[o];return this.#l.process(-i/(n-t)),this.#A?this.#l.getState():0}parameterChanged(e){e===this.parameterLookahead?this.#w=this.parameterLookahead.getValue():e===this.parameterAutomakeup?this.#A=this.parameterAutomakeup.getValue():e===this.parameterAutoattack?(this.#_=this.parameterAutoattack.getValue(),this.#n.setAutoAttack(this.#_),this.#_||this.#n.setAttack(this.#x*.001)):e===this.parameterAutorelease?(this.#E=this.parameterAutorelease.getValue(),this.#n.setAutoRelease(this.#E),this.#E||this.#n.setRelease(this.#S*.001)):e===this.parameterInputgain?this.#f.set(Pe(this.parameterInputgain.getValue()),this.#T):e===this.parameterThreshold?(this.#F=this.parameterThreshold.getValue(),this.#o.setThreshold(this.#F)):e===this.parameterRatio?(this.#b=this.parameterRatio.getValue(),this.#o.setRatio(this.#b)):e===this.parameterKnee?(this.#y=this.parameterKnee.getValue(),this.#o.setKnee(this.#y)):e===this.parameterAttack?(this.#x=this.parameterAttack.getValue(),this.#_||this.#n.setAttack(this.#x*.001)):e===this.parameterRelease?(this.#S=this.parameterRelease.getValue(),this.#E||this.#n.setRelease(this.#S*.001)):e===this.parameterMakeup?this.#I=this.parameterMakeup.getValue():e===this.parameterMix&&(this.#M=this.parameterMix.getValue())}toString(){return`{${this.constructor.name} (${this.#e})}`}};var n0=class r extends Ve{static PEAK_DECAY_PER_SAMPLE=Math.exp(-1/(sampleRate*.01));static ID=0;#e=r.ID++;#t;parameterInverse;parameterThreshold;parameterReturn;parameterAttack;parameterHold;parameterRelease;parameterFloor;#r;#i;#n;#o=new j;#a=m.None;#s=m.None;#l=!1;#c=!1;#u=-40;#p=6;#d=.5;#f=50;#h=100;#m=-80;#g=Pe(-40);#v=Pe(-46);#w=Pe(-80);#A=0;#_=0;#E=0;#F=0;#b=0;#y=!1;#x=0;#S=0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new Float32Array([Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY]);let{inverse:n,threshold:i,return:o,attack:a,hold:s,release:l,floor:u}=t.namedParameter;this.parameterInverse=this.own(this.bindParameter(n)),this.parameterThreshold=this.own(this.bindParameter(i)),this.parameterReturn=this.own(this.bindParameter(o)),this.parameterAttack=this.own(this.bindParameter(a)),this.parameterHold=this.own(this.bindParameter(s)),this.parameterRelease=this.own(this.bindParameter(l)),this.parameterFloor=this.own(this.bindParameter(u)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),e.broadcaster.broadcastFloats(t.address.append(0),this.#n,p=>{this.#n[0]=yo(this.#x),this.#n[1]=yo(this.#S),this.#n[2]=yo(this.#F)}),t.sideChain.catchupAndSubscribe(()=>{this.#o.terminate(),this.#s=m.None,this.#l=!0}),e.subscribeProcessPhase(p=>{p===0&&this.#l&&(this.#l=!1,t.sideChain.targetVertex.map(({box:d})=>d.address).ifSome(d=>{e.audioOutputBufferRegistry.resolve(d).ifSome(h=>{this.#s=m.wrap(h.buffer),this.#o.own(e.registerEdge(h.processor,this.incoming))})}))}),this.#o),this.readAllParameters(),this.#I()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.clear(),this.#i.clear(),this.eventInput.clear(),this.#F=0,this.#b=0,this.#y=!1,this.#x=0,this.#S=0}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#a=m.wrap(e),{terminate:()=>this.#a=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#a.isEmpty())return;let i=this.#a.unwrap(),o=i.getChannel(0),a=i.getChannel(1),s=this.#r.getChannel(0),l=this.#r.getChannel(1),u=this.#s.nonEmpty(),p=u?this.#s.unwrap().getChannel(0):o,d=u?this.#s.unwrap().getChannel(1):a;for(let h=t;h<n;h++){let g=Math.max(Math.abs(p[h]),Math.abs(d[h]));this.#x<=g?this.#x=g:this.#x*=r.PEAK_DECAY_PER_SAMPLE,this.#x>=this.#g?(this.#y=!0,this.#b=this.#A):this.#y&&this.#b>0?this.#b--:this.#x<this.#v&&(this.#y=!1);let v=this.#c!==this.#y?1:0;v>this.#F?this.#F=this.#_*this.#F+(1-this.#_)*v:this.#F=this.#E*this.#F+(1-this.#E)*v;let y=this.#w+(1-this.#w)*this.#F,x=o[h]*y,B=a[h]*y;s[h]=x,l[h]=B;let I=Math.max(Math.abs(x),Math.abs(B));this.#S<=I?this.#S=I:this.#S*=r.PEAK_DECAY_PER_SAMPLE}this.#i.process(s,l,t,n)}parameterChanged(e){e===this.parameterInverse?this.#c=this.parameterInverse.getValue():e===this.parameterThreshold?(this.#u=this.parameterThreshold.getValue(),this.#g=Pe(this.#u),this.#v=Pe(this.#u-this.#p)):e===this.parameterReturn?(this.#p=this.parameterReturn.getValue(),this.#v=Pe(this.#u-this.#p)):e===this.parameterAttack?(this.#d=this.parameterAttack.getValue(),this.#I()):e===this.parameterHold?(this.#f=this.parameterHold.getValue(),this.#A=Math.round(this.#f*.001*sampleRate)|0):e===this.parameterRelease?(this.#h=this.parameterRelease.getValue(),this.#I()):e===this.parameterFloor&&(this.#m=this.parameterFloor.getValue(),this.#w=Pe(this.#m))}#I(){let e=this.#d*.001,t=this.#h*.001;this.#_=Math.exp(-1/(sampleRate*e)),this.#E=Math.exp(-1/(sampleRate*t)),this.#A=Math.round(this.#f*.001*sampleRate)|0}toString(){return`{${this.constructor.name} (${this.#e})}`}};var o0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterCrusherRate;parameterBitDepth;parameterBoost;parameterMix;#o=m.None;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=new yg(sampleRate),this.#n=this.own(new Be(e.broadcaster,t.address));let{crush:n,bits:i,boost:o,mix:a}=t.namedParameter;this.parameterCrusherRate=this.own(this.bindParameter(n)),this.parameterBitDepth=this.own(this.bindParameter(i)),this.parameterBoost=this.own(this.bindParameter(o)),this.parameterMix=this.own(this.bindParameter(a)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#i.reset(),this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#o.isEmpty())return;let i=this.#o.unwrap();this.#i.process(i.channels(),this.#r.channels(),t,n),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1),t,n)}parameterChanged(e){e===this.parameterCrusherRate?this.#i.setCrush(1-this.parameterCrusherRate.getValue()):e===this.parameterBitDepth?this.#i.setBitDepth(this.parameterBitDepth.getValue()):e===this.parameterBoost?this.#i.setBoost(this.parameterBoost.getValue()):e===this.parameterMix&&this.#i.setMix(this.parameterMix.getValue())}toString(){return`{${this.constructor.name} (${this.#e})`}};var WR=[2,4,8],kM=8,a0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;parameterDrive;parameterVolume;#o=m.None;#a=!1;#s;#l;#c;#u;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=[new Float32Array(fe*kM),new Float32Array(fe*kM)],this.#n=this.own(new Be(e.broadcaster,t.address));let{drive:n,volume:i}=t.namedParameter;this.parameterDrive=this.own(this.bindParameter(n)),this.parameterVolume=this.own(this.bindParameter(i)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing),t.box.overSampling.catchupAndSubscribe(o=>{let a=WR[o.getValue()];this.#s=new Fg(a),this.#c=fr.linear(sampleRate*a),this.#c.set(Pe(this.parameterDrive.getValue()),this.#a),this.#u=fr.linear(sampleRate*a),this.#u.set(Pe(this.parameterVolume.getValue()),this.#a),this.#l=a})),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){console.debug("reset"),this.#a=!1,this.#n.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio(e,t,n){if(this.#o.isEmpty())return;this.#s.upsample(this.#o.unwrap().channels(),this.#i,t,n);let i=(n-t)*this.#l,[o,a]=this.#i;for(let s=0;s<i;s++){let l=this.#u.moveAndGet(),u=this.#c.moveAndGet();o[s]=rA(o[s]*u)*l,a[s]=rA(a[s]*u)*l}this.#s.downsample(this.#i,this.#r.channels(),t,n),this.#n.process(this.#r.getChannel(0),this.#r.getChannel(1),t,n),this.#a=!0}parameterChanged(e){e===this.parameterDrive?this.#c.set(Pe(this.parameterDrive.getValue()),this.#a):e===this.parameterVolume&&this.#u.set(Pe(this.parameterVolume.getValue()),this.#a)}toString(){return`{${this.constructor.name} (${this.#e})`}};var s0=class extends Ve{#e;#t;#r=[];#i;#n;#o=!0;#a=m.None;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#i=[];let{midiDevice:n,box:i,parameters:o}=t;this.#n=i.channel.getValue(),this.ownAll(i.enabled.catchupAndSubscribe(a=>{this.#o=a.getValue(),this.#o||this.reset()}),i.parameters.pointerHub.catchupAndSubscribe({onAdded:({box:a})=>this.#i.push(this.bindParameter(o.parameterAt(Ce(a,Rn).value.address))),onRemoved:({box:a})=>U.removeIf(this.#i,s=>s.address===Ce(a,Rn).value.address)}),i.channel.subscribe(a=>{n.ifSome(s=>this.#r.forEach(l=>e.sendMIDIData(s.id.getValue(),Nt.noteOff(this.#n,l),s.delayInMs.getValue()))),this.#r.length=0,this.#n=a.getValue()}),e.registerProcessor(this)),this.readAllParameters()}get noteEventTarget(){return m.wrap(this)}introduceBlock({p0:e,p1:t,s0:n,flags:i,bpm:o}){if(this.#a.isEmpty()||!this.#o)return;let{box:{channel:a,device:s}}=this.#e,l=s.targetVertex.match({none:()=>m.None,some:({box:p})=>m.wrap(Ce(p,Tn))}),u=l.mapOr(p=>p.delayInMs.getValue(),0);for(let p of this.#a.unwrap().processNotes(e,t,i))if(p.pitch>=0&&p.pitch<=127){let d=n/sampleRate,h=J.pulsesToSeconds(p.position-e,o),g=(d+h)*1e3+u,v=a.getValue();if(Fe.isStart(p)){let y=Math.round(p.velocity*127);this.#r.push(p.pitch),l.ifSome(x=>this.context.sendMIDIData(x.id.getValue(),Nt.noteOn(v,p.pitch,y),g))}else if(Fe.isStop(p)){let y=this.#r.indexOf(p.pitch);y>-1&&this.#r.splice(y,1),l.ifSome(x=>this.context.sendMIDIData(x.id.getValue(),Nt.noteOff(v,p.pitch),g))}}}setNoteEventSource(e){return this.#a=m.wrap(e),ee.create(()=>this.#a=m.None)}get incoming(){return this}get outgoing(){return this}reset(){}get uuid(){return this.#e.uuid}get audioOutput(){return this.#t}get adapter(){return this.#e}handleEvent(e){}processAudio(e,t,n){}parameterChanged(e,t=0){let{box:{channel:n,device:i}}=this.#e;if(i.isEmpty()||!this.#o)return;let{id:o,delayInMs:a}=Ce(i.targetVertex.unwrap().box,Tn),s=t*1e3*a.getValue(),l=Ce(e.adapter.field.box,Rn).controller.getValue(),u=Math.round(e.getValue()*127),p=Nt.control(n.getValue(),l,u);this.context.sendMIDIData(o.getValue(),p,s)}finishProcess(){}toString(){return"{MIDIOutputDeviceProcessor}"}};var l0=class extends Ai{#e;#t;#r;#i=m.None;#n;constructor(e,t){super(e),this.#e=t,this.#t=this.own(new Pn(e.broadcaster,t.address)),this.#r=new Int32Array(1024),this.#n=0;let{magnetPosition:n,magnetStrength:i,randomSeed:o,randomAmount:a,offset:s,mix:l}=t.namedParameter;this.ownAll(this.bindParameter(n),this.bindParameter(i),this.bindParameter(o),this.bindParameter(a),this.bindParameter(s),this.bindParameter(l),e.broadcaster.broadcastIntegers(t.address.append(0),this.#r,u=>{this.#r[this.#n]=0,this.#n=0}),e.registerProcessor(this)),this.readAllParameters()}setNoteEventSource(e){return V(this.#i.isEmpty(),"NoteEventSource already set"),this.#i=m.wrap(e),ee.create(()=>this.#i=m.None)}get uuid(){return this.#e.uuid}get incoming(){return this}get outgoing(){return this}*processNotes(e,t,n){if(!this.#i.isEmpty())for(let i of this.#i.unwrap().processNotes(e,t,n))if(Fe.isStart(i)){this.#t.noteOn(i.pitch);let o=this.#e.computeVelocity(i.position,i.velocity);this.#r[this.#n++]=Math.round(i.velocity*127)|Math.round(o*127)<<8|65536,yield _i.overwrite(i,{velocity:o})}else this.#t.noteOff(i.pitch),yield i}*iterateActiveNotesAt(e,t){if(!this.#i.isEmpty())for(let n of this.#i.unwrap().iterateActiveNotesAt(e,t))n.type==="note-event"&&(yield _i.overwrite(n,{velocity:this.#e.computeVelocity(n.position,n.velocity)}))}reset(){this.eventInput.clear()}processEvents(e,t,n){}parameterChanged(e){}handleEvent(e,t){}index(){return this.#e.indexField.getValue()}adapter(){return this.#e}};var c0=class r extends Ve{static ID=0;#e=r.ID++;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f=m.None;#h=!0;#m=0;constructor(e,t){super(e),this.#t=t,this.#r=new Ae,this.#i=this.own(new Be(e.broadcaster,t.address)),this.#n=new xg,this.#o=new Pi(.003,sampleRate),this.#a=new Pi(.003,sampleRate);let{rate:n,depth:i,slope:o,symmetry:a,offset:s,channelOffset:l}=t.namedParameter;this.#s=this.bindParameter(n),this.#l=this.bindParameter(i),this.#c=this.bindParameter(o),this.#u=this.bindParameter(a),this.#p=this.bindParameter(s),this.#d=this.bindParameter(l),this.ownAll(e.broadcaster.broadcastFloat(t.address.append(0),()=>this.#m),e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#r,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#m=0,this.#h=!0,this.#i.clear(),this.#r.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#r}setAudioSource(e){return this.#f=m.wrap(e),{terminate:()=>this.#f=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}processAudio({p0:e,bpm:t,flags:n},i,o){if(this.#f.isEmpty())return;let a=this.#f.unwrap(),[s,l]=a.channels(),[u,p]=this.#r.channels();this.#h&&(this.#n.set(this.#l.getValue(),this.#c.getValue(),this.#u.getValue()),this.#h=!1);let{RateFractions:d}=ro,h=J.samplesToPulses(1,t,sampleRate),v=1/wr.toPPQN(d[this.#s.getValue()]),y=this.#p.getValue()/360,x=y+this.#d.getValue()/360;for(let B=i;B<o;B++){let I=(e+B*h)*v+y,O=(e+B*h)*v+x;u[B]=s[B]*this.#o.process(this.#n.compute(I-Math.floor(I))),p[B]=l[B]*this.#a.process(this.#n.compute(O-Math.floor(O)))}this.#i.process(u,p),St.every(n,5)&&(this.#m=(e+(o-i)*h)*v)}parameterChanged(e){(e===this.#l||e===this.#c||e===this.#u)&&(this.#h=!0)}toString(){return`{${this.constructor.name} (${this.#e})`}};var u0=class{#e;#t=[];#r;#i;#n;#o=0;#a=0;#s=0;#l=0;#c=0;#u=0;#p=.9999;#d=.75;#f=.625;#h=.5;#m=.7;#g=.5;#v=.005;#w=.5;#A=.7;#_=.3;#E=.6;constructor(e){this.#e=e,this.#n=e+1,this.#r=new Float32Array(this.#n),[.004771345,.003595309,.012734787,.009307483,.022579886,.149625349,.060481839,.1249958,.030509727,.141695508,.089244313,.106280031].forEach(i=>this.#F(i));let n=[.008937872,.099929438,.064278754,.067067639,.066866033,.006283391,.035818689,.011861161,.121870905,.041262054,.08981553,.070931756,.011256342,.004065724];this.#i=Int16Array.from(n,i=>Math.round(i*e))}#F(e){let t=Math.round(e*this.#e),n=2**Math.ceil(Math.log2(t));this.#t.push([new Float32Array(n),t-1,0,n-1])}#b(e,t){return this.#t[e][0][this.#t[e][1]]=t}#y(e){return this.#t[e][0][this.#t[e][2]]}#x(e,t){let n=this.#t[e];return n[0][n[2]+t&n[3]]}#S(e,t){let n=this.#t[e],i=t-~~t,o=~~t+n[2]-1,a=n[3],s=n[0][o++&a],l=n[0][o++&a],u=n[0][o++&a],p=n[0][o&a],d=(3*(l-u)-s+p)*.5,h=2*u+s-(5*l+p)*.5,g=(u-s)*.5;return((d*i+h)*i+g)*i+l}set preDelayMs(e){this.#u=Math.floor(e/1e3*this.#e)}set bandwidth(e){this.#p=e*.9999}set inputDiffusion1(e){this.#d=e}set inputDiffusion2(e){this.#f=e}set decay(e){this.#h=e}set decayDiffusion1(e){this.#m=e*.999999}set decayDiffusion2(e){this.#g=e*.999999}set damping(e){this.#v=e}set excursionRate(e){this.#w=e*2}set excursionDepth(e){this.#A=e*2}set wetGain(e){this.#_=e}set dryGain(e){this.#E=e}reset(){this.#r.fill(0),this.#t.forEach(e=>e[0].fill(0)),this.#o=0,this.#a=0,this.#s=0,this.#l=0,this.#c=0}process(e,t,n,i){let o=this.#u,a=this.#p,s=this.#d,l=this.#f,u=this.#h,p=this.#m,d=this.#g,h=1-this.#v,g=this.#w/this.#e,v=this.#A*this.#e/1e3,y=this.#_*.6,x=this.#E,B=e[0],I=e[1],O=t[0],z=t[1];for(let $=n;$<i;$++){let ie=B[$],ne=I[$];this.#r[this.#o]=(ie+ne)*.5,O[$]=ie*x,z[$]=ne*x;let le=this.#r[(this.#n+this.#o-o)%this.#n];this.#a+=a*(le-this.#a);let W=this.#b(0,this.#a-s*this.#y(0));W=this.#b(1,s*(W-this.#y(1))+this.#y(0)),W=this.#b(2,s*W+this.#y(1)-l*this.#y(2)),W=this.#b(3,l*(W-this.#y(3))+this.#y(2));let xe=l*W+this.#y(3),se=v*(1+Math.cos(this.#c*6.28)),Ee=v*(1+Math.sin(this.#c*6.2847)),Re=this.#b(4,xe+u*this.#y(11)+p*this.#S(4,se));this.#b(5,this.#S(4,se)-p*Re),this.#s+=h*(this.#y(5)-this.#s),Re=this.#b(6,u*this.#s-d*this.#y(6)),this.#b(7,this.#y(6)+d*Re),Re=this.#b(8,xe+u*this.#y(7)+p*this.#S(8,Ee)),this.#b(9,this.#S(8,Ee)-p*Re),this.#l+=h*(this.#y(9)-this.#l),Re=this.#b(10,u*this.#l-d*this.#y(10)),this.#b(11,this.#y(10)+d*Re);let st=this.#x(9,this.#i[0])+this.#x(9,this.#i[1])-this.#x(10,this.#i[2])+this.#x(11,this.#i[3])-this.#x(5,this.#i[4])-this.#x(6,this.#i[5])-this.#x(7,this.#i[6]),gt=this.#x(5,this.#i[7])+this.#x(5,this.#i[8])-this.#x(6,this.#i[9])+this.#x(7,this.#i[10])-this.#x(9,this.#i[11])-this.#x(10,this.#i[12])-this.#x(11,this.#i[13]);O[$]+=st*y,z[$]+=gt*y,this.#c+=g,this.#o=(this.#o+1)%this.#n;for(let ye=0;ye<this.#t.length;ye++){let ke=this.#t[ye];ke[1]=ke[1]+1&ke[3],ke[2]=ke[2]+1&ke[3]}}}};var d0=class r extends Ve{static ID=0;#e=r.ID++;#t;parameterPreDelay;parameterBandwidth;parameterInputDiffusion1;parameterInputDiffusion2;parameterDecay;parameterDecayDiffusion1;parameterDecayDiffusion2;parameterDamping;parameterExcursionRate;parameterExcursionDepth;parameterWet;parameterDry;#r;#i;#n;#o=m.None;constructor(e,t){super(e),this.#t=t,this.#i=new Ae,this.#n=this.own(new Be(e.broadcaster,t.address)),this.#r=new u0(sampleRate);let{preDelay:n,bandwidth:i,inputDiffusion1:o,inputDiffusion2:a,decay:s,decayDiffusion1:l,decayDiffusion2:u,damping:p,excursionRate:d,excursionDepth:h,wet:g,dry:v}=t.namedParameter;this.parameterPreDelay=this.own(this.bindParameter(n)),this.parameterBandwidth=this.own(this.bindParameter(i)),this.parameterInputDiffusion1=this.own(this.bindParameter(o)),this.parameterInputDiffusion2=this.own(this.bindParameter(a)),this.parameterDecay=this.own(this.bindParameter(s)),this.parameterDecayDiffusion1=this.own(this.bindParameter(l)),this.parameterDecayDiffusion2=this.own(this.bindParameter(u)),this.parameterDamping=this.own(this.bindParameter(p)),this.parameterExcursionRate=this.own(this.bindParameter(d)),this.parameterExcursionDepth=this.own(this.bindParameter(h)),this.parameterWet=this.own(this.bindParameter(g)),this.parameterDry=this.own(this.bindParameter(v)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#i,this.outgoing)),this.readAllParameters()}get incoming(){return this}get outgoing(){return this}reset(){this.#r.reset(),this.#i.clear(),this.#n.clear(),this.eventInput.clear()}get uuid(){return this.#t.uuid}get audioOutput(){return this.#i}setAudioSource(e){return this.#o=m.wrap(e),{terminate:()=>this.#o=m.None}}index(){return this.#t.indexField.getValue()}adapter(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#o.isEmpty())return;let i=this.#o.unwrap();this.#r.process(i.channels(),this.#i.channels(),t,n),this.#n.process(this.#i.getChannel(0),this.#i.getChannel(1),t,n)}parameterChanged(e){e===this.parameterPreDelay?this.#r.preDelayMs=this.parameterPreDelay.getValue():e===this.parameterBandwidth?this.#r.bandwidth=this.parameterBandwidth.getValue():e===this.parameterInputDiffusion1?this.#r.inputDiffusion1=this.parameterInputDiffusion1.getValue():e===this.parameterInputDiffusion2?this.#r.inputDiffusion2=this.parameterInputDiffusion2.getValue():e===this.parameterDecay?this.#r.decay=this.parameterDecay.getValue():e===this.parameterDecayDiffusion1?this.#r.decayDiffusion1=this.parameterDecayDiffusion1.getValue():e===this.parameterDecayDiffusion2?this.#r.decayDiffusion2=this.parameterDecayDiffusion2.getValue():e===this.parameterDamping?this.#r.damping=this.parameterDamping.getValue():e===this.parameterExcursionRate?this.#r.excursionRate=this.parameterExcursionRate.getValue():e===this.parameterExcursionDepth?this.#r.excursionDepth=this.parameterExcursionDepth.getValue():e===this.parameterWet?this.#r.wetGain=Pe(this.parameterWet.getValue()):e===this.parameterDry&&(this.#r.dryGain=Pe(this.parameterDry.getValue()))}toString(){return`{${this.constructor.name} (${this.#e})}`}};var p0=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},tt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},It,Pc,Sc,Zm,Gm=class r{constructor(e,t=128){if(It.set(this,void 0),Pc.set(this,void 0),Sc.set(this,void 0),Zm.set(this,void 0),p0(this,It,e,"f"),p0(this,Zm,t,"f"),p0(this,Pc,e._malloc(t*4),"f"),p0(this,Sc,e._malloc(t*4),"f"),tt(this,Pc,"f")===0||tt(this,Sc,"f")===0)throw new Error("Failed to allocate audio buffers")}static async create(e,t=128){let n=await e();return new r(n,t)}static fromModule(e,t=128){return new r(e,t)}dispose(){tt(this,It,"f")._free(tt(this,Pc,"f")),tt(this,It,"f")._free(tt(this,Sc,"f"))}createInstance(){return tt(this,It,"f")._nam_createInstance()}destroyInstance(e){tt(this,It,"f")._nam_destroyInstance(e)}getInstanceCount(){return tt(this,It,"f")._nam_getInstanceCount()}loadModel(e,t){let n=tt(this,It,"f").lengthBytesUTF8(t)+1,i=tt(this,It,"f")._malloc(n);if(i===0)return!1;try{return tt(this,It,"f").stringToUTF8(t,i,n),tt(this,It,"f")._nam_loadModel(e,i)}finally{tt(this,It,"f")._free(i)}}unloadModel(e){tt(this,It,"f")._nam_unloadModel(e)}hasModel(e){return tt(this,It,"f")._nam_hasModel(e)}process(e,t,n){let i=Math.min(t.length,n.length,tt(this,Zm,"f")),o=tt(this,Pc,"f")>>2,a=tt(this,Sc,"f")>>2;tt(this,It,"f").HEAPF32.set(t.subarray(0,i),o),tt(this,It,"f")._nam_process(e,tt(this,Pc,"f"),tt(this,Sc,"f"),i),n.set(tt(this,It,"f").HEAPF32.subarray(a,a+i))}processInPlace(e,t){this.process(e,t,t)}setSampleRate(e){tt(this,It,"f")._nam_setSampleRate(e)}getSampleRate(){return tt(this,It,"f")._nam_getSampleRate()}setMaxBufferSize(e){tt(this,It,"f")._nam_setMaxBufferSize(e)}getMaxBufferSize(){return tt(this,It,"f")._nam_getMaxBufferSize()}getModelLoudness(e){return tt(this,It,"f")._nam_getModelLoudness(e)}hasModelLoudness(e){return tt(this,It,"f")._nam_hasModelLoudness(e)}reset(e){tt(this,It,"f")._nam_reset(e)}get bufferSize(){return tt(this,Zm,"f")}};It=new WeakMap,Pc=new WeakMap,Sc=new WeakMap,Zm=new WeakMap;var _F;(function(r){r.parse=e=>JSON.parse(e)})(_F||(_F={}));var ZR=(()=>{var r=import.meta.url;return function(e={}){var t=e,n,i;t.ready=new Promise((F,R)=>{n=F,i=R});var o=Object.assign({},t),a=[],s="./this.program",l=(F,R)=>{throw R},u=typeof window=="object",p=typeof importScripts=="function",d=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function g(F){return t.locateFile?t.locateFile(F,h):h+F}var v,y,x;(u||p)&&(p?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h.indexOf("blob:")!==0?h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):h="",v=F=>{var R=new XMLHttpRequest;return R.open("GET",F,!1),R.send(null),R.responseText},p&&(x=F=>{var R=new XMLHttpRequest;return R.open("GET",F,!1),R.responseType="arraybuffer",R.send(null),new Uint8Array(R.response)}),y=(F,R,L)=>{var te=new XMLHttpRequest;te.open("GET",F,!0),te.responseType="arraybuffer",te.onload=()=>{if(te.status==200||te.status==0&&te.response){R(te.response);return}L()},te.onerror=L,te.send(null)});var B=t.print||console.log.bind(console),I=t.printErr||console.error.bind(console);Object.assign(t,o),o=null,t.arguments&&(a=t.arguments),t.thisProgram&&(s=t.thisProgram),t.quit&&(l=t.quit);var O;t.wasmBinary&&(O=t.wasmBinary),typeof WebAssembly!="object"&&Nc("no native wasm support detected");var z,$=!1,ie,ne,le,W,xe,se,Ee,Re,st;function gt(){var F=z.buffer;t.HEAP8=ne=new Int8Array(F),t.HEAP16=W=new Int16Array(F),t.HEAPU8=le=new Uint8Array(F),t.HEAPU16=xe=new Uint16Array(F),t.HEAP32=se=new Int32Array(F),t.HEAPU32=Ee=new Uint32Array(F),t.HEAPF32=Re=new Float32Array(F),t.HEAPF64=st=new Float64Array(F)}var ye=[],ke=[],lt=[],Lr=!1;function Wi(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Ec(t.preRun.shift());Yo(ye)}function Ws(){Lr=!0,Yo(ke)}function so(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Mt(t.postRun.shift());Yo(lt)}function Ec(F){ye.unshift(F)}function Fn(F){ke.unshift(F)}function Mt(F){lt.unshift(F)}var Bn=0,Fc=null,Da=null;function Bc(F){Bn++,t.monitorRunDependencies?.(Bn)}function qm(F){if(Bn--,t.monitorRunDependencies?.(Bn),Bn==0&&(Fc!==null&&(clearInterval(Fc),Fc=null),Da)){var R=Da;Da=null,R()}}function Nc(F){t.onAbort?.(F),F="Aborted("+F+")",I(F),$=!0,ie=1,F+=". Build with -sASSERTIONS for more info.";var R=new WebAssembly.RuntimeError(F);throw i(R),R}var $0="data:application/octet-stream;base64,",Hm=F=>F.startsWith($0),lo;t.locateFile?(lo="nam.wasm",Hm(lo)||(lo=g(lo))):lo=new URL("nam.wasm",import.meta.url).href;function Tp(F){if(F==lo&&O)return new Uint8Array(O);if(x)return x(F);throw"both async and sync fetching of the wasm failed"}function Jm(F){return!O&&(u||p)&&typeof fetch=="function"?fetch(F,{credentials:"same-origin"}).then(R=>{if(!R.ok)throw"failed to load wasm binary file at '"+F+"'";return R.arrayBuffer()}).catch(()=>Tp(F)):Promise.resolve().then(()=>Tp(F))}function Rp(F,R,L){return Jm(F).then(te=>WebAssembly.instantiate(te,R)).then(te=>te).then(L,te=>{I(`failed to asynchronously prepare wasm: ${te}`),Nc(te)})}function DF(F,R,L,te){return!F&&typeof WebAssembly.instantiateStreaming=="function"&&!Hm(R)&&typeof fetch=="function"?fetch(R,{credentials:"same-origin"}).then(Je=>{var nt=WebAssembly.instantiateStreaming(Je,L);return nt.then(te,function(Ge){return I(`wasm streaming compile failed: ${Ge}`),I("falling back to ArrayBuffer instantiation"),Rp(R,L,te)})}):Rp(R,L,te)}function MF(){var F={a:JM};function R(te,Je){return vt=te.exports,z=vt.h,gt(),Fn(vt.i),qm("wasm-instantiate"),vt}Bc("wasm-instantiate");function L(te){R(te.instance)}if(t.instantiateWasm)try{return t.instantiateWasm(F,R)}catch(te){I(`Module.instantiateWasm callback failed with error: ${te}`),i(te)}return DF(O,lo,F,L).catch(i),{}}var Yo=F=>{for(;F.length>0;)F.shift()(t)},kF=t.noExitRuntime||!0;function T0(F){this.excPtr=F,this.ptr=F-24,this.set_type=function(R){Ee[this.ptr+4>>2]=R},this.get_type=function(){return Ee[this.ptr+4>>2]},this.set_destructor=function(R){Ee[this.ptr+8>>2]=R},this.get_destructor=function(){return Ee[this.ptr+8>>2]},this.set_caught=function(R){R=R?1:0,ne[this.ptr+12>>0]=R},this.get_caught=function(){return ne[this.ptr+12>>0]!=0},this.set_rethrown=function(R){R=R?1:0,ne[this.ptr+13>>0]=R},this.get_rethrown=function(){return ne[this.ptr+13>>0]!=0},this.init=function(R,L){this.set_adjusted_ptr(0),this.set_type(R),this.set_destructor(L)},this.set_adjusted_ptr=function(R){Ee[this.ptr+16>>2]=R},this.get_adjusted_ptr=function(){return Ee[this.ptr+16>>2]},this.get_exception_ptr=function(){var R=ZF(this.get_type());if(R)return Ee[this.excPtr>>2];var L=this.get_adjusted_ptr();return L!==0?L:this.excPtr}}var Qm=0,$F=0,R0=(F,R,L)=>{var te=new T0(F);throw te.init(R,L),Qm=F,$F++,Qm},TF=()=>{Nc("")},$M=(F,R,L)=>le.copyWithin(F,R,R+L),TM=()=>536870912,RM=F=>{var R=z.buffer,L=(F-R.byteLength+65535)/65536;try{return z.grow(L),gt(),1}catch{}},CM=F=>{var R=le.length;F>>>=0;var L=TM();if(F>L)return!1;for(var te=(hr,ni)=>hr+(ni-hr%ni)%ni,Je=1;Je<=4;Je*=2){var nt=R*(1+.2/Je);nt=Math.min(nt,F+100663296);var Ge=Math.min(L,te(Math.max(F,nt),65536)),dt=RM(Ge);if(dt)return!0}return!1},C0={},OM=()=>s||"./this.program",Cp=()=>{if(!Cp.strings){var F=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",R={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:F,_:OM()};for(var L in C0)C0[L]===void 0?delete R[L]:R[L]=C0[L];var te=[];for(var L in R)te.push(`${L}=${R[L]}`);Cp.strings=te}return Cp.strings},VM=(F,R)=>{for(var L=0;L<F.length;++L)ne[R++>>0]=F.charCodeAt(L);ne[R>>0]=0},RF=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,zM=(F,R,L)=>{for(var te=R+L,Je=R;F[Je]&&!(Je>=te);)++Je;if(Je-R>16&&F.buffer&&RF)return RF.decode(F.subarray(R,Je));for(var nt="";R<Je;){var Ge=F[R++];if(!(Ge&128)){nt+=String.fromCharCode(Ge);continue}var dt=F[R++]&63;if((Ge&224)==192){nt+=String.fromCharCode((Ge&31)<<6|dt);continue}var hr=F[R++]&63;if((Ge&240)==224?Ge=(Ge&15)<<12|dt<<6|hr:Ge=(Ge&7)<<18|dt<<12|hr<<6|F[R++]&63,Ge<65536)nt+=String.fromCharCode(Ge);else{var ni=Ge-65536;nt+=String.fromCharCode(55296|ni>>10,56320|ni&1023)}}return nt},Ym=(F,R)=>F?zM(le,F,R):"",O0={varargs:void 0,get(){var F=se[+O0.varargs>>2];return O0.varargs+=4,F},getp(){return O0.get()},getStr(F){var R=Ym(F);return R}},UM=(F,R)=>{var L=0;return Cp().forEach((te,Je)=>{var nt=R+L;Ee[F+Je*4>>2]=nt,VM(te,nt),L+=te.length+1}),0},jM=(F,R)=>{var L=Cp();Ee[F>>2]=L.length;var te=0;return L.forEach(Je=>te+=Je.length+1),Ee[R>>2]=te,0},Xm=F=>F%4===0&&(F%100!==0||F%400===0),LM=(F,R)=>{for(var L=0,te=0;te<=R;L+=F[te++]);return L},CF=[31,29,31,30,31,30,31,31,30,31,30,31],OF=[31,28,31,30,31,30,31,31,30,31,30,31],KM=(F,R)=>{for(var L=new Date(F.getTime());R>0;){var te=Xm(L.getFullYear()),Je=L.getMonth(),nt=(te?CF:OF)[Je];if(R>nt-L.getDate())R-=nt-L.getDate()+1,L.setDate(1),Je<11?L.setMonth(Je+1):(L.setMonth(0),L.setFullYear(L.getFullYear()+1));else return L.setDate(L.getDate()+R),L}return L},V0=F=>{for(var R=0,L=0;L<F.length;++L){var te=F.charCodeAt(L);te<=127?R++:te<=2047?R+=2:te>=55296&&te<=57343?(R+=4,++L):R+=3}return R},VF=(F,R,L,te)=>{if(!(te>0))return 0;for(var Je=L,nt=L+te-1,Ge=0;Ge<F.length;++Ge){var dt=F.charCodeAt(Ge);if(dt>=55296&&dt<=57343){var hr=F.charCodeAt(++Ge);dt=65536+((dt&1023)<<10)|hr&1023}if(dt<=127){if(L>=nt)break;R[L++]=dt}else if(dt<=2047){if(L+1>=nt)break;R[L++]=192|dt>>6,R[L++]=128|dt&63}else if(dt<=65535){if(L+2>=nt)break;R[L++]=224|dt>>12,R[L++]=128|dt>>6&63,R[L++]=128|dt&63}else{if(L+3>=nt)break;R[L++]=240|dt>>18,R[L++]=128|dt>>12&63,R[L++]=128|dt>>6&63,R[L++]=128|dt&63}}return R[L]=0,L-Je};function WM(F,R,L){var te=L>0?L:V0(F)+1,Je=new Array(te),nt=VF(F,Je,0,Je.length);return R&&(Je.length=nt),Je}var zF=(F,R)=>{ne.set(F,R)},ZM=(F,R,L,te)=>{var Je=Ee[te+40>>2],nt={tm_sec:se[te>>2],tm_min:se[te+4>>2],tm_hour:se[te+8>>2],tm_mday:se[te+12>>2],tm_mon:se[te+16>>2],tm_year:se[te+20>>2],tm_wday:se[te+24>>2],tm_yday:se[te+28>>2],tm_isdst:se[te+32>>2],tm_gmtoff:se[te+36>>2],tm_zone:Je?Ym(Je):""},Ge=Ym(L),dt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var hr in dt)Ge=Ge.replace(new RegExp(hr,"g"),dt[hr]);var ni=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],co=["January","February","March","April","May","June","July","August","September","October","November","December"];function Op(Q,$e,Zi){for(var oi=typeof Q=="number"?Q.toString():Q||"";oi.length<$e;)oi=Zi[0]+oi;return oi}function Kr(Q,$e){return Op(Q,$e,"0")}function tg(Q,$e){function Zi(rg){return rg<0?-1:rg>0?1:0}var oi;return(oi=Zi(Q.getFullYear()-$e.getFullYear()))===0&&(oi=Zi(Q.getMonth()-$e.getMonth()))===0&&(oi=Zi(Q.getDate()-$e.getDate())),oi}function Dr(Q){switch(Q.getDay()){case 0:return new Date(Q.getFullYear()-1,11,29);case 1:return Q;case 2:return new Date(Q.getFullYear(),0,3);case 3:return new Date(Q.getFullYear(),0,2);case 4:return new Date(Q.getFullYear(),0,1);case 5:return new Date(Q.getFullYear()-1,11,31);case 6:return new Date(Q.getFullYear()-1,11,30)}}function Ma(Q){var $e=KM(new Date(Q.tm_year+1900,0,1),Q.tm_yday),Zi=new Date($e.getFullYear(),0,4),oi=new Date($e.getFullYear()+1,0,4),rg=Dr(Zi),gk=Dr(oi);return tg(rg,$e)<=0?tg(gk,$e)<=0?$e.getFullYear()+1:$e.getFullYear():$e.getFullYear()-1}var qF={"%a":Q=>ni[Q.tm_wday].substring(0,3),"%A":Q=>ni[Q.tm_wday],"%b":Q=>co[Q.tm_mon].substring(0,3),"%B":Q=>co[Q.tm_mon],"%C":Q=>{var $e=Q.tm_year+1900;return Kr($e/100|0,2)},"%d":Q=>Kr(Q.tm_mday,2),"%e":Q=>Op(Q.tm_mday,2," "),"%g":Q=>Ma(Q).toString().substring(2),"%G":Q=>Ma(Q),"%H":Q=>Kr(Q.tm_hour,2),"%I":Q=>{var $e=Q.tm_hour;return $e==0?$e=12:$e>12&&($e-=12),Kr($e,2)},"%j":Q=>Kr(Q.tm_mday+LM(Xm(Q.tm_year+1900)?CF:OF,Q.tm_mon-1),3),"%m":Q=>Kr(Q.tm_mon+1,2),"%M":Q=>Kr(Q.tm_min,2),"%n":()=>`
43
+ `,"%p":Q=>Q.tm_hour>=0&&Q.tm_hour<12?"AM":"PM","%S":Q=>Kr(Q.tm_sec,2),"%t":()=>" ","%u":Q=>Q.tm_wday||7,"%U":Q=>{var $e=Q.tm_yday+7-Q.tm_wday;return Kr(Math.floor($e/7),2)},"%V":Q=>{var $e=Math.floor((Q.tm_yday+7-(Q.tm_wday+6)%7)/7);if((Q.tm_wday+371-Q.tm_yday-2)%7<=2&&$e++,$e){if($e==53){var oi=(Q.tm_wday+371-Q.tm_yday)%7;oi!=4&&(oi!=3||!Xm(Q.tm_year))&&($e=1)}}else{$e=52;var Zi=(Q.tm_wday+7-Q.tm_yday-1)%7;(Zi==4||Zi==5&&Xm(Q.tm_year%400-1))&&$e++}return Kr($e,2)},"%w":Q=>Q.tm_wday,"%W":Q=>{var $e=Q.tm_yday+7-(Q.tm_wday+6)%7;return Kr(Math.floor($e/7),2)},"%y":Q=>(Q.tm_year+1900).toString().substring(2),"%Y":Q=>Q.tm_year+1900,"%z":Q=>{var $e=Q.tm_gmtoff,Zi=$e>=0;return $e=Math.abs($e)/60,$e=$e/60*100+$e%60,(Zi?"+":"-")+("0000"+$e).slice(-4)},"%Z":Q=>Q.tm_zone,"%%":()=>"%"};Ge=Ge.replace(/%%/g,"\0\0");for(var hr in qF)Ge.includes(hr)&&(Ge=Ge.replace(new RegExp(hr,"g"),qF[hr](nt)));Ge=Ge.replace(/\0\0/g,"%");var U0=WM(Ge,!1);return U0.length>R?0:(zF(U0,F),U0.length-1)},GM=(F,R,L,te,Je)=>ZM(F,R,L,te),UF=F=>{var R=t["_"+F];return R},jF=(F,R,L)=>VF(F,le,R,L),qM=F=>{var R=V0(F)+1,L=z0(R);return jF(F,L,R),L},LF=(F,R,L,te,Je)=>{var nt={string:Dr=>{var Ma=0;return Dr!=null&&Dr!==0&&(Ma=qM(Dr)),Ma},array:Dr=>{var Ma=z0(Dr.length);return zF(Dr,Ma),Ma}};function Ge(Dr){return R==="string"?Ym(Dr):R==="boolean"?!!Dr:Dr}var dt=UF(F),hr=[],ni=0;if(te)for(var co=0;co<te.length;co++){var Op=nt[L[co]];Op?(ni===0&&(ni=KF()),hr[co]=Op(te[co])):hr[co]=te[co]}var Kr=dt.apply(null,hr);function tg(Dr){return ni!==0&&WF(ni),Ge(Dr)}return Kr=tg(Kr),Kr},HM=(F,R,L,te)=>{var Je=!L||L.every(Ge=>Ge==="number"||Ge==="boolean"),nt=R!=="string";return nt&&Je&&!te?UF(F):function(){return LF(F,R,L,arguments,te)}},JM={a:R0,b:TF,g:$M,f:CM,d:UM,e:jM,c:GM},vt=MF(),QM=()=>(QM=vt.i)(),YM=t._nam_createInstance=()=>(YM=t._nam_createInstance=vt.j)(),XM=t._nam_destroyInstance=F=>(XM=t._nam_destroyInstance=vt.k)(F),ek=t._nam_getInstanceCount=()=>(ek=t._nam_getInstanceCount=vt.l)(),tk=t._nam_loadModel=(F,R)=>(tk=t._nam_loadModel=vt.m)(F,R),rk=t._nam_unloadModel=F=>(rk=t._nam_unloadModel=vt.n)(F),ik=t._nam_hasModel=F=>(ik=t._nam_hasModel=vt.o)(F),nk=t._nam_process=(F,R,L,te)=>(nk=t._nam_process=vt.p)(F,R,L,te),ok=t._nam_setSampleRate=F=>(ok=t._nam_setSampleRate=vt.q)(F),ak=t._nam_getSampleRate=()=>(ak=t._nam_getSampleRate=vt.r)(),sk=t._nam_setMaxBufferSize=F=>(sk=t._nam_setMaxBufferSize=vt.s)(F),lk=t._nam_getMaxBufferSize=()=>(lk=t._nam_getMaxBufferSize=vt.t)(),ck=t._nam_getModelLoudness=F=>(ck=t._nam_getModelLoudness=vt.u)(F),uk=t._nam_hasModelLoudness=F=>(uk=t._nam_hasModelLoudness=vt.v)(F),dk=t._nam_reset=F=>(dk=t._nam_reset=vt.w)(F),pk=t._free=F=>(pk=t._free=vt.x)(F),hk=t._malloc=F=>(hk=t._malloc=vt.y)(F),fk=()=>(fk=vt.__errno_location)(),KF=()=>(KF=vt.A)(),WF=F=>(WF=vt.B)(F),z0=F=>(z0=vt.C)(F),mk=F=>(mk=vt.__cxa_increment_exception_refcount)(F),ZF=F=>(ZF=vt.D)(F);t.ccall=LF,t.cwrap=HM,t.stringToUTF8=jF,t.lengthBytesUTF8=V0;var eg;Da=function F(){eg||GF(),eg||(Da=F)};function GF(){if(Bn>0||(Wi(),Bn>0))return;function F(){eg||(eg=!0,t.calledRun=!0,!$&&(Ws(),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),so()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),F()},1)):F()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return GF(),e.ready}})(),PF=ZR;var h0=class r extends Ve{static ID=0;static#e=m.None;static#t=null;static async fetchWasm(e){return this.#e.nonEmpty()?this.#e.unwrap():q(this.#t)?this.#t:(this.#t=(async()=>{let t=await e.fetchNamWasm(),n=await PF({wasmBinary:t,locateFile:()=>""}),i=Gm.fromModule(n);return i.setSampleRate(sampleRate),this.#e=m.wrap(i),this.#t=null,i})(),this.#t)}#r=r.ID++;#i;#n;parameterInputGain;parameterOutputGain;parameterMix;#o;#a;#s;#l;#c;#u;#p=!1;#d="";#f=m.None;#h=[-1,-1];#m=!1;#g=1;#v=1;#w=!0;#A=1;#_=!1;constructor(e,t){super(e),this.#i=e,this.#n=t,this.#o=new Ae,this.#a=this.own(new Be(e.broadcaster,t.address)),this.#s=new ka({decay:.96}),this.#l=new Float32Array(this.#s.numBins()),this.#c=[new Float32Array(fe),new Float32Array(fe)],this.#u=[new Float32Array(fe),new Float32Array(fe)];let{namedParameter:n}=t;this.parameterInputGain=this.own(this.bindParameter(n.inputGain)),this.parameterOutputGain=this.own(this.bindParameter(n.outputGain)),this.parameterMix=this.own(this.bindParameter(n.mix)),this.ownAll(e.registerProcessor(this),e.audioOutputBufferRegistry.register(t.address,this.#o,this.outgoing),t.modelField.catchupAndSubscribe(()=>this.#y()),t.monoField.catchupAndSubscribe(o=>this.#b(o.getValue())),e.broadcaster.broadcastFloats(t.spectrum,this.#l,o=>{this.#p=o,o&&(this.#l.set(this.#s.bins()),this.#s.decay=!0)})),this.#E(),this.readAllParameters(),t.getModelJson().length>0&&e.awaitResource(r.fetchWasm(e.engineToClient))}get incoming(){return this}get outgoing(){return this}reset(){if(this.#o.clear(),this.#a.clear(),this.eventInput.clear(),this.#_)return;let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();for(let n of this.#h)if(n>=0)try{t.reset(n)}catch(i){console.error("NAM reset failed:",i)}}}get uuid(){return this.#n.uuid}get audioOutput(){return this.#o}setAudioSource(e){return this.#f=m.wrap(e),{terminate:()=>this.#f=m.None}}index(){return this.#n.indexField.getValue()}adapter(){return this.#n}handleEvent(e){}processAudio(e,t,n){if(this.#_||this.#f.isEmpty())return;let[i,o]=this.#f.unwrap().channels(),[a,s]=this.#o.channels(),l=n-t,u=r.#e;if(u.isEmpty()||!this.#m||this.#h[0]<0){for(let $=t;$<n;$++)a[$]=i[$],s[$]=o[$];this.#a.process(a,s,t,n);return}let p=u.unwrap(),[d,h]=this.#c,[g,v]=this.#u,[y,x]=this.#h,B=this.#g,I=this.#v,O=this.#A,z=1-O;if(this.#w){for(let $=0;$<l;$++)d[$]=(i[t+$]+o[t+$])*.5*B;p.process(y,d.subarray(0,l),g.subarray(0,l));for(let $=0;$<l;$++){let ie=g[$]*I;a[t+$]=i[t+$]*z+ie*O,s[t+$]=o[t+$]*z+ie*O}}else{for(let $=0;$<l;$++)d[$]=i[t+$]*B,h[$]=o[t+$]*B;p.process(y,d.subarray(0,l),g.subarray(0,l)),p.process(x,h.subarray(0,l),v.subarray(0,l));for(let $=0;$<l;$++)a[t+$]=i[t+$]*z+g[$]*I*O,s[t+$]=o[t+$]*z+v[$]*I*O}this.#a.process(a,s,t,n),this.#p&&this.#s.process(a,s,t,n)}parameterChanged(e){e===this.parameterInputGain?this.#g=Pe(this.parameterInputGain.getValue()):e===this.parameterOutputGain?this.#v=Pe(this.parameterOutputGain.getValue()):e===this.parameterMix&&(this.#A=this.parameterMix.getValue())}terminate(){this.#_=!0,super.terminate(),this.#F()}toString(){return`{${this.constructor.name} (${this.#r})}`}#E(){let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();this.#h[0]<0&&(this.#h[0]=t.createInstance()),!this.#w&&this.#h[1]<0&&(this.#h[1]=t.createInstance())}}#F(){let e=r.#e;if(e.nonEmpty()){let t=e.unwrap();for(let n=0;n<2;n++)if(this.#h[n]>=0){try{t.unloadModel(this.#h[n]),t.destroyInstance(this.#h[n])}catch(i){console.error("NAM destroyInstance failed:",i)}this.#h[n]=-1}}this.#m=!1}#b(e){if(this.#_)return;this.#w=e;let t=r.#e;if(t.isEmpty())return;let n=t.unwrap();if(e){if(this.#h[1]>=0){try{n.unloadModel(this.#h[1]),n.destroyInstance(this.#h[1])}catch(i){console.error("NAM destroyInstance failed in onMonoChanged:",i)}this.#h[1]=-1}}else if(this.#h[1]<0&&(this.#h[1]=n.createInstance(),this.#d.length>0))try{n.loadModel(this.#h[1],this.#d)}catch(i){console.error("NAM loadModel failed in onMonoChanged:",i)}}#y(){this.#x(this.#n.getModelJson())}#x(e){if(this.#_)return;this.#d=e,r.#e.nonEmpty()?(this.#E(),this.#S()):r.fetchWasm(this.#i.engineToClient).then(()=>{this.#_||(this.#E(),this.#S())}).catch(n=>console.error("Failed to load NAM WASM:",n))}#S(){if(this.#_)return;let e=r.#e;if(e.isEmpty()){this.#m=!1;return}if(this.#h[0]<0&&this.#E(),this.#h[0]<0){this.#m=!1;return}let t=e.unwrap();if(this.#d.length===0){for(let n of this.#h)n>=0&&t.unloadModel(n);this.#m=!1;return}try{this.#m=t.loadModel(this.#h[0],this.#d),this.#h[1]>=0&&(this.#m=this.#m&&t.loadModel(this.#h[1],this.#d))}catch(n){console.error("NAM loadModel failed:",n),this.#m=!1}}};var SF;(e=>e.create=(t,n)=>n.accept({visitAudioBusBox:i=>new Ip(t,t.boxAdapters.adapterFor(i,Hr)),visitVaporisateurDeviceBox:i=>new Fb(t,t.boxAdapters.adapterFor(i,gd)),visitNanoDeviceBox:i=>new Ob(t,t.boxAdapters.adapterFor(i,xd)),visitTapeDeviceBox:i=>new Db(t,t.boxAdapters.adapterFor(i,md)),visitPlayfieldDeviceBox:i=>new Kb(t,t.boxAdapters.adapterFor(i,Ps)),visitSoundfontDeviceBox:i=>new Jb(t,t.boxAdapters.adapterFor(i,Dd)),visitMIDIOutputDeviceBox:i=>new s0(t,t.boxAdapters.adapterFor(i,zd))}))(SF||={});var EF;(e=>e.create=(t,n)=>he(n.accept({visitUnknownMidiEffectDeviceBox:i=>new Gb(t,t.boxAdapters.adapterFor(i,Bd)),visitArpeggioDeviceBox:i=>new kb(t,t.boxAdapters.adapterFor(i,Hn)),visitPitchDeviceBox:i=>new $b(t,t.boxAdapters.adapterFor(i,vd)),visitVelocityDeviceBox:i=>new l0(t,t.boxAdapters.adapterFor(i,Ud)),visitZeitgeistDeviceBox:i=>new Zb(t,t.boxAdapters.adapterFor(i,Ed))}),`Could not create midi-effect for'${n.name}'`))(EF||={});var Km;(e=>e.create=(t,n)=>he(n.accept({visitUnknownAudioEffectDeviceBox:i=>new zm(t,t.boxAdapters.adapterFor(i,Fd)),visitStereoToolDeviceBox:i=>new Wb(t,t.boxAdapters.adapterFor(i,Pd)),visitMaximizerDeviceBox:i=>new Qb(t,t.boxAdapters.adapterFor(i,Md)),visitCompressorDeviceBox:i=>new i0(t,t.boxAdapters.adapterFor(i,kd)),visitGateDeviceBox:i=>new n0(t,t.boxAdapters.adapterFor(i,$d)),visitDelayDeviceBox:i=>new bb(t,t.boxAdapters.adapterFor(i,tr)),visitDattorroReverbDeviceBox:i=>new d0(t,t.boxAdapters.adapterFor(i,jd)),visitTidalDeviceBox:i=>new c0(t,t.boxAdapters.adapterFor(i,ro)),visitCrusherDeviceBox:i=>new o0(t,t.boxAdapters.adapterFor(i,Td)),visitFoldDeviceBox:i=>new a0(t,t.boxAdapters.adapterFor(i,Cd)),visitReverbDeviceBox:i=>new Cb(t,t.boxAdapters.adapterFor(i,Ju)),visitRevampDeviceBox:i=>new Tb(t,t.boxAdapters.adapterFor(i,Qu)),visitModularDeviceBox:i=>new zm(t,t.boxAdapters.adapterFor(i,ys)),visitNeuralAmpDeviceBox:i=>new h0(t,t.boxAdapters.adapterFor(i,Zd))}),`Could not create audio-effect for'${n.name}'`))(Km||={});var f0=class extends Ve{#e;#t;#r;#i;#n;#o;#a=m.None;#s=!0;#l=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=fr.linear(sampleRate),this.#i=fr.linear(sampleRate),this.#n=this.own(this.bindParameter(t.sendGain)),this.#o=this.own(this.bindParameter(t.sendPan)),this.own(e.registerProcessor(this)),this.readAllParameters()}reset(){this.#t.clear()}get adapter(){return this.#e}setAudioSource(e){return this.#a=m.wrap(e),{terminate:()=>this.#a=m.None}}get audioOutput(){return this.#t}processAudio(e,t,n){if(this.#a.isEmpty())return;if(this.#s){let u=Pe(this.#n.getValue()),p=this.#o.getValue();this.#r.set((1-Math.max(0,p))*u,this.#l),this.#i.set((1+Math.min(0,p))*u,this.#l),this.#s=!1}let i=this.#t.getChannel(0),o=this.#t.getChannel(1),a=this.#a.unwrap(),s=a.getChannel(0),l=a.getChannel(1);if(this.#r.isInterpolating()||this.#i.isInterpolating())for(let u=t;u<n;u++)i[u]=s[u]*this.#r.moveAndGet(),o[u]=l[u]*this.#i.moveAndGet();else{let u=this.#r.get(),p=this.#i.get();for(let d=t;d<n;d++)i[d]=s[d]*u,o[d]=l[d]*p}this.#l=!0}parameterChanged(e){this.#s=!0}};var m0=class extends Ve{#e;#t;#r;#i;#n;#o;#a;#s;#l=fr.linear(sampleRate);#c=fr.linear(sampleRate);#u=fr.linear(sampleRate);#p=m.None;#d=!0;#f=!1;constructor(e,t){super(e),this.#e=t,this.#t=new Ae,this.#r=[new Float32Array(fe),new Float32Array(fe)],this.#i=this.own(new Be(e.broadcaster,this.#e.address)),this.#n=this.own(this.bindParameter(this.#e.namedParameter.volume)),this.#o=this.own(this.bindParameter(this.#e.namedParameter.panning)),this.#a=this.own(this.bindParameter(this.#e.namedParameter.mute)),this.#s=this.own(this.bindParameter(this.#e.namedParameter.solo)),this.ownAll(e.registerProcessor(this),e.mixer.attachChannelStrip(this),e.audioOutputBufferRegistry.register(t.address,this.#t,this)),this.readAllParameters()}reset(){this.#i.clear(),this.#t.clear(),this.#r[0].fill(0),this.#r[1].fill(0),this.#f=!1}get isMute(){return this.#a.getValue()}get isSolo(){return this.#s.getValue()}get adapter(){return this.#e}get audioOutput(){return this.#t}handleEvent(e){}processAudio(e,t,n){if(this.#p.isEmpty())return;if(this.#d){let d=this.context.mixer;d.updateSolo();let h=this.isSolo||d.isVirtualSolo(this),g=this.isMute||d.hasChannelSolo()&&!h&&!this.#e.isOutput,v=Pe(this.#n.getValue()),y=this.#o.getValue();this.#l.set((1-Math.max(0,y))*v,this.#f),this.#c.set((1+Math.min(0,y))*v,this.#f),this.#u.set(g?0:1,this.#f),this.#d=!1}let i=this.#p.unwrap(),[o,a]=i.channels(),[s,l]=this.#t.channels(),[u,p]=this.#r;if(this.#l.isInterpolating()||this.#c.isInterpolating()||this.#u.isInterpolating())for(let d=t;d<n;d++){let h=this.#u.moveAndGet(),g=o[d]*this.#l.moveAndGet(),v=a[d]*this.#c.moveAndGet();s[d]=g*h,l[d]=v*h,u[d]=g,p[d]=v}else{let d=this.#l.get(),h=this.#c.get(),g=this.#u.get();for(let v=t;v<n;v++){let y=o[v]*d,x=a[v]*h;u[v]=y,p[v]=x,s[v]=y*g,l[v]=x*g}}this.#i.process(u,p,t,n),this.#f=!0}finishProcess(){this.#t.assertSanity()}parameterChanged(e){e===this.#n?this.requestGainUpdate():e===this.#o?this.requestGainUpdate():e===this.#a?this.requestGainUpdate():e===this.#s&&this.context.mixer.onChannelStripSoloChanged(this)}requestGainUpdate(){this.#d=!0}requestSoloUpdate(){this.#d=!0}setAudioSource(e){return this.#p=m.wrap(e),{terminate:()=>this.#p=m.None}}toString(){return`{${this.constructor.name}}`}};var g0=class extends gr{#e=m.None;#t=m.None;constructor(e){super(e)}setAudioSource(e){return this.#e=m.wrap(e),{terminate:()=>this.#e=m.None}}setChannels(e){this.#t=m.wrap(e)}clearChannels(){this.#t=m.None}get isActive(){return this.#t.nonEmpty()}reset(){}process(e){if(this.#e.isEmpty()||this.#t.isEmpty())return;let[t,n]=this.#e.unwrap().channels(),i=this.#t.unwrap(),o=this.context.getMonitoringChannel(i[0]);if(o.isEmpty())return;let a=o.unwrap(),s=i.length===2?this.context.getMonitoringChannel(i[1]).unwrapOrElse(a):a;for(let l=0;l<fe;l++)t[l]+=a[l],n[l]+=s[l]}};var v0=class{#e=new j;#t;#r;#i;#n;#o;#a;#s=[];#l=!1;#c=m.None;constructor(e,t){this.#t=e,this.#r=t,this.#i=b.newSet(n=>n.adapter.uuid),this.#n=this.#e.own(new m0(this.#t.context,this.#t.adapter)),this.#o=b.newSet(({device:n})=>n.uuid),this.#a=new j,this.#e.ownAll(this.#t.adapter.audioEffects.catchupAndSubscribe({onAdd:n=>{this.invalidateWiring();let i=Km.create(this.#t.context,n.box),o=this.#o.add({device:i,subscription:i.adapter().enabledField.subscribe(()=>{i.incoming.reset(),i.outgoing.reset(),this.invalidateWiring()})});V(o,"Could not add.")},onRemove:n=>{this.invalidateWiring();let{device:i,subscription:o}=this.#o.removeByKey(n.uuid);o.terminate(),i.terminate()},onReorder:n=>this.invalidateWiring()}),this.#t.adapter.auxSends.catchupAndSubscribe({onAdd:n=>{this.invalidateWiring();let i=this.#i.add(new f0(this.#t.context,n));V(i,"Could not add.")},onRemove:({uuid:n})=>{this.invalidateWiring(),this.#i.removeByKey(n).terminate()},onReorder:n=>{}}),this.#t.adapter.output.catchupAndSubscribe(n=>this.invalidateWiring()),this.#t.context.subscribeProcessPhase(n=>{n===0&&this.#l&&(this.#u(),this.#l=!1)}),this.#a)}get channelStrip(){return this.#n}invalidateWiring(){this.#a.terminate(),this.#l=!0}setMonitoringChannels(e){if(!this.#t.input().isEmpty()){if(this.#c.isEmpty()){let n=new g0(this.#t.context);this.#t.context.registerProcessor(n),this.#c=m.wrap(n)}this.#c.unwrap().setChannels(e),this.invalidateWiring()}}clearMonitoringChannels(){this.#c.ifSome(e=>{e.clearChannels(),this.invalidateWiring()})}terminate(){this.#c.ifSome(e=>e.terminate()),this.#e.terminate(),this.#o.forEach(({device:e})=>e.terminate()),this.#o.clear(),this.#s=[]}toString(){return`{${this.constructor.name}}`}#u(){let e=this.#t.context,t=this.#t.input();if(t.isEmpty())return;let n=this.#t.adapter.isOutput,i=this.#t.adapter.output.adapter.map(s=>e.getAudioUnit(s.deviceHost().uuid).inputAsAudioBus());if(this.#r.useInstrumentOutput){if(i.nonEmpty()&&!n){let s=t.unwrap(),l=i.unwrap();this.#a.own(l.addAudioSource(s.audioOutput)),this.#a.own(e.registerEdge(s.outgoing,l))}return}if(i.isEmpty()&&!n)return;let o=t.unwrap(),a=o.outgoing;if(this.#c.nonEmpty()&&this.#c.unwrap().isActive){let s=this.#c.unwrap();this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(o.outgoing,s)),a=s}if(this.#r.includeAudioEffects){U.replace(this.#s,this.#t.adapter.audioEffects.adapters().map(({uuid:s})=>this.#o.get(s).device));for(let s of this.#s)s.adapter().enabledField.getValue()&&(this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(a,s.incoming)),o=s,a=s.outgoing)}if(this.#r.includeSends&&this.#i.forEach(s=>{let l=e.getAudioUnit(s.adapter.targetBus.deviceHost().uuid);this.#a.own(s.setAudioSource(o.audioOutput)),this.#a.own(l.inputAsAudioBus().addAudioSource(s.audioOutput)),this.#a.own(e.registerEdge(a,s)),this.#a.own(e.registerEdge(s,l.inputAsAudioBus()))}),this.#a.own(this.#n.setAudioSource(o.audioOutput)),this.#a.own(e.registerEdge(a,this.#n)),i.nonEmpty()&&!n){let s=i.unwrap();this.#a.own(s.addAudioSource(this.#n.audioOutput)),this.#a.own(e.registerEdge(this.#n,s))}}};var y0=class{#e=new j;#t;#r;#i;#n;#o;#a;#s;constructor(e,t){this.#t=e,this.#r=t,this.#i=Rc.create(268431651),this.#n=new Set,this.#o=[],this.#a=new Qs,this.#s=new Qs,this.#e.ownAll(this.#t.subscribeProcessPhase(n=>{if(n===1)for(let i of this.#n)i.gate||this.#n.delete(i)}))}get uuid(){return this.#r.uuid}terminate(){this.#e.terminate()}pushRawNoteOn(e,t){this.#n.add({pitch:e,velocity:t,gate:!0,running:m.None})}pushRawNoteOff(e){for(let t of this.#n)if(t.running.isEmpty())this.#n.delete(t);else if(t.pitch===e){t.gate=!1;return}}auditionNote(e,t,n){this.#o.push({pitch:e,duration:t,velocity:n})}*processNotes(e,t,n){let i=St.every(n,5),o=St.every(n,2);if(this.#s.nonEmpty()&&(!i||o?yield*this.#p(e):yield*this.#d(e,t)),this.#a.nonEmpty())if(o)for(let a of this.#a.releaseAll())yield Fe.stop(a,e);else for(let a of this.#a.releaseLinearCompleted(t)){let s=be(a.position+a.duration,e,t);yield Fe.stop(a,s)}if(this.#n.size>0)for(let a of this.#n){if(a.running.isEmpty()){let{pitch:s,velocity:l}=a,u=Number.POSITIVE_INFINITY,p=Fe.start(e,u,s,l);a.running=m.wrap(p),yield p}a.gate||(this.#n.delete(a),yield Fe.stop(a.running.unwrap("raw note never started"),e))}if(this.#o.length>0){for(let a of this.#a.releaseAll())yield Fe.stop(a,e);for(let{pitch:a,duration:s,velocity:l}of this.#o){let u=Fe.start(e,s,a,l);this.#a.addAndRetain({...u}),yield u}this.#o.length=0}if(i){let a=this.#r.tracks.collection.adapters().filter(s=>s.type===me.Notes&&s.enabled.getValue());for(let s of a){let l=this.#t.clipSequencing.iterate(s.uuid,e,t);for(let{optClip:u,sectionFrom:p,sectionTo:d}of l)u.isEmpty()?yield*this.#c(s,p,d):yield*this.#l(u.unwrap(),p,d)}yield*this.#d(e,t)}}*iterateActiveNotesAt(e,t){if(this.#n.size>0)for(let{pitch:n,velocity:i}of this.#n)yield{type:"note-event",position:e,duration:Number.POSITIVE_INFINITY,pitch:n,velocity:i,cent:0};yield*this.#a.overlapping(e,$r.Comparator),!t&&(yield*this.#s.overlapping(e,$r.Comparator))}reset(){this.#n.clear(),this.#s.clear(),this.#o.length=0,this.#a.clear()}toString(){return`{${this.constructor.name}}`}*#l(e,t,n){if(e.optCollection.isEmpty())return;let i=this.#t.preferences.settings.playback.truncateNotesAtRegionEnd,o=e.optCollection.unwrap(),a=e.duration,s=ta(t,a),l=s+a,u=i?a:Number.POSITIVE_INFINITY;n>l?(yield*this.#u(o,t-s,l-s,s,u),yield*this.#u(o,0,n-l,l,u)):yield*this.#u(o,t-s,n-s,s,u)}*#c(e,t,n){let i=this.#t.preferences.settings.playback.truncateNotesAtRegionEnd;for(let o of e.regions.collection.iterateRange(t,n)){if(this.#t.ignoresRegion(o.address.uuid)||o.mute||!pt(o,ss))continue;let a=o.optCollection;if(a.isEmpty())continue;let s=a.unwrap();for(let{resultStart:l,resultEnd:u,rawStart:p,rawEnd:d}of kr.locateLoops(o,t,n)){let h=i?Math.min(d,o.complete):Number.POSITIVE_INFINITY;yield*this.#u(s,l-p,u-p,p,h-p)}}}*#u(e,t,n,i,o){for(let a of e.events.iterateRange(t-e.maxDuration,n)){if(!$r.isOfType(a))continue;let{position:s,duration:l,chance:u,playCount:p,playCurve:d}=a;if(!(u<100&&this.#i.nextDouble(0,100)>u)){if(p>1){let h=$r.inverseCurveFunc((t-s)/l,d),g=$r.inverseCurveFunc((n-s)/l,d),v=Math.floor(h*p),y=v/p;for(;y<g;){if(y>=h){let x=$r.curveFunc(y,d)*l;if(x>=l)break;let B=$r.curveFunc(y+1/p,d)*l,I=Fe.startWith(a,s+x+i,B-x);this.#s.addAndRetain({...I}),yield I}y=++v/p}}else if(t<=s&&s<n){let h=Math.min(a.duration,o-s),g=Fe.startWith(a,s+i,h);this.#s.addAndRetain({...g}),yield g}}}}*#p(e){for(let t of this.#s.releaseAll())yield Fe.stop(t,e)}*#d(e,t){for(let n of this.#s.releaseLinearCompleted(t)){let i=be(n.position+n.duration,e,t);yield Fe.stop(n,i)}}};var x0=class{#e=new j;#t;#r;#i;#n;#o=!1;constructor(e){this.#t=e,this.#r=this.#e.own(new y0(this.#t.context,this.#t.adapter)),this.#i=b.newSet(({device:t})=>t.uuid),this.#n=this.#e.own(new j),this.#e.ownAll(this.#t.adapter.midiEffects.catchupAndSubscribe({onAdd:t=>{this.invalidateWiring();let n=EF.create(this.#t.context,t.box),i=this.#i.add({device:n,subscription:n.adapter().enabledField.subscribe(()=>{n.reset(),this.invalidateWiring()})});V(i,"Could not add.")},onRemove:t=>{this.invalidateWiring();let{device:n,subscription:i}=this.#i.removeByKey(t.uuid);i.terminate(),n.terminate()},onReorder:t=>this.invalidateWiring()}),this.#t.context.subscribeProcessPhase(t=>{t===0&&this.#o&&(this.#a(),this.#o=!1)}))}get noteSequencer(){return this.#r}invalidateWiring(){this.#n.terminate(),this.#o=!0}terminate(){this.#e.terminate()}toString(){return`{${this.constructor.name}}`}#a(){let e=this.#t.input().flatMap(i=>i.noteEventTarget);if(e.isEmpty())return;let t=e.unwrap(),n=this.#r;this.#t.adapter.midiEffects.adapters().map(i=>this.#i.get(i.uuid).device).forEach(i=>{i.adapter().enabledField.getValue()&&(this.#n.ownAll(i.setNoteEventSource(n),this.#t.context.registerEdge(i,t.incoming)),n=i)}),this.#n.own(t.setNoteEventSource(n))}};var w0=class r{static ID=0;#e=r.ID++;#t=new j;#r;#i;#n;#o;#a=m.None;#s;constructor(e,t,n){this.#r=e,this.#i=t,this.#s=n.useInstrumentOutput,this.#n=this.#t.own(new x0(this)),this.#o=this.#t.own(new v0(this,n)),this.#t.ownAll(this.#i.input.catchupAndSubscribe(i=>{this.#n.invalidateWiring(),this.#o.invalidateWiring(),this.#a.ifSome(o=>o.terminate()),this.#a=i.flatMap(o=>m.wrap(SF.create(e,o.box.box)))}))}input(){return this.#a}inputAsAudioBus(){return Ce(this.#a.unwrap("No input available"),Ip)}audioOutput(){return this.#s?this.#a.unwrap().audioOutput:this.#o.channelStrip.audioOutput}get midiDeviceChain(){return this.#n}get audioDeviceChain(){return this.#o}get context(){return this.#r}get adapter(){return this.#i}invalidateWiring(){this.#o.invalidateWiring()}setMonitoringChannels(e){this.#o.setMonitoringChannels(e)}clearMonitoringChannels(){this.#o.clearMonitoringChannels()}terminate(){this.#t.terminate(),this.#a.ifSome(e=>e.terminate()),this.#a=m.None}toString(){return`{${this.constructor.name}(${this.#e})}`}};var b0=class{#e;#t;#r;#i=!1;constructor(){this.#e=b.newSet(e=>e.adapter.uuid),this.#t=new Set,this.#r=new Set}attachChannelStrip(e){return this.#e.add(e),ee.many(e.adapter.input.subscribe(()=>this.#n()),e.adapter.output.subscribe(()=>this.#n()),{terminate:()=>{this.#t.delete(e),this.#e.removeByValue(e),this.#n()}})}onChannelStripSoloChanged(e){e.isSolo?this.#t.add(e):this.#t.delete(e),this.#n()}hasChannelSolo(){return this.#t.size>0}isVirtualSolo(e){return this.#r.has(e)}#n(){this.#i||(this.#i=!0,this.#e.forEach(e=>e.requestSoloUpdate()))}updateSolo(){if(!this.#i)return;this.#r.clear();let e=new Set,t=new Set,n=o=>{e.has(o)||(e.add(o),o.adapter.input.adapter().ifSome(a=>{a.type==="bus"&&a.box.input.pointerHub.filter(c.AudioOutput).map(s=>he(s.box.accept({visitAudioUnitBox:({address:{uuid:l}})=>this.#e.get(l),visitAuxSendBox:({audioUnit:{targetVertex:l}})=>this.#e.get(l.unwrap().address.uuid)}),"Could not resolve channel-strip")).forEach(s=>{s.isSolo||this.#r.add(s),n(s)})}))},i=o=>{t.has(o)||(t.add(o),o.adapter.output.adapter.ifSome(a=>{let s=this.#e.get(a.audioUnitBoxAdapter().uuid);s.isSolo||(this.#r.add(s),i(s))}))};this.#e.forEach(o=>{o.isSolo&&(n(o),i(o))}),this.#i=!1}};var A0=class r{static createDefaultClickSounds(){return[880,440].map(e=>{let t=Math.floor(.002*sampleRate),n=Math.floor(.05*sampleRate),i=t+n,o=gg.create(sampleRate,i,1);for(let a=0;a<i;a++){let s=Math.min(a/t,1-(a-t)/n),l=Math.sin(a/sampleRate*Nn*e)*s*s;o.frames[0][a]+=l}return o})}#e;#t=new Ae;#r=r.createDefaultClickSounds();#i=[];constructor(e){this.#e=e}loadClickSound(e,t){this.#r[e]=t}process({blocks:e}){let t=this.#e.timeInfo.metronomeEnabled,n=this.#e.timelineBoxAdapter.signatureTrack,i=this.#e.preferences.settings.metronome,{beatSubDivision:o,gain:a,monophonic:s}=i;e.forEach(({p0:l,p1:u,bpm:p,s0:d,s1:h,flags:g})=>{if(t&&St.every(g,1))for(let[v,y]of ht.pairWise(n.iterateAll())){let x=v.accumulatedPpqn,B=Ct(y)?y.accumulatedPpqn:1/0;if(B<=l)continue;if(x>=u&&v.index!==-1)break;let I=v.index===-1?l:Math.max(l,x),O=Math.min(u,B),z=v.denominator*o,$=J.fromSignature(1,z),ie=I-x,ne=Math.ceil(ie/$),le=x+ne*$;for(;le<O;){let W=Math.floor(J.pulsesToSamples(le-l,p,sampleRate)),se=Math.round((le-x)/$)%v.nominator===0?0:1;s&&this.#i.forEach(Ee=>Ee.fadeOut()),this.#i.push(new FF(this.#r[se],d+W,a)),le+=$}}this.#t.clear(d,h);for(let v=this.#i.length-1;v>=0;v--)this.#i[v].processAdd(this.#t,d,h)&&this.#i.splice(v,1)})}get output(){return this.#t}},FF=class r{static FadeOutDuration=Math.floor(.005*sampleRate)|0;#e;#t;#r=0;#i=0;#n=-1;constructor(e,t,n){V(t>=0&&t<fe,`${t} out of bounds`),this.#e=e,this.#t=n,this.#i=t}fadeOut(){this.#n<0&&(this.#n=0)}processAdd(e,t,n){let[i,o]=e.channels(),a=Pe(this.#t),{frames:s,numberOfChannels:l,numberOfFrames:u,sampleRate:p}=this.#e,d=s[0],h=s[l>1?1:0],g=p/sampleRate,v=this.#n>=0,y=1;for(let x=Math.max(this.#i,t);x<n;x++){let B=this.#r,I=B|0,O=B-I;if(v&&(y=1-this.#n/r.FadeOutDuration,++this.#n>=r.FadeOutDuration)||(i[x]+=(d[I]+O*(d[I+1]-d[I]))*a*y,o[x]+=(h[I]+O*(h[I+1]-h[I]))*a*y,this.#r+=g,this.#r>=u-1))return!0}return this.#i=0,!1}};var _0=class{#e;constructor(){this.#e=Me.newSet(({address:e})=>e)}register(e,t,n){return this.#e.add({address:e,buffer:t,processor:n}),{terminate:()=>this.#e.removeByKey(e)}}resolve(e){return this.#e.opt(e)}};var P0=class{#e=new j;#t;#r;#i=!1;#n=null;#o=!1;#a=0;#s=m.None;#l;constructor(e){this.#t=e;let{timelineBoxAdapter:t}=e,{box:{bpm:n},markerTrack:i}=t;this.#l=n.getValue(),i.subscribe(()=>this.#o=!0),this.#e.ownAll(n.subscribe(o=>{this.#s.isEmpty()&&(this.#l=o.getValue(),this.#i=!0)}),t.catchupAndSubscribeTempoAutomation(o=>{this.#s=o,o.isEmpty()&&(this.#l=n.getValue()),this.#i=!0})),this.#r=new $c}get bpm(){return this.#l}setCallback(e,t){return this.#r.add(e,t),ee.create(()=>this.#r.remove(e,t))}reset(){this.#i=!1,this.#o=!1,this.#a=0,this.#n=null}process(e){let t=!1,{timeInfo:n,timelineBoxAdapter:{box:i,markerTrack:o},preferences:{settings:a}}=this.#t,s=a.playback.pauseOnLoopDisabled,l=a.recording.allowTakes,u=n.transporting;if(u){let p=[],d=n.position,h=0,g=0,v=n.getLeapStateAndReset();for(;h<fe;){if(this.#o||v){this.#o=!1;let W=o.events.lowerEqual(d);(this.#n?.at(0)??null)!==W&&(this.#n=q(W)?[W,0]:null,t=!0)}if(v&&this.#s.nonEmpty()){let W=this.#s.unwrap().valueAt(d,this.#l);W!==this.#l&&(this.#l=W,this.#i=!0)}let y=fe-h,x=d+J.samplesToPulses(y,this.#l,sampleRate),B=null,I=Number.POSITIVE_INFINITY;if(o.enabled){let W=Array.from(ht.take(o.events.iterateFrom(d),2));if(W.length>0){let[xe,se]=W;this.#n===null?xe.position>=d&&xe.position<x&&(B={type:"marker",prev:xe,next:se},I=xe.position):q(se)&&se!==this.#n[0]&&xe.position<d&&se.position<x&&(B={type:"marker",prev:xe,next:se},I=se.position)}}let{isCountingIn:O}=this.#t.timeInfo,{from:z,to:$,enabled:ie}=i.loopArea;if(ie.getValue()&&!O&&(!n.isRecording||l)||s){let W=$.getValue();d<W&&x>W&&W<I&&(B={type:"loop",target:z.getValue()},I=W)}if(this.#r.keyCount()>0)for(let W of this.#r.keys())d<W&&x>W&&W<I&&(B={type:"callback",position:W,callbacks:this.#r.get(W)},I=W);if(this.#s.nonEmpty()&&!this.#s.unwrap().events.isEmpty()){let W=Dc(d,na);if(W>=d&&W<x&&W<I){let xe=this.#s.unwrap().valueAt(W,this.#l);xe!==this.#l&&(B={type:"tempo",position:W,bpm:xe},I=W)}}let le=!n.isCountingIn;if(B===null){let W=h+y;p.push({index:g++,p0:d,p1:x,s0:h,s1:W,bpm:this.#l,flags:Bp.create(u,v,le,this.#i)}),v=!1,d=x,h=W}else{let W=()=>{if(I>d){let se=h+J.pulsesToSamples(I-d,this.#l,sampleRate)|0;se>h&&(p.push({index:g++,p0:d,p1:I,s0:h,s1:se,bpm:this.#l,flags:Bp.create(u,v,le,this.#i)}),v=!1),d=I,h=se}},xe=()=>{if(h<fe){let se=h+J.pulsesToSamples(x-d,this.#l,sampleRate)|0;p.push({index:g++,p0:d,p1:I,s0:h,s1:se,bpm:this.#l,flags:Bp.create(!1,!1,!1,this.#i)}),h=se}};switch(B.type){case"loop":{W(),s?(this.#t.timeInfo.pause(),xe()):(d=B.target,v=!0);break}case"marker":{let{prev:se,next:Ee}=B;!q(this.#n)||this.#n[0]!==se?this.#n=[se,0]:++this.#n[1]<se.plays||se.plays===0?(W(),d=se.position,v=!0):this.#n=[Ee,0],t=!0;break}case"callback":{W(),B.callbacks.forEach(se=>se());break}case"tempo":{W(),this.#l=B.bpm,this.#i=!0;break}}}}e({blocks:p}),n.advanceTo(d),v=!1,this.#a=d,this.#i=!1}else{let p=n.getLeapStateAndReset();if((p||this.#i)&&this.#s.nonEmpty()){let v=this.#s.unwrap().valueAt(this.#t.timeInfo.position,this.#l);v!==this.#l&&(this.#l=v,this.#i=!0)}if(this.#o||p){this.#o=!1;let v=o.events.lowerEqual(n.position);v!==null&&this.#n?.at(0)!==v&&(this.#n=[v,0],t=!0)}let d=this.#a,h=d+J.samplesToPulses(fe,this.#l,sampleRate),g={blocks:[{index:0,p0:d,p1:h,s0:0,s1:fe,bpm:this.#l,flags:Bp.create(!1,!1,!1,this.#i)}]};e(g),this.#i=!1,this.#a=h}t&&this.#t.engineToClient.switchMarkerState(q(this.#n)?[this.#n[0].uuid,this.#n[1]]:null)}terminate(){this.#e.terminate()}};var BF=class{constructor(e,t){this.uuid=e;this.engineToClient=t;t.fetchAudio(e).then(n=>this.#t=m.wrap(n),console.warn)}peaks=m.None;#e={type:"idle"};#t=m.None;get data(){return this.#t}get state(){return this.#e}subscribe(e){return ee.Empty}invalidate(){}terminate(){this.#t=m.None}toString(){return"{SampleLoaderWorklet}"}},S0=class{#e;#t;constructor(e){this.#e=e,this.#t=b.newSet(({uuid:t})=>t)}record(e){}getOrCreate(e){return this.#t.getOrCreate(e,t=>new BF(t,this.#e))}remove(e){this.#t.removeByKey(e).terminate()}register(e){return ee.Empty}invalidate(e){}terminate(){this.#t.forEach(e=>e.terminate()),this.#t.clear()}};var E0=class{constructor(e){this.uuid=e}waiting=m.None;playing=m.None},F0=class{#e;#t;#r=[];#i=[];#n=[];constructor(e){this.#e=e,this.#e.subscribeToAllUpdatesImmediate({onUpdate:t=>{if(t.type==="delete"){let n=t.uuid;this.#t.opt(n).ifSome(i=>{i.playing.ifSome(o=>this.#a(o.uuid)),i.playing=m.None,i.waiting=m.None}),this.#t.forEach(i=>{i.playing.nonEmpty()&&b.equals(i.playing.unwrap().uuid,n)&&(i.playing=m.None,this.#a(n));let o=i.waiting.flatMap(zp);o.nonEmpty()&&b.equals(o.unwrap().uuid,n)&&(i.waiting=m.None)})}}}),this.#t=b.newSet(t=>t.uuid)}schedulePlay(e){e.trackBoxAdapter.ifSome(({uuid:t})=>{let n=this.#t.getOrCreate(t,o=>new E0(o));if(n.playing.nonEmpty()&&n.playing.unwrap()===e){console.debug(`${e} is already playing (ignore)`);return}let i=n.waiting.flatMap(o=>o);i.nonEmpty()&&(console.debug("obsolete",i.unwrap()),this.#n.push(i.unwrap().uuid),n.waiting=m.None),console.debug(`schedulePlay(${b.toString(n.uuid)} > ${e})`),U.removeOpt(this.#n,e.uuid),n.waiting=m.wrap(m.wrap(e))})}scheduleStop({uuid:e}){let t=this.#t.getOrCreate(e,i=>new E0(i)),n=t.waiting.flatMap(i=>i);n.nonEmpty()&&(console.debug("obsolete",n.unwrap()),this.#n.push(n.unwrap().uuid),t.waiting=m.None),t.playing.nonEmpty()&&(console.debug(`scheduleStop(${b.toString(e)})`),t.waiting=m.wrap(m.None))}reset(){this.#t.forEach(e=>{e.waiting.ifSome(t=>t.ifSome(n=>this.#n.push(n.uuid))),e.waiting=m.None,e.playing.ifSome(t=>this.#a(t.uuid)),e.playing=m.None}),this.#t.clear()}*iterate(e,t,n){let i=this.#t.getOrNull(e);if(i===null){yield{optClip:m.None,sectionFrom:t,sectionTo:n};return}if(i.waiting.nonEmpty()){let o=i.waiting.unwrap(),a=i.playing.mapOr(l=>l.duration,J.Bar),s=ta(n,a);s>=t?(t<s&&(yield{optClip:i.playing,sectionFrom:t,sectionTo:s}),i.waiting=m.None,i.playing.ifSome(l=>this.#a(l.uuid)),o.nonEmpty()?(i.playing=o,this.#o(o.unwrap().uuid)):i.playing=m.None,yield{optClip:i.playing,sectionFrom:s,sectionTo:n}):yield{optClip:i.playing,sectionFrom:t,sectionTo:n}}else if(i.playing.nonEmpty()){let o=i.playing.unwrap();if(o.box.triggerMode.loop.getValue())yield{optClip:i.playing,sectionFrom:t,sectionTo:n};else{let a=ta(t,o.duration)+o.duration;a<=n?(yield{optClip:i.playing,sectionFrom:t,sectionTo:a},i.playing=m.None,this.#a(o.uuid),a<n&&(yield{optClip:m.None,sectionFrom:a,sectionTo:n})):yield{optClip:i.playing,sectionFrom:t,sectionTo:n}}}else yield{optClip:m.None,sectionFrom:t,sectionTo:n}}changes(){if(this.#r.length>0||this.#i.length>0||this.#n.length>0){let e=m.wrap({started:this.#r.slice(),stopped:this.#i.slice(),obsolete:this.#n.slice()});return this.#r.length=0,this.#i.length=0,this.#n.length=0,e}return m.None}terminate(){this.#t.clear(),this.#r.length=0,this.#i.length=0,this.#n.length=0}#o(e){this.#r.push(e)}#a(e){this.#i.push(e)}};var NF;(e=>e.Default={includeAudioEffects:!0,includeSends:!0,useInstrumentOutput:!1})(NF||={});var IF=class{constructor(e,t){this.uuid=e;this.engineToClient=t;t.fetchSoundfont(e).then(n=>this.#t=m.wrap(n),console.warn)}peaks=m.None;#e={type:"idle"};#t=m.None;get soundfont(){return this.#t}get state(){return this.#e}subscribe(e){return ee.Empty}invalidate(){}toString(){return"{SoundfontLoaderWorklet}"}},B0=class{#e;#t;constructor(e){this.#e=e,this.#t=b.newSet(t=>t.uuid)}getOrCreate(e){return this.#t.getOrCreate(e,t=>new IF(t,this.#e))}remove(e){}invalidate(e){}};var N0=class r extends gr{static ClockRate=J.fromSignature(1,24*4);#e;#t;constructor(e,t){super(e),this.#e=t,this.#t=[],this.own(this.context.registerProcessor(this))}schedule(e){this.#t.push(e)}reset(){this.eventInput.clear()}process({blocks:e}){let t=this.#e.midiOutputDevices;if(t.length===0){this.#t.length=0;return}let n=t.filter(i=>i.sendTransportMessages.getValue()&&i.id.getValue()!=="");if(n.length===0){this.#t.length=0;return}n.forEach(i=>{let o=i.id.getValue(),a=i.delayInMs.getValue();this.#t.forEach(s=>this.context.sendMIDIData(o,s,a)),this.#t.length=0}),e.forEach(({p0:i,p1:o,s0:a,bpm:s,flags:l})=>{let u=a/sampleRate;if(St.every(l,1))for(let p of Oa.iterate(i,o,r.ClockRate)){let d=J.pulsesToSeconds(p-i,s);n.forEach(h=>{let g=h.id.getValue(),v=h.delayInMs.getValue(),y=(u+d)*1e3+v;this.context.sendMIDIData(g,Nt.Clock,y)})}})}toString(){return`{${this.constructor.name}}`}};var I0=class{#e;#t;#r;#i;#n=new Map;#o=[];constructor(e,t){this.#e=e,this.#t=new Uint32Array(t,0,2),this.#r=new Uint32Array(t,8),this.#i=(this.#r.length>>1)-1}send(e,t,n){let i=this.#n.get(e);if(Ic(i)){if(i=this.#o.length,i>=64)return console.error(`Too many MIDI devices: ${i}, max is 64`),!1;this.#n.set(e,i),this.#o.push(e),this.#e.postMessage({registerDevice:e,id:i})}let o=Atomics.load(this.#t,0),a=o+1&this.#i;if(a===Atomics.load(this.#t,1))return!1;let s=t.length,l=t[0]??0,u=t[1]??0,p=t[2]??0,d=s<<30|i<<24|l<<16|u<<8|p,h=n|0,g=o<<1;return this.#r[g]=d,this.#r[g+1]=h,Atomics.store(this.#t,0,a),this.#e.postMessage(null),!0}};var D0=class{#e;#t;#r=0;#i=0;#n=0;#o=0;constructor(e){this.#e=new Int32Array(e),this.#t=new Float64Array(e)}start(){let e=Atomics.load(this.#e,1),t=Atomics.load(this.#e,2),n=this.#t[2],i=this.#t[3];this.#a();let o=0;return this.#r>0&&this.#i===this.#r+1&&(o=this.#o-this.#n),this.#r=e,this.#i=t,this.#n=n,this.#o=i,o}end(){this.#a()}#a(){Atomics.add(this.#e,0,1),Atomics.notify(this.#e,0)}};var GR=!1,M0=class extends AudioWorkletProcessor{#e;#t;#r;#i;#n;#o;#a;#s;#l;#c;#u;#p;#d;#f;#h;#m;#g;#v;#w;#A;#_;#E;#F;#b;#y;#x;#S;#I;#M;#k;#D;#B;#$=new Set;#T=new Float32Array(wx);#N=m.None;#R=m.None;#C=[];#O=m.None;#V=m.None;#W=!1;#U=!0;#j=0;#z=0;#L=0;constructor({processorOptions:{syncStreamBuffer:e,controlFlagsBuffer:t,hrClockBuffer:n,project:i,exportConfiguration:o}}){super();let{boxGraph:a,mandatoryBoxes:{rootBox:s,timelineBox:l}}=zs.decode(i);this.#e=new j,this.#t=uB.for(this.port),this.#r=new Om(this.#t.channel("engine-preferences"),dM.parse({})),this.#i=a,this.#n=new Ev,this.#M=new Int32Array(t),this.#k=new D0(n),this.#o=In.sender(this.#t.channel("engine-to-client"),d=>new class{log(h){d.dispatchAndForget(this.log,h)}error(h){d.dispatchAndForget(this.error,h)}fetchAudio(h){return d.dispatchAndReturn(this.fetchAudio,h)}fetchSoundfont(h){return d.dispatchAndReturn(this.fetchSoundfont,h)}fetchNamWasm(){return d.dispatchAndReturn(this.fetchNamWasm)}notifyClipSequenceChanges(h){d.dispatchAndForget(this.notifyClipSequenceChanges,h)}switchMarkerState(h){d.dispatchAndForget(this.switchMarkerState,h)}ready(){d.dispatchAndForget(this.ready)}}),this.#s=this.#e.own(new S0(this.#o)),this.#l=new B0(this.#o),this.#c=b.newSet(d=>d.adapter.uuid),this.#f=new Px,this.#a=this.#e.own(new xx(this)),this.#p=this.#a.adapterFor(l,ln),this.#d=this.#e.own(new Nx(this.timelineBoxAdapter)),this.#u=this.#a.adapterFor(s,fd),this.#h=new bg,this.#m=new Ag(this.#h),this.#g=new ce,this.#v=new b0,this.#b=new A0(this),this.#y=new N0(this,this.#u),this.#x=new _0,this.#S=this.#e.own(new P0(this)),this.#B=b.newSet(d=>d),this.#I=Vc.writer(pN(),e,d=>{let{transporting:h,isCountingIn:g,isRecording:v,position:y}=this.#n,x=this.#p.box.signature.denominator.getValue();d.position=y,d.bpm=this.#S.bpm,d.playbackTimestamp=this.#z,d.countInBeatsRemaining=g?(this.#j-y)/J.fromSignature(1,x):0,d.isPlaying=h,d.isRecording=v,d.isCountingIn=g,d.perfBuffer.set(this.#T),d.perfIndex=this.#L}),this.#w=this.#e.own(vb.create(this.#t,"engine-live-data")),this.#_=new xb(this),this.#E=this.#e.own(new Be(this.#w,Gd.PEAKS)),this.#F=new ka;let u=new Float32Array(this.#F.numBins()),p=new Float32Array(this.#F.numBins());this.#e.own(this.#w.broadcastFloats(Gd.SPECTRUM,u,d=>{d&&(u.set(this.#F.bins()),this.#F.decay=!0)})),this.#e.own(this.#w.broadcastFloats(Gd.WAVEFORM,p,d=>{d&&p.set(this.#F.waveform())})),this.#A=this.#e.own(new F0(this.#i)),this.#e.ownAll(dB(this.#i,this.#t.channel("engine-sync")),this.#r.catchupAndSubscribe(d=>this.#n.metronomeEnabled=d,"metronome","enabled"),In.executor(this.#t.channel("engine-commands"),{play:()=>this.#Z(),stop:d=>this.#G(d),setPosition:d=>this.#q(d),prepareRecordingState:d=>this.#H(d),stopRecording:()=>this.#J(),queryLoadingComplete:()=>Promise.all(this.#$).then(()=>this.#i.boxes().every(d=>d.accept({visitAudioFileBox:h=>this.#s.getOrCreate(h.address.uuid).data.nonEmpty()&&h.pointerHub.nonEmpty()})??!0)),panic:()=>this.#W=!0,loadClickSound:(d,h)=>this.#b.loadClickSound(d,h),updateMonitoringMap:d=>{this.#c.forEach(h=>h.clearMonitoringChannels());for(let{uuid:h,channels:g}of d)this.optAudioUnit(h).ifSome(v=>v.setMonitoringChannels(g))},noteSignal:d=>{if(Fa.isOn(d)){let{uuid:h,pitch:g,velocity:v}=d;this.optAudioUnit(h).ifSome(y=>y.midiDeviceChain.noteSequencer.pushRawNoteOn(g,v))}else if(Fa.isOff(d)){let{uuid:h,pitch:g}=d;this.optAudioUnit(h).ifSome(v=>v.midiDeviceChain.noteSequencer.pushRawNoteOff(g))}else if(Fa.isAudition(d)){let{uuid:h,pitch:g,duration:v,velocity:y}=d;this.optAudioUnit(h).ifSome(x=>x.midiDeviceChain.noteSequencer.auditionNote(g,v,y))}},ignoreNoteRegion:d=>this.#B.add(d),scheduleClipPlay:d=>{d.forEach(h=>{let g=this.#i.findBox(h);if(g.isEmpty())console.warn(`Could not scheduleClipPlay. Cannot find clip: '${b.toString(h)}'`);else{let v=Zv.for(this.#a,g.unwrap());this.#A.schedulePlay(v)}}),this.#n.transporting=!0,this.#y.schedule(Nt.Start)},scheduleClipStop:d=>{d.forEach(h=>{let g=this.#i.findBox(h);g.isEmpty()?console.warn(`Could not scheduleClipStop. Cannot find track: '${b.toString(h)}'`):this.#A.scheduleStop(this.#a.adapterFor(g.unwrap(),Vt))})},setupMIDI:(d,h)=>{this.#V=m.wrap(new I0(d,h))},terminate:()=>{this.#O.ifSome(d=>d.terminate()),this.#O=m.None,this.#U=!1,this.#B.clear(),this.#c.forEach(d=>d.invalidateWiring()),this.#e.terminate(),this.#c.forEach(d=>d.terminate()),this.#c.clear()}}),this.#u.audioUnits.catchupAndSubscribe({onAdd:d=>{let h=b.toString(d.uuid),g=q(o?.[h])?o[h]:NF.Default,v=new w0(this,d,g),y=this.#c.add(v);if(V(y,`Could not add ${v}`),v.adapter.isOutput){V(this.#R.isEmpty(),"Output can only assigned once."),this.#R=m.wrap(v);return}},onRemove:({uuid:d})=>this.#c.removeByKey(d).terminate(),onReorder:ea}),(()=>{for(let d of this.#i.boxes())d instanceof br&&this.#s.getOrCreate(d.address.uuid);return this.#i.subscribeToAllUpdates({onUpdate:d=>{d instanceof rl&&d.name===br.ClassName?this.#s.getOrCreate(d.uuid):d instanceof il&&d.name===br.ClassName&&this.#s.remove(d.uuid)}})})()),this.#D=m.wrap(o).match({none:()=>U.empty(),some:d=>Object.keys(d).map(h=>this.#c.get(b.parse(h)))}),this.#o.ready(),console.log=(...d)=>this.#o.log(d.join(", "))}ignoresRegion(e){return this.#B.hasKey(e)}process(e,t){if(!this.#U)return!1;if(Atomics.load(this.#M,0)===1)return!0;try{return this.render(e,t)}catch(n){return console.debug(n),this.#U=!1,this.#o.error(n),this.terminate(),!1}}render(e,[t]){if(!this.#U)return!1;if(this.#W)return D("Manual Panic");this.#C=e[0]??[];let n=this.#k.start(),i=this.#n.metronomeEnabled;this.#g.notify(0),this.#N.isEmpty()&&(this.#m.update(),this.#N=m.wrap(this.#m.sorted().concat()),GR&&console.debug(`%cAudio-Graph%c
44
44
  ${this.#N.unwrap().map((a,s)=>`${s+1}: ${a}`).join(`
45
45
  `)}`,"color: hsl(200, 83%, 60%)","color: inherit"));let o=this.#N.unwrap();return this.#S.process(a=>{o.forEach(s=>s.process(a)),i&&this.#b.process(a)}),this.#D.length===0?(this.#R.unwrap().audioOutput().replaceInto(t),i&&this.#b.output.mixInto(t),this.#E.process(t[0],t[1]),this.#F.process(t[0],t[1],0,fe)):this.#D.forEach((a,s)=>{let[l,u]=a.audioOutput().channels();t[s*2].set(l),t[s*2+1].set(u)}),this.#g.notify(1),this.#A.changes().ifSome(a=>this.#o.notifyClipSequenceChanges(a)),this.#k.end(),this.#T[this.#L]=n,this.#L=(this.#L+1)%wx,this.#I.tryWrite(),this.#w.flush(),!0}getAudioUnit(e){return this.#c.get(e)}optAudioUnit(e){return this.#c.opt(e)}subscribeProcessPhase(e){return this.#g.subscribe(e)}registerProcessor(e){return this.#h.addVertex(e),this.#N=m.None,{terminate:()=>{this.#h.removeVertex(e),this.#N=m.None}}}registerEdge(e,t){return this.#h.addEdge([e,t]),this.#N=m.None,{terminate:()=>{this.#h.removeEdge([e,t]),this.#N=m.None}}}awaitResource(e){this.#$.add(e),e.finally(()=>this.#$.delete(e))}get preferences(){return this.#r}get boxGraph(){return this.#i}get boxAdapters(){return this.#a}get sampleManager(){return this.#s}get soundfontManager(){return this.#l}get rootBoxAdapter(){return this.#u}get timelineBoxAdapter(){return this.#p}get tempoMap(){return this.#d}get liveStreamBroadcaster(){return this.#w}get liveStreamReceiver(){return D("Only available in main thread")}get parameterFieldAdapters(){return this.#f}get clipSequencing(){return this.#A}get broadcaster(){return this.#w}get updateClock(){return this.#_}get timeInfo(){return this.#n}get mixer(){return this.#v}get engineToClient(){return this.#o}get isMainThread(){return!1}get isAudioContext(){return!0}get audioOutputBufferRegistry(){return this.#x}sendMIDIData(e,t,n){this.#V.ifSome(i=>i.send(e,t,n))}getMonitoringChannel(e){return e>=this.#C.length?m.None:m.wrap(this.#C[e])}terminate(){console.trace(`terminate: ${this}`),this.#e.terminate(),this.#c.forEach(e=>e.terminate()),this.#c.clear()}#Z(){this.#r.settings.playback.timestampEnabled&&(this.#n.position=this.#z,this.#y.schedule(Nt.positionInPPQN(this.#n.position))),this.#n.transporting=!0,this.#y.schedule(Nt.Start)}#G(e){(this.#n.isRecording||this.#n.isCountingIn)&&(this.#n.isRecording=!1,this.#n.isCountingIn=!1,this.#n.position=this.#r.settings.playback.timestampEnabled?this.#z:0,this.#y.schedule(Nt.positionInPPQN(this.#n.position)));let t=this.#n.transporting;this.#n.transporting=!1,this.#n.metronomeEnabled=this.#K(),this.#B.clear(),(e||!t)&&this.#Q(),this.#y.schedule(Nt.Stop)}#q(e){this.#n.isRecording||(this.#n.position=this.#z=e,this.#y.schedule(Nt.positionInPPQN(this.#n.position)))}#H(e){if(!(this.#n.isRecording||this.#n.isCountingIn))if(!this.#n.transporting&&e){let t=this.#n.position,[n,i]=this.#p.signature,o=J.fromSignature(this.#r.settings.recording.countInBars*n,i);this.#j=ta(t,J.fromSignature(n,i)),this.#n.isCountingIn=!0,this.#n.metronomeEnabled=!0,this.#n.transporting=!0,this.#n.position=this.#j-o;let a=this.#S.setCallback(this.#j,()=>{this.#n.isCountingIn=!1,this.#n.isRecording=!0,this.#n.metronomeEnabled=this.#K(),a.terminate()});this.#y.schedule(Nt.positionInPPQN(this.#n.position))}else this.#n.transporting=!0,this.#n.isRecording=!0,this.#y.schedule(Nt.Start)}#J(){!this.#n.isRecording&&!this.#n.isCountingIn||(this.#n.isRecording=!1,this.#n.isCountingIn=!1,this.#n.metronomeEnabled=this.#K(),this.#n.transporting=!1,this.#B.clear(),this.#y.schedule(Nt.Stop))}#Q(){this.#z=0,this.#n.isRecording=!1,this.#n.isCountingIn=!1,this.#n.metronomeEnabled=this.#K(),this.#n.position=0,this.#n.transporting=!1,this.#S.reset(),this.#A.reset(),this.#m.sorted().forEach(e=>e.reset()),this.#E.clear()}#K(){return this.#r.settings.metronome.enabled}};var k0=class extends AudioWorkletProcessor{#e;constructor({processorOptions:e}){super(),this.#e=Ex.writer(e)}process(e){return this.#e.write(e[0]),!0}};registerProcessor("meter-processor",Dg);registerProcessor("engine-processor",M0);registerProcessor("recording-processor",k0);
46
46
  /*! Bundled license information: