web-music-score 6.0.0-pre.1 → 6.0.0-pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -1
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +4 -4
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +4 -4
- package/dist/audio-synth/index.js +1 -1
- package/dist/audio-synth/index.mjs +4 -4
- package/dist/{chunk-LO4NI4AU.mjs → chunk-3L3RBNBV.mjs} +3 -3
- package/dist/{chunk-PW2SO6EZ.mjs → chunk-5P4O5YX2.mjs} +3 -3
- package/dist/{chunk-VHB57TXT.mjs → chunk-5W6ROWBC.mjs} +2 -2
- package/dist/{chunk-X7BMJX7E.mjs → chunk-7PNMM2PM.mjs} +3 -3
- package/dist/{chunk-GNT3ECDB.mjs → chunk-GNFWJCFN.mjs} +4 -4
- package/dist/{chunk-A7C2G7OG.mjs → chunk-OXLTN43T.mjs} +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +4 -4
- package/dist/iife/{audio-cg.global.js → audio-cg.js} +2 -2
- package/dist/iife/{index.global.js → index.js} +3 -3
- package/dist/{music-objects-DLmp5uL6.d.ts → music-objects-CiIS8yPn.d.ts} +2 -2
- package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
- package/dist/pieces/index.d.ts +3 -3
- package/dist/pieces/index.js +1 -1
- package/dist/pieces/index.mjs +2 -2
- package/dist/react-ui/index.d.ts +3 -3
- package/dist/react-ui/index.js +1 -1
- package/dist/react-ui/index.mjs +2 -2
- package/dist/{scale-B1M10_fu.d.ts → scale-DxGqFxlv.d.ts} +2 -2
- package/dist/score/index.d.ts +5 -5
- package/dist/score/index.js +1 -1
- package/dist/score/index.mjs +5 -5
- package/dist/{tempo-D-JF-8b_.d.ts → tempo-pCAa6qgo.d.ts} +1 -1
- package/dist/theory/index.d.ts +5 -5
- package/dist/theory/index.js +1 -1
- package/dist/theory/index.mjs +4 -4
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* WebMusicScore v6.0.0-pre.
|
|
2
|
-
"use strict";var WebMusicScore=(()=>{var Ds=Object.defineProperty,bg=Object.defineProperties,xg=Object.getOwnPropertyDescriptor,Ag=Object.getOwnPropertyDescriptors,Cg=Object.getOwnPropertyNames,Es=Object.getOwnPropertySymbols;var tu=Object.prototype.hasOwnProperty,Hh=Object.prototype.propertyIsEnumerable;var Kc=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i),_g=i=>{throw TypeError(i)},$h=Math.pow,Jc=(i,t,e)=>t in i?Ds(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t)=>{for(var e in t||(t={}))tu.call(t,e)&&Jc(i,e,t[e]);if(Es)for(var e of Es(t))Hh.call(t,e)&&Jc(i,e,t[e]);return i},Q=(i,t)=>bg(i,Ag(t));var Qr=(i,t)=>{var e={};for(var r in i)tu.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&Es)for(var r of Es(i))t.indexOf(r)<0&&Hh.call(i,r)&&(e[r]=i[r]);return e};var en=(i,t)=>{for(var e in t)Ds(i,e,{get:t[e],enumerable:!0})},vg=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cg(t))!tu.call(i,n)&&n!==e&&Ds(i,n,{get:()=>t[n],enumerable:!(r=xg(t,n))||r.enumerable});return i};var Sg=i=>vg(Ds({},"__esModule",{value:!0}),i);var d=(i,t,e)=>Jc(i,typeof t!="symbol"?t+"":t,e);var J=(i,t,e)=>new Promise((r,n)=>{var o=c=>{try{a(e.next(c))}catch(u){n(u)}},s=c=>{try{a(e.throw(c))}catch(u){n(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((e=e.apply(i,t)).next())}),wg=function(i,t){this[0]=i,this[1]=t};var pe=i=>{var t=i[Kc("asyncIterator")],e=!1,r,n={};return t==null?(t=i[Kc("iterator")](),r=o=>n[o]=s=>t[o](s)):(t=t.call(i),r=o=>n[o]=s=>{if(e){if(e=!1,o==="throw")throw s;return s}return e=!0,{done:!1,value:new wg(new Promise(a=>{var c=t[o](s);c instanceof Object||_g("Object expected"),a(c)}),1)}}),n[Kc("iterator")]=()=>n,r("next"),"throw"in t?r("throw"):n.throw=o=>{throw o},"return"in t&&r("return"),n};var l0={};en(l0,{Audio:()=>Fo,Core:()=>hu,Pieces:()=>Yh,Score:()=>Vh,Theory:()=>xu});var Fo={};en(Fo,{addInstrument:()=>Rv,getCurrentInstrument:()=>Ov,getInstrumentList:()=>Nv,isMuted:()=>Dv,linearToDecibels:()=>Js,mute:()=>Mv,playNote:()=>Ua,stop:()=>za,unmute:()=>Ev,useInstrument:()=>Jf});var xu={};en(xu,{AccidentalType:()=>du,BeamGrouping:()=>Oi,Chord:()=>pu,DefaultGuitarNoteLabel:()=>GA,DefaultPitchNotation:()=>FA,DefaultTuningName:()=>pC,GuitarNoteLabel:()=>zs,GuitarNoteLabelList:()=>VA,Interval:()=>uo,KeySignature:()=>rr,Mode:()=>lu,Note:()=>U,NoteLength:()=>ir,NoteLengthProps:()=>Nt,PitchNotation:()=>ti,PitchNotationList:()=>PA,RhythmProps:()=>Kt,Scale:()=>ri,ScaleFactory:()=>ne,ScaleType:()=>Ti,SymbolSet:()=>Jr,TimeSignature:()=>ii,TimeSignatures:()=>po,TuningNameList:()=>lo,Tuplet:()=>Gr,alterTempoSpeed:()=>bu,getDefaultKeySignature:()=>Ys,getDefaultScale:()=>nC,getDefaultTempo:()=>Qs,getDefaultTimeSignature:()=>Xs,getPitchNotationName:()=>BA,getScale:()=>Pr,getScaleFactory:()=>Ml,getScaleFactoryList:()=>rC,getTempoString:()=>Ks,getTuningStrings:()=>$s,isNoteLength:()=>nr,isTupletRatio:()=>Zs,validateGuitarNoteLabel:()=>qA,validateIntervalQuality:()=>QA,validateNoteLength:()=>Br,validatePitchNotation:()=>_l,validateScaleType:()=>ho,validateTuningName:()=>fu,validateTupletRatio:()=>kl});var Zh=Object.defineProperty,Ig=(i,t,e)=>t in i?Zh(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,er=(i,t)=>{for(var e in t)Zh(i,e,{get:t[e],enumerable:!0})},ft=(i,t,e)=>Ig(i,typeof t!="symbol"?t+"":t,e),Xh={};er(Xh,{assert:()=>tb,doesNotThrow:()=>Tx,doesThrow:()=>Ix,fail:()=>nb,isArray:()=>yb,isArrayOrUndefined:()=>bb,isBigInt:()=>Gb,isBoolean:()=>Ob,isBooleanOrUndefined:()=>Rb,isDeepEqual:()=>sb,isDefined:()=>hb,isEmptyArray:()=>xb,isEmptyArrayOrUndefined:()=>Cb,isEmptyObject:()=>pb,isEmptyString:()=>Sb,isEmptyStringOrUndefined:()=>Tb,isEnumValue:()=>Pb,isEnumValueOrUndefined:()=>Fb,isEven:()=>Cx,isFalse:()=>Db,isFalseOrUndefined:()=>kb,isFinite:()=>Qb,isFloat:()=>Kb,isFunction:()=>Lb,isFunctionOrUndefined:()=>jb,isIncluded:()=>Sx,isIndex:()=>wx,isInfinity:()=>hx,isInteger:()=>Jb,isIntegerBetween:()=>ax,isIntegerBetweenExclusive:()=>cx,isIntegerEq:()=>rx,isIntegerGt:()=>ix,isIntegerGte:()=>nx,isIntegerLt:()=>ox,isIntegerLte:()=>sx,isIntegerOrUndefined:()=>ex,isMultipleOf:()=>_x,isNaNValue:()=>ux,isNeg:()=>mx,isNegInfinity:()=>dx,isNegZero:()=>xx,isNonEmptyArray:()=>Ab,isNonEmptyArrayOrUndefined:()=>_b,isNonEmptyString:()=>wb,isNonEmptyStringOrUndefined:()=>Nb,isNonNeg:()=>gx,isNonNull:()=>lb,isNonPos:()=>fx,isNull:()=>cb,isNullish:()=>ub,isNumber:()=>Vb,isNumberBetween:()=>Zb,isNumberBetweenExclusive:()=>Xb,isNumberEq:()=>Ub,isNumberGt:()=>zb,isNumberGte:()=>Yb,isNumberLt:()=>Hb,isNumberLte:()=>$b,isNumberOrUndefined:()=>Wb,isNumericString:()=>Bb,isObject:()=>db,isObjectOrUndefined:()=>fb,isOdd:()=>Ax,isPlainObject:()=>mb,isPos:()=>px,isPosInfinity:()=>lx,isPosZero:()=>bx,isPowerOfTwo:()=>vx,isSafeInteger:()=>tx,isSafeNumber:()=>qb,isStrictEqual:()=>ob,isString:()=>vb,isStringOrUndefined:()=>Ib,isTrue:()=>Mb,isTrueOrUndefined:()=>Eb,isTypedObject:()=>gb,isUndefined:()=>ab,isZero:()=>yx,require:()=>eb,requireDefined:()=>rb,requireElement:()=>ib,setErrorClass:()=>Jy});var Qh={};er(Qh,{charCount:()=>Zy,chunkString:()=>Yy,insertAt:()=>Hy,isString:()=>el,makeSentenceFromPascal:()=>Xy,removeAt:()=>$y,repeatString:()=>zy,replaceAt:()=>ou,splitByCaps:()=>Qy,splitByChars:()=>Ky,splitByStrings:()=>ol,stringify:()=>Gt,toCharArray:()=>Uy});var Kh={};er(Kh,{deepEqual:()=>Ps,getCtorName:()=>nl,hasProperties:()=>Wy,isObject:()=>wi});var y={};er(y,{doesNotThrow:()=>Vy,doesThrow:()=>Gy,isArray:()=>je,isArrayOrUndefined:()=>Gg,isBigInt:()=>sy,isBoolean:()=>Xg,isBooleanOrUndefined:()=>Qg,isDeepEqual:()=>ao,isDefined:()=>Dg,isEmptyArray:()=>Vg,isEmptyArrayOrUndefined:()=>Wg,isEmptyObject:()=>Lg,isEmptyString:()=>zg,isEmptyStringOrUndefined:()=>$g,isEnumValue:()=>iy,isEnumValueOrUndefined:()=>ny,isEven:()=>Ly,isFalse:()=>ty,isFalseOrUndefined:()=>ey,isFinite:()=>rn,isFloat:()=>gy,isFunction:()=>_r,isFunctionOrUndefined:()=>ry,isIncluded:()=>Fy,isIndex:()=>By,isInfinity:()=>Sy,isInteger:()=>Lt,isIntegerBetween:()=>rl,isIntegerBetweenExclusive:()=>vy,isIntegerEq:()=>xy,isIntegerGt:()=>Ay,isIntegerGte:()=>nu,isIntegerLt:()=>Cy,isIntegerLte:()=>_y,isIntegerOrUndefined:()=>by,isMultipleOf:()=>jy,isNaNValue:()=>il,isNeg:()=>Ny,isNegInfinity:()=>Iy,isNegZero:()=>Dy,isNonEmptyArray:()=>qg,isNonEmptyArrayOrUndefined:()=>Ug,isNonEmptyString:()=>Yg,isNonEmptyStringOrUndefined:()=>Zg,isNonNeg:()=>Ry,isNonNull:()=>kg,isNonPos:()=>Oy,isNull:()=>Mg,isNullish:()=>Eg,isNumber:()=>kt,isNumberBetween:()=>my,isNumberBetweenExclusive:()=>fy,isNumberEq:()=>uy,isNumberGt:()=>hy,isNumberGte:()=>ly,isNumberLt:()=>dy,isNumberLte:()=>py,isNumberOrUndefined:()=>cy,isNumericString:()=>oy,isObject:()=>wi,isObjectOrUndefined:()=>jg,isOdd:()=>ky,isPlainObject:()=>Pg,isPos:()=>Ty,isPosInfinity:()=>wy,isPosZero:()=>Ey,isPowerOfTwo:()=>Py,isSafeInteger:()=>yy,isSafeNumber:()=>ay,isStrictEqual:()=>Og,isString:()=>el,isStringOrUndefined:()=>Hg,isTrue:()=>Kg,isTrueOrUndefined:()=>Jg,isTypedObject:()=>Fg,isUndefined:()=>Rg,isZero:()=>My,tryOr:()=>qy});var Jh={};er(Jh,{forEachEnum:()=>Ng,getEnumEntries:()=>tl,getEnumKey:()=>Tg,getEnumKeys:()=>Fs,getEnumValues:()=>iu});function Fs(i){return Object.keys(i).filter(t=>isNaN(Number(t)))}function iu(i){return Fs(i).map(t=>i[t])}function tl(i){return Fs(i).map(t=>[t,i[t]])}function Tg(i,t){return Fs(i).find(e=>i[e]===t)}function Ng(i,t){for(let[e,r]of tl(i))t(e,r)}function Og(i,t){return i===t}function ao(i,t){return Ps(i,t)}function Rg(i){return i===void 0}function Mg(i){return i===null}function Eg(i){return i==null}function Dg(i){return i!==void 0}function kg(i){return i!==null}function wi(i){return typeof i=="object"&&i!==null&&!je(i)}function Lg(i){return wi(i)&&Object.keys(i).length===0}function jg(i){return i===void 0||wi(i)}function Pg(i){if(!wi(i))return!1;let t=Object.getPrototypeOf(i);return t===Object.prototype||t===null}function Fg(i,t){return wi(i)&&t.every(e=>e in i)}function Bg(i){return i instanceof Set}function je(i){return!!i&&Object.prototype.toString.call(i)==="[object Array]"}function Gg(i){return i===void 0||je(i)}function Vg(i){return je(i)&&i.length===0}function qg(i){return je(i)&&i.length>0}function Wg(i){return je(i)&&i.length===0||i===void 0}function Ug(i){return je(i)&&i.length>0||i===void 0}function el(i){return typeof i=="string"}function zg(i){return typeof i=="string"&&i.length===0}function Yg(i){return typeof i=="string"&&i.length>0}function Hg(i){return i===void 0||typeof i=="string"}function $g(i){return typeof i=="string"&&i.length===0||i===void 0}function Zg(i){return typeof i=="string"&&i.length>0||i===void 0}function Xg(i){return typeof i=="boolean"}function Qg(i){return i===void 0||typeof i=="boolean"}function Kg(i){return i===!0}function Jg(i){return i===!0||i===void 0}function ty(i){return i===!1}function ey(i){return i===!1||i===void 0}function _r(i){return typeof i=="function"}function ry(i){return i===void 0||typeof i=="function"}function iy(i,t){return iu(t).some(e=>e===i)}function ny(i,t){return i===void 0||iu(t).some(e=>e===i)}function oy(i){if(typeof i!="string"||i.trim()==="")return!1;let t=+i;return Number.isFinite(t)}function sy(i){return typeof i=="bigint"}function kt(i){return typeof i=="number"}function ay(i){return kt(i)&&Number.isSafeInteger(i)}function cy(i){return typeof i=="number"||i===void 0}function uy(i,t){return kt(i)&&i===t}function hy(i,t){return kt(i)&&kt(t)&&i>t}function ly(i,t){return kt(i)&&kt(t)&&i>=t}function dy(i,t){return kt(i)&&kt(t)&&i<t}function py(i,t){return kt(i)&&kt(t)&&i<=t}function my(i,t,e){return kt(i)&&kt(t)&&kt(e)&&i>=t&&i<=e}function fy(i,t,e){return kt(i)&&kt(t)&&kt(e)&&i>t&&i<e}function rn(i){return typeof i=="number"&&Number.isFinite(i)}function gy(i){return rn(i)&&!Lt(i)}function Lt(i){return typeof i=="number"&&rn(i)&&i===Math.trunc(i)}function yy(i){return Lt(i)&&Number.isSafeInteger(i)}function by(i){return typeof i=="number"&&rn(i)&&i===Math.trunc(i)||i===void 0}function xy(i,t){return Lt(i)&&i===t}function Ay(i,t){return Lt(i)&&kt(t)&&i>t}function nu(i,t){return Lt(i)&&kt(t)&&i>=t}function Cy(i,t){return Lt(i)&&kt(t)&&i<t}function _y(i,t){return Lt(i)&&kt(t)&&i<=t}function rl(i,t,e){return Lt(i)&&kt(t)&&kt(e)&&i>=t&&i<=e}function vy(i,t,e){return Lt(i)&&kt(t)&&kt(e)&&i>t&&i<e}function il(i){return typeof i=="number"&&Number.isNaN(i)}function Sy(i){return i===1/0||i===-1/0}function wy(i){return i===1/0}function Iy(i){return i===-1/0}function Ty(i){return typeof i=="number"&&i>0}function Ny(i){return typeof i=="number"&&i<0}function Oy(i){return typeof i=="number"&&i<=0}function Ry(i){return typeof i=="number"&&i>=0}function My(i){return typeof i=="number"&&i===0}function Ey(i){return typeof i=="number"&&i===0&&1/i===1/0}function Dy(i){return typeof i=="number"&&i===0&&1/i===-1/0}function ky(i){return Lt(i)&&Math.abs(i)%2===1}function Ly(i){return Lt(i)&&i%2===0}function jy(i,t){return typeof i=="number"&&typeof t=="number"&&i%t===0}function Py(i){return Lt(i)&&i>0&&(i&i-1)===0}function Fy(i,t){return je(t)?t.includes(i):Bg(t)?t.has(i):!1}function By(i,t){return je(t)?rl(i,0,t.length-1):nu(i,0)}function Gy(i){try{return i(),!1}catch(t){return!0}}function Vy(i){try{return i(),!0}catch(t){return!1}}function qy(i,t){try{return i()}catch(e){return _r(t)?t():t}}function Wy(i,t){return wi(i)&&t.every(e=>e in i)}function Ps(i,t){if(i===t)return!0;if(i===null||t===null||typeof i!="object"||typeof t!="object")return!1;if(Array.isArray(i)&&Array.isArray(t))return i.length!==t.length?!1:i.every((n,o)=>Ps(n,t[o]));if(Array.isArray(i)!==Array.isArray(t))return!1;let e=Object.keys(i),r=Object.keys(t);if(e.length!==r.length)return!1;for(let n of e)if(!Object.prototype.hasOwnProperty.call(t,n)||!Ps(i[n],t[n]))return!1;return!0}function nl(i){return i===null?"null":je(i)?"Array":typeof i!="object"?typeof i:Object.prototype.toString.call(i).slice(8,-1)||"Object"}function Uy(i){return i.split("")}function zy(i,t){if(!Lt(t)||t<0)throw new Error("repeatStr: Invalid repeatCount = "+t);return new Array(t+1).join(i)}function Yy(i,t){if(!Lt(t)||t<1)throw new Error("chunckString: Invalid chuckSize = "+t);let e=[];for(let r=0;r<i.length;r+=t)e.push(i.slice(r,r+t));return e}function ou(i,t,e,r){if(!Lt(e)||e<0)throw new Error("replaceAt: Invalid removeCount = "+e);if(!Lt(t)||t<0||t+e>i.length)throw new Error("replaceAt: Invalid pos = "+t+", removeCount = "+e+", str.length = "+i.length);return i.substring(0,t)+r+i.substring(t+e)}function Hy(i,t,e){return ou(i,t,0,e)}function $y(i,t,e){return ou(i,t,e,"")}function Zy(i,t){if(t.length!==1||i.length===0)return 0;let e=0;for(let r=0;r<i.length;r++)i[r]===t&&e++;return e}function Xy(i){if(i==="")return"";let t=i.charAt(0),e="",r=()=>{t!==""&&(e===""?e+=t.charAt(0).toUpperCase()+t.substring(1):e+=" "+t,t="")},n=o=>o.toUpperCase()!==o.toLowerCase()&&o===o.toUpperCase();for(let o=1;o<i.length;o++){let s=i.charAt(o);n(s)&&r(),t+=s.toLowerCase()}return r(),e}function Gt(i,t=5,e=new WeakSet){if(i===null)return"null";if(i===void 0)return"undefined";let r=typeof i;switch(r){case"boolean":return i?"true":"false";case"number":return il(i)?"NaN":rn(i)?i.toString():i<0?"-Infinity":"Infinity";case"bigint":return`${i}n`;case"string":return`"${i}"`;case"symbol":return i.description?`Symbol(${i.description})`:"Symbol()";case"function":return`[Function${i.name?` ${i.name}`:""}]`}if(e.has(i))return"[Circular]";if(t<=0)return"[Depth limit]";t--,e.add(i);let n=s=>Gt(s,t,e);if(je(i)){let s=i.map(a=>n(a)).join(", ");return s.length===0?"[ ]":`[ ${s} ]`}if(ArrayBuffer.isView(i)){if(i instanceof DataView)return`DataView(${i.byteLength})`;let s=Array.from(i).map(a=>n(a)).join(", ");return`${i.constructor.name}[ ${s} ]`}if(i instanceof ArrayBuffer)return`ArrayBuffer(${i.byteLength})`;if(i instanceof Map){let s=Array.from(i.entries()).map(([a,c])=>`${n(a)} => ${n(c)}`).join(", ");return s.length===0?`Map(${i.size}){ }`:`Map(${i.size}){ ${s} }`}if(i instanceof Set){let s=Array.from(i.values()).map(a=>n(a)).join(", ");return s.length===0?`Set(${i.size}){ }`:`Set(${i.size}){ ${s} }`}if(i instanceof WeakMap)return"WeakMap{ ? }";if(i instanceof WeakSet)return"WeakSet{ ? }";if(i instanceof Date)return`Date("${i.toISOString()}")`;if(i instanceof RegExp)return i.toString();if(i instanceof Error)return`${i.name}("${i.message}")`;if(i instanceof Promise)return"Promise{ ? }";if(i instanceof URL)return`URL("${i.href}")`;if(i instanceof URLSearchParams)return`URLSearchParams("${i.toString()}")`;if(i===Math)return"Math";if(i===JSON)return"JSON";if(i===Reflect)return"Reflect";if(i===Intl)return"Intl";if(typeof(i==null?void 0:i.toString)=="function"&&i.toString!==Object.prototype.toString)try{let s=i.toString();if(!/^\[object .+\]$/.test(s))return s}catch(s){}if(r==="object"){let s=nl(i),a=Object.entries(i).map(([c,u])=>`${n(c)}: ${n(u)}`);return a.length===0?`${s}{ }`:`${s}{ ${a.join(", ")} }`}return String(i)}function Qy(i){return i.split(/(?=[A-Z])/).filter(t=>!!t)}function ol(i,...t){if(t.length===0)return[i];let e=t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r=new RegExp(e.join("|"),"g");return i.split(r)}function Ky(i,t){return ol(i,...t.split(""))}var L=Gt,sl=Error;function Jy(i){sl=i!=null?i:Error}function V(...i){let t=i.join(", ");throw new sl("Assertion Failed!"+(t===""?"":" "+t))}function tb(i,t){i||V(t)}function eb(i,t){return i==null&&V(`Expected ${L(i)} not to be nullish`,t),i}function rb(i,t){return i===void 0&&V(`Expected ${L(i)} not to be undefined`,t),i}function ib(i,t,e){return y.isIndex(i,t)||V(`Expected ${i} to be index for array ${L(t)}`,e),t[i]}function nb(i){V(i)}function ob(i,t,e){return y.isStrictEqual(i,t)||V(`Expected ${L(i)} to ne strict equal to ${t}`,e),i}function sb(i,t,e){return y.isDeepEqual(i,t)||V(`Expected ${L(i)} to deep equal with ${L(t)}`,e),i}function ab(i,t){return y.isUndefined(i)||V(`Expected ${L(i)} to be undefined`,t),i}function cb(i,t){return y.isNull(i)||V(`Expected ${L(i)} to be null`,t),i}function ub(i,t){return y.isNullish(i)||V(`Expected ${L(i)} to be null or undefined`,t),i}function hb(i,t){return y.isDefined(i)||V(`Expected ${L(i)} to be defined`,t),i}function lb(i,t){return y.isNonNull(i)||V(`Expected ${L(i)} to be defined`,t),i}function db(i,t){return y.isObject(i)||V(`Expected ${L(i)} to be object`,t),i}function pb(i,t){return y.isEmptyObject(i)||V(`Expected ${L(i)} to be empty object`,t),i}function mb(i,t){return y.isPlainObject(i)||V(`Expected ${L(i)} to be plain object`,t),i}function fb(i,t){return y.isObjectOrUndefined(i)||V(`Expected ${L(i)} to be object or undefined`,t),i}function gb(i,t,e){return y.isTypedObject(i,t)||V(`Expected ${L(i)} to have keys ${L(t)}`,e),i}function yb(i,t){return y.isArray(i)||V(`Expected ${L(i)} to be array`,t),i}function bb(i,t){return y.isArrayOrUndefined(i)||V(`Expected ${L(i)} to be array or undefined`,t),!0}function xb(i,t){y.isEmptyArray(i)||V(`Expected ${L(i)} to be empty array`,t)}function Ab(i,t){y.isNonEmptyArray(i)||V(`Expected ${L(i)} to be non-empty array`,t)}function Cb(i,t){y.isEmptyArrayOrUndefined(i)||V(`Expected ${L(i)} to be empty array or undefined`,t)}function _b(i,t){y.isNonEmptyArrayOrUndefined(i)||V(`Expected ${L(i)} to be non-empty array or undefined`,t)}function vb(i,t){return y.isString(i)||V(`Expected ${L(i)} to be string`,t),i}function Sb(i,t){return y.isEmptyString(i)||V(`Expected ${L(i)} to be empty string`,t),i}function wb(i,t){return y.isNonEmptyString(i)||V(`Expected ${L(i)} to be non-empty string`,t),i}function Ib(i,t){return y.isStringOrUndefined(i)||V(`Expected ${L(i)} to be string or undefined`,t),i}function Tb(i,t){return y.isEmptyStringOrUndefined(i)||V(`Expected ${L(i)} to be empty string or undefined`,t),i}function Nb(i,t){return y.isNonEmptyStringOrUndefined(i)||V(`Expected ${L(i)} to be non-empty string or undefined`,t),i}function Ob(i,t){return y.isBoolean(i)||V(`Expected ${L(i)} to be boolean`,t),i}function Rb(i,t){return y.isBooleanOrUndefined(i)||V(`Expected ${L(i)} to be boolean or undefined`,t),i}function Mb(i,t){return y.isTrue(i)||V(`Expected ${L(i)} to be true`,t),i}function Eb(i,t){return y.isTrueOrUndefined(i)||V(`Expected ${L(i)} to be true or undefined`,t),i}function Db(i,t){return y.isFalse(i)||V(`Expected ${L(i)} to be false`,t),i}function kb(i,t){return y.isFalseOrUndefined(i)||V(`Expected ${L(i)} to be false or undefined`,t),i}function Lb(i,t){return y.isFunction(i)||V(`Expected ${L(i)} to be function`,t),i}function jb(i,t){return y.isFunctionOrUndefined(i)||V(`Expected ${L(i)} to be function or undefined`,t),i}function Pb(i,t,e){return y.isEnumValue(i,t)||V(`Expected ${L(i)} to be enum val`,e),i}function Fb(i,t,e){return y.isEnumValueOrUndefined(i,t)||V(`Expected ${L(i)} to be enum val or undefined`,e),i}function Bb(i,t){return y.isNumericString(i)||V(`Expected ${L(i)} to be numeric string`,t),i}function Gb(i,t){return y.isBigInt(i)||V(`Expected ${L(i)} to be BigInt`,t),i}function Vb(i,t){return y.isNumber(i)||V(`Expected ${L(i)} to be number`,t),i}function qb(i,t){return y.isSafeNumber(i)||V(`Expected ${L(i)} to be safe number`,t),i}function Wb(i,t){return y.isNumberOrUndefined(i)||V(`Expected ${L(i)} to be number or undefined`,t),i}function Ub(i,t,e){return y.isNumberEq(i,t)||V(`Expected ${L(i)} to be number equal to ${L(t)}`,e),i}function zb(i,t,e){return y.isNumberGt(i,t)||V(`Expected ${L(i)} to be number > ${L(t)}`,e),i}function Yb(i,t,e){return y.isNumberGte(i,t)||V(`Expected ${L(i)} to be number >= ${L(t)}`,e),i}function Hb(i,t,e){return y.isNumberLt(i,t)||V(`Expected ${L(i)} to be number < ${L(t)}`,e),i}function $b(i,t,e){return y.isNumberLte(i,t)||V(`Expected ${L(i)} to be number <= ${L(t)}`,e),i}function Zb(i,t,e,r){return y.isNumberBetween(i,t,e)||V(`Expected number ${L(t)} <= ${L(i)} <= ${L(e)}`,r),i}function Xb(i,t,e,r){return y.isNumberBetweenExclusive(i,t,e)||V(`Expected number ${L(t)} < ${L(i)} < ${L(e)}`,r),i}function Qb(i,t){return y.isFinite(i)||V(`Expected ${L(i)} to be finite`,t),i}function Kb(i,t){return y.isFloat(i)||V(`Expected ${L(i)} to be float`,t),i}function Jb(i,t){return y.isInteger(i)||V(`Expected ${L(i)} to be integer`,t),i}function tx(i,t){return y.isSafeInteger(i)||V(`Expected ${L(i)} to be safe integer`,t),i}function ex(i,t){return y.isIntegerOrUndefined(i)||V(`Expected ${L(i)} to be integer or undefined`,t),i}function rx(i,t,e){return y.isIntegerEq(i,t)||V(`Expected ${L(i)} to be integer equal to ${L(t)}`,e),i}function ix(i,t,e){return y.isIntegerGt(i,t)||V(`Expected ${L(i)} to be integer > ${L(t)}`,e),i}function nx(i,t,e){return y.isIntegerGte(i,t)||V(`Expected ${L(i)} to be integer >= ${L(t)}`,e),i}function ox(i,t,e){return y.isIntegerLt(i,t)||V(`Expected ${L(i)} to be integer < ${L(t)}`,e),i}function sx(i,t,e){return y.isIntegerLte(i,t)||V(`Expected ${L(i)} to be integer <= ${L(t)}`,e),i}function ax(i,t,e,r){return y.isIntegerBetween(i,t,e)||V(`Expected integer ${L(t)} <= ${L(i)} <= ${L(e)}`,r),i}function cx(i,t,e,r){return y.isIntegerBetweenExclusive(i,t,e)||V(`Expected integer ${L(t)} < ${L(i)} < ${L(e)}`,r),i}function ux(i,t){return y.isNaNValue(i)||V(`Expected ${L(i)} to be NaN`,t),NaN}function hx(i,t){return y.isInfinity(i)||V(`Expected ${L(i)} to be +-Infinity`,t),i}function lx(i,t){return y.isPosInfinity(i)||V(`Expected ${L(i)} to be +Infinity`,t),i}function dx(i,t){return y.isNegInfinity(i)||V(`Expected ${L(i)} to be -Infinity`,t),i}function px(i,t){return y.isPos(i)||V(`Expected ${L(i)} to be positive (> 0)`,t),i}function mx(i,t){return y.isNeg(i)||V(`Expected ${L(i)} to be negative (< 0)`,t),i}function fx(i,t){return y.isNonPos(i)||V(`Expected ${L(i)} to be non-positive (<= 0)`,t),i}function gx(i,t){return y.isNonNeg(i)||V(`Expected ${L(i)} to be non-negative (>= 0)`,t),i}function yx(i,t){return y.isZero(i)||V(`Expected ${L(i)} to be 0`,t),i}function bx(i,t){return y.isPosZero(i)||V(`Expected ${L(i)} to be +0`,t),i}function xx(i,t){return y.isNegZero(i)||V(`Expected ${L(i)} to be -0`,t),i}function Ax(i,t){return y.isOdd(i)||V(`Expected ${L(i)} to odd`,t),i}function Cx(i,t){return y.isEven(i)||V(`Expected ${L(i)} to even`,t),i}function _x(i,t,e){return y.isMultipleOf(i,t)||V(`Expected ${L(i)} to be divisble bu ${L(t)}`,e),i}function vx(i,t){return y.isPowerOfTwo(i)||V(`Expected ${L(i)} to be power of two`,t),i}function Sx(i,t,e){return y.isIncluded(i,t)||V(`Expected ${L(i)} to be included in ${L(t)}`,e),i}function wx(...i){let t=i.shift(),e=y.isString(i[i.length-1])?i.pop():void 0,r=y.isArray(i[0])?i.shift():void 0;return y.isIndex(t,r)||V(r===void 0?`Expected ${t} to be index`:`Expected ${t} to be index for ${L(r)}`,e),t}function Ix(i,t){return y.doesThrow(i)||V("Expected to throw",t),!0}function Tx(i,t){return y.doesNotThrow(i)||V("Expected to throw",t),!0}var Nx={};er(Nx,{accept:()=>Dx,decline:()=>kx,erase:()=>al,eraseAll:()=>Bx,isConsentPending:()=>Ex,read:()=>jx,readBool:()=>Fx,readInt:()=>Px,save:()=>Lx,setExpireDays:()=>Mx});var Bs="ConsentCookie",tr,so,eu=Gs(Bs);tr=eu==="accept"||eu==="decline"?eu:void 0;function Ox(){return typeof document=="undefined"?[]:document.cookie.split(";").map(t=>t.trim())}function su(i,t){let e=i+"="+t.toString()+";sameSite=Lax;";return so&&(e+="expires="+so.toUTCString()+";"),typeof document!="undefined"&&(document.cookie=e),t}function Gs(i,t){let e=Ox().find(r=>r.startsWith(i+"="));return e===void 0?t:e.substring(i.length+1)}function Rx(i){typeof document!="undefined"&&(document.cookie=i+"=;expires=Thu, 01 Jan 1970 00:00:00 UTC;")}function Mx(i){so=new Date,so.setDate(so.getDate()+i)}function Ex(){return tr===void 0}function Dx(){tr="accept",su(Bs,tr)}function kx(){tr="decline",su(Bs,tr)}function Lx(i,t){return tr==="accept"&&su(i,t),t}function jx(i,t){var e;return tr==="accept"&&(e=Gs(i,t))!=null?e:t}function Px(i,t){if(tr==="accept"){let e=Gs(i);return e===void 0?t:parseInt(e)}else return t}function Fx(i,t){if(tr==="accept"){let e=Gs(i);return e===void 0?t:/true|1/i.test(e)}else return t}function al(i){(tr==="accept"||i===Bs)&&Rx(i)}function Bx(){typeof document!="undefined"&&document.cookie.split(";").forEach(i=>al(i.trim().split("=")[0]))}var Vs={};er(Vs,{DPI:()=>cl,FontSize:()=>ul,HostAddress:()=>Qx,IsMobileDevice:()=>Xx,IsTouchDevice:()=>Zx,PxPerMm:()=>au,ScrollbarWidth:()=>$x,mmToPx:()=>ks,pxToMm:()=>Kx,toPx:()=>Jx});function Gx(){try{let i=document.createElement("div");i.style.width="1in",document.body.appendChild(i);let t=i.offsetWidth;return i.remove(),t||96}catch(i){return 96}}function Vx(){try{let i=document.createElement("div");i.style.visibility="hidden",i.style.width="100px",document.body.appendChild(i);let t=i.offsetWidth;i.style.overflow="scroll";let e=document.createElement("div");e.style.width="100%",i.appendChild(e);let r=e.offsetWidth;return i.parentNode&&i.parentNode.removeChild(i),t-r}catch(i){return 0}}function qx(){try{let i=document.createElement("div");i.style.cssText="display:inline-block; padding:0; line-height:1; position:absolute; visibility:hidden; font-size:1em",i.appendChild(document.createTextNode("M")),document.body.appendChild(i);let t=i.offsetHeight;return document.body.removeChild(i),t}catch(i){return 16}}function Wx(){if(typeof window=="undefined")return!1;if("ontouchstart"in window||"DocumentTouch"in window||"createTouch"in document&&"createTouchList"in document)return!0;var i=" -webkit- -moz- -o- -ms- ".split(" "),t=function(r){return window.matchMedia(r).matches},e=["(",i.join("touch-enabled),("),"heartz",")"].join("");return t(e)}function Ux(){let i=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4))}function zx(){return typeof location=="undefined"||!location.host?"localhost":`${location.protocol}//${location.host}`}var Yx=/^(mm|cm|in|inch|px|em)$/,Hx=/^([0-9\\.]+)(.*)$/,cl=Gx(),au=cl/25.4,$x=Vx(),ul=qx(),Zx=Wx(),Xx=Ux(),Qx=zx();function Kx(i){return i/au}function ks(i){return i*au}function Jx(i){if(typeof i=="number")return i;let t=NaN,e,r=i.toString().match(Hx);if(r&&r[1]){t=parseFloat(r[1]);let n=r[2]?r[2].toLowerCase():"undefined";e=Yx.test(n)?n:void 0,e||console.log("Unknown unit '"+n+"' => using 'px'.")}else t=parseFloat(i);switch(Xh.isFinite(t,"value in function toPx"),e){case"mm":return ks(t);case"cm":return ks(t)*10;case"in":case"inch":return ks(t)*25.4;case"em":return ul*t;default:case"px":return t}}var $={};er($,{Arr:()=>hl,Dom:()=>pl,Enum:()=>Jh,Math:()=>fl,Obj:()=>Kh,Str:()=>Qh});var hl={};er(hl,{arrayContains:()=>sA,chunckArray:()=>aA,duplicate:()=>eA,fillArray:()=>iA,getRangeArray:()=>oA,getSequenceArray:()=>nA,isArray:()=>je,mapRangeArray:()=>dl,mapSequenceArray:()=>ll,removeDuplicates:()=>rA,toArray:()=>tA});function tA(i){return je(i)?i:[i]}function eA(i){var t;return(t=i==null?void 0:i.slice())!=null?t:[]}function rA(i,t){return t!==void 0?i.filter((e,r,n)=>r===n.findIndex(o=>t(e,o))):i.filter((e,r,n)=>r===n.indexOf(e))}function iA(i,t){if(!Lt(t)||t<0)throw new Error("fillArray: Invalid fillCount = "+t);return new Array(t).fill(i)}function ll(i,t){if(!Lt(i)||i<0)throw new Error("mapSequenceArray: Invalid len = "+i);let e=new Array(i);for(let r=0;r<i;r++)e[r]=t(r);return e}function nA(i){return ll(i,t=>t)}function dl(i,t,e){if(!Lt(i))throw new Error("mapRangeArray: Invalid start = "+t);if(!Lt(t))throw new Error("mapRangeArray: Invalid end = "+t);let r=Math.abs(t-i)+1,n=new Array(r);for(let o=0,s=i,a=Math.sign(t-i);o<r;s+=a,o++)n[o]=e(s);return n}function oA(i,t){return dl(i,t,e=>e)}function sA(i,t){return i.indexOf(t)>=0}function aA(i,t){if(!Lt(t)||t<1)throw new Error("chunckArray: Invalid chunckSize = "+t);let e=[];for(let r=0;r<i.length;r+=t)e.push(i.slice(r,r+t));return e}var pl={};er(pl,{addClass:()=>cA,appendTo:()=>gA,getButton:()=>AA,getCanvas:()=>CA,getCanvasTextWidth:()=>wA,getDimension:()=>vA,getHeight:()=>mA,getOffset:()=>lA,getPadding:()=>_A,getWidth:()=>dA,hasClass:()=>cu,removeClass:()=>uA,removeFromParent:()=>yA,setHeight:()=>fA,setOffset:()=>hA,setRect:()=>xA,setVisibility:()=>bA,setWidth:()=>pA,styleLayoutChanged:()=>SA});function ml(i){var t;return typeof document=="undefined"?void 0:(t=document.getElementById(i))!=null?t:void 0}function Dt(i){return i===void 0?void 0:Vs.toPx(i)}function cu(i,t){return t.length===0?!1:i.classList?i.classList.contains(t):!!i.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function cA(i,t){t.length!==0&&(i.classList?i.classList.add(t):cu(i,t)||(i.className+=" "+t))}function uA(i,t){if(t.length!==0){if(i.classList)i.classList.remove(t);else if(cu(i,t)){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");i.className=i.className.replace(e," ")}}}function hA(i,t,e,r="px"){i.style.left=t+r,i.style.top=e+r}function lA(i){let{left:t,top:e}=i.getBoundingClientRect();if(typeof window!="undefined"&&(t+=window.pageXOffset,e+=window.pageYOffset),typeof document!="undefined"){let r=document.documentElement;t-=r.clientLeft,e-=r.clientTop}return{left:t,top:e}}function dA(i){if(i instanceof Window)return i.innerWidth;{let t=parseFloat(getComputedStyle(i,null).width.replace("px",""));return isNaN(t)?0:t}}function pA(i,t){i.style.width=t+"px"}function mA(i){if(i instanceof Window)return i.innerHeight;{let t=parseFloat(getComputedStyle(i,null).height.replace("px",""));return isNaN(t)?0:t}}function fA(i,t){i.style.height=t+"px"}function gA(i,t){t.appendChild(i)}function yA(i){i.remove()}function bA(i,t){i.style.display=t?"block":"none"}function xA(i,t,e,r,n,o="px"){i.style.left=t+o,i.style.top=e+o,i.style.width=r+o,i.style.height=n+o}function AA(i){let t=typeof i=="string"?ml(i):i;return t instanceof HTMLButtonElement?t:void 0}function CA(i){let t=typeof i=="string"?ml(i):i;return t instanceof HTMLCanvasElement?t:void 0}function _A(i){var s;if(!i)return{top:0,right:0,bottom:0,left:0};let t=Dt(i.paddingTop),e=Dt(i.paddingRight),r=Dt(i.paddingBottom),n=Dt(i.paddingLeft),o=((s=i.padding)!=null?s:"").toString().split(" ").filter(a=>a.length>0);switch(o.length){case 0:break;case 1:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[0])),r!=null||(r=Dt(o[0])),n!=null||(n=Dt(o[0]));break;case 2:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[0])),n!=null||(n=Dt(o[1]));break;case 3:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[2])),n!=null||(n=Dt(o[1]));break;case 4:default:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[2])),n!=null||(n=Dt(o[3]));break}return t!=null||(t=0),e!=null||(e=0),r!=null||(r=0),n!=null||(n=0),{top:t,right:e,bottom:r,left:n}}function vA(i){let t=Dt(i==null?void 0:i.left),e=Dt(i==null?void 0:i.right),r=Dt(i==null?void 0:i.top),n=Dt(i==null?void 0:i.bottom),o=Dt(i==null?void 0:i.width),s=Dt(i==null?void 0:i.height);return o===void 0&&t!==void 0&&e!==void 0&&(o=e-t),s===void 0&&r!==void 0&&n!==void 0&&(s=n-r),{left:t,top:r,width:o,height:s}}function SA(i,t){return!i&&!t?!1:!i||!t?!0:i.left!==t.left||i.top!==t.top||i.right!==t.right||i.bottom!==t.bottom||i.width!==t.width||i.height!==t.height}var no;function wA(i,t){!no&&typeof document!="undefined"&&(no=document.createElement("canvas"));let e=no==null?void 0:no.getContext("2d");return e?(e.font=t,e.measureText(i).width):0}var fl={};er(fl,{avg:()=>DA,calcNormal:()=>EA,clamp:()=>ru,cmp:()=>kA,interpolateCoord:()=>RA,interpolateY:()=>MA,isInteger:()=>Lt,isNumber:()=>kt,linearToDecibels:()=>IA,mod:()=>TA,romanize:()=>NA,sum:()=>gl,toOrdinalNumber:()=>OA});function IA(i){if(isFinite(i))return i<=0?-1/0:20*Math.log10(i);throw new Error("linearToDecibel: Invalid linearVolume = "+i)}function TA(i,t){return(i%t+t)%t}function NA(i){if(!Lt(i)||i<0)throw new Error("romanize: Invalid n = "+i);for(var t=String(+i).split(""),e=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],r="",n=3;n--;)r=(e[+t.pop()+n*10]||"")+r;return Array(+t.join("")+1).join("M")+r}function OA(i){if(!Lt(i))throw new Error("toOrdinalNumber: Invalid n = "+i);let t=i.toString(),e=Number(t.charAt(t.length-1));return i===1||i>=20&&e===1?t+"st":i===2||i>=20&&e===2?t+"nd":i===3||i>=20&&e===3?t+"rd":t+"th"}function RA(i,t,e,r,n){return{x:i+(e-i)*n,y:t+(r-t)*n}}function MA(i,t,e,r,n){let o=(n-i)/(e-i);return t+(r-t)*o}function ru(i,t,e){return Math.min(Math.max(i,t),e)}function EA(i,t,e,r){let n=e-i,s=-(r-t),a=n,c=Math.sqrt(s*s+a*a);return c>0?(s/=c,a/=c):(s=0,a=1),{nx:s,ny:a}}function gl(i){return i.reduce((t,e)=>e+t,0)}function DA(...i){return gl(i)/i.length}function kA(i,t){return i<t?-1:i>t?1:0}var Le=(i,t)=>i===t,jr=class{};var yl=class We extends jr{constructor(...t){if(super(),ft(this,"coords"),t.length<2)throw new TypeError("Vec needs minumum two coords!");this.coords=t}static vec2(t,e){return new We(t,e)}static vec3(t,e,r){return new We(t,e,r)}static zero(t){if(t<2)throw new TypeError("Vec.zero requires dimension >= 2");return new We(...Array(t).fill(0))}get dim(){return this.coords.length}get length(){return Math.hypot(...this.coords)}magnitude(){return this.length}get x(){return this.coords[0]}get y(){return this.coords[1]}get z(){if(this.coords[2]===void 0)throw new TypeError("Vec z-coord not available!");return this.coords[2]}add(...t){let e=t[0]instanceof We?t[0].coords:t;if(this.coords.length!==e.length)throw new TypeError("Coordinate length mismatch!");return new We(...this.coords.map((r,n)=>r+e[n]))}sub(...t){let e=t[0]instanceof We?t[0].coords:t;if(this.coords.length!==e.length)throw new TypeError("Coordinate length mismatch!");return new We(...this.coords.map((r,n)=>r-e[n]))}mul(t){return new We(...this.coords.map(e=>e*t))}div(t){return new We(...this.coords.map(e=>e/t))}dot(t){if(this.coords.length!==t.coords.length)throw new TypeError("Coordinate length mismatch!");return this.coords.reduce((e,r,n)=>e+r*t.coords[n],0)}distance(t){if(this.coords.length!==t.coords.length)throw new TypeError("Coordinate length mismatch!");return Math.hypot(...this.coords.map((e,r)=>e-t.coords[r]))}normalize(){let t=this.length;if(t===0)throw new TypeError("Cannot normalize zero-length vector!");return this.div(t)}static lerp(t,e,r){if(t.coords.length!==e.coords.length)throw new TypeError("Coordinate length mismatch!");if(!rn(r))throw new TypeError("Lerp t is not finite!");return t.add(e.sub(t).mul(r))}toLength(t){let e=this.length;return e===0?this:this.mul(t/e)}clamp(t,e,r){let n=this.length;if(n===0){if(t!==void 0){if(r&&r.coords.length!==this.coords.length)throw new TypeError("Coordinate length mismatch!");return(r&&r.length!==0?r.normalize():new We(1,...Array(this.coords.length-1).fill(0))).mul(t)}return this}return e!==void 0&&n>e?this.normalize().mul(e):t!==void 0&&n<t?this.normalize().mul(t):this}equals(t){return this.coords.length===t.coords.length&&this.coords.every((e,r)=>e===t.coords[r])}clone(){return new We(...this.coords)}toObject(){return{x:this.x,y:this.y,z:this.z}}[Symbol.iterator](){return this.coords[Symbol.iterator]()}toString(){return`Vec(${this.coords.join(", ")})`}},uu=class Ie{constructor(...t){if(ft(this,"x"),ft(this,"y"),ft(this,"width"),ft(this,"height"),t.length===0?this.x=this.y=this.width=this.height=0:t.length===2?(this.x=this.y=0,this.width=t[0],this.height=t[1]):(this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]),this.width<0||this.height<0)throw new Error("Rect width and height must be non-negative.")}set(...t){if(t.length===0?this.x=this.y=this.width=this.height=0:t.length===2?(this.x=this.y=0,this.width=t[0],this.height=t[1]):(this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]),this.width<0||this.height<0)throw new Error("Rect width and height must be non-negative.");return this}static fromPoints(t,e){let r=Math.min(t.x,e.x),n=Math.min(t.y,e.y),o=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return new Ie(r,n,o,s)}static fromCenter(t,e,r,n){return new Ie(t-r/2,e-n/2,r,n)}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}get center(){return{x:this.centerX,y:this.centerY}}get area(){return this.width*this.height}get isEmpty(){return this.width<=0||this.height<=0}containsPoint(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom}containsRect(t){return t.left>=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom}intersects(t){return!(t.right<this.left||t.left>this.right||t.bottom<this.top||t.top>this.bottom)}intersectionCopy(t){let e=Math.max(this.left,t.left),r=Math.max(this.top,t.top),n=Math.min(this.right,t.right),o=Math.min(this.bottom,t.bottom);return n<=e||o<=r?new Ie:new Ie(e,r,n-e,o-r)}unionCopy(t){let e=Math.min(this.left,t.left),r=Math.min(this.top,t.top),n=Math.max(this.right,t.right),o=Math.max(this.bottom,t.bottom);return new Ie(e,r,n-e,o-r)}insetCopy(t,e){return new Ie(this.x+t,this.y+e,this.width-2*t,this.height-2*e)}inflateCopy(t,e){return new Ie(this.x-t,this.y-e,this.width+2*t,this.height+2*e)}offsetInPlace(t,e){return this.x+=t,this.y+=e,this}offsetCopy(t,e){return new Ie(this.x+t,this.y+e,this.width,this.height)}scaleInPlace(t,e=t){return this.x=this.centerX-this.width*t/2,this.width*=t,this.y=this.centerY-this.height*e/2,this.height*=e,this}scaleCopy(t,e=t){return this.clone().scaleInPlace(t,e)}roundCopy(){let t=Math.round(this.left),e=Math.round(this.top),r=Math.round(this.right),n=Math.round(this.bottom);return new Ie(t,e,r-t,n-e)}floorCopy(){let t=Math.floor(this.left),e=Math.floor(this.top),r=Math.floor(this.right),n=Math.floor(this.bottom);return new Ie(t,e,r-t,n-e)}ceilCopy(){let t=Math.ceil(this.left),e=Math.ceil(this.top),r=Math.ceil(this.right),n=Math.ceil(this.bottom);return new Ie(t,e,r-t,n-e)}expandCopy(t,e){let r=Math.min(this.left,t),n=Math.min(this.top,e),o=Math.max(this.right,t),s=Math.max(this.bottom,e);return new Ie(r,n,o-r,s-n)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Ie(this.x,this.y,this.width,this.height)}toString(){return`Rect(x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height})`}toAnchoredRect(){return new G(this.left,this.right,this.top,this.bottom)}},G=class vi{constructor(...t){if(ft(this,"left"),ft(this,"anchorX"),ft(this,"right"),ft(this,"top"),ft(this,"anchorY"),ft(this,"bottom"),t.length===6)this.left=t[0],this.anchorX=t[1],this.right=t[2],this.top=t[3],this.anchorY=t[4],this.bottom=t[5];else if(t.length===4)this.left=t[0],this.right=t[1],this.anchorX=(this.left+this.right)/2,this.top=t[2],this.bottom=t[3],this.anchorY=(this.top+this.bottom)/2;else if(t.length===0)this.left=this.anchorX=this.right=0,this.top=this.anchorY=this.bottom=0;else throw new TypeError(`Invalid AnchoredRect args: ${t}`)}set(...t){if(t.length===6)this.left=t[0],this.anchorX=t[1],this.right=t[2],this.top=t[3],this.anchorY=t[4],this.bottom=t[5];else if(t.length===4)this.left=t[0],this.right=t[1],this.anchorX=(this.left+this.right)/2,this.top=t[2],this.bottom=t[3],this.anchorY=(this.top+this.bottom)/2;else if(t.length===0)this.left=this.anchorX=this.right=0,this.top=this.anchorY=this.bottom=0;else throw new TypeError(`Invalid AnchoredRect args: ${t}`);return this}static create(t,e,r,n){return new vi(t,t+r,e,e+n)}static createCentered(t,e,r,n){return new vi(t-r/2,t,t+r/2,e-n/2,e,e+n/2)}static createSections(t,e,r,n){return new vi(-t,0,e,-r,0,n)}get centerX(){return this.left+this.width/2}get centerY(){return this.top+this.height/2}get width(){return this.right-this.left}get height(){return this.bottom-this.top}get leftw(){return this.anchorX-this.left}get rightw(){return this.right-this.anchorX}get toph(){return this.anchorY-this.top}get bottomh(){return this.bottom-this.anchorY}contains(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom}static overlap(t,e){return t.right>e.left&&t.left<e.right&&t.bottom>e.top&&t.top<e.bottom}static overlapX(t,e){return t.right>e.left&&t.left<e.right}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.left===e.left&&t.anchorX===e.anchorX&&t.right===e.right&&t.top===e.top&&t.anchorY===e.anchorY&&t.bottom===e.bottom}equals(t){return vi.equals(this,t)}static equalsEdges(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.left===e.left&&t.right===e.right&&t.top===e.top&&t.bottom===e.bottom}equalsEdges(t){return vi.equalsEdges(this,t)}clone(){return new vi(this.left,this.anchorX,this.right,this.top,this.anchorY,this.bottom)}offsetInPlace(t,e){return this.left+=t,this.anchorX+=t,this.right+=t,this.top+=e,this.anchorY+=e,this.bottom+=e,this}offsetCopy(t,e){return this.clone().offsetInPlace(t,e)}expandInPlace(t){return this.left=Math.min(this.left,t.left),this.right=Math.max(this.right,t.right),this.top=Math.min(this.top,t.top),this.bottom=Math.max(this.bottom,t.bottom),this}expandCopy(t){return this.clone().expandInPlace(t)}clipInPlace(t){return this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.anchorX=ru(this.anchorX,this.left,this.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this.anchorY=ru(this.anchorY,this.top,this.bottom),this}clipCopy(t){return this.clone().clipInPlace(t)}scaleInPlace(t,e=t){return this.left=this.anchorX-this.leftw*t,this.right=this.anchorX+this.rightw*t,this.top=this.anchorY-this.toph*e,this.bottom=this.anchorY+this.bottomh*e,this}scaleCopy(t,e=t){return this.clone().scaleInPlace(t,e)}getRect(){return this}toRect(){return new uu(this.left,this.right,this.width,this.height)}toString(){return`Rect(left=${this.left}, anchorX=${this.anchorX}, right=${this.right}, top=${this.top}, anchorY=${this.anchorY}, bottom=${this.bottom})`}},bl=class extends jr{constructor(i,t=1/0){super(),ft(this,"cache"),ft(this,"next"),ft(this,"prev"),ft(this,"head"),ft(this,"tail"),ft(this,"capacity"),ft(this,"size"),ft(this,"maxKeyLength"),this.cache=Object.create(null),this.next=Object.create(null),this.prev=Object.create(null),this.head=null,this.tail=null,this.capacity=i,this.size=0,this.maxKeyLength=t}get(i){if(!(i.length>this.maxKeyLength)&&this.cache[i]!==void 0)return this.touch(i),this.cache[i]}set(i,t){if(!(i.length>this.maxKeyLength)){if(this.cache[i]!==void 0){this.cache[i]=t,this.touch(i);return}this.size>=this.capacity&&this.evict(),this.cache[i]=t,this.addToTail(i),this.size++}}touch(i){this.tail!==i&&(this.removeKey(i),this.addToTail(i))}evict(){if(this.head!==null){let i=this.head;this.removeKey(i),delete this.cache[i],this.size--}}removeKey(i){let t=this.prev[i],e=this.next[i];t!==void 0?this.next[t]=e:this.head=e!=null?e:null,e!==void 0?this.prev[e]=t:this.tail=t!=null?t:null,delete this.prev[i],delete this.next[i]}addToTail(i){this.tail!==null?(this.next[this.tail]=i,this.prev[i]=this.tail):this.head=i,this.tail=i}*keys(){for(let i=this.head;i!=null;i=this.next[i])yield i}*values(){for(let i=this.head;i!=null;i=this.next[i])yield this.cache[i]}*entries(){for(let i=this.head;i!=null;i=this.next[i])yield[i,this.cache[i]]}*[Symbol.iterator](){yield*pe(this.entries())}toString(){let i=[...this.entries()];return i.length===0?"LRUCache(0){ }":`LRUCache(${i.length}){ ${i.map(t=>`${Gt(t[0])}: ${Gt(t[1])}`).join(", ")} }`}},vr=class Kr extends jr{constructor(t){if(super(),ft(this,"posVal"),ft(this,"hasPos"),ft(this,"valCount"),t instanceof Kr)this.posVal=t.posVal.slice(),this.hasPos=t.hasPos.slice(),this.valCount=t.valCount;else if(this.posVal=[],this.hasPos=[],this.valCount=0,t)for(let[e,r]of t)this.set(e,r)}static validateIndex(t){if(!nu(t,0))throw new Error(`Invalid index ${t} - must be an integer >= 0!`);return t}get posLen(){return this.hasPos.length}get size(){return this.valCount}get length(){return this.hasPos.length}trimRight(){let t=this.length;for(;t>0&&this.hasPos[t-1]!==!0;)t--;t<this.length&&(this.posVal.length=this.hasPos.length=t)}isEmpty(){return this.size===0}has(t){return Kr.validateIndex(t),this.hasPos[t]===!0}set(t,e){Kr.validateIndex(t),this.hasPos[t]!==!0&&this.valCount++,this.posVal[t]=e,this.hasPos[t]=!0}get(t){return Kr.validateIndex(t),this.hasPos[t]?this.posVal[t]:void 0}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){return Kr.validateIndex(t),this.hasPos[t]?(this.posVal[t]=void 0,this.hasPos[t]=!1,this.valCount--,this.trimRight(),!0):!1}clear(){this.posVal=[],this.hasPos=[],this.valCount=0}forEach(t,e){for(let[r,n]of this.entries())t.call(e,n,r,this)}*indices(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield t)}*values(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield this.posVal[t])}*entries(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield[t,this.posVal[t]])}indicesArray(){return[...this.indices()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.indices())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Kr(this)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.entries())if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.entries())if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.entries())t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty IndexArray with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapToArray(t){let e=[];for(let[r,n]of this.entries())e.push(t(n,r));return e}map(t){let e=new Kr;for(let[r,n]of this.entries())e.set(r,t(n,r));return e}equals(t,e){if(this.size!==t.size)return!1;e!=null||(e=(n,o)=>n===o);let r=Math.max(this.posLen,t.posLen);for(let n=0;n<r;++n){let o=this.hasPos[n],s=t.hasPos[n];if(o!==s||o&&!e(this.posVal[n],t.posVal[n]))return!1}return!0}toArray(){return this.valuesArray()}toString(){let t=!0;for(let r=0;r<this.hasPos.length&&t;r++)this.hasPos[r]||(t=!1);if(t)return Gt(this.posVal.slice(0,this.hasPos.length));let e=this.entriesArray().map(([r,n])=>`${Gt(r)}: ${Gt(n)}`).join(", ");return e.length===0?"[ ]":`[ ${e} ]`}},xl=class Te extends jr{constructor(t){if(super(),ft(this,"posVal"),ft(this,"hasPos"),ft(this,"negVal"),ft(this,"hasNeg"),ft(this,"valCount"),t instanceof Te)this.negVal=t.negVal.slice(),this.hasNeg=t.hasNeg.slice(),this.posVal=t.posVal.slice(),this.hasPos=t.hasPos.slice(),this.valCount=t.valCount;else if(this.negVal=[],this.hasNeg=[],this.posVal=[],this.hasPos=[],this.valCount=0,t)for(let[e,r]of t)this.set(e,r)}static toNegIndex(t){return-t-1}static validateIndex(t){if(!Lt(t))throw new Error(`Invalid index ${t} - must be an integer!`);return t}get size(){return this.valCount}isEmpty(){return this.size===0}get posLen(){return this.hasPos.length}get negLen(){return this.hasNeg.length}has(t){return Te.validateIndex(t),t>=0?this.hasPos[t]===!0:this.hasNeg[Te.toNegIndex(t)]===!0}set(t,e){if(Te.validateIndex(t),t>=0)this.hasPos[t]!==!0&&this.valCount++,this.posVal[t]=e,this.hasPos[t]=!0;else{let r=Te.toNegIndex(t);this.hasNeg[r]!==!0&&this.valCount++,this.negVal[r]=e,this.hasNeg[r]=!0}}get(t){if(Te.validateIndex(t),t>=0)return this.hasPos[t]?this.posVal[t]:void 0;{let e=Te.toNegIndex(t);return this.hasNeg[e]?this.negVal[e]:void 0}}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){Te.validateIndex(t);let e=t>=0,r=e?this.posVal:this.negVal,n=e?this.hasPos:this.hasNeg,o=e?t:Te.toNegIndex(t);return n[o]?(r[o]=void 0,n[o]=!1,this.valCount--,!0):!1}clear(){this.negVal=[],this.hasNeg=[],this.posVal=[],this.hasPos=[],this.valCount=0}forEach(t,e){for(let[r,n]of this.entries())t.call(e,n,r,this)}*indices(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield Te.toNegIndex(t));for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield t)}*values(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield this.negVal[t]);for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield this.posVal[t])}*entries(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield[Te.toNegIndex(t),this.negVal[t]]);for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield[t,this.posVal[t]])}indicesArray(){return[...this.indices()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.indices())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Te(this)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.entries())if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.entries())if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.entries())t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty SignedIndexArray with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapToArray(t){let e=[];for(let[r,n]of this.entries())e.push(t(n,r));return e}map(t){let e=new Te;for(let[r,n]of this.entries())e.set(r,t(n,r));return e}equals(t,e){if(this.size!==t.size)return!1;e!=null||(e=(o,s)=>o===s);let r=Math.max(this.posLen,t.posLen);for(let o=0;o<r;++o){let s=this.hasPos[o],a=t.hasPos[o];if(s!==a||s&&!e(this.posVal[o],t.posVal[o]))return!1}let n=Math.max(this.negLen,t.negLen);for(let o=0;o<n;++o){let s=this.hasNeg[o],a=t.hasNeg[o];if(s!==a||s&&!e(this.negVal[o],t.negVal[o]))return!1}return!0}toArray(){return this.valuesArray()}toString(){let t=this.hasNeg.length===0;for(let r=0;r<this.hasPos.length&&t;r++)this.hasPos[r]||(t=!1);if(t)return Gt(this.posVal.slice(0,this.hasPos.length));let e=this.entriesArray().map(([r,n])=>`${Gt(r)}: ${Gt(n)}`).join(", ");return e.length===0?"[ ]":`[ ${e} ]`}};var lt=class oo extends jr{constructor(...t){super(),ft(this,"map"),ft(this,"keyEquals");let e=t.at(-1);this.keyEquals=_r(e)?t.pop():Le;let r=t[0];this.map=new Map(r)}static createDeep(t){return t?new oo(t,ao):new oo(ao)}has(t){if(this.keyEquals===Le||this.map.has(t))return this.map.has(t);for(let[e,r]of this.map)if(this.keyEquals(e,t))return!0;return!1}set(t,e){if(this.keyEquals===Le||this.map.has(t))return this.map.set(t,e),e;for(let r of this.map.keys())if(this.keyEquals(r,t))return this.map.set(r,e),e;return this.map.set(t,e),e}get(t){if(this.keyEquals===Le||this.map.has(t))return this.map.get(t);for(let[e,r]of this.map)if(this.keyEquals(e,t))return r}delete(t){if(this.keyEquals===Le||this.map.has(t))return this.map.delete(t);for(let e of this.map.keys())if(this.keyEquals(e,t))return this.map.delete(e);return this.map.delete(t)}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r)}return this.get(t)}clear(){this.map.clear()}get size(){return this.map.size}isEmpty(){return this.size===0}forEach(t,e){this.map.forEach((r,n)=>t.call(e,r,n,this))}*keys(){yield*pe(this.map.keys())}*values(){yield*pe(this.map.values())}*entries(){for(let[t,e]of this.map)yield[t,e]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.keys())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new oo(this,this.keyEquals)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.map)if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.map)if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map)t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty UniMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map)e.push(t(n,r));return e}mapValues(t){let e=new oo;for(let[r,n]of this.map)e.set(r,t(n,r));return e}toMap(){return new Map(this.map)}toString(){let t=[...this.map].map(([e,r])=>`${Gt(e)} => ${Gt(r)}`).join(", ");return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t} }`}},Al=class Ls extends jr{constructor(t){if(super(),ft(this,"map1"),ft(this,"key1Equals",Le),ft(this,"key2Equals",Le),this.map1=new lt(this.key1Equals),t instanceof Ls)for(let[e,r]of t.map1){let n=this.map1.set(e,new lt(this.key2Equals));for(let[o,s]of r)n.set(o,s)}else if(t)for(let[e,r,n]of t)this.set(e,r,n)}has(t,e){var r,n;return(n=(r=this.map1.get(t))==null?void 0:r.has(e))!=null?n:!1}set(t,e,r){return this.map1.getOrCreate(t,()=>new lt(this.key2Equals)).set(e,r)}get(t,e){var r;return(r=this.map1.get(t))==null?void 0:r.get(e)}getOrDefault(t,e,r){var n;return(n=this.get(t,e))!=null?n:r}getOrCreate(t,e,r){if(!this.has(t,e)){let n=_r(r)?r():r;return this.set(t,e,n),n}return this.get(t,e)}delete(t,e){if(e===void 0)return this.map1.delete(t);let r=this.map1.get(t);return r?r.delete(e):!1}clear(){this.map1.clear()}get size(){let t=0;for(let e of this.map1.values())t+=e.size;return t}isEmpty(){return this.size===0}forEach(t,e){this.map1.forEach((r,n)=>r.forEach((o,s)=>t.call(e,o,n,s,this)))}*keys(){for(let[t,e]of this.map1)for(let r of e.keys())yield[t,r]}*values(){for(let t of this.map1.values())for(let e of t.values())yield e}*entries(){for(let[t,e]of this.map1)for(let[r,n]of e)yield[t,r,n]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let[t,e]of this.keys())yield[t,e]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e,r]of this.entries())yield[[t,e],r]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Ls(this)}merge(t,e){for(let[r,n,o]of t.entries())this.has(r,n)&&e?this.set(r,n,e(this.get(r,n),o,r,n)):this.set(r,n,o);return this}some(t){for(let[e,r]of this.map1)for(let[n,o]of r)if(t(o,e,n))return!0;return!1}every(t){for(let[e,r]of this.map1)for(let[n,o]of r)if(!t(o,e,n))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map1)for(let[o,s]of n)t(s,r,o,this)&&e.set(r,o,s);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty BiMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[2],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u,h]=a.value;o=t(o,h,c,u)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map1)for(let[o,s]of n)e.push(t(s,r,o));return e}mapValues(t){let e=new Ls;for(let[r,n]of this.map1)for(let[o,s]of n)e.set(r,o,t(s,r,o));return e}toMap(){let t=new Map;for(let[e,r]of this.map1)for(let[n,o]of r)t.set([e,n],o);return t}toString(){let t=[];for(let[e,r]of this.map1){let n=[...r].map(([o,s])=>`${Gt(o)} => ${Gt(s)}`).join(", ");t.push(`${Gt(e)} => { ${n} }`)}return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t} }`}},qs=class js extends jr{constructor(t){if(super(),ft(this,"map1"),ft(this,"key1Equals",Le),ft(this,"key2Equals",Le),ft(this,"key3Equals",Le),this.map1=new lt(this.key1Equals),t instanceof js)for(let[e,r]of t.map1){let n=this.map1.set(e,new lt(this.key2Equals));for(let[o,s]of r)n.set(o,new lt(s,this.key3Equals))}else if(t)for(let[e,r,n,o]of t)this.set(e,r,n,o)}has(t,e,r){var n,o,s;return(s=(o=(n=this.map1.get(t))==null?void 0:n.get(e))==null?void 0:o.has(r))!=null?s:!1}set(t,e,r,n){return this.map1.getOrCreate(t,()=>new lt(this.key2Equals)).getOrCreate(e,()=>new lt(this.key3Equals)).set(r,n),n}get(t,e,r){var n,o;return(o=(n=this.map1.get(t))==null?void 0:n.get(e))==null?void 0:o.get(r)}getOrDefault(t,e,r,n){var o;return(o=this.get(t,e,r))!=null?o:n}getOrCreate(t,e,r,n){if(!this.has(t,e,r)){let o=_r(n)?n():n;return this.set(t,e,r,o),o}return this.get(t,e,r)}delete(t,e,r){var n;if(r===void 0){if(e===void 0)return this.map1.delete(t);let o=this.map1.get(t);return o?o.delete(e):!1}else{if(e===void 0)return this.map1.delete(t);let o=(n=this.map1.get(t))==null?void 0:n.get(e);return o?o.delete(r):!1}}clear(){this.map1.clear()}get size(){let t=0;for(let e of this.map1.values())for(let r of e.values())t+=r.size;return t}isEmpty(){return this.size===0}forEach(t,e){this.map1.forEach((r,n)=>r.forEach((o,s)=>o.forEach((a,c)=>t.call(e,a,n,s,c,this))))}*keys(){for(let[t,e]of this.map1)for(let[r,n]of e)for(let o of n.keys())yield[t,r,o]}*values(){for(let t of this.map1.values())for(let e of t.values())for(let r of e.values())yield r}*entries(){for(let[t,e]of this.map1)for(let[r,n]of e)for(let[o,s]of n)yield[t,r,o,s]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let[t,e,r]of this.keys())yield[t,e,r]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e,r,n]of this.entries())yield[[t,e,r],n]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new js(this)}merge(t,e){for(let[r,n,o,s]of t.entries())this.has(r,n,o)&&e?this.set(r,n,o,e(this.get(r,n,o),s,r,n,o)):this.set(r,n,o,s);return this}some(t){for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)if(t(a,e,n,s))return!0;return!1}every(t){for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)if(!t(a,e,n,s))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)t(c,r,o,a,this)&&e.set(r,o,a,c);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty TriMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[3],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u,h,l]=a.value;o=t(o,l,c,u,h)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)e.push(t(c,r,o,a));return e}mapValues(t){let e=new js;for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)e.set(r,o,a,t(c,r,o,a));return e}toMap(){let t=new Map;for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)t.set([e,n,s],a);return t}toString(){let t=[];for(let[e,r]of this.map1)for(let[n,o]of r){let s=[...o].map(([a,c])=>`${Gt(a)} => ${Gt(c)}`).join(", ");t.push(`${Gt(e)} => ${Gt(n)} => { ${s} }`)}return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t.join(", ")} }`}},Ws=class Si extends jr{constructor(...t){super(),ft(this,"data"),ft(this,"equals");let e=t.at(-1);this.equals=_r(e)?t.pop():Le;let r=t[0];this.data=new Set(r)}static createDeep(t){return t?new Si(t,ao):new Si(ao)}has(t){return this.equals===Le?this.data.has(t):this.some(e=>this.equals(e,t))}add(t){return this.has(t)||this.data.add(t),t}set(t,e){if(!this.equals(t,e))throw new TypeError("ValueSet.set() requires key === value.");this.add(e)}get(t){return this.has(t)?t:void 0}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){if(this.equals===Le||this.data.has(t))return this.data.delete(t);for(let e of this.values())if(this.equals(e,t))return this.data.delete(e),!0;return!1}clear(){this.data.clear()}get size(){return this.data.size}isEmpty(){return this.size===0}forEach(t,e){this.data.forEach(r=>t.call(e,r,this))}*keys(){yield*pe(this.data.keys())}*values(){yield*pe(this.data.values())}*entries(){yield*pe(this.data.entries())}*kvKeys(){for(let t of this.keys())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.values())}clone(){let t=new Si;for(let e of this.values())t.add(e);return t}merge(t){for(let e of t.values())this.add(e);return this}some(t){for(let e of this.data)if(t(e))return!0;return!1}every(t){for(let e of this.data)if(!t(e))return!1;return!0}filter(t){let e=new Si;for(let r of this.data)t(r,this)&&e.add(r);return e}reduce(t,e){let r=this.values(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty ValueSet with no initial value!");return e}let o,s;arguments.length<2?(o=n.value,s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let c=a.value;o=t(o,c)}return o}mapValues(t){let e=new Si;for(let r of this.data)e.add(t(r));return e}mapToArray(t){let e=[];for(let r of this.values())e.push(t(r));return e}map(t){let e=new Si;for(let r of this.values())e.add(t(r));return e}toSet(){return new Set(this.data)}toArray(){return[...this.values()]}toString(){return Gt(this.data)}},LA=class extends jr{constructor(i){super(),this.base=i}isEmpty(){return this.base.isEmpty()}clear(){var i,t;(t=(i=this.base).clear)==null||t.call(i)}add(...i){let t=i.slice(0,-1),e=i[i.length-1],r=this.base.get(...t);return this.base.set(...t,r?[...r,e]:[e]),e}remove(...i){let t=i.slice(0,-1),e=i[i.length-1],r=this.base.get(...t);if(!r)return!1;let n=r.indexOf(e);return n===-1?!1:(r.splice(n,1),r.length===0&&this.base.delete(...t),!0)}getAll(...i){var t;return(t=this.base.get(...i))!=null?t:[]}*iterAll(...i){yield*pe(this.getAll(...i))}*values(){for(let i of this.keys())yield*pe(this.getAll(...i))}*keys(){for(let i of this.base.kvKeys())yield i}*entries(){for(let i of this.keys()){let t=this.getAll(...i);t.length>0&&(yield[i,t])}}[Symbol.iterator](){return this.entries()}toString(){let i=[];for(let t of this.keys()){let e=this.getAll(...t),r=Array.isArray(t)?Gt(t):"[ ]",n=Array.isArray(e)?Gt(e):"[ ]";i.push(`${r} => ${n}`)}return i.length===0?"MultiContainer{ }":`MultiContainer{ ${i.join(", ")} }`}};function Us(i){return new LA(i)}var hu={};en(hu,{MusicError:()=>N,MusicErrorType:()=>_t,init:()=>Ii});var _t=(c=>(c[c.Unknown=0]="Unknown",c[c.InvalidArg=1]="InvalidArg",c[c.Note=2]="Note",c[c.Scale=3]="Scale",c[c.KeySignature=4]="KeySignature",c[c.Timesignature=5]="Timesignature",c[c.Score=6]="Score",c[c.Audio=7]="Audio",c))(_t||{});function jA(i){return i===void 0?"":`[${_t[i]}] `}var N=class extends Error{constructor(...e){let[r,n]=e.length===1?[0,e[0]]:e;super(jA(r)+n);d(this,"type");Object.setPrototypeOf(this,new.target.prototype),this.name="MusicError",this.type=r}};var Cl=!1;function Ii(){Cl||(Cl=!0,console.log("%cWebMusicScore v6.0.0-pre.1 (iife) initialized.","background: black; color: white; padding: 2px;"))}var Jr=(e=>(e[e.Ascii=0]="Ascii",e[e.Unicode=1]="Unicode",e))(Jr||{}),ti=(e=>(e[e.Scientific=0]="Scientific",e[e.Helmholtz=1]="Helmholtz",e))(ti||{}),PA=$.Enum.getEnumValues(ti),FA=0;function _l(i){if(y.isEnumValue(i,ti))return i;throw new N(1,`Invalid pitchNotation: ${i}`)}function BA(i){return ti[_l(i)]}var zs=(r=>(r.Default="Default",r.OmitOctave="Omit Octave",r.Interval="Interval",r))(zs||{}),GA="Default",VA=$.Enum.getEnumValues(zs);function qA(i){if(y.isEnumValue(i,zs))return i;throw new N(5,`Invalid guitarNoteLabel: ${i}`)}function vl(i,t){return(i%t+t)%t}var Sl=12,wl=7,WA=new Map([[-2,"bb"],[-1,"b"],[0,""],[1,"#"],[2,"x"]]),UA=new Map([[-2,"\u{1D12B}"],[-1,"\u266D"],[0,""],[1,"\u266F"],[2,"\u{1D12A}"]]),Il=new Map([["",0],["bb",-2],["b",-1],["#",1],["x",2],["\u{1D12B}",-2],["\u266D",-1],["\u266F",1],["\u{1D12A}",2]]),co=["C","D","E","F","G","A","B"],Tl=[0,2,4,5,7,9,11],Nl=/^([A-G])((?:bb|𝄫|♭|b|#|♯|x|𝄪)?)?(-?\d+)?$/,dt=class dt{constructor(t,e,r){d(this,"diatonicClass");d(this,"accidental");d(this,"octave");if(typeof t=="number"&&typeof e=="number"&&r===void 0)dt.validateDiatonicId(t),this.diatonicClass=dt.getDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.getOctaveFromDiatonicId(t);else if(typeof t=="number"&&typeof e=="number"&&typeof r=="number")this.diatonicClass=dt.validateDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.validateOctave(r);else if(typeof t=="string"&&typeof e=="number"&&typeof r=="number")this.diatonicClass=dt.getDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.validateOctave(r);else throw new N(2,`Invalid args: ${t}, ${e}, ${r}`)}get diatonicId(){return dt.getDiatonicIdInOctave(this.diatonicClass,this.octave)}get chromaticId(){return dt.getChromaticIdInOctave(Tl[this.diatonicClass]+this.accidental,this.octave)}get midiNumber(){return this.chromaticId}get chromaticClass(){return dt.getChromaticClass(Tl[this.diatonicClass]+this.accidental)}get noteLetter(){return co[this.diatonicClass]}format(t,e){let{noteLetter:r,octave:n}=this,o=dt.getAccidentalSymbol(this.accidental,e);return t===1?n>=3?r.toLowerCase()+o+"\u2032".repeat(n-3):r.toUpperCase()+o+"\u0375".repeat(2-n):r+o+n}formatOmitOctave(t){let e=co[this.diatonicClass],r=dt.getAccidentalSymbol(this.accidental,t);return e+r}static getNote(t){return this.noteCache.getOrCreate(t,()=>{let e=dt.parseNote(t);if(!e)throw new N(2,`Invalid note "${t}".`);if(e.octave===void 0)throw new N(2,`Invalid note "${t}" (missing octave).`);return new dt(e.noteLetter,e.accidental,e.octave)})}static isNote(t){let e=dt.parseNote(t);return e!==void 0&&e.octave!==void 0}static validateNote(t){if(this.isNote(t))return!0;throw new N(2,`Invalid note "${t}"`)}static getChromaticNote(t){return this.chromaticNoteCache.getOrCreate(t,()=>{let r=["C/B#","C#/Db","D","D#/Eb","E/Fb","F/E#","F#/Gb","G","G#/Ab","A","A#/Bb","B/Cb"][dt.getChromaticClass(t)].split("/")[0]+dt.getOctaveFromChromaticId(t);return dt.getNote(r)})}static getDiatonicClass(t){if(typeof t=="number")return vl(t,7);if(typeof t=="string"&&t.length>0)return co.indexOf(dt.validateNoteLetter(t[0]));throw new N(2,`Invalid arg: ${t}`)}static getOctaveFromDiatonicId(t){return Math.floor((t-wl)/7)}static getDiatonicIdInOctave(t,e){return dt.getDiatonicClass(t)+e*7+wl}static getChromaticClass(t){return vl(t,12)}static getOctaveFromChromaticId(t){return Math.floor((t-Sl)/12)}static getChromaticIdInOctave(t,e){return dt.getChromaticClass(t)+e*12+Sl}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.diatonicId===e.diatonicId&&t.accidental===e.accidental}static replaceAccidentalSymbols(t,e){return e===1?t.replace("bb","\u{1D12B}").replace("b","\u266D").replace("#","\u266F").replace("x","\u{1D12A}"):t.replace("\u{1D12B}","bb").replace("\u266D","b").replace("\u266F","#").replace("\u{1D12A}","x")}static isValidNoteName(t){return Nl.test(t)}static parseNote(t){var c;let e=Nl.exec(t);if(!e)return;let r=dt.validateNoteLetter(e[1]),n=e[2],o=dt.validateAccidental((c=Il.get(n))!=null?c:0),s=e[3],a=s?dt.validateOctave(+s):void 0;return{noteLetter:r,accidental:o,octave:a}}static getScientificNoteName(t,e){let r=dt.parseNote(t);if(!r)throw new N(2,`Invalid noteName: ${t}`);let{noteLetter:n,accidental:o,octave:s}=r;return n+dt.getAccidentalSymbol(o,e)+(s!=null?s:"")}static getAccidentalSymbol(t,e){return e===1?UA.get(t):WA.get(t)}static getAccidental(t){let e=Il.get(t);if(e===void 0)throw new N(2,`Invalid accidental: ${t}`);return e}static getNoteLetter(t){return co[dt.getDiatonicClass(t)]}static findNextDiatonicIdAbove(t,e,r){let n=dt.getDiatonicClass(t),o=dt.getDiatonicClass(e),s=r?n<=o?1:0:n<o?1:0;return dt.getDiatonicIdInOctave(n,dt.getOctaveFromDiatonicId(e)+s)}static validateDiatonicId(t){if(y.isInteger(t))return t;throw new N(2,`Invalid diatonicId: ${t}`)}static validateDiatonicClass(t){if(y.isIntegerBetween(t,0,6))return t;throw new N(2,`Invalid diatonicClass: ${t}`)}static validateChromaticId(t){if(y.isInteger(t))return t;throw new N(2,`Invalid chromaticId: ${t}`)}static validatechromaticClass(t){if(y.isIntegerBetween(t,0,11))return t;throw new N(2,`Invalid chromaticClass: ${t}`)}static validateNoteLetter(t){if(co.some(e=>e===t))return t;throw new N(2,`Invalid note: ${t}`)}static validateOctave(t){if(y.isInteger(t))return t;throw new N(2,`Invalid octave: ${t}`)}static validateAccidental(t){if(y.isIntegerBetween(t,-2,2))return t;throw new N(2,`Invalid accidental: ${t}`)}static sort(t){return t.slice().sort(dt.compareFunc)}static removeDuplicates(t){let e=[];return t.forEach(r=>{e.find(n=>dt.equals(r,n))===void 0&&e.push(r)}),e}static compareFunc(t,e){return t.diatonicId<e.diatonicId?-1:t.diatonicId>e.diatonicId?1:t.accidental<e.accidental?-1:t.accidental>e.accidental?1:0}};d(dt,"noteCache",new lt),d(dt,"chromaticNoteCache",new lt);var U=dt;function zA(i,t){let e=U.getChromaticClass(i)-new U(t,0).chromaticClass;for(;e>2;)e-=12;for(;e<-2;)e+=12;return U.validateAccidental(e)}var YA=/^(bb?|b?|#?|x?)([0-9]*)$/;function HA(i){var n,o;let t=YA.exec(""+i);if(!t)throw new N(4,`Invalid degree: ${i}`);let e=(o=U.getAccidental((n=t[1])!=null?n:""))!=null?o:0,r=+t[2];if(!y.isInteger(e)||e<-2||e>2||!y.isInteger(r)||r<1)throw new N(4,`Invalid degree: ${i}`);return{deg:r,acc:e}}var lu=(a=>(a[a.Ionian=1]="Ionian",a[a.Dorian=2]="Dorian",a[a.Phrygian=3]="Phrygian",a[a.Lydian=4]="Lydian",a[a.Mixolydian=5]="Mixolydian",a[a.Aeolian=6]="Aeolian",a[a.Locrian=7]="Locrian",a))(lu||{}),du=(r=>(r[r.Natural=0]="Natural",r[r.Flats=1]="Flats",r[r.Sharps=2]="Sharps",r))(du||{});function Ys(){return Pr("C","Major")}var ei=class ei{constructor(t,e){this.tonic=t;this.mode=e;d(this,"naturalScaleNotes");d(this,"accidentalByDiatonicClass");d(this,"orderedAccidentedNotes");if(!y.isEnumValue(e,lu))throw new N(4,`Invalid mode: ${e}`);let r=[2,2,1,2,2,2,1];for(let c=1;c<e;c++)r.push(r.shift());this.naturalScaleNotes=[],this.accidentalByDiatonicClass=[];let n=U.getDiatonicClass(t[0]),o=U.getNote(t+"0").chromaticId;for(let c=0;c<7;n++,o+=r[c],c++){let u=new U(U.getDiatonicClass(n),zA(o,n));if(Math.abs(u.accidental)>=2)throw new N(4,"Key signature contains double accidental.");this.naturalScaleNotes[c]=u,this.accidentalByDiatonicClass[u.diatonicClass]=u.accidental}let s=this.naturalScaleNotes.filter(c=>c.accidental>0).sort((c,u)=>{let h=ei.OrderOfSharps.indexOf(c.noteLetter),l=ei.OrderOfSharps.indexOf(u.noteLetter);if(h===-1||l===-1)throw new N(4,"Unexpected note in key signature.");return h-l}),a=this.naturalScaleNotes.filter(c=>c.accidental<0).sort((c,u)=>{let h=ei.OrderOfFlats.indexOf(c.noteLetter),l=ei.OrderOfFlats.indexOf(u.noteLetter);if(h===-1||l===-1)throw new N(4,"Unexpected note in key signature.");return h-l});if(s.length!==0&&a.length!==0)throw new N(4,"Key Signature has both sharps and flats.");this.orderedAccidentedNotes=a.length>0?a:s}getAccidentalType(){return this.orderedAccidentedNotes.length===0?0:this.orderedAccidentedNotes[0].accidental<0?1:2}getNaturalScaleNotes(){return this.naturalScaleNotes}getAccidental(t){var e;return(e=this.accidentalByDiatonicClass[U.getDiatonicClass(t)])!=null?e:0}getNumAccidentals(){return this.orderedAccidentedNotes.length}getOrderedAccidentalNotes(){return this.orderedAccidentedNotes}getNoteByDegree(t){let{deg:e,acc:r}=HA(t);if(r===0)return this.naturalScaleNotes[(e-1)%7];{let n=this.naturalScaleNotes[(e-1)%7];return new U(n.diatonicId,n.accidental+r)}}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.tonic===e.tonic&&t.mode===e.mode}};d(ei,"OrderOfSharps","FCGDAEB"),d(ei,"OrderOfFlats","BEADGCF");var rr=ei;var $A=new lt([["Major","M"],["minor","m"],["Perfect","P"],["diminished","d"],["Augmented","A"],["doubly diminished","dd"],["Doubly Augmented","AA"]]),ZA={1:{0:"Perfect",1:"Augmented","-1":"diminished",2:"Doubly Augmented","-2":"doubly diminished"},2:{2:"Major",1:"minor",3:"Augmented",0:"diminished",4:"Doubly Augmented","-1":"doubly diminished"},3:{4:"Major",3:"minor",5:"Augmented",2:"diminished",6:"Doubly Augmented",1:"doubly diminished"},4:{5:"Perfect",6:"Augmented",4:"diminished",7:"Doubly Augmented",3:"doubly diminished"},5:{7:"Perfect",8:"Augmented",6:"diminished",9:"Doubly Augmented",5:"doubly diminished"},6:{9:"Major",8:"minor",10:"Augmented",7:"diminished",11:"Doubly Augmented",6:"doubly diminished"},7:{11:"Major",10:"minor",12:"Augmented",9:"diminished",13:"Doubly Augmented",8:"doubly diminished"},8:{12:"Perfect",13:"Augmented",11:"diminished",14:"Doubly Augmented",10:"doubly diminished"}};function XA(i,t){for(;i<1;)i+=7,t+=12;for(;i>8;)i-=7,t-=12;let e=ZA[i];if(e)return e[t]}function QA(i){if(i==="Perfect"||i==="Major"||i==="minor"||i==="Augmented"||i==="diminished"||i==="Doubly Augmented"||i==="doubly diminished")return i;throw new N(1,`Invalid interval quality: ${i}`)}function KA(i){if(y.isIntegerGte(i,1))return $.Math.toOrdinalNumber(i);throw new N(1,`Invalid interval quantity: ${i}`)}var Hs=class extends Error{constructor(e){super(e);this.msg=e;this.name="InvalidInterval"}},uo=class i{constructor(t,e){this.note1=t;this.note2=e;d(this,"direction");d(this,"semitones");d(this,"quantity");d(this,"quality");e.diatonicId>=t.diatonicId?(this.direction=e.diatonicId===t.diatonicId?"Unison":"Ascending",this.quantity=e.diatonicId-t.diatonicId+1,this.semitones=e.chromaticId-t.chromaticId):(this.direction="Descending",this.quantity=t.diatonicId-e.diatonicId+1,this.semitones=t.chromaticId-e.chromaticId);let r=XA(this.quantity,this.semitones);if(r)this.quality=r;else throw new Hs("Unknown interval quality")}static get(t,e){try{return new i(t,e)}catch(r){if(r instanceof Hs)return;throw r}}toString(){let t=this.direction==="Unison"?"":this.direction+" ",e=this.quality+" ",r=this.direction==="Unison"?"Unison":KA(this.quantity);return t+e+r}toAbbrString(){let t=this.direction==="Descending"?"\u2193":"",e=$A.getOrDefault(this.quality,"?"),r=this.quantity;return t+e+r}};function JA(i){let t=U.getDiatonicClass("CCDDEFFGGAAB"[U.getChromaticClass(i)]),e=U.getOctaveFromChromaticId(i);return U.getDiatonicIdInOctave(t,e)}var tC=["Cb","C","C#","Db","D","D#","Eb","E","E#","Fb","F","F#","Gb","G","G#","Ab","A","A#","Bb","B","B#"],Ti=(g=>(g.Major="Major",g.NaturalMinor="Natural Minor",g.HarmonicMinor="Harmonic Minor",g.Ionian="Ionian",g.Dorian="Dorian",g.Phrygian="Phrygian",g.Lydian="Lydian",g.Mixolydian="Mixolydian",g.Aeolian="Aeolian",g.Locrian="Locrian",g.MajorPentatonic="Major Pentatonic",g.MinorPentatonic="Minor Pentatonic",g.MajorHexatonicBlues="Major Hexatonic Blues",g.MinorHexatonicBlues="Minor Hexatonic Blues",g.HeptatonicBlues="Heptatonic Blues",g))(Ti||{});function eC(i){switch(i){case"Major":return 1;case"Natural Minor":return 6;case"Harmonic Minor":return 6;case"Ionian":return 1;case"Dorian":return 2;case"Phrygian":return 3;case"Lydian":return 4;case"Mixolydian":return 5;case"Aeolian":return 6;case"Locrian":return 7;case"Major Pentatonic":return 1;case"Minor Pentatonic":return 6;case"Major Hexatonic Blues":return 1;case"Minor Hexatonic Blues":return 6;case"Heptatonic Blues":return 1;default:throw new N(3,`Invalid scaleType: ${i}`)}}var ri=class extends rr{constructor(e,r){super(e,eC(r));this.tonic=e;this.scaleType=r;d(this,"scaleDegrees");d(this,"scaleNotes");d(this,"chromaticClassDegree");d(this,"preferredChromaticIdNoteCache",new xl);switch(r){case"Harmonic Minor":this.scaleDegrees=[1,2,3,4,5,6,"#7"];break;case"Major Pentatonic":this.scaleDegrees=[1,2,3,5,6];break;case"Minor Pentatonic":this.scaleDegrees=[1,3,4,5,7];break;case"Major Hexatonic Blues":this.scaleDegrees=[1,2,"b3",3,5,6];break;case"Minor Hexatonic Blues":this.scaleDegrees=[1,3,4,"b5",5,7];break;case"Heptatonic Blues":this.scaleDegrees=[1,2,"b3",4,"b5",6,"b7"];break;default:this.scaleDegrees=[1,2,3,4,5,6,7];break}this.scaleNotes=this.scaleDegrees.map(n=>this.getNoteByDegree(n)),this.chromaticClassDegree=[0,1,2,3,4,5,6,7,8,9,10,11].map(n=>{let o=this.scaleNotes.findIndex(s=>s.chromaticClass===n);return o>=0?this.scaleDegrees[o]:void 0})}static equals(e,r){return e==null&&r==null?!0:e==null||r==null?!1:e===r||e.getScaleName()===r.getScaleName()}getScaleName(e){switch(e){case 1:return U.getScientificNoteName(this.tonic,e)+" "+this.scaleType;default:return this.tonic+" "+this.scaleType}}getScaleNotes(e,r){if(!y.isIntegerGte(r,1))throw new N(3,`Invalid numOctaves: ${r}`);let n=[];for(let s=1;s<=r;s++)n=[...n,...this.scaleNotes];n.push(this.scaleNotes[0]);let o=U.getNote(e).diatonicId;return n.map(s=>(o=U.findNextDiatonicIdAbove(s.diatonicId,o,!1),new U(o,s.accidental)))}getScaleOverview(){return this.getScaleNotes("C4",1).map(e=>e.formatOmitOctave(1)).join(" - ")}getScaleSteps(){let e=this.getScaleNotes("C4",1).map(n=>n.chromaticId),r=[];for(let n=0;n<e.length-1;n++)r.push($.Math.mod(e[n+1]-e[n],12));return r}getScaleStringSteps(){return this.getScaleSteps().map(e=>e===1?"H":e===2?"W":e.toString()+"H")}isScaleNote(e){return this.chromaticClassDegree[e.chromaticClass]!==void 0}isScaleRootNote(e){return String(this.chromaticClassDegree[e.chromaticClass])==="1"}getIntervalFromRootNote(e){let r=this.getScaleNotes("C0",1)[0];for(;e.chromaticId>=r.chromaticId+12;)e=new U(e.diatonicClass,e.accidental,e.octave-1);if(e.chromaticId<r.chromaticId)throw new N(3,"Note is below rootNote.");let n=uo.get(r,e);if(n===void 0)throw new N(3,"Interval is undefined.");return n}getPreferredChromaticNote(e){U.validateChromaticId(e);let r=this.preferredChromaticIdNoteCache.get(e);if(r)return r;let n=U.getOctaveFromChromaticId(e);if(r=this.scaleNotes.map(l=>l.noteLetter==="C"&&l.accidental<0?new U(l.diatonicClass,l.accidental,n+1):l.noteLetter==="B"&&l.accidental>0?new U(l.diatonicClass,l.accidental,n-1):new U(l.diatonicClass,l.accidental,n)).find(l=>U.getChromaticClass(e)===l.chromaticClass),r)return this.preferredChromaticIdNoteCache.set(e,r),r;let s=JA(e),a=s-2,c=s+2,h=this.getAccidentalType()===1?[0,-1,1,-2,2]:[0,1,-1,2,-2];for(let l=0;l<h.length;l++){let p=h[l];for(let m=Math.max(0,a);m<=c;m++)if(r=new U(m,p),e===r.chromaticId)return this.preferredChromaticIdNoteCache.set(e,r),r}return r=U.getChromaticNote(e),this.preferredChromaticIdNoteCache.set(e,r),r}},ne=class{constructor(t){this.type=t;d(this,"tonicList",[]);d(this,"scaleMap",new Map);let e=[],r=[],n=[];if(tC.forEach(s=>{try{let a=new ri(s,this.type);switch(a.getAccidentalType()){case 0:e.push(a);break;case 2:if(s.endsWith("b"))return;r.push(a);break;case 1:if(s.endsWith("#"))return;n.push(a);break}this.scaleMap.set(s,a)}catch(a){}}),e.length===0)throw new N(3,"Expected natural scale.");let o=(s,a)=>s.getNumAccidentals()-a.getNumAccidentals();this.tonicList=[...e.sort(o).map(s=>s.tonic),"- Sharps -",...r.sort(o).map(s=>s.tonic),"- Flats -",...n.sort(o).map(s=>s.tonic)]}getTonicList(){return this.tonicList}getDefaultTonic(){return this.tonicList[0]}getType(){return this.type}getScale(t){let e=this.scaleMap.get(t);if(e)return e;throw new N(3,`Invalid scale: ${t} ${this.type}`)}hasScale(t){return this.scaleMap.get(t)!==void 0}},Ol=[new ne("Major"),new ne("Natural Minor"),new ne("Harmonic Minor"),"- Modes -",new ne("Ionian"),new ne("Dorian"),new ne("Phrygian"),new ne("Lydian"),new ne("Mixolydian"),new ne("Aeolian"),new ne("Locrian"),"- Pentatonic -",new ne("Major Pentatonic"),new ne("Minor Pentatonic"),"- Blues -",new ne("Major Hexatonic Blues"),new ne("Minor Hexatonic Blues"),new ne("Heptatonic Blues")];function rC(){return Ol}var Rl=new lt;Ol.forEach(i=>{i instanceof ne&&Rl.set(i.getType(),i)});function Ml(i){let t=Rl.get(i);if(t)return t;throw new N(3,`Invalid scaleType: ${i}`)}function ho(i){if(y.isEnumValue(i,Ti))return i;throw new N(3,`Invalid scaleType: "${i}"`)}function Pr(i,t){let e,r;return t!==void 0?(e=i,r=ho(t)):(e=i.split(" ")[0],r=ho(i.substring(e.length+1))),Ml(r).getScale(e)}var iC=Pr("C","Major");function nC(){return iC}var Fr=(i,t)=>i.chromaticClass===t.chromaticClass,oC=["C","C#","Db","D","Eb","E","F","F#","Gb","G","Ab","A","Bb","B","Cb"].map(i=>U.getNote(i+"0")),sC=new vr;function aC(i){return sC.getOrCreate(i.chromaticClass,()=>{let t=oC.find(e=>Fr(e,i));if(!t)throw new N(1,`Invalid chord root note: ${i.formatOmitOctave(1)}`);return t})}function cC(i,t){let e=i.formatOmitOctave(0);return Pr(e,"Major").getNoteByDegree(t)}function uC(i){return $.Arr.removeDuplicates(i,Fr)}var hC=[{name:"5",degrees:[1,5]},{name:"",degrees:[1,3,5]},{name:"m",degrees:[1,"b3",5]},{name:"dim",degrees:[1,"b3","b5"]},{name:"aug",degrees:[1,3,"#5"]},{name:"sus2",degrees:[1,2,5]},{name:"sus4",degrees:[1,4,5]},{name:"6",degrees:[1,3,5,6]},{name:"m6",degrees:[1,"b3",5,6]},{name:"m(maj7)",degrees:[1,"b3",5,7]},{name:"7",degrees:[1,3,5,"b7"]},{name:"7\u266D5",degrees:[1,3,"b5","b7"]},{name:"7\u266F5",degrees:[1,3,"#5","b7"]},{name:"7sus2",degrees:[1,2,5,"b7"]},{name:"7sus4",degrees:[1,4,5,"b7"]},{name:"dim7",degrees:[1,"b3","b5","bb7"]},{name:"maj7",degrees:[1,3,5,7]},{name:"maj7\u266D5",degrees:[1,3,"b5",7]},{name:"maj7\u266F5",degrees:[1,3,"#5",7]},{name:"m7",degrees:[1,"b3",5,"b7"]},{name:"m7\u266D5",degrees:[1,"b3","b5","b7"]},{name:"m7\u266F5",degrees:[1,"b3","#5","b7"]},{name:"9",degrees:[1,3,5,"b7",9]},{name:"m9",degrees:[1,"b3",5,"b7",9]},{name:"7\u266F9",degrees:[1,3,5,"b7","#9"]},{name:"7\u266D9",degrees:[1,3,5,"b7","b9"]},{name:"11",degrees:[1,3,5,"b7",9,11]},{name:"m11",degrees:[1,"b3",5,"b7",9,11]},{name:"13",degrees:[1,3,5,"b7",9,11,13]},{name:"m13",degrees:[1,"b3",5,"b7",9,11,13]}];function lC(i,t){return i.degrees.every(e=>e!==t)?!0:i.degrees.length>=4&&t===5||i.degrees.length>=6&&t===9||i.degrees.length>=7&&t===11}var nn=class extends Error{constructor(e){super(e);this.msg=e;this.name="InvalidChordException"}},pu=class i{constructor(t,e,r,n){this.chordInfo=t;this.rootNote=r;d(this,"name");d(this,"notes");d(this,"omitNotes");d(this,"slashBassNote");this.name=t.name;let o=e.slice();!o.some(a=>Fr(a,n))&&o.push(n),this.notes=new Array(this.chordInfo.degrees.length),this.omitNotes=new Array(this.chordInfo.degrees.length);for(let a=0;a<t.degrees.length;a++){let c=t.degrees[a],u=this.notes[a]=cC(this.rootNote,c),h=o.findIndex(l=>Fr(l,u));if(h>=0)this.omitNotes[a]=!1,o.splice(h,1);else if(lC(t,c))this.omitNotes[a]=!0;else throw new nn("Missing chord note!");Fr(n,u)&&(n=u)}if(o.length>0)if(o.every(a=>Fr(a,n)))this.slashBassNote=n;else throw new nn("Got some extra notes that are not bass note!");else this.slashBassNote=Fr(n,this.rootNote)?void 0:n;if(t.name==="5"&&this.slashBassNote)throw new nn("Power chord no bass note allowed!")}static getChords(t){let e=[],r=U.sort(t),n=r[0],o=uC(r);for(let s=0;s<o.length;s++){let a=aC(o[s]);hC.forEach(c=>{try{let u=new i(c,o,a,n),h=e.findIndex(l=>l.replaceWith(u));h>=0?e[h]=u:e.push(u)}catch(u){if(!(u instanceof nn))throw u}})}return e}replaceWith(t){if(t.notes.length<this.notes.length)return!1;if(t.slashBassNote&&this.slashBassNote&&!Fr(t.slashBassNote,this.slashBassNote)||t.slashBassNote&&!this.slashBassNote||!t.slashBassNote&&this.slashBassNote)return!1;for(let e=0;e<this.notes.length;e++)if(!Fr(t.notes[e],this.notes[e])||t.omitNotes[e]!==this.omitNotes[e])return!1;return!0}toString(){let t=1,e=this.rootNote.formatOmitOctave(t),r=this.slashBassNote?"/"+this.slashBassNote.formatOmitOctave(t):"";return e+this.name+r}getDegreeNotationString(){let t=1,e=this.slashBassNote?this.slashBassNote.formatOmitOctave(t)+" - ":"",r=this.omitNotes.map((n,o)=>this.getDegreeStr(o)+"("+(n?"-":this.getNoteStr(o))+")").join(" - ");return e+r}getOmittedDegreesString(){let t=this.omitNotes.map((e,r)=>e?this.getDegreeStr(r)+"("+this.getNoteStr(r)+")":void 0).filter(e=>e!==void 0);return t.length>0?"Omits "+t.join(", "):""}getDegreeStr(t){return U.replaceAccidentalSymbols(""+this.chordInfo.degrees[t],1)}getNoteStr(t){return this.notes[t].formatOmitOctave(1)}};var mu={list:[{name:"Standard",strings:["E2","A2","D3","G3","B3","E4"]},{name:"B Standard",strings:["B1","E2","A2","D3","F#3","B3"]},{name:"C Standard",strings:["C2","F2","A#2","D#3","G3","C4"]},{name:"D Modal",strings:["D2","A2","D3","G3","A3","D4"]},{name:"D Standard",strings:["D2","G2","C3","F3","A3","D4"]},{name:"D# Standard",strings:["D#2","G#2","C#3","F#3","A#3","D#4"]},{name:"Double Drop D",strings:["D2","A2","D3","G3","B3","D4"]},{name:"Drop B",strings:["B1","F#2","B2","E3","G#3","C#4"]},{name:"Drop C",strings:["C2","G2","C3","F3","A3","D4"]},{name:"Drop D",strings:["D2","A2","D3","G3","B3","E4"]},{name:"Low C",strings:["C2","G2","D3","G3","A3","D4"]},{name:"New Standard",strings:["C2","G2","D3","A3","E4","G4"]},{name:"Open A",strings:["E2","A2","C#3","E3","A3","E4"]},{name:"Open A Minor",strings:["E2","A2","E3","A3","C4","E4"]},{name:"Open C",strings:["C2","G2","C3","G3","C4","E4"]},{name:"Open C Minor",strings:["C2","G2","C3","G3","C4","D#4"]},{name:"Open D",strings:["D2","A2","D3","F#3","A3","D4"]},{name:"Open D Minor",strings:["D2","A2","D3","F3","A3","D4"]},{name:"Open E",strings:["E2","B2","E3","G#3","B3","E4"]},{name:"Open E Minor",strings:["E2","B2","E3","G3","B3","E4"]},{name:"Open G",strings:["D2","G2","D3","G3","B3","D4"]},{name:"Open G Minor",strings:["D2","G2","D3","G3","A#3","D4"]}]};var lo=mu.list.map(i=>i.name),pC=lo[0];function fu(i){if(lo.indexOf(i)<0)throw new N(1,`Invalid tuning name: ${i}`);return i}var El=new bl(100);function $s(i){let t=El.get(i);if(!t){let e=mu.list.find(r=>r.name===i);if(!e)throw new N(1,`Invalid tuningName: ${i}`);if(t=e.strings.slice().reverse().map(r=>U.getNote(r)),!y.isIntegerEq(t.length,6))throw new N(0,`Tuning has ${t.length} strings.`);El.set(i,t)}return t}var Dl=12,mC=1188*7*5,ir=(k=>(k.Whole="1n",k.WholeTriplet="1t",k.WholeDot="1.",k.Whole2Dots="1..",k.Whole3Dots="1...",k.Whole4Dots="1....",k.Whole5Dots="1.....",k.Whole6Dots="1......",k.Half="2n",k.HalfTriplet="2t",k.HalfDot="2.",k.Half2Dots="2..",k.Half3Dots="2...",k.Half4Dots="2....",k.Half5Dots="2.....",k.Quarter="4n",k.QuarterTriplet="4t",k.QuarterDot="4.",k.Quarter2Dots="4..",k.Quarter3Dots="4...",k.Quarter4Dots="4....",k.Eighth="8n",k.EighthTriplet="8t",k.EighthDot="8.",k.Eighth2Dots="8..",k.Eighth3Dots="8...",k.Sixteenth="16n",k.SixteenthTriplet="16t",k.SixteenthDot="16.",k.Sixteenth2Dots="16..",k.ThirtySecond="32n",k.ThirtySecondTriplet="32t",k.ThirtySecondDot="32.",k.SixtyFourth="64n",k.SixtyFourthTriplet="64t",k))(ir||{});function nr(i){return y.isEnumValue(i,ir)}function Br(i){if(nr(i))return i;throw new N(1,`Invalid noteLength: ${i}`)}var me=class me{constructor(t){d(this,"noteLength");d(this,"noteSize");d(this,"ticks");d(this,"flagCount");d(this,"dotCount");d(this,"maxDotCount");d(this,"isTriplet");d(this,"hasStem");d(this,"isSolid");if(this.noteLength=Br(t),this.noteSize=parseInt(t),this.isTriplet=t.endsWith("t"),this.maxDotCount=this.isTriplet?0:Math.floor(Math.log2(me.ShortestNoteSize/this.noteSize)),this.dotCount=$.Str.charCount(t,"."),this.flagCount=this.noteSize>4?Math.floor(Math.log2(this.noteSize/4)):0,this.ticks=mC*me.ShortestNoteSize/this.noteSize,this.hasStem=this.noteSize>1,this.isSolid=this.noteSize>2,this.dotCount>this.maxDotCount)throw new N(2,`dotCount ${this.dotCount} > maxDotCount ${this.maxDotCount}, for noteLength "${this.noteLength}".`);if(this.isTriplet&&this.dotCount>0)throw new N(2,`noteLength "${this.noteLength}" is both triplet and dotted!`)}static get(t){return this.cache.getOrCreate(t,()=>new me(t))}static create(t,e=0){let r=typeof t=="number"?t:this.get(t).noteSize;return this.get(r+(y.isIntegerGte(e,1)?".".repeat(e):"n"))}static cmp(t,e){let r=t instanceof me?t.noteSize:typeof t=="number"?t:me.get(t).noteSize,n=e instanceof me?e.noteSize:typeof e=="number"?e:me.get(e).noteSize;return $.Math.cmp(n,r)}static equals(t,e){let r=t instanceof me?t.noteSize:typeof t=="number"?t:me.get(t).noteSize,n=e instanceof me?e.noteSize:typeof e=="number"?e:me.get(e).noteSize;return r===n}};d(me,"LongestNoteSize",Math.min(...$.Enum.getEnumValues(ir).map(t=>parseInt(t)))),d(me,"ShortestNoteSize",Math.max(...$.Enum.getEnumValues(ir).map(t=>parseInt(t)))),d(me,"cache",new lt);var Nt=me;function Zs(i){return y.isObject(i)&&y.isIntegerBetween(i.parts,2,Dl)&&y.isIntegerBetween(i.inTimeOf,2,Dl)}function kl(i){if(Zs(i))return i;throw new N(2,`Invalid tupletRatio ${JSON.stringify(i)}`)}var Gr={Duplet:{parts:2,inTimeOf:3},Triplet:{parts:3,inTimeOf:2},Quadruplet:{parts:4,inTimeOf:3}},Ni=class Ni{constructor(t,e,r){d(this,"noteLength");d(this,"noteSize");d(this,"dotCount");d(this,"tupletRatio");d(this,"ticks");d(this,"flagCount");d(this,"hasStem");d(this,"isSolidNoteHead");this.noteLength=Br(t);let n=Nt.get(t);if(this.noteSize=n.noteSize,this.ticks=n.ticks,this.flagCount=n.flagCount,this.dotCount=e!=null?e:n.dotCount,this.hasStem=n.hasStem,this.isSolidNoteHead=n.isSolid,y.isObject(r)?this.tupletRatio=kl(r):n.isTriplet?this.tupletRatio=Gr.Triplet:this.tupletRatio=void 0,this.dotCount>0&&this.tupletRatio!==void 0)throw new N(2,"Note cannot be both dotted and tuplet!");if(this.dotCount>n.maxDotCount)throw new N(2,`Too big dot count ${this.dotCount} for note length ${this.noteLength}.`);for(let o=this.ticks/2,s=1;s<=this.dotCount;s++,o/=2)this.ticks+=o;this.tupletRatio&&(this.ticks*=this.tupletRatio.inTimeOf/this.tupletRatio.parts)}toString(){let t=Ni.NoteSymbolMap.get(this.noteSize),e=".".repeat(this.dotCount);return t?t+e:""+this.noteSize+(e.length>0?e:"n")}static get(t,e,r){return e!==void 0||r!==void 0?new Ni(t,e,r):this.cache.getOrCreate(t,()=>new Ni(t))}static cmp(t,e){return $.Math.cmp(t.ticks,e.ticks)}static equals(t,e){return t.ticks===e.ticks}};d(Ni,"NoteSymbolMap",new vr([[1,"\u{1D15D}"],[2,"\u{1D15E}"],[4,"\u{1D15F}"],[8,"\u{1D160}"],[16,"\u{1D161}"],[32,"\u{1D162}"],[64,"\u{1D163}"],[128,"\u{1D164}"]])),d(Ni,"cache",new lt);var Kt=Ni;var po=(u=>(u._2_4="2/4",u._3_4="3/4",u._4_4="4/4",u._3_8="3/8",u._5_8="5/8",u._6_8="6/8",u._7_8="7/8",u._9_8="9/8",u._12_8="12/8",u))(po||{}),Oi=(n=>(n._2_3="2-3",n._3_2="3-2",n._2_2_3="2-2-3",n._3_2_2="3-2-2",n))(Oi||{}),ii=class{constructor(...t){d(this,"beatCount");d(this,"beatSize");d(this,"beatLength");d(this,"measureTicks");d(this,"beamGroupSizes",[]);let e;if(y.isEnumValue(t[0],po)){let o=t[0].split("/");this.beatCount=+o[0],this.beatSize=+o[1],y.isEnumValue(t[1],Oi)&&(e=t[1])}else if(y.isIntegerGte(t[0],2)&&y.isIntegerGte(t[1],2))this.beatCount=t[0],this.beatSize=t[1],y.isEnumValue(t[2],Oi)&&(e=t[2]);else throw new N(5,`Invalid args: ${t}`);if(y.isIntegerGte(this.beatCount,1)){if(!y.isIntegerGte(this.beatSize,1))throw new N(5,`Invalid beatSize: ${this.beatSize}`)}else throw new N(5,`Invalid beatCount: ${this.beatCount}`);let{noteLength:r,ticks:n}=Nt.create(this.beatSize);if(this.beatLength=r,this.measureTicks=this.beatCount*n,this.is(2,4))this.beamGroupSizes=[[2],[2]];else if(this.is(3,4))this.beamGroupSizes=[[2],[2],[2]];else if(this.is(4,4))this.beamGroupSizes=[[2,2],[2,2]];else if(this.is(3,8))this.beamGroupSizes=[[3]];else if(this.is(5,8)){if(!y.isUndefined(e)&&e!=="2-3"&&e!=="3-2")throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`);this.beamGroupSizes=e==="3-2"?[[3],[2]]:[[2],[3]],e=void 0}else if(this.is(6,8))this.beamGroupSizes=[[3],[3]];else if(this.is(7,8)){if(!y.isUndefined(e)&&e!=="2-2-3"&&e!=="3-2-2")throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`);this.beamGroupSizes=e==="3-2-2"?[[3],[2],[2]]:[[2],[2],[3]],e=void 0}else this.is(9,8)?this.beamGroupSizes=[[3],[3],[3]]:this.is(12,8)&&(this.beamGroupSizes=[[3],[3],[3],[3]]);if(this.beamGroupSizes.length===0)throw new N(5,`Unimplemented time signature "${this.toString()}".`);if(e!==void 0)throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`)}is(t,e){return this.beatCount===t&&this.beatSize===e}toString(){return this.beatCount+"/"+this.beatSize}},gu;function Xs(){return gu||(gu=new ii(4,4)),gu}var yu;function Qs(){return yu||(yu={beatsPerMinute:120,options:{beatLength:"4n",dotCount:0}}),yu}function Ks(i){return Kt.get(i.options.beatLength,i.options.dotCount).toString()+"="+i.beatsPerMinute}function bu(i,t){return{beatsPerMinute:i.beatsPerMinute*t,options:{beatLength:i.options.beatLength,dotCount:i.options.dotCount}}}Ii();function Js(i){return!isFinite(i)||i<=0?-1/0:20*Math.log10(i)}var mo="15.1.22";var Au=(i,t,e)=>({endTime:t,insertTime:e,type:"exponentialRampToValue",value:i});var Cu=(i,t,e)=>({endTime:t,insertTime:e,type:"linearRampToValue",value:i});var on=(i,t)=>({startTime:t,type:"setValue",value:i});var fo=(i,t,e)=>({duration:e,startTime:t,type:"setValueCurve",values:i});var ta=(i,t,{startTime:e,target:r,timeConstant:n})=>r+(t-r)*Math.exp((e-i)/n);var Vr=i=>i.type==="exponentialRampToValue";var Ri=i=>i.type==="linearRampToValue";var or=i=>Vr(i)||Ri(i);var sn=i=>i.type==="setValue";var Ue=i=>i.type==="setValueCurve";var an=(i,t,e,r)=>{let n=i[t];return n===void 0?r:or(n)||sn(n)?n.value:Ue(n)?n.values[n.values.length-1]:ta(e,an(i,t-1,n.startTime,r),n)};var _u=(i,t,e,r,n)=>e===void 0?[r.insertTime,n]:or(e)?[e.endTime,e.value]:sn(e)?[e.startTime,e.value]:Ue(e)?[e.startTime+e.duration,e.values[e.values.length-1]]:[e.startTime,an(i,t-1,e.startTime,n)];var go=i=>i.type==="cancelAndHold";var yo=i=>i.type==="cancelScheduledValues";var qr=i=>go(i)||yo(i)?i.cancelTime:Vr(i)||Ri(i)?i.endTime:i.startTime;var vu=(i,t,e,{endTime:r,value:n})=>e===n?n:0<e&&0<n||e<0&&n<0?e*$h(n/e,(i-t)/(r-t)):0;var Su=(i,t,e,{endTime:r,value:n})=>e+(i-t)/(r-t)*(n-e);var Ll=(i,t)=>{let e=Math.floor(t),r=Math.ceil(t);return e===r?i[e]:(1-(t-e))*i[e]+(1-(r-t))*i[r]};var jl=(i,{duration:t,startTime:e,values:r})=>{let n=(i-e)/t*(r.length-1);return Ll(r,n)};var bo=i=>i.type==="setTarget";var xo=class{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){let e=qr(t);if(go(t)||yo(t)){let r=this._automationEvents.findIndex(o=>yo(t)&&Ue(o)?o.startTime+o.duration>=e:qr(o)>=e),n=this._automationEvents[r];if(r!==-1&&(this._automationEvents=this._automationEvents.slice(0,r)),go(t)){let o=this._automationEvents[this._automationEvents.length-1];if(n!==void 0&&or(n)){if(o!==void 0&&bo(o))throw new Error("The internal list is malformed.");let s=o===void 0?n.insertTime:Ue(o)?o.startTime+o.duration:qr(o),a=o===void 0?this._defaultValue:Ue(o)?o.values[o.values.length-1]:o.value,c=Vr(n)?vu(e,s,a,n):Su(e,s,a,n),u=Vr(n)?Au(c,e,this._currenTime):Cu(c,e,this._currenTime);this._automationEvents.push(u)}if(o!==void 0&&bo(o)&&this._automationEvents.push(on(this.getValue(e),e)),o!==void 0&&Ue(o)&&o.startTime+o.duration>e){let s=e-o.startTime,a=(o.values.length-1)/o.duration,c=Math.max(2,1+Math.ceil(s*a)),u=s/(c-1)*a,h=o.values.slice(0,c);if(u<1)for(let l=1;l<c;l+=1){let p=u*l%1;h[l]=o.values[l-1]*(1-p)+o.values[l]*p}this._automationEvents[this._automationEvents.length-1]=fo(h,o.startTime,s)}}}else{let r=this._automationEvents.findIndex(s=>qr(s)>e),n=r===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[r-1];if(n!==void 0&&Ue(n)&&qr(n)+n.duration>e)return!1;let o=Vr(t)?Au(t.value,t.endTime,this._currenTime):Ri(t)?Cu(t.value,e,this._currenTime):t;if(r===-1)this._automationEvents.push(o);else{if(Ue(t)&&e+t.duration>qr(this._automationEvents[r]))return!1;this._automationEvents.splice(r,0,o)}}return!0}flush(t){let e=this._automationEvents.findIndex(r=>qr(r)>t);if(e>1){let r=this._automationEvents.slice(e-1),n=r[0];bo(n)&&r.unshift(on(an(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=r}}getValue(t){if(this._automationEvents.length===0)return this._defaultValue;let e=this._automationEvents.findIndex(s=>qr(s)>t),r=this._automationEvents[e],n=(e===-1?this._automationEvents.length:e)-1,o=this._automationEvents[n];if(o!==void 0&&bo(o)&&(r===void 0||!or(r)||r.insertTime>t))return ta(t,an(this._automationEvents,n-1,o.startTime,this._defaultValue),o);if(o!==void 0&&sn(o)&&(r===void 0||!or(r)))return o.value;if(o!==void 0&&Ue(o)&&(r===void 0||!or(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?jl(t,o):o.values[o.values.length-1];if(o!==void 0&&or(o)&&(r===void 0||!or(r)))return o.value;if(r!==void 0&&Vr(r)){let[s,a]=_u(this._automationEvents,n,o,r,this._defaultValue);return vu(t,s,a,r)}if(r!==void 0&&Ri(r)){let[s,a]=_u(this._automationEvents,n,o,r,this._defaultValue);return Su(t,s,a,r)}return this._defaultValue}};var wu=i=>({cancelTime:i,type:"cancelAndHold"});var Iu=i=>({cancelTime:i,type:"cancelScheduledValues"});var Tu=(i,t)=>({endTime:t,type:"exponentialRampToValue",value:i});var Nu=(i,t)=>({endTime:t,type:"linearRampToValue",value:i});var Ou=(i,t,e)=>({startTime:t,target:i,timeConstant:e,type:"setTarget"});var Pl=()=>new DOMException("","AbortError");var Fl=i=>(t,e,[r,n,o],s)=>{i(t[n],[e,r,o],a=>a[0]===e&&a[1]===r,s)};var Bl=i=>(t,e,r)=>{let n=[];for(let o=0;o<r.numberOfInputs;o+=1)n.push(new Set);i.set(t,{activeInputs:n,outputs:new Set,passiveInputs:new WeakMap,renderer:e})};var Gl=i=>(t,e)=>{i.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})};var Sr=new WeakSet,ea=new WeakMap,cn=new WeakMap,ra=new WeakMap,Ao=new WeakMap,un=new WeakMap,ia=new WeakMap,Co=new WeakMap,_o=new WeakMap,vo=new WeakMap;var Vl={construct(){return Vl}},ql=i=>{try{let t=new Proxy(i,Vl);new t}catch(t){return!1}return!0};var Wl=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,Ru=(i,t)=>{let e=[],r=i.replace(/^[\s]+/,""),n=r.match(Wl);for(;n!==null;){let o=n[1].slice(1,-1),s=n[0].replace(/([\s]+)?;?$/,"").replace(o,new URL(o,t).toString());e.push(s),r=r.slice(n[0].length).replace(/^[\s]+/,""),n=r.match(Wl)}return[e.join(";"),r]};var Ul=i=>{if(i!==void 0&&!Array.isArray(i))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},zl=i=>{if(!ql(i))throw new TypeError("The given value for processorCtor should be a constructor.");if(i.prototype===null||typeof i.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},Yl=(i,t,e,r,n,o,s,a,c,u,h,l,p)=>{let m=0;return(f,g,b={credentials:"omit"})=>{let x=h.get(f);if(x!==void 0&&x.has(g))return Promise.resolve();let C=u.get(f);if(C!==void 0){let w=C.get(g);if(w!==void 0)return w}let S=o(f),T=S.audioWorklet===void 0?n(g).then(([w,v])=>{let[A,_]=Ru(w,v),E=`${A};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${_}
|
|
1
|
+
/* WebMusicScore v6.0.0-pre.2 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
|
+
"use strict";var WebMusicScore=(()=>{var Ds=Object.defineProperty,bg=Object.defineProperties,xg=Object.getOwnPropertyDescriptor,Ag=Object.getOwnPropertyDescriptors,Cg=Object.getOwnPropertyNames,Es=Object.getOwnPropertySymbols;var tu=Object.prototype.hasOwnProperty,Hh=Object.prototype.propertyIsEnumerable;var Kc=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i),_g=i=>{throw TypeError(i)},$h=Math.pow,Jc=(i,t,e)=>t in i?Ds(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t)=>{for(var e in t||(t={}))tu.call(t,e)&&Jc(i,e,t[e]);if(Es)for(var e of Es(t))Hh.call(t,e)&&Jc(i,e,t[e]);return i},Q=(i,t)=>bg(i,Ag(t));var Qr=(i,t)=>{var e={};for(var r in i)tu.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&Es)for(var r of Es(i))t.indexOf(r)<0&&Hh.call(i,r)&&(e[r]=i[r]);return e};var en=(i,t)=>{for(var e in t)Ds(i,e,{get:t[e],enumerable:!0})},vg=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cg(t))!tu.call(i,n)&&n!==e&&Ds(i,n,{get:()=>t[n],enumerable:!(r=xg(t,n))||r.enumerable});return i};var Sg=i=>vg(Ds({},"__esModule",{value:!0}),i);var d=(i,t,e)=>Jc(i,typeof t!="symbol"?t+"":t,e);var J=(i,t,e)=>new Promise((r,n)=>{var o=c=>{try{a(e.next(c))}catch(u){n(u)}},s=c=>{try{a(e.throw(c))}catch(u){n(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((e=e.apply(i,t)).next())}),wg=function(i,t){this[0]=i,this[1]=t};var pe=i=>{var t=i[Kc("asyncIterator")],e=!1,r,n={};return t==null?(t=i[Kc("iterator")](),r=o=>n[o]=s=>t[o](s)):(t=t.call(i),r=o=>n[o]=s=>{if(e){if(e=!1,o==="throw")throw s;return s}return e=!0,{done:!1,value:new wg(new Promise(a=>{var c=t[o](s);c instanceof Object||_g("Object expected"),a(c)}),1)}}),n[Kc("iterator")]=()=>n,r("next"),"throw"in t?r("throw"):n.throw=o=>{throw o},"return"in t&&r("return"),n};var l0={};en(l0,{Audio:()=>Fo,Core:()=>hu,Pieces:()=>Yh,Score:()=>Vh,Theory:()=>xu});var Fo={};en(Fo,{addInstrument:()=>Rv,getCurrentInstrument:()=>Ov,getInstrumentList:()=>Nv,isMuted:()=>Dv,linearToDecibels:()=>Js,mute:()=>Mv,playNote:()=>Ua,stop:()=>za,unmute:()=>Ev,useInstrument:()=>Jf});var xu={};en(xu,{AccidentalType:()=>du,BeamGrouping:()=>Oi,Chord:()=>pu,DefaultGuitarNoteLabel:()=>GA,DefaultPitchNotation:()=>FA,DefaultTuningName:()=>pC,GuitarNoteLabel:()=>zs,GuitarNoteLabelList:()=>VA,Interval:()=>uo,KeySignature:()=>rr,Mode:()=>lu,Note:()=>U,NoteLength:()=>ir,NoteLengthProps:()=>Nt,PitchNotation:()=>ti,PitchNotationList:()=>PA,RhythmProps:()=>Kt,Scale:()=>ri,ScaleFactory:()=>ne,ScaleType:()=>Ti,SymbolSet:()=>Jr,TimeSignature:()=>ii,TimeSignatures:()=>po,TuningNameList:()=>lo,Tuplet:()=>Gr,alterTempoSpeed:()=>bu,getDefaultKeySignature:()=>Ys,getDefaultScale:()=>nC,getDefaultTempo:()=>Qs,getDefaultTimeSignature:()=>Xs,getPitchNotationName:()=>BA,getScale:()=>Pr,getScaleFactory:()=>Ml,getScaleFactoryList:()=>rC,getTempoString:()=>Ks,getTuningStrings:()=>$s,isNoteLength:()=>nr,isTupletRatio:()=>Zs,validateGuitarNoteLabel:()=>qA,validateIntervalQuality:()=>QA,validateNoteLength:()=>Br,validatePitchNotation:()=>_l,validateScaleType:()=>ho,validateTuningName:()=>fu,validateTupletRatio:()=>kl});var Zh=Object.defineProperty,Ig=(i,t,e)=>t in i?Zh(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,er=(i,t)=>{for(var e in t)Zh(i,e,{get:t[e],enumerable:!0})},ft=(i,t,e)=>Ig(i,typeof t!="symbol"?t+"":t,e),Xh={};er(Xh,{assert:()=>tb,doesNotThrow:()=>Tx,doesThrow:()=>Ix,fail:()=>nb,isArray:()=>yb,isArrayOrUndefined:()=>bb,isBigInt:()=>Gb,isBoolean:()=>Ob,isBooleanOrUndefined:()=>Rb,isDeepEqual:()=>sb,isDefined:()=>hb,isEmptyArray:()=>xb,isEmptyArrayOrUndefined:()=>Cb,isEmptyObject:()=>pb,isEmptyString:()=>Sb,isEmptyStringOrUndefined:()=>Tb,isEnumValue:()=>Pb,isEnumValueOrUndefined:()=>Fb,isEven:()=>Cx,isFalse:()=>Db,isFalseOrUndefined:()=>kb,isFinite:()=>Qb,isFloat:()=>Kb,isFunction:()=>Lb,isFunctionOrUndefined:()=>jb,isIncluded:()=>Sx,isIndex:()=>wx,isInfinity:()=>hx,isInteger:()=>Jb,isIntegerBetween:()=>ax,isIntegerBetweenExclusive:()=>cx,isIntegerEq:()=>rx,isIntegerGt:()=>ix,isIntegerGte:()=>nx,isIntegerLt:()=>ox,isIntegerLte:()=>sx,isIntegerOrUndefined:()=>ex,isMultipleOf:()=>_x,isNaNValue:()=>ux,isNeg:()=>mx,isNegInfinity:()=>dx,isNegZero:()=>xx,isNonEmptyArray:()=>Ab,isNonEmptyArrayOrUndefined:()=>_b,isNonEmptyString:()=>wb,isNonEmptyStringOrUndefined:()=>Nb,isNonNeg:()=>gx,isNonNull:()=>lb,isNonPos:()=>fx,isNull:()=>cb,isNullish:()=>ub,isNumber:()=>Vb,isNumberBetween:()=>Zb,isNumberBetweenExclusive:()=>Xb,isNumberEq:()=>Ub,isNumberGt:()=>zb,isNumberGte:()=>Yb,isNumberLt:()=>Hb,isNumberLte:()=>$b,isNumberOrUndefined:()=>Wb,isNumericString:()=>Bb,isObject:()=>db,isObjectOrUndefined:()=>fb,isOdd:()=>Ax,isPlainObject:()=>mb,isPos:()=>px,isPosInfinity:()=>lx,isPosZero:()=>bx,isPowerOfTwo:()=>vx,isSafeInteger:()=>tx,isSafeNumber:()=>qb,isStrictEqual:()=>ob,isString:()=>vb,isStringOrUndefined:()=>Ib,isTrue:()=>Mb,isTrueOrUndefined:()=>Eb,isTypedObject:()=>gb,isUndefined:()=>ab,isZero:()=>yx,require:()=>eb,requireDefined:()=>rb,requireElement:()=>ib,setErrorClass:()=>Jy});var Qh={};er(Qh,{charCount:()=>Zy,chunkString:()=>Yy,insertAt:()=>Hy,isString:()=>el,makeSentenceFromPascal:()=>Xy,removeAt:()=>$y,repeatString:()=>zy,replaceAt:()=>ou,splitByCaps:()=>Qy,splitByChars:()=>Ky,splitByStrings:()=>ol,stringify:()=>Gt,toCharArray:()=>Uy});var Kh={};er(Kh,{deepEqual:()=>Ps,getCtorName:()=>nl,hasProperties:()=>Wy,isObject:()=>wi});var y={};er(y,{doesNotThrow:()=>Vy,doesThrow:()=>Gy,isArray:()=>je,isArrayOrUndefined:()=>Gg,isBigInt:()=>sy,isBoolean:()=>Xg,isBooleanOrUndefined:()=>Qg,isDeepEqual:()=>ao,isDefined:()=>Dg,isEmptyArray:()=>Vg,isEmptyArrayOrUndefined:()=>Wg,isEmptyObject:()=>Lg,isEmptyString:()=>zg,isEmptyStringOrUndefined:()=>$g,isEnumValue:()=>iy,isEnumValueOrUndefined:()=>ny,isEven:()=>Ly,isFalse:()=>ty,isFalseOrUndefined:()=>ey,isFinite:()=>rn,isFloat:()=>gy,isFunction:()=>_r,isFunctionOrUndefined:()=>ry,isIncluded:()=>Fy,isIndex:()=>By,isInfinity:()=>Sy,isInteger:()=>Lt,isIntegerBetween:()=>rl,isIntegerBetweenExclusive:()=>vy,isIntegerEq:()=>xy,isIntegerGt:()=>Ay,isIntegerGte:()=>nu,isIntegerLt:()=>Cy,isIntegerLte:()=>_y,isIntegerOrUndefined:()=>by,isMultipleOf:()=>jy,isNaNValue:()=>il,isNeg:()=>Ny,isNegInfinity:()=>Iy,isNegZero:()=>Dy,isNonEmptyArray:()=>qg,isNonEmptyArrayOrUndefined:()=>Ug,isNonEmptyString:()=>Yg,isNonEmptyStringOrUndefined:()=>Zg,isNonNeg:()=>Ry,isNonNull:()=>kg,isNonPos:()=>Oy,isNull:()=>Mg,isNullish:()=>Eg,isNumber:()=>kt,isNumberBetween:()=>my,isNumberBetweenExclusive:()=>fy,isNumberEq:()=>uy,isNumberGt:()=>hy,isNumberGte:()=>ly,isNumberLt:()=>dy,isNumberLte:()=>py,isNumberOrUndefined:()=>cy,isNumericString:()=>oy,isObject:()=>wi,isObjectOrUndefined:()=>jg,isOdd:()=>ky,isPlainObject:()=>Pg,isPos:()=>Ty,isPosInfinity:()=>wy,isPosZero:()=>Ey,isPowerOfTwo:()=>Py,isSafeInteger:()=>yy,isSafeNumber:()=>ay,isStrictEqual:()=>Og,isString:()=>el,isStringOrUndefined:()=>Hg,isTrue:()=>Kg,isTrueOrUndefined:()=>Jg,isTypedObject:()=>Fg,isUndefined:()=>Rg,isZero:()=>My,tryOr:()=>qy});var Jh={};er(Jh,{forEachEnum:()=>Ng,getEnumEntries:()=>tl,getEnumKey:()=>Tg,getEnumKeys:()=>Fs,getEnumValues:()=>iu});function Fs(i){return Object.keys(i).filter(t=>isNaN(Number(t)))}function iu(i){return Fs(i).map(t=>i[t])}function tl(i){return Fs(i).map(t=>[t,i[t]])}function Tg(i,t){return Fs(i).find(e=>i[e]===t)}function Ng(i,t){for(let[e,r]of tl(i))t(e,r)}function Og(i,t){return i===t}function ao(i,t){return Ps(i,t)}function Rg(i){return i===void 0}function Mg(i){return i===null}function Eg(i){return i==null}function Dg(i){return i!==void 0}function kg(i){return i!==null}function wi(i){return typeof i=="object"&&i!==null&&!je(i)}function Lg(i){return wi(i)&&Object.keys(i).length===0}function jg(i){return i===void 0||wi(i)}function Pg(i){if(!wi(i))return!1;let t=Object.getPrototypeOf(i);return t===Object.prototype||t===null}function Fg(i,t){return wi(i)&&t.every(e=>e in i)}function Bg(i){return i instanceof Set}function je(i){return!!i&&Object.prototype.toString.call(i)==="[object Array]"}function Gg(i){return i===void 0||je(i)}function Vg(i){return je(i)&&i.length===0}function qg(i){return je(i)&&i.length>0}function Wg(i){return je(i)&&i.length===0||i===void 0}function Ug(i){return je(i)&&i.length>0||i===void 0}function el(i){return typeof i=="string"}function zg(i){return typeof i=="string"&&i.length===0}function Yg(i){return typeof i=="string"&&i.length>0}function Hg(i){return i===void 0||typeof i=="string"}function $g(i){return typeof i=="string"&&i.length===0||i===void 0}function Zg(i){return typeof i=="string"&&i.length>0||i===void 0}function Xg(i){return typeof i=="boolean"}function Qg(i){return i===void 0||typeof i=="boolean"}function Kg(i){return i===!0}function Jg(i){return i===!0||i===void 0}function ty(i){return i===!1}function ey(i){return i===!1||i===void 0}function _r(i){return typeof i=="function"}function ry(i){return i===void 0||typeof i=="function"}function iy(i,t){return iu(t).some(e=>e===i)}function ny(i,t){return i===void 0||iu(t).some(e=>e===i)}function oy(i){if(typeof i!="string"||i.trim()==="")return!1;let t=+i;return Number.isFinite(t)}function sy(i){return typeof i=="bigint"}function kt(i){return typeof i=="number"}function ay(i){return kt(i)&&Number.isSafeInteger(i)}function cy(i){return typeof i=="number"||i===void 0}function uy(i,t){return kt(i)&&i===t}function hy(i,t){return kt(i)&&kt(t)&&i>t}function ly(i,t){return kt(i)&&kt(t)&&i>=t}function dy(i,t){return kt(i)&&kt(t)&&i<t}function py(i,t){return kt(i)&&kt(t)&&i<=t}function my(i,t,e){return kt(i)&&kt(t)&&kt(e)&&i>=t&&i<=e}function fy(i,t,e){return kt(i)&&kt(t)&&kt(e)&&i>t&&i<e}function rn(i){return typeof i=="number"&&Number.isFinite(i)}function gy(i){return rn(i)&&!Lt(i)}function Lt(i){return typeof i=="number"&&rn(i)&&i===Math.trunc(i)}function yy(i){return Lt(i)&&Number.isSafeInteger(i)}function by(i){return typeof i=="number"&&rn(i)&&i===Math.trunc(i)||i===void 0}function xy(i,t){return Lt(i)&&i===t}function Ay(i,t){return Lt(i)&&kt(t)&&i>t}function nu(i,t){return Lt(i)&&kt(t)&&i>=t}function Cy(i,t){return Lt(i)&&kt(t)&&i<t}function _y(i,t){return Lt(i)&&kt(t)&&i<=t}function rl(i,t,e){return Lt(i)&&kt(t)&&kt(e)&&i>=t&&i<=e}function vy(i,t,e){return Lt(i)&&kt(t)&&kt(e)&&i>t&&i<e}function il(i){return typeof i=="number"&&Number.isNaN(i)}function Sy(i){return i===1/0||i===-1/0}function wy(i){return i===1/0}function Iy(i){return i===-1/0}function Ty(i){return typeof i=="number"&&i>0}function Ny(i){return typeof i=="number"&&i<0}function Oy(i){return typeof i=="number"&&i<=0}function Ry(i){return typeof i=="number"&&i>=0}function My(i){return typeof i=="number"&&i===0}function Ey(i){return typeof i=="number"&&i===0&&1/i===1/0}function Dy(i){return typeof i=="number"&&i===0&&1/i===-1/0}function ky(i){return Lt(i)&&Math.abs(i)%2===1}function Ly(i){return Lt(i)&&i%2===0}function jy(i,t){return typeof i=="number"&&typeof t=="number"&&i%t===0}function Py(i){return Lt(i)&&i>0&&(i&i-1)===0}function Fy(i,t){return je(t)?t.includes(i):Bg(t)?t.has(i):!1}function By(i,t){return je(t)?rl(i,0,t.length-1):nu(i,0)}function Gy(i){try{return i(),!1}catch(t){return!0}}function Vy(i){try{return i(),!0}catch(t){return!1}}function qy(i,t){try{return i()}catch(e){return _r(t)?t():t}}function Wy(i,t){return wi(i)&&t.every(e=>e in i)}function Ps(i,t){if(i===t)return!0;if(i===null||t===null||typeof i!="object"||typeof t!="object")return!1;if(Array.isArray(i)&&Array.isArray(t))return i.length!==t.length?!1:i.every((n,o)=>Ps(n,t[o]));if(Array.isArray(i)!==Array.isArray(t))return!1;let e=Object.keys(i),r=Object.keys(t);if(e.length!==r.length)return!1;for(let n of e)if(!Object.prototype.hasOwnProperty.call(t,n)||!Ps(i[n],t[n]))return!1;return!0}function nl(i){return i===null?"null":je(i)?"Array":typeof i!="object"?typeof i:Object.prototype.toString.call(i).slice(8,-1)||"Object"}function Uy(i){return i.split("")}function zy(i,t){if(!Lt(t)||t<0)throw new Error("repeatStr: Invalid repeatCount = "+t);return new Array(t+1).join(i)}function Yy(i,t){if(!Lt(t)||t<1)throw new Error("chunckString: Invalid chuckSize = "+t);let e=[];for(let r=0;r<i.length;r+=t)e.push(i.slice(r,r+t));return e}function ou(i,t,e,r){if(!Lt(e)||e<0)throw new Error("replaceAt: Invalid removeCount = "+e);if(!Lt(t)||t<0||t+e>i.length)throw new Error("replaceAt: Invalid pos = "+t+", removeCount = "+e+", str.length = "+i.length);return i.substring(0,t)+r+i.substring(t+e)}function Hy(i,t,e){return ou(i,t,0,e)}function $y(i,t,e){return ou(i,t,e,"")}function Zy(i,t){if(t.length!==1||i.length===0)return 0;let e=0;for(let r=0;r<i.length;r++)i[r]===t&&e++;return e}function Xy(i){if(i==="")return"";let t=i.charAt(0),e="",r=()=>{t!==""&&(e===""?e+=t.charAt(0).toUpperCase()+t.substring(1):e+=" "+t,t="")},n=o=>o.toUpperCase()!==o.toLowerCase()&&o===o.toUpperCase();for(let o=1;o<i.length;o++){let s=i.charAt(o);n(s)&&r(),t+=s.toLowerCase()}return r(),e}function Gt(i,t=5,e=new WeakSet){if(i===null)return"null";if(i===void 0)return"undefined";let r=typeof i;switch(r){case"boolean":return i?"true":"false";case"number":return il(i)?"NaN":rn(i)?i.toString():i<0?"-Infinity":"Infinity";case"bigint":return`${i}n`;case"string":return`"${i}"`;case"symbol":return i.description?`Symbol(${i.description})`:"Symbol()";case"function":return`[Function${i.name?` ${i.name}`:""}]`}if(e.has(i))return"[Circular]";if(t<=0)return"[Depth limit]";t--,e.add(i);let n=s=>Gt(s,t,e);if(je(i)){let s=i.map(a=>n(a)).join(", ");return s.length===0?"[ ]":`[ ${s} ]`}if(ArrayBuffer.isView(i)){if(i instanceof DataView)return`DataView(${i.byteLength})`;let s=Array.from(i).map(a=>n(a)).join(", ");return`${i.constructor.name}[ ${s} ]`}if(i instanceof ArrayBuffer)return`ArrayBuffer(${i.byteLength})`;if(i instanceof Map){let s=Array.from(i.entries()).map(([a,c])=>`${n(a)} => ${n(c)}`).join(", ");return s.length===0?`Map(${i.size}){ }`:`Map(${i.size}){ ${s} }`}if(i instanceof Set){let s=Array.from(i.values()).map(a=>n(a)).join(", ");return s.length===0?`Set(${i.size}){ }`:`Set(${i.size}){ ${s} }`}if(i instanceof WeakMap)return"WeakMap{ ? }";if(i instanceof WeakSet)return"WeakSet{ ? }";if(i instanceof Date)return`Date("${i.toISOString()}")`;if(i instanceof RegExp)return i.toString();if(i instanceof Error)return`${i.name}("${i.message}")`;if(i instanceof Promise)return"Promise{ ? }";if(i instanceof URL)return`URL("${i.href}")`;if(i instanceof URLSearchParams)return`URLSearchParams("${i.toString()}")`;if(i===Math)return"Math";if(i===JSON)return"JSON";if(i===Reflect)return"Reflect";if(i===Intl)return"Intl";if(typeof(i==null?void 0:i.toString)=="function"&&i.toString!==Object.prototype.toString)try{let s=i.toString();if(!/^\[object .+\]$/.test(s))return s}catch(s){}if(r==="object"){let s=nl(i),a=Object.entries(i).map(([c,u])=>`${n(c)}: ${n(u)}`);return a.length===0?`${s}{ }`:`${s}{ ${a.join(", ")} }`}return String(i)}function Qy(i){return i.split(/(?=[A-Z])/).filter(t=>!!t)}function ol(i,...t){if(t.length===0)return[i];let e=t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r=new RegExp(e.join("|"),"g");return i.split(r)}function Ky(i,t){return ol(i,...t.split(""))}var L=Gt,sl=Error;function Jy(i){sl=i!=null?i:Error}function V(...i){let t=i.join(", ");throw new sl("Assertion Failed!"+(t===""?"":" "+t))}function tb(i,t){i||V(t)}function eb(i,t){return i==null&&V(`Expected ${L(i)} not to be nullish`,t),i}function rb(i,t){return i===void 0&&V(`Expected ${L(i)} not to be undefined`,t),i}function ib(i,t,e){return y.isIndex(i,t)||V(`Expected ${i} to be index for array ${L(t)}`,e),t[i]}function nb(i){V(i)}function ob(i,t,e){return y.isStrictEqual(i,t)||V(`Expected ${L(i)} to ne strict equal to ${t}`,e),i}function sb(i,t,e){return y.isDeepEqual(i,t)||V(`Expected ${L(i)} to deep equal with ${L(t)}`,e),i}function ab(i,t){return y.isUndefined(i)||V(`Expected ${L(i)} to be undefined`,t),i}function cb(i,t){return y.isNull(i)||V(`Expected ${L(i)} to be null`,t),i}function ub(i,t){return y.isNullish(i)||V(`Expected ${L(i)} to be null or undefined`,t),i}function hb(i,t){return y.isDefined(i)||V(`Expected ${L(i)} to be defined`,t),i}function lb(i,t){return y.isNonNull(i)||V(`Expected ${L(i)} to be defined`,t),i}function db(i,t){return y.isObject(i)||V(`Expected ${L(i)} to be object`,t),i}function pb(i,t){return y.isEmptyObject(i)||V(`Expected ${L(i)} to be empty object`,t),i}function mb(i,t){return y.isPlainObject(i)||V(`Expected ${L(i)} to be plain object`,t),i}function fb(i,t){return y.isObjectOrUndefined(i)||V(`Expected ${L(i)} to be object or undefined`,t),i}function gb(i,t,e){return y.isTypedObject(i,t)||V(`Expected ${L(i)} to have keys ${L(t)}`,e),i}function yb(i,t){return y.isArray(i)||V(`Expected ${L(i)} to be array`,t),i}function bb(i,t){return y.isArrayOrUndefined(i)||V(`Expected ${L(i)} to be array or undefined`,t),!0}function xb(i,t){y.isEmptyArray(i)||V(`Expected ${L(i)} to be empty array`,t)}function Ab(i,t){y.isNonEmptyArray(i)||V(`Expected ${L(i)} to be non-empty array`,t)}function Cb(i,t){y.isEmptyArrayOrUndefined(i)||V(`Expected ${L(i)} to be empty array or undefined`,t)}function _b(i,t){y.isNonEmptyArrayOrUndefined(i)||V(`Expected ${L(i)} to be non-empty array or undefined`,t)}function vb(i,t){return y.isString(i)||V(`Expected ${L(i)} to be string`,t),i}function Sb(i,t){return y.isEmptyString(i)||V(`Expected ${L(i)} to be empty string`,t),i}function wb(i,t){return y.isNonEmptyString(i)||V(`Expected ${L(i)} to be non-empty string`,t),i}function Ib(i,t){return y.isStringOrUndefined(i)||V(`Expected ${L(i)} to be string or undefined`,t),i}function Tb(i,t){return y.isEmptyStringOrUndefined(i)||V(`Expected ${L(i)} to be empty string or undefined`,t),i}function Nb(i,t){return y.isNonEmptyStringOrUndefined(i)||V(`Expected ${L(i)} to be non-empty string or undefined`,t),i}function Ob(i,t){return y.isBoolean(i)||V(`Expected ${L(i)} to be boolean`,t),i}function Rb(i,t){return y.isBooleanOrUndefined(i)||V(`Expected ${L(i)} to be boolean or undefined`,t),i}function Mb(i,t){return y.isTrue(i)||V(`Expected ${L(i)} to be true`,t),i}function Eb(i,t){return y.isTrueOrUndefined(i)||V(`Expected ${L(i)} to be true or undefined`,t),i}function Db(i,t){return y.isFalse(i)||V(`Expected ${L(i)} to be false`,t),i}function kb(i,t){return y.isFalseOrUndefined(i)||V(`Expected ${L(i)} to be false or undefined`,t),i}function Lb(i,t){return y.isFunction(i)||V(`Expected ${L(i)} to be function`,t),i}function jb(i,t){return y.isFunctionOrUndefined(i)||V(`Expected ${L(i)} to be function or undefined`,t),i}function Pb(i,t,e){return y.isEnumValue(i,t)||V(`Expected ${L(i)} to be enum val`,e),i}function Fb(i,t,e){return y.isEnumValueOrUndefined(i,t)||V(`Expected ${L(i)} to be enum val or undefined`,e),i}function Bb(i,t){return y.isNumericString(i)||V(`Expected ${L(i)} to be numeric string`,t),i}function Gb(i,t){return y.isBigInt(i)||V(`Expected ${L(i)} to be BigInt`,t),i}function Vb(i,t){return y.isNumber(i)||V(`Expected ${L(i)} to be number`,t),i}function qb(i,t){return y.isSafeNumber(i)||V(`Expected ${L(i)} to be safe number`,t),i}function Wb(i,t){return y.isNumberOrUndefined(i)||V(`Expected ${L(i)} to be number or undefined`,t),i}function Ub(i,t,e){return y.isNumberEq(i,t)||V(`Expected ${L(i)} to be number equal to ${L(t)}`,e),i}function zb(i,t,e){return y.isNumberGt(i,t)||V(`Expected ${L(i)} to be number > ${L(t)}`,e),i}function Yb(i,t,e){return y.isNumberGte(i,t)||V(`Expected ${L(i)} to be number >= ${L(t)}`,e),i}function Hb(i,t,e){return y.isNumberLt(i,t)||V(`Expected ${L(i)} to be number < ${L(t)}`,e),i}function $b(i,t,e){return y.isNumberLte(i,t)||V(`Expected ${L(i)} to be number <= ${L(t)}`,e),i}function Zb(i,t,e,r){return y.isNumberBetween(i,t,e)||V(`Expected number ${L(t)} <= ${L(i)} <= ${L(e)}`,r),i}function Xb(i,t,e,r){return y.isNumberBetweenExclusive(i,t,e)||V(`Expected number ${L(t)} < ${L(i)} < ${L(e)}`,r),i}function Qb(i,t){return y.isFinite(i)||V(`Expected ${L(i)} to be finite`,t),i}function Kb(i,t){return y.isFloat(i)||V(`Expected ${L(i)} to be float`,t),i}function Jb(i,t){return y.isInteger(i)||V(`Expected ${L(i)} to be integer`,t),i}function tx(i,t){return y.isSafeInteger(i)||V(`Expected ${L(i)} to be safe integer`,t),i}function ex(i,t){return y.isIntegerOrUndefined(i)||V(`Expected ${L(i)} to be integer or undefined`,t),i}function rx(i,t,e){return y.isIntegerEq(i,t)||V(`Expected ${L(i)} to be integer equal to ${L(t)}`,e),i}function ix(i,t,e){return y.isIntegerGt(i,t)||V(`Expected ${L(i)} to be integer > ${L(t)}`,e),i}function nx(i,t,e){return y.isIntegerGte(i,t)||V(`Expected ${L(i)} to be integer >= ${L(t)}`,e),i}function ox(i,t,e){return y.isIntegerLt(i,t)||V(`Expected ${L(i)} to be integer < ${L(t)}`,e),i}function sx(i,t,e){return y.isIntegerLte(i,t)||V(`Expected ${L(i)} to be integer <= ${L(t)}`,e),i}function ax(i,t,e,r){return y.isIntegerBetween(i,t,e)||V(`Expected integer ${L(t)} <= ${L(i)} <= ${L(e)}`,r),i}function cx(i,t,e,r){return y.isIntegerBetweenExclusive(i,t,e)||V(`Expected integer ${L(t)} < ${L(i)} < ${L(e)}`,r),i}function ux(i,t){return y.isNaNValue(i)||V(`Expected ${L(i)} to be NaN`,t),NaN}function hx(i,t){return y.isInfinity(i)||V(`Expected ${L(i)} to be +-Infinity`,t),i}function lx(i,t){return y.isPosInfinity(i)||V(`Expected ${L(i)} to be +Infinity`,t),i}function dx(i,t){return y.isNegInfinity(i)||V(`Expected ${L(i)} to be -Infinity`,t),i}function px(i,t){return y.isPos(i)||V(`Expected ${L(i)} to be positive (> 0)`,t),i}function mx(i,t){return y.isNeg(i)||V(`Expected ${L(i)} to be negative (< 0)`,t),i}function fx(i,t){return y.isNonPos(i)||V(`Expected ${L(i)} to be non-positive (<= 0)`,t),i}function gx(i,t){return y.isNonNeg(i)||V(`Expected ${L(i)} to be non-negative (>= 0)`,t),i}function yx(i,t){return y.isZero(i)||V(`Expected ${L(i)} to be 0`,t),i}function bx(i,t){return y.isPosZero(i)||V(`Expected ${L(i)} to be +0`,t),i}function xx(i,t){return y.isNegZero(i)||V(`Expected ${L(i)} to be -0`,t),i}function Ax(i,t){return y.isOdd(i)||V(`Expected ${L(i)} to odd`,t),i}function Cx(i,t){return y.isEven(i)||V(`Expected ${L(i)} to even`,t),i}function _x(i,t,e){return y.isMultipleOf(i,t)||V(`Expected ${L(i)} to be divisble bu ${L(t)}`,e),i}function vx(i,t){return y.isPowerOfTwo(i)||V(`Expected ${L(i)} to be power of two`,t),i}function Sx(i,t,e){return y.isIncluded(i,t)||V(`Expected ${L(i)} to be included in ${L(t)}`,e),i}function wx(...i){let t=i.shift(),e=y.isString(i[i.length-1])?i.pop():void 0,r=y.isArray(i[0])?i.shift():void 0;return y.isIndex(t,r)||V(r===void 0?`Expected ${t} to be index`:`Expected ${t} to be index for ${L(r)}`,e),t}function Ix(i,t){return y.doesThrow(i)||V("Expected to throw",t),!0}function Tx(i,t){return y.doesNotThrow(i)||V("Expected to throw",t),!0}var Nx={};er(Nx,{accept:()=>Dx,decline:()=>kx,erase:()=>al,eraseAll:()=>Bx,isConsentPending:()=>Ex,read:()=>jx,readBool:()=>Fx,readInt:()=>Px,save:()=>Lx,setExpireDays:()=>Mx});var Bs="ConsentCookie",tr,so,eu=Gs(Bs);tr=eu==="accept"||eu==="decline"?eu:void 0;function Ox(){return typeof document=="undefined"?[]:document.cookie.split(";").map(t=>t.trim())}function su(i,t){let e=i+"="+t.toString()+";sameSite=Lax;";return so&&(e+="expires="+so.toUTCString()+";"),typeof document!="undefined"&&(document.cookie=e),t}function Gs(i,t){let e=Ox().find(r=>r.startsWith(i+"="));return e===void 0?t:e.substring(i.length+1)}function Rx(i){typeof document!="undefined"&&(document.cookie=i+"=;expires=Thu, 01 Jan 1970 00:00:00 UTC;")}function Mx(i){so=new Date,so.setDate(so.getDate()+i)}function Ex(){return tr===void 0}function Dx(){tr="accept",su(Bs,tr)}function kx(){tr="decline",su(Bs,tr)}function Lx(i,t){return tr==="accept"&&su(i,t),t}function jx(i,t){var e;return tr==="accept"&&(e=Gs(i,t))!=null?e:t}function Px(i,t){if(tr==="accept"){let e=Gs(i);return e===void 0?t:parseInt(e)}else return t}function Fx(i,t){if(tr==="accept"){let e=Gs(i);return e===void 0?t:/true|1/i.test(e)}else return t}function al(i){(tr==="accept"||i===Bs)&&Rx(i)}function Bx(){typeof document!="undefined"&&document.cookie.split(";").forEach(i=>al(i.trim().split("=")[0]))}var Vs={};er(Vs,{DPI:()=>cl,FontSize:()=>ul,HostAddress:()=>Qx,IsMobileDevice:()=>Xx,IsTouchDevice:()=>Zx,PxPerMm:()=>au,ScrollbarWidth:()=>$x,mmToPx:()=>ks,pxToMm:()=>Kx,toPx:()=>Jx});function Gx(){try{let i=document.createElement("div");i.style.width="1in",document.body.appendChild(i);let t=i.offsetWidth;return i.remove(),t||96}catch(i){return 96}}function Vx(){try{let i=document.createElement("div");i.style.visibility="hidden",i.style.width="100px",document.body.appendChild(i);let t=i.offsetWidth;i.style.overflow="scroll";let e=document.createElement("div");e.style.width="100%",i.appendChild(e);let r=e.offsetWidth;return i.parentNode&&i.parentNode.removeChild(i),t-r}catch(i){return 0}}function qx(){try{let i=document.createElement("div");i.style.cssText="display:inline-block; padding:0; line-height:1; position:absolute; visibility:hidden; font-size:1em",i.appendChild(document.createTextNode("M")),document.body.appendChild(i);let t=i.offsetHeight;return document.body.removeChild(i),t}catch(i){return 16}}function Wx(){if(typeof window=="undefined")return!1;if("ontouchstart"in window||"DocumentTouch"in window||"createTouch"in document&&"createTouchList"in document)return!0;var i=" -webkit- -moz- -o- -ms- ".split(" "),t=function(r){return window.matchMedia(r).matches},e=["(",i.join("touch-enabled),("),"heartz",")"].join("");return t(e)}function Ux(){let i=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4))}function zx(){return typeof location=="undefined"||!location.host?"localhost":`${location.protocol}//${location.host}`}var Yx=/^(mm|cm|in|inch|px|em)$/,Hx=/^([0-9\\.]+)(.*)$/,cl=Gx(),au=cl/25.4,$x=Vx(),ul=qx(),Zx=Wx(),Xx=Ux(),Qx=zx();function Kx(i){return i/au}function ks(i){return i*au}function Jx(i){if(typeof i=="number")return i;let t=NaN,e,r=i.toString().match(Hx);if(r&&r[1]){t=parseFloat(r[1]);let n=r[2]?r[2].toLowerCase():"undefined";e=Yx.test(n)?n:void 0,e||console.log("Unknown unit '"+n+"' => using 'px'.")}else t=parseFloat(i);switch(Xh.isFinite(t,"value in function toPx"),e){case"mm":return ks(t);case"cm":return ks(t)*10;case"in":case"inch":return ks(t)*25.4;case"em":return ul*t;default:case"px":return t}}var $={};er($,{Arr:()=>hl,Dom:()=>pl,Enum:()=>Jh,Math:()=>fl,Obj:()=>Kh,Str:()=>Qh});var hl={};er(hl,{arrayContains:()=>sA,chunckArray:()=>aA,duplicate:()=>eA,fillArray:()=>iA,getRangeArray:()=>oA,getSequenceArray:()=>nA,isArray:()=>je,mapRangeArray:()=>dl,mapSequenceArray:()=>ll,removeDuplicates:()=>rA,toArray:()=>tA});function tA(i){return je(i)?i:[i]}function eA(i){var t;return(t=i==null?void 0:i.slice())!=null?t:[]}function rA(i,t){return t!==void 0?i.filter((e,r,n)=>r===n.findIndex(o=>t(e,o))):i.filter((e,r,n)=>r===n.indexOf(e))}function iA(i,t){if(!Lt(t)||t<0)throw new Error("fillArray: Invalid fillCount = "+t);return new Array(t).fill(i)}function ll(i,t){if(!Lt(i)||i<0)throw new Error("mapSequenceArray: Invalid len = "+i);let e=new Array(i);for(let r=0;r<i;r++)e[r]=t(r);return e}function nA(i){return ll(i,t=>t)}function dl(i,t,e){if(!Lt(i))throw new Error("mapRangeArray: Invalid start = "+t);if(!Lt(t))throw new Error("mapRangeArray: Invalid end = "+t);let r=Math.abs(t-i)+1,n=new Array(r);for(let o=0,s=i,a=Math.sign(t-i);o<r;s+=a,o++)n[o]=e(s);return n}function oA(i,t){return dl(i,t,e=>e)}function sA(i,t){return i.indexOf(t)>=0}function aA(i,t){if(!Lt(t)||t<1)throw new Error("chunckArray: Invalid chunckSize = "+t);let e=[];for(let r=0;r<i.length;r+=t)e.push(i.slice(r,r+t));return e}var pl={};er(pl,{addClass:()=>cA,appendTo:()=>gA,getButton:()=>AA,getCanvas:()=>CA,getCanvasTextWidth:()=>wA,getDimension:()=>vA,getHeight:()=>mA,getOffset:()=>lA,getPadding:()=>_A,getWidth:()=>dA,hasClass:()=>cu,removeClass:()=>uA,removeFromParent:()=>yA,setHeight:()=>fA,setOffset:()=>hA,setRect:()=>xA,setVisibility:()=>bA,setWidth:()=>pA,styleLayoutChanged:()=>SA});function ml(i){var t;return typeof document=="undefined"?void 0:(t=document.getElementById(i))!=null?t:void 0}function Dt(i){return i===void 0?void 0:Vs.toPx(i)}function cu(i,t){return t.length===0?!1:i.classList?i.classList.contains(t):!!i.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function cA(i,t){t.length!==0&&(i.classList?i.classList.add(t):cu(i,t)||(i.className+=" "+t))}function uA(i,t){if(t.length!==0){if(i.classList)i.classList.remove(t);else if(cu(i,t)){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");i.className=i.className.replace(e," ")}}}function hA(i,t,e,r="px"){i.style.left=t+r,i.style.top=e+r}function lA(i){let{left:t,top:e}=i.getBoundingClientRect();if(typeof window!="undefined"&&(t+=window.pageXOffset,e+=window.pageYOffset),typeof document!="undefined"){let r=document.documentElement;t-=r.clientLeft,e-=r.clientTop}return{left:t,top:e}}function dA(i){if(i instanceof Window)return i.innerWidth;{let t=parseFloat(getComputedStyle(i,null).width.replace("px",""));return isNaN(t)?0:t}}function pA(i,t){i.style.width=t+"px"}function mA(i){if(i instanceof Window)return i.innerHeight;{let t=parseFloat(getComputedStyle(i,null).height.replace("px",""));return isNaN(t)?0:t}}function fA(i,t){i.style.height=t+"px"}function gA(i,t){t.appendChild(i)}function yA(i){i.remove()}function bA(i,t){i.style.display=t?"block":"none"}function xA(i,t,e,r,n,o="px"){i.style.left=t+o,i.style.top=e+o,i.style.width=r+o,i.style.height=n+o}function AA(i){let t=typeof i=="string"?ml(i):i;return t instanceof HTMLButtonElement?t:void 0}function CA(i){let t=typeof i=="string"?ml(i):i;return t instanceof HTMLCanvasElement?t:void 0}function _A(i){var s;if(!i)return{top:0,right:0,bottom:0,left:0};let t=Dt(i.paddingTop),e=Dt(i.paddingRight),r=Dt(i.paddingBottom),n=Dt(i.paddingLeft),o=((s=i.padding)!=null?s:"").toString().split(" ").filter(a=>a.length>0);switch(o.length){case 0:break;case 1:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[0])),r!=null||(r=Dt(o[0])),n!=null||(n=Dt(o[0]));break;case 2:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[0])),n!=null||(n=Dt(o[1]));break;case 3:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[2])),n!=null||(n=Dt(o[1]));break;case 4:default:t!=null||(t=Dt(o[0])),e!=null||(e=Dt(o[1])),r!=null||(r=Dt(o[2])),n!=null||(n=Dt(o[3]));break}return t!=null||(t=0),e!=null||(e=0),r!=null||(r=0),n!=null||(n=0),{top:t,right:e,bottom:r,left:n}}function vA(i){let t=Dt(i==null?void 0:i.left),e=Dt(i==null?void 0:i.right),r=Dt(i==null?void 0:i.top),n=Dt(i==null?void 0:i.bottom),o=Dt(i==null?void 0:i.width),s=Dt(i==null?void 0:i.height);return o===void 0&&t!==void 0&&e!==void 0&&(o=e-t),s===void 0&&r!==void 0&&n!==void 0&&(s=n-r),{left:t,top:r,width:o,height:s}}function SA(i,t){return!i&&!t?!1:!i||!t?!0:i.left!==t.left||i.top!==t.top||i.right!==t.right||i.bottom!==t.bottom||i.width!==t.width||i.height!==t.height}var no;function wA(i,t){!no&&typeof document!="undefined"&&(no=document.createElement("canvas"));let e=no==null?void 0:no.getContext("2d");return e?(e.font=t,e.measureText(i).width):0}var fl={};er(fl,{avg:()=>DA,calcNormal:()=>EA,clamp:()=>ru,cmp:()=>kA,interpolateCoord:()=>RA,interpolateY:()=>MA,isInteger:()=>Lt,isNumber:()=>kt,linearToDecibels:()=>IA,mod:()=>TA,romanize:()=>NA,sum:()=>gl,toOrdinalNumber:()=>OA});function IA(i){if(isFinite(i))return i<=0?-1/0:20*Math.log10(i);throw new Error("linearToDecibel: Invalid linearVolume = "+i)}function TA(i,t){return(i%t+t)%t}function NA(i){if(!Lt(i)||i<0)throw new Error("romanize: Invalid n = "+i);for(var t=String(+i).split(""),e=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],r="",n=3;n--;)r=(e[+t.pop()+n*10]||"")+r;return Array(+t.join("")+1).join("M")+r}function OA(i){if(!Lt(i))throw new Error("toOrdinalNumber: Invalid n = "+i);let t=i.toString(),e=Number(t.charAt(t.length-1));return i===1||i>=20&&e===1?t+"st":i===2||i>=20&&e===2?t+"nd":i===3||i>=20&&e===3?t+"rd":t+"th"}function RA(i,t,e,r,n){return{x:i+(e-i)*n,y:t+(r-t)*n}}function MA(i,t,e,r,n){let o=(n-i)/(e-i);return t+(r-t)*o}function ru(i,t,e){return Math.min(Math.max(i,t),e)}function EA(i,t,e,r){let n=e-i,s=-(r-t),a=n,c=Math.sqrt(s*s+a*a);return c>0?(s/=c,a/=c):(s=0,a=1),{nx:s,ny:a}}function gl(i){return i.reduce((t,e)=>e+t,0)}function DA(...i){return gl(i)/i.length}function kA(i,t){return i<t?-1:i>t?1:0}var Le=(i,t)=>i===t,jr=class{};var yl=class We extends jr{constructor(...t){if(super(),ft(this,"coords"),t.length<2)throw new TypeError("Vec needs minumum two coords!");this.coords=t}static vec2(t,e){return new We(t,e)}static vec3(t,e,r){return new We(t,e,r)}static zero(t){if(t<2)throw new TypeError("Vec.zero requires dimension >= 2");return new We(...Array(t).fill(0))}get dim(){return this.coords.length}get length(){return Math.hypot(...this.coords)}magnitude(){return this.length}get x(){return this.coords[0]}get y(){return this.coords[1]}get z(){if(this.coords[2]===void 0)throw new TypeError("Vec z-coord not available!");return this.coords[2]}add(...t){let e=t[0]instanceof We?t[0].coords:t;if(this.coords.length!==e.length)throw new TypeError("Coordinate length mismatch!");return new We(...this.coords.map((r,n)=>r+e[n]))}sub(...t){let e=t[0]instanceof We?t[0].coords:t;if(this.coords.length!==e.length)throw new TypeError("Coordinate length mismatch!");return new We(...this.coords.map((r,n)=>r-e[n]))}mul(t){return new We(...this.coords.map(e=>e*t))}div(t){return new We(...this.coords.map(e=>e/t))}dot(t){if(this.coords.length!==t.coords.length)throw new TypeError("Coordinate length mismatch!");return this.coords.reduce((e,r,n)=>e+r*t.coords[n],0)}distance(t){if(this.coords.length!==t.coords.length)throw new TypeError("Coordinate length mismatch!");return Math.hypot(...this.coords.map((e,r)=>e-t.coords[r]))}normalize(){let t=this.length;if(t===0)throw new TypeError("Cannot normalize zero-length vector!");return this.div(t)}static lerp(t,e,r){if(t.coords.length!==e.coords.length)throw new TypeError("Coordinate length mismatch!");if(!rn(r))throw new TypeError("Lerp t is not finite!");return t.add(e.sub(t).mul(r))}toLength(t){let e=this.length;return e===0?this:this.mul(t/e)}clamp(t,e,r){let n=this.length;if(n===0){if(t!==void 0){if(r&&r.coords.length!==this.coords.length)throw new TypeError("Coordinate length mismatch!");return(r&&r.length!==0?r.normalize():new We(1,...Array(this.coords.length-1).fill(0))).mul(t)}return this}return e!==void 0&&n>e?this.normalize().mul(e):t!==void 0&&n<t?this.normalize().mul(t):this}equals(t){return this.coords.length===t.coords.length&&this.coords.every((e,r)=>e===t.coords[r])}clone(){return new We(...this.coords)}toObject(){return{x:this.x,y:this.y,z:this.z}}[Symbol.iterator](){return this.coords[Symbol.iterator]()}toString(){return`Vec(${this.coords.join(", ")})`}},uu=class Ie{constructor(...t){if(ft(this,"x"),ft(this,"y"),ft(this,"width"),ft(this,"height"),t.length===0?this.x=this.y=this.width=this.height=0:t.length===2?(this.x=this.y=0,this.width=t[0],this.height=t[1]):(this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]),this.width<0||this.height<0)throw new Error("Rect width and height must be non-negative.")}set(...t){if(t.length===0?this.x=this.y=this.width=this.height=0:t.length===2?(this.x=this.y=0,this.width=t[0],this.height=t[1]):(this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]),this.width<0||this.height<0)throw new Error("Rect width and height must be non-negative.");return this}static fromPoints(t,e){let r=Math.min(t.x,e.x),n=Math.min(t.y,e.y),o=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return new Ie(r,n,o,s)}static fromCenter(t,e,r,n){return new Ie(t-r/2,e-n/2,r,n)}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}get center(){return{x:this.centerX,y:this.centerY}}get area(){return this.width*this.height}get isEmpty(){return this.width<=0||this.height<=0}containsPoint(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom}containsRect(t){return t.left>=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom}intersects(t){return!(t.right<this.left||t.left>this.right||t.bottom<this.top||t.top>this.bottom)}intersectionCopy(t){let e=Math.max(this.left,t.left),r=Math.max(this.top,t.top),n=Math.min(this.right,t.right),o=Math.min(this.bottom,t.bottom);return n<=e||o<=r?new Ie:new Ie(e,r,n-e,o-r)}unionCopy(t){let e=Math.min(this.left,t.left),r=Math.min(this.top,t.top),n=Math.max(this.right,t.right),o=Math.max(this.bottom,t.bottom);return new Ie(e,r,n-e,o-r)}insetCopy(t,e){return new Ie(this.x+t,this.y+e,this.width-2*t,this.height-2*e)}inflateCopy(t,e){return new Ie(this.x-t,this.y-e,this.width+2*t,this.height+2*e)}offsetInPlace(t,e){return this.x+=t,this.y+=e,this}offsetCopy(t,e){return new Ie(this.x+t,this.y+e,this.width,this.height)}scaleInPlace(t,e=t){return this.x=this.centerX-this.width*t/2,this.width*=t,this.y=this.centerY-this.height*e/2,this.height*=e,this}scaleCopy(t,e=t){return this.clone().scaleInPlace(t,e)}roundCopy(){let t=Math.round(this.left),e=Math.round(this.top),r=Math.round(this.right),n=Math.round(this.bottom);return new Ie(t,e,r-t,n-e)}floorCopy(){let t=Math.floor(this.left),e=Math.floor(this.top),r=Math.floor(this.right),n=Math.floor(this.bottom);return new Ie(t,e,r-t,n-e)}ceilCopy(){let t=Math.ceil(this.left),e=Math.ceil(this.top),r=Math.ceil(this.right),n=Math.ceil(this.bottom);return new Ie(t,e,r-t,n-e)}expandCopy(t,e){let r=Math.min(this.left,t),n=Math.min(this.top,e),o=Math.max(this.right,t),s=Math.max(this.bottom,e);return new Ie(r,n,o-r,s-n)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Ie(this.x,this.y,this.width,this.height)}toString(){return`Rect(x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height})`}toAnchoredRect(){return new G(this.left,this.right,this.top,this.bottom)}},G=class vi{constructor(...t){if(ft(this,"left"),ft(this,"anchorX"),ft(this,"right"),ft(this,"top"),ft(this,"anchorY"),ft(this,"bottom"),t.length===6)this.left=t[0],this.anchorX=t[1],this.right=t[2],this.top=t[3],this.anchorY=t[4],this.bottom=t[5];else if(t.length===4)this.left=t[0],this.right=t[1],this.anchorX=(this.left+this.right)/2,this.top=t[2],this.bottom=t[3],this.anchorY=(this.top+this.bottom)/2;else if(t.length===0)this.left=this.anchorX=this.right=0,this.top=this.anchorY=this.bottom=0;else throw new TypeError(`Invalid AnchoredRect args: ${t}`)}set(...t){if(t.length===6)this.left=t[0],this.anchorX=t[1],this.right=t[2],this.top=t[3],this.anchorY=t[4],this.bottom=t[5];else if(t.length===4)this.left=t[0],this.right=t[1],this.anchorX=(this.left+this.right)/2,this.top=t[2],this.bottom=t[3],this.anchorY=(this.top+this.bottom)/2;else if(t.length===0)this.left=this.anchorX=this.right=0,this.top=this.anchorY=this.bottom=0;else throw new TypeError(`Invalid AnchoredRect args: ${t}`);return this}static create(t,e,r,n){return new vi(t,t+r,e,e+n)}static createCentered(t,e,r,n){return new vi(t-r/2,t,t+r/2,e-n/2,e,e+n/2)}static createSections(t,e,r,n){return new vi(-t,0,e,-r,0,n)}get centerX(){return this.left+this.width/2}get centerY(){return this.top+this.height/2}get width(){return this.right-this.left}get height(){return this.bottom-this.top}get leftw(){return this.anchorX-this.left}get rightw(){return this.right-this.anchorX}get toph(){return this.anchorY-this.top}get bottomh(){return this.bottom-this.anchorY}contains(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom}static overlap(t,e){return t.right>e.left&&t.left<e.right&&t.bottom>e.top&&t.top<e.bottom}static overlapX(t,e){return t.right>e.left&&t.left<e.right}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.left===e.left&&t.anchorX===e.anchorX&&t.right===e.right&&t.top===e.top&&t.anchorY===e.anchorY&&t.bottom===e.bottom}equals(t){return vi.equals(this,t)}static equalsEdges(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.left===e.left&&t.right===e.right&&t.top===e.top&&t.bottom===e.bottom}equalsEdges(t){return vi.equalsEdges(this,t)}clone(){return new vi(this.left,this.anchorX,this.right,this.top,this.anchorY,this.bottom)}offsetInPlace(t,e){return this.left+=t,this.anchorX+=t,this.right+=t,this.top+=e,this.anchorY+=e,this.bottom+=e,this}offsetCopy(t,e){return this.clone().offsetInPlace(t,e)}expandInPlace(t){return this.left=Math.min(this.left,t.left),this.right=Math.max(this.right,t.right),this.top=Math.min(this.top,t.top),this.bottom=Math.max(this.bottom,t.bottom),this}expandCopy(t){return this.clone().expandInPlace(t)}clipInPlace(t){return this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.anchorX=ru(this.anchorX,this.left,this.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this.anchorY=ru(this.anchorY,this.top,this.bottom),this}clipCopy(t){return this.clone().clipInPlace(t)}scaleInPlace(t,e=t){return this.left=this.anchorX-this.leftw*t,this.right=this.anchorX+this.rightw*t,this.top=this.anchorY-this.toph*e,this.bottom=this.anchorY+this.bottomh*e,this}scaleCopy(t,e=t){return this.clone().scaleInPlace(t,e)}getRect(){return this}toRect(){return new uu(this.left,this.right,this.width,this.height)}toString(){return`Rect(left=${this.left}, anchorX=${this.anchorX}, right=${this.right}, top=${this.top}, anchorY=${this.anchorY}, bottom=${this.bottom})`}},bl=class extends jr{constructor(i,t=1/0){super(),ft(this,"cache"),ft(this,"next"),ft(this,"prev"),ft(this,"head"),ft(this,"tail"),ft(this,"capacity"),ft(this,"size"),ft(this,"maxKeyLength"),this.cache=Object.create(null),this.next=Object.create(null),this.prev=Object.create(null),this.head=null,this.tail=null,this.capacity=i,this.size=0,this.maxKeyLength=t}get(i){if(!(i.length>this.maxKeyLength)&&this.cache[i]!==void 0)return this.touch(i),this.cache[i]}set(i,t){if(!(i.length>this.maxKeyLength)){if(this.cache[i]!==void 0){this.cache[i]=t,this.touch(i);return}this.size>=this.capacity&&this.evict(),this.cache[i]=t,this.addToTail(i),this.size++}}touch(i){this.tail!==i&&(this.removeKey(i),this.addToTail(i))}evict(){if(this.head!==null){let i=this.head;this.removeKey(i),delete this.cache[i],this.size--}}removeKey(i){let t=this.prev[i],e=this.next[i];t!==void 0?this.next[t]=e:this.head=e!=null?e:null,e!==void 0?this.prev[e]=t:this.tail=t!=null?t:null,delete this.prev[i],delete this.next[i]}addToTail(i){this.tail!==null?(this.next[this.tail]=i,this.prev[i]=this.tail):this.head=i,this.tail=i}*keys(){for(let i=this.head;i!=null;i=this.next[i])yield i}*values(){for(let i=this.head;i!=null;i=this.next[i])yield this.cache[i]}*entries(){for(let i=this.head;i!=null;i=this.next[i])yield[i,this.cache[i]]}*[Symbol.iterator](){yield*pe(this.entries())}toString(){let i=[...this.entries()];return i.length===0?"LRUCache(0){ }":`LRUCache(${i.length}){ ${i.map(t=>`${Gt(t[0])}: ${Gt(t[1])}`).join(", ")} }`}},vr=class Kr extends jr{constructor(t){if(super(),ft(this,"posVal"),ft(this,"hasPos"),ft(this,"valCount"),t instanceof Kr)this.posVal=t.posVal.slice(),this.hasPos=t.hasPos.slice(),this.valCount=t.valCount;else if(this.posVal=[],this.hasPos=[],this.valCount=0,t)for(let[e,r]of t)this.set(e,r)}static validateIndex(t){if(!nu(t,0))throw new Error(`Invalid index ${t} - must be an integer >= 0!`);return t}get posLen(){return this.hasPos.length}get size(){return this.valCount}get length(){return this.hasPos.length}trimRight(){let t=this.length;for(;t>0&&this.hasPos[t-1]!==!0;)t--;t<this.length&&(this.posVal.length=this.hasPos.length=t)}isEmpty(){return this.size===0}has(t){return Kr.validateIndex(t),this.hasPos[t]===!0}set(t,e){Kr.validateIndex(t),this.hasPos[t]!==!0&&this.valCount++,this.posVal[t]=e,this.hasPos[t]=!0}get(t){return Kr.validateIndex(t),this.hasPos[t]?this.posVal[t]:void 0}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){return Kr.validateIndex(t),this.hasPos[t]?(this.posVal[t]=void 0,this.hasPos[t]=!1,this.valCount--,this.trimRight(),!0):!1}clear(){this.posVal=[],this.hasPos=[],this.valCount=0}forEach(t,e){for(let[r,n]of this.entries())t.call(e,n,r,this)}*indices(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield t)}*values(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield this.posVal[t])}*entries(){for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield[t,this.posVal[t]])}indicesArray(){return[...this.indices()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.indices())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Kr(this)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.entries())if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.entries())if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.entries())t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty IndexArray with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapToArray(t){let e=[];for(let[r,n]of this.entries())e.push(t(n,r));return e}map(t){let e=new Kr;for(let[r,n]of this.entries())e.set(r,t(n,r));return e}equals(t,e){if(this.size!==t.size)return!1;e!=null||(e=(n,o)=>n===o);let r=Math.max(this.posLen,t.posLen);for(let n=0;n<r;++n){let o=this.hasPos[n],s=t.hasPos[n];if(o!==s||o&&!e(this.posVal[n],t.posVal[n]))return!1}return!0}toArray(){return this.valuesArray()}toString(){let t=!0;for(let r=0;r<this.hasPos.length&&t;r++)this.hasPos[r]||(t=!1);if(t)return Gt(this.posVal.slice(0,this.hasPos.length));let e=this.entriesArray().map(([r,n])=>`${Gt(r)}: ${Gt(n)}`).join(", ");return e.length===0?"[ ]":`[ ${e} ]`}},xl=class Te extends jr{constructor(t){if(super(),ft(this,"posVal"),ft(this,"hasPos"),ft(this,"negVal"),ft(this,"hasNeg"),ft(this,"valCount"),t instanceof Te)this.negVal=t.negVal.slice(),this.hasNeg=t.hasNeg.slice(),this.posVal=t.posVal.slice(),this.hasPos=t.hasPos.slice(),this.valCount=t.valCount;else if(this.negVal=[],this.hasNeg=[],this.posVal=[],this.hasPos=[],this.valCount=0,t)for(let[e,r]of t)this.set(e,r)}static toNegIndex(t){return-t-1}static validateIndex(t){if(!Lt(t))throw new Error(`Invalid index ${t} - must be an integer!`);return t}get size(){return this.valCount}isEmpty(){return this.size===0}get posLen(){return this.hasPos.length}get negLen(){return this.hasNeg.length}has(t){return Te.validateIndex(t),t>=0?this.hasPos[t]===!0:this.hasNeg[Te.toNegIndex(t)]===!0}set(t,e){if(Te.validateIndex(t),t>=0)this.hasPos[t]!==!0&&this.valCount++,this.posVal[t]=e,this.hasPos[t]=!0;else{let r=Te.toNegIndex(t);this.hasNeg[r]!==!0&&this.valCount++,this.negVal[r]=e,this.hasNeg[r]=!0}}get(t){if(Te.validateIndex(t),t>=0)return this.hasPos[t]?this.posVal[t]:void 0;{let e=Te.toNegIndex(t);return this.hasNeg[e]?this.negVal[e]:void 0}}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){Te.validateIndex(t);let e=t>=0,r=e?this.posVal:this.negVal,n=e?this.hasPos:this.hasNeg,o=e?t:Te.toNegIndex(t);return n[o]?(r[o]=void 0,n[o]=!1,this.valCount--,!0):!1}clear(){this.negVal=[],this.hasNeg=[],this.posVal=[],this.hasPos=[],this.valCount=0}forEach(t,e){for(let[r,n]of this.entries())t.call(e,n,r,this)}*indices(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield Te.toNegIndex(t));for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield t)}*values(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield this.negVal[t]);for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield this.posVal[t])}*entries(){for(let t=this.negLen-1;t>=0;t--)this.hasNeg[t]&&(yield[Te.toNegIndex(t),this.negVal[t]]);for(let t=0;t<this.posLen;t++)this.hasPos[t]&&(yield[t,this.posVal[t]])}indicesArray(){return[...this.indices()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.indices())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Te(this)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.entries())if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.entries())if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.entries())t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty SignedIndexArray with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapToArray(t){let e=[];for(let[r,n]of this.entries())e.push(t(n,r));return e}map(t){let e=new Te;for(let[r,n]of this.entries())e.set(r,t(n,r));return e}equals(t,e){if(this.size!==t.size)return!1;e!=null||(e=(o,s)=>o===s);let r=Math.max(this.posLen,t.posLen);for(let o=0;o<r;++o){let s=this.hasPos[o],a=t.hasPos[o];if(s!==a||s&&!e(this.posVal[o],t.posVal[o]))return!1}let n=Math.max(this.negLen,t.negLen);for(let o=0;o<n;++o){let s=this.hasNeg[o],a=t.hasNeg[o];if(s!==a||s&&!e(this.negVal[o],t.negVal[o]))return!1}return!0}toArray(){return this.valuesArray()}toString(){let t=this.hasNeg.length===0;for(let r=0;r<this.hasPos.length&&t;r++)this.hasPos[r]||(t=!1);if(t)return Gt(this.posVal.slice(0,this.hasPos.length));let e=this.entriesArray().map(([r,n])=>`${Gt(r)}: ${Gt(n)}`).join(", ");return e.length===0?"[ ]":`[ ${e} ]`}};var lt=class oo extends jr{constructor(...t){super(),ft(this,"map"),ft(this,"keyEquals");let e=t.at(-1);this.keyEquals=_r(e)?t.pop():Le;let r=t[0];this.map=new Map(r)}static createDeep(t){return t?new oo(t,ao):new oo(ao)}has(t){if(this.keyEquals===Le||this.map.has(t))return this.map.has(t);for(let[e,r]of this.map)if(this.keyEquals(e,t))return!0;return!1}set(t,e){if(this.keyEquals===Le||this.map.has(t))return this.map.set(t,e),e;for(let r of this.map.keys())if(this.keyEquals(r,t))return this.map.set(r,e),e;return this.map.set(t,e),e}get(t){if(this.keyEquals===Le||this.map.has(t))return this.map.get(t);for(let[e,r]of this.map)if(this.keyEquals(e,t))return r}delete(t){if(this.keyEquals===Le||this.map.has(t))return this.map.delete(t);for(let e of this.map.keys())if(this.keyEquals(e,t))return this.map.delete(e);return this.map.delete(t)}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r)}return this.get(t)}clear(){this.map.clear()}get size(){return this.map.size}isEmpty(){return this.size===0}forEach(t,e){this.map.forEach((r,n)=>t.call(e,r,n,this))}*keys(){yield*pe(this.map.keys())}*values(){yield*pe(this.map.values())}*entries(){for(let[t,e]of this.map)yield[t,e]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let t of this.keys())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new oo(this,this.keyEquals)}merge(t,e){for(let[r,n]of t.entries())this.has(r)&&e?this.set(r,e(this.get(r),n,r)):this.set(r,n);return this}some(t){for(let[e,r]of this.map)if(t(r,e))return!0;return!1}every(t){for(let[e,r]of this.map)if(!t(r,e))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map)t(n,r,this)&&e.set(r,n);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty UniMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[1],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u]=a.value;o=t(o,u,c)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map)e.push(t(n,r));return e}mapValues(t){let e=new oo;for(let[r,n]of this.map)e.set(r,t(n,r));return e}toMap(){return new Map(this.map)}toString(){let t=[...this.map].map(([e,r])=>`${Gt(e)} => ${Gt(r)}`).join(", ");return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t} }`}},Al=class Ls extends jr{constructor(t){if(super(),ft(this,"map1"),ft(this,"key1Equals",Le),ft(this,"key2Equals",Le),this.map1=new lt(this.key1Equals),t instanceof Ls)for(let[e,r]of t.map1){let n=this.map1.set(e,new lt(this.key2Equals));for(let[o,s]of r)n.set(o,s)}else if(t)for(let[e,r,n]of t)this.set(e,r,n)}has(t,e){var r,n;return(n=(r=this.map1.get(t))==null?void 0:r.has(e))!=null?n:!1}set(t,e,r){return this.map1.getOrCreate(t,()=>new lt(this.key2Equals)).set(e,r)}get(t,e){var r;return(r=this.map1.get(t))==null?void 0:r.get(e)}getOrDefault(t,e,r){var n;return(n=this.get(t,e))!=null?n:r}getOrCreate(t,e,r){if(!this.has(t,e)){let n=_r(r)?r():r;return this.set(t,e,n),n}return this.get(t,e)}delete(t,e){if(e===void 0)return this.map1.delete(t);let r=this.map1.get(t);return r?r.delete(e):!1}clear(){this.map1.clear()}get size(){let t=0;for(let e of this.map1.values())t+=e.size;return t}isEmpty(){return this.size===0}forEach(t,e){this.map1.forEach((r,n)=>r.forEach((o,s)=>t.call(e,o,n,s,this)))}*keys(){for(let[t,e]of this.map1)for(let r of e.keys())yield[t,r]}*values(){for(let t of this.map1.values())for(let e of t.values())yield e}*entries(){for(let[t,e]of this.map1)for(let[r,n]of e)yield[t,r,n]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let[t,e]of this.keys())yield[t,e]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e,r]of this.entries())yield[[t,e],r]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new Ls(this)}merge(t,e){for(let[r,n,o]of t.entries())this.has(r,n)&&e?this.set(r,n,e(this.get(r,n),o,r,n)):this.set(r,n,o);return this}some(t){for(let[e,r]of this.map1)for(let[n,o]of r)if(t(o,e,n))return!0;return!1}every(t){for(let[e,r]of this.map1)for(let[n,o]of r)if(!t(o,e,n))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map1)for(let[o,s]of n)t(s,r,o,this)&&e.set(r,o,s);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty BiMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[2],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u,h]=a.value;o=t(o,h,c,u)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map1)for(let[o,s]of n)e.push(t(s,r,o));return e}mapValues(t){let e=new Ls;for(let[r,n]of this.map1)for(let[o,s]of n)e.set(r,o,t(s,r,o));return e}toMap(){let t=new Map;for(let[e,r]of this.map1)for(let[n,o]of r)t.set([e,n],o);return t}toString(){let t=[];for(let[e,r]of this.map1){let n=[...r].map(([o,s])=>`${Gt(o)} => ${Gt(s)}`).join(", ");t.push(`${Gt(e)} => { ${n} }`)}return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t} }`}},qs=class js extends jr{constructor(t){if(super(),ft(this,"map1"),ft(this,"key1Equals",Le),ft(this,"key2Equals",Le),ft(this,"key3Equals",Le),this.map1=new lt(this.key1Equals),t instanceof js)for(let[e,r]of t.map1){let n=this.map1.set(e,new lt(this.key2Equals));for(let[o,s]of r)n.set(o,new lt(s,this.key3Equals))}else if(t)for(let[e,r,n,o]of t)this.set(e,r,n,o)}has(t,e,r){var n,o,s;return(s=(o=(n=this.map1.get(t))==null?void 0:n.get(e))==null?void 0:o.has(r))!=null?s:!1}set(t,e,r,n){return this.map1.getOrCreate(t,()=>new lt(this.key2Equals)).getOrCreate(e,()=>new lt(this.key3Equals)).set(r,n),n}get(t,e,r){var n,o;return(o=(n=this.map1.get(t))==null?void 0:n.get(e))==null?void 0:o.get(r)}getOrDefault(t,e,r,n){var o;return(o=this.get(t,e,r))!=null?o:n}getOrCreate(t,e,r,n){if(!this.has(t,e,r)){let o=_r(n)?n():n;return this.set(t,e,r,o),o}return this.get(t,e,r)}delete(t,e,r){var n;if(r===void 0){if(e===void 0)return this.map1.delete(t);let o=this.map1.get(t);return o?o.delete(e):!1}else{if(e===void 0)return this.map1.delete(t);let o=(n=this.map1.get(t))==null?void 0:n.get(e);return o?o.delete(r):!1}}clear(){this.map1.clear()}get size(){let t=0;for(let e of this.map1.values())for(let r of e.values())t+=r.size;return t}isEmpty(){return this.size===0}forEach(t,e){this.map1.forEach((r,n)=>r.forEach((o,s)=>o.forEach((a,c)=>t.call(e,a,n,s,c,this))))}*keys(){for(let[t,e]of this.map1)for(let[r,n]of e)for(let o of n.keys())yield[t,r,o]}*values(){for(let t of this.map1.values())for(let e of t.values())for(let r of e.values())yield r}*entries(){for(let[t,e]of this.map1)for(let[r,n]of e)for(let[o,s]of n)yield[t,r,o,s]}keysArray(){return[...this.keys()]}valuesArray(){return[...this.values()]}entriesArray(){return[...this.entries()]}*kvKeys(){for(let[t,e,r]of this.keys())yield[t,e,r]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e,r,n]of this.entries())yield[[t,e,r],n]}*[Symbol.iterator](){yield*pe(this.entries())}clone(){return new js(this)}merge(t,e){for(let[r,n,o,s]of t.entries())this.has(r,n,o)&&e?this.set(r,n,o,e(this.get(r,n,o),s,r,n,o)):this.set(r,n,o,s);return this}some(t){for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)if(t(a,e,n,s))return!0;return!1}every(t){for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)if(!t(a,e,n,s))return!1;return!0}filter(t){let e=new this.constructor;for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)t(c,r,o,a,this)&&e.set(r,o,a,c);return e}reduce(t,e){let r=this.entries(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty TriMap with no initial value!");return e}let o,s;arguments.length<2?(o=n.value[3],s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let[c,u,h,l]=a.value;o=t(o,l,c,u,h)}return o}mapEntries(t){let e=[];for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)e.push(t(c,r,o,a));return e}mapValues(t){let e=new js;for(let[r,n]of this.map1)for(let[o,s]of n)for(let[a,c]of s)e.set(r,o,a,t(c,r,o,a));return e}toMap(){let t=new Map;for(let[e,r]of this.map1)for(let[n,o]of r)for(let[s,a]of o)t.set([e,n,s],a);return t}toString(){let t=[];for(let[e,r]of this.map1)for(let[n,o]of r){let s=[...o].map(([a,c])=>`${Gt(a)} => ${Gt(c)}`).join(", ");t.push(`${Gt(e)} => ${Gt(n)} => { ${s} }`)}return t.length===0?`Map(${this.size}){ }`:`Map(${this.size}){ ${t.join(", ")} }`}},Ws=class Si extends jr{constructor(...t){super(),ft(this,"data"),ft(this,"equals");let e=t.at(-1);this.equals=_r(e)?t.pop():Le;let r=t[0];this.data=new Set(r)}static createDeep(t){return t?new Si(t,ao):new Si(ao)}has(t){return this.equals===Le?this.data.has(t):this.some(e=>this.equals(e,t))}add(t){return this.has(t)||this.data.add(t),t}set(t,e){if(!this.equals(t,e))throw new TypeError("ValueSet.set() requires key === value.");this.add(e)}get(t){return this.has(t)?t:void 0}getOrDefault(t,e){var r;return(r=this.get(t))!=null?r:e}getOrCreate(t,e){if(!this.has(t)){let r=_r(e)?e():e;return this.set(t,r),r}return this.get(t)}delete(t){if(this.equals===Le||this.data.has(t))return this.data.delete(t);for(let e of this.values())if(this.equals(e,t))return this.data.delete(e),!0;return!1}clear(){this.data.clear()}get size(){return this.data.size}isEmpty(){return this.size===0}forEach(t,e){this.data.forEach(r=>t.call(e,r,this))}*keys(){yield*pe(this.data.keys())}*values(){yield*pe(this.data.values())}*entries(){yield*pe(this.data.entries())}*kvKeys(){for(let t of this.keys())yield[t]}*kvValues(){for(let t of this.values())yield t}*kvEntries(){for(let[t,e]of this.entries())yield[[t],e]}*[Symbol.iterator](){yield*pe(this.values())}clone(){let t=new Si;for(let e of this.values())t.add(e);return t}merge(t){for(let e of t.values())this.add(e);return this}some(t){for(let e of this.data)if(t(e))return!0;return!1}every(t){for(let e of this.data)if(!t(e))return!1;return!0}filter(t){let e=new Si;for(let r of this.data)t(r,this)&&e.add(r);return e}reduce(t,e){let r=this.values(),n=r.next();if(n.done){if(arguments.length<2)throw new TypeError("Reduce of empty ValueSet with no initial value!");return e}let o,s;arguments.length<2?(o=n.value,s=r.next()):(o=e,s=n);for(let a=s;!a.done;a=r.next()){let c=a.value;o=t(o,c)}return o}mapValues(t){let e=new Si;for(let r of this.data)e.add(t(r));return e}mapToArray(t){let e=[];for(let r of this.values())e.push(t(r));return e}map(t){let e=new Si;for(let r of this.values())e.add(t(r));return e}toSet(){return new Set(this.data)}toArray(){return[...this.values()]}toString(){return Gt(this.data)}},LA=class extends jr{constructor(i){super(),this.base=i}isEmpty(){return this.base.isEmpty()}clear(){var i,t;(t=(i=this.base).clear)==null||t.call(i)}add(...i){let t=i.slice(0,-1),e=i[i.length-1],r=this.base.get(...t);return this.base.set(...t,r?[...r,e]:[e]),e}remove(...i){let t=i.slice(0,-1),e=i[i.length-1],r=this.base.get(...t);if(!r)return!1;let n=r.indexOf(e);return n===-1?!1:(r.splice(n,1),r.length===0&&this.base.delete(...t),!0)}getAll(...i){var t;return(t=this.base.get(...i))!=null?t:[]}*iterAll(...i){yield*pe(this.getAll(...i))}*values(){for(let i of this.keys())yield*pe(this.getAll(...i))}*keys(){for(let i of this.base.kvKeys())yield i}*entries(){for(let i of this.keys()){let t=this.getAll(...i);t.length>0&&(yield[i,t])}}[Symbol.iterator](){return this.entries()}toString(){let i=[];for(let t of this.keys()){let e=this.getAll(...t),r=Array.isArray(t)?Gt(t):"[ ]",n=Array.isArray(e)?Gt(e):"[ ]";i.push(`${r} => ${n}`)}return i.length===0?"MultiContainer{ }":`MultiContainer{ ${i.join(", ")} }`}};function Us(i){return new LA(i)}var hu={};en(hu,{MusicError:()=>N,MusicErrorType:()=>_t,init:()=>Ii});var _t=(c=>(c[c.Unknown=0]="Unknown",c[c.InvalidArg=1]="InvalidArg",c[c.Note=2]="Note",c[c.Scale=3]="Scale",c[c.KeySignature=4]="KeySignature",c[c.Timesignature=5]="Timesignature",c[c.Score=6]="Score",c[c.Audio=7]="Audio",c))(_t||{});function jA(i){return i===void 0?"":`[${_t[i]}] `}var N=class extends Error{constructor(...e){let[r,n]=e.length===1?[0,e[0]]:e;super(jA(r)+n);d(this,"type");Object.setPrototypeOf(this,new.target.prototype),this.name="MusicError",this.type=r}};var Cl=!1;function Ii(){Cl||(Cl=!0,console.log("%cWebMusicScore v6.0.0-pre.2 (iife) initialized.","background: black; color: white; padding: 2px;"))}var Jr=(e=>(e[e.Ascii=0]="Ascii",e[e.Unicode=1]="Unicode",e))(Jr||{}),ti=(e=>(e[e.Scientific=0]="Scientific",e[e.Helmholtz=1]="Helmholtz",e))(ti||{}),PA=$.Enum.getEnumValues(ti),FA=0;function _l(i){if(y.isEnumValue(i,ti))return i;throw new N(1,`Invalid pitchNotation: ${i}`)}function BA(i){return ti[_l(i)]}var zs=(r=>(r.Default="Default",r.OmitOctave="Omit Octave",r.Interval="Interval",r))(zs||{}),GA="Default",VA=$.Enum.getEnumValues(zs);function qA(i){if(y.isEnumValue(i,zs))return i;throw new N(5,`Invalid guitarNoteLabel: ${i}`)}function vl(i,t){return(i%t+t)%t}var Sl=12,wl=7,WA=new Map([[-2,"bb"],[-1,"b"],[0,""],[1,"#"],[2,"x"]]),UA=new Map([[-2,"\u{1D12B}"],[-1,"\u266D"],[0,""],[1,"\u266F"],[2,"\u{1D12A}"]]),Il=new Map([["",0],["bb",-2],["b",-1],["#",1],["x",2],["\u{1D12B}",-2],["\u266D",-1],["\u266F",1],["\u{1D12A}",2]]),co=["C","D","E","F","G","A","B"],Tl=[0,2,4,5,7,9,11],Nl=/^([A-G])((?:bb|𝄫|♭|b|#|♯|x|𝄪)?)?(-?\d+)?$/,dt=class dt{constructor(t,e,r){d(this,"diatonicClass");d(this,"accidental");d(this,"octave");if(typeof t=="number"&&typeof e=="number"&&r===void 0)dt.validateDiatonicId(t),this.diatonicClass=dt.getDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.getOctaveFromDiatonicId(t);else if(typeof t=="number"&&typeof e=="number"&&typeof r=="number")this.diatonicClass=dt.validateDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.validateOctave(r);else if(typeof t=="string"&&typeof e=="number"&&typeof r=="number")this.diatonicClass=dt.getDiatonicClass(t),this.accidental=dt.validateAccidental(e),this.octave=dt.validateOctave(r);else throw new N(2,`Invalid args: ${t}, ${e}, ${r}`)}get diatonicId(){return dt.getDiatonicIdInOctave(this.diatonicClass,this.octave)}get chromaticId(){return dt.getChromaticIdInOctave(Tl[this.diatonicClass]+this.accidental,this.octave)}get midiNumber(){return this.chromaticId}get chromaticClass(){return dt.getChromaticClass(Tl[this.diatonicClass]+this.accidental)}get noteLetter(){return co[this.diatonicClass]}format(t,e){let{noteLetter:r,octave:n}=this,o=dt.getAccidentalSymbol(this.accidental,e);return t===1?n>=3?r.toLowerCase()+o+"\u2032".repeat(n-3):r.toUpperCase()+o+"\u0375".repeat(2-n):r+o+n}formatOmitOctave(t){let e=co[this.diatonicClass],r=dt.getAccidentalSymbol(this.accidental,t);return e+r}static getNote(t){return this.noteCache.getOrCreate(t,()=>{let e=dt.parseNote(t);if(!e)throw new N(2,`Invalid note "${t}".`);if(e.octave===void 0)throw new N(2,`Invalid note "${t}" (missing octave).`);return new dt(e.noteLetter,e.accidental,e.octave)})}static isNote(t){let e=dt.parseNote(t);return e!==void 0&&e.octave!==void 0}static validateNote(t){if(this.isNote(t))return!0;throw new N(2,`Invalid note "${t}"`)}static getChromaticNote(t){return this.chromaticNoteCache.getOrCreate(t,()=>{let r=["C/B#","C#/Db","D","D#/Eb","E/Fb","F/E#","F#/Gb","G","G#/Ab","A","A#/Bb","B/Cb"][dt.getChromaticClass(t)].split("/")[0]+dt.getOctaveFromChromaticId(t);return dt.getNote(r)})}static getDiatonicClass(t){if(typeof t=="number")return vl(t,7);if(typeof t=="string"&&t.length>0)return co.indexOf(dt.validateNoteLetter(t[0]));throw new N(2,`Invalid arg: ${t}`)}static getOctaveFromDiatonicId(t){return Math.floor((t-wl)/7)}static getDiatonicIdInOctave(t,e){return dt.getDiatonicClass(t)+e*7+wl}static getChromaticClass(t){return vl(t,12)}static getOctaveFromChromaticId(t){return Math.floor((t-Sl)/12)}static getChromaticIdInOctave(t,e){return dt.getChromaticClass(t)+e*12+Sl}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.diatonicId===e.diatonicId&&t.accidental===e.accidental}static replaceAccidentalSymbols(t,e){return e===1?t.replace("bb","\u{1D12B}").replace("b","\u266D").replace("#","\u266F").replace("x","\u{1D12A}"):t.replace("\u{1D12B}","bb").replace("\u266D","b").replace("\u266F","#").replace("\u{1D12A}","x")}static isValidNoteName(t){return Nl.test(t)}static parseNote(t){var c;let e=Nl.exec(t);if(!e)return;let r=dt.validateNoteLetter(e[1]),n=e[2],o=dt.validateAccidental((c=Il.get(n))!=null?c:0),s=e[3],a=s?dt.validateOctave(+s):void 0;return{noteLetter:r,accidental:o,octave:a}}static getScientificNoteName(t,e){let r=dt.parseNote(t);if(!r)throw new N(2,`Invalid noteName: ${t}`);let{noteLetter:n,accidental:o,octave:s}=r;return n+dt.getAccidentalSymbol(o,e)+(s!=null?s:"")}static getAccidentalSymbol(t,e){return e===1?UA.get(t):WA.get(t)}static getAccidental(t){let e=Il.get(t);if(e===void 0)throw new N(2,`Invalid accidental: ${t}`);return e}static getNoteLetter(t){return co[dt.getDiatonicClass(t)]}static findNextDiatonicIdAbove(t,e,r){let n=dt.getDiatonicClass(t),o=dt.getDiatonicClass(e),s=r?n<=o?1:0:n<o?1:0;return dt.getDiatonicIdInOctave(n,dt.getOctaveFromDiatonicId(e)+s)}static validateDiatonicId(t){if(y.isInteger(t))return t;throw new N(2,`Invalid diatonicId: ${t}`)}static validateDiatonicClass(t){if(y.isIntegerBetween(t,0,6))return t;throw new N(2,`Invalid diatonicClass: ${t}`)}static validateChromaticId(t){if(y.isInteger(t))return t;throw new N(2,`Invalid chromaticId: ${t}`)}static validatechromaticClass(t){if(y.isIntegerBetween(t,0,11))return t;throw new N(2,`Invalid chromaticClass: ${t}`)}static validateNoteLetter(t){if(co.some(e=>e===t))return t;throw new N(2,`Invalid note: ${t}`)}static validateOctave(t){if(y.isInteger(t))return t;throw new N(2,`Invalid octave: ${t}`)}static validateAccidental(t){if(y.isIntegerBetween(t,-2,2))return t;throw new N(2,`Invalid accidental: ${t}`)}static sort(t){return t.slice().sort(dt.compareFunc)}static removeDuplicates(t){let e=[];return t.forEach(r=>{e.find(n=>dt.equals(r,n))===void 0&&e.push(r)}),e}static compareFunc(t,e){return t.diatonicId<e.diatonicId?-1:t.diatonicId>e.diatonicId?1:t.accidental<e.accidental?-1:t.accidental>e.accidental?1:0}};d(dt,"noteCache",new lt),d(dt,"chromaticNoteCache",new lt);var U=dt;function zA(i,t){let e=U.getChromaticClass(i)-new U(t,0).chromaticClass;for(;e>2;)e-=12;for(;e<-2;)e+=12;return U.validateAccidental(e)}var YA=/^(bb?|b?|#?|x?)([0-9]*)$/;function HA(i){var n,o;let t=YA.exec(""+i);if(!t)throw new N(4,`Invalid degree: ${i}`);let e=(o=U.getAccidental((n=t[1])!=null?n:""))!=null?o:0,r=+t[2];if(!y.isInteger(e)||e<-2||e>2||!y.isInteger(r)||r<1)throw new N(4,`Invalid degree: ${i}`);return{deg:r,acc:e}}var lu=(a=>(a[a.Ionian=1]="Ionian",a[a.Dorian=2]="Dorian",a[a.Phrygian=3]="Phrygian",a[a.Lydian=4]="Lydian",a[a.Mixolydian=5]="Mixolydian",a[a.Aeolian=6]="Aeolian",a[a.Locrian=7]="Locrian",a))(lu||{}),du=(r=>(r[r.Natural=0]="Natural",r[r.Flats=1]="Flats",r[r.Sharps=2]="Sharps",r))(du||{});function Ys(){return Pr("C","Major")}var ei=class ei{constructor(t,e){this.tonic=t;this.mode=e;d(this,"naturalScaleNotes");d(this,"accidentalByDiatonicClass");d(this,"orderedAccidentedNotes");if(!y.isEnumValue(e,lu))throw new N(4,`Invalid mode: ${e}`);let r=[2,2,1,2,2,2,1];for(let c=1;c<e;c++)r.push(r.shift());this.naturalScaleNotes=[],this.accidentalByDiatonicClass=[];let n=U.getDiatonicClass(t[0]),o=U.getNote(t+"0").chromaticId;for(let c=0;c<7;n++,o+=r[c],c++){let u=new U(U.getDiatonicClass(n),zA(o,n));if(Math.abs(u.accidental)>=2)throw new N(4,"Key signature contains double accidental.");this.naturalScaleNotes[c]=u,this.accidentalByDiatonicClass[u.diatonicClass]=u.accidental}let s=this.naturalScaleNotes.filter(c=>c.accidental>0).sort((c,u)=>{let h=ei.OrderOfSharps.indexOf(c.noteLetter),l=ei.OrderOfSharps.indexOf(u.noteLetter);if(h===-1||l===-1)throw new N(4,"Unexpected note in key signature.");return h-l}),a=this.naturalScaleNotes.filter(c=>c.accidental<0).sort((c,u)=>{let h=ei.OrderOfFlats.indexOf(c.noteLetter),l=ei.OrderOfFlats.indexOf(u.noteLetter);if(h===-1||l===-1)throw new N(4,"Unexpected note in key signature.");return h-l});if(s.length!==0&&a.length!==0)throw new N(4,"Key Signature has both sharps and flats.");this.orderedAccidentedNotes=a.length>0?a:s}getAccidentalType(){return this.orderedAccidentedNotes.length===0?0:this.orderedAccidentedNotes[0].accidental<0?1:2}getNaturalScaleNotes(){return this.naturalScaleNotes}getAccidental(t){var e;return(e=this.accidentalByDiatonicClass[U.getDiatonicClass(t)])!=null?e:0}getNumAccidentals(){return this.orderedAccidentedNotes.length}getOrderedAccidentalNotes(){return this.orderedAccidentedNotes}getNoteByDegree(t){let{deg:e,acc:r}=HA(t);if(r===0)return this.naturalScaleNotes[(e-1)%7];{let n=this.naturalScaleNotes[(e-1)%7];return new U(n.diatonicId,n.accidental+r)}}static equals(t,e){return t==null&&e==null?!0:t==null||e==null?!1:t===e||t.tonic===e.tonic&&t.mode===e.mode}};d(ei,"OrderOfSharps","FCGDAEB"),d(ei,"OrderOfFlats","BEADGCF");var rr=ei;var $A=new lt([["Major","M"],["minor","m"],["Perfect","P"],["diminished","d"],["Augmented","A"],["doubly diminished","dd"],["Doubly Augmented","AA"]]),ZA={1:{0:"Perfect",1:"Augmented","-1":"diminished",2:"Doubly Augmented","-2":"doubly diminished"},2:{2:"Major",1:"minor",3:"Augmented",0:"diminished",4:"Doubly Augmented","-1":"doubly diminished"},3:{4:"Major",3:"minor",5:"Augmented",2:"diminished",6:"Doubly Augmented",1:"doubly diminished"},4:{5:"Perfect",6:"Augmented",4:"diminished",7:"Doubly Augmented",3:"doubly diminished"},5:{7:"Perfect",8:"Augmented",6:"diminished",9:"Doubly Augmented",5:"doubly diminished"},6:{9:"Major",8:"minor",10:"Augmented",7:"diminished",11:"Doubly Augmented",6:"doubly diminished"},7:{11:"Major",10:"minor",12:"Augmented",9:"diminished",13:"Doubly Augmented",8:"doubly diminished"},8:{12:"Perfect",13:"Augmented",11:"diminished",14:"Doubly Augmented",10:"doubly diminished"}};function XA(i,t){for(;i<1;)i+=7,t+=12;for(;i>8;)i-=7,t-=12;let e=ZA[i];if(e)return e[t]}function QA(i){if(i==="Perfect"||i==="Major"||i==="minor"||i==="Augmented"||i==="diminished"||i==="Doubly Augmented"||i==="doubly diminished")return i;throw new N(1,`Invalid interval quality: ${i}`)}function KA(i){if(y.isIntegerGte(i,1))return $.Math.toOrdinalNumber(i);throw new N(1,`Invalid interval quantity: ${i}`)}var Hs=class extends Error{constructor(e){super(e);this.msg=e;this.name="InvalidInterval"}},uo=class i{constructor(t,e){this.note1=t;this.note2=e;d(this,"direction");d(this,"semitones");d(this,"quantity");d(this,"quality");e.diatonicId>=t.diatonicId?(this.direction=e.diatonicId===t.diatonicId?"Unison":"Ascending",this.quantity=e.diatonicId-t.diatonicId+1,this.semitones=e.chromaticId-t.chromaticId):(this.direction="Descending",this.quantity=t.diatonicId-e.diatonicId+1,this.semitones=t.chromaticId-e.chromaticId);let r=XA(this.quantity,this.semitones);if(r)this.quality=r;else throw new Hs("Unknown interval quality")}static get(t,e){try{return new i(t,e)}catch(r){if(r instanceof Hs)return;throw r}}toString(){let t=this.direction==="Unison"?"":this.direction+" ",e=this.quality+" ",r=this.direction==="Unison"?"Unison":KA(this.quantity);return t+e+r}toAbbrString(){let t=this.direction==="Descending"?"\u2193":"",e=$A.getOrDefault(this.quality,"?"),r=this.quantity;return t+e+r}};function JA(i){let t=U.getDiatonicClass("CCDDEFFGGAAB"[U.getChromaticClass(i)]),e=U.getOctaveFromChromaticId(i);return U.getDiatonicIdInOctave(t,e)}var tC=["Cb","C","C#","Db","D","D#","Eb","E","E#","Fb","F","F#","Gb","G","G#","Ab","A","A#","Bb","B","B#"],Ti=(g=>(g.Major="Major",g.NaturalMinor="Natural Minor",g.HarmonicMinor="Harmonic Minor",g.Ionian="Ionian",g.Dorian="Dorian",g.Phrygian="Phrygian",g.Lydian="Lydian",g.Mixolydian="Mixolydian",g.Aeolian="Aeolian",g.Locrian="Locrian",g.MajorPentatonic="Major Pentatonic",g.MinorPentatonic="Minor Pentatonic",g.MajorHexatonicBlues="Major Hexatonic Blues",g.MinorHexatonicBlues="Minor Hexatonic Blues",g.HeptatonicBlues="Heptatonic Blues",g))(Ti||{});function eC(i){switch(i){case"Major":return 1;case"Natural Minor":return 6;case"Harmonic Minor":return 6;case"Ionian":return 1;case"Dorian":return 2;case"Phrygian":return 3;case"Lydian":return 4;case"Mixolydian":return 5;case"Aeolian":return 6;case"Locrian":return 7;case"Major Pentatonic":return 1;case"Minor Pentatonic":return 6;case"Major Hexatonic Blues":return 1;case"Minor Hexatonic Blues":return 6;case"Heptatonic Blues":return 1;default:throw new N(3,`Invalid scaleType: ${i}`)}}var ri=class extends rr{constructor(e,r){super(e,eC(r));this.tonic=e;this.scaleType=r;d(this,"scaleDegrees");d(this,"scaleNotes");d(this,"chromaticClassDegree");d(this,"preferredChromaticIdNoteCache",new xl);switch(r){case"Harmonic Minor":this.scaleDegrees=[1,2,3,4,5,6,"#7"];break;case"Major Pentatonic":this.scaleDegrees=[1,2,3,5,6];break;case"Minor Pentatonic":this.scaleDegrees=[1,3,4,5,7];break;case"Major Hexatonic Blues":this.scaleDegrees=[1,2,"b3",3,5,6];break;case"Minor Hexatonic Blues":this.scaleDegrees=[1,3,4,"b5",5,7];break;case"Heptatonic Blues":this.scaleDegrees=[1,2,"b3",4,"b5",6,"b7"];break;default:this.scaleDegrees=[1,2,3,4,5,6,7];break}this.scaleNotes=this.scaleDegrees.map(n=>this.getNoteByDegree(n)),this.chromaticClassDegree=[0,1,2,3,4,5,6,7,8,9,10,11].map(n=>{let o=this.scaleNotes.findIndex(s=>s.chromaticClass===n);return o>=0?this.scaleDegrees[o]:void 0})}static equals(e,r){return e==null&&r==null?!0:e==null||r==null?!1:e===r||e.getScaleName()===r.getScaleName()}getScaleName(e){switch(e){case 1:return U.getScientificNoteName(this.tonic,e)+" "+this.scaleType;default:return this.tonic+" "+this.scaleType}}getScaleNotes(e,r){if(!y.isIntegerGte(r,1))throw new N(3,`Invalid numOctaves: ${r}`);let n=[];for(let s=1;s<=r;s++)n=[...n,...this.scaleNotes];n.push(this.scaleNotes[0]);let o=U.getNote(e).diatonicId;return n.map(s=>(o=U.findNextDiatonicIdAbove(s.diatonicId,o,!1),new U(o,s.accidental)))}getScaleOverview(){return this.getScaleNotes("C4",1).map(e=>e.formatOmitOctave(1)).join(" - ")}getScaleSteps(){let e=this.getScaleNotes("C4",1).map(n=>n.chromaticId),r=[];for(let n=0;n<e.length-1;n++)r.push($.Math.mod(e[n+1]-e[n],12));return r}getScaleStringSteps(){return this.getScaleSteps().map(e=>e===1?"H":e===2?"W":e.toString()+"H")}isScaleNote(e){return this.chromaticClassDegree[e.chromaticClass]!==void 0}isScaleRootNote(e){return String(this.chromaticClassDegree[e.chromaticClass])==="1"}getIntervalFromRootNote(e){let r=this.getScaleNotes("C0",1)[0];for(;e.chromaticId>=r.chromaticId+12;)e=new U(e.diatonicClass,e.accidental,e.octave-1);if(e.chromaticId<r.chromaticId)throw new N(3,"Note is below rootNote.");let n=uo.get(r,e);if(n===void 0)throw new N(3,"Interval is undefined.");return n}getPreferredChromaticNote(e){U.validateChromaticId(e);let r=this.preferredChromaticIdNoteCache.get(e);if(r)return r;let n=U.getOctaveFromChromaticId(e);if(r=this.scaleNotes.map(l=>l.noteLetter==="C"&&l.accidental<0?new U(l.diatonicClass,l.accidental,n+1):l.noteLetter==="B"&&l.accidental>0?new U(l.diatonicClass,l.accidental,n-1):new U(l.diatonicClass,l.accidental,n)).find(l=>U.getChromaticClass(e)===l.chromaticClass),r)return this.preferredChromaticIdNoteCache.set(e,r),r;let s=JA(e),a=s-2,c=s+2,h=this.getAccidentalType()===1?[0,-1,1,-2,2]:[0,1,-1,2,-2];for(let l=0;l<h.length;l++){let p=h[l];for(let m=Math.max(0,a);m<=c;m++)if(r=new U(m,p),e===r.chromaticId)return this.preferredChromaticIdNoteCache.set(e,r),r}return r=U.getChromaticNote(e),this.preferredChromaticIdNoteCache.set(e,r),r}},ne=class{constructor(t){this.type=t;d(this,"tonicList",[]);d(this,"scaleMap",new Map);let e=[],r=[],n=[];if(tC.forEach(s=>{try{let a=new ri(s,this.type);switch(a.getAccidentalType()){case 0:e.push(a);break;case 2:if(s.endsWith("b"))return;r.push(a);break;case 1:if(s.endsWith("#"))return;n.push(a);break}this.scaleMap.set(s,a)}catch(a){}}),e.length===0)throw new N(3,"Expected natural scale.");let o=(s,a)=>s.getNumAccidentals()-a.getNumAccidentals();this.tonicList=[...e.sort(o).map(s=>s.tonic),"- Sharps -",...r.sort(o).map(s=>s.tonic),"- Flats -",...n.sort(o).map(s=>s.tonic)]}getTonicList(){return this.tonicList}getDefaultTonic(){return this.tonicList[0]}getType(){return this.type}getScale(t){let e=this.scaleMap.get(t);if(e)return e;throw new N(3,`Invalid scale: ${t} ${this.type}`)}hasScale(t){return this.scaleMap.get(t)!==void 0}},Ol=[new ne("Major"),new ne("Natural Minor"),new ne("Harmonic Minor"),"- Modes -",new ne("Ionian"),new ne("Dorian"),new ne("Phrygian"),new ne("Lydian"),new ne("Mixolydian"),new ne("Aeolian"),new ne("Locrian"),"- Pentatonic -",new ne("Major Pentatonic"),new ne("Minor Pentatonic"),"- Blues -",new ne("Major Hexatonic Blues"),new ne("Minor Hexatonic Blues"),new ne("Heptatonic Blues")];function rC(){return Ol}var Rl=new lt;Ol.forEach(i=>{i instanceof ne&&Rl.set(i.getType(),i)});function Ml(i){let t=Rl.get(i);if(t)return t;throw new N(3,`Invalid scaleType: ${i}`)}function ho(i){if(y.isEnumValue(i,Ti))return i;throw new N(3,`Invalid scaleType: "${i}"`)}function Pr(i,t){let e,r;return t!==void 0?(e=i,r=ho(t)):(e=i.split(" ")[0],r=ho(i.substring(e.length+1))),Ml(r).getScale(e)}var iC=Pr("C","Major");function nC(){return iC}var Fr=(i,t)=>i.chromaticClass===t.chromaticClass,oC=["C","C#","Db","D","Eb","E","F","F#","Gb","G","Ab","A","Bb","B","Cb"].map(i=>U.getNote(i+"0")),sC=new vr;function aC(i){return sC.getOrCreate(i.chromaticClass,()=>{let t=oC.find(e=>Fr(e,i));if(!t)throw new N(1,`Invalid chord root note: ${i.formatOmitOctave(1)}`);return t})}function cC(i,t){let e=i.formatOmitOctave(0);return Pr(e,"Major").getNoteByDegree(t)}function uC(i){return $.Arr.removeDuplicates(i,Fr)}var hC=[{name:"5",degrees:[1,5]},{name:"",degrees:[1,3,5]},{name:"m",degrees:[1,"b3",5]},{name:"dim",degrees:[1,"b3","b5"]},{name:"aug",degrees:[1,3,"#5"]},{name:"sus2",degrees:[1,2,5]},{name:"sus4",degrees:[1,4,5]},{name:"6",degrees:[1,3,5,6]},{name:"m6",degrees:[1,"b3",5,6]},{name:"m(maj7)",degrees:[1,"b3",5,7]},{name:"7",degrees:[1,3,5,"b7"]},{name:"7\u266D5",degrees:[1,3,"b5","b7"]},{name:"7\u266F5",degrees:[1,3,"#5","b7"]},{name:"7sus2",degrees:[1,2,5,"b7"]},{name:"7sus4",degrees:[1,4,5,"b7"]},{name:"dim7",degrees:[1,"b3","b5","bb7"]},{name:"maj7",degrees:[1,3,5,7]},{name:"maj7\u266D5",degrees:[1,3,"b5",7]},{name:"maj7\u266F5",degrees:[1,3,"#5",7]},{name:"m7",degrees:[1,"b3",5,"b7"]},{name:"m7\u266D5",degrees:[1,"b3","b5","b7"]},{name:"m7\u266F5",degrees:[1,"b3","#5","b7"]},{name:"9",degrees:[1,3,5,"b7",9]},{name:"m9",degrees:[1,"b3",5,"b7",9]},{name:"7\u266F9",degrees:[1,3,5,"b7","#9"]},{name:"7\u266D9",degrees:[1,3,5,"b7","b9"]},{name:"11",degrees:[1,3,5,"b7",9,11]},{name:"m11",degrees:[1,"b3",5,"b7",9,11]},{name:"13",degrees:[1,3,5,"b7",9,11,13]},{name:"m13",degrees:[1,"b3",5,"b7",9,11,13]}];function lC(i,t){return i.degrees.every(e=>e!==t)?!0:i.degrees.length>=4&&t===5||i.degrees.length>=6&&t===9||i.degrees.length>=7&&t===11}var nn=class extends Error{constructor(e){super(e);this.msg=e;this.name="InvalidChordException"}},pu=class i{constructor(t,e,r,n){this.chordInfo=t;this.rootNote=r;d(this,"name");d(this,"notes");d(this,"omitNotes");d(this,"slashBassNote");this.name=t.name;let o=e.slice();!o.some(a=>Fr(a,n))&&o.push(n),this.notes=new Array(this.chordInfo.degrees.length),this.omitNotes=new Array(this.chordInfo.degrees.length);for(let a=0;a<t.degrees.length;a++){let c=t.degrees[a],u=this.notes[a]=cC(this.rootNote,c),h=o.findIndex(l=>Fr(l,u));if(h>=0)this.omitNotes[a]=!1,o.splice(h,1);else if(lC(t,c))this.omitNotes[a]=!0;else throw new nn("Missing chord note!");Fr(n,u)&&(n=u)}if(o.length>0)if(o.every(a=>Fr(a,n)))this.slashBassNote=n;else throw new nn("Got some extra notes that are not bass note!");else this.slashBassNote=Fr(n,this.rootNote)?void 0:n;if(t.name==="5"&&this.slashBassNote)throw new nn("Power chord no bass note allowed!")}static getChords(t){let e=[],r=U.sort(t),n=r[0],o=uC(r);for(let s=0;s<o.length;s++){let a=aC(o[s]);hC.forEach(c=>{try{let u=new i(c,o,a,n),h=e.findIndex(l=>l.replaceWith(u));h>=0?e[h]=u:e.push(u)}catch(u){if(!(u instanceof nn))throw u}})}return e}replaceWith(t){if(t.notes.length<this.notes.length)return!1;if(t.slashBassNote&&this.slashBassNote&&!Fr(t.slashBassNote,this.slashBassNote)||t.slashBassNote&&!this.slashBassNote||!t.slashBassNote&&this.slashBassNote)return!1;for(let e=0;e<this.notes.length;e++)if(!Fr(t.notes[e],this.notes[e])||t.omitNotes[e]!==this.omitNotes[e])return!1;return!0}toString(){let t=1,e=this.rootNote.formatOmitOctave(t),r=this.slashBassNote?"/"+this.slashBassNote.formatOmitOctave(t):"";return e+this.name+r}getDegreeNotationString(){let t=1,e=this.slashBassNote?this.slashBassNote.formatOmitOctave(t)+" - ":"",r=this.omitNotes.map((n,o)=>this.getDegreeStr(o)+"("+(n?"-":this.getNoteStr(o))+")").join(" - ");return e+r}getOmittedDegreesString(){let t=this.omitNotes.map((e,r)=>e?this.getDegreeStr(r)+"("+this.getNoteStr(r)+")":void 0).filter(e=>e!==void 0);return t.length>0?"Omits "+t.join(", "):""}getDegreeStr(t){return U.replaceAccidentalSymbols(""+this.chordInfo.degrees[t],1)}getNoteStr(t){return this.notes[t].formatOmitOctave(1)}};var mu={list:[{name:"Standard",strings:["E2","A2","D3","G3","B3","E4"]},{name:"B Standard",strings:["B1","E2","A2","D3","F#3","B3"]},{name:"C Standard",strings:["C2","F2","A#2","D#3","G3","C4"]},{name:"D Modal",strings:["D2","A2","D3","G3","A3","D4"]},{name:"D Standard",strings:["D2","G2","C3","F3","A3","D4"]},{name:"D# Standard",strings:["D#2","G#2","C#3","F#3","A#3","D#4"]},{name:"Double Drop D",strings:["D2","A2","D3","G3","B3","D4"]},{name:"Drop B",strings:["B1","F#2","B2","E3","G#3","C#4"]},{name:"Drop C",strings:["C2","G2","C3","F3","A3","D4"]},{name:"Drop D",strings:["D2","A2","D3","G3","B3","E4"]},{name:"Low C",strings:["C2","G2","D3","G3","A3","D4"]},{name:"New Standard",strings:["C2","G2","D3","A3","E4","G4"]},{name:"Open A",strings:["E2","A2","C#3","E3","A3","E4"]},{name:"Open A Minor",strings:["E2","A2","E3","A3","C4","E4"]},{name:"Open C",strings:["C2","G2","C3","G3","C4","E4"]},{name:"Open C Minor",strings:["C2","G2","C3","G3","C4","D#4"]},{name:"Open D",strings:["D2","A2","D3","F#3","A3","D4"]},{name:"Open D Minor",strings:["D2","A2","D3","F3","A3","D4"]},{name:"Open E",strings:["E2","B2","E3","G#3","B3","E4"]},{name:"Open E Minor",strings:["E2","B2","E3","G3","B3","E4"]},{name:"Open G",strings:["D2","G2","D3","G3","B3","D4"]},{name:"Open G Minor",strings:["D2","G2","D3","G3","A#3","D4"]}]};var lo=mu.list.map(i=>i.name),pC=lo[0];function fu(i){if(lo.indexOf(i)<0)throw new N(1,`Invalid tuning name: ${i}`);return i}var El=new bl(100);function $s(i){let t=El.get(i);if(!t){let e=mu.list.find(r=>r.name===i);if(!e)throw new N(1,`Invalid tuningName: ${i}`);if(t=e.strings.slice().reverse().map(r=>U.getNote(r)),!y.isIntegerEq(t.length,6))throw new N(0,`Tuning has ${t.length} strings.`);El.set(i,t)}return t}var Dl=12,mC=1188*7*5,ir=(k=>(k.Whole="1n",k.WholeTriplet="1t",k.WholeDot="1.",k.Whole2Dots="1..",k.Whole3Dots="1...",k.Whole4Dots="1....",k.Whole5Dots="1.....",k.Whole6Dots="1......",k.Half="2n",k.HalfTriplet="2t",k.HalfDot="2.",k.Half2Dots="2..",k.Half3Dots="2...",k.Half4Dots="2....",k.Half5Dots="2.....",k.Quarter="4n",k.QuarterTriplet="4t",k.QuarterDot="4.",k.Quarter2Dots="4..",k.Quarter3Dots="4...",k.Quarter4Dots="4....",k.Eighth="8n",k.EighthTriplet="8t",k.EighthDot="8.",k.Eighth2Dots="8..",k.Eighth3Dots="8...",k.Sixteenth="16n",k.SixteenthTriplet="16t",k.SixteenthDot="16.",k.Sixteenth2Dots="16..",k.ThirtySecond="32n",k.ThirtySecondTriplet="32t",k.ThirtySecondDot="32.",k.SixtyFourth="64n",k.SixtyFourthTriplet="64t",k))(ir||{});function nr(i){return y.isEnumValue(i,ir)}function Br(i){if(nr(i))return i;throw new N(1,`Invalid noteLength: ${i}`)}var me=class me{constructor(t){d(this,"noteLength");d(this,"noteSize");d(this,"ticks");d(this,"flagCount");d(this,"dotCount");d(this,"maxDotCount");d(this,"isTriplet");d(this,"hasStem");d(this,"isSolid");if(this.noteLength=Br(t),this.noteSize=parseInt(t),this.isTriplet=t.endsWith("t"),this.maxDotCount=this.isTriplet?0:Math.floor(Math.log2(me.ShortestNoteSize/this.noteSize)),this.dotCount=$.Str.charCount(t,"."),this.flagCount=this.noteSize>4?Math.floor(Math.log2(this.noteSize/4)):0,this.ticks=mC*me.ShortestNoteSize/this.noteSize,this.hasStem=this.noteSize>1,this.isSolid=this.noteSize>2,this.dotCount>this.maxDotCount)throw new N(2,`dotCount ${this.dotCount} > maxDotCount ${this.maxDotCount}, for noteLength "${this.noteLength}".`);if(this.isTriplet&&this.dotCount>0)throw new N(2,`noteLength "${this.noteLength}" is both triplet and dotted!`)}static get(t){return this.cache.getOrCreate(t,()=>new me(t))}static create(t,e=0){let r=typeof t=="number"?t:this.get(t).noteSize;return this.get(r+(y.isIntegerGte(e,1)?".".repeat(e):"n"))}static cmp(t,e){let r=t instanceof me?t.noteSize:typeof t=="number"?t:me.get(t).noteSize,n=e instanceof me?e.noteSize:typeof e=="number"?e:me.get(e).noteSize;return $.Math.cmp(n,r)}static equals(t,e){let r=t instanceof me?t.noteSize:typeof t=="number"?t:me.get(t).noteSize,n=e instanceof me?e.noteSize:typeof e=="number"?e:me.get(e).noteSize;return r===n}};d(me,"LongestNoteSize",Math.min(...$.Enum.getEnumValues(ir).map(t=>parseInt(t)))),d(me,"ShortestNoteSize",Math.max(...$.Enum.getEnumValues(ir).map(t=>parseInt(t)))),d(me,"cache",new lt);var Nt=me;function Zs(i){return y.isObject(i)&&y.isIntegerBetween(i.parts,2,Dl)&&y.isIntegerBetween(i.inTimeOf,2,Dl)}function kl(i){if(Zs(i))return i;throw new N(2,`Invalid tupletRatio ${JSON.stringify(i)}`)}var Gr={Duplet:{parts:2,inTimeOf:3},Triplet:{parts:3,inTimeOf:2},Quadruplet:{parts:4,inTimeOf:3}},Ni=class Ni{constructor(t,e,r){d(this,"noteLength");d(this,"noteSize");d(this,"dotCount");d(this,"tupletRatio");d(this,"ticks");d(this,"flagCount");d(this,"hasStem");d(this,"isSolidNoteHead");this.noteLength=Br(t);let n=Nt.get(t);if(this.noteSize=n.noteSize,this.ticks=n.ticks,this.flagCount=n.flagCount,this.dotCount=e!=null?e:n.dotCount,this.hasStem=n.hasStem,this.isSolidNoteHead=n.isSolid,y.isObject(r)?this.tupletRatio=kl(r):n.isTriplet?this.tupletRatio=Gr.Triplet:this.tupletRatio=void 0,this.dotCount>0&&this.tupletRatio!==void 0)throw new N(2,"Note cannot be both dotted and tuplet!");if(this.dotCount>n.maxDotCount)throw new N(2,`Too big dot count ${this.dotCount} for note length ${this.noteLength}.`);for(let o=this.ticks/2,s=1;s<=this.dotCount;s++,o/=2)this.ticks+=o;this.tupletRatio&&(this.ticks*=this.tupletRatio.inTimeOf/this.tupletRatio.parts)}toString(){let t=Ni.NoteSymbolMap.get(this.noteSize),e=".".repeat(this.dotCount);return t?t+e:""+this.noteSize+(e.length>0?e:"n")}static get(t,e,r){return e!==void 0||r!==void 0?new Ni(t,e,r):this.cache.getOrCreate(t,()=>new Ni(t))}static cmp(t,e){return $.Math.cmp(t.ticks,e.ticks)}static equals(t,e){return t.ticks===e.ticks}};d(Ni,"NoteSymbolMap",new vr([[1,"\u{1D15D}"],[2,"\u{1D15E}"],[4,"\u{1D15F}"],[8,"\u{1D160}"],[16,"\u{1D161}"],[32,"\u{1D162}"],[64,"\u{1D163}"],[128,"\u{1D164}"]])),d(Ni,"cache",new lt);var Kt=Ni;var po=(u=>(u._2_4="2/4",u._3_4="3/4",u._4_4="4/4",u._3_8="3/8",u._5_8="5/8",u._6_8="6/8",u._7_8="7/8",u._9_8="9/8",u._12_8="12/8",u))(po||{}),Oi=(n=>(n._2_3="2-3",n._3_2="3-2",n._2_2_3="2-2-3",n._3_2_2="3-2-2",n))(Oi||{}),ii=class{constructor(...t){d(this,"beatCount");d(this,"beatSize");d(this,"beatLength");d(this,"measureTicks");d(this,"beamGroupSizes",[]);let e;if(y.isEnumValue(t[0],po)){let o=t[0].split("/");this.beatCount=+o[0],this.beatSize=+o[1],y.isEnumValue(t[1],Oi)&&(e=t[1])}else if(y.isIntegerGte(t[0],2)&&y.isIntegerGte(t[1],2))this.beatCount=t[0],this.beatSize=t[1],y.isEnumValue(t[2],Oi)&&(e=t[2]);else throw new N(5,`Invalid args: ${t}`);if(y.isIntegerGte(this.beatCount,1)){if(!y.isIntegerGte(this.beatSize,1))throw new N(5,`Invalid beatSize: ${this.beatSize}`)}else throw new N(5,`Invalid beatCount: ${this.beatCount}`);let{noteLength:r,ticks:n}=Nt.create(this.beatSize);if(this.beatLength=r,this.measureTicks=this.beatCount*n,this.is(2,4))this.beamGroupSizes=[[2],[2]];else if(this.is(3,4))this.beamGroupSizes=[[2],[2],[2]];else if(this.is(4,4))this.beamGroupSizes=[[2,2],[2,2]];else if(this.is(3,8))this.beamGroupSizes=[[3]];else if(this.is(5,8)){if(!y.isUndefined(e)&&e!=="2-3"&&e!=="3-2")throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`);this.beamGroupSizes=e==="3-2"?[[3],[2]]:[[2],[3]],e=void 0}else if(this.is(6,8))this.beamGroupSizes=[[3],[3]];else if(this.is(7,8)){if(!y.isUndefined(e)&&e!=="2-2-3"&&e!=="3-2-2")throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`);this.beamGroupSizes=e==="3-2-2"?[[3],[2],[2]]:[[2],[2],[3]],e=void 0}else this.is(9,8)?this.beamGroupSizes=[[3],[3],[3]]:this.is(12,8)&&(this.beamGroupSizes=[[3],[3],[3],[3]]);if(this.beamGroupSizes.length===0)throw new N(5,`Unimplemented time signature "${this.toString()}".`);if(e!==void 0)throw new N(5,`Invalid beam grouping "${e}" for time signature "${this.toString()}".`)}is(t,e){return this.beatCount===t&&this.beatSize===e}toString(){return this.beatCount+"/"+this.beatSize}},gu;function Xs(){return gu||(gu=new ii(4,4)),gu}var yu;function Qs(){return yu||(yu={beatsPerMinute:120,options:{beatLength:"4n",dotCount:0}}),yu}function Ks(i){return Kt.get(i.options.beatLength,i.options.dotCount).toString()+"="+i.beatsPerMinute}function bu(i,t){return{beatsPerMinute:i.beatsPerMinute*t,options:{beatLength:i.options.beatLength,dotCount:i.options.dotCount}}}Ii();function Js(i){return!isFinite(i)||i<=0?-1/0:20*Math.log10(i)}var mo="15.1.22";var Au=(i,t,e)=>({endTime:t,insertTime:e,type:"exponentialRampToValue",value:i});var Cu=(i,t,e)=>({endTime:t,insertTime:e,type:"linearRampToValue",value:i});var on=(i,t)=>({startTime:t,type:"setValue",value:i});var fo=(i,t,e)=>({duration:e,startTime:t,type:"setValueCurve",values:i});var ta=(i,t,{startTime:e,target:r,timeConstant:n})=>r+(t-r)*Math.exp((e-i)/n);var Vr=i=>i.type==="exponentialRampToValue";var Ri=i=>i.type==="linearRampToValue";var or=i=>Vr(i)||Ri(i);var sn=i=>i.type==="setValue";var Ue=i=>i.type==="setValueCurve";var an=(i,t,e,r)=>{let n=i[t];return n===void 0?r:or(n)||sn(n)?n.value:Ue(n)?n.values[n.values.length-1]:ta(e,an(i,t-1,n.startTime,r),n)};var _u=(i,t,e,r,n)=>e===void 0?[r.insertTime,n]:or(e)?[e.endTime,e.value]:sn(e)?[e.startTime,e.value]:Ue(e)?[e.startTime+e.duration,e.values[e.values.length-1]]:[e.startTime,an(i,t-1,e.startTime,n)];var go=i=>i.type==="cancelAndHold";var yo=i=>i.type==="cancelScheduledValues";var qr=i=>go(i)||yo(i)?i.cancelTime:Vr(i)||Ri(i)?i.endTime:i.startTime;var vu=(i,t,e,{endTime:r,value:n})=>e===n?n:0<e&&0<n||e<0&&n<0?e*$h(n/e,(i-t)/(r-t)):0;var Su=(i,t,e,{endTime:r,value:n})=>e+(i-t)/(r-t)*(n-e);var Ll=(i,t)=>{let e=Math.floor(t),r=Math.ceil(t);return e===r?i[e]:(1-(t-e))*i[e]+(1-(r-t))*i[r]};var jl=(i,{duration:t,startTime:e,values:r})=>{let n=(i-e)/t*(r.length-1);return Ll(r,n)};var bo=i=>i.type==="setTarget";var xo=class{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){let e=qr(t);if(go(t)||yo(t)){let r=this._automationEvents.findIndex(o=>yo(t)&&Ue(o)?o.startTime+o.duration>=e:qr(o)>=e),n=this._automationEvents[r];if(r!==-1&&(this._automationEvents=this._automationEvents.slice(0,r)),go(t)){let o=this._automationEvents[this._automationEvents.length-1];if(n!==void 0&&or(n)){if(o!==void 0&&bo(o))throw new Error("The internal list is malformed.");let s=o===void 0?n.insertTime:Ue(o)?o.startTime+o.duration:qr(o),a=o===void 0?this._defaultValue:Ue(o)?o.values[o.values.length-1]:o.value,c=Vr(n)?vu(e,s,a,n):Su(e,s,a,n),u=Vr(n)?Au(c,e,this._currenTime):Cu(c,e,this._currenTime);this._automationEvents.push(u)}if(o!==void 0&&bo(o)&&this._automationEvents.push(on(this.getValue(e),e)),o!==void 0&&Ue(o)&&o.startTime+o.duration>e){let s=e-o.startTime,a=(o.values.length-1)/o.duration,c=Math.max(2,1+Math.ceil(s*a)),u=s/(c-1)*a,h=o.values.slice(0,c);if(u<1)for(let l=1;l<c;l+=1){let p=u*l%1;h[l]=o.values[l-1]*(1-p)+o.values[l]*p}this._automationEvents[this._automationEvents.length-1]=fo(h,o.startTime,s)}}}else{let r=this._automationEvents.findIndex(s=>qr(s)>e),n=r===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[r-1];if(n!==void 0&&Ue(n)&&qr(n)+n.duration>e)return!1;let o=Vr(t)?Au(t.value,t.endTime,this._currenTime):Ri(t)?Cu(t.value,e,this._currenTime):t;if(r===-1)this._automationEvents.push(o);else{if(Ue(t)&&e+t.duration>qr(this._automationEvents[r]))return!1;this._automationEvents.splice(r,0,o)}}return!0}flush(t){let e=this._automationEvents.findIndex(r=>qr(r)>t);if(e>1){let r=this._automationEvents.slice(e-1),n=r[0];bo(n)&&r.unshift(on(an(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=r}}getValue(t){if(this._automationEvents.length===0)return this._defaultValue;let e=this._automationEvents.findIndex(s=>qr(s)>t),r=this._automationEvents[e],n=(e===-1?this._automationEvents.length:e)-1,o=this._automationEvents[n];if(o!==void 0&&bo(o)&&(r===void 0||!or(r)||r.insertTime>t))return ta(t,an(this._automationEvents,n-1,o.startTime,this._defaultValue),o);if(o!==void 0&&sn(o)&&(r===void 0||!or(r)))return o.value;if(o!==void 0&&Ue(o)&&(r===void 0||!or(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?jl(t,o):o.values[o.values.length-1];if(o!==void 0&&or(o)&&(r===void 0||!or(r)))return o.value;if(r!==void 0&&Vr(r)){let[s,a]=_u(this._automationEvents,n,o,r,this._defaultValue);return vu(t,s,a,r)}if(r!==void 0&&Ri(r)){let[s,a]=_u(this._automationEvents,n,o,r,this._defaultValue);return Su(t,s,a,r)}return this._defaultValue}};var wu=i=>({cancelTime:i,type:"cancelAndHold"});var Iu=i=>({cancelTime:i,type:"cancelScheduledValues"});var Tu=(i,t)=>({endTime:t,type:"exponentialRampToValue",value:i});var Nu=(i,t)=>({endTime:t,type:"linearRampToValue",value:i});var Ou=(i,t,e)=>({startTime:t,target:i,timeConstant:e,type:"setTarget"});var Pl=()=>new DOMException("","AbortError");var Fl=i=>(t,e,[r,n,o],s)=>{i(t[n],[e,r,o],a=>a[0]===e&&a[1]===r,s)};var Bl=i=>(t,e,r)=>{let n=[];for(let o=0;o<r.numberOfInputs;o+=1)n.push(new Set);i.set(t,{activeInputs:n,outputs:new Set,passiveInputs:new WeakMap,renderer:e})};var Gl=i=>(t,e)=>{i.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})};var Sr=new WeakSet,ea=new WeakMap,cn=new WeakMap,ra=new WeakMap,Ao=new WeakMap,un=new WeakMap,ia=new WeakMap,Co=new WeakMap,_o=new WeakMap,vo=new WeakMap;var Vl={construct(){return Vl}},ql=i=>{try{let t=new Proxy(i,Vl);new t}catch(t){return!1}return!0};var Wl=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,Ru=(i,t)=>{let e=[],r=i.replace(/^[\s]+/,""),n=r.match(Wl);for(;n!==null;){let o=n[1].slice(1,-1),s=n[0].replace(/([\s]+)?;?$/,"").replace(o,new URL(o,t).toString());e.push(s),r=r.slice(n[0].length).replace(/^[\s]+/,""),n=r.match(Wl)}return[e.join(";"),r]};var Ul=i=>{if(i!==void 0&&!Array.isArray(i))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},zl=i=>{if(!ql(i))throw new TypeError("The given value for processorCtor should be a constructor.");if(i.prototype===null||typeof i.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},Yl=(i,t,e,r,n,o,s,a,c,u,h,l,p)=>{let m=0;return(f,g,b={credentials:"omit"})=>{let x=h.get(f);if(x!==void 0&&x.has(g))return Promise.resolve();let C=u.get(f);if(C!==void 0){let w=C.get(g);if(w!==void 0)return w}let S=o(f),T=S.audioWorklet===void 0?n(g).then(([w,v])=>{let[A,_]=Ru(w,v),E=`${A};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${_}
|
|
3
3
|
})})(window,'_AWGS')`;return e(E)}).then(()=>{let w=p._AWGS.pop();if(w===void 0)throw new SyntaxError;r(S.currentTime,S.sampleRate,()=>w(class{},void 0,(v,A)=>{if(v.trim()==="")throw t();let _=_o.get(S);if(_!==void 0){if(_.has(v))throw t();zl(A),Ul(A.parameterDescriptors),_.set(v,A)}else zl(A),Ul(A.parameterDescriptors),_o.set(S,new Map([[v,A]]))},S.sampleRate,void 0,void 0))}):Promise.all([n(g),Promise.resolve(i(l,l))]).then(([[w,v],A])=>{let _=m+1;m=_;let[E,q]=Ru(w,v),D=`${E};((AudioWorkletProcessor,registerProcessor)=>{${q}
|
|
4
4
|
})(${A?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${A?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${A?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${_}',class extends AudioWorkletProcessor{process(){return !1}})`,j=new Blob([D],{type:"application/javascript; charset=utf-8"}),F=URL.createObjectURL(j);return S.audioWorklet.addModule(F,b).then(()=>{if(a(S))return S;let W=s(S);return W.audioWorklet.addModule(F,b).then(()=>W)}).then(W=>{if(c===null)throw new SyntaxError;try{new c(W,`__sac${_}`)}catch(K){throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(F))});return C===void 0?u.set(f,new Map([[g,T]])):C.set(g,T),T.then(()=>{let w=h.get(f);w===void 0?h.set(f,new Set([g])):w.add(g)}).finally(()=>{let w=u.get(f);w!==void 0&&w.delete(g)}),T}};var Jt=(i,t)=>{let e=i.get(t);if(e===void 0)throw new Error("A value with the given key could not be found.");return e};var ni=(i,t)=>{let e=Array.from(i).filter(t);if(e.length>1)throw Error("More than one element was found.");if(e.length===0)throw Error("No element was found.");let[r]=e;return i.delete(r),r};var na=(i,t,e,r)=>{let n=Jt(i,t),o=ni(n,s=>s[0]===e&&s[1]===r);return n.size===0&&i.delete(t),o};var wr=i=>Jt(ia,i);var sr=i=>{if(Sr.has(i))throw new Error("The AudioNode is already stored.");Sr.add(i),wr(i).forEach(t=>t(!0))};var oa=i=>"port"in i;var Ir=i=>{if(!Sr.has(i))throw new Error("The AudioNode is not stored.");Sr.delete(i),wr(i).forEach(t=>t(!1))};var So=(i,t)=>{!oa(i)&&t.every(e=>e.size===0)&&Ir(i)};var Hl=(i,t,e,r,n,o,s,a,c,u,h,l,p)=>{let m=new WeakMap;return(f,g,b,x,C)=>{let{activeInputs:S,passiveInputs:T}=o(g),{outputs:w}=o(f),v=a(f),A=_=>{let E=c(g),q=c(f);if(_){let M=na(T,f,b,x);i(S,f,M,!1),!C&&!l(f)&&e(q,E,b,x),p(g)&&sr(g)}else{let M=r(S,f,b,x);t(T,x,M,!1),!C&&!l(f)&&n(q,E,b,x);let R=s(g);if(R===0)h(g)&&So(g,S);else{let B=m.get(g);B!==void 0&&clearTimeout(B),m.set(g,setTimeout(()=>{h(g)&&So(g,S)},R*1e3))}}};return u(w,[g,b,x],_=>_[0]===g&&_[1]===b&&_[2]===x,!0)?(v.add(A),h(f)?i(S,f,[b,x,A],!0):t(T,x,[f,b,A],!0),!0):!1}};var $l=i=>(t,e,[r,n,o],s)=>{let a=t.get(r);a===void 0?t.set(r,new Set([[n,e,o]])):i(a,[n,e,o],c=>c[0]===n&&c[1]===e,s)};var Zl=i=>(t,e)=>{let r=i(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(r).connect(t.destination);let n=()=>{e.removeEventListener("ended",n),e.disconnect(r),r.disconnect()};e.addEventListener("ended",n)};var Xl=i=>(t,e)=>{i(t).add(e)};var fC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},Ql=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=n(a),h=O(O({},fC),c),l=r(u,h),p=o(u)?t():null;super(a,!1,l,p),this._nativeAnalyserNode=l}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(a){this._nativeAnalyserNode.fftSize=a}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(a){let c=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=a,!(a>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=c,e()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(a){let c=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=a,!(this._nativeAnalyserNode.maxDecibels>a))throw this._nativeAnalyserNode.minDecibels=c,e()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(a){this._nativeAnalyserNode.smoothingTimeConstant=a}getByteFrequencyData(a){this._nativeAnalyserNode.getByteFrequencyData(a)}getByteTimeDomainData(a){this._nativeAnalyserNode.getByteTimeDomainData(a)}getFloatFrequencyData(a){this._nativeAnalyserNode.getFloatFrequencyData(a)}getFloatTimeDomainData(a){this._nativeAnalyserNode.getFloatTimeDomainData(a)}};var vt=(i,t)=>i.context===t;var Kl=(i,t,e)=>()=>{let r=new WeakMap,n=(o,s)=>J(null,null,function*(){let a=t(o);if(!vt(a,s)){let u={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,fftSize:a.fftSize,maxDecibels:a.maxDecibels,minDecibels:a.minDecibels,smoothingTimeConstant:a.smoothingTimeConstant};a=i(s,u)}return r.set(s,a),yield e(o,s,a),a});return{render(o,s){let a=r.get(s);return a!==void 0?Promise.resolve(a):n(o,s)}}};var hn=i=>{try{i.copyToChannel(new Float32Array(1),0,-1)}catch(t){return!1}return!0};var ze=()=>new DOMException("","IndexSizeError");var ln=i=>{i.getChannelData=(t=>e=>{try{return t.call(i,e)}catch(r){throw r.code===12?ze():r}})(i.getChannelData)};var gC={numberOfChannels:1},Jl=(i,t,e,r,n,o,s,a)=>{let c=null;return class td{constructor(h){if(n===null)throw new Error("Missing the native OfflineAudioContext constructor.");let{length:l,numberOfChannels:p,sampleRate:m}=O(O({},gC),h);c===null&&(c=new n(1,1,44100));let f=r!==null&&t(o,o)?new r({length:l,numberOfChannels:p,sampleRate:m}):c.createBuffer(p,l,m);if(f.numberOfChannels===0)throw e();return typeof f.copyFromChannel!="function"?(s(f),ln(f)):t(hn,()=>hn(f))||a(f),i.add(f),f}static[Symbol.hasInstance](h){return h!==null&&typeof h=="object"&&Object.getPrototypeOf(h)===td.prototype||i.has(h)}}};var $t=-34028234663852886e22,Ut=-$t;var xe=i=>Sr.has(i);var yC={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},ed=(i,t,e,r,n,o,s,a)=>class extends i{constructor(u,h){let l=o(u),p=O(O({},yC),h),m=n(l,p),f=s(l),g=f?t():null;super(u,!1,m,g),this._audioBufferSourceNodeRenderer=g,this._isBufferNullified=!1,this._isBufferSet=p.buffer!==null,this._nativeAudioBufferSourceNode=m,this._onended=null,this._playbackRate=e(this,f,m.playbackRate,Ut,$t)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(u){if(this._nativeAudioBufferSourceNode.buffer=u,u!==null){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(u){this._nativeAudioBufferSourceNode.loop=u}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(u){this._nativeAudioBufferSourceNode.loopEnd=u}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(u){this._nativeAudioBufferSourceNode.loopStart=u}get onended(){return this._onended}set onended(u){let h=typeof u=="function"?a(this,u):null;this._nativeAudioBufferSourceNode.onended=h;let l=this._nativeAudioBufferSourceNode.onended;this._onended=l!==null&&l===h?u:l}get playbackRate(){return this._playbackRate}start(u=0,h=0,l){if(this._nativeAudioBufferSourceNode.start(u,h,l),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=l===void 0?[u,h]:[u,h,l]),this.context.state!=="closed"){sr(this);let p=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",p),xe(this)&&Ir(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",p)}}stop(u=0){this._nativeAudioBufferSourceNode.stop(u),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=u)}};var rd=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=null,a=null,c=(u,h)=>J(null,null,function*(){let l=e(u),p=vt(l,h);if(!p){let m={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=t(h,m),s!==null&&l.start(...s),a!==null&&l.stop(a)}return o.set(h,l),p?yield i(h,u.playbackRate,l.playbackRate):yield r(h,u.playbackRate,l.playbackRate),yield n(u,h,l),l});return{set start(u){s=u},set stop(u){a=u},render(u,h){let l=o.get(h);return l!==void 0?Promise.resolve(l):c(u,h)}}};var id=i=>"playbackRate"in i;var nd=i=>"frequency"in i&&"gain"in i;var od=i=>"offset"in i;var sd=i=>!("frequency"in i)&&"gain"in i;var ad=i=>"detune"in i&&"frequency"in i&&!("gain"in i);var cd=i=>"pan"in i;var oe=i=>Jt(ea,i);var oi=i=>Jt(ra,i);var sa=(i,t)=>{let{activeInputs:e}=oe(i);e.forEach(n=>n.forEach(([o])=>{t.includes(i)||sa(o,[...t,i])}));let r=id(i)?[i.playbackRate]:oa(i)?Array.from(i.parameters.values()):nd(i)?[i.Q,i.detune,i.frequency,i.gain]:od(i)?[i.offset]:sd(i)?[i.gain]:ad(i)?[i.detune,i.frequency]:cd(i)?[i.pan]:[];for(let n of r){let o=oi(n);o!==void 0&&o.activeInputs.forEach(([s])=>sa(s,t))}xe(i)&&Ir(i)};var si=i=>{sa(i.destination,[])};var aa=i=>i===void 0||typeof i=="number"||typeof i=="string"&&(i==="balanced"||i==="interactive"||i==="playback");var ud=(i,t,e,r,n,o,s,a,c)=>class extends i{constructor(h={}){if(c===null)throw new Error("Missing the native AudioContext constructor.");let l;try{l=new c(h)}catch(f){throw f.code===12&&f.message==="sampleRate is not in range"?e():f}if(l===null)throw r();if(!aa(h.latencyHint))throw new TypeError(`The provided value '${h.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(h.sampleRate!==void 0&&l.sampleRate!==h.sampleRate)throw e();super(l,2);let{latencyHint:p}=h,{sampleRate:m}=l;if(this._baseLatency=typeof l.baseLatency=="number"?l.baseLatency:p==="balanced"?512/m:p==="interactive"||p===void 0?256/m:p==="playback"?1024/m:Math.max(2,Math.min(128,Math.round(p*m/128)))*128/m,this._nativeAudioContext=l,c.name==="webkitAudioContext"?(this._nativeGainNode=l.createGain(),this._nativeOscillatorNode=l.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(l.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,l.state==="running"){this._state="suspended";let f=()=>{this._state==="suspended"&&(this._state=null),l.removeEventListener("statechange",f)};l.addEventListener("statechange",f)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw t()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),si(this)}))}createMediaElementSource(h){return new n(this,{mediaElement:h})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(h){return new s(this,{mediaStream:h})}createMediaStreamTrackSource(h){return new a(this,{mediaStreamTrack:h})}resume(){return this._state==="suspended"?new Promise((h,l)=>{let p=()=>{this._nativeAudioContext.removeEventListener("statechange",p),this._nativeAudioContext.state==="running"?h():this.resume().then(h,l)};this._nativeAudioContext.addEventListener("statechange",p)}):this._nativeAudioContext.resume().catch(h=>{throw h===void 0||h.code===15?t():h})}suspend(){return this._nativeAudioContext.suspend().catch(h=>{throw h===void 0?t():h})}};var hd=(i,t,e,r,n,o,s,a)=>class extends i{constructor(u,h){let l=o(u),p=s(l),m=n(l,h,p),f=p?t(a):null;super(u,!1,m,f),this._isNodeOfNativeOfflineAudioContext=p,this._nativeAudioDestinationNode=m}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(u){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(u>this._nativeAudioDestinationNode.maxChannelCount)throw e();this._nativeAudioDestinationNode.channelCount=u}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(u){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=u}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}};var ld=i=>{let t=new WeakMap,e=(r,n)=>J(null,null,function*(){let o=n.destination;return t.set(n,o),yield i(r,n,o),o});return{render(r,n){let o=t.get(n);return o!==void 0?Promise.resolve(o):e(r,n)}}};var dd=(i,t,e,r,n,o,s,a)=>(c,u)=>{let h=u.listener,l=()=>{let w=new Float32Array(1),v=t(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),A=s(u),_=!1,E=[0,0,-1,0,1,0],q=[0,0,0],M=()=>{if(_)return;_=!0;let j=r(u,256,9,0);j.onaudioprocess=({inputBuffer:F})=>{let W=[o(F,w,0),o(F,w,1),o(F,w,2),o(F,w,3),o(F,w,4),o(F,w,5)];W.some((k,nt)=>k!==E[nt])&&(h.setOrientation(...W),E=W);let K=[o(F,w,6),o(F,w,7),o(F,w,8)];K.some((k,nt)=>k!==q[nt])&&(h.setPosition(...K),q=K)},v.connect(j)},R=j=>F=>{F!==E[j]&&(E[j]=F,h.setOrientation(...E))},B=j=>F=>{F!==q[j]&&(q[j]=F,h.setPosition(...q))},D=(j,F,W)=>{let K=e(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:F});K.connect(v,0,j),K.start(),Object.defineProperty(K.offset,"defaultValue",{get(){return F}});let k=i({context:c},A,K.offset,Ut,$t);return a(k,"value",nt=>()=>nt.call(k),nt=>mt=>{try{nt.call(k,mt)}catch(Ct){if(Ct.code!==9)throw Ct}M(),A&&W(mt)}),k.cancelAndHoldAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.cancelAndHoldAtTime),k.cancelScheduledValues=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.cancelScheduledValues),k.exponentialRampToValueAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.exponentialRampToValueAtTime),k.linearRampToValueAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.linearRampToValueAtTime),k.setTargetAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.setTargetAtTime),k.setValueAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.setValueAtTime),k.setValueCurveAtTime=(nt=>A?()=>{throw n()}:(...mt)=>{let Ct=nt.apply(k,mt);return M(),Ct})(k.setValueCurveAtTime),k};return{forwardX:D(0,0,R(0)),forwardY:D(1,0,R(1)),forwardZ:D(2,-1,R(2)),positionX:D(6,0,B(0)),positionY:D(7,0,B(1)),positionZ:D(8,0,B(2)),upX:D(3,0,R(3)),upY:D(4,1,R(4)),upZ:D(5,0,R(5))}},{forwardX:p,forwardY:m,forwardZ:f,positionX:g,positionY:b,positionZ:x,upX:C,upY:S,upZ:T}=h.forwardX===void 0?l():h;return{get forwardX(){return p},get forwardY(){return m},get forwardZ(){return f},get positionX(){return g},get positionY(){return b},get positionZ(){return x},get upX(){return C},get upY(){return S},get upZ(){return T}}};var Mi=i=>"context"in i;var ai=i=>Mi(i[0]);var ar=(i,t,e,r)=>{for(let n of i)if(e(n)){if(r)return!1;throw Error("The set contains at least one similar element.")}return i.add(t),!0};var Mu=(i,t,[e,r],n)=>{ar(i,[t,e,r],o=>o[0]===t&&o[1]===e,n)};var Eu=(i,[t,e,r],n)=>{let o=i.get(t);o===void 0?i.set(t,new Set([[e,r]])):ar(o,[e,r],s=>s[0]===e,n)};var Ye=i=>"inputs"in i;var dn=(i,t,e,r)=>{if(Ye(t)){let n=t.inputs[r];return i.connect(n,e,0),[n,e,0]}return i.connect(t,e,r),[t,e,r]};var Du=(i,t,e)=>{for(let r of i)if(r[0]===t&&r[1]===e)return i.delete(r),r;return null};var pd=(i,t,e)=>ni(i,r=>r[0]===t&&r[1]===e);var ku=(i,t)=>{if(!wr(i).delete(t))throw new Error("Missing the expected event listener.")};var Lu=(i,t,e)=>{let r=Jt(i,t),n=ni(r,o=>o[0]===e);return r.size===0&&i.delete(t),n};var pn=(i,t,e,r)=>{Ye(t)?i.disconnect(t.inputs[r],e,0):i.disconnect(t,e,r)};var Rt=i=>Jt(cn,i);var Ei=i=>Jt(Ao,i);var Wr=i=>Co.has(i);var mn=i=>!Sr.has(i);var ju=(i,t)=>new Promise(e=>{if(t!==null)e(!0);else{let r=i.createScriptProcessor(256,1,1),n=i.createGain(),o=i.createBuffer(1,2,44100),s=o.getChannelData(0);s[0]=1,s[1]=1;let a=i.createBufferSource();a.buffer=o,a.loop=!0,a.connect(r).connect(i.destination),a.connect(n),a.disconnect(n),r.onaudioprocess=c=>{let u=c.inputBuffer.getChannelData(0);Array.prototype.some.call(u,h=>h===1)?e(!0):e(!1),a.stop(),r.onaudioprocess=null,a.disconnect(r),r.disconnect(i.destination)},a.start()}});var ca=(i,t)=>{let e=new Map;for(let r of i)for(let n of r){let o=e.get(n);e.set(n,o===void 0?1:o+1)}e.forEach((r,n)=>t(n,r))};var Di=i=>"context"in i;var md=i=>{let t=new Map;i.connect=(e=>(r,n=0,o=0)=>{let s=Di(r)?e(r,n,o):e(r,n),a=t.get(r);return a===void 0?t.set(r,[{input:o,output:n}]):a.every(c=>c.input!==o||c.output!==n)&&a.push({input:o,output:n}),s})(i.connect.bind(i)),i.disconnect=(e=>(r,n,o)=>{if(e.apply(i),r===void 0)t.clear();else if(typeof r=="number")for(let[s,a]of t){let c=a.filter(u=>u.output!==r);c.length===0?t.delete(s):t.set(s,c)}else if(t.has(r))if(n===void 0)t.delete(r);else{let s=t.get(r);if(s!==void 0){let a=s.filter(c=>c.output!==n&&(c.input!==o||o===void 0));a.length===0?t.delete(r):t.set(r,a)}}for(let[s,a]of t)a.forEach(c=>{Di(s)?i.connect(s,c.output,c.input):i.connect(s,c.output)})})(i.disconnect)};var bC=(i,t,e,r)=>{let{activeInputs:n,passiveInputs:o}=oi(t),{outputs:s}=oe(i),a=wr(i),c=u=>{let h=Rt(i),l=Ei(t);if(u){let p=Lu(o,i,e);Mu(n,i,p,!1),!r&&!Wr(i)&&h.connect(l,e)}else{let p=pd(n,i,e);Eu(o,p,!1),!r&&!Wr(i)&&h.disconnect(l,e)}};return ar(s,[t,e],u=>u[0]===t&&u[1]===e,!0)?(a.add(c),xe(i)?Mu(n,i,[e,c],!0):Eu(o,[i,e,c],!0),!0):!1},xC=(i,t,e,r)=>{let{activeInputs:n,passiveInputs:o}=oe(t),s=Du(n[r],i,e);return s===null?[na(o,i,e,r)[2],!1]:[s[2],!0]},AC=(i,t,e)=>{let{activeInputs:r,passiveInputs:n}=oi(t),o=Du(r,i,e);return o===null?[Lu(n,i,e)[1],!1]:[o[2],!0]},Pu=(i,t,e,r,n)=>{let[o,s]=xC(i,e,r,n);if(o!==null&&(ku(i,o),s&&!t&&!Wr(i)&&pn(Rt(i),Rt(e),r,n)),xe(e)){let{activeInputs:a}=oe(e);So(e,a)}},Fu=(i,t,e,r)=>{let[n,o]=AC(i,e,r);n!==null&&(ku(i,n),o&&!t&&!Wr(i)&&Rt(i).disconnect(Ei(e),r))},CC=(i,t)=>{let e=oe(i),r=[];for(let n of e.outputs)ai(n)?Pu(i,t,...n):Fu(i,t,...n),r.push(n[0]);return e.outputs.clear(),r},_C=(i,t,e)=>{let r=oe(i),n=[];for(let o of r.outputs)o[1]===e&&(ai(o)?Pu(i,t,...o):Fu(i,t,...o),n.push(o[0]),r.outputs.delete(o));return n},vC=(i,t,e,r,n)=>{let o=oe(i);return Array.from(o.outputs).filter(s=>s[0]===e&&(r===void 0||s[1]===r)&&(n===void 0||s[2]===n)).map(s=>(ai(s)?Pu(i,t,...s):Fu(i,t,...s),o.outputs.delete(s),s[0]))},fd=(i,t,e,r,n,o,s,a,c,u,h,l,p,m,f,g)=>class extends u{constructor(x,C,S,T){super(S),this._context=x,this._nativeAudioNode=S;let w=h(x);l(w)&&e(ju,()=>ju(w,g))!==!0&&md(S),cn.set(this,S),ia.set(this,new Set),x.state!=="closed"&&C&&sr(this),i(this,T,S)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(x){this._nativeAudioNode.channelCount=x}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(x){this._nativeAudioNode.channelCountMode=x}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(x){this._nativeAudioNode.channelInterpretation=x}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(x,C=0,S=0){if(C<0||C>=this._nativeAudioNode.numberOfOutputs)throw n();let T=h(this._context),w=f(T);if(p(x)||m(x))throw o();if(Mi(x)){let _=Rt(x);try{let q=dn(this._nativeAudioNode,_,C,S),M=mn(this);(w||M)&&this._nativeAudioNode.disconnect(...q),this.context.state!=="closed"&&!M&&mn(x)&&sr(x)}catch(q){throw q.code===12?o():q}if(t(this,x,C,S,w)){let q=c([this],x);ca(q,r(w))}return x}let v=Ei(x);if(v.name==="playbackRate"&&v.maxValue===1024)throw s();try{this._nativeAudioNode.connect(v,C),(w||mn(this))&&this._nativeAudioNode.disconnect(v,C)}catch(_){throw _.code===12?o():_}if(bC(this,x,C,w)){let _=c([this],x);ca(_,r(w))}}disconnect(x,C,S){let T,w=h(this._context),v=f(w);if(x===void 0)T=CC(this,v);else if(typeof x=="number"){if(x<0||x>=this.numberOfOutputs)throw n();T=_C(this,v,x)}else{if(C!==void 0&&(C<0||C>=this.numberOfOutputs)||Mi(x)&&S!==void 0&&(S<0||S>=x.numberOfInputs))throw n();if(T=vC(this,v,x,C,S),T.length===0)throw o()}for(let A of T){let _=c([this],A);ca(_,a)}}};var gd=(i,t,e,r,n,o,s,a,c,u,h,l,p)=>(m,f,g,b=null,x=null)=>{let C=g.value,S=new xo(C),T=f?r(S):null,w={get defaultValue(){return C},get maxValue(){return b===null?g.maxValue:b},get minValue(){return x===null?g.minValue:x},get value(){return g.value},set value(v){g.value=v,w.setValueAtTime(v,m.context.currentTime)},cancelAndHoldAtTime(v){if(typeof g.cancelAndHoldAtTime=="function")T===null&&S.flush(m.context.currentTime),S.add(n(v)),g.cancelAndHoldAtTime(v);else{let A=Array.from(S).pop();T===null&&S.flush(m.context.currentTime),S.add(n(v));let _=Array.from(S).pop();g.cancelScheduledValues(v),A!==_&&_!==void 0&&(_.type==="exponentialRampToValue"?g.exponentialRampToValueAtTime(_.value,_.endTime):_.type==="linearRampToValue"?g.linearRampToValueAtTime(_.value,_.endTime):_.type==="setValue"?g.setValueAtTime(_.value,_.startTime):_.type==="setValueCurve"&&g.setValueCurveAtTime(_.values,_.startTime,_.duration))}return w},cancelScheduledValues(v){return T===null&&S.flush(m.context.currentTime),S.add(o(v)),g.cancelScheduledValues(v),w},exponentialRampToValueAtTime(v,A){if(v===0)throw new RangeError;if(!Number.isFinite(A)||A<0)throw new RangeError;let _=m.context.currentTime;return T===null&&S.flush(_),Array.from(S).length===0&&(S.add(u(C,_)),g.setValueAtTime(C,_)),S.add(s(v,A)),g.exponentialRampToValueAtTime(v,A),w},linearRampToValueAtTime(v,A){let _=m.context.currentTime;return T===null&&S.flush(_),Array.from(S).length===0&&(S.add(u(C,_)),g.setValueAtTime(C,_)),S.add(a(v,A)),g.linearRampToValueAtTime(v,A),w},setTargetAtTime(v,A,_){return T===null&&S.flush(m.context.currentTime),S.add(c(v,A,_)),g.setTargetAtTime(v,A,_),w},setValueAtTime(v,A){return T===null&&S.flush(m.context.currentTime),S.add(u(v,A)),g.setValueAtTime(v,A),w},setValueCurveAtTime(v,A,_){let E=v instanceof Float32Array?v:new Float32Array(v);if(l!==null&&l.name==="webkitAudioContext"){let q=A+_,M=m.context.sampleRate,R=Math.ceil(A*M),B=Math.floor(q*M),D=B-R,j=new Float32Array(D);for(let W=0;W<D;W+=1){let K=(E.length-1)/_*((R+W)/M-A),k=Math.floor(K),nt=Math.ceil(K);j[W]=k===nt?E[k]:(1-(K-k))*E[k]+(1-(nt-K))*E[nt]}T===null&&S.flush(m.context.currentTime),S.add(h(j,A,_)),g.setValueCurveAtTime(j,A,_);let F=B/M;F<q&&p(w,j[j.length-1],F),p(w,E[E.length-1],q)}else T===null&&S.flush(m.context.currentTime),S.add(h(E,A,_)),g.setValueCurveAtTime(E,A,_);return w}};return e.set(w,g),t.set(w,m),i(w,T),w};var yd=i=>({replay(t){for(let e of i)if(e.type==="exponentialRampToValue"){let{endTime:r,value:n}=e;t.exponentialRampToValueAtTime(n,r)}else if(e.type==="linearRampToValue"){let{endTime:r,value:n}=e;t.linearRampToValueAtTime(n,r)}else if(e.type==="setTarget"){let{startTime:r,target:n,timeConstant:o}=e;t.setTargetAtTime(n,r,o)}else if(e.type==="setValue"){let{startTime:r,value:n}=e;t.setValueAtTime(n,r)}else if(e.type==="setValueCurve"){let{duration:r,startTime:n,values:o}=e;t.setValueCurveAtTime(o,n,r)}else throw new Error("Can't apply an unknown automation.")}});var fn=class{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((r,n)=>t.call(e,r,n,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}};var SC={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},bd=(i,t,e,r,n,o,s,a,c,u,h,l,p,m)=>class extends t{constructor(g,b,x){var C;let S=a(g),T=c(S),w=h(O(O({},SC),x));p(w);let v=_o.get(S),A=v==null?void 0:v.get(b),_=T||S.state!=="closed"?S:(C=s(S))!==null&&C!==void 0?C:S,E=n(_,T?null:g.baseLatency,u,b,A,w),q=T?r(b,w,A):null;super(g,!0,E,q);let M=[];E.parameters.forEach((B,D)=>{let j=e(this,T,B);M.push([D,j])}),this._nativeAudioWorkletNode=E,this._onprocessorerror=null,this._parameters=new fn(M),T&&i(S,this);let{activeInputs:R}=o(this);l(E,R)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(g){let b=typeof g=="function"?m(this,g):null;this._nativeAudioWorkletNode.onprocessorerror=b;let x=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=x!==null&&x===b?g:x}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function gn(i,t,e,r,n){if(typeof i.copyFromChannel=="function")t[e].byteLength===0&&(t[e]=new Float32Array(128)),i.copyFromChannel(t[e],r,n);else{let o=i.getChannelData(r);if(t[e].byteLength===0)t[e]=o.slice(n,n+128);else{let s=new Float32Array(o.buffer,n*Float32Array.BYTES_PER_ELEMENT,128);t[e].set(s)}}}var ua=(i,t,e,r,n)=>{typeof i.copyToChannel=="function"?t[e].byteLength!==0&&i.copyToChannel(t[e],r,n):t[e].byteLength!==0&&i.getChannelData(r).set(t[e],n)};var yn=(i,t)=>{let e=[];for(let r=0;r<i;r+=1){let n=[],o=typeof t=="number"?t:t[r];for(let s=0;s<o;s+=1)n.push(new Float32Array(128));e.push(n)}return e};var xd=(i,t)=>{let e=Jt(vo,i),r=Rt(t);return Jt(e,r)};var wC=(i,t,e,r,n,o,s)=>J(null,null,function*(){let a=t===null?Math.ceil(i.context.length/128)*128:t.length,c=r.channelCount*r.numberOfInputs,u=n.reduce((b,x)=>b+x,0),h=u===0?null:e.createBuffer(u,a,e.sampleRate);if(o===void 0)throw new Error("Missing the processor constructor.");let l=oe(i),p=yield xd(e,i),m=yn(r.numberOfInputs,r.channelCount),f=yn(r.numberOfOutputs,n),g=Array.from(i.parameters.keys()).reduce((b,x)=>Q(O({},b),{[x]:new Float32Array(128)}),{});for(let b=0;b<a;b+=128){if(r.numberOfInputs>0&&t!==null)for(let x=0;x<r.numberOfInputs;x+=1)for(let C=0;C<r.channelCount;C+=1)gn(t,m[x],C,C,b);o.parameterDescriptors!==void 0&&t!==null&&o.parameterDescriptors.forEach(({name:x},C)=>{gn(t,g,x,c+C,b)});for(let x=0;x<r.numberOfInputs;x+=1)for(let C=0;C<n[x];C+=1)f[x][C].byteLength===0&&(f[x][C]=new Float32Array(128));try{let x=m.map((S,T)=>l.activeInputs[T].size===0?[]:S),C=s(b/e.sampleRate,e.sampleRate,()=>p.process(x,f,g));if(h!==null)for(let S=0,T=0;S<r.numberOfOutputs;S+=1){for(let w=0;w<n[S];w+=1)ua(h,f[S],w,T+w,b);T+=n[S]}if(!C)break}catch(x){i.dispatchEvent(new ErrorEvent("processorerror",{colno:x.colno,filename:x.filename,lineno:x.lineno,message:x.message}));break}}return h}),Ad=(i,t,e,r,n,o,s,a,c,u,h,l,p,m,f,g)=>(b,x,C)=>{let S=new WeakMap,T=null,w=(v,A)=>J(null,null,function*(){let _=h(v),E=null,q=vt(_,A),M=Array.isArray(x.outputChannelCount)?x.outputChannelCount:Array.from(x.outputChannelCount);if(l===null){let R=M.reduce((F,W)=>F+W,0),B=n(A,{channelCount:Math.max(1,R),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,R)}),D=[];for(let F=0;F<v.numberOfOutputs;F+=1)D.push(r(A,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:M[F]}));let j=s(A,{channelCount:x.channelCount,channelCountMode:x.channelCountMode,channelInterpretation:x.channelInterpretation,gain:1});j.connect=t.bind(null,D),j.disconnect=c.bind(null,D),E=[B,D,j]}else q||(_=new l(A,b));if(S.set(A,E===null?_:E[2]),E!==null){if(T===null){if(C===void 0)throw new Error("Missing the processor constructor.");if(p===null)throw new Error("Missing the native OfflineAudioContext constructor.");let W=v.channelCount*v.numberOfInputs,K=C.parameterDescriptors===void 0?0:C.parameterDescriptors.length,k=W+K;T=wC(v,k===0?null:yield J(null,null,function*(){let mt=new p(k,Math.ceil(v.context.length/128)*128,A.sampleRate),Ct=[],Ht=[];for(let Ot=0;Ot<x.numberOfInputs;Ot+=1)Ct.push(s(mt,{channelCount:x.channelCount,channelCountMode:x.channelCountMode,channelInterpretation:x.channelInterpretation,gain:1})),Ht.push(n(mt,{channelCount:x.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:x.channelCount}));let De=yield Promise.all(Array.from(v.parameters.values()).map(Ot=>J(null,null,function*(){let ut=o(mt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:Ot.value});return yield m(mt,Ot,ut.offset),ut}))),ke=r(mt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,W+K)});for(let Ot=0;Ot<x.numberOfInputs;Ot+=1){Ct[Ot].connect(Ht[Ot]);for(let ut=0;ut<x.channelCount;ut+=1)Ht[Ot].connect(ke,ut,Ot*x.channelCount+ut)}for(let[Ot,ut]of De.entries())ut.connect(ke,0,W+Ot),ut.start(0);return ke.connect(mt.destination),yield Promise.all(Ct.map(Ot=>f(v,mt,Ot))),g(mt)}),A,x,M,C,u)}let R=yield T,B=e(A,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[D,j,F]=E;R!==null&&(B.buffer=R,B.start(0)),B.connect(D);for(let W=0,K=0;W<v.numberOfOutputs;W+=1){let k=j[W];for(let nt=0;nt<M[W];nt+=1)D.connect(k,K+nt,nt);K+=M[W]}return F}if(q)for(let[R,B]of v.parameters.entries())yield i(A,B,_.parameters.get(R));else for(let[R,B]of v.parameters.entries())yield m(A,B,_.parameters.get(R));return yield f(v,A,_),_});return{render(v,A){a(A,v);let _=S.get(A);return _!==void 0?Promise.resolve(_):w(v,A)}}};var Cd=(i,t,e,r,n,o,s,a,c,u,h,l,p,m,f,g,b,x,C,S)=>class extends f{constructor(w,v){super(w,v),this._nativeContext=w,this._audioWorklet=i===void 0?void 0:{addModule:(A,_)=>i(this,A,_)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new t(this)}createBiquadFilter(){return new n(this)}createBuffer(w,v,A){return new e({length:v,numberOfChannels:w,sampleRate:A})}createBufferSource(){return new r(this)}createChannelMerger(w=6){return new o(this,{numberOfInputs:w})}createChannelSplitter(w=6){return new s(this,{numberOfOutputs:w})}createConstantSource(){return new a(this)}createConvolver(){return new c(this)}createDelay(w=1){return new h(this,{maxDelayTime:w})}createDynamicsCompressor(){return new l(this)}createGain(){return new p(this)}createIIRFilter(w,v){return new m(this,{feedback:v,feedforward:w})}createOscillator(){return new g(this)}createPanner(){return new b(this)}createPeriodicWave(w,v,A={disableNormalization:!1}){return new x(this,Q(O({},A),{imag:v,real:w}))}createStereoPanner(){return new C(this)}createWaveShaper(){return new S(this)}decodeAudioData(w,v,A){return u(this._nativeContext,w).then(_=>(typeof v=="function"&&v(_),_),_=>{throw typeof A=="function"&&A(_),_})}};var IC={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},_d=(i,t,e,r,n,o,s,a)=>class extends i{constructor(u,h){let l=o(u),p=O(O({},IC),h),m=n(l,p),f=s(l),g=f?e():null;super(u,!1,m,g),this._Q=t(this,f,m.Q,Ut,$t),this._detune=t(this,f,m.detune,1200*Math.log2(Ut),-1200*Math.log2(Ut)),this._frequency=t(this,f,m.frequency,u.sampleRate/2,0),this._gain=t(this,f,m.gain,40*Math.log10(Ut),$t),this._nativeBiquadFilterNode=m,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(u){this._nativeBiquadFilterNode.type=u}getFrequencyResponse(u,h,l){try{this._nativeBiquadFilterNode.getFrequencyResponse(u,h,l)}catch(p){throw p.code===11?r():p}if(u.length!==h.length||h.length!==l.length)throw r()}};var vd=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=(a,c)=>J(null,null,function*(){let u=e(a),h=vt(u,c);if(!h){let l={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=t(c,l)}return o.set(c,u),h?(yield i(c,a.Q,u.Q),yield i(c,a.detune,u.detune),yield i(c,a.frequency,u.frequency),yield i(c,a.gain,u.gain)):(yield r(c,a.Q,u.Q),yield r(c,a.detune,u.detune),yield r(c,a.frequency,u.frequency),yield r(c,a.gain,u.gain)),yield n(a,c,u),u});return{render(a,c){let u=o.get(c);return u!==void 0?Promise.resolve(u):s(a,c)}}};var Sd=(i,t)=>(e,r)=>{let n=t.get(e);if(n!==void 0)return n;let o=i.get(e);if(o!==void 0)return o;try{let s=r();return s instanceof Promise?(i.set(e,s),s.catch(()=>!1).then(a=>(i.delete(e),t.set(e,a),a))):(t.set(e,s),s)}catch(s){return t.set(e,!1),!1}};var TC={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},wd=(i,t,e,r,n)=>class extends i{constructor(s,a){let c=r(s),u=O(O({},TC),a),h=e(c,u),l=n(c)?t():null;super(s,!1,h,l)}};var Id=(i,t,e)=>()=>{let r=new WeakMap,n=(o,s)=>J(null,null,function*(){let a=t(o);if(!vt(a,s)){let u={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs};a=i(s,u)}return r.set(s,a),yield e(o,s,a),a});return{render(o,s){let a=r.get(s);return a!==void 0?Promise.resolve(a):n(o,s)}}};var NC={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Td=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=r(a),h=o(O(O({},NC),c)),l=e(u,h),p=n(u)?t():null;super(a,!1,l,p)}};var Nd=(i,t,e)=>()=>{let r=new WeakMap,n=(o,s)=>J(null,null,function*(){let a=t(o);if(!vt(a,s)){let u={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs};a=i(s,u)}return r.set(s,a),yield e(o,s,a),a});return{render(o,s){let a=r.get(s);return a!==void 0?Promise.resolve(a):n(o,s)}}};var Od=i=>(t,e,r)=>i(e,t,r);var Rd=i=>(t,e,r=0,n=0)=>{let o=t[r];if(o===void 0)throw i();return Di(e)?o.connect(e,0,n):o.connect(e,0)};var Md=i=>(t,e)=>{let r=i(t,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),n=t.createBuffer(1,2,44100);return r.buffer=n,r.loop=!0,r.connect(e),r.start(),()=>{r.stop(),r.disconnect(e)}};var OC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Ed=(i,t,e,r,n,o,s)=>class extends i{constructor(c,u){let h=n(c),l=O(O({},OC),u),p=r(h,l),m=o(h),f=m?e():null;super(c,!1,p,f),this._constantSourceNodeRenderer=f,this._nativeConstantSourceNode=p,this._offset=t(this,m,p.offset,Ut,$t),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(c){let u=typeof c=="function"?s(this,c):null;this._nativeConstantSourceNode.onended=u;let h=this._nativeConstantSourceNode.onended;this._onended=h!==null&&h===u?c:h}start(c=0){if(this._nativeConstantSourceNode.start(c),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=c),this.context.state!=="closed"){sr(this);let u=()=>{this._nativeConstantSourceNode.removeEventListener("ended",u),xe(this)&&Ir(this)};this._nativeConstantSourceNode.addEventListener("ended",u)}}stop(c=0){this._nativeConstantSourceNode.stop(c),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=c)}};var Dd=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=null,a=null,c=(u,h)=>J(null,null,function*(){let l=e(u),p=vt(l,h);if(!p){let m={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=t(h,m),s!==null&&l.start(s),a!==null&&l.stop(a)}return o.set(h,l),p?yield i(h,u.offset,l.offset):yield r(h,u.offset,l.offset),yield n(u,h,l),l});return{set start(u){s=u},set stop(u){a=u},render(u,h){let l=o.get(h);return l!==void 0?Promise.resolve(l):c(u,h)}}};var kd=i=>t=>(i[0]=t,i[0]);var RC={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Ld=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=r(a),h=O(O({},RC),c),l=e(u,h),m=n(u)?t():null;super(a,!1,l,m),this._isBufferNullified=!1,this._nativeConvolverNode=l,h.buffer!==null&&o(this,h.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(a){if(this._nativeConvolverNode.buffer=a,a===null&&this._nativeConvolverNode.buffer!==null){let c=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=c.createBuffer(1,1,c.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(a){this._nativeConvolverNode.normalize=a}};var jd=(i,t,e)=>()=>{let r=new WeakMap,n=(o,s)=>J(null,null,function*(){let a=t(o);if(!vt(a,s)){let u={buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize};a=i(s,u)}return r.set(s,a),Ye(a)?yield e(o,s,a.inputs[0]):yield e(o,s,a),a});return{render(o,s){let a=r.get(s);return a!==void 0?Promise.resolve(a):n(o,s)}}};var Pd=(i,t)=>(e,r,n)=>{if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(e,r,n)}catch(o){throw o.name==="SyntaxError"?i():o}};var Fd=()=>new DOMException("","DataCloneError");var Bu=i=>{let{port1:t,port2:e}=new MessageChannel;return new Promise(r=>{let n=()=>{e.onmessage=null,t.close(),e.close(),r()};e.onmessage=()=>n();try{t.postMessage(i,[i])}catch(o){}finally{n()}})};var Bd=(i,t,e,r,n,o,s,a,c,u,h)=>(l,p)=>{let m=s(l)?l:o(l);if(n.has(p)){let f=e();return Promise.reject(f)}try{n.add(p)}catch(f){}return t(c,()=>c(m))?m.decodeAudioData(p).then(f=>(Bu(p).catch(()=>{}),t(a,()=>a(f))||h(f),i.add(f),f)):new Promise((f,g)=>{let b=()=>J(null,null,function*(){try{yield Bu(p)}catch(C){}}),x=C=>{g(C),b()};try{m.decodeAudioData(p,C=>{typeof C.copyFromChannel!="function"&&(u(C),ln(C)),i.add(C),b().then(()=>f(C))},C=>{x(C===null?r():C)})}catch(C){x(C)}})};var Gd=(i,t,e,r,n,o,s,a)=>(c,u)=>{let h=t.get(c);if(h===void 0)throw new Error("Missing the expected cycle count.");let l=o(c.context),p=a(l);if(h===u){if(t.delete(c),!p&&s(c)){let m=r(c),{outputs:f}=e(c);for(let g of f)if(ai(g)){let b=r(g[0]);i(m,b,g[1],g[2])}else{let b=n(g[0]);m.connect(b,g[1])}}}else t.set(c,h-u)};var MC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Vd=(i,t,e,r,n,o,s)=>class extends i{constructor(c,u){let h=n(c),l=O(O({},MC),u),p=r(h,l),m=o(h),f=m?e(l.maxDelayTime):null;super(c,!1,p,f),this._delayTime=t(this,m,p.delayTime),s(this,l.maxDelayTime)}get delayTime(){return this._delayTime}};var qd=(i,t,e,r,n)=>o=>{let s=new WeakMap,a=(c,u)=>J(null,null,function*(){let h=e(c),l=vt(h,u);if(!l){let p={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,delayTime:h.delayTime.value,maxDelayTime:o};h=t(u,p)}return s.set(u,h),l?yield i(u,c.delayTime,h.delayTime):yield r(u,c.delayTime,h.delayTime),yield n(c,u,h),h});return{render(c,u){let h=s.get(u);return h!==void 0?Promise.resolve(h):a(c,u)}}};var Wd=i=>(t,e,r,n)=>i(t[n],o=>o[0]===e&&o[1]===r);var Ud=i=>(t,e)=>{i(t).delete(e)};var zd=i=>"delayTime"in i;var Yd=(i,t,e)=>function r(n,o){let s=Mi(o)?o:e(i,o);if(zd(s))return[];if(n[0]===s)return[n];if(n.includes(s))return[];let{outputs:a}=t(s);return Array.from(a).map(c=>r([...n,s],c[0])).reduce((c,u)=>c.concat(u),[])};var ha=(i,t,e)=>{let r=t[e];if(r===void 0)throw i();return r},Hd=i=>(t,e=void 0,r=void 0,n=0)=>e===void 0?t.forEach(o=>o.disconnect()):typeof e=="number"?ha(i,t,e).disconnect():Di(e)?r===void 0?t.forEach(o=>o.disconnect(e)):n===void 0?ha(i,t,r).disconnect(e,0):ha(i,t,r).disconnect(e,0,n):r===void 0?t.forEach(o=>o.disconnect(e)):ha(i,t,r).disconnect(e,0);var EC={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},$d=(i,t,e,r,n,o,s,a)=>class extends i{constructor(u,h){let l=o(u),p=O(O({},EC),h),m=r(l,p),f=s(l),g=f?e():null;super(u,!1,m,g),this._attack=t(this,f,m.attack),this._knee=t(this,f,m.knee),this._nativeDynamicsCompressorNode=m,this._ratio=t(this,f,m.ratio),this._release=t(this,f,m.release),this._threshold=t(this,f,m.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(u){let h=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=u,u>2)throw this._nativeDynamicsCompressorNode.channelCount=h,n()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(u){let h=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=u,u==="max")throw this._nativeDynamicsCompressorNode.channelCountMode=h,n()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value=="number"?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}};var Zd=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=(a,c)=>J(null,null,function*(){let u=e(a),h=vt(u,c);if(!h){let l={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=t(c,l)}return o.set(c,u),h?(yield i(c,a.attack,u.attack),yield i(c,a.knee,u.knee),yield i(c,a.ratio,u.ratio),yield i(c,a.release,u.release),yield i(c,a.threshold,u.threshold)):(yield r(c,a.attack,u.attack),yield r(c,a.knee,u.knee),yield r(c,a.ratio,u.ratio),yield r(c,a.release,u.release),yield r(c,a.threshold,u.threshold)),yield n(a,c,u),u});return{render(a,c){let u=o.get(c);return u!==void 0?Promise.resolve(u):s(a,c)}}};var Xd=()=>new DOMException("","EncodingError");var Qd=i=>t=>new Promise((e,r)=>{if(i===null){r(new SyntaxError);return}let n=i.document.head;if(n===null)r(new SyntaxError);else{let o=i.document.createElement("script"),s=new Blob([t],{type:"application/javascript"}),a=URL.createObjectURL(s),c=i.onerror,u=()=>{i.onerror=c,URL.revokeObjectURL(a)};i.onerror=(h,l,p,m,f)=>{if(l===a||l===i.location.href&&p===1&&m===1)return u(),r(f),!1;if(c!==null)return c(h,l,p,m,f)},o.onerror=()=>{u(),r(new SyntaxError)},o.onload=()=>{u(),e()},o.src=a,o.type="module",n.appendChild(o)}});var Kd=i=>class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,r,n){if(r!==null){let o=this._listeners.get(r);o===void 0&&(o=i(this,r),typeof r=="function"&&this._listeners.set(r,o)),this._nativeEventTarget.addEventListener(e,o,n)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,r,n){let o=r===null?void 0:this._listeners.get(r);this._nativeEventTarget.removeEventListener(e,o===void 0?null:o,n)}};var Jd=i=>(t,e,r)=>{Object.defineProperties(i,{currentFrame:{configurable:!0,get(){return Math.round(t*e)}},currentTime:{configurable:!0,get(){return t}}});try{return r()}finally{i!==null&&(delete i.currentFrame,delete i.currentTime)}};var tp=i=>t=>J(null,null,function*(){try{let e=yield fetch(t);if(e.ok)return[yield e.text(),e.url]}catch(e){}throw i()});var DC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},ep=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=n(a),h=O(O({},DC),c),l=r(u,h),p=o(u),m=p?e():null;super(a,!1,l,m),this._gain=t(this,p,l.gain,Ut,$t)}get gain(){return this._gain}};var rp=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=(a,c)=>J(null,null,function*(){let u=e(a),h=vt(u,c);if(!h){let l={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=t(c,l)}return o.set(c,u),h?yield i(c,a.gain,u.gain):yield r(c,a.gain,u.gain),yield n(a,c,u),u});return{render(a,c){let u=o.get(c);return u!==void 0?Promise.resolve(u):s(a,c)}}};var ip=(i,t)=>e=>t(i,e);var np=i=>t=>{let e=i(t);if(e.renderer===null)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return e.renderer};var op=i=>t=>{var e;return(e=i.get(t))!==null&&e!==void 0?e:0};var sp=i=>t=>{let e=i(t);if(e.renderer===null)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return e.renderer};var ap=i=>t=>i.get(t);var Ft=()=>new DOMException("","InvalidStateError");var cp=i=>t=>{let e=i.get(t);if(e===void 0)throw Ft();return e};var up=(i,t)=>e=>{let r=i.get(e);if(r!==void 0)return r;if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),i.set(e,r),r};var hp=i=>t=>{let e=i.get(t);if(e===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return e};var bn=()=>new DOMException("","InvalidAccessError");var lp=i=>{i.getFrequencyResponse=(t=>(e,r,n)=>{if(e.length!==r.length||r.length!==n.length)throw bn();return t.call(i,e,r,n)})(i.getFrequencyResponse)};var kC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},dp=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=r(a),h=n(u),l=O(O({},kC),c),p=t(u,h?null:a.baseLatency,l),m=h?e(l.feedback,l.feedforward):null;super(a,!1,p,m),lp(p),this._nativeIIRFilterNode=p,o(this,1)}getFrequencyResponse(a,c,u){return this._nativeIIRFilterNode.getFrequencyResponse(a,c,u)}};var la=(i,t,e,r,n,o,s,a,c,u,h)=>{let l=u.length,p=a;for(let m=0;m<l;m+=1){let f=e[0]*u[m];for(let g=1;g<n;g+=1){let b=p-g&c-1;f+=e[g]*o[b],f-=i[g]*s[b]}for(let g=n;g<r;g+=1)f+=e[g]*o[p-g&c-1];for(let g=n;g<t;g+=1)f-=i[g]*s[p-g&c-1];o[p]=u[m],s[p]=f,p=p+1&c-1,h[m]=f}return p};var LC=(i,t,e,r)=>{let n=e instanceof Float64Array?e:new Float64Array(e),o=r instanceof Float64Array?r:new Float64Array(r),s=n.length,a=o.length,c=Math.min(s,a);if(n[0]!==1){for(let f=0;f<s;f+=1)o[f]/=n[0];for(let f=1;f<a;f+=1)n[f]/=n[0]}let u=32,h=new Float32Array(u),l=new Float32Array(u),p=t.createBuffer(i.numberOfChannels,i.length,i.sampleRate),m=i.numberOfChannels;for(let f=0;f<m;f+=1){let g=i.getChannelData(f),b=p.getChannelData(f);h.fill(0),l.fill(0),la(n,s,o,a,c,h,l,0,u,g,b)}return p},pp=(i,t,e,r,n)=>(o,s)=>{let a=new WeakMap,c=null,u=(h,l)=>J(null,null,function*(){let p=null,m=t(h),f=vt(m,l);if(l.createIIRFilter===void 0?p=i(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):f||(m=l.createIIRFilter(s,o)),a.set(l,p===null?m:p),p!==null){if(c===null){if(e===null)throw new Error("Missing the native OfflineAudioContext constructor.");let b=new e(h.context.destination.channelCount,h.context.length,l.sampleRate);c=J(null,null,function*(){yield r(h,b,b.destination);let x=yield n(b);return LC(x,l,o,s)})}let g=yield c;return p.buffer=g,p.start(0),p}return yield r(h,l,m),m});return{render(h,l){let p=a.get(l);return p!==void 0?Promise.resolve(p):u(h,l)}}};var mp=(i,t,e,r,n,o)=>s=>(a,c)=>{let u=i.get(a);if(u===void 0){if(!s&&o(a)){let h=r(a),{outputs:l}=e(a);for(let p of l)if(ai(p)){let m=r(p[0]);t(h,m,p[1],p[2])}else{let m=n(p[0]);h.disconnect(m,p[1])}}i.set(a,c)}else i.set(a,u+c)};var fp=(i,t)=>e=>{let r=i.get(e);return t(r)||t(e)};var gp=(i,t)=>e=>i.has(e)||t(e);var yp=(i,t)=>e=>i.has(e)||t(e);var bp=(i,t)=>e=>{let r=i.get(e);return t(r)||t(e)};var xp=i=>t=>i!==null&&t instanceof i;var Ap=i=>t=>i!==null&&typeof i.AudioNode=="function"&&t instanceof i.AudioNode;var Cp=i=>t=>i!==null&&typeof i.AudioParam=="function"&&t instanceof i.AudioParam;var _p=(i,t)=>e=>i(e)||t(e);var vp=i=>t=>i!==null&&t instanceof i;var Sp=i=>i!==null&&i.isSecureContext;var wp=(i,t,e,r)=>class extends i{constructor(o,s){let a=e(o),c=t(a,s);if(r(a))throw TypeError();super(o,!0,c,null),this._nativeMediaElementAudioSourceNode=c}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}};var jC={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Ip=(i,t,e,r)=>class extends i{constructor(o,s){let a=e(o);if(r(a))throw new TypeError;let c=O(O({},jC),s),u=t(a,c);super(o,!1,u,null),this._nativeMediaStreamAudioDestinationNode=u}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}};var Tp=(i,t,e,r)=>class extends i{constructor(o,s){let a=e(o),c=t(a,s);if(r(a))throw new TypeError;super(o,!0,c,null),this._nativeMediaStreamAudioSourceNode=c}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}};var Np=(i,t,e)=>class extends i{constructor(n,o){let s=e(n),a=t(s,o);super(n,!0,a,null)}};var Op=(i,t,e,r,n)=>class extends r{constructor(s={}){if(n===null)throw new Error("Missing the native AudioContext constructor.");let a;try{a=new n(s)}catch(h){throw h.code===12&&h.message==="sampleRate is not in range"?t():h}if(a===null)throw e();if(!aa(s.latencyHint))throw new TypeError(`The provided value '${s.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(s.sampleRate!==void 0&&a.sampleRate!==s.sampleRate)throw t();super(a,2);let{latencyHint:c}=s,{sampleRate:u}=a;if(this._baseLatency=typeof a.baseLatency=="number"?a.baseLatency:c==="balanced"?512/u:c==="interactive"||c===void 0?256/u:c==="playback"?1024/u:Math.max(2,Math.min(128,Math.round(c*u/128)))*128/u,this._nativeAudioContext=a,n.name==="webkitAudioContext"?(this._nativeGainNode=a.createGain(),this._nativeOscillatorNode=a.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(a.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,a.state==="running"){this._state="suspended";let h=()=>{this._state==="suspended"&&(this._state=null),a.removeEventListener("statechange",h)};a.addEventListener("statechange",h)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw i()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),si(this)}))}resume(){return this._state==="suspended"?new Promise((s,a)=>{let c=()=>{this._nativeAudioContext.removeEventListener("statechange",c),this._nativeAudioContext.state==="running"?s():this.resume().then(s,a)};this._nativeAudioContext.addEventListener("statechange",c)}):this._nativeAudioContext.resume().catch(s=>{throw s===void 0||s.code===15?i():s})}suspend(){return this._nativeAudioContext.suspend().catch(s=>{throw s===void 0?i():s})}};var Rp=(i,t,e,r,n,o)=>class extends e{constructor(a,c){super(a),this._nativeContext=a,un.set(this,a),r(a)&&n.set(a,new Set),this._destination=new i(this,c),this._listener=t(this,a),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(a){let c=typeof a=="function"?o(this,a):null;this._nativeContext.onstatechange=c;let u=this._nativeContext.onstatechange;this._onstatechange=u!==null&&u===c?a:u}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}};var cr=i=>{let t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{let e=i.decodeAudioData(t.buffer,()=>{});return e===void 0?!1:(e.catch(()=>{}),!0)}catch(e){}return!1};var PC={numberOfChannels:1},Mp=(i,t,e,r,n)=>class extends r{constructor(s){let{length:a,numberOfChannels:c,sampleRate:u}=O(O({},PC),s),h=e(c,a,u);i(cr,()=>cr(h))||h.addEventListener("statechange",(()=>{let l=0,p=m=>{this._state==="running"&&(l>0?(h.removeEventListener("statechange",p),m.stopImmediatePropagation(),this._waitForThePromiseToSettle(m)):l+=1)};return p})()),super(h,c),this._length=a,this._nativeOfflineAudioContext=h,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(t()):(this._state="running",n(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,si(this)}))}_waitForThePromiseToSettle(s){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(s):setTimeout(()=>this._waitForThePromiseToSettle(s))}};var Ep=(i,t)=>(e,r,n)=>{let o=new Set;return e.connect=(s=>(a,c=0,u=0)=>{let h=o.size===0;if(t(a))return s.call(e,a,c,u),i(o,[a,c,u],l=>l[0]===a&&l[1]===c&&l[2]===u,!0),h&&r(),a;s.call(e,a,c),i(o,[a,c],l=>l[0]===a&&l[1]===c,!0),h&&r()})(e.connect),e.disconnect=(s=>(a,c,u)=>{let h=o.size>0;if(a===void 0)s.apply(e),o.clear();else if(typeof a=="number"){s.call(e,a);for(let p of o)p[1]===a&&o.delete(p)}else{t(a)?s.call(e,a,c,u):s.call(e,a,c);for(let p of o)p[0]===a&&(c===void 0||p[1]===c)&&(u===void 0||p[2]===u)&&o.delete(p)}let l=o.size===0;h&&l&&n()})(e.disconnect),e};var St=(i,t,e)=>{let r=t[e];r!==void 0&&r!==i[e]&&(i[e]=r)};var gt=(i,t)=>{St(i,t,"channelCount"),St(i,t,"channelCountMode"),St(i,t,"channelInterpretation")};var Gu=i=>typeof i.getFloatTimeDomainData=="function";var Dp=i=>{i.getFloatTimeDomainData=t=>{let e=new Uint8Array(t.length);i.getByteTimeDomainData(e);let r=Math.max(e.length,i.fftSize);for(let n=0;n<r;n+=1)t[n]=(e[n]-128)*.0078125;return t}};var kp=(i,t)=>(e,r)=>{let n=e.createAnalyser();if(gt(n,r),!(r.maxDecibels>r.minDecibels))throw t();return St(n,r,"fftSize"),St(n,r,"maxDecibels"),St(n,r,"minDecibels"),St(n,r,"smoothingTimeConstant"),i(Gu,()=>Gu(n))||Dp(n),n};var Lp=i=>i===null?null:i.hasOwnProperty("AudioBuffer")?i.AudioBuffer:null;var Tt=(i,t,e)=>{let r=t[e];r!==void 0&&r!==i[e].value&&(i[e].value=r)};var jp=i=>{i.start=(t=>{let e=!1;return(r=0,n=0,o)=>{if(e)throw Ft();t.call(i,r,n,o),e=!0}})(i.start)};var xn=i=>{i.start=(t=>(e=0,r=0,n)=>{if(typeof n=="number"&&n<0||r<0||e<0)throw new RangeError("The parameters can't be negative.");t.call(i,e,r,n)})(i.start)};var An=i=>{i.stop=(t=>(e=0)=>{if(e<0)throw new RangeError("The parameter can't be negative.");t.call(i,e)})(i.stop)};var Pp=(i,t,e,r,n,o,s,a,c,u,h)=>(l,p)=>{let m=l.createBufferSource();return gt(m,p),Tt(m,p,"playbackRate"),St(m,p,"buffer"),St(m,p,"loop"),St(m,p,"loopEnd"),St(m,p,"loopStart"),t(e,()=>e(l))||jp(m),t(r,()=>r(l))||c(m),t(n,()=>n(l))||u(m,l),t(o,()=>o(l))||xn(m),t(s,()=>s(l))||h(m,l),t(a,()=>a(l))||An(m),i(l,m),m};var Fp=i=>i===null?null:i.hasOwnProperty("AudioContext")?i.AudioContext:i.hasOwnProperty("webkitAudioContext")?i.webkitAudioContext:null;var Bp=(i,t)=>(e,r,n)=>{let o=e.destination;if(o.channelCount!==r)try{o.channelCount=r}catch(a){}n&&o.channelCountMode!=="explicit"&&(o.channelCountMode="explicit"),o.maxChannelCount===0&&Object.defineProperty(o,"maxChannelCount",{value:r});let s=i(e,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return t(s,"channelCount",a=>()=>a.call(s),a=>c=>{a.call(s,c);try{o.channelCount=c}catch(u){if(c>o.maxChannelCount)throw u}}),t(s,"channelCountMode",a=>()=>a.call(s),a=>c=>{a.call(s,c),o.channelCountMode=c}),t(s,"channelInterpretation",a=>()=>a.call(s),a=>c=>{a.call(s,c),o.channelInterpretation=c}),Object.defineProperty(s,"maxChannelCount",{get:()=>o.maxChannelCount}),s.connect(o),s};var Gp=i=>i===null?null:i.hasOwnProperty("AudioWorkletNode")?i.AudioWorkletNode:null;var Vp=i=>{let{port1:t}=new MessageChannel;try{t.postMessage(i)}finally{t.close()}};var qp=(i,t,e,r,n)=>(o,s,a,c,u,h)=>{if(a!==null)try{let l=new a(o,c,h),p=new Map,m=null;if(Object.defineProperties(l,{channelCount:{get:()=>h.channelCount,set:()=>{throw i()}},channelCountMode:{get:()=>"explicit",set:()=>{throw i()}},onprocessorerror:{get:()=>m,set:f=>{typeof m=="function"&&l.removeEventListener("processorerror",m),m=typeof f=="function"?f:null,typeof m=="function"&&l.addEventListener("processorerror",m)}}}),l.addEventListener=(f=>(...g)=>{if(g[0]==="processorerror"){let b=typeof g[1]=="function"?g[1]:typeof g[1]=="object"&&g[1]!==null&&typeof g[1].handleEvent=="function"?g[1].handleEvent:null;if(b!==null){let x=p.get(g[1]);x!==void 0?g[1]=x:(g[1]=C=>{C.type==="error"?(Object.defineProperties(C,{type:{value:"processorerror"}}),b(C)):b(new ErrorEvent(g[0],O({},C)))},p.set(b,g[1]))}}return f.call(l,"error",g[1],g[2]),f.call(l,...g)})(l.addEventListener),l.removeEventListener=(f=>(...g)=>{if(g[0]==="processorerror"){let b=p.get(g[1]);b!==void 0&&(p.delete(g[1]),g[1]=b)}return f.call(l,"error",g[1],g[2]),f.call(l,g[0],g[1],g[2])})(l.removeEventListener),h.numberOfOutputs!==0){let f=e(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return l.connect(f).connect(o.destination),n(l,()=>f.disconnect(),()=>f.connect(o.destination))}return l}catch(l){throw l.code===11?r():l}if(u===void 0)throw r();return Vp(h),t(o,s,u,h)};var da=(i,t)=>i===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(i*t)))));var Wp=i=>new Promise((t,e)=>{let{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:o})=>{r.close(),n.close(),t(o)},r.onmessageerror=({data:o})=>{r.close(),n.close(),e(o)},n.postMessage(i)});var Up=(i,t)=>J(null,null,function*(){let e=yield Wp(t);return new i(e)});var zp=(i,t,e,r)=>{let n=vo.get(i);n===void 0&&(n=new WeakMap,vo.set(i,n));let o=Up(e,r);return n.set(t,o),o};var Yp=(i,t,e,r,n,o,s,a,c,u,h,l,p)=>(m,f,g,b)=>{if(b.numberOfInputs===0&&b.numberOfOutputs===0)throw c();let x=Array.isArray(b.outputChannelCount)?b.outputChannelCount:Array.from(b.outputChannelCount);if(x.some(H=>H<1))throw c();if(x.length!==b.numberOfOutputs)throw t();if(b.channelCountMode!=="explicit")throw c();let C=b.channelCount*b.numberOfInputs,S=x.reduce((H,at)=>H+at,0),T=g.parameterDescriptors===void 0?0:g.parameterDescriptors.length;if(C+T>6||S>6)throw c();let w=new MessageChannel,v=[],A=[];for(let H=0;H<b.numberOfInputs;H+=1)v.push(s(m,{channelCount:b.channelCount,channelCountMode:b.channelCountMode,channelInterpretation:b.channelInterpretation,gain:1})),A.push(n(m,{channelCount:b.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:b.channelCount}));let _=[];if(g.parameterDescriptors!==void 0)for(let{defaultValue:H,maxValue:at,minValue:ie,name:Bt}of g.parameterDescriptors){let It=o(m,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:b.parameterData[Bt]!==void 0?b.parameterData[Bt]:H===void 0?0:H});Object.defineProperties(It.offset,{defaultValue:{get:()=>H===void 0?0:H},maxValue:{get:()=>at===void 0?Ut:at},minValue:{get:()=>ie===void 0?$t:ie}}),_.push(It)}let E=r(m,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,C+T)}),q=da(f,m.sampleRate),M=a(m,q,C+T,Math.max(1,S)),R=n(m,{channelCount:Math.max(1,S),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,S)}),B=[];for(let H=0;H<b.numberOfOutputs;H+=1)B.push(r(m,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:x[H]}));for(let H=0;H<b.numberOfInputs;H+=1){v[H].connect(A[H]);for(let at=0;at<b.channelCount;at+=1)A[H].connect(E,at,H*b.channelCount+at)}let D=new fn(g.parameterDescriptors===void 0?[]:g.parameterDescriptors.map(({name:H},at)=>{let ie=_[at];return ie.connect(E,0,C+at),ie.start(0),[H,ie.offset]}));E.connect(M);let j=b.channelInterpretation,F=null,W=b.numberOfOutputs===0?[M]:B,K={get bufferSize(){return q},get channelCount(){return b.channelCount},set channelCount(H){throw e()},get channelCountMode(){return b.channelCountMode},set channelCountMode(H){throw e()},get channelInterpretation(){return j},set channelInterpretation(H){for(let at of v)at.channelInterpretation=H;j=H},get context(){return M.context},get inputs(){return v},get numberOfInputs(){return b.numberOfInputs},get numberOfOutputs(){return b.numberOfOutputs},get onprocessorerror(){return F},set onprocessorerror(H){typeof F=="function"&&K.removeEventListener("processorerror",F),F=typeof H=="function"?H:null,typeof F=="function"&&K.addEventListener("processorerror",F)},get parameters(){return D},get port(){return w.port2},addEventListener(...H){return M.addEventListener(H[0],H[1],H[2])},connect:i.bind(null,W),disconnect:u.bind(null,W),dispatchEvent(...H){return M.dispatchEvent(H[0])},removeEventListener(...H){return M.removeEventListener(H[0],H[1],H[2])}},k=new Map;w.port1.addEventListener=(H=>(...at)=>{if(at[0]==="message"){let ie=typeof at[1]=="function"?at[1]:typeof at[1]=="object"&&at[1]!==null&&typeof at[1].handleEvent=="function"?at[1].handleEvent:null;if(ie!==null){let Bt=k.get(at[1]);Bt!==void 0?at[1]=Bt:(at[1]=It=>{h(m.currentTime,m.sampleRate,()=>ie(It))},k.set(ie,at[1]))}}return H.call(w.port1,at[0],at[1],at[2])})(w.port1.addEventListener),w.port1.removeEventListener=(H=>(...at)=>{if(at[0]==="message"){let ie=k.get(at[1]);ie!==void 0&&(k.delete(at[1]),at[1]=ie)}return H.call(w.port1,at[0],at[1],at[2])})(w.port1.removeEventListener);let nt=null;Object.defineProperty(w.port1,"onmessage",{get:()=>nt,set:H=>{typeof nt=="function"&&w.port1.removeEventListener("message",nt),nt=typeof H=="function"?H:null,typeof nt=="function"&&(w.port1.addEventListener("message",nt),w.port1.start())}}),g.prototype.port=w.port1;let mt=null;zp(m,K,g,b).then(H=>mt=H);let Ht=yn(b.numberOfInputs,b.channelCount),De=yn(b.numberOfOutputs,x),ke=g.parameterDescriptors===void 0?[]:g.parameterDescriptors.reduce((H,{name:at})=>Q(O({},H),{[at]:new Float32Array(128)}),{}),Ot=!0,ut=()=>{b.numberOfOutputs>0&&M.disconnect(R);for(let H=0,at=0;H<b.numberOfOutputs;H+=1){let ie=B[H];for(let Bt=0;Bt<x[H];Bt+=1)R.disconnect(ie,at+Bt,Bt);at+=x[H]}},Ki=new Map;M.onaudioprocess=({inputBuffer:H,outputBuffer:at})=>{if(mt!==null){let ie=l(K);for(let Bt=0;Bt<q;Bt+=128){for(let It=0;It<b.numberOfInputs;It+=1)for(let Wt=0;Wt<b.channelCount;Wt+=1)gn(H,Ht[It],Wt,Wt,Bt);g.parameterDescriptors!==void 0&&g.parameterDescriptors.forEach(({name:It},Wt)=>{gn(H,ke,It,C+Wt,Bt)});for(let It=0;It<b.numberOfInputs;It+=1)for(let Wt=0;Wt<x[It];Wt+=1)De[It][Wt].byteLength===0&&(De[It][Wt]=new Float32Array(128));try{let It=Ht.map((qe,Xr)=>{if(ie[Xr].size>0)return Ki.set(Xr,q/128),qe;let Qc=Ki.get(Xr);return Qc===void 0?[]:(qe.every(gg=>gg.every(yg=>yg===0))&&(Qc===1?Ki.delete(Xr):Ki.set(Xr,Qc-1)),qe)});Ot=h(m.currentTime+Bt/m.sampleRate,m.sampleRate,()=>mt.process(It,De,ke));for(let qe=0,Xr=0;qe<b.numberOfOutputs;qe+=1){for(let io=0;io<x[qe];io+=1)ua(at,De[qe],io,Xr+io,Bt);Xr+=x[qe]}}catch(It){Ot=!1,K.dispatchEvent(new ErrorEvent("processorerror",{colno:It.colno,filename:It.filename,lineno:It.lineno,message:It.message}))}if(!Ot){for(let It=0;It<b.numberOfInputs;It+=1){v[It].disconnect(A[It]);for(let Wt=0;Wt<b.channelCount;Wt+=1)A[Bt].disconnect(E,Wt,It*b.channelCount+Wt)}if(g.parameterDescriptors!==void 0){let It=g.parameterDescriptors.length;for(let Wt=0;Wt<It;Wt+=1){let qe=_[Wt];qe.disconnect(E,0,C+Wt),qe.stop()}}E.disconnect(M),M.onaudioprocess=null,to?ut():tn();break}}}};let to=!1,et=s(m,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),Ji=()=>M.connect(et).connect(m.destination),tn=()=>{M.disconnect(et),et.disconnect()},eo=()=>{if(Ot){tn(),b.numberOfOutputs>0&&M.connect(R);for(let H=0,at=0;H<b.numberOfOutputs;H+=1){let ie=B[H];for(let Bt=0;Bt<x[H];Bt+=1)R.connect(ie,at+Bt,Bt);at+=x[H]}}to=!0},ro=()=>{Ot&&(Ji(),ut()),to=!1};return Ji(),p(K,eo,ro)};var Vu=(i,t)=>{let e=i.createBiquadFilter();return gt(e,t),Tt(e,t,"Q"),Tt(e,t,"detune"),Tt(e,t,"frequency"),Tt(e,t,"gain"),St(e,t,"type"),e};var Hp=(i,t)=>(e,r)=>{let n=e.createChannelMerger(r.numberOfInputs);return i!==null&&i.name==="webkitAudioContext"&&t(e,n),gt(n,r),n};var $p=i=>{let t=i.numberOfOutputs;Object.defineProperty(i,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw Ft()}}),Object.defineProperty(i,"channelCountMode",{get:()=>"explicit",set:e=>{if(e!=="explicit")throw Ft()}}),Object.defineProperty(i,"channelInterpretation",{get:()=>"discrete",set:e=>{if(e!=="discrete")throw Ft()}})};var Cn=(i,t)=>{let e=i.createChannelSplitter(t.numberOfOutputs);return gt(e,t),$p(e),e};var Zp=(i,t,e,r,n)=>(o,s)=>{if(o.createConstantSource===void 0)return e(o,s);let a=o.createConstantSource();return gt(a,s),Tt(a,s,"offset"),t(r,()=>r(o))||xn(a),t(n,()=>n(o))||An(a),i(o,a),a};var He=(i,t)=>(i.connect=t.connect.bind(t),i.disconnect=t.disconnect.bind(t),i);var Xp=(i,t,e,r)=>(n,a)=>{var c=a,{offset:o}=c,s=Qr(c,["offset"]);let u=n.createBuffer(1,2,44100),h=t(n,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),l=e(n,Q(O({},s),{gain:o})),p=u.getChannelData(0);p[0]=1,p[1]=1,h.buffer=u,h.loop=!0;let m={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(b){l.channelCount=b},get channelCountMode(){return l.channelCountMode},set channelCountMode(b){l.channelCountMode=b},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(b){l.channelInterpretation=b},get context(){return l.context},get inputs(){return[]},get numberOfInputs(){return h.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get offset(){return l.gain},get onended(){return h.onended},set onended(b){h.onended=b},addEventListener(...b){return h.addEventListener(b[0],b[1],b[2])},dispatchEvent(...b){return h.dispatchEvent(b[0])},removeEventListener(...b){return h.removeEventListener(b[0],b[1],b[2])},start(b=0){h.start.call(h,b)},stop(b=0){h.stop.call(h,b)}},f=()=>h.connect(l),g=()=>h.disconnect(l);return i(n,h),r(He(m,l),f,g)};var Qp=(i,t)=>(e,r)=>{let n=e.createConvolver();if(gt(n,r),r.disableNormalization===n.normalize&&(n.normalize=!r.disableNormalization),St(n,r,"buffer"),r.channelCount>2||(t(n,"channelCount",o=>()=>o.call(n),o=>s=>{if(s>2)throw i();return o.call(n,s)}),r.channelCountMode==="max"))throw i();return t(n,"channelCountMode",o=>()=>o.call(n),o=>s=>{if(s==="max")throw i();return o.call(n,s)}),n};var qu=(i,t)=>{let e=i.createDelay(t.maxDelayTime);return gt(e,t),Tt(e,t,"delayTime"),e};var Kp=i=>(t,e)=>{let r=t.createDynamicsCompressor();if(gt(r,e),e.channelCount>2||e.channelCountMode==="max")throw i();return Tt(r,e,"attack"),Tt(r,e,"knee"),Tt(r,e,"ratio"),Tt(r,e,"release"),Tt(r,e,"threshold"),r};var Ae=(i,t)=>{let e=i.createGain();return gt(e,t),Tt(e,t,"gain"),e};var Jp=i=>(t,e,r)=>{if(t.createIIRFilter===void 0)return i(t,e,r);let n=t.createIIRFilter(r.feedforward,r.feedback);return gt(n,r),n};function FC(i,t){let e=t[0]*t[0]+t[1]*t[1];return[(i[0]*t[0]+i[1]*t[1])/e,(i[1]*t[0]-i[0]*t[1])/e]}function BC(i,t){return[i[0]*t[0]-i[1]*t[1],i[0]*t[1]+i[1]*t[0]]}function tm(i,t){let e=[0,0];for(let r=i.length-1;r>=0;r-=1)e=BC(e,t),e[0]+=i[r];return e}var em=(i,t,e,r)=>(n,o,{channelCount:s,channelCountMode:a,channelInterpretation:c,feedback:u,feedforward:h})=>{let l=da(o,n.sampleRate),p=u instanceof Float64Array?u:new Float64Array(u),m=h instanceof Float64Array?h:new Float64Array(h),f=p.length,g=m.length,b=Math.min(f,g);if(f===0||f>20)throw r();if(p[0]===0)throw t();if(g===0||g>20)throw r();if(m[0]===0)throw t();if(p[0]!==1){for(let _=0;_<g;_+=1)m[_]/=p[0];for(let _=1;_<f;_+=1)p[_]/=p[0]}let x=e(n,l,s,s);x.channelCount=s,x.channelCountMode=a,x.channelInterpretation=c;let C=32,S=[],T=[],w=[];for(let _=0;_<s;_+=1){S.push(0);let E=new Float32Array(C),q=new Float32Array(C);E.fill(0),q.fill(0),T.push(E),w.push(q)}x.onaudioprocess=_=>{let E=_.inputBuffer,q=_.outputBuffer,M=E.numberOfChannels;for(let R=0;R<M;R+=1){let B=E.getChannelData(R),D=q.getChannelData(R);S[R]=la(p,f,m,g,b,T[R],w[R],S[R],C,B,D)}};let v=n.sampleRate/2;return He({get bufferSize(){return l},get channelCount(){return x.channelCount},set channelCount(_){x.channelCount=_},get channelCountMode(){return x.channelCountMode},set channelCountMode(_){x.channelCountMode=_},get channelInterpretation(){return x.channelInterpretation},set channelInterpretation(_){x.channelInterpretation=_},get context(){return x.context},get inputs(){return[x]},get numberOfInputs(){return x.numberOfInputs},get numberOfOutputs(){return x.numberOfOutputs},addEventListener(..._){return x.addEventListener(_[0],_[1],_[2])},dispatchEvent(..._){return x.dispatchEvent(_[0])},getFrequencyResponse(_,E,q){if(_.length!==E.length||E.length!==q.length)throw i();let M=_.length;for(let R=0;R<M;R+=1){let B=-Math.PI*(_[R]/v),D=[Math.cos(B),Math.sin(B)],j=tm(m,D),F=tm(p,D),W=FC(j,F);E[R]=Math.sqrt(W[0]*W[0]+W[1]*W[1]),q[R]=Math.atan2(W[1],W[0])}},removeEventListener(..._){return x.removeEventListener(_[0],_[1],_[2])}},x)};var rm=(i,t)=>i.createMediaElementSource(t.mediaElement);var im=(i,t)=>{let e=i.createMediaStreamDestination();return gt(e,t),e.numberOfOutputs===1&&Object.defineProperty(e,"numberOfOutputs",{get:()=>0}),e};var nm=(i,{mediaStream:t})=>{let e=t.getAudioTracks();e.sort((o,s)=>o.id<s.id?-1:o.id>s.id?1:0);let r=e.slice(0,1),n=i.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(n,"mediaStream",{value:t}),n};var om=(i,t)=>(e,{mediaStreamTrack:r})=>{if(typeof e.createMediaStreamTrackSource=="function")return e.createMediaStreamTrackSource(r);let n=new MediaStream([r]),o=e.createMediaStreamSource(n);if(r.kind!=="audio")throw i();if(t(e))throw new TypeError;return o};var sm=i=>i===null?null:i.hasOwnProperty("OfflineAudioContext")?i.OfflineAudioContext:i.hasOwnProperty("webkitOfflineAudioContext")?i.webkitOfflineAudioContext:null;var am=(i,t,e,r,n,o)=>(s,a)=>{let c=s.createOscillator();return gt(c,a),Tt(c,a,"detune"),Tt(c,a,"frequency"),a.periodicWave!==void 0?c.setPeriodicWave(a.periodicWave):St(c,a,"type"),t(e,()=>e(s))||xn(c),t(r,()=>r(s))||o(c,s),t(n,()=>n(s))||An(c),i(s,c),c};var cm=i=>(t,e)=>{let r=t.createPanner();return r.orientationX===void 0?i(t,e):(gt(r,e),Tt(r,e,"orientationX"),Tt(r,e,"orientationY"),Tt(r,e,"orientationZ"),Tt(r,e,"positionX"),Tt(r,e,"positionY"),Tt(r,e,"positionZ"),St(r,e,"coneInnerAngle"),St(r,e,"coneOuterAngle"),St(r,e,"coneOuterGain"),St(r,e,"distanceModel"),St(r,e,"maxDistance"),St(r,e,"panningModel"),St(r,e,"refDistance"),St(r,e,"rolloffFactor"),r)};var um=(i,t,e,r,n,o,s,a,c,u)=>(h,q)=>{var M=q,{coneInnerAngle:l,coneOuterAngle:p,coneOuterGain:m,distanceModel:f,maxDistance:g,orientationX:b,orientationY:x,orientationZ:C,panningModel:S,positionX:T,positionY:w,positionZ:v,refDistance:A,rolloffFactor:_}=M,E=Qr(M,["coneInnerAngle","coneOuterAngle","coneOuterGain","distanceModel","maxDistance","orientationX","orientationY","orientationZ","panningModel","positionX","positionY","positionZ","refDistance","rolloffFactor"]);let R=h.createPanner();if(E.channelCount>2||E.channelCountMode==="max")throw s();gt(R,E);let B={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},D=e(h,Q(O({},B),{channelInterpretation:"speakers",numberOfInputs:6})),j=r(h,Q(O({},E),{gain:1})),F=r(h,Q(O({},B),{gain:1})),W=r(h,Q(O({},B),{gain:0})),K=r(h,Q(O({},B),{gain:0})),k=r(h,Q(O({},B),{gain:0})),nt=r(h,Q(O({},B),{gain:0})),mt=r(h,Q(O({},B),{gain:0})),Ct=n(h,256,6,1),Ht=o(h,Q(O({},B),{curve:new Float32Array([1,1]),oversample:"none"})),De=[b,x,C],ke=[T,w,v],Ot=new Float32Array(1);Ct.onaudioprocess=({inputBuffer:et})=>{let Ji=[c(et,Ot,0),c(et,Ot,1),c(et,Ot,2)];Ji.some((eo,ro)=>eo!==De[ro])&&(R.setOrientation(...Ji),De=Ji);let tn=[c(et,Ot,3),c(et,Ot,4),c(et,Ot,5)];tn.some((eo,ro)=>eo!==ke[ro])&&(R.setPosition(...tn),ke=tn)},Object.defineProperty(W.gain,"defaultValue",{get:()=>0}),Object.defineProperty(K.gain,"defaultValue",{get:()=>0}),Object.defineProperty(k.gain,"defaultValue",{get:()=>0}),Object.defineProperty(nt.gain,"defaultValue",{get:()=>0}),Object.defineProperty(mt.gain,"defaultValue",{get:()=>0});let ut={get bufferSize(){},get channelCount(){return R.channelCount},set channelCount(et){if(et>2)throw s();j.channelCount=et,R.channelCount=et},get channelCountMode(){return R.channelCountMode},set channelCountMode(et){if(et==="max")throw s();j.channelCountMode=et,R.channelCountMode=et},get channelInterpretation(){return R.channelInterpretation},set channelInterpretation(et){j.channelInterpretation=et,R.channelInterpretation=et},get coneInnerAngle(){return R.coneInnerAngle},set coneInnerAngle(et){R.coneInnerAngle=et},get coneOuterAngle(){return R.coneOuterAngle},set coneOuterAngle(et){R.coneOuterAngle=et},get coneOuterGain(){return R.coneOuterGain},set coneOuterGain(et){if(et<0||et>1)throw t();R.coneOuterGain=et},get context(){return R.context},get distanceModel(){return R.distanceModel},set distanceModel(et){R.distanceModel=et},get inputs(){return[j]},get maxDistance(){return R.maxDistance},set maxDistance(et){if(et<0)throw new RangeError;R.maxDistance=et},get numberOfInputs(){return R.numberOfInputs},get numberOfOutputs(){return R.numberOfOutputs},get orientationX(){return F.gain},get orientationY(){return W.gain},get orientationZ(){return K.gain},get panningModel(){return R.panningModel},set panningModel(et){R.panningModel=et},get positionX(){return k.gain},get positionY(){return nt.gain},get positionZ(){return mt.gain},get refDistance(){return R.refDistance},set refDistance(et){if(et<0)throw new RangeError;R.refDistance=et},get rolloffFactor(){return R.rolloffFactor},set rolloffFactor(et){if(et<0)throw new RangeError;R.rolloffFactor=et},addEventListener(...et){return j.addEventListener(et[0],et[1],et[2])},dispatchEvent(...et){return j.dispatchEvent(et[0])},removeEventListener(...et){return j.removeEventListener(et[0],et[1],et[2])}};l!==ut.coneInnerAngle&&(ut.coneInnerAngle=l),p!==ut.coneOuterAngle&&(ut.coneOuterAngle=p),m!==ut.coneOuterGain&&(ut.coneOuterGain=m),f!==ut.distanceModel&&(ut.distanceModel=f),g!==ut.maxDistance&&(ut.maxDistance=g),b!==ut.orientationX.value&&(ut.orientationX.value=b),x!==ut.orientationY.value&&(ut.orientationY.value=x),C!==ut.orientationZ.value&&(ut.orientationZ.value=C),S!==ut.panningModel&&(ut.panningModel=S),T!==ut.positionX.value&&(ut.positionX.value=T),w!==ut.positionY.value&&(ut.positionY.value=w),v!==ut.positionZ.value&&(ut.positionZ.value=v),A!==ut.refDistance&&(ut.refDistance=A),_!==ut.rolloffFactor&&(ut.rolloffFactor=_),(De[0]!==1||De[1]!==0||De[2]!==0)&&R.setOrientation(...De),(ke[0]!==0||ke[1]!==0||ke[2]!==0)&&R.setPosition(...ke);let Ki=()=>{j.connect(R),i(j,Ht,0,0),Ht.connect(F).connect(D,0,0),Ht.connect(W).connect(D,0,1),Ht.connect(K).connect(D,0,2),Ht.connect(k).connect(D,0,3),Ht.connect(nt).connect(D,0,4),Ht.connect(mt).connect(D,0,5),D.connect(Ct).connect(h.destination)},to=()=>{j.disconnect(R),a(j,Ht,0,0),Ht.disconnect(F),F.disconnect(D),Ht.disconnect(W),W.disconnect(D),Ht.disconnect(K),K.disconnect(D),Ht.disconnect(k),k.disconnect(D),Ht.disconnect(nt),nt.disconnect(D),Ht.disconnect(mt),mt.disconnect(D),D.disconnect(Ct),Ct.disconnect(h.destination)};return u(He(ut,R),Ki,to)};var hm=i=>(t,{disableNormalization:e,imag:r,real:n})=>{let o=r instanceof Float32Array?r:new Float32Array(r),s=n instanceof Float32Array?n:new Float32Array(n),a=t.createPeriodicWave(s,o,{disableNormalization:e});if(Array.from(r).length<2)throw i();return a};var _n=(i,t,e,r)=>i.createScriptProcessor(t,e,r);var lm=(i,t)=>(e,r)=>{let n=r.channelCountMode;if(n==="clamped-max")throw t();if(e.createStereoPanner===void 0)return i(e,r);let o=e.createStereoPanner();return gt(o,r),Tt(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>n,set:s=>{if(s!==n)throw t()}}),o};var dm=(i,t,e,r,n,o)=>{let a=new Float32Array([1,1]),c=Math.PI/2,u={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},h=Q(O({},u),{oversample:"none"}),l=(f,g,b,x)=>{let C=new Float32Array(16385),S=new Float32Array(16385);for(let E=0;E<16385;E+=1){let q=E/16384*c;C[E]=Math.cos(q),S[E]=Math.sin(q)}let T=e(f,Q(O({},u),{gain:0})),w=r(f,Q(O({},h),{curve:C})),v=r(f,Q(O({},h),{curve:a})),A=e(f,Q(O({},u),{gain:0})),_=r(f,Q(O({},h),{curve:S}));return{connectGraph(){g.connect(T),g.connect(v.inputs===void 0?v:v.inputs[0]),g.connect(A),v.connect(b),b.connect(w.inputs===void 0?w:w.inputs[0]),b.connect(_.inputs===void 0?_:_.inputs[0]),w.connect(T.gain),_.connect(A.gain),T.connect(x,0,0),A.connect(x,0,1)},disconnectGraph(){g.disconnect(T),g.disconnect(v.inputs===void 0?v:v.inputs[0]),g.disconnect(A),v.disconnect(b),b.disconnect(w.inputs===void 0?w:w.inputs[0]),b.disconnect(_.inputs===void 0?_:_.inputs[0]),w.disconnect(T.gain),_.disconnect(A.gain),T.disconnect(x,0,0),A.disconnect(x,0,1)}}},p=(f,g,b,x)=>{let C=new Float32Array(16385),S=new Float32Array(16385),T=new Float32Array(16385),w=new Float32Array(16385),v=Math.floor(16385/2);for(let W=0;W<16385;W+=1)if(W>v){let K=(W-v)/(16384-v)*c;C[W]=Math.cos(K),S[W]=Math.sin(K),T[W]=0,w[W]=1}else{let K=W/(16384-v)*c;C[W]=1,S[W]=0,T[W]=Math.cos(K),w[W]=Math.sin(K)}let A=t(f,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),_=e(f,Q(O({},u),{gain:0})),E=r(f,Q(O({},h),{curve:C})),q=e(f,Q(O({},u),{gain:0})),M=r(f,Q(O({},h),{curve:S})),R=r(f,Q(O({},h),{curve:a})),B=e(f,Q(O({},u),{gain:0})),D=r(f,Q(O({},h),{curve:T})),j=e(f,Q(O({},u),{gain:0})),F=r(f,Q(O({},h),{curve:w}));return{connectGraph(){g.connect(A),g.connect(R.inputs===void 0?R:R.inputs[0]),A.connect(_,0),A.connect(q,0),A.connect(B,1),A.connect(j,1),R.connect(b),b.connect(E.inputs===void 0?E:E.inputs[0]),b.connect(M.inputs===void 0?M:M.inputs[0]),b.connect(D.inputs===void 0?D:D.inputs[0]),b.connect(F.inputs===void 0?F:F.inputs[0]),E.connect(_.gain),M.connect(q.gain),D.connect(B.gain),F.connect(j.gain),_.connect(x,0,0),B.connect(x,0,0),q.connect(x,0,1),j.connect(x,0,1)},disconnectGraph(){g.disconnect(A),g.disconnect(R.inputs===void 0?R:R.inputs[0]),A.disconnect(_,0),A.disconnect(q,0),A.disconnect(B,1),A.disconnect(j,1),R.disconnect(b),b.disconnect(E.inputs===void 0?E:E.inputs[0]),b.disconnect(M.inputs===void 0?M:M.inputs[0]),b.disconnect(D.inputs===void 0?D:D.inputs[0]),b.disconnect(F.inputs===void 0?F:F.inputs[0]),E.disconnect(_.gain),M.disconnect(q.gain),D.disconnect(B.gain),F.disconnect(j.gain),_.disconnect(x,0,0),B.disconnect(x,0,0),q.disconnect(x,0,1),j.disconnect(x,0,1)}}},m=(f,g,b,x,C)=>{if(g===1)return l(f,b,x,C);if(g===2)return p(f,b,x,C);throw n()};return(f,S)=>{var T=S,{channelCount:g,channelCountMode:b,pan:x}=T,C=Qr(T,["channelCount","channelCountMode","pan"]);if(b==="max")throw n();let w=i(f,Q(O({},C),{channelCount:1,channelCountMode:b,numberOfInputs:2})),v=e(f,Q(O({},C),{channelCount:g,channelCountMode:b,gain:1})),A=e(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:x}),{connectGraph:_,disconnectGraph:E}=m(f,g,v,A,w);Object.defineProperty(A.gain,"defaultValue",{get:()=>0}),Object.defineProperty(A.gain,"maxValue",{get:()=>1}),Object.defineProperty(A.gain,"minValue",{get:()=>-1});let q={get bufferSize(){},get channelCount(){return v.channelCount},set channelCount(D){v.channelCount!==D&&(M&&E(),{connectGraph:_,disconnectGraph:E}=m(f,D,v,A,w),M&&_()),v.channelCount=D},get channelCountMode(){return v.channelCountMode},set channelCountMode(D){if(D==="clamped-max"||D==="max")throw n();v.channelCountMode=D},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(D){v.channelInterpretation=D},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},get pan(){return A.gain},addEventListener(...D){return v.addEventListener(D[0],D[1],D[2])},dispatchEvent(...D){return v.dispatchEvent(D[0])},removeEventListener(...D){return v.removeEventListener(D[0],D[1],D[2])}},M=!1,R=()=>{_(),M=!0},B=()=>{E(),M=!1};return o(He(q,w),R,B)}};var pm=(i,t,e,r,n,o,s)=>(a,c)=>{let u=a.createWaveShaper();if(o!==null&&o.name==="webkitAudioContext"&&a.createGain().gain.automationRate===void 0)return e(a,c);gt(u,c);let h=c.curve===null||c.curve instanceof Float32Array?c.curve:new Float32Array(c.curve);if(h!==null&&h.length<2)throw t();St(u,{curve:h},"curve"),St(u,c,"oversample");let l=null,p=!1;return s(u,"curve",g=>()=>g.call(u),g=>b=>(g.call(u,b),p&&(r(b)&&l===null?l=i(a,u):!r(b)&&l!==null&&(l(),l=null)),b)),n(u,()=>{p=!0,r(u.curve)&&(l=i(a,u))},()=>{p=!1,l!==null&&(l(),l=null)})};var mm=(i,t,e,r,n)=>(o,u)=>{var h=u,{curve:s,oversample:a}=h,c=Qr(h,["curve","oversample"]);let l=o.createWaveShaper(),p=o.createWaveShaper();gt(l,c),gt(p,c);let m=e(o,Q(O({},c),{gain:1})),f=e(o,Q(O({},c),{gain:-1})),g=e(o,Q(O({},c),{gain:1})),b=e(o,Q(O({},c),{gain:-1})),x=null,C=!1,S=null,T={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(A){m.channelCount=A,f.channelCount=A,l.channelCount=A,g.channelCount=A,p.channelCount=A,b.channelCount=A},get channelCountMode(){return l.channelCountMode},set channelCountMode(A){m.channelCountMode=A,f.channelCountMode=A,l.channelCountMode=A,g.channelCountMode=A,p.channelCountMode=A,b.channelCountMode=A},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(A){m.channelInterpretation=A,f.channelInterpretation=A,l.channelInterpretation=A,g.channelInterpretation=A,p.channelInterpretation=A,b.channelInterpretation=A},get context(){return l.context},get curve(){return S},set curve(A){if(A!==null&&A.length<2)throw t();if(A===null)l.curve=A,p.curve=A;else{let _=A.length,E=new Float32Array(_+2-_%2),q=new Float32Array(_+2-_%2);E[0]=A[0],q[0]=-A[_-1];let M=Math.ceil((_+1)/2),R=(_+1)/2-1;for(let B=1;B<M;B+=1){let D=B/M*R,j=Math.floor(D),F=Math.ceil(D);E[B]=j===F?A[j]:(1-(D-j))*A[j]+(1-(F-D))*A[F],q[B]=j===F?-A[_-1-j]:-((1-(D-j))*A[_-1-j])-(1-(F-D))*A[_-1-F]}E[M]=_%2===1?A[M-1]:(A[M-2]+A[M-1])/2,l.curve=E,p.curve=q}S=A,C&&(r(S)&&x===null?x=i(o,m):x!==null&&(x(),x=null))},get inputs(){return[m]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get oversample(){return l.oversample},set oversample(A){l.oversample=A,p.oversample=A},addEventListener(...A){return m.addEventListener(A[0],A[1],A[2])},dispatchEvent(...A){return m.dispatchEvent(A[0])},removeEventListener(...A){return m.removeEventListener(A[0],A[1],A[2])}};s!==null&&(T.curve=s instanceof Float32Array?s:new Float32Array(s)),a!==T.oversample&&(T.oversample=a);let w=()=>{m.connect(l).connect(g),m.connect(f).connect(p).connect(b).connect(g),C=!0,r(S)&&(x=i(o,m))},v=()=>{m.disconnect(l),l.disconnect(g),m.disconnect(f),f.disconnect(p),p.disconnect(b),b.disconnect(g),C=!1,x!==null&&(x(),x=null)};return n(He(T,g),w,v)};var ue=()=>new DOMException("","NotSupportedError");var GC={numberOfChannels:1},fm=(i,t,e,r,n)=>class extends i{constructor(s,a,c){let u;if(typeof s=="number"&&a!==void 0&&c!==void 0)u={length:a,numberOfChannels:s,sampleRate:c};else if(typeof s=="object")u=s;else throw new Error("The given parameters are not valid.");let{length:h,numberOfChannels:l,sampleRate:p}=O(O({},GC),u),m=r(l,h,p);t(cr,()=>cr(m))||m.addEventListener("statechange",(()=>{let f=0,g=b=>{this._state==="running"&&(f>0?(m.removeEventListener("statechange",g),b.stopImmediatePropagation(),this._waitForThePromiseToSettle(b)):f+=1)};return g})()),super(m,l),this._length=h,this._nativeOfflineAudioContext=m,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(e()):(this._state="running",n(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,si(this)}))}_waitForThePromiseToSettle(s){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(s):setTimeout(()=>this._waitForThePromiseToSettle(s))}};var VC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},gm=(i,t,e,r,n,o,s)=>class extends i{constructor(c,u){let h=n(c),l=O(O({},VC),u),p=e(h,l),m=o(h),f=m?r():null,g=c.sampleRate/2;super(c,!1,p,f),this._detune=t(this,m,p.detune,153600,-153600),this._frequency=t(this,m,p.frequency,g,-g),this._nativeOscillatorNode=p,this._onended=null,this._oscillatorNodeRenderer=f,this._oscillatorNodeRenderer!==null&&l.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=l.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(c){let u=typeof c=="function"?s(this,c):null;this._nativeOscillatorNode.onended=u;let h=this._nativeOscillatorNode.onended;this._onended=h!==null&&h===u?c:h}get type(){return this._nativeOscillatorNode.type}set type(c){this._nativeOscillatorNode.type=c,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(c){this._nativeOscillatorNode.setPeriodicWave(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=c)}start(c=0){if(this._nativeOscillatorNode.start(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=c),this.context.state!=="closed"){sr(this);let u=()=>{this._nativeOscillatorNode.removeEventListener("ended",u),xe(this)&&Ir(this)};this._nativeOscillatorNode.addEventListener("ended",u)}}stop(c=0){this._nativeOscillatorNode.stop(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=c)}};var ym=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=null,a=null,c=null,u=(h,l)=>J(null,null,function*(){let p=e(h),m=vt(p,l);if(!m){let f={channelCount:p.channelCount,channelCountMode:p.channelCountMode,channelInterpretation:p.channelInterpretation,detune:p.detune.value,frequency:p.frequency.value,periodicWave:s===null?void 0:s,type:p.type};p=t(l,f),a!==null&&p.start(a),c!==null&&p.stop(c)}return o.set(l,p),m?(yield i(l,h.detune,p.detune),yield i(l,h.frequency,p.frequency)):(yield r(l,h.detune,p.detune),yield r(l,h.frequency,p.frequency)),yield n(h,l,p),p});return{set periodicWave(h){s=h},set start(h){a=h},set stop(h){c=h},render(h,l){let p=o.get(l);return p!==void 0?Promise.resolve(p):u(h,l)}}};var qC={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},bm=(i,t,e,r,n,o,s)=>class extends i{constructor(c,u){let h=n(c),l=O(O({},qC),u),p=e(h,l),m=o(h),f=m?r():null;super(c,!1,p,f),this._nativePannerNode=p,this._orientationX=t(this,m,p.orientationX,Ut,$t),this._orientationY=t(this,m,p.orientationY,Ut,$t),this._orientationZ=t(this,m,p.orientationZ,Ut,$t),this._positionX=t(this,m,p.positionX,Ut,$t),this._positionY=t(this,m,p.positionY,Ut,$t),this._positionZ=t(this,m,p.positionZ,Ut,$t),s(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(c){this._nativePannerNode.coneInnerAngle=c}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(c){this._nativePannerNode.coneOuterAngle=c}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(c){this._nativePannerNode.coneOuterGain=c}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(c){this._nativePannerNode.distanceModel=c}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(c){this._nativePannerNode.maxDistance=c}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(c){this._nativePannerNode.panningModel=c}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(c){this._nativePannerNode.refDistance=c}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(c){this._nativePannerNode.rolloffFactor=c}};var xm=(i,t,e,r,n,o,s,a,c,u)=>()=>{let h=new WeakMap,l=null,p=(m,f)=>J(null,null,function*(){let g=null,b=o(m),x={channelCount:b.channelCount,channelCountMode:b.channelCountMode,channelInterpretation:b.channelInterpretation},C=Q(O({},x),{coneInnerAngle:b.coneInnerAngle,coneOuterAngle:b.coneOuterAngle,coneOuterGain:b.coneOuterGain,distanceModel:b.distanceModel,maxDistance:b.maxDistance,panningModel:b.panningModel,refDistance:b.refDistance,rolloffFactor:b.rolloffFactor}),S=vt(b,f);if("bufferSize"in b)g=r(f,Q(O({},x),{gain:1}));else if(!S){let T=Q(O({},C),{orientationX:b.orientationX.value,orientationY:b.orientationY.value,orientationZ:b.orientationZ.value,positionX:b.positionX.value,positionY:b.positionY.value,positionZ:b.positionZ.value});b=n(f,T)}if(h.set(f,g===null?b:g),g!==null){if(l===null){if(s===null)throw new Error("Missing the native OfflineAudioContext constructor.");let M=new s(6,m.context.length,f.sampleRate),R=t(M,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});R.connect(M.destination),l=J(null,null,function*(){let B=yield Promise.all([m.orientationX,m.orientationY,m.orientationZ,m.positionX,m.positionY,m.positionZ].map((D,j)=>J(null,null,function*(){let F=e(M,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:j===0?1:0});return yield a(M,D,F.offset),F})));for(let D=0;D<6;D+=1)B[D].connect(R,0,D),B[D].start(0);return u(M)})}let T=yield l,w=r(f,Q(O({},x),{gain:1}));yield c(m,f,w);let v=[];for(let M=0;M<T.numberOfChannels;M+=1)v.push(T.getChannelData(M));let A=[v[0][0],v[1][0],v[2][0]],_=[v[3][0],v[4][0],v[5][0]],E=r(f,Q(O({},x),{gain:1})),q=n(f,Q(O({},C),{orientationX:A[0],orientationY:A[1],orientationZ:A[2],positionX:_[0],positionY:_[1],positionZ:_[2]}));w.connect(E).connect(q.inputs[0]),q.connect(g);for(let M=128;M<T.length;M+=128){let R=[v[0][M],v[1][M],v[2][M]],B=[v[3][M],v[4][M],v[5][M]];if(R.some((D,j)=>D!==A[j])||B.some((D,j)=>D!==_[j])){A=R,_=B;let D=M/f.sampleRate;E.gain.setValueAtTime(0,D),E=r(f,Q(O({},x),{gain:0})),q=n(f,Q(O({},C),{orientationX:A[0],orientationY:A[1],orientationZ:A[2],positionX:_[0],positionY:_[1],positionZ:_[2]})),E.gain.setValueAtTime(1,D),w.connect(E).connect(q.inputs[0]),q.connect(g)}}return g}return S?(yield i(f,m.orientationX,b.orientationX),yield i(f,m.orientationY,b.orientationY),yield i(f,m.orientationZ,b.orientationZ),yield i(f,m.positionX,b.positionX),yield i(f,m.positionY,b.positionY),yield i(f,m.positionZ,b.positionZ)):(yield a(f,m.orientationX,b.orientationX),yield a(f,m.orientationY,b.orientationY),yield a(f,m.orientationZ,b.orientationZ),yield a(f,m.positionX,b.positionX),yield a(f,m.positionY,b.positionY),yield a(f,m.positionZ,b.positionZ)),Ye(b)?yield c(m,f,b.inputs[0]):yield c(m,f,b),b});return{render(m,f){let g=h.get(f);return g!==void 0?Promise.resolve(g):p(m,f)}}};var WC={disableNormalization:!1},Am=(i,t,e,r)=>class Cm{constructor(o,s){let a=t(o),c=r(O(O({},WC),s)),u=i(a,c);return e.add(u),u}static[Symbol.hasInstance](o){return o!==null&&typeof o=="object"&&Object.getPrototypeOf(o)===Cm.prototype||e.has(o)}};var _m=(i,t)=>(e,r,n)=>(i(r).replay(n),t(r,e,n));var vm=(i,t,e)=>(r,n,o)=>J(null,null,function*(){let s=i(r);yield Promise.all(s.activeInputs.map((a,c)=>Array.from(a).map(l=>J(null,[l],function*([u,h]){let m=yield t(u).render(u,n),f=r.context.destination;!e(u)&&(r!==f||!e(r))&&m.connect(o,h,c)}))).reduce((a,c)=>[...a,...c],[]))});var Sm=(i,t,e)=>(r,n,o)=>J(null,null,function*(){let s=t(r);yield Promise.all(Array.from(s.activeInputs).map(u=>J(null,[u],function*([a,c]){let l=yield i(a).render(a,n);e(a)||l.connect(o,c)})))});var wm=(i,t,e,r)=>n=>i(cr,()=>cr(n))?Promise.resolve(i(r,r)).then(o=>{if(!o){let s=e(n,512,0,1);n.oncomplete=()=>{s.onaudioprocess=null,s.disconnect()},s.onaudioprocess=()=>n.currentTime,s.connect(n.destination)}return n.startRendering()}):new Promise(o=>{let s=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.oncomplete=a=>{s.disconnect(),o(a.renderedBuffer)},s.connect(n.destination),n.startRendering()});var Im=i=>(t,e)=>{i.set(t,e)};var Tm=i=>(t,e)=>i.set(t,e);var Nm=(i,t,e,r,n,o,s,a)=>(c,u)=>e(c).render(c,u).then(()=>Promise.all(Array.from(r(u)).map(h=>e(h).render(h,u)))).then(()=>n(u)).then(h=>(typeof h.copyFromChannel!="function"?(s(h),ln(h)):t(o,()=>o(h))||a(h),i.add(h),h));var UC={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Om=(i,t,e,r,n,o)=>class extends i{constructor(a,c){let u=n(a),h=O(O({},UC),c),l=e(u,h),p=o(u),m=p?r():null;super(a,!1,l,m),this._pan=t(this,p,l.pan)}get pan(){return this._pan}};var Rm=(i,t,e,r,n)=>()=>{let o=new WeakMap,s=(a,c)=>J(null,null,function*(){let u=e(a),h=vt(u,c);if(!h){let l={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=t(c,l)}return o.set(c,u),h?yield i(c,a.pan,u.pan):yield r(c,a.pan,u.pan),Ye(u)?yield n(a,c,u.inputs[0]):yield n(a,c,u),u});return{render(a,c){let u=o.get(c);return u!==void 0?Promise.resolve(u):s(a,c)}}};var Mm=i=>()=>{if(i===null)return!1;try{new i({length:1,sampleRate:44100})}catch(t){return!1}return!0};var Em=(i,t)=>()=>J(null,null,function*(){if(i===null)return!0;if(t===null)return!1;let e=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new t(1,128,44100),n=URL.createObjectURL(e),o=!1,s=!1;try{yield r.audioWorklet.addModule(n);let a=new i(r,"a",{numberOfOutputs:0}),c=r.createOscillator();a.port.onmessage=()=>o=!0,a.onprocessorerror=()=>s=!0,c.connect(a),c.start(0),yield r.startRendering(),yield new Promise(u=>setTimeout(u))}catch(a){}finally{URL.revokeObjectURL(n)}return o&&!s});var Dm=(i,t)=>()=>{if(t===null)return Promise.resolve(!1);let e=new t(1,1,44100),r=i(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(n=>{e.oncomplete=()=>{r.disconnect(),n(e.currentTime!==0)},e.startRendering()})};var Wu=()=>new DOMException("","UnknownError");var zC={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},km=(i,t,e,r,n,o,s)=>class extends i{constructor(c,u){let h=n(c),l=O(O({},zC),u),p=e(h,l),f=o(h)?r():null;super(c,!0,p,f),this._isCurveNullified=!1,this._nativeWaveShaperNode=p,s(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(c){if(c===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(c.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=c}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(c){this._nativeWaveShaperNode.oversample=c}};var Lm=(i,t,e)=>()=>{let r=new WeakMap,n=(o,s)=>J(null,null,function*(){let a=t(o);if(!vt(a,s)){let u={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample};a=i(s,u)}return r.set(s,a),Ye(a)?yield e(o,s,a.inputs[0]):yield e(o,s,a),a});return{render(o,s){let a=r.get(s);return a!==void 0?Promise.resolve(a):n(o,s)}}};var jm=()=>typeof window=="undefined"?null:window;var Pm=(i,t)=>e=>{e.copyFromChannel=(r,n,o=0)=>{let s=i(o),a=i(n);if(a>=e.numberOfChannels)throw t();let c=e.length,u=e.getChannelData(a),h=r.length;for(let l=s<0?-s:0;l+s<c&&l<h;l+=1)r[l]=u[l+s]},e.copyToChannel=(r,n,o=0)=>{let s=i(o),a=i(n);if(a>=e.numberOfChannels)throw t();let c=e.length,u=e.getChannelData(a),h=r.length;for(let l=s<0?-s:0;l+s<c&&l<h;l+=1)u[l+s]=r[l]}};var Fm=i=>t=>{t.copyFromChannel=(e=>(r,n,o=0)=>{let s=i(o),a=i(n);if(s<t.length)return e.call(t,r,a,s)})(t.copyFromChannel),t.copyToChannel=(e=>(r,n,o=0)=>{let s=i(o),a=i(n);if(s<t.length)return e.call(t,r,a,s)})(t.copyToChannel)};var Bm=i=>(t,e)=>{let r=e.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=r),i(t,"buffer",n=>()=>{let o=n.call(t);return o===r?null:o},n=>o=>n.call(t,o===null?r:o))};var Gm=(i,t)=>(e,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw i()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw i()}});let n=e.createBufferSource();t(r,()=>{let a=r.numberOfInputs;for(let c=0;c<a;c+=1)n.connect(r,0,c)},()=>n.disconnect(r))};var Uu=(i,t,e)=>i.copyFromChannel===void 0?i.getChannelData(e)[0]:(i.copyFromChannel(t,e),t[0]);var zu=i=>{if(i===null)return!1;let t=i.length;return t%2!==0?i[Math.floor(t/2)]!==0:i[t/2-1]+i[t/2]!==0};var vn=(i,t,e,r)=>{let n=i;for(;!n.hasOwnProperty(t);)n=Object.getPrototypeOf(n);let{get:o,set:s}=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(i,t,{get:e(o),set:r(s)})};var Vm=i=>Q(O({},i),{outputChannelCount:i.outputChannelCount!==void 0?i.outputChannelCount:i.numberOfInputs===1&&i.numberOfOutputs===1?[i.channelCount]:Array.from({length:i.numberOfOutputs},()=>1)});var qm=i=>Q(O({},i),{channelCount:i.numberOfOutputs});var Wm=i=>{let{imag:t,real:e}=i;return t===void 0?e===void 0?Q(O({},i),{imag:[0,0],real:[0,0]}):Q(O({},i),{imag:Array.from(e,()=>0),real:e}):e===void 0?Q(O({},i),{imag:t,real:Array.from(t,()=>0)}):Q(O({},i),{imag:t,real:e})};var Yu=(i,t,e)=>{try{i.setValueAtTime(t,e)}catch(r){if(r.code!==9)throw r;Yu(i,t,e+1e-7)}};var Um=i=>{let t=i.createBufferSource();t.start();try{t.start()}catch(e){return!0}return!1};var zm=i=>{let t=i.createBufferSource(),e=i.createBuffer(1,1,44100);t.buffer=e;try{t.start(0,1)}catch(r){return!1}return!0};var Ym=i=>{let t=i.createBufferSource();t.start();try{t.stop()}catch(e){return!1}return!0};var pa=i=>{let t=i.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1};var Hu=i=>{let t=i.createBuffer(1,1,44100),e=i.createBufferSource();e.buffer=t,e.start(),e.stop();try{return e.stop(),!0}catch(r){return!1}};var ma=i=>{let t=i.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1};var Hm=i=>{let{port1:t,port2:e}=new MessageChannel;try{t.postMessage(i)}finally{t.close(),e.close()}};var $m=i=>{i.start=(t=>(e=0,r=0,n)=>{let o=i.buffer,s=o===null?r:Math.min(o.duration,r);o!==null&&s>o.duration-.5/i.context.sampleRate?t.call(i,e,0,0):t.call(i,e,s,n)})(i.start)};var $u=(i,t)=>{let e=t.createGain();i.connect(e);let r=(n=>()=>{n.call(i,e),i.removeEventListener("ended",r)})(i.disconnect);i.addEventListener("ended",r),He(i,e),i.stop=(n=>{let o=!1;return(s=0)=>{if(o)try{n.call(i,s)}catch(a){e.gain.setValueAtTime(0,s)}else n.call(i,s),o=!0}})(i.stop)};var ki=(i,t)=>e=>{let r={value:i};return Object.defineProperties(e,{currentTarget:r,target:r}),typeof t=="function"?t.call(i,e):t.handleEvent.call(i,e)};var YC=Fl(ar),HC=$l(ar),$C=Wd(ni),Xm=new WeakMap,ZC=op(Xm),$e=Sd(new Map,new WeakMap),Tr=jm(),Qm=kp($e,ze),Zu=np(oe),he=vm(oe,Zu,Wr),XC=Kl(Qm,Rt,he),jt=cp(un),Ur=sm(Tr),Mt=vp(Ur),Km=new WeakMap,Jm=Kd(ki),Sn=Fp(Tr),Xu=xp(Sn),Qu=Ap(Tr),tf=Cp(Tr),wo=Gp(Tr),Zt=fd(Bl(ea),Hl(YC,HC,dn,$C,pn,oe,ZC,wr,Rt,ar,xe,Wr,mn),$e,mp(Co,pn,oe,Rt,Ei,xe),ze,bn,ue,Gd(dn,Co,oe,Rt,Ei,jt,xe,Mt),Yd(Km,oe,Jt),Jm,jt,Xu,Qu,tf,Mt,wo),QC=Ql(Zt,XC,ze,Qm,jt,Mt);var Ku=new WeakSet,Zm=Lp(Tr),ef=kd(new Uint32Array(1)),Ju=Pm(ef,ze),th=Fm(ef),eh=Jl(Ku,$e,ue,Zm,Ur,Mm(Zm),Ju,th);var fa=Zl(Ae),rf=Sm(Zu,oi,Wr),Nr=Od(rf),wn=Pp(fa,$e,Um,zm,Ym,pa,Hu,ma,$m,Bm(vn),$u),Or=_m(sp(oi),rf),KC=rd(Nr,wn,Rt,Or,he),ur=gd(Gl(ra),Km,Ao,yd,wu,Iu,Tu,Nu,Ou,on,fo,Sn,Yu),JC=ed(Zt,KC,ur,Ft,wn,jt,Mt,ki);var t_=hd(Zt,ld,ze,Ft,Bp(Ae,vn),jt,Mt,he),e_=vd(Nr,Vu,Rt,Or,he),Li=Tm(Xm),r_=_d(Zt,ur,e_,bn,Vu,jt,Mt,Li),ci=Ep(ar,Qu),i_=Gm(Ft,ci),ui=Hp(Sn,i_),n_=Id(ui,Rt,he),o_=wd(Zt,n_,ui,jt,Mt),s_=Nd(Cn,Rt,he),a_=Td(Zt,s_,Cn,jt,Mt,qm),c_=Xp(fa,wn,Ae,ci),In=Zp(fa,$e,c_,pa,ma),u_=Dd(Nr,In,Rt,Or,he),h_=Ed(Zt,ur,u_,In,jt,Mt,ki),nf=Qp(ue,vn),l_=jd(nf,Rt,he),d_=Ld(Zt,l_,nf,jt,Mt,Li),p_=qd(Nr,qu,Rt,Or,he),m_=Vd(Zt,ur,p_,qu,jt,Mt,Li),of=Kp(ue),f_=Zd(Nr,of,Rt,Or,he),g_=$d(Zt,ur,f_,of,ue,jt,Mt,Li),y_=rp(Nr,Ae,Rt,Or,he),b_=ep(Zt,ur,y_,Ae,jt,Mt),x_=em(bn,Ft,_n,ue),ga=wm($e,Ae,_n,Dm(Ae,Ur)),A_=pp(wn,Rt,Ur,he,ga),C_=Jp(x_),__=dp(Zt,C_,A_,jt,Mt,Li),v_=dd(ur,ui,In,_n,ue,Uu,Mt,vn),sf=new WeakMap,rh=Rp(t_,v_,Jm,Mt,sf,ki),af=am(fa,$e,pa,Hu,ma,$u),S_=ym(Nr,af,Rt,Or,he),w_=gm(Zt,ur,af,S_,jt,Mt,ki),cf=Md(wn),I_=mm(cf,Ft,Ae,zu,ci),ya=pm(cf,Ft,I_,zu,ci,Sn,vn),T_=um(dn,Ft,ui,Ae,_n,ya,ue,pn,Uu,ci),uf=cm(T_),N_=xm(Nr,ui,In,Ae,uf,Rt,Ur,Or,he,ga),O_=bm(Zt,ur,uf,N_,jt,Mt,Li),R_=hm(ze),M_=Am(R_,jt,new WeakSet,Wm),E_=dm(ui,Cn,Ae,ya,ue,ci),hf=lm(E_,ue),D_=Rm(Nr,hf,Rt,Or,he),k_=Om(Zt,ur,hf,D_,jt,Mt),L_=Lm(ya,Rt,he),j_=km(Zt,Ft,ya,L_,jt,Mt,Li),lf=Sp(Tr),ih=Jd(Tr),df=new WeakMap,P_=up(df,Ur),F_=lf?Yl($e,ue,Qd(Tr),ih,tp(Pl),jt,P_,Mt,wo,new WeakMap,new WeakMap,Em(wo,Ur),Tr):void 0,B_=_p(Xu,Mt),G_=Bd(Ku,$e,Fd,Xd,new WeakSet,jt,B_,hn,cr,Ju,th),pf=Cd(F_,QC,eh,JC,r_,o_,a_,h_,d_,G_,m_,g_,b_,__,rh,w_,O_,M_,k_,j_),V_=wp(Zt,rm,jt,Mt),q_=Ip(Zt,im,jt,Mt),W_=Tp(Zt,nm,jt,Mt),U_=om(Ft,Mt),z_=Np(Zt,U_,jt),mf=ud(pf,Ft,ue,Wu,V_,q_,W_,z_,Sn);var nh=hp(sf),Y_=Xl(nh),ff=Rd(ze),H_=Ud(nh),gf=Hd(ze),yf=new WeakMap,$_=ip(yf,Jt),Z_=Yp(ff,ze,Ft,ui,Cn,In,Ae,_n,ue,gf,ih,$_,ci),X_=qp(Ft,Z_,Ae,ue,ci),Q_=Ad(Nr,ff,wn,ui,Cn,In,Ae,H_,gf,ih,Rt,wo,Ur,Or,he,ga),K_=ap(df),J_=Im(yf),oh=lf?bd(Y_,Zt,ur,Q_,X_,oe,K_,jt,Mt,wo,Vm,J_,Hm,ki):void 0;var fU=Op(Ft,ue,Wu,rh,Sn);var bf=Pd(ue,Ur),xf=Nm(Ku,$e,Zu,nh,ga,hn,Ju,th),gU=Mp($e,Ft,bf,rh,xf);var Af=fm(pf,$e,Ft,bf,xf);var Cf=fp(un,Xu),_f=gp(cn,Qu),vf=yp(Ao,tf),Sf=bp(un,Mt);function Xt(i){return i===void 0}function it(i){return i!==void 0}function wf(i){return typeof i=="function"}function le(i){return typeof i=="number"}function hr(i){return Object.prototype.toString.call(i)==="[object Object]"&&i.constructor===Object}function sh(i){return typeof i=="boolean"}function Vt(i){return Array.isArray(i)}function fe(i){return typeof i=="string"}function Io(i){return fe(i)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(i)}function Y(i,t){if(!i)throw new Error(t)}function zt(i,t,e=1/0){if(!(t<=i&&i<=e))throw new RangeError(`Value must be within [${t}, ${e}], got: ${i}`)}function ba(i){!i.isOffline&&i.state!=="running"&&ji('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}var Tf=!1,If=!1;function ah(i){Tf=i}function Nf(i){Xt(i)&&Tf&&!If&&(If=!0,ji("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}var Of=console;function Rf(...i){Of.log(...i)}function ji(...i){Of.warn(...i)}function Mf(i){return new mf(i)}function Ef(i,t,e){return new Af(i,t,e)}var ge=typeof self=="object"?self:null,Df=ge&&(ge.hasOwnProperty("AudioContext")||ge.hasOwnProperty("webkitAudioContext"));function kf(i,t,e){return Y(it(oh),"AudioWorkletNode only works in a secure context (https or localhost)"),new(i instanceof(ge==null?void 0:ge.BaseAudioContext)?ge==null?void 0:ge.AudioWorkletNode:oh)(i,t,e)}function ye(i,t,e,r){var n=arguments.length,o=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(n<3?s(o):n>3?s(t,e,o):s(t,e))||o);return n>3&&o&&Object.defineProperty(t,e,o),o}function yt(i,t,e,r){function n(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(h){try{u(r.next(h))}catch(l){s(l)}}function c(h){try{u(r.throw(h))}catch(l){s(l)}}function u(h){h.done?o(h.value):n(h.value).then(a,c)}u((r=r.apply(i,t||[])).next())})}var xa=class{constructor(t,e,r,n){this._callback=t,this._type=e,this._minimumUpdateInterval=Math.max(128/(n||44100),.001),this.updateInterval=r,this._createClock()}_createWorker(){let t=new Blob([`
|
|
5
5
|
// the initial timeout time
|
|
@@ -225,4 +225,4 @@ tone/build/esm/core/Tone.js:
|
|
|
225
225
|
* @copyright 2014-2024 Yotam Mann
|
|
226
226
|
*)
|
|
227
227
|
*/
|
|
228
|
-
//# sourceMappingURL=index.
|
|
228
|
+
//# sourceMappingURL=index.js.map
|