diff --git a/_app/immutable/chunks/3.06dc71f7.js b/_app/immutable/chunks/3.06dc71f7.js deleted file mode 100644 index 48639daa..00000000 --- a/_app/immutable/chunks/3.06dc71f7.js +++ /dev/null @@ -1,7 +0,0 @@ -import{_ as Ce}from"./preload-helper.a4192956.js";import{S as We,i as qe,s as Je,e as b,n as j,a as y,b as C,p as B,d as p,f as m,Z as Ie,N as $,g as U,h as u,_ as et,q as J,t as x,F as xe,l as q,y as Fe,$ as Xe,Q as Ae,R as Ne,c as Ps,a0 as de,u as Os,j as Vs,k as js,V as os,W as Et,X as rs,a1 as as,a2 as Oe,x as Pe,H as Bs,B as X,C as Z,D as pe,r as me,O as Ue,J as ge,K as ve,L as be,M as ye,m as Te,T as Mt,w as Be,a3 as Vn,o as ae,P as _e,a4 as ms,v as bn,a5 as jn,a6 as is,a7 as Bn,a8 as Gn,I as Mn}from"./vendor_svelte.f9b78e98.js";import{w as es,c as Rn,e as Un,f as Qs,g as Xs,h as Ft,i as cs,j as us,k as jt,l as Bt,m as Kn,a as Zs,n as Ts}from"./vendor.e9b0235c.js";import{a as xn}from"./modal.57c20595.js";function el(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l[24]=e[t].icon,l[26]=t,l}const Fn=s=>({}),tl=s=>({});function sl(s){let e,t,l,n,r,o,a,i,c,d,f;const g=s[17].header,_=Ps(g,s,s[16],tl);let h=de(s[0]),v=[];for(let k=0;kq(v[k],1,1,()=>{v[k]=null});return{c(){e=b("button"),l=j(),n=b("ul"),r=b("li"),_&&_.c(),o=j();for(let k=0;k{c&&(t||(t=Et(e,rs,{duration:ts},!0)),t.run(1))}),x(_,k);for(let E=0;E{c&&(i||(i=Et(n,as,{duration:ts},!0)),i.run(1))}),c=!0}},o(k){k&&(t||(t=Et(e,rs,{duration:ts},!1)),t.run(0)),q(_,k),v=v.filter(Boolean);for(let E=0;E{h[L]=null}),Fe(),n=h[l],n?n.p(s,E):(n=h[l]=_[l](s),n.c()),x(n,1),n.m(t,r)),(!d||E&1)&&a!==(a=s[23]+"")&&pe(i,a),(!d||E&9)&&$(t,"selected",s[22]===s[3])},i(k){d||(x(n),d=!0)},o(k){q(n),d=!1},d(k){k&&p(e),h[l].d(),f=!1,g()}}}function Hn(s){let e;return{c(){e=b("div"),this.h()},l(t){e=y(t,"DIV",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","w-[24px]")},m(t,l){U(t,e,l)},p:me,i:me,o:me,d(t){t&&p(e)}}}function zn(s){let e,t;return e=new Ue({props:{class:"mr-2",icon:s[24],width:16}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},p(l,n){const r={};n&1&&(r.icon=l[24]),e.$set(r)},i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){q(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function nl(s){let e,t,l=!s[8][s[26]]&&ll(s);return{c(){l&&l.c(),e=Pe()},l(n){l&&l.l(n),e=Pe()},m(n,r){l&&l.m(n,r),U(n,e,r),t=!0},p(n,r){n[8][n[26]]?l&&(xe(),q(l,1,1,()=>{l=null}),Fe()):l?(l.p(n,r),r&256&&x(l,1)):(l=ll(n),l.c(),x(l,1),l.m(e.parentNode,e))},i(n){t||(x(l),t=!0)},o(n){q(l),t=!1},d(n){n&&p(e),l&&l.d(n)}}}function Wn(s){let e,t,l,n,r,o,a,i,c,d=s[6]&&sl(s);return{c(){e=b("div"),t=b("input"),r=j(),d&&d.c(),this.h()},l(f){e=y(f,"DIV",{class:!0,id:!0});var g=C(e);t=y(g,"INPUT",{class:!0,title:!0}),r=B(g),d&&d.l(g),g.forEach(p),this.h()},h(){m(t,"class",l=Ie(`${s[14].class||""} open-btn text-justify text-sm rounded`)+" svelte-h65upg"),m(t,"title",n=s[14].title||""),$(t,"disabled",s[4]),$(t,"open",s[6]),m(e,"class",o=Ie(`relative ${s[2]||""}`)+" svelte-h65upg"),m(e,"id",s[1])},m(f,g){U(f,e,g),u(e,t),et(t,s[7]),u(e,r),d&&d.m(e,null),s[21](e),a=!0,i||(c=[J(t,"input",s[18]),J(t,"click",s[9]),J(t,"focus",s[19]),J(t,"input",s[10]),J(t,"keydown",s[12])],i=!0)},p(f,[g]){(!a||g&16384&&l!==(l=Ie(`${f[14].class||""} open-btn text-justify text-sm rounded`)+" svelte-h65upg"))&&m(t,"class",l),(!a||g&16384&&n!==(n=f[14].title||""))&&m(t,"title",n),g&128&&t.value!==f[7]&&et(t,f[7]),(!a||g&16400)&&$(t,"disabled",f[4]),(!a||g&16448)&&$(t,"open",f[6]),f[6]?d?(d.p(f,g),g&64&&x(d,1)):(d=sl(f),d.c(),x(d,1),d.m(e,null)):d&&(xe(),q(d,1,1,()=>{d=null}),Fe()),(!a||g&4&&o!==(o=Ie(`relative ${f[2]||""}`)+" svelte-h65upg"))&&m(e,"class",o),(!a||g&2)&&m(e,"id",f[1])},i(f){a||(x(d),a=!0)},o(f){q(d),a=!1},d(f){f&&p(e),d&&d.d(),s[21](null),i=!1,Xe(c)}}}const ts=400;function qn(s,e,t){let{$$slots:l={},$$scope:n}=e,{options:r,id:o=void 0,containerClass:a=void 0,selected:i,disabled:c=void 0,onSelect:d}=e,f,g=!1,_=i,h=r.map(A=>!1);function v(){c||t(6,g=!g)}function S(A){t(8,h=r.map(w=>!w.value.toLowerCase().includes(A.currentTarget.value.toLowerCase())))}function k(){t(7,_=i),t(6,g=!1),t(8,h=r.map(A=>!1))}function E(A){if(A.key==="Enter"){const w=h.findIndex(D=>!D);_===i?k():w>-1&&t(6,g=d(r[w].key)),g||(t(8,h=r.map(D=>!1)),A.currentTarget instanceof HTMLElement&&A.currentTarget.blur())}else A.key==="Escape"&&(k(),A.currentTarget instanceof HTMLElement&&A.currentTarget.blur())}function L(A){t(6,g=d(A))}function O(){_=this.value,t(7,_),t(3,i)}const K=()=>t(6,g=!0),N=A=>L(A);function T(A){Bs[A?"unshift":"push"](()=>{f=A,t(5,f)})}return s.$$set=A=>{t(14,e=Ae(Ae({},e),Ne(A))),"options"in A&&t(0,r=A.options),"id"in A&&t(1,o=A.id),"containerClass"in A&&t(2,a=A.containerClass),"selected"in A&&t(3,i=A.selected),"disabled"in A&&t(4,c=A.disabled),"onSelect"in A&&t(15,d=A.onSelect),"$$scope"in A&&t(16,n=A.$$scope)},s.$$.update=()=>{s.$$.dirty&8&&t(7,_=i),s.$$.dirty&1&&t(8,h=r.map(A=>!1))},e=Ne(e),[r,o,a,i,c,f,g,_,h,v,S,k,E,L,e,d,n,l,O,K,N,T]}class yn extends We{constructor(e){super(),qe(this,e,qn,Wn,Je,{options:0,id:1,containerClass:2,selected:3,disabled:4,onSelect:15})}}const ol={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function Ze(s,e=0,t=0){return{interval:`${s}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:s,semitones:kn(s,e,t),flats:e,sharps:t}}function kn(s,e,t){return(s<8?ol[s]:ol[s%7])-e+t+Math.floor(s/8)*12}function wn(s){let e,t=0,l=0;s<0?(t=1+Math.floor(-s/100),e=-s%100):s>100?(l=Math.floor(s/100),e=s%100):e=s;const n=kn(e,t,l);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(l)}`,interval_seq:e,semitones:n,flats:t,sharps:l}}const Jn=[[["maj"],["Major Chord"],"major",[1,3,5]],[["6"],["Major 6th Chord"],"major",[1,3,5,6]],[["6/9"],["Major 6th/9th Chord"],"major",[1,3,5,6,9]],[["maj7"],["Major 7th Chord"],"major",[1,3,5,7]],[["maj9"],["Major 9th Chord"],"major",[1,3,5,7,9]],[["maj11"],["Major 11th Chord"],"major",[1,3,5,7,9,11]],[["maj13"],["Major 13th Chord"],"major",[1,3,5,7,9,11,13]],[["m"],["Minor Chord"],"minor",[1,-3,5]],[["m6"],["Minor 6th Chord"],"minor",[1,-3,5,6]],[["m7"],["Minor 7th Chord"],"minor",[1,-3,5,-7]],[["m9"],["Minor 9th Chord"],"minor",[1,-3,5,-7,9]],[["m11"],["Minor 11th Chord"],"minor",[1,-3,5,-7,9,11]],[["m13"],["Minor 13th Chord"],"minor",[1,-3,5,-7,9,11,13]],[["sus2"],["Suspended 2nd Chord"],"suspended",[1,2,5]],[["sus4"],["Suspended 4th Chord"],"suspended",[1,4,5]],[["7sus4"],["Suspended 4th Seventh Chord"],"suspended",[1,4,5,-7]],[["7"],["Dominant 7th Chord"],"major",[1,3,5,-7]],[["7#9"],["Dominant 7th Sharp 9th Chord"],"major",[1,3,5,-7,109]],[["9"],["Dominant 9th Chord"],"major",[1,3,5,-7,9]],[["11"],["Dominant 11th Chord"],"major",[1,3,5,-7,9,11]],[["13"],["Dominant 13th Chord"],"major",[1,3,5,-7,9,11,13]],[["5"],["Power Chord"],"indeterminate",[1,5]],[["dim","°"],["Diminished Chord"],"diminished",[1,-3,-5]],[["dim7","°7"],["Diminished 7th Chord"],"diminished",[1,-3,-5,-107]],[["m7b5"],["Half-Diminished 7th Chord"],"diminished",[1,-3,-5,-7]],[["aug","+"],["Augmented Chord"],"augmented",[1,3,105]],[["aug7","+7"],["Augmented 7th Chord"],"augmented",[1,3,105,-7]]];let Es=[];function En(){return Jn.map(s=>{const e=s[3].map(wn);return{suffixes:s[0],name:s[1][0],type:s[2],intervals:e}})}function Rt(s){Es.length===0&&(Es=En());const e=s.replaceAll(/-|\s/g,"").toLowerCase().trim();return Es.find(t=>t.suffixes.find(l=>l===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function $n(s,e,t){let l=e<0?s.flats-e:s.flats,n=e>0?s.sharps+e:s.sharps;if(l>0&&n>0){const o=Math.min(l,n);l-=o,n-=o}const r=(s.semitones+e)%12;return{...s,semitones:r<0?r+12:r,note:`${s.note.charAt(0)}${"♭".repeat(l)}${"♯".repeat(n)}`,flats:l,sharps:n,midi:t}}function ns(s,e,t){const l=[];for(let n=0;ng.semitones===o%12),i=r.flats>0,c=r.sharps>0,d=(i?o+1:c?o-1:o)%12,f=i?-1:c?1:0;l.push($n(a??e.notesMap.get(d),a?0:f,o))}return l}const rl=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],Yn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],al=new Map([[0,"C"],[-1,"F"],[-2,"B♭"],[-3,"E♭"],[-4,"A♭"],[-5,"D♭"],[-6,"G♭"],[-7,"C♭"],[1,"G"],[2,"D"],[3,"A"],[4,"E"],[5,"B"],[6,"F♯"],[7,"C♯"]]);function Qn(s){let e=0,t=0;for(let l=0;lo.note.slice(0,2)===rl[l]),r=s.find(o=>o.note.slice(0,2)===Yn[l]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:al.get(e*-1)}:{flats:0,sharps:t,majorSignature:al.get(t)}}function Xn(s){return s>=9?`${s>=10?"X":""}${s===9?"IX":"I".repeat(s%10)}`:`${s>=5?"V":""}${s===4?"IV":"I".repeat(s%5)}`}function Cn(s){return s.map(e=>{const t=[Ze(1)];let l;return e.major?(t.push(Ze(3)),e.suffix.startsWith("+")?t.push(Ze(5,0,1)):e.suffix.startsWith("6")?t.push(Ze(6)):e.suffix.startsWith("7")?t.push(Ze(7,1)):e.suffix.startsWith("maj7")?t.push(Ze(7)):l=Rt("maj")):e.minor?(t.push(Ze(3,1)),e.suffix.startsWith("°")?t.push(Ze(5,1)):e.suffix.startsWith("6")?(t.push(Ze(6)),l=Rt("m"+e.suffix)):e.suffix.startsWith("7")?(t.push(Ze(7,1)),l=Rt("m"+e.suffix)):l=Rt("m")):e.suffix.startsWith("sus2")?t.push(Ze(2)):e.suffix.startsWith("sus4")&&t.push(Ze(4)),t.length<=2&&t.push(Ze(5)),t.length<=2&&t.push(Ze(8)),l||(l=Rt(e.suffix)),{...l,intervals:t}})}function Zn(s,e){let t=e.has(4)&&e.has(7),l=e.has(3)&&e.has(7);const n=Xn(s);let r="";return t||l||(e.has(3)&&e.has(6)?(r="°",l=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(l=!0,r="7"):e.has(4)&&e.has(10)?(r="7",t=!0):e.has(4)&&e.has(11)?(r="maj7",t=!0):e.has(3)&&e.has(8)?(r="6",l=!0):e.has(4)&&e.has(9)?(r="6",t=!0):e.has(2)?r="sus2":e.has(5)?r="sus4":e.has(7)?r="5":r="?"),{degree:s,roman:l?n.toLowerCase():n,suffix:r,major:t,minor:l,semitones:e}}function eo(s){const e=s.length;return s.map((t,l)=>{const n=t.semitones,r=new Set;for(let o=1;o{const e=s[0],t=s[1].map(wn),l=eo(t);return{names:e,intervals:t,triads:l}})}function so(s){Cs.length===0&&(Cs=_s());const e=s.replaceAll(/-|\s/g,"").toLowerCase().trim();return Cs.find(t=>t.names.find(l=>l.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const lo=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,no=/^[0-9]$/,at=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function fs(s){const e=s.midi+s.flats-s.sharps;return e===12?1:Math.floor((e-12)/12)}function ft(s){return`${s.note}${fs(s)}`}function il(s){const t=(s-12)%12;return{...at[t],semitones:t,midi:s}}function oo(s,e=!0,t=!1){if(e&&!lo.test(s))return{err:`Unrecognized note "${s}"`,code:400};const l=s.trim(),n=l.charAt(0).toUpperCase(),r=at.find(f=>f.note.charAt(0)===n&&f.note.length===1);if(!r)return{err:`Unable to find note ${l}`,code:500};const o=l.slice(1).split("").reduce((f,g)=>f+(g.toLowerCase()==="b"||g==="♭"?-1:g==="#"||g==="♯"?1:0),0);let a;if(no.test(l.charAt(l.length-1)))try{a=parseInt(l.charAt(l.length-1),10)}catch{}if(t&&a===void 0)return{err:`No octave provided: ${s}`,code:400};a===void 0&&(a=0);let i=(r.semitones+o)%12;i=i<0?i+12:i;const c=o<0?-o:0,d=o>0?o:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(d)}`,semitones:i,midi:12+a*12+i,flats:c,sharps:d}}}function Gs(s){const e=at.find(t=>t.note.charAt(0)===s.charAt(0)&&t.note.length===1);if(e){const t=s.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),l=(e.semitones+t)%12;return{note:s,semitones:l<0?l+12:l,flats:t<0?-t:0,sharps:t>0?t:0}}}const ro=/^[a-gA-G][♭b#♯]?$/,Is="ABCDEFG";function ao(s,e){return e.map(t=>Is.charAt((Is.indexOf(s)+t.interval_seq-1)%Is.length))}function io(s,e,t){return t.map((l,n)=>{const r=e[n],o=(s+l.semitones)%12,a=at[o],i=a.note.charAt(0);if(ir||i==="A"&&r==="G"){let c=1,d=o===0?at.length-1:o-c,f=at[d];for(;f.note.charAt(0)!==r;)c+=1,d=d===0?at.length-1:d-1,f=at[d];return{semitones:o,note:f.note+"♯".repeat(c),flats:0,sharps:c+(f.note.includes("♯")?1:0)}}else return{semitones:o,note:a.note,flats:a.flats,sharps:a.sharps}})}function Ut(s,e){if(!ro.test(s))return{err:`Unknown key: ${s}`,code:400};const t=so(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const l=`${s.charAt(0).toUpperCase()}${s.charAt(1).replace("b","♭").replace("#","♯")}`,n=Gs(l);if(!n)return{err:`Unable to find root for note: ${l}`,code:404};const r=ao(l.charAt(0),t.intervals),o=io(n.semitones,r,t.intervals),a=new Map(at.map(i=>{const c=o.find(d=>d.semitones===i.semitones);return c?[i.semitones,c]:[i.semitones,{...i}]}));return{data:{key:l,scale:t.names[0],names:t.names,...Qn(o),intervals:t.intervals.map(i=>({...i})),triads:t.triads.map(i=>({...i})),scaleNotes:o,notesMap:a}}}const As=new Map;function co(s,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(s)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function uo(s,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(s)),{data:void 0}}catch(l){return{err:`Failed to store the value: ${l}`,code:400}}}function _t(s,e){const{key:t,storage:l="local",namespace:n="default"}=e,r=co(t,l),o=Te(s);"data"in r?s.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const a=s.subscribe(c=>{const d=uo(e.serialize?e.serialize(c):c,t,l);"err"in d&&(e!=null&&e.debug)&&console.error(d.err)}),i=As.get(n);return i?i.push({key:t,storage:l,value:s,defaultValue:o,unsubscribe:a}):As.set(n,[{key:t,storage:l,value:s,defaultValue:o,unsubscribe:a}]),s}function fo(s=["default"],e){s.forEach(t=>{var l;(l=As.get(t))==null||l.forEach(n=>{if(e!=null&&e.cb)e==null||e.cb(n);else try{e!=null&&e.unsubscribe&&n.unsubscribe(),n.value.set(n.defaultValue),(n.storage==="local"?window.localStorage:window.sessionStorage).removeItem(n.key)}catch{}})})}async function ho(s,e){const t=await fetch(s);if(!t.ok)return{err:t.statusText,code:t.status};const l=await t.arrayBuffer();return{data:await e.decodeAudioData(l)}}async function mo(s,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],l=await Promise.all(t.map(r=>ho(`${s}${r}`,e))),n=[];return l.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class _o{constructor(e,t,l,n){this.noteA=t.createBufferSource(),this.noteB=t.createBufferSource(),this.gainA=t.createGain(),this.gainB=t.createGain(),this.gain=t.createGain(),this.biquadFilter=t.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.connect(l),this.gain.connect(this.biquadFilter),this.gainA.connect(this.gain),this.noteA.connect(this.gainA),this.gainB.connect(this.gain),this.noteB.connect(this.gainB),e<90&&(this.damp=t.createBufferSource(),this.damp.buffer=n,this.damp.connect(l))}on(e,t,l,n,r,o,a,i){this.noteA.buffer=e,this.noteA.playbackRate.value=l,this.biquadFilter.frequency.value=r,this.gainA.gain.value=o,this.gain.gain.value=i,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=a,this.noteB.start(0)),this.noteA.start(0)}off(e,t,l){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(l),this.noteB.stop(l),(n=this.damp)==null||n.start(0)}}class po{constructor(e){return this.bufferlists=[],this.sus=!1,this.sustained=[],this.notes=new Map,this.context=e,this.convolver=e.createConvolver(),this.directGain=e.createGain(),this.convGain=e.createGain(),this.convGainAfter=e.createGain(),this.convGain.connect(this.convolver),this.convolver.connect(this.convGainAfter),this.convGainAfter.connect(e.destination),this.directGain.connect(e.destination),this.directGain.connect(this.convGain),this.directGain.gain.value=.75,this.convGain.gain.value=0,this.convGainAfter.gain.value=0,this}load(e){e.forEach((t,l)=>{this.bufferlists.push(t),l===8?this.damper=t:l===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(l=>{this.noteOn(l,t)})}noteOn(e,t=80){if(e<109&&e>20){const l=this.notes.get(e);l&&(l.off(this.context.currentTime,1.1,this.context.currentTime+2),this.sustained.splice(this.sustained.indexOf(e),1));const n=Math.floor((e-21)/12),r=n+1,o=n*12+21,a=2**((e-69)/12)*440,i=t/127;let c=a*(2-(e-21)/50)+3*a*i;e<60&&(c=440*(3-(60-21)/50)+3*a*i);const d=1-(e%12/12+1)/12,f=Math.pow(2,(e-o)/12),g=0,_=0,h=i**1.4,v=new _o(e,this.context,this.directGain,this.damper);v.on(this.bufferlists[n],this.bufferlists[r],f,g,c,d,_,h),this.notes.set(e,v)}}noteOff(e){if(this.sus)this.sustained.push(e);else{const t=this.notes.get(e);e<90&&t&&t.off(this.context.currentTime+.03,.08,this.context.currentTime+2),this.notes.delete(e)}}sustain(e){if(e==127)this.sus=!0,this.convGain.gain.value=1,this.convGainAfter.gain.value=1;else if(e==0){this.sus=!1,this.convGain.gain.value=0,this.convGainAfter.gain.value=0;for(let t=0;t[il(s[0]),il(s[1])]),cl=Be(void 0),lt=Be(void 0),nt=_t(Be({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),je={async openMidi(){return es.enable().then(()=>(Ns.set(!0),es.inputs.length>0?(ds.set(es.inputs[0]),{data:es.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(s=>({err:s.toString(),code:403}))},disableMidi(){Ns.set(!1),ds.set(void 0)},setMidiRange(s){ps.set(s)},setInputValue(s,e){nt.update(t=>({...t,[s]:e})),s==="useSound"&&!e?lt.set(void 0):s==="useSound"&&!Te(lt)&&this.initAudio()},async initAudio(){let s=Te(cl);if(s||(s=new AudioContext,cl.set(s)),!Te(lt)){const e=new po(s),t=await mo(`${go}audio`,s);e.load(t),lt.set(e)}}};let rt;Vn({A:{note:"C",semitones:0,flats:0,sharps:0},W:{note:"C♯",semitones:1,flats:0,sharps:1},S:{note:"D",semitones:2,flats:0,sharps:0},E:{note:"E♭",semitones:3,flats:1,sharps:0},D:{note:"E",semitones:4,flats:0,sharps:0},F:{note:"F",semitones:5,flats:0,sharps:0},T:{note:"F♯",semitones:6,flats:0,sharps:1},G:{note:"G",semitones:7,flats:0,sharps:0},Y:{note:"G♯",semitones:8,flats:0,sharps:1},H:{note:"A",semitones:9,flats:0,sharps:0},U:{note:"B♭",semitones:10,flats:1,sharps:0},J:{note:"B",semitones:11,flats:0,sharps:0},K:{note:"C",semitones:12,flats:0,sharps:0},O:{note:"C♯",semitones:13,flats:0,sharps:1},L:{note:"D",semitones:14,flats:0,sharps:0},P:{note:"E♭",semitones:15,flats:1,sharps:0},Ö:{note:"E",semitones:16,flats:0,sharps:0},Ä:{note:"F",semitones:17,flats:0,sharps:0},Å:{note:"F♯",semitones:18,flats:0,sharps:1}});const Tt=Be(["C","Major"]),It=Mt(Tt,s=>{const e=Ut(s[0],s[1]);return"data"in e?e.data:{key:s[0],scale:s[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),ul=Be([]),yt=Be([]);function Ss(s,e){if(s.length>0){const t=Date.now();let l=t;const n=s.filter(r=>(r.started+e>t&&(l=Math.min(l,r.started)),r.started+e>t));return!rt&&n.length>0&&(rt=setTimeout(()=>{rt=void 0,yt.update(r=>Ss(r,e))},e-(t-l)+100)),n}return s}const De={setKey(s){Tt.update(e=>[s,e[1]])},setScale(s){Tt.update(e=>[e[0],s])},setKeyAndScale(s,e){Tt.set([s,e])},setTarget(s=[]){ul.set(s)},getNote(s){return{...Te(It).notesMap.get(s%12),midi:s}},pushPlayed(s,e,t){const n={...Te(It).notesMap.get(s%12),midi:s},r=Date.now(),o=e===void 0?"default":e?"correct":"wrong";if(yt.update(a=>{const i=a.findIndex(c=>c.midi===s);return i>=0&&a.splice(i,1),[...a,{...n,color:o,started:r}]}),!rt&&t!==-1){const a=t??Te(nt).keyFadeTimeout;rt=setTimeout(()=>{rt=void 0,yt.update(i=>Ss(i,a))},a)}},setPlayed(s,e,t){const l=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(yt.update(r=>[...s.map(o=>({...o,color:n,started:l}))]),!rt&&t!==-1){const r=t??Te(nt).keyFadeTimeout;rt=setTimeout(()=>{rt=void 0,yt.update(o=>Ss(o,r))},r)}},clearPlayed(){yt.set([]),clearTimeout(rt),rt=void 0},clearScore(s=!1){s&&Tt.set(["C","Major"]),ul.set([]),yt.set([])}};class Ms{constructor(e,t,l){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=l;const n=[],{count:r}=l,o=t.map(i=>typeof i=="object"&&i!==null?{...i}:i);let a=l.duplicates;!l.duplicates&&r>o.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),a=!0);for(let i=0;i0&&n.push(d[0])}}this.sampled=n,this.timing=performance.now()}get current(){return this.sampled[this.idx]}get latestGuess(){const e=this.sampled[this.idx-1],t=this.guesses[this.idx-1];return{target:e,guessed:t}}get ended(){return this.sampled.length0?s.sharps+e:s.sharps;if(l>0&&n>0){const o=Math.min(l,n);l-=o,n-=o}const r=(s.semitones+e)%12;return{...s,semitones:r<0?r+12:r,note:`${s.note.charAt(0)}${"♭".repeat(l)}${"♯".repeat(n)}`,flats:l,sharps:n,midi:t}}function bo(s,e,t){const l=[];for(let n=0;ng.semitones===o%12),i=r.flats>0,c=r.sharps>0,d=(i?o+1:c?o-1:o)%12,f=i?-1:c?1:0;l.push(vo(a??e.notesMap.get(d),a?0:f,o))}return l}const yo=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function ko(s){const t=(s-12)%12;return{...yo[t],semitones:t,midi:s}}function wo(s){return`${s.note.trim().charAt(0).toUpperCase()}${"♭".repeat(s.flats)}${"♯".repeat(s.sharps)}`}class ht extends Ms{constructor(e,t,l){const n=t.range[0],r=t.range[1],o=new Set(t.scale.scaleNotes.map(i=>i.semitones)),a=l.chords.flatMap(i=>{const c=[],d=i.intervals.reduce((f,g)=>g.semitones>f?g.semitones:f,0);for(let f=n;f<=r-d;f+=1)if((!l.onlyScale||o.has(f%12))&&(!i.allowed||i.allowed.has(f%12))){const g=bo(f,t.scale,i.intervals);c.push({...i,rootNote:g[0].note,chord:`${g[0].note}${i.suffixes[0]}`,notes:g})}return c});super(e,a,t),this.played=new Set,this.opts=l}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${wo(e)}${e.chord.toLowerCase()}`,notes:[]};let l=this.current.chord===t.chord;return this.current.chord.slice(-3)==="maj"&&!l&&(l=this.current.chord.slice(0,-3)===t.chord),this.addGuessed(t,l)}guess(){const e=Array.from(this.played.values()).map(n=>ko(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},l=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,l)}}const Eo={major:{C:{num:0},F:{acc:"b",num:1},Bb:{acc:"b",num:2},Eb:{acc:"b",num:3},Ab:{acc:"b",num:4},Db:{acc:"b",num:5},Gb:{acc:"b",num:6},Cb:{acc:"b",num:7},G:{acc:"#",num:1},D:{acc:"#",num:2},A:{acc:"#",num:3},E:{acc:"#",num:4},B:{acc:"#",num:5},"F#":{acc:"#",num:6},"C#":{acc:"#",num:7}},minor:{A:{num:0},D:{acc:"b",num:1},G:{acc:"b",num:2},C:{acc:"b",num:3},F:{acc:"b",num:4},Bb:{acc:"b",num:5},Eb:{acc:"b",num:6},Ab:{acc:"b",num:7},E:{acc:"#",num:1},B:{acc:"#",num:2},"F#":{acc:"#",num:3},"C#":{acc:"#",num:4},"G#":{acc:"#",num:5},"D#":{acc:"#",num:6},"A#":{acc:"#",num:7}}};class Kt extends Ms{constructor(e,t){const l=e==="keys-major"?"major":"minor";super(e,Object.keys(Eo[l]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class Vt extends Ms{constructor(e,t){const l=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-l+1)).map((r,o)=>l+o),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const In={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},dt=Be("waiting"),mt=_t(Be(In),{key:"game-options"}),Ct=Be(void 0),Rs=Be(En().map(s=>({...s,selected:!0}))),Le={play(...[s,e]){var i,c,d;let t;const l=Te(It),n=Te(ps),r=Te(mt),o={scale:l,range:n,duplicates:r.duplicates,count:r.count};let a=[l.key,l.scale];if(s==="notes")t=new Vt(s,o),De.setTarget([De.getNote(t.current)]),(i=Te(lt))==null||i.noteOn(t.current);else if(s==="pitches")t=new Vt(s,o),De.setTarget(),je.setInputValue("useSound",!0),(c=Te(lt))==null||c.noteOn(t.current);else if(s==="keys-major"||s=="keys-minor")t=new Kt(s,o),a=[t.current,s==="keys-major"?"major":"minor"];else if(s==="chords-play"||s==="chords-write")t=new ht(s,o,e);else if(s==="chords-diatonic"){const f=Cn(l.triads).map((g,_)=>({...g,allowed:new Set([l.scaleNotes[_].semitones])}));t=new ht(s,o,{chords:f})}else throw Error("Unknown game type: "+s);return typeof t.current!="number"&&typeof t.current!="string"&&((d=Te(lt))==null||d.playChord(t.current.notes.map(f=>f.midi)),De.setTarget(t.current.notes)),De.setKeyAndScale(a[0],a[1]),De.clearPlayed(),dt.set("waiting"),Ct.set(t),t},updateState(s){dt.set(s)},setOptionValue(s,e){mt.update(t=>({...t,[s]:e}))},toggleChords(s){Rs.update(e=>e.map(t=>({...t,selected:s(t)})))},nextGuess(){var e,t;const s=Te(Ct);s!=null&&s.ended?dt.set("ended"):s instanceof Vt?(s.type==="notes"?De.setTarget([De.getNote(s.current)]):De.setTarget(),De.clearPlayed(),(e=Te(lt))==null||e.noteOn(s.current),Le.updateState("waiting"),s.startTime()):s instanceof ht?(De.setTarget(s.current.notes),De.clearPlayed(),(t=Te(lt))==null||t.playChord(s==null?void 0:s.current.notes.map(l=>l.midi)),dt.set("waiting"),s.startTime()):s instanceof Kt&&(De.setKey(s.current),dt.set("waiting"),s.startTime())},clearGame(s=!1){const e=Te(Ct);e&&De.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),s&&mt.set(In),Ct.set(void 0),dt.set("waiting"),De.clearScore()}};function fl(s,e,t){const l=s.slice();return l[35]=e[t],l[37]=t,l}function dl(s,e,t){const l=s.slice();return l[40]=e[t],l}function hl(s,e,t){const l=s.slice();return l[9]=e[t],l}function ml(s,e,t){const l=s.slice();return l[35]=e[t],l[37]=t,l}function _l(s,e,t){const l=s.slice();return l[40]=e[t],l}function pl(s,e,t){const l=s.slice();return l[9]=e[t],l}function Co(s){let e,t=de(s[35].intervals),l=[];for(let n=0;n0?Io:Co}let T=N(s),A=T(s);function w(){return s[26](s[35])}return{c(){e=b("li"),t=b("button"),l=b("span"),ge(n.$$.fragment),r=j(),o=b("div"),i=X(a),c=j(),d=b("li"),A.c(),g=j(),_=b("li"),h=b("button"),S=X(v),k=j(),this.h()},l(D){e=y(D,"LI",{});var P=C(e);t=y(P,"BUTTON",{class:!0});var I=C(t);l=y(I,"SPAN",{class:!0});var V=C(l);ve(n.$$.fragment,V),V.forEach(p),r=B(I),o=y(I,"DIV",{class:!0});var R=C(o);i=Z(R,a),R.forEach(p),I.forEach(p),P.forEach(p),c=B(D),d=y(D,"LI",{class:!0,title:!0});var M=C(d);A.l(M),M.forEach(p),g=B(D),_=y(D,"LI",{class:!0});var F=C(_);h=y(F,"BUTTON",{class:!0});var ee=C(h);S=Z(ee,v),ee.forEach(p),k=B(F),F.forEach(p),this.h()},h(){m(l,"class","px-1 py-1 rounded"),$(l,"text-green-500",s[35].selected),$(l,"text-gray-400",!s[35].selected),m(o,"class","ml-1 px-1 w-full bg-gray-200 svelte-1rg0xw5"),m(t,"class","flex items-center justify-center w-full select-btn svelte-1rg0xw5"),$(t,"hidden",s[8]),m(d,"class","intervals svelte-1rg0xw5"),m(d,"title",f=s[35].intervals.map(El).join("-")),m(h,"class","text-start"),m(_,"class","text-xs")},m(D,P){U(D,e,P),u(e,t),u(t,l),be(n,l,null),u(t,r),u(t,o),u(o,i),U(D,c,P),U(D,d,P),A.m(d,null),U(D,g,P),U(D,_,P),u(_,h),u(h,S),u(_,k),E=!0,L||(O=[J(t,"click",K),J(h,"click",w)],L=!0)},p(D,P){s=D;const I={};P[0]&128&&(I.icon=s[35].selected?cs:us),n.$set(I),(!E||P[0]&128)&&$(l,"text-green-500",s[35].selected),(!E||P[0]&128)&&$(l,"text-gray-400",!s[35].selected),(!E||P[0]&128)&&a!==(a=s[35].suffixes[0]+"")&&pe(i,a),(!E||P[0]&256)&&$(t,"hidden",s[8]),T===(T=N(s))&&A?A.p(s,P):(A.d(1),A=T(s),A&&(A.c(),A.m(d,null))),(!E||P[0]&128&&f!==(f=s[35].intervals.map(El).join("-")))&&m(d,"title",f),(!E||P[0]&128)&&v!==(v=s[35].name+"")&&pe(S,v)},i(D){E||(x(n.$$.fragment,D),E=!0)},o(D){q(n.$$.fragment,D),E=!1},d(D){D&&(p(e),p(c),p(d),p(g),p(_)),ye(n),A.d(),L=!1,Xe(O)}}}function To(s){let e,t=de(s[35].intervals),l=[];for(let n=0;n0?Ao:To}let T=N(s),A=T(s);function w(){return s[28](s[35])}return{c(){e=b("li"),t=b("button"),l=b("span"),ge(n.$$.fragment),r=j(),o=b("div"),i=X(a),c=j(),d=b("li"),A.c(),g=j(),_=b("li"),h=b("button"),S=X(v),k=j(),this.h()},l(D){e=y(D,"LI",{});var P=C(e);t=y(P,"BUTTON",{class:!0});var I=C(t);l=y(I,"SPAN",{class:!0});var V=C(l);ve(n.$$.fragment,V),V.forEach(p),r=B(I),o=y(I,"DIV",{class:!0});var R=C(o);i=Z(R,a),R.forEach(p),I.forEach(p),P.forEach(p),c=B(D),d=y(D,"LI",{class:!0,title:!0});var M=C(d);A.l(M),M.forEach(p),g=B(D),_=y(D,"LI",{class:!0});var F=C(_);h=y(F,"BUTTON",{class:!0});var ee=C(h);S=Z(ee,v),ee.forEach(p),k=B(F),F.forEach(p),this.h()},h(){m(l,"class","px-1 py-1 rounded"),$(l,"text-green-500",s[35].selected),$(l,"text-gray-400",!s[35].selected),m(o,"class","ml-1 px-1 w-full bg-gray-200 svelte-1rg0xw5"),m(t,"class","flex items-center justify-center w-full select-btn svelte-1rg0xw5"),$(t,"hidden",s[8]),m(d,"class","intervals svelte-1rg0xw5"),m(d,"title",f=s[35].intervals.map(Cl).join("-")),m(h,"class","text-start"),m(_,"class","text-xs")},m(D,P){U(D,e,P),u(e,t),u(t,l),be(n,l,null),u(t,r),u(t,o),u(o,i),U(D,c,P),U(D,d,P),A.m(d,null),U(D,g,P),U(D,_,P),u(_,h),u(h,S),u(_,k),E=!0,L||(O=[J(t,"click",K),J(h,"click",w)],L=!0)},p(D,P){s=D;const I={};P[0]&64&&(I.icon=s[35].selected?cs:us),n.$set(I),(!E||P[0]&64)&&$(l,"text-green-500",s[35].selected),(!E||P[0]&64)&&$(l,"text-gray-400",!s[35].selected),(!E||P[0]&64)&&a!==(a=s[35].suffixes[0]+"")&&pe(i,a),(!E||P[0]&256)&&$(t,"hidden",s[8]),T===(T=N(s))&&A?A.p(s,P):(A.d(1),A=T(s),A&&(A.c(),A.m(d,null))),(!E||P[0]&64&&f!==(f=s[35].intervals.map(Cl).join("-")))&&m(d,"title",f),(!E||P[0]&64)&&v!==(v=s[35].name+"")&&pe(S,v)},i(D){E||(x(n.$$.fragment,D),E=!0)},o(D){q(n.$$.fragment,D),E=!1},d(D){D&&(p(e),p(c),p(d),p(g),p(_)),ye(n),A.d(),L=!1,Xe(O)}}}function No(s){let e,t,l,n,r="Chords",o,a,i,c,d,f,g,_,h,v,S,k,E,L,O,K,N,T="Key",A,w,D,P,I="Scale",V,R,M,F,ee="Note",ie,Y,z,G,le,H,se,ce,Ee,oe;c=new Ue({props:{icon:Rn,width:20}}),g=new Ue({props:{icon:Un,width:16}}),v=new Ue({props:{icon:s[5]?Qs:Xs,width:16}}),E=new Ue({props:{icon:Ft,width:16}}),R=new yn({props:{class:"bg-gray-100 w-48",containerClass:"input w-48",selected:s[1],options:s[10],onSelect:s[14]}});let he=de(s[7]),Q=[];for(let W=0;Wq(Q[W],1,1,()=>{Q[W]=null});let we=de(s[6]),fe=[];for(let W=0;Wq(fe[W],1,1,()=>{fe[W]=null});return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("button"),ge(g.$$.fragment),_=j(),h=b("button"),ge(v.$$.fragment),S=j(),k=b("button"),ge(E.$$.fragment),L=j(),O=b("div"),K=b("div"),N=b("label"),N.textContent=T,A=j(),w=b("input"),D=j(),P=b("label"),P.textContent=I,V=j(),ge(R.$$.fragment),M=j(),F=b("label"),F.textContent=ee,ie=j(),Y=b("input"),z=j(),G=b("ul");for(let W=0;Ws.interval,Cl=s=>s.interval;function So(s,e,t){let l,n,r,o,a,i,c,d,f;_e(s,nt,G=>t(30,a=G)),_e(s,lt,G=>t(31,i=G)),_e(s,Gt,G=>t(32,c=G)),_e(s,Rs,G=>t(24,d=G));let g="C",_="Major",h=Ut(g,_),v="",S,k=[],E=[];const O=_s().map(G=>({key:G.names[0],value:G.names[0]})),K=_t(Be(!0),{key:"chords-hidden"});_e(s,K,G=>t(8,f=G));function N(){K.update(G=>!G)}function T(){const G=S&&60+S.semitones;if("err"in h||!G)t(3,k=[]),t(4,E=[]);else{const le=h.data;t(3,k=n.map(H=>ns(G,le,H.intervals))),t(4,E=r.map(H=>ns(G,le,H.intervals)))}}function A({currentTarget:{value:G}}){t(0,g=`${G.charAt(0).toUpperCase()}${G.charAt(1).toLowerCase()}`),h=Ut(g,_),T()}function w(G){var le;return t(1,_=(le=O.find(H=>G===H.key))==null?void 0:le.value),h=Ut(g,_),T(),!1}function D({currentTarget:{value:G}}){t(2,v=`${G.charAt(0).toUpperCase()}${G.charAt(1).toLowerCase()}`),t(9,S=Gs(v)),T()}function P(G){Le.toggleChords(le=>le.name===G.name?!le.selected:le.selected)}function I(){const G=H=>H.suffixes[0]==="maj"||H.suffixes[0]==="m",le=d.filter(G).every(H=>H.selected);Le.toggleChords(H=>G(H)?!le:H.selected)}function V(){const G=H=>H.suffixes[0]==="maj7"||H.suffixes[0]==="m7"||H.suffixes[0]==="7"||H.suffixes[0]==="dim7"||H.suffixes[0]==="aug7",le=d.filter(G).every(H=>H.selected);Le.toggleChords(H=>G(H)?!le:H.selected)}function R(){Le.toggleChords(G=>!o)}function M(){Le.toggleChords(G=>!0)}function F(G){if("err"in h)return;const le=c[0].midi+((S==null?void 0:S.semitones)||0),H=ns(le,h.data,G.intervals);i==null||i.playChord(H.map(se=>se.midi),a.fixedVelocity)}const ee=G=>P(G),ie=G=>F(G),Y=G=>P(G),z=G=>F(G);return s.$$set=G=>{t(22,e=Ae(Ae({},e),Ne(G)))},s.$$.update=()=>{s.$$.dirty[0]&16777216&&t(23,l=d),s.$$.dirty[0]&8388608&&t(7,n=l.filter((G,le)=>lele>=l.length/2)),s.$$.dirty[0]&8388608&&t(5,o=l.every(G=>G.selected))},e=Ne(e),[g,_,v,k,E,o,r,n,f,S,O,K,N,A,w,D,P,I,V,R,M,F,e,l,d,ee,ie,Y,z]}class Do extends We{constructor(e){super(),qe(this,e,So,No,Je,{},null,[-1,-1])}}function Il(s,e,t){const l=s.slice();return l[12]=e[t],l}function Lo(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},p:me,i:me,o:me,d(t){t&&p(e)}}}function Po(s){let e,t,l="Played:",n,r=de(s[2]),o=[];for(let a=0;a0?4:5}t=d(s),l=c[t]=i[t](s);function f(h,v){return h[0]&&h[1]==="ended"?Uo:h[0]&&h[3].autoplay?Ro:h[0]?Mo:Go}let g=f(s),_=g(s);return{c(){e=b("div"),l.c(),r=j(),o=b("div"),_.c(),this.h()},l(h){e=y(h,"DIV",{class:!0});var v=C(e);l.l(v),v.forEach(p),r=B(h),o=y(h,"DIV",{class:!0});var S=C(o);_.l(S),S.forEach(p),this.h()},h(){m(e,"class",n=Ie(`${s[9].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),m(o,"class","mt-2 h-8 flex items-center")},m(h,v){U(h,e,v),c[t].m(e,null),U(h,r,v),U(h,o,v),_.m(o,null),a=!0},p(h,[v]){let S=t;t=d(h),t===S?c[t].p(h,v):(xe(),q(c[S],1,1,()=>{c[S]=null}),Fe(),l=c[t],l?l.p(h,v):(l=c[t]=i[t](h),l.c()),x(l,1),l.m(e,null)),(!a||v&512&&n!==(n=Ie(`${h[9].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"))&&m(e,"class",n),g===(g=f(h))&&_?_.p(h,v):(_.d(1),_=g(h),_&&(_.c(),_.m(o,null)))},i(h){a||(x(l),a=!0)},o(h){q(l),a=!1},d(h){h&&(p(e),p(r),p(o)),c[t].d(),_.d()}}}const Al=s=>s.note,Nl=s=>s.note;function xo(s,e,t){let l,n,r,o;_e(s,It,h=>t(11,l=h)),_e(s,dt,h=>t(1,n=h)),_e(s,yt,h=>t(2,r=h)),_e(s,mt,h=>t(3,o=h));let{game:a}=e;function i(){Le.nextGuess()}function c(){Le.setOptionValue("autoplay",!0),Le.nextGuess()}function d(){a instanceof ht?Le.play(a.type,a.opts):a&&Le.play(a.type,void 0)}function f(){Le.clearGame()}function g(h){const v=l.notesMap.get(h%12);return ft({midi:h,...v})}const _=()=>Le.setOptionValue("autoplay",!1);return s.$$set=h=>{t(9,e=Ae(Ae({},e),Ne(h))),"game"in h&&t(0,a=h.game)},e=Ne(e),[a,n,r,o,i,c,d,f,g,e,_]}class Fo extends We{constructor(e){super(),qe(this,e,xo,Ko,Je,{game:0})}}const Ds={ar:{name:"Arabic",import:Ce(()=>import("./arabic-TJdw9TqS.cd2ea0d3.js"),[],import.meta.url)},hye:{name:"Armenian Eastern",import:Ce(()=>import("./armenianEastern-LNw2V_Kb.e28a3752.js"),[],import.meta.url)},hyw:{name:"Armenian Western",import:Ce(()=>import("./armenianWestern-zmIyLd1o.38785f27.js"),[],import.meta.url)},be:{name:"Belarusian",import:Ce(()=>import("./belarusian--mjombxK.1fcd2897.js"),[],import.meta.url)},bn:{name:"Bengali",import:Ce(()=>import("./bengali-2-qmZ9ZL.b883376f.js"),[],import.meta.url)},pt:{name:"Brazilian",import:Ce(()=>import("./brazilian-_aUR_EdS.2b1b1fd9.js"),[],import.meta.url)},my:{name:"Burmese",import:Ce(()=>import("./burmese-DNLMDG0C.87e404a2.js"),[],import.meta.url)},zh:{name:"Chinese",import:Ce(()=>import("./chinese-Vv6o_huT.c292fc41.js"),[],import.meta.url)},cs:{name:"Czech",import:Ce(()=>import("./czech-AAz70GMU.0cffa7b5.js"),[],import.meta.url)},en:{name:"English",import:Promise.resolve().then(()=>zo)},fa:{name:"Farsi",import:Ce(()=>import("./farsi-akNUiiy1.62727da0.js"),[],import.meta.url)},fr:{name:"French",import:Ce(()=>import("./french-GKHnJmdK.94658ac4.js"),[],import.meta.url)},ka:{name:"Georgian",import:Ce(()=>import("./georgian-SQFgQD3n.89ef2935.js"),[],import.meta.url)},de:{name:"German",import:Ce(()=>import("./german-Wy-4wNPv.fa6f994f.js"),[],import.meta.url)},el:{name:"Greek",import:Ce(()=>import("./greek-lay7OJjb.9c2c2556.js"),[],import.meta.url)},he:{name:"Hebrew",import:Ce(()=>import("./hebrew-V6ZtD_jG.48875cb9.js"),[],import.meta.url)},hi:{name:"Hindi",import:Ce(()=>import("./hindi-uNDpRlqm.76d6c741.js"),[],import.meta.url)},hu:{name:"Hungarian",import:Ce(()=>import("./hungarian-Wnxix6n4.45652951.js"),[],import.meta.url)},it:{name:"Italian",import:Ce(()=>import("./italian-eDgp6wHT.50798155.js"),[],import.meta.url)},ja:{name:"Japanese",import:Ce(()=>import("./japanese-Zv_Q1DDl.d78f358a.js"),[],import.meta.url)},mk:{name:"Macedonian",import:Ce(()=>import("./macedonian-Dot-tKLH.04517113.js"),[],import.meta.url)},yo:{name:"Nigerian",import:Ce(()=>import("./nigerian-IYPkF_j3.5b26cce3.js"),[],import.meta.url)},nko:{name:"Nko",import:Ce(()=>import("./nko-EI8QPheE.3268d6cd.js"),[],import.meta.url)},no:{name:"Norwegian",import:Ce(()=>import("./norwegian-sal6SH2s.847bc0b5.js"),[],import.meta.url)},pl:{name:"Polish",import:Ce(()=>import("./polish-yYQdl0aw.936f6a15.js"),[],import.meta.url)},pa:{name:"Punjabi",import:Ce(()=>import("./punjabi-0AIiTj_p.01c98b73.js"),[],import.meta.url)},ru:{name:"Russian",import:Ce(()=>import("./russian-sQ885m4A.ff7543fb.js"),[],import.meta.url)},es:{name:"Spanish",import:Ce(()=>import("./spanish-Ww3zYGV_.0ed27470.js"),[],import.meta.url)},sv:{name:"Swedish",import:Ce(()=>import("./swedish-RpPWxHx_.af07bd5e.js"),[],import.meta.url)},te:{name:"Telugu",import:Ce(()=>import("./telugu-WPb3GXn5.f8d401d9.js"),[],import.meta.url)},th:{name:"Thai",import:Ce(()=>import("./thai-Q-LTk3Id.1148f3d0.js"),[],import.meta.url)},tr:{name:"Turkish",import:Ce(()=>import("./turkish-qQEi80RS.cb967a2e.js"),[],import.meta.url)},uk:{name:"Ukrainian",import:Ce(()=>import("./ukrainian-CLoogq0p.3e4781c0.js"),[],import.meta.url)},ug:{name:"Uyghur",import:Ce(()=>import("./uyghur-eF-99IjK.066cbfdb.js"),[],import.meta.url)}};function Tn(s){if(!("default"in s.layout)||!("shift"in s.layout))throw console.error(s),Error("Invalid layout import");return{default:s.layout.default,shift:s.layout.shift}}async function Ho(s=["en"]){let e={code:"en",layout:Ds.en,index:99};Object.entries(Ds).forEach(([l,n])=>{for(let r=0;rr)&&(e={code:l,layout:n,index:r})});const t=await e.layout.import;return{code:e.code,name:e.layout.name,imported:Tn(t.default)}}const An={layout:{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]}},zo=Object.freeze(Object.defineProperty({__proto__:null,default:An},Symbol.toStringTag,{value:"Module"})),Nn=[0,2,4,5,7,9,11],Sn=[1,3,-1,6,8,10,-1];function Wo(s,e,t){const l=s.keyType==="white"?Nn:Sn,n=l[t%l.length];let r;if(n>=0){r=e[n];const o=Math.floor(t/l.length);return{...r,semitones:r.semitones+(o>0?o:0)*12}}}function Ot(s,e,t=0,l=0){const n=s.keyType==="white"?Nn:Sn;let r=-1,o=0,a=0;return s.keys.forEach((i,c)=>{if(i.key.charAt(0)!=="{"&&c>=t&&r===-1?r=c:r!==-1&&i.key==="{empty}"&&(o+=1),r!==-1&&i.key.charAt(0)!=="{"){const d=c-o-r+l,f=n[d%n.length];if(f>=0){const g=e[f],_=Math.floor(d/n.length);i.note={...g,semitones:g.semitones+(_>0?_:0)*12},a=c-r}}}),{firstIndex:r,lastIndex:a}}const qo=[["IntlBackslash","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Digit0","Minus","Equal","Backspace"],["Tab","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Enter"],["Capslock","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","Backslash"],["ShiftLeft","Backquote","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","ShiftRight"]];function Jo(s,e){let t=[];const l=s.default.map((r,o)=>{if(o===0){const a=r.split(" ").filter(i=>i!=="{bksp}");for(;a.length!==13;)a.length<13?a.unshift("{empty}"):a.shift();return[...a,"{bksp}"]}else if(o===1){const a=r.split(" ");return t=a.slice(13),[...a.slice(0,13),"{enter}"]}else{if(o===2)return[...r.split(" ").slice(0,13).filter(a=>a!=="{enter}"),...t].slice(0,13);if(o===3){const a=["{shift}",...r.split(" ").slice(1,12).filter(c=>c!=="{shift}"),"{shift}"];let i=1;for(;a.length<13;)a.splice(i,0,"{empty}"),i=i===1?-1:1;return a}else return r.split(" ")}}),n=[0,1,2,3].map(r=>l[r].map((o,a)=>({key:o,code:qo[r][a]})));return[{keyType:e==="two-rows"?"black":void 0,startNoteOffset:2,availableNotes:11,keys:n[0]},{keyType:e==="two-rows"?"white":"black",startNoteOffset:e==="two-rows"?1:2,availableNotes:12,keys:n[1]},{keyType:e==="two-rows"?"black":"white",startNoteOffset:1,availableNotes:12,keys:n[2]},{keyType:e==="two-rows"?"white":void 0,startNoteOffset:1,availableNotes:11,keys:n[3]}]}const Sl=[{keyType:void 0,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:void 0,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:void 0,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:void 0,startNoteOffset:0,availableNotes:0,keys:[]}];class Dn{constructor(e){return this.rows=Sl,this.setCustomRow={row:Sl[0],rowIndex:0,nextKeyIdx:-1,nextNoteOffset:0},this.opts={hotkeydRows:"middle-row",isCustom:!1,layout:{code:"en",name:"English",imported:Tn(An)},...e},this.loadRowsFromImport(this.opts.layout.imported)}setOptions(e){this.opts={...this.opts,...e}}loadRowsFromImport(e){return this.rows=Jo(e,this.opts.hotkeydRows),this}setRows(e){return this.rows=e,this}setNotes(e){if(this.opts.hotkeydRows==="middle-row"){const{firstIndex:t}=Ot(this.rows[2],e);Ot(this.rows[1],e,1+t)}else{const{firstIndex:t,lastIndex:l}=Ot(this.rows[3],e);Ot(this.rows[2],e,t);const{firstIndex:n}=Ot(this.rows[1],e,0,l+1);Ot(this.rows[0],e,1+n,l+1)}}startSetCustomRow(e){const t={...this.rows[e],keys:this.rows[e].keys.map(a=>({...a}))},{availableNotes:l,startNoteOffset:n}=t,r=this.opts.hotkeydRows==="two-rows"&&(e===0||e===1)?3:-1,o=r!==-1?this.rows[r].keys.reduce((a,i)=>(a===-1&&i.note?a=0:a!==-1&&(i.key[0]!=="{"||i.key==="{empty}")&&(a+=1),a),-1)+1:0;return this.setCustomRow={row:t,rowIndex:e,nextKeyIdx:n,nextNoteOffset:o},{first:n,count:l}}setNextCustomNote(e,t,l){let n;const{nextKeyIdx:r,nextNoteOffset:o,row:a}=this.setCustomRow,i=r+o-a.startNoteOffset,c=Wo(a,l,i);return c?n={key:e,code:t,note:c}:n={key:e,code:t},this.setCustomRow.nextKeyIdx+=1,{index:this.setCustomRow.nextKeyIdx,key:n}}skipNextCustomNote(){return this.setCustomRow.nextKeyIdx+=1,this.setCustomRow.nextNoteOffset-=1,{index:this.setCustomRow.nextKeyIdx,key:{code:"EMPTY",key:"{empty}"}}}}function $o(s){const e=[...s.map(t=>t.keys.map(l=>l.key).join(" ")),""];return{default:e,shift:e}}function Dl(s,e,t){const l=s.slice();return l[15]=e[t].key,l[16]=e[t].value,l[17]=e[t].icon,l[19]=t,l}const Yo=s=>({}),Ll=s=>({}),Qo=s=>({}),Pl=s=>({});function Ol(s){let e,t,l,n,r,o,a,i,c,d,f;const g=s[12].header,_=Ps(g,s,s[11],Ll);let h=de(s[0]),v=[];for(let k=0;kq(v[k],1,1,()=>{v[k]=null});return{c(){e=b("button"),l=j(),n=b("ul"),r=b("li"),_&&_.c(),o=j();for(let k=0;k{c&&(t||(t=Et(e,rs,{duration:ss},!0)),t.run(1))}),x(_,k);for(let E=0;E{c&&(i||(i=Et(n,as,{duration:ss},!0)),i.run(1))}),c=!0}},o(k){k&&(t||(t=Et(e,rs,{duration:ss},!1)),t.run(0)),q(_,k),v=v.filter(Boolean);for(let E=0;E{h[L]=null}),Fe(),n=h[l],n?n.p(s,E):(n=h[l]=_[l](s),n.c()),x(n,1),n.m(t,r)),(!d||E&1)&&a!==(a=s[16]+"")&&pe(i,a),(!d||E&9)&&$(t,"selected",s[15]===s[3])},i(k){d||(x(n),d=!0)},o(k){q(n),d=!1},d(k){k&&p(e),h[l].d(),f=!1,g()}}}function er(s){let e,t,l,n,r,o,a,i,c;const d=s[12].value,f=Ps(d,s,s[11],Pl);let g=s[6]&&Ol(s);return{c(){e=b("div"),t=b("button"),f&&f.c(),r=j(),g&&g.c(),this.h()},l(_){e=y(_,"DIV",{class:!0,id:!0});var h=C(e);t=y(h,"BUTTON",{class:!0,title:!0});var v=C(t);f&&f.l(v),v.forEach(p),r=B(h),g&&g.l(h),h.forEach(p),this.h()},h(){m(t,"class",l=Ie(`${s[9].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),m(t,"title",n=s[9].title||""),$(t,"disabled",s[4]),$(t,"open",s[6]),m(e,"class",o=Ie(`relative ${s[2]||""}`)+" svelte-h65upg"),m(e,"id",s[1])},m(_,h){U(_,e,h),u(e,t),f&&f.m(t,null),u(e,r),g&&g.m(e,null),s[14](e),a=!0,i||(c=J(t,"click",s[7]),i=!0)},p(_,[h]){f&&f.p&&(!a||h&2048)&&Os(f,d,_,_[11],a?js(d,_[11],h,Qo):Vs(_[11]),Pl),(!a||h&512&&l!==(l=Ie(`${_[9].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&m(t,"class",l),(!a||h&512&&n!==(n=_[9].title||""))&&m(t,"title",n),(!a||h&528)&&$(t,"disabled",_[4]),(!a||h&576)&&$(t,"open",_[6]),_[6]?g?(g.p(_,h),h&64&&x(g,1)):(g=Ol(_),g.c(),x(g,1),g.m(e,null)):g&&(xe(),q(g,1,1,()=>{g=null}),Fe()),(!a||h&4&&o!==(o=Ie(`relative ${_[2]||""}`)+" svelte-h65upg"))&&m(e,"class",o),(!a||h&2)&&m(e,"id",_[1])},i(_){a||(x(f,_),x(g),a=!0)},o(_){q(f,_),q(g),a=!1},d(_){_&&p(e),f&&f.d(_),g&&g.d(),s[14](null),i=!1,c()}}}const ss=400;function tr(s,e,t){let{$$slots:l={},$$scope:n}=e,{options:r,id:o=void 0,containerClass:a=void 0,selected:i=void 0,disabled:c=void 0,onSelect:d}=e,f,g=!1;function _(){c||t(6,g=!g)}function h(k){t(6,g=d(k))}const v=k=>h(k);function S(k){Bs[k?"unshift":"push"](()=>{f=k,t(5,f)})}return s.$$set=k=>{t(9,e=Ae(Ae({},e),Ne(k))),"options"in k&&t(0,r=k.options),"id"in k&&t(1,o=k.id),"containerClass"in k&&t(2,a=k.containerClass),"selected"in k&&t(3,i=k.selected),"disabled"in k&&t(4,c=k.disabled),"onSelect"in k&&t(10,d=k.onSelect),"$$scope"in k&&t(11,n=k.$$scope)},e=Ne(e),[r,o,a,i,c,f,g,_,h,e,d,n,l,v,S]}class sr extends We{constructor(e){super(),qe(this,e,tr,er,Je,{options:0,id:1,containerClass:2,selected:3,disabled:4,onSelect:10})}}function lr(s){let e,t,l,n,r,o,a;return{c(){e=b("label"),t=b("input"),l=j(),n=b("div"),this.h()},l(i){e=y(i,"LABEL",{class:!0});var c=C(e);t=y(c,"INPUT",{type:!0,class:!0}),l=B(c),n=y(c,"DIV",{class:!0}),C(n).forEach(p),c.forEach(p),this.h()},h(){t.checked=s[0],m(t,"type","checkbox"),m(t,"class","svelte-k5zciy"),m(n,"class","slider svelte-k5zciy"),m(e,"class",r=Ie(`${s[3].class||""} toggle`)+" svelte-k5zciy")},m(i,c){U(i,e,c),u(e,t),s[5](t),u(e,l),u(e,n),o||(a=[J(t,"change",s[4]),J(t,"keydown",s[2])],o=!0)},p(i,[c]){c&1&&(t.checked=i[0]),c&8&&r!==(r=Ie(`${i[3].class||""} toggle`)+" svelte-k5zciy")&&m(e,"class",r)},i:me,o:me,d(i){i&&p(e),s[5](null),o=!1,Xe(a)}}}function nr(s,e,t){let{checked:l}=e,n;function r(i){i.key==="Enter"&&n.click()}function o(i){ms.call(this,s,i)}function a(i){Bs[i?"unshift":"push"](()=>{n=i,t(1,n)})}return s.$$set=i=>{t(3,e=Ae(Ae({},e),Ne(i))),"checked"in i&&t(0,l=i.checked)},e=Ne(e),[l,n,r,e,o,a]}class or extends We{constructor(e){super(),qe(this,e,nr,lr,Je,{checked:0})}}function rr(s,e,t){return e==="Escape"?{e:"hotkeys-cancel"}:e==="Space"?{e:"hotkeys-skip-key"}:s.has(e)?{e:"hotkeys-no-key"}:(s.add(e),{e:"hotkeys-captured-key",data:{code:e,key:t}})}const Us=/^[a-gA-G]$/,Ln=/^[♭Bb#♯sS]$/,ar=/^[0-9]$/;let te="",Qe;function ir(s,e){const{useHotkeys:t}=Te(nt),l=Te(xs).get(s);if(t&&te.length===0&&l&&l.note)return te="",{e:"guessed-key",data:l.note.note};if(!t&&te.length===0&&Us.test(e))return te+=e.toUpperCase(),{e:"string",data:te};if(!t&&te.length>0&&Ln.test(e))return e==="b"||e==="B"?te+="♭":te+="♯",{e:"string",data:te};if(s==="Backspace"&&te.length>0)return te=te.slice(0,-1),{e:"string",data:te};if(s==="Enter"&&te.length>0){const n=te;return te="",{e:"guessed-key",data:n}}return!1}function cr(s,e){if(s==="Enter"&&te.length>0){const t={note:"",flats:0,sharps:0,chord:""};for(let l=0;l0?t.chord+=te[l].toLowerCase():te[l]==="♭"?(t.note+=te[l],t.flats+=1):te[l]==="♯"?(t.note+=te[l],t.sharps+=1):t.chord+=te[l].toLowerCase();return te="",{e:"guessed-chord",data:t}}else{if(s==="Backspace"&&te.length>0)return te=te.slice(0,-1),{e:"string",data:te};if(te.length===0&&Us.test(e))return te+=e.toUpperCase(),{e:"string",data:te};if(te.length>0&&e.length===1)return te.length===1&&(e==="b"||e==="B")?te+="♭":te.length===1&&e==="#"?te+="♯":te+=e,{e:"string",data:te}}return!1}function ur(s,e,t){const{useAutoOctave:l,useHotkeys:n}=Te(nt);let r;const a=Te(xs).get(s),i=(a==null?void 0:a.key)||"";let c=!1;if(!Qe&&n&&(a!=null&&a.note)?(Qe=a.note,l&&(r=fs({midi:Te(Gt)[0].midi,flats:0,sharps:0})),c="note"):!n&&te.length===0&&Us.test(e)?(te+=e.toUpperCase(),c="input"):!n&&te.length>0&&Ln.test(e)?(e==="b"||e==="B"?te+="♭":te+="♯",c="input"):!n&&te.length>0&&s==="Enter"&&l&&(r=fs({midi:Te(Gt)[0].midi,flats:0,sharps:0}),c="octave"),!c&&ar.test(i))try{r=parseInt(i),c="octave"}catch{}if(c&&(Qe||te)&&r!==void 0){const d=(Qe==null?void 0:Qe.note)??te;return t&&(r+=1),Qe&&(Qe==null?void 0:Qe.semitones)>=12&&(r+=Math.floor(Qe.semitones/12)),Qe=void 0,te="",{e:"guessed-note",data:{note:d,octave:r}}}else if(s==="Backspace"&&(Qe||te.length>0))return Qe=void 0,te=te.slice(0,-1),{e:"string",data:te};return c==="note"?{e:"note",data:Qe}:c==="input"?{e:"string",data:te}:!1}const Ks={code:"en",name:"English",imported:{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]}},ls=new Set,fr=new Dn({layout:Ks}),kt=Be(void 0);Mt(kt,s=>s?[s.rowIndex,s.nextIndex]:[-1,-1]);const wt=_t(Be({isCustom:!1,layout:Ks,hotkeydRows:"middle-row"}),{key:"keyboard-options"}),xt=Be(fr.rows),hs=Mt([It,wt],([s,e])=>{const t=new Dn(e);return t.setNotes(Array.from(s.notesMap.values())),xt.set(t.rows),t}),xs=Mt(hs,s=>new Map([...s.rows[0].keys.map(e=>[e.code,e]),...s.rows[1].keys.map(e=>[e.code,e]),...s.rows[2].keys.map(e=>[e.code,e]),...s.rows[3].keys.map(e=>[e.code,e])])),dr=Mt(xs,s=>Array.from(s.values()).map(e=>e.note).filter(e=>e!==void 0).sort((e,t)=>e.semitones-t.semitones)),it={async setLayout(s){const e=await Ho(s),t=Te(wt);e.code!==t.layout.code&&wt.update(l=>({...l,isCustom:!1,layout:e}))},setCustomLayout(s){s?wt.update(e=>({...e,isCustom:s,layout:{code:"custom",name:"Custom",imported:e.layout.imported}})):this.setLayout(navigator.languages)},toggleRows(s){wt.update(e=>({...e,hotkeydRows:s??(e.hotkeydRows==="middle-row"?"two-rows":"middle-row")}))},captureHotkeyRow(s){const e=Te(hs),t=Te(It),{first:l,count:n}=e.startSetCustomRow(s);kt.set({nextIndex:l,rowIndex:s,count:n,scaleNotes:Array.from(t.notesMap.values())})},findNote(s){return Te(dr).find(e=>{if(e.note.charAt(0)===s.charAt(0)){const t=s.slice(1).split("").reduce((l,n)=>l+(n.toLowerCase()==="b"||n==="♭"?-1:n.toLowerCase()==="s"||n==="#"||n==="♯"?1:0),0);return t>0?e.sharps===t:t<0?e.flats===t*-1:e.flats===0&&e.sharps===0}})},handleHotkeyInput(s,e,t){const l=rr(ls,e,t),n=Te(hs);let r;const o=n.setCustomRow.nextKeyIdx;l.e==="hotkeys-cancel"?(kt.set(void 0),ls.clear()):l.e==="hotkeys-skip-key"?r=n.skipNextCustomNote():l.e==="hotkeys-captured-key"&&(r=n.setNextCustomNote(l.data.key,l.data.code,s.scaleNotes));const a=Te(xt);if(r&&(a[s.rowIndex].keys[o]=r.key,xt.set(a),kt.update(i=>i?{...i,nextIndex:r.index}:void 0)),s.count===o){const i=$o(a);wt.update(c=>({...c,layout:{...c.layout,imported:i}})),kt.set(void 0),ls.clear()}return l},handleInput(s,e,t=!1){const l=Te(Ct),n=Te(kt);return n?this.handleHotkeyInput(n,s,e):l instanceof Kt?ir(s,e.toUpperCase()):l instanceof ht&&l.type==="chords-write"?cr(s,e):Te(nt).useKeyboard?ur(s,e.toUpperCase(),t):!1},cancelCapture(){kt.set(void 0),ls.clear()},reset(){wt.set({isCustom:!1,layout:Ks,hotkeydRows:"middle-row"})}};function jl(s){let e;return{c(){e=b("li"),this.h()},l(t){e=y(t,"LI",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","m-[0.175rem] mr-0")},m(t,l){U(t,e,l)},d(t){t&&p(e)}}}function Bl(s){let e;return{c(){e=b("div"),this.h()},l(t){e=y(t,"DIV",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-1479mcy")},m(t,l){U(t,e,l)},d(t){t&&p(e)}}}function Gl(s){let e,t=s[0].note.note+"",l,n;return{c(){e=b("div"),l=X(t),n=X(s[3]),this.h()},l(r){e=y(r,"DIV",{class:!0});var o=C(e);l=Z(o,t),n=Z(o,s[3]),o.forEach(p),this.h()},h(){m(e,"class","absolute top-0 left-0")},m(r,o){U(r,e,o),u(e,l),u(e,n)},p(r,o){o&1&&t!==(t=r[0].note.note+"")&&pe(l,t),o&8&&pe(n,r[3])},d(r){r&&p(e)}}}function hr(s){let e,t,l,n,r,o,a=Rl(s[0].key)+"",i,c,d,f,g=s[0].key==="{enter}"&&jl(),_=s[0].key==="{enter}"&&Bl(),h=s[0].note&&Gl(s);return{c(){g&&g.c(),e=j(),t=b("li"),l=b("button"),_&&_.c(),n=j(),h&&h.c(),r=j(),o=b("div"),i=X(a),this.h()},l(v){g&&g.l(v),e=B(v),t=y(v,"LI",{class:!0});var S=C(t);l=y(S,"BUTTON",{class:!0});var k=C(l);_&&_.l(k),n=B(k),h&&h.l(k),r=B(k),o=y(k,"DIV",{});var E=C(o);i=Z(E,a),E.forEach(p),k.forEach(p),S.forEach(p),this.h()},h(){m(l,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex justify-center svelte-1479mcy"),$(l,"items-center",!s[0].note),$(l,"items-end",s[0].note),m(t,"class",c=Ie(`${s[4].class||""} m-[0.175rem] ${Ml(s[1])} min-w-[32px]`)+" svelte-1479mcy"),$(t,"enter",s[0].key==="{enter}"),$(t,"captured",s[2])},m(v,S){g&&g.m(v,S),U(v,e,S),U(v,t,S),u(t,l),_&&_.m(l,null),u(l,n),h&&h.m(l,null),u(l,r),u(l,o),u(o,i),d||(f=J(l,"click",s[10]),d=!0)},p(v,[S]){v[0].key==="{enter}"?g||(g=jl(),g.c(),g.m(e.parentNode,e)):g&&(g.d(1),g=null),v[0].key==="{enter}"?_||(_=Bl(),_.c(),_.m(l,n)):_&&(_.d(1),_=null),v[0].note?h?h.p(v,S):(h=Gl(v),h.c(),h.m(l,r)):h&&(h.d(1),h=null),S&1&&a!==(a=Rl(v[0].key)+"")&&pe(i,a),S&1&&$(l,"items-center",!v[0].note),S&1&&$(l,"items-end",v[0].note),S&18&&c!==(c=Ie(`${v[4].class||""} m-[0.175rem] ${Ml(v[1])} min-w-[32px]`)+" svelte-1479mcy")&&m(t,"class",c),S&19&&$(t,"enter",v[0].key==="{enter}"),S&22&&$(t,"captured",v[2])},i:me,o:me,d(v){v&&(p(e),p(t)),g&&g.d(v),_&&_.d(),h&&h.d(),d=!1,f()}}}function Ml(s){return s&&Number.isInteger(s)?`size-${s}`:s?`size-${Math.floor(s)}-${Math.floor(s*10)-Math.floor(s)*10}`:"size-1"}function Rl(s){return s==="{empty}"?"":s==="{bksp}"?"Backspace":s==="{tab}"?"Tab":s==="{enter}"?"Enter":s==="{lock}"?"Capslock":s==="{shift}"?"Shift":s}function mr(s,e,t){let l,n,r,o,a,i;_e(s,kt,_=>t(7,o=_)),_e(s,ps,_=>t(8,a=_)),_e(s,xt,_=>t(9,i=_));let{rowIndex:c,keyIndex:d}=e,f;function g(_){ms.call(this,s,_)}return s.$$set=_=>{t(4,e=Ae(Ae({},e),Ne(_))),"rowIndex"in _&&t(5,c=_.rowIndex),"keyIndex"in _&&t(6,d=_.keyIndex)},s.$$.update=()=>{s.$$.dirty&608&&t(0,l=i[c].keys[d]),s.$$.dirty&257&&t(3,n=l.note?fs({midi:l.note.semitones+a[0],flats:0,sharps:0}):0),s.$$.dirty&224&&t(2,r=o&&o.rowIndex===c&&o.nextIndex===d),s.$$.dirty&65&&(l.key==="{bksp}"?t(1,f=2):l.key==="{tab}"?t(1,f=1.5):l.key==="{enter}"?t(1,f=2):l.key==="{lock}"?t(1,f=1.75):l.key==="{shift}"&&d===0?t(1,f=1.5):l.key==="{shift}"?t(1,f=2.5):t(1,f=1))},e=Ne(e),[l,f,r,n,e,c,d,o,a,i,g]}class _r extends We{constructor(e){super(),qe(this,e,mr,hr,Je,{rowIndex:5,keyIndex:6})}}function Ul(s,e,t){const l=s.slice();return l[13]=e[t],l[15]=t,l}function Kl(s,e,t){const l=s.slice();return l[16]=e[t],l[18]=t,l}function pr(s){let e,t=s[0].layout.name+"",l;return{c(){e=b("div"),l=X(t),this.h()},l(n){e=y(n,"DIV",{slot:!0});var r=C(e);l=Z(r,t),r.forEach(p),this.h()},h(){m(e,"slot","value")},m(n,r){U(n,e,r),u(e,l)},p(n,r){r&1&&t!==(t=n[0].layout.name+"")&&pe(l,t)},d(n){n&&p(e)}}}function xl(s){let e,t,l,n,r;t=new Ue({props:{icon:Kn,width:20}});function o(){return s[12](s[15])}return{c(){e=b("button"),ge(t.$$.fragment),this.h()},l(a){e=y(a,"BUTTON",{class:!0});var i=C(e);ve(t.$$.fragment,i),i.forEach(p),this.h()},h(){m(e,"class","flex items-center justify-center rounded w-full h-full hover:bg-gray-300")},m(a,i){U(a,e,i),be(t,e,null),l=!0,n||(r=J(e,"click",o),n=!0)},p(a,i){s=a},i(a){l||(x(t.$$.fragment,a),l=!0)},o(a){q(t.$$.fragment,a),l=!1},d(a){a&&p(e),ye(t),n=!1,r()}}}function Fl(s){let e,t;return e=new _r({props:{rowIndex:s[15],keyIndex:s[18]}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},p:me,i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){q(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function Hl(s){let e,t,l,n,r=s[2][s[15]]&&s[0].isCustom&&xl(s),o=de(s[13].keys),a=[];for(let c=0;cq(a[c],1,1,()=>{a[c]=null});return{c(){e=b("li"),r&&r.c(),t=j();for(let c=0;c{r=null}),Fe()),d&8){o=de(c[13].keys);let f;for(f=0;fq(G[H],1,1,()=>{G[H]=null});return{c(){e=b("div"),t=b("div"),l=b("div"),n=b("div"),r=b("label"),r.textContent=o,a=j(),ge(i.$$.fragment),c=j(),d=b("div"),f=b("label"),f.textContent=g,_=j(),h=b("input"),S=j(),k=b("div"),E=b("label"),E.textContent=L,O=j(),ge(K.$$.fragment),N=j(),T=b("label"),T.textContent=A,w=j(),D=b("div"),P=b("button"),ge(I.$$.fragment),V=j(),R=b("div"),M=b("ul");for(let H=0;Ht(0,r=v)),_e(s,xt,v=>t(11,o=v)),_e(s,hs,v=>t(3,a=v)),bn(()=>{a.opts.isCustom||it.setLayout(navigator.languages)});const i=Object.entries(Ds).map(([v,S])=>({key:v,value:S.name}));function c(){it.reset(),it.setLayout(navigator.languages)}function d(v){return it.setLayout([v]),!1}function f(v){it.setCustomLayout(v.currentTarget.checked)}function g(v){it.captureHotkeyRow(v)}function _(){it.toggleRows()}const h=v=>g(v);return s.$$set=v=>{t(10,e=Ae(Ae({},e),Ne(v)))},s.$$.update=()=>{s.$$.dirty&2049&&t(2,l=o.map((v,S)=>r.hotkeydRows==="middle-row"?S===1||S===2:!0)),s.$$.dirty&1&&t(1,n=r.hotkeydRows==="middle-row")},e=Ne(e),[r,n,l,a,i,c,d,f,g,_,e,o,h]}class br extends We{constructor(e){super(),qe(this,e,vr,gr,Je,{})}}function zl(s){let e,t;return e=new br({props:{class:"mt-4"}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){q(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function yr(s){let e,t,l,n,r="I/O",o,a,i,c,d,f,g,_,h="Device",v,S,k,E,L,O,K="Prompt",N,T,A="Disable",w,D,P,I,V="Sound",R,M,F,ee,ie,Y,z="Fixed velocity",G,le,H,se,ce,Ee,oe="Keyboard",he,Q,ue,we,fe,He,W="Hotkeys",re,ke,tt,ne,Ve,Me,pt="Auto-octave",At,ze,Ke,Nt,st,$e,Fs=" ",gs,St,ct,vs,Ht,bs,gt,vt,Hs="Fade timeout",ys,ut,ks,zt,Ye,ws,zs;c=new Ue({props:{icon:Ft,width:16}});let Ge=s[2]&&!s[4]&&zl();return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("div"),g=b("div"),_=b("label"),_.textContent=h,v=j(),S=b("input"),E=j(),L=b("div"),O=b("button"),O.textContent=K,N=j(),T=b("button"),T.textContent=A,w=j(),D=b("div"),P=b("div"),I=b("label"),I.textContent=V,R=j(),M=b("input"),ee=j(),ie=b("div"),Y=b("label"),Y.textContent=z,G=j(),le=b("input"),H=j(),se=b("div"),ce=b("div"),Ee=b("label"),Ee.textContent=oe,he=j(),Q=b("input"),we=j(),fe=b("div"),He=b("label"),He.textContent=W,re=j(),ke=b("input"),ne=j(),Ve=b("div"),Me=b("label"),Me.textContent=pt,At=j(),ze=b("input"),Nt=j(),st=b("div"),$e=b("div"),$e.textContent=Fs,gs=j(),St=b("div"),ct=b("button"),vs=X("Set hotkeys"),bs=j(),gt=b("div"),vt=b("label"),vt.textContent=Hs,ys=j(),ut=b("input"),ks=j(),Ge&&Ge.c(),this.h()},l(Se){e=y(Se,"DIV",{class:!0});var Re=C(e);t=y(Re,"FIELDSET",{class:!0});var ot=C(t);l=y(ot,"LEGEND",{class:!0});var Ws=C(l);n=y(Ws,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(n)!=="svelte-1jbbsti"&&(n.textContent=r),Ws.forEach(p),o=B(ot),a=y(ot,"DIV",{class:!0});var qs=C(a);i=y(qs,"BUTTON",{class:!0});var Js=C(i);ve(c.$$.fragment,Js),Js.forEach(p),qs.forEach(p),d=B(ot),f=y(ot,"DIV",{class:!0});var bt=C(f);g=y(bt,"DIV",{class:!0});var Dt=C(g);_=y(Dt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(_)!=="svelte-crpa7y"&&(_.textContent=h),v=B(Dt),S=y(Dt,"INPUT",{class:!0,id:!0}),E=B(Dt),L=y(Dt,"DIV",{class:!0});var Wt=C(L);O=y(Wt,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(O)!=="svelte-mj6mct"&&(O.textContent=K),N=B(Wt),T=y(Wt,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(T)!=="svelte-1sl6oxh"&&(T.textContent=A),Wt.forEach(p),Dt.forEach(p),w=B(bt),D=y(bt,"DIV",{class:!0});var qt=C(D);P=y(qt,"DIV",{class:!0});var Jt=C(P);I=y(Jt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(I)!=="svelte-wgxtkw"&&(I.textContent=V),R=B(Jt),M=y(Jt,"INPUT",{class:!0,id:!0,type:!0}),Jt.forEach(p),ee=B(qt),ie=y(qt,"DIV",{class:!0});var $t=C(ie);Y=y($t,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Y)!=="svelte-1tm2bth"&&(Y.textContent=z),G=B($t),le=y($t,"INPUT",{class:!0,id:!0,placeholder:!0}),$t.forEach(p),qt.forEach(p),H=B(bt),se=y(bt,"DIV",{class:!0});var Lt=C(se);ce=y(Lt,"DIV",{class:!0});var Yt=C(ce);Ee=y(Yt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Ee)!=="svelte-1js269u"&&(Ee.textContent=oe),he=B(Yt),Q=y(Yt,"INPUT",{class:!0,id:!0,type:!0}),Yt.forEach(p),we=B(Lt),fe=y(Lt,"DIV",{class:!0});var Qt=C(fe);He=y(Qt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(He)!=="svelte-21h39k"&&(He.textContent=W),re=B(Qt),ke=y(Qt,"INPUT",{class:!0,id:!0,type:!0}),Qt.forEach(p),ne=B(Lt),Ve=y(Lt,"DIV",{class:!0});var Xt=C(Ve);Me=y(Xt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Me)!=="svelte-33lczu"&&(Me.textContent=pt),At=B(Xt),ze=y(Xt,"INPUT",{class:!0,id:!0,type:!0}),Xt.forEach(p),Lt.forEach(p),Nt=B(bt),st=y(bt,"DIV",{class:!0});var Pt=C(st);$e=y(Pt,"DIV",{class:!0,"data-svelte-h":!0}),ae($e)!=="svelte-dgefms"&&($e.textContent=Fs),gs=B(Pt),St=y(Pt,"DIV",{class:!0});var $s=C(St);ct=y($s,"BUTTON",{class:!0});var Ys=C(ct);vs=Z(Ys,"Set hotkeys"),Ys.forEach(p),$s.forEach(p),bs=B(Pt),gt=y(Pt,"DIV",{class:!0});var Zt=C(gt);vt=y(Zt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(vt)!=="svelte-vd5i27"&&(vt.textContent=Hs),ys=B(Zt),ut=y(Zt,"INPUT",{class:!0,id:!0}),Zt.forEach(p),Pt.forEach(p),bt.forEach(p),ks=B(ot),Ge&&Ge.l(ot),ot.forEach(p),Re.forEach(p),this.h()},h(){var Se;m(n,"class","px-1 rounded hover:bg-gray-100"),m(l,"class","text-base"),m(i,"class","rounded px-1 py-1 hover:bg-gray-200"),m(a,"class","absolute top-[-0.25rem] right-[0.5rem] flex items-center justify-center"),$(a,"hidden",s[4]),m(_,"class","font-bold"),m(_,"for","device"),m(S,"class","px-1 my-1 rounded w-50"),m(S,"id","device"),S.disabled=!0,S.value=k=((Se=s[5])==null?void 0:Se.name)??"No device",m(O,"class","btn-sm primary mr-2"),m(T,"class","btn-sm primary"),m(L,"class","flex my-[auto]"),m(g,"class","h-full flex flex-col"),m(I,"class","font-bold"),m(I,"for","sound"),m(M,"class","h-[20px]"),m(M,"id","sound"),m(M,"type","checkbox"),M.checked=F=s[3].useSound,m(P,"class","my-1 flex justify-between mr-12"),m(Y,"class","font-bold"),m(Y,"for","fixed-velocity"),m(le,"class","h-[20px] w-16"),m(le,"id","fixed-velocity"),m(le,"placeholder","0-127"),m(ie,"class","flex justify-between"),m(D,"class","flex flex-col h-full"),m(Ee,"class","font-bold"),m(Ee,"for","keyboard"),m(Q,"class","h-[20px]"),m(Q,"id","keyboard"),m(Q,"type","checkbox"),Q.checked=ue=s[3].useKeyboard,m(ce,"class","my-1 flex justify-between mr-12"),m(He,"class","font-bold"),m(He,"for","hotkeys"),m(ke,"class","h-[20px]"),m(ke,"id","hotkeys"),m(ke,"type","checkbox"),ke.checked=tt=s[3].useHotkeys,m(fe,"class","my-1 flex justify-between mr-12"),m(Me,"class","font-bold"),m(Me,"for","auto-octave"),m(ze,"class","h-[20px]"),m(ze,"id","auto-octave"),m(ze,"type","checkbox"),ze.checked=Ke=s[3].useAutoOctave,m(Ve,"class","my-1 flex justify-between mr-12"),m(se,"class","flex flex-col h-full"),m($e,"class","h-[28px]"),m(ct,"class","w-full btn-sm primary"),ct.disabled=Ht=!s[3].useHotkeys,m(St,"class","my-[2px] flex justify-between"),m(vt,"class","font-bold"),m(vt,"for","fade-timeout"),m(ut,"class","h-[20px] w-16"),m(ut,"id","fade-timeout"),ut.value=s[1],m(gt,"class","my-1 flex justify-between"),m(st,"class","flex flex-col h-full"),m(f,"class","body svelte-1bpw69s"),$(f,"hidden",s[4]),m(t,"class","relative flex flex-col max-w-full rounded border-2 px-4 pt-2 pb-4 my-4 text-sm svelte-1bpw69s"),$(t,"collapsed",s[4]),m(e,"class",zt=Ie(`${s[12].class||""}`)+" svelte-1bpw69s")},m(Se,Re){U(Se,e,Re),u(e,t),u(t,l),u(l,n),u(t,o),u(t,a),u(a,i),be(c,i,null),u(t,d),u(t,f),u(f,g),u(g,_),u(g,v),u(g,S),u(g,E),u(g,L),u(L,O),u(L,N),u(L,T),u(f,w),u(f,D),u(D,P),u(P,I),u(P,R),u(P,M),u(D,ee),u(D,ie),u(ie,Y),u(ie,G),u(ie,le),et(le,s[0]),u(f,H),u(f,se),u(se,ce),u(ce,Ee),u(ce,he),u(ce,Q),u(se,we),u(se,fe),u(fe,He),u(fe,re),u(fe,ke),u(se,ne),u(se,Ve),u(Ve,Me),u(Ve,At),u(Ve,ze),u(f,Nt),u(f,st),u(st,$e),u(st,gs),u(st,St),u(St,ct),u(ct,vs),u(st,bs),u(st,gt),u(gt,vt),u(gt,ys),u(gt,ut),u(t,ks),Ge&&Ge.m(t,null),Ye=!0,ws||(zs=[J(n,"click",s[7]),J(i,"click",s[11]),J(O,"click",je.openMidi),J(T,"click",je.disableMidi),J(M,"change",s[13]),J(le,"input",s[14]),J(le,"change",s[8]),J(Q,"change",s[15]),J(ke,"change",s[9]),J(ze,"change",s[16]),J(ct,"click",s[17]),J(ut,"input",s[10])],ws=!0)},p(Se,[Re]){var ot;(!Ye||Re&16)&&$(a,"hidden",Se[4]),(!Ye||Re&32&&k!==(k=((ot=Se[5])==null?void 0:ot.name)??"No device")&&S.value!==k)&&(S.value=k),(!Ye||Re&8&&F!==(F=Se[3].useSound))&&(M.checked=F),Re&1&&le.value!==Se[0]&&et(le,Se[0]),(!Ye||Re&8&&ue!==(ue=Se[3].useKeyboard))&&(Q.checked=ue),(!Ye||Re&8&&tt!==(tt=Se[3].useHotkeys))&&(ke.checked=tt),(!Ye||Re&8&&Ke!==(Ke=Se[3].useAutoOctave))&&(ze.checked=Ke),(!Ye||Re&8&&Ht!==(Ht=!Se[3].useHotkeys))&&(ct.disabled=Ht),(!Ye||Re&2&&ut.value!==Se[1])&&(ut.value=Se[1]),(!Ye||Re&16)&&$(f,"hidden",Se[4]),Se[2]&&!Se[4]?Ge?Re&20&&x(Ge,1):(Ge=zl(),Ge.c(),x(Ge,1),Ge.m(t,null)):Ge&&(xe(),q(Ge,1,1,()=>{Ge=null}),Fe()),(!Ye||Re&16)&&$(t,"collapsed",Se[4]),(!Ye||Re&4096&&zt!==(zt=Ie(`${Se[12].class||""}`)+" svelte-1bpw69s"))&&m(e,"class",zt)},i(Se){Ye||(x(c.$$.fragment,Se),x(Ge),Ye=!0)},o(Se){q(c.$$.fragment,Se),q(Ge),Ye=!1},d(Se){Se&&p(e),ye(c),Ge&&Ge.d(),ws=!1,Xe(zs)}}}function kr(s,e,t){let l,n,r;_e(s,nt,O=>t(3,l=O)),_e(s,ds,O=>t(5,r=O));const o=_t(Be(!1),{key:"inputs-hidden"});_e(s,o,O=>t(4,n=O));let a=l.fixedVelocity??"",i=l.keyFadeTimeout,c=!1;nt.subscribe(O=>{t(0,a=O.fixedVelocity??""),t(1,i=O.keyFadeTimeout)});function d(){o.update(O=>!O)}function f(O){const{value:K}=O.currentTarget;let N;if(K)try{N=parseInt(K)}catch{}N!==void 0&&N>=0&&N<=127?je.setInputValue("fixedVelocity",N):K?t(0,a=l.fixedVelocity||""):je.setInputValue("fixedVelocity",void 0)}function g(O){je.setInputValue("useHotkeys",O.currentTarget.checked),O.currentTarget.checked||(t(2,c=!1),it.cancelCapture())}function _(O){try{const K=parseInt(O.currentTarget.value);je.setInputValue("keyFadeTimeout",K)}catch{t(1,i=l.keyFadeTimeout)}}function h(){je.setInputValue("useSound",!0),je.setInputValue("fixedVelocity",void 0),je.setInputValue("useKeyboard",!0),je.setInputValue("useHotkeys",!0),je.setInputValue("useAutoOctave",!0),je.setInputValue("keyFadeTimeout",1500)}const v=O=>je.setInputValue("useSound",O.currentTarget.checked);function S(){a=this.value,t(0,a)}const k=O=>je.setInputValue("useKeyboard",O.currentTarget.checked),E=O=>je.setInputValue("useAutoOctave",O.currentTarget.checked),L=()=>t(2,c=!c);return s.$$set=O=>{t(12,e=Ae(Ae({},e),Ne(O)))},e=Ne(e),[a,i,c,l,n,r,o,d,f,g,_,h,e,v,S,k,E,L]}class wr extends We{constructor(e){super(),qe(this,e,kr,yr,Je,{})}}function Er(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},p:me,d(t){t&&p(e)}}}function Cr(s){let e,t=s[1].note+"",l;return{c(){e=X("Input: "),l=X(t)},l(n){e=Z(n,"Input: "),l=Z(n,t)},m(n,r){U(n,e,r),U(n,l,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&pe(l,t)},d(n){n&&(p(e),p(l))}}}function Ir(s){let e,t;return{c(){e=X("Input: "),t=X(s[0])},l(l){e=Z(l,"Input: "),t=Z(l,s[0])},m(l,n){U(l,e,n),U(l,t,n)},p(l,n){n&1&&pe(t,l[0])},d(l){l&&(p(e),p(t))}}}function Tr(s){let e;return{c(){e=X(Ls)},l(t){e=Z(t,Ls)},m(t,l){U(t,e,l)},p:me,d(t){t&&p(e)}}}function Ar(s){let e,t,l,n;function r(i,c){return i[2].useKeyboard&&Ls?Tr:i[2].useKeyboard&&i[0]?Ir:i[2].useKeyboard&&i[1]?Cr:Er}let o=r(s),a=o(s);return{c(){e=b("div"),a.c(),this.h()},l(i){e=y(i,"DIV",{class:!0});var c=C(e);a.l(c),c.forEach(p),this.h()},h(){m(e,"class",t=`${s[4].class||""}`)},m(i,c){U(i,e,c),a.m(e,null),l||(n=J(window,"keydown",s[3]),l=!0)},p(i,[c]){o===(o=r(i))&&a?a.p(i,c):(a.d(1),a=o(i),a&&(a.c(),a.m(e,null))),c&16&&t!==(t=`${i[4].class||""}`)&&m(e,"class",t)},i:me,o:me,d(i){i&&p(e),a.d(),l=!1,n()}}}let Ls="";function Nr(s,e,t){let l;_e(s,nt,c=>t(2,l=c));let{debounced:n}=e,r="",o;const a=jn();function i(c){const d=c.target;if(n||!(d instanceof HTMLElement)||d.tagName==="INPUT")return;const f=it.handleInput(c.code,c.key,c.shiftKey);f&&f.e==="note"?t(1,o=f.data):f&&f.e==="string"?t(0,r=f.data):f&&(f.e==="guessed-key"||f.e==="guessed-chord"||f.e==="guessed-note")?(t(0,r=""),t(1,o=void 0),a(f.e,f.data),c.code==="Enter"&&c.preventDefault()):f&&c.preventDefault()}return s.$$set=c=>{t(4,e=Ae(Ae({},e),Ne(c))),"debounced"in c&&t(5,n=c.debounced)},e=Ne(e),[r,o,l,i,e,n]}class Sr extends We{constructor(e){super(),qe(this,e,Nr,Ar,Je,{debounced:5})}}function Dr(s){let e,t,l,n="Count",r,o,a,i,c,d="Duplicates",f,g,_,h,v,S,k="Autoplay",E,L,O,K,N,T,A="Wait seconds",w,D,P,I,V;return{c(){e=b("ul"),t=b("li"),l=b("label"),l.textContent=n,r=j(),o=b("input"),a=j(),i=b("li"),c=b("label"),c.textContent=d,f=j(),g=b("input"),h=j(),v=b("li"),S=b("label"),S.textContent=k,E=j(),L=b("input"),K=j(),N=b("li"),T=b("label"),T.textContent=A,w=j(),D=b("input"),this.h()},l(R){e=y(R,"UL",{class:!0});var M=C(e);t=y(M,"LI",{class:!0});var F=C(t);l=y(F,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(l)!=="svelte-wgq9fc"&&(l.textContent=n),r=B(F),o=y(F,"INPUT",{class:!0,id:!0,type:!0}),F.forEach(p),a=B(M),i=y(M,"LI",{class:!0});var ee=C(i);c=y(ee,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(c)!=="svelte-hcg9dq"&&(c.textContent=d),f=B(ee),g=y(ee,"INPUT",{class:!0,id:!0,type:!0}),ee.forEach(p),h=B(M),v=y(M,"LI",{class:!0});var ie=C(v);S=y(ie,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(S)!=="svelte-lr68n2"&&(S.textContent=k),E=B(ie),L=y(ie,"INPUT",{class:!0,id:!0,type:!0}),ie.forEach(p),K=B(M),N=y(M,"LI",{class:!0});var Y=C(N);T=y(Y,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(T)!=="svelte-1qj2vcy"&&(T.textContent=A),w=B(Y),D=y(Y,"INPUT",{class:!0,id:!0,type:!0}),Y.forEach(p),M.forEach(p),this.h()},h(){m(l,"class","font-bold"),m(l,"for","guess-count"),m(o,"class","h-[20px] w-10"),m(o,"id","guess-count"),m(o,"type","number"),m(t,"class","flex items-center justify-between svelte-1elvih2"),m(c,"class","font-bold"),m(c,"for","duplicates"),m(g,"class","h-[20px]"),m(g,"id","duplicates"),m(g,"type","checkbox"),g.checked=_=s[2].duplicates,m(i,"class","flex items-center justify-between mr-6 svelte-1elvih2"),m(S,"class","font-bold"),m(S,"for","autoplay"),m(L,"class","h-[20px]"),m(L,"id","autoplay"),m(L,"type","checkbox"),L.checked=O=s[2].autoplay,m(v,"class","flex items-center justify-between mr-6 svelte-1elvih2"),m(T,"class","font-bold"),m(T,"for","wait-ms"),m(D,"class","h-[20px] w-10"),m(D,"id","wait-ms"),m(D,"type","number"),m(N,"class","flex items-center justify-between svelte-1elvih2"),m(e,"class",P=Ie(`${s[5].class||""}`)+" svelte-1elvih2")},m(R,M){U(R,e,M),u(e,t),u(t,l),u(t,r),u(t,o),et(o,s[0]),u(e,a),u(e,i),u(i,c),u(i,f),u(i,g),u(e,h),u(e,v),u(v,S),u(v,E),u(v,L),u(e,K),u(e,N),u(N,T),u(N,w),u(N,D),et(D,s[1]),I||(V=[J(o,"input",s[6]),J(o,"input",s[3]),J(g,"input",s[7]),J(L,"input",s[8]),J(D,"input",s[9]),J(D,"input",s[4])],I=!0)},p(R,[M]){M&1&&is(o.value)!==R[0]&&et(o,R[0]),M&4&&_!==(_=R[2].duplicates)&&(g.checked=_),M&4&&O!==(O=R[2].autoplay)&&(L.checked=O),M&2&&is(D.value)!==R[1]&&et(D,R[1]),M&32&&P!==(P=Ie(`${R[5].class||""}`)+" svelte-1elvih2")&&m(e,"class",P)},i:me,o:me,d(R){R&&p(e),I=!1,Xe(V)}}}function Lr(s,e,t){let l;_e(s,mt,g=>t(2,l=g));let n=l.count||"",r=l.waitSeconds||"";mt.subscribe(g=>{t(0,n=g.count||""),t(1,r=g.waitSeconds||"")});function o({currentTarget:{value:g}}){let _;try{_=parseInt(g),_<=0&&(_=1),Le.setOptionValue("count",_)}catch{t(0,n=l.count)}}function a({currentTarget:{value:g}}){let _;try{_=parseInt(g),_<0&&(_=0),Le.setOptionValue("waitSeconds",_)}catch{t(1,r=l.waitSeconds)}}function i(){n=is(this.value),t(0,n)}const c=g=>Le.setOptionValue("duplicates",g.currentTarget.checked),d=g=>Le.setOptionValue("autoplay",g.currentTarget.checked);function f(){r=is(this.value),t(1,r)}return s.$$set=g=>{t(5,e=Ae(Ae({},e),Ne(g)))},e=Ne(e),[n,r,l,o,a,e,i,c,d,f]}class Pr extends We{constructor(e){super(),qe(this,e,Lr,Dr,Je,{})}}function Wl(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l}function ql(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l}function Jl(s){let e,t,l=s[23]+"",n,r,o,a,i,c,d,f;function g(){return s[15](s[22])}a=new Ue({props:{icon:Ts,width:20}});function _(...h){return s[16](s[22],...h)}return{c(){e=b("li"),t=b("button"),n=X(l),r=j(),o=b("button"),ge(a.$$.fragment),i=j(),this.h()},l(h){e=y(h,"LI",{class:!0});var v=C(e);t=y(v,"BUTTON",{class:!0});var S=C(t);n=Z(S,l),S.forEach(p),r=B(v),o=y(v,"BUTTON",{class:!0});var k=C(o);ve(a.$$.fragment,k),k.forEach(p),i=B(v),v.forEach(p),this.h()},h(){m(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),$(t,"selected",s[22]===s[0]),m(o,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),m(e,"class","flex svelte-1okhpct")},m(h,v){U(h,e,v),u(e,t),u(t,n),u(e,r),u(e,o),be(a,o,null),u(e,i),c=!0,d||(f=[J(t,"click",g),J(o,"click",_)],d=!0)},p(h,v){s=h,(!c||v&17)&&$(t,"selected",s[22]===s[0])},i(h){c||(x(a.$$.fragment,h),c=!0)},o(h){q(a.$$.fragment,h),c=!1},d(h){h&&p(e),ye(a),d=!1,Xe(f)}}}function $l(s){let e,t=de(s[3]),l=[];for(let n=0;nq(D[V],1,1,()=>{D[V]=null});let I=(s[0]==="chords-write"||s[0]==="chords-play")&&$l(s);return d=new Pr({props:{class:"game-options"}}),k=new Ue({props:{class:"mr-1",icon:s[2]?Zs:Ts,width:20}}),{c(){e=b("fieldset"),t=b("legend"),t.textContent=l,n=j(),r=b("div"),o=b("ul");for(let V=0;Vt(12,o=N)),_e(s,mt,N=>t(20,a=N)),_e(s,dt,N=>t(13,i=N)),_e(s,Ct,N=>t(14,c=N));const d=[{key:"notes",value:"Play Notes"},{key:"pitches",value:"Guess Pitches"},{key:"keys-major",value:"Guess Major Keys"},{key:"keys-minor",value:"Guess Minor Keys"},{key:"chords-write",value:"Write Chords"},{key:"chords-play",value:"Play Chords"},{key:"chords-diatonic",value:"Play Diatonic Triads"}];let f=d[4].key,g="maj-m";a.count,a.waitSeconds,mt.subscribe(N=>{N.count,N.waitSeconds});function _(N,T){if(T==="chords-write"||T==="chords-play"||T==="chords-diatonic"){let A=[];g==="selected"?A=o.filter(w=>w.selected):g==="all"?A=o:g==="maj-m"?A=o.filter(w=>w.suffixes[0]==="maj"||w.suffixes[0]==="m"):g==="seventh"&&(A=o.filter(w=>w.suffixes[0]==="maj7"||w.suffixes[0]==="m7"||w.suffixes[0]==="7"||w.suffixes[0]==="dim7"||w.suffixes[0]==="aug7")),Le.play(T,{chords:A})}else Le.play(T,void 0);N.currentTarget instanceof HTMLElement&&N.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function h(N){t(0,f=N)}function v(N,T){t(0,f=T),_(N,T)}function S(N){t(1,g=N)}function k(){Le.clearGame(!0)}function E(N){l?Le.clearGame():_(N,f)}const L=N=>h(N),O=(N,T)=>v(T,N),K=N=>S(N);return s.$$set=N=>{t(10,e=Ae(Ae({},e),Ne(N)))},s.$$.update=()=>{s.$$.dirty&24576&&t(2,l=!!c&&i!=="ended"),s.$$.dirty&4096&&t(11,n=o.reduce((N,T)=>T.selected?N+1:N,0)),s.$$.dirty&2048&&t(3,r=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${n} chords`},{key:"all",value:"All"}])},e=Ne(e),[f,g,l,r,d,h,v,S,k,E,e,n,o,i,c,L,O,K]}class jr extends We{constructor(e){super(),qe(this,e,Vr,Or,Je,{})}}function Ql(s,e,t){const l=s.slice();return l[7]=e[t],l}function Xl(s,e,t){const l=s.slice();return l[4]=e[t],l}function Br(s){let e,t=de(s[1]),l=[];for(let n=0;ns.interval;function Rr(s,e,t){let{scale:l,intervals:n}=e;function r(o){ms.call(this,s,o)}return s.$$set=o=>{t(2,e=Ae(Ae({},e),Ne(o))),"scale"in o&&t(0,l=o.scale),"intervals"in o&&t(1,n=o.intervals)},e=Ne(e),[l,n,e,r]}class Pn extends We{constructor(e){super(),qe(this,e,Rr,Mr,Je,{scale:0,intervals:1})}}function sn(s,e,t){const l=s.slice();return l[7]=e[t],l}function ln(s,e,t){const l=s.slice();return l[4]=e[t],l}function Ur(s){let e,t=de(s[0]),l=[];for(let n=0;n2),m(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(d,f){U(d,e,f),u(e,t),u(t,n),u(e,r),u(e,o),u(o,i),u(e,c)},p(d,f){f&1&&l!==(l=d[7].roman+"")&&pe(n,l),f&1&&a!==(a=d[7].suffix+"")&&pe(i,a),f&1&&$(o,"super-text",d[7].suffix.length>2)},d(d){d&&p(e)}}}function on(s){let e,t,l=s[4]+"",n,r;return{c(){e=b("span"),t=b("span"),n=X(l),r=j(),this.h()},l(o){e=y(o,"SPAN",{class:!0});var a=C(e);t=y(a,"SPAN",{});var i=C(t);n=Z(i,l),i.forEach(p),r=B(a),a.forEach(p),this.h()},h(){m(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(o,a){U(o,e,a),u(e,t),u(t,n),u(e,r)},p(o,a){a&2&&l!==(l=o[4]+"")&&pe(n,l)},d(o){o&&p(e)}}}function xr(s){let e,t,l,n,r,o;function a(d,f){return d[1].length>0?Kr:Ur}let i=a(s),c=i(s);return{c(){e=b("div"),t=b("button"),c.c(),this.h()},l(d){e=y(d,"DIV",{class:!0,title:!0});var f=C(e);t=y(f,"BUTTON",{class:!0});var g=C(t);c.l(g),g.forEach(p),f.forEach(p),this.h()},h(){m(t,"class","triads flex flex-wrap svelte-1roj1mi"),m(e,"class",l=Ie(`${s[2].class||""} `)+" svelte-1roj1mi"),m(e,"title",n=s[0].map(rn).join("-"))},m(d,f){U(d,e,f),u(e,t),c.m(t,null),r||(o=J(t,"click",s[3]),r=!0)},p(d,[f]){i===(i=a(d))&&c?c.p(d,f):(c.d(1),c=i(d),c&&(c.c(),c.m(t,null))),f&4&&l!==(l=Ie(`${d[2].class||""} `)+" svelte-1roj1mi")&&m(e,"class",l),f&1&&n!==(n=d[0].map(rn).join("-"))&&m(e,"title",n)},i:me,o:me,d(d){d&&p(e),c.d(),r=!1,o()}}}const rn=s=>s.roman+s.suffix;function Fr(s,e,t){let{triads:l,chords:n}=e;function r(o){ms.call(this,s,o)}return s.$$set=o=>{t(2,e=Ae(Ae({},e),Ne(o))),"triads"in o&&t(0,l=o.triads),"chords"in o&&t(1,n=o.chords)},e=Ne(e),[l,n,e,r]}class On extends We{constructor(e){super(),qe(this,e,Fr,xr,Je,{triads:0,chords:1})}}function an(s,e,t){const l=s.slice();return l[23]=e[t],l}function cn(s,e,t){const l=s.slice();return l[23]=e[t],l}function un(s){let e,t,l=s[23].raw.names[0]+"",n,r,o,a,i,c,d;function f(){return s[11](s[23])}o=new Pn({props:{scale:s[23].scale,intervals:s[23].raw.intervals}}),o.$on("click",f);function g(){return s[12](s[23])}return i=new On({props:{triads:s[23].triads,chords:s[23].triadChords}}),i.$on("click",g),{c(){e=b("li"),t=b("div"),n=X(l),r=j(),ge(o.$$.fragment),a=j(),ge(i.$$.fragment),c=j(),this.h()},l(_){e=y(_,"LI",{class:!0});var h=C(e);t=y(h,"DIV",{class:!0});var v=C(t);n=Z(v,l),v.forEach(p),r=B(h),ve(o.$$.fragment,h),a=B(h),ve(i.$$.fragment,h),c=B(h),h.forEach(p),this.h()},h(){m(t,"class","text-xs font-bold"),m(e,"class","svelte-4hctsl")},m(_,h){U(_,e,h),u(e,t),u(t,n),u(e,r),be(o,e,null),u(e,a),be(i,e,null),u(e,c),d=!0},p(_,h){s=_,(!d||h&4)&&l!==(l=s[23].raw.names[0]+"")&&pe(n,l);const v={};h&4&&(v.scale=s[23].scale),h&4&&(v.intervals=s[23].raw.intervals),o.$set(v);const S={};h&4&&(S.triads=s[23].triads),h&4&&(S.chords=s[23].triadChords),i.$set(S)},i(_){d||(x(o.$$.fragment,_),x(i.$$.fragment,_),d=!0)},o(_){q(o.$$.fragment,_),q(i.$$.fragment,_),d=!1},d(_){_&&p(e),ye(o),ye(i)}}}function fn(s){let e,t,l=s[23].raw.names[0]+"",n,r,o,a,i,c,d;function f(){return s[13](s[23])}o=new Pn({props:{scale:s[23].scale,intervals:s[23].raw.intervals}}),o.$on("click",f);function g(){return s[14](s[23])}return i=new On({props:{triads:s[23].triads,chords:s[23].triadChords}}),i.$on("click",g),{c(){e=b("li"),t=b("div"),n=X(l),r=j(),ge(o.$$.fragment),a=j(),ge(i.$$.fragment),c=j(),this.h()},l(_){e=y(_,"LI",{class:!0});var h=C(e);t=y(h,"DIV",{class:!0});var v=C(t);n=Z(v,l),v.forEach(p),r=B(h),ve(o.$$.fragment,h),a=B(h),ve(i.$$.fragment,h),c=B(h),h.forEach(p),this.h()},h(){m(t,"class","text-xs font-bold"),m(e,"class","svelte-4hctsl")},m(_,h){U(_,e,h),u(e,t),u(t,n),u(e,r),be(o,e,null),u(e,a),be(i,e,null),u(e,c),d=!0},p(_,h){s=_,(!d||h&2)&&l!==(l=s[23].raw.names[0]+"")&&pe(n,l);const v={};h&2&&(v.scale=s[23].scale),h&2&&(v.intervals=s[23].raw.intervals),o.$set(v);const S={};h&2&&(S.triads=s[23].triads),h&2&&(S.chords=s[23].triadChords),i.$set(S)},i(_){d||(x(o.$$.fragment,_),x(i.$$.fragment,_),d=!0)},o(_){q(o.$$.fragment,_),q(i.$$.fragment,_),d=!1},d(_){_&&p(e),ye(o),ye(i)}}}function Hr(s){let e,t,l,n,r="Scales",o,a,i,c="Key",d,f,g,_,h,v,S,k,E,L,O,K=de(s[2]),N=[];for(let P=0;Pq(N[P],1,1,()=>{N[P]=null});let A=de(s[1]),w=[];for(let P=0;Pq(w[P],1,1,()=>{w[P]=null});return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("label"),i.textContent=c,d=j(),f=b("input"),g=j(),_=b("div"),h=b("ul");for(let P=0;Pt(17,r=w)),_e(s,It,w=>t(18,o=w)),_e(s,nt,w=>t(19,a=w)),_e(s,lt,w=>t(20,i=w));let f=_s().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),g="",_=[o.key,o.scale],h;const v=_t(Be(!0),{key:"scales-hidden"});_e(s,v,w=>t(3,c=w));function S(){v.update(w=>!w)}function k({currentTarget:{value:w}}){t(0,g=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,f=f.map(D=>{const P=Ut(g,D.key),I=g&&"data"in P?P.data:void 0;let V=[];return I&&(V=D.triads.map((R,M)=>`${I.scaleNotes[M].note}${!R.suffix.includes("°")&&R.minor?"m":""}${R.suffix}`)),{...D,scale:I,triadChords:V}}))}function E(w,D,P){if(wV.midi),a.fixedVelocity),h=setTimeout(()=>E(w,D,P),P)}else De.setPlayed([]),De.setKeyAndScale(_[0],_[1])}function L(w){clearTimeout(h);let D,P;w.scale?(P=w.scale,_=[o.key,o.scale],De.setKeyAndScale(w.scale.key,w.scale.scale)):P=o;const I=r[0].midi+P.scaleNotes[0].semitones;D=w.raw.intervals.map(V=>[{...P.notesMap.get(V.semitones%12),midi:I+V.semitones}]),D[0][0].semitones!==D[D.length-1][0].semitones&&D.push(D[0].map(V=>({...V,midi:V.midi+12}))),E(0,D,500)}function O(w){clearTimeout(h);const{intervals:D}=w.raw;let P,I;w.scale?(I=w.scale,_=[o.key,o.scale],De.setKeyAndScale(w.scale.key,w.scale.scale)):I=o;const V=r[0].midi+I.scaleNotes[0].semitones;P=Cn(w.triads).map((M,F)=>ns(V+I.intervals[F].semitones,I,M.intervals)),D[D.length-1].interval_seq!==1&&P.push(P[0].map(M=>({...M,midi:M.midi+12}))),E(0,P,750)}const K=w=>L(w),N=w=>O(w),T=w=>L(w),A=w=>O(w);return s.$$set=w=>{t(9,e=Ae(Ae({},e),Ne(w)))},s.$$.update=()=>{s.$$.dirty&1024&&t(2,l=f.filter((w,D)=>DD>=f.length/2))},e=Ne(e),[g,n,l,c,v,S,k,L,O,e,f,K,N,T,A]}class Wr extends We{constructor(e){super(),qe(this,e,zr,Hr,Je,{})}}function dn(s,e,t){const l=s.slice();return l[26]=e[t],l}function hn(s,e,t){const l=s.slice();return l[29]=e[t],l}function mn(s){let e,t;return{c(){e=b("div"),t=X(s[3]),this.h()},l(l){e=y(l,"DIV",{class:!0});var n=C(e);t=Z(n,s[3]),n.forEach(p),this.h()},h(){m(e,"class","error svelte-1u7ze7x")},m(l,n){U(l,e,n),u(e,t)},p(l,n){n[0]&8&&pe(t,l[3])},d(l){l&&p(e)}}}function _n(s){let e,t=de(s[5]),l=[];for(let n=0;nt(23,n=I)),_e(s,Tt,I=>t(24,r=I)),_e(s,Ct,I=>t(7,a=I)),_e(s,It,I=>t(8,i=I));let c=ft(n[0]),d=ft(n[1]),f="";const g=_t(Be(!1),{key:"score-options-hidden"});_e(s,g,I=>t(6,o=I));let _=r[0],h=r[1];const v=_s(),S=v.map(I=>({key:I.names[0],value:I.names[0]}));Gt.subscribe(I=>{t(1,c=ft(I[0])),t(2,d=ft(I[1]))}),Tt.subscribe(I=>{t(4,_=I[0]),t(0,h=I[1])});function k(I,V){const R=oo(V.currentTarget.value,!0,!0);if("data"in R){const{midi:M}=R.data,F=n,ee=[I==="min"?M:F[0].midi,I==="max"?M:F[1].midi];je.setMidiRange(ee),t(3,f="")}else t(3,f=R.err),I==="min"?t(1,c=ft(n[0])):t(2,d=ft(n[1]))}function E(){t(3,f="")}function L({currentTarget:{value:I}}){t(4,_=`${I.charAt(0).toUpperCase()}${I.charAt(1).toLowerCase()}`),De.setKey(_)}function O(I){var V;return t(0,h=(V=S.find(R=>I===R.key))==null?void 0:V.value),De.setScale(h),!1}function K(){g.update(I=>!I)}function N(){De.clearScore(!0),je.setMidiRange([60,84])}function T(){c=this.value,t(1,c)}const A=I=>k("min",I);function w(){d=this.value,t(2,d)}const D=I=>k("max",I);function P(){_=this.value,t(4,_)}return s.$$set=I=>{t(17,e=Ae(Ae({},e),Ne(I)))},s.$$.update=()=>{var I;s.$$.dirty[0]&1&&t(5,l=((I=v.find(V=>V.names[0]===h))==null?void 0:I.intervals)||[])},e=Ne(e),[h,c,d,f,_,l,o,a,i,g,S,k,E,L,O,K,N,e,T,A,w,D,P]}class $r extends We{constructor(e){super(),qe(this,e,Jr,qr,Je,{},null,[-1,-1])}}function Yr(s){s[21]=s[22].default}function Qr(s){return{c:me,l:me,m:me,i:me,o:me,d:me}}function Xr(s){Yr(s);let e,t,l;var n=s[21];function r(o,a){return{props:{class:"mx-4 md:mx-0"}}}return n&&(e=Mn(n,r())),{c(){e&&ge(e.$$.fragment),t=Pe()},l(o){e&&ve(e.$$.fragment,o),t=Pe()},m(o,a){e&&be(e,o,a),U(o,t,a),l=!0},i(o){l||(e&&x(e.$$.fragment,o),l=!0)},o(o){e&&q(e.$$.fragment,o),l=!1},d(o){o&&p(t),e&&ye(e,o)}}}function Zr(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},i:me,o:me,d(t){t&&p(e)}}}function ea(s){let e,t,l,n,r="MIDI Note Trainer",o,a,i,c,d,f,g,_="Introduction",h,v,S,k,E,L,O,K,N,T,A,w,D,P,I,V,R,M,F,ee,ie;c=new Ue({props:{icon:Ft,width:24}}),S=new wr({}),E=new Wr({}),O=new Do({}),T=new $r({props:{class:"score-options mr-4"}}),w=new jr({props:{class:"play-form"}});let Y={ctx:s,current:null,token:null,hasCatch:!1,pending:Zr,then:Xr,catch:Qr,value:22,blocks:[,,,]};return Bn(Ce(()=>import("./Score.5d65f50b.js"),["./Score.5d65f50b.js","./vendor_svelte.f9b78e98.js","./vendor.e9b0235c.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),Y),V=new Sr({props:{class:"min-h-32",debounced:!!s[0]}}),V.$on("guessed-chord",s[2]),V.$on("guessed-key",s[3]),V.$on("guessed-note",s[4]),M=new Fo({props:{game:s[1]}}),{c(){e=b("meta"),t=j(),l=b("h1"),n=b("a"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("div"),g=b("button"),g.textContent=_,h=j(),v=b("section"),ge(S.$$.fragment),k=j(),ge(E.$$.fragment),L=j(),ge(O.$$.fragment),K=j(),N=b("div"),ge(T.$$.fragment),A=j(),ge(w.$$.fragment),D=j(),Y.block.c(),P=j(),I=b("section"),ge(V.$$.fragment),R=j(),ge(M.$$.fragment),this.h()},l(z){const G=Gn("svelte-1w2oado",document.head);e=y(G,"META",{name:!0,content:!0}),G.forEach(p),t=B(z),l=y(z,"H1",{class:!0});var le=C(l);n=y(le,"A",{class:!0,href:!0,"data-svelte-h":!0}),ae(n)!=="svelte-km4jns"&&(n.textContent=r),o=B(le),a=y(le,"DIV",{class:!0});var H=C(a);i=y(H,"BUTTON",{class:!0});var se=C(i);ve(c.$$.fragment,se),se.forEach(p),H.forEach(p),le.forEach(p),d=B(z),f=y(z,"DIV",{class:!0});var ce=C(f);g=y(ce,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(g)!=="svelte-f34gar"&&(g.textContent=_),ce.forEach(p),h=B(z),v=y(z,"SECTION",{class:!0});var Ee=C(v);ve(S.$$.fragment,Ee),k=B(Ee),ve(E.$$.fragment,Ee),L=B(Ee),ve(O.$$.fragment,Ee),K=B(Ee),N=y(Ee,"DIV",{class:!0});var oe=C(N);ve(T.$$.fragment,oe),A=B(oe),ve(w.$$.fragment,oe),oe.forEach(p),Ee.forEach(p),D=B(z),Y.block.l(z),P=B(z),I=y(z,"SECTION",{class:!0});var he=C(I);ve(V.$$.fragment,he),R=B(he),ve(M.$$.fragment,he),he.forEach(p),this.h()},h(){m(e,"name","description"),m(e,"content","App to practise music notation, scales and chords using MIDI"),m(n,"class","hover:underline"),m(n,"href","https://github.com/TeemuKoivisto/midi-note-trainer"),m(i,"class","rounded p-2 hover:bg-gray-200"),m(a,"class","flex items-center justify-center"),m(l,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight flex items-center justify-between"),m(g,"class","btn-pill border-2 border-gray-300 hover:bg-gray-200"),m(f,"class","px-4 md:px-0"),m(N,"class","play svelte-qjpqy3"),m(v,"class","mx-4 md:mx-0"),m(I,"class","mb-8 ml-16 flex flex-col")},m(z,G){u(document.head,e),U(z,t,G),U(z,l,G),u(l,n),u(l,o),u(l,a),u(a,i),be(c,i,null),U(z,d,G),U(z,f,G),u(f,g),U(z,h,G),U(z,v,G),be(S,v,null),u(v,k),be(E,v,null),u(v,L),be(O,v,null),u(v,K),u(v,N),be(T,N,null),u(N,A),be(w,N,null),U(z,D,G),Y.block.m(z,Y.anchor=G),Y.mount=()=>P.parentNode,Y.anchor=P,U(z,P,G),U(z,I,G),be(V,I,null),u(I,R),be(M,I,null),F=!0,ee||(ie=[J(i,"click",s[5]),J(g,"click",s[6])],ee=!0)},p(z,[G]){s=z;const le={};G&1&&(le.debounced=!!s[0]),V.$set(le);const H={};G&2&&(H.game=s[1]),M.$set(H)},i(z){F||(x(c.$$.fragment,z),x(S.$$.fragment,z),x(E.$$.fragment,z),x(O.$$.fragment,z),x(T.$$.fragment,z),x(w.$$.fragment,z),x(Y.block),x(V.$$.fragment,z),x(M.$$.fragment,z),F=!0)},o(z){q(c.$$.fragment,z),q(S.$$.fragment,z),q(E.$$.fragment,z),q(O.$$.fragment,z),q(T.$$.fragment,z),q(w.$$.fragment,z);for(let G=0;G<3;G+=1){const le=Y.blocks[G];q(le)}q(V.$$.fragment,z),q(M.$$.fragment,z),F=!1},d(z){z&&(p(t),p(l),p(d),p(f),p(h),p(v),p(D),p(P),p(I)),p(e),ye(c),ye(S),ye(E),ye(O),ye(T),ye(w),Y.block.d(z),Y.token=null,Y=null,ye(V),ye(M),ee=!1,Xe(ie)}}}function ta(s,e,t){let l,n,r,o,a,i;_e(s,dt,T=>t(9,l=T)),_e(s,Ct,T=>t(1,n=T)),_e(s,mt,T=>t(10,r=T)),_e(s,nt,T=>t(11,o=T)),_e(s,lt,T=>t(12,a=T)),_e(s,Ns,T=>t(13,i=T));let c,d;bn(()=>(i&&O(),window.addEventListener("keydown",f),window.addEventListener("mousedown",f),window.addEventListener("touchstart",f),()=>{window.removeEventListener("keydown",f),window.removeEventListener("mousedown",f),window.removeEventListener("touchstart",f)})),ds.subscribe(T=>{T&&T.channels[1].addListener("noteon",g)});function f(){je.initAudio(),window.removeEventListener("keydown",f),window.removeEventListener("mousedown",f),window.removeEventListener("touchstart",f)}function g(T){if(c)return;const A=T.rawData;_(A[1],A[2])}function _(T,A){const w=n;w instanceof Vt&&!(w!=null&&w.ended)&&l==="waiting"?S(T):w instanceof ht&&!(w!=null&&w.ended)&&l==="waiting"?(w.addPlayedNote(T),d||(d=setTimeout(v,2e3))):w||De.pushPlayed(T),a&&a.noteOn(T,o.fixedVelocity??A)}function h(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&Le.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?Le.nextGuess():t(0,c=void 0)}function v(){var A;const T=n;if(T instanceof ht){const w=T.guess();De.setPlayed(((A=T.latestGuess.guessed)==null?void 0:A.notes)||[],w,-1),Le.updateState(w?"correct":"wrong"),h()}d=void 0}function S(T){const A=n;if(A instanceof Vt&&l==="waiting"){De.setTarget([De.getNote(A.current)]);const w=A.guess(T);Le.updateState(w?"correct":"wrong"),De.pushPlayed(T,w,4e3),h()}}function k(T){const A=n;if(A instanceof ht&&l==="waiting"){const w=A.guessWrittenChord(T.detail);Le.updateState(w?"correct":"wrong"),h()}}function E(T){const A=n;if(A instanceof Kt&&l==="waiting"){const w=T.detail.replaceAll("♭","b").replaceAll("♯","#"),D=A.guess(w);Le.updateState(D?"correct":"wrong"),h()}}function L(T){const A=it.findNote(T.detail.note)??Gs(T.detail.note);A&&_(A.semitones+12+T.detail.octave*12,80)}async function O(){const T=await je.openMidi();"data"in T?T.data.name:(T.err,console.error(T.err))}function K(){fo(),window.location.reload()}return[c,n,k,E,L,K,()=>xn.open("introduction",void 0)]}class ra extends We{constructor(e){super(),qe(this,e,ta,ea,Je,{})}}export{rl as F,ht as G,ra as P,Yn as S,Vt as a,Le as b,Ct as c,yt as d,fs as e,dt as g,lt as p,It as s,ul as t}; diff --git a/_app/immutable/chunks/3.25ec78aa.js b/_app/immutable/chunks/3.25ec78aa.js new file mode 100644 index 00000000..15c2a5a8 --- /dev/null +++ b/_app/immutable/chunks/3.25ec78aa.js @@ -0,0 +1,7 @@ +import{_ as Ie}from"./preload-helper.a4192956.js";import{S as qe,i as We,s as $e,e as b,n as j,a as y,b as C,p as B,d as p,f as m,Z as Te,N as J,g as U,h as u,_ as et,q as $,t as x,F as xe,l as W,y as Fe,$ as Xe,Q as Ae,R as Ne,c as Os,a0 as de,u as Ps,j as Vs,k as js,V as rs,W as Ct,X as as,a1 as is,a2 as Pe,x as Oe,H as Bs,B as X,C as Z,D as pe,r as me,O as Ue,J as ge,K as ve,L as be,M as ye,m as we,T as Ht,w as Ve,o as ae,P as _e,a3 as ms,v as bn,a4 as Bn,a5 as cs,a6 as Gn,a7 as Mn,I as Rn}from"./vendor_svelte.d337c9a7.js";import{w as ss,c as Un,e as Kn,f as Qs,g as Xs,h as zt,i as us,j as fs,k as Bt,l as Gt,m as xn,a as Zs,n as Ts}from"./vendor.e9b0235c.js";import{a as Fn}from"./modal.94ff3968.js";function el(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l[24]=e[t].icon,l[26]=t,l}const Hn=s=>({}),tl=s=>({});function sl(s){let e,t,l,n,r,o,a,i,c,d,f;const g=s[17].header,_=Os(g,s,s[16],tl);let h=de(s[0]),v=[];for(let k=0;kW(v[k],1,1,()=>{v[k]=null});return{c(){e=b("button"),l=j(),n=b("ul"),r=b("li"),_&&_.c(),o=j();for(let k=0;k{c&&(t||(t=Ct(e,as,{duration:ls},!0)),t.run(1))}),x(_,k);for(let E=0;E{c&&(i||(i=Ct(n,is,{duration:ls},!0)),i.run(1))}),c=!0}},o(k){k&&(t||(t=Ct(e,as,{duration:ls},!1)),t.run(0)),W(_,k),v=v.filter(Boolean);for(let E=0;E{h[L]=null}),Fe(),n=h[l],n?n.p(s,E):(n=h[l]=_[l](s),n.c()),x(n,1),n.m(t,r)),(!d||E&1)&&a!==(a=s[23]+"")&&pe(i,a),(!d||E&9)&&J(t,"selected",s[22]===s[3])},i(k){d||(x(n),d=!0)},o(k){W(n),d=!1},d(k){k&&p(e),h[l].d(),f=!1,g()}}}function zn(s){let e;return{c(){e=b("div"),this.h()},l(t){e=y(t,"DIV",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","w-[24px]")},m(t,l){U(t,e,l)},p:me,i:me,o:me,d(t){t&&p(e)}}}function qn(s){let e,t;return e=new Ue({props:{class:"mr-2",icon:s[24],width:16}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},p(l,n){const r={};n&1&&(r.icon=l[24]),e.$set(r)},i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){W(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function nl(s){let e,t,l=!s[8][s[26]]&&ll(s);return{c(){l&&l.c(),e=Oe()},l(n){l&&l.l(n),e=Oe()},m(n,r){l&&l.m(n,r),U(n,e,r),t=!0},p(n,r){n[8][n[26]]?l&&(xe(),W(l,1,1,()=>{l=null}),Fe()):l?(l.p(n,r),r&256&&x(l,1)):(l=ll(n),l.c(),x(l,1),l.m(e.parentNode,e))},i(n){t||(x(l),t=!0)},o(n){W(l),t=!1},d(n){n&&p(e),l&&l.d(n)}}}function Wn(s){let e,t,l,n,r,o,a,i,c,d=s[6]&&sl(s);return{c(){e=b("div"),t=b("input"),r=j(),d&&d.c(),this.h()},l(f){e=y(f,"DIV",{class:!0,id:!0});var g=C(e);t=y(g,"INPUT",{class:!0,title:!0}),r=B(g),d&&d.l(g),g.forEach(p),this.h()},h(){m(t,"class",l=Te(`${s[14].class||""} open-btn text-justify text-sm rounded`)+" svelte-h65upg"),m(t,"title",n=s[14].title||""),J(t,"disabled",s[4]),J(t,"open",s[6]),m(e,"class",o=Te(`relative ${s[2]||""}`)+" svelte-h65upg"),m(e,"id",s[1])},m(f,g){U(f,e,g),u(e,t),et(t,s[7]),u(e,r),d&&d.m(e,null),s[21](e),a=!0,i||(c=[$(t,"input",s[18]),$(t,"click",s[9]),$(t,"focus",s[19]),$(t,"input",s[10]),$(t,"keydown",s[12])],i=!0)},p(f,[g]){(!a||g&16384&&l!==(l=Te(`${f[14].class||""} open-btn text-justify text-sm rounded`)+" svelte-h65upg"))&&m(t,"class",l),(!a||g&16384&&n!==(n=f[14].title||""))&&m(t,"title",n),g&128&&t.value!==f[7]&&et(t,f[7]),(!a||g&16400)&&J(t,"disabled",f[4]),(!a||g&16448)&&J(t,"open",f[6]),f[6]?d?(d.p(f,g),g&64&&x(d,1)):(d=sl(f),d.c(),x(d,1),d.m(e,null)):d&&(xe(),W(d,1,1,()=>{d=null}),Fe()),(!a||g&4&&o!==(o=Te(`relative ${f[2]||""}`)+" svelte-h65upg"))&&m(e,"class",o),(!a||g&2)&&m(e,"id",f[1])},i(f){a||(x(d),a=!0)},o(f){W(d),a=!1},d(f){f&&p(e),d&&d.d(),s[21](null),i=!1,Xe(c)}}}const ls=400;function $n(s,e,t){let{$$slots:l={},$$scope:n}=e,{options:r,id:o=void 0,containerClass:a=void 0,selected:i,disabled:c=void 0,onSelect:d}=e,f,g=!1,_=i,h=r.map(A=>!1);function v(){c||t(6,g=!g)}function S(A){t(8,h=r.map(w=>!w.value.toLowerCase().includes(A.currentTarget.value.toLowerCase())))}function k(){t(7,_=i),t(6,g=!1),t(8,h=r.map(A=>!1))}function E(A){if(A.key==="Enter"){const w=h.findIndex(D=>!D);_===i?k():w>-1&&t(6,g=d(r[w].key)),g||(t(8,h=r.map(D=>!1)),A.currentTarget instanceof HTMLElement&&A.currentTarget.blur())}else A.key==="Escape"&&(k(),A.currentTarget instanceof HTMLElement&&A.currentTarget.blur())}function L(A){t(6,g=d(A))}function P(){_=this.value,t(7,_),t(3,i)}const K=()=>t(6,g=!0),N=A=>L(A);function T(A){Bs[A?"unshift":"push"](()=>{f=A,t(5,f)})}return s.$$set=A=>{t(14,e=Ae(Ae({},e),Ne(A))),"options"in A&&t(0,r=A.options),"id"in A&&t(1,o=A.id),"containerClass"in A&&t(2,a=A.containerClass),"selected"in A&&t(3,i=A.selected),"disabled"in A&&t(4,c=A.disabled),"onSelect"in A&&t(15,d=A.onSelect),"$$scope"in A&&t(16,n=A.$$scope)},s.$$.update=()=>{s.$$.dirty&8&&t(7,_=i),s.$$.dirty&1&&t(8,h=r.map(A=>!1))},e=Ne(e),[r,o,a,i,c,f,g,_,h,v,S,k,E,L,e,d,n,l,P,K,N,T]}class yn extends qe{constructor(e){super(),We(this,e,$n,Wn,$e,{options:0,id:1,containerClass:2,selected:3,disabled:4,onSelect:15})}}const ol={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function Ze(s,e=0,t=0){return{interval:`${s}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:s,semitones:kn(s,e,t),flats:e,sharps:t}}function kn(s,e,t){return(s<8?ol[s]:ol[s%7])-e+t+Math.floor(s/8)*12}function wn(s){let e,t=0,l=0;s<0?(t=1+Math.floor(-s/100),e=-s%100):s>100?(l=Math.floor(s/100),e=s%100):e=s;const n=kn(e,t,l);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(l)}`,interval_seq:e,semitones:n,flats:t,sharps:l}}const Jn=[[["maj"],["Major Chord"],"major",[1,3,5]],[["6"],["Major 6th Chord"],"major",[1,3,5,6]],[["6/9"],["Major 6th/9th Chord"],"major",[1,3,5,6,9]],[["maj7"],["Major 7th Chord"],"major",[1,3,5,7]],[["maj9"],["Major 9th Chord"],"major",[1,3,5,7,9]],[["maj11"],["Major 11th Chord"],"major",[1,3,5,7,9,11]],[["maj13"],["Major 13th Chord"],"major",[1,3,5,7,9,11,13]],[["m"],["Minor Chord"],"minor",[1,-3,5]],[["m6"],["Minor 6th Chord"],"minor",[1,-3,5,6]],[["m7"],["Minor 7th Chord"],"minor",[1,-3,5,-7]],[["m9"],["Minor 9th Chord"],"minor",[1,-3,5,-7,9]],[["m11"],["Minor 11th Chord"],"minor",[1,-3,5,-7,9,11]],[["m13"],["Minor 13th Chord"],"minor",[1,-3,5,-7,9,11,13]],[["sus2"],["Suspended 2nd Chord"],"suspended",[1,2,5]],[["sus4"],["Suspended 4th Chord"],"suspended",[1,4,5]],[["7sus4"],["Suspended 4th Seventh Chord"],"suspended",[1,4,5,-7]],[["7"],["Dominant 7th Chord"],"major",[1,3,5,-7]],[["7#9"],["Dominant 7th Sharp 9th Chord"],"major",[1,3,5,-7,109]],[["9"],["Dominant 9th Chord"],"major",[1,3,5,-7,9]],[["11"],["Dominant 11th Chord"],"major",[1,3,5,-7,9,11]],[["13"],["Dominant 13th Chord"],"major",[1,3,5,-7,9,11,13]],[["5"],["Power Chord"],"indeterminate",[1,5]],[["dim","°"],["Diminished Chord"],"diminished",[1,-3,-5]],[["dim7","°7"],["Diminished 7th Chord"],"diminished",[1,-3,-5,-107]],[["m7b5"],["Half-Diminished 7th Chord"],"diminished",[1,-3,-5,-7]],[["aug","+"],["Augmented Chord"],"augmented",[1,3,105]],[["aug7","+7"],["Augmented 7th Chord"],"augmented",[1,3,105,-7]]];let Es=[];function En(){return Jn.map(s=>{const e=s[3].map(wn);return{suffixes:s[0],name:s[1][0],type:s[2],intervals:e}})}function Ut(s){Es.length===0&&(Es=En());const e=s.replaceAll(/-|\s/g,"").toLowerCase().trim();return Es.find(t=>t.suffixes.find(l=>l===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function Yn(s,e,t){let l=e<0?s.flats-e:s.flats,n=e>0?s.sharps+e:s.sharps;if(l>0&&n>0){const o=Math.min(l,n);l-=o,n-=o}const r=(s.semitones+e)%12;return{...s,semitones:r<0?r+12:r,note:`${s.note.charAt(0)}${"♭".repeat(l)}${"♯".repeat(n)}`,flats:l,sharps:n,midi:t}}function os(s,e,t){const l=[];for(let n=0;ng.semitones===o%12),i=r.flats>0,c=r.sharps>0,d=(i?o+1:c?o-1:o)%12,f=i?-1:c?1:0;l.push(Yn(a??e.notesMap.get(d),a?0:f,o))}return l}const rl=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],Qn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],al=new Map([[0,"C"],[-1,"F"],[-2,"B♭"],[-3,"E♭"],[-4,"A♭"],[-5,"D♭"],[-6,"G♭"],[-7,"C♭"],[1,"G"],[2,"D"],[3,"A"],[4,"E"],[5,"B"],[6,"F♯"],[7,"C♯"]]);function Xn(s){let e=0,t=0;for(let l=0;lo.note.slice(0,2)===rl[l]),r=s.find(o=>o.note.slice(0,2)===Qn[l]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:al.get(e*-1)}:{flats:0,sharps:t,majorSignature:al.get(t)}}function Zn(s){return s>=9?`${s>=10?"X":""}${s===9?"IX":"I".repeat(s%10)}`:`${s>=5?"V":""}${s===4?"IV":"I".repeat(s%5)}`}function Cn(s){return s.map(e=>{const t=[Ze(1)];let l;return e.major?(t.push(Ze(3)),e.suffix.startsWith("+")?t.push(Ze(5,0,1)):e.suffix.startsWith("6")?t.push(Ze(6)):e.suffix.startsWith("7")?t.push(Ze(7,1)):e.suffix.startsWith("maj7")?t.push(Ze(7)):l=Ut("maj")):e.minor?(t.push(Ze(3,1)),e.suffix.startsWith("°")?t.push(Ze(5,1)):e.suffix.startsWith("6")?(t.push(Ze(6)),l=Ut("m"+e.suffix)):e.suffix.startsWith("7")?(t.push(Ze(7,1)),l=Ut("m"+e.suffix)):l=Ut("m")):e.suffix.startsWith("sus2")?t.push(Ze(2)):e.suffix.startsWith("sus4")&&t.push(Ze(4)),t.length<=2&&t.push(Ze(5)),t.length<=2&&t.push(Ze(8)),l||(l=Ut(e.suffix)),{...l,intervals:t}})}function eo(s,e){let t=e.has(4)&&e.has(7),l=e.has(3)&&e.has(7);const n=Zn(s);let r="";return t||l||(e.has(3)&&e.has(6)?(r="°",l=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(l=!0,r="7"):e.has(4)&&e.has(10)?(r="7",t=!0):e.has(4)&&e.has(11)?(r="maj7",t=!0):e.has(3)&&e.has(8)?(r="6",l=!0):e.has(4)&&e.has(9)?(r="6",t=!0):e.has(2)?r="sus2":e.has(5)?r="sus4":e.has(7)?r="5":r="?"),{degree:s,roman:l?n.toLowerCase():n,suffix:r,major:t,minor:l,semitones:e}}function to(s){const e=s.length;return s.map((t,l)=>{const n=t.semitones,r=new Set;for(let o=1;o{const e=s[0],t=s[1].map(wn),l=to(t);return{names:e,intervals:t,triads:l}})}function lo(s){Cs.length===0&&(Cs=_s());const e=s.replaceAll(/-|\s/g,"").toLowerCase().trim();return Cs.find(t=>t.names.find(l=>l.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const no=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,oo=/^[0-9]$/,at=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function ds(s){const e=s.midi+s.flats-s.sharps;return e===12?1:Math.floor((e-12)/12)}function dt(s){return`${s.note}${ds(s)}`}function il(s){const t=(s-12)%12;return{...at[t],semitones:t,midi:s}}function ro(s,e=!0,t=!1){if(e&&!no.test(s))return{err:`Unrecognized note "${s}"`,code:400};const l=s.trim(),n=l.charAt(0).toUpperCase(),r=at.find(f=>f.note.charAt(0)===n&&f.note.length===1);if(!r)return{err:`Unable to find note ${l}`,code:500};const o=l.slice(1).split("").reduce((f,g)=>f+(g.toLowerCase()==="b"||g==="♭"?-1:g==="#"||g==="♯"?1:0),0);let a;if(oo.test(l.charAt(l.length-1)))try{a=parseInt(l.charAt(l.length-1),10)}catch{}if(t&&a===void 0)return{err:`No octave provided: ${s}`,code:400};a===void 0&&(a=0);let i=(r.semitones+o)%12;i=i<0?i+12:i;const c=o<0?-o:0,d=o>0?o:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(d)}`,semitones:i,midi:12+a*12+i,flats:c,sharps:d}}}function Gs(s){const e=at.find(t=>t.note.charAt(0)===s.charAt(0)&&t.note.length===1);if(e){const t=s.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),l=(e.semitones+t)%12;return{note:s,semitones:l<0?l+12:l,flats:t<0?-t:0,sharps:t>0?t:0}}}const ao=/^[a-gA-G][♭b#♯]?$/,Is="ABCDEFG";function io(s,e){return e.map(t=>Is.charAt((Is.indexOf(s)+t.interval_seq-1)%Is.length))}function co(s,e,t){return t.map((l,n)=>{const r=e[n],o=(s+l.semitones)%12,a=at[o],i=a.note.charAt(0);if(ir||i==="A"&&r==="G"){let c=1,d=o===0?at.length-1:o-c,f=at[d];for(;f.note.charAt(0)!==r;)c+=1,d=d===0?at.length-1:d-1,f=at[d];return{semitones:o,note:f.note+"♯".repeat(c),flats:0,sharps:c+(f.note.includes("♯")?1:0)}}else return{semitones:o,note:a.note,flats:a.flats,sharps:a.sharps}})}function xt(s,e){if(!ao.test(s))return{err:`Unknown key: ${s}`,code:400};const t=lo(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const l=`${s.charAt(0).toUpperCase()}${s.charAt(1).replace("b","♭").replace("#","♯")}`,n=Gs(l);if(!n)return{err:`Unable to find root for note: ${l}`,code:404};const r=io(l.charAt(0),t.intervals),o=co(n.semitones,r,t.intervals),a=new Map(at.map(i=>{const c=o.find(d=>d.semitones===i.semitones);return c?[i.semitones,c]:[i.semitones,{...i}]}));return{data:{key:l,scale:t.names[0],names:t.names,...Xn(o),intervals:t.intervals.map(i=>({...i})),triads:t.triads.map(i=>({...i})),scaleNotes:o,notesMap:a}}}const As=new Map;function uo(s,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(s)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function fo(s,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(s)),{data:void 0}}catch(l){return{err:`Failed to store the value: ${l}`,code:400}}}function gt(s,e){const{key:t,storage:l="local",namespace:n="default"}=e,r=uo(t,l),o=we(s);"data"in r?s.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const a=s.subscribe(c=>{const d=fo(e.serialize?e.serialize(c):c,t,l);"err"in d&&(e!=null&&e.debug)&&console.error(d.err)}),i=As.get(n);return i?i.push({key:t,storage:l,value:s,defaultValue:o,unsubscribe:a}):As.set(n,[{key:t,storage:l,value:s,defaultValue:o,unsubscribe:a}]),s}function ho(s=["default"],e){s.forEach(t=>{var l;(l=As.get(t))==null||l.forEach(n=>{if(e!=null&&e.cb)e==null||e.cb(n);else try{e!=null&&e.unsubscribe&&n.unsubscribe(),n.value.set(n.defaultValue),(n.storage==="local"?window.localStorage:window.sessionStorage).removeItem(n.key)}catch{}})})}async function mo(s,e){const t=await fetch(s);if(!t.ok)return{err:t.statusText,code:t.status};const l=await t.arrayBuffer();return{data:await e.decodeAudioData(l)}}async function _o(s,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],l=await Promise.all(t.map(r=>mo(`${s}${r}`,e))),n=[];return l.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class po{constructor(e,t,l,n){this.noteA=t.createBufferSource(),this.noteB=t.createBufferSource(),this.gainA=t.createGain(),this.gainB=t.createGain(),this.gain=t.createGain(),this.biquadFilter=t.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.connect(l),this.gain.connect(this.biquadFilter),this.gainA.connect(this.gain),this.noteA.connect(this.gainA),this.gainB.connect(this.gain),this.noteB.connect(this.gainB),e<90&&(this.damp=t.createBufferSource(),this.damp.buffer=n,this.damp.connect(l))}on(e,t,l,n,r,o,a,i){this.noteA.buffer=e,this.noteA.playbackRate.value=l,this.biquadFilter.frequency.value=r,this.gainA.gain.value=o,this.gain.gain.value=i,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=a,this.noteB.start(0)),this.noteA.start(0)}off(e,t,l){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(l),this.noteB.stop(l),(n=this.damp)==null||n.start(0)}}class go{constructor(e){return this.bufferlists=[],this.sus=!1,this.sustained=[],this.notes=new Map,this.context=e,this.convolver=e.createConvolver(),this.directGain=e.createGain(),this.convGain=e.createGain(),this.convGainAfter=e.createGain(),this.convGain.connect(this.convolver),this.convolver.connect(this.convGainAfter),this.convGainAfter.connect(e.destination),this.directGain.connect(e.destination),this.directGain.connect(this.convGain),this.directGain.gain.value=.75,this.convGain.gain.value=0,this.convGainAfter.gain.value=0,this}load(e){e.forEach((t,l)=>{this.bufferlists.push(t),l===8?this.damper=t:l===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(l=>{this.noteOn(l,t)})}noteOn(e,t=80){if(e<109&&e>20){const l=this.notes.get(e);l&&(l.off(this.context.currentTime,1.1,this.context.currentTime+2),this.sustained.splice(this.sustained.indexOf(e),1));const n=Math.floor((e-21)/12),r=n+1,o=n*12+21,a=2**((e-69)/12)*440,i=t/127;let c=a*(2-(e-21)/50)+3*a*i;e<60&&(c=440*(3-(60-21)/50)+3*a*i);const d=1-(e%12/12+1)/12,f=Math.pow(2,(e-o)/12),g=0,_=0,h=i**1.4,v=new po(e,this.context,this.directGain,this.damper);v.on(this.bufferlists[n],this.bufferlists[r],f,g,c,d,_,h),this.notes.set(e,v)}}noteOff(e){if(this.sus)this.sustained.push(e);else{const t=this.notes.get(e);e<90&&t&&t.off(this.context.currentTime+.03,.08,this.context.currentTime+2),this.notes.delete(e)}}sustain(e){if(e==127)this.sus=!0,this.convGain.gain.value=1,this.convGainAfter.gain.value=1;else if(e==0){this.sus=!1,this.convGain.gain.value=0,this.convGainAfter.gain.value=0;for(let t=0;t[il(s[0]),il(s[1])]),cl=Ve(void 0),lt=Ve(void 0),nt=gt(Ve({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),Be={async openMidi(){return ss.enable().then(()=>(Ns.set(!0),ss.inputs.length>0?(hs.set(ss.inputs[0]),{data:ss.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(s=>({err:s.toString(),code:403}))},disableMidi(){Ns.set(!1),hs.set(void 0)},setMidiRange(s){ps.set(s)},setInputValue(s,e){nt.update(t=>({...t,[s]:e})),s==="useSound"&&!e?lt.set(void 0):s==="useSound"&&!we(lt)&&this.initAudio()},async initAudio(){let s=we(cl);if(s||(s=new AudioContext,cl.set(s)),!we(lt)){const e=new go(s),t=await _o(`${vo}audio`,s);e.load(t),lt.set(e)}}};let rt;const At=Ve(["C","Major"]),pt=Ht(At,s=>{const e=xt(s[0],s[1]);return"data"in e?e.data:{key:s[0],scale:s[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),ul=Ve([]),wt=Ve([]);function Ss(s,e){if(s.length>0){const t=Date.now();let l=t;const n=s.filter(r=>(r.started+e>t&&(l=Math.min(l,r.started)),r.started+e>t));return!rt&&n.length>0&&(rt=setTimeout(()=>{rt=void 0,wt.update(r=>Ss(r,e))},e-(t-l)+100)),n}return s}const De={setKey(s){At.update(e=>[s,e[1]])},setScale(s){At.update(e=>[e[0],s])},setKeyAndScale(s,e){At.set([s,e])},setTarget(s=[]){ul.set(s)},getNote(s){return{...we(pt).notesMap.get(s%12),midi:s}},pushPlayed(s,e,t){const n={...we(pt).notesMap.get(s%12),midi:s},r=Date.now(),o=e===void 0?"default":e?"correct":"wrong";if(wt.update(a=>{const i=a.findIndex(c=>c.midi===s);return i>=0&&a.splice(i,1),[...a,{...n,color:o,started:r}]}),!rt&&t!==-1){const a=t??we(nt).keyFadeTimeout;rt=setTimeout(()=>{rt=void 0,wt.update(i=>Ss(i,a))},a)}},setPlayed(s,e,t){const l=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(wt.update(r=>[...s.map(o=>({...o,color:n,started:l}))]),!rt&&t!==-1){const r=t??we(nt).keyFadeTimeout;rt=setTimeout(()=>{rt=void 0,wt.update(o=>Ss(o,r))},r)}},clearPlayed(){wt.set([]),clearTimeout(rt),rt=void 0},clearScore(s=!1){s&&At.set(["C","Major"]),ul.set([]),wt.set([])}};class Ms{constructor(e,t,l){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=l;const n=[],{count:r}=l,o=t.map(i=>typeof i=="object"&&i!==null?{...i}:i);let a=l.duplicates;!l.duplicates&&r>o.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),a=!0);for(let i=0;i0&&n.push(d[0])}}this.sampled=n,this.timing=performance.now()}get current(){return this.sampled[this.idx]}get latestGuess(){const e=this.sampled[this.idx-1],t=this.guesses[this.idx-1];return{target:e,guessed:t}}get ended(){return this.sampled.length0?s.sharps+e:s.sharps;if(l>0&&n>0){const o=Math.min(l,n);l-=o,n-=o}const r=(s.semitones+e)%12;return{...s,semitones:r<0?r+12:r,note:`${s.note.charAt(0)}${"♭".repeat(l)}${"♯".repeat(n)}`,flats:l,sharps:n,midi:t}}function yo(s,e,t){const l=[];for(let n=0;ng.semitones===o%12),i=r.flats>0,c=r.sharps>0,d=(i?o+1:c?o-1:o)%12,f=i?-1:c?1:0;l.push(bo(a??e.notesMap.get(d),a?0:f,o))}return l}const ko=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function wo(s){const t=(s-12)%12;return{...ko[t],semitones:t,midi:s}}function Eo(s){return`${s.note.trim().charAt(0).toUpperCase()}${"♭".repeat(s.flats)}${"♯".repeat(s.sharps)}`}class mt extends Ms{constructor(e,t,l){const n=t.range[0],r=t.range[1],o=new Set(t.scale.scaleNotes.map(i=>i.semitones)),a=l.chords.flatMap(i=>{const c=[],d=i.intervals.reduce((f,g)=>g.semitones>f?g.semitones:f,0);for(let f=n;f<=r-d;f+=1)if((!l.onlyScale||o.has(f%12))&&(!i.allowed||i.allowed.has(f%12))){const g=yo(f,t.scale,i.intervals);c.push({...i,rootNote:g[0].note,chord:`${g[0].note}${i.suffixes[0]}`,notes:g})}return c});super(e,a,t),this.played=new Set,this.opts=l}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${Eo(e)}${e.chord.toLowerCase()}`,notes:[]};let l=this.current.chord===t.chord;return this.current.chord.slice(-3)==="maj"&&!l&&(l=this.current.chord.slice(0,-3)===t.chord),this.addGuessed(t,l)}guess(){const e=Array.from(this.played.values()).map(n=>wo(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},l=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,l)}}const Co={major:{C:{num:0},F:{acc:"b",num:1},Bb:{acc:"b",num:2},Eb:{acc:"b",num:3},Ab:{acc:"b",num:4},Db:{acc:"b",num:5},Gb:{acc:"b",num:6},Cb:{acc:"b",num:7},G:{acc:"#",num:1},D:{acc:"#",num:2},A:{acc:"#",num:3},E:{acc:"#",num:4},B:{acc:"#",num:5},"F#":{acc:"#",num:6},"C#":{acc:"#",num:7}},minor:{A:{num:0},D:{acc:"b",num:1},G:{acc:"b",num:2},C:{acc:"b",num:3},F:{acc:"b",num:4},Bb:{acc:"b",num:5},Eb:{acc:"b",num:6},Ab:{acc:"b",num:7},E:{acc:"#",num:1},B:{acc:"#",num:2},"F#":{acc:"#",num:3},"C#":{acc:"#",num:4},"G#":{acc:"#",num:5},"D#":{acc:"#",num:6},"A#":{acc:"#",num:7}}};class Ft extends Ms{constructor(e,t){const l=e==="keys-major"?"major":"minor";super(e,Object.keys(Co[l]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class jt extends Ms{constructor(e,t){const l=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-l+1)).map((r,o)=>l+o),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const In={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},ht=Ve("waiting"),_t=gt(Ve(In),{key:"game-options"}),It=Ve(void 0),Rs=Ve(En().map(s=>({...s,selected:!0}))),Le={play(...[s,e]){var i,c,d;let t;const l=we(pt),n=we(ps),r=we(_t),o={scale:l,range:n,duplicates:r.duplicates,count:r.count};let a=[l.key,l.scale];if(s==="notes")t=new jt(s,o),De.setTarget([De.getNote(t.current)]),(i=we(lt))==null||i.noteOn(t.current);else if(s==="pitches")t=new jt(s,o),De.setTarget(),Be.setInputValue("useSound",!0),(c=we(lt))==null||c.noteOn(t.current);else if(s==="keys-major"||s=="keys-minor")t=new Ft(s,o),a=[t.current,s==="keys-major"?"major":"minor"];else if(s==="chords-play"||s==="chords-write")t=new mt(s,o,e);else if(s==="chords-diatonic"){const f=Cn(l.triads).map((g,_)=>({...g,allowed:new Set([l.scaleNotes[_].semitones])}));t=new mt(s,o,{chords:f})}else throw Error("Unknown game type: "+s);return typeof t.current!="number"&&typeof t.current!="string"&&((d=we(lt))==null||d.playChord(t.current.notes.map(f=>f.midi)),De.setTarget(t.current.notes)),De.setKeyAndScale(a[0],a[1]),De.clearPlayed(),ht.set("waiting"),It.set(t),t},updateState(s){ht.set(s)},setOptionValue(s,e){_t.update(t=>({...t,[s]:e}))},toggleChords(s){Rs.update(e=>e.map(t=>({...t,selected:s(t)})))},nextGuess(){var e,t;const s=we(It);s!=null&&s.ended?ht.set("ended"):s instanceof jt?(s.type==="notes"?De.setTarget([De.getNote(s.current)]):De.setTarget(),De.clearPlayed(),(e=we(lt))==null||e.noteOn(s.current),Le.updateState("waiting"),s.startTime()):s instanceof mt?(De.setTarget(s.current.notes),De.clearPlayed(),(t=we(lt))==null||t.playChord(s==null?void 0:s.current.notes.map(l=>l.midi)),ht.set("waiting"),s.startTime()):s instanceof Ft&&(De.setKey(s.current),ht.set("waiting"),s.startTime())},clearGame(s=!1){const e=we(It);e&&De.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),s&&_t.set(In),It.set(void 0),ht.set("waiting"),De.clearScore()}};function fl(s,e,t){const l=s.slice();return l[35]=e[t],l[37]=t,l}function dl(s,e,t){const l=s.slice();return l[40]=e[t],l}function hl(s,e,t){const l=s.slice();return l[9]=e[t],l}function ml(s,e,t){const l=s.slice();return l[35]=e[t],l[37]=t,l}function _l(s,e,t){const l=s.slice();return l[40]=e[t],l}function pl(s,e,t){const l=s.slice();return l[9]=e[t],l}function Io(s){let e,t=de(s[35].intervals),l=[];for(let n=0;n0?To:Io}let T=N(s),A=T(s);function w(){return s[26](s[35])}return{c(){e=b("li"),t=b("button"),l=b("span"),ge(n.$$.fragment),r=j(),o=b("div"),i=X(a),c=j(),d=b("li"),A.c(),g=j(),_=b("li"),h=b("button"),S=X(v),k=j(),this.h()},l(D){e=y(D,"LI",{});var O=C(e);t=y(O,"BUTTON",{class:!0});var I=C(t);l=y(I,"SPAN",{class:!0});var V=C(l);ve(n.$$.fragment,V),V.forEach(p),r=B(I),o=y(I,"DIV",{class:!0});var R=C(o);i=Z(R,a),R.forEach(p),I.forEach(p),O.forEach(p),c=B(D),d=y(D,"LI",{class:!0,title:!0});var M=C(d);A.l(M),M.forEach(p),g=B(D),_=y(D,"LI",{class:!0});var F=C(_);h=y(F,"BUTTON",{class:!0});var ee=C(h);S=Z(ee,v),ee.forEach(p),k=B(F),F.forEach(p),this.h()},h(){m(l,"class","px-1 py-1 rounded"),J(l,"text-green-500",s[35].selected),J(l,"text-gray-400",!s[35].selected),m(o,"class","ml-1 px-1 w-full bg-gray-200 svelte-1rg0xw5"),m(t,"class","flex items-center justify-center w-full select-btn svelte-1rg0xw5"),J(t,"hidden",s[8]),m(d,"class","intervals svelte-1rg0xw5"),m(d,"title",f=s[35].intervals.map(El).join("-")),m(h,"class","text-start"),m(_,"class","text-xs")},m(D,O){U(D,e,O),u(e,t),u(t,l),be(n,l,null),u(t,r),u(t,o),u(o,i),U(D,c,O),U(D,d,O),A.m(d,null),U(D,g,O),U(D,_,O),u(_,h),u(h,S),u(_,k),E=!0,L||(P=[$(t,"click",K),$(h,"click",w)],L=!0)},p(D,O){s=D;const I={};O[0]&128&&(I.icon=s[35].selected?us:fs),n.$set(I),(!E||O[0]&128)&&J(l,"text-green-500",s[35].selected),(!E||O[0]&128)&&J(l,"text-gray-400",!s[35].selected),(!E||O[0]&128)&&a!==(a=s[35].suffixes[0]+"")&&pe(i,a),(!E||O[0]&256)&&J(t,"hidden",s[8]),T===(T=N(s))&&A?A.p(s,O):(A.d(1),A=T(s),A&&(A.c(),A.m(d,null))),(!E||O[0]&128&&f!==(f=s[35].intervals.map(El).join("-")))&&m(d,"title",f),(!E||O[0]&128)&&v!==(v=s[35].name+"")&&pe(S,v)},i(D){E||(x(n.$$.fragment,D),E=!0)},o(D){W(n.$$.fragment,D),E=!1},d(D){D&&(p(e),p(c),p(d),p(g),p(_)),ye(n),A.d(),L=!1,Xe(P)}}}function Ao(s){let e,t=de(s[35].intervals),l=[];for(let n=0;n0?No:Ao}let T=N(s),A=T(s);function w(){return s[28](s[35])}return{c(){e=b("li"),t=b("button"),l=b("span"),ge(n.$$.fragment),r=j(),o=b("div"),i=X(a),c=j(),d=b("li"),A.c(),g=j(),_=b("li"),h=b("button"),S=X(v),k=j(),this.h()},l(D){e=y(D,"LI",{});var O=C(e);t=y(O,"BUTTON",{class:!0});var I=C(t);l=y(I,"SPAN",{class:!0});var V=C(l);ve(n.$$.fragment,V),V.forEach(p),r=B(I),o=y(I,"DIV",{class:!0});var R=C(o);i=Z(R,a),R.forEach(p),I.forEach(p),O.forEach(p),c=B(D),d=y(D,"LI",{class:!0,title:!0});var M=C(d);A.l(M),M.forEach(p),g=B(D),_=y(D,"LI",{class:!0});var F=C(_);h=y(F,"BUTTON",{class:!0});var ee=C(h);S=Z(ee,v),ee.forEach(p),k=B(F),F.forEach(p),this.h()},h(){m(l,"class","px-1 py-1 rounded"),J(l,"text-green-500",s[35].selected),J(l,"text-gray-400",!s[35].selected),m(o,"class","ml-1 px-1 w-full bg-gray-200 svelte-1rg0xw5"),m(t,"class","flex items-center justify-center w-full select-btn svelte-1rg0xw5"),J(t,"hidden",s[8]),m(d,"class","intervals svelte-1rg0xw5"),m(d,"title",f=s[35].intervals.map(Cl).join("-")),m(h,"class","text-start"),m(_,"class","text-xs")},m(D,O){U(D,e,O),u(e,t),u(t,l),be(n,l,null),u(t,r),u(t,o),u(o,i),U(D,c,O),U(D,d,O),A.m(d,null),U(D,g,O),U(D,_,O),u(_,h),u(h,S),u(_,k),E=!0,L||(P=[$(t,"click",K),$(h,"click",w)],L=!0)},p(D,O){s=D;const I={};O[0]&64&&(I.icon=s[35].selected?us:fs),n.$set(I),(!E||O[0]&64)&&J(l,"text-green-500",s[35].selected),(!E||O[0]&64)&&J(l,"text-gray-400",!s[35].selected),(!E||O[0]&64)&&a!==(a=s[35].suffixes[0]+"")&&pe(i,a),(!E||O[0]&256)&&J(t,"hidden",s[8]),T===(T=N(s))&&A?A.p(s,O):(A.d(1),A=T(s),A&&(A.c(),A.m(d,null))),(!E||O[0]&64&&f!==(f=s[35].intervals.map(Cl).join("-")))&&m(d,"title",f),(!E||O[0]&64)&&v!==(v=s[35].name+"")&&pe(S,v)},i(D){E||(x(n.$$.fragment,D),E=!0)},o(D){W(n.$$.fragment,D),E=!1},d(D){D&&(p(e),p(c),p(d),p(g),p(_)),ye(n),A.d(),L=!1,Xe(P)}}}function So(s){let e,t,l,n,r="Chords",o,a,i,c,d,f,g,_,h,v,S,k,E,L,P,K,N,T="Key",A,w,D,O,I="Scale",V,R,M,F,ee="Note",ie,Y,z,G,le,H,se,ce,Ce,oe;c=new Ue({props:{icon:Un,width:20}}),g=new Ue({props:{icon:Kn,width:16}}),v=new Ue({props:{icon:s[5]?Qs:Xs,width:16}}),E=new Ue({props:{icon:zt,width:16}}),R=new yn({props:{class:"bg-gray-100 w-48",containerClass:"input w-48",selected:s[1],options:s[10],onSelect:s[14]}});let he=de(s[7]),Q=[];for(let q=0;qW(Q[q],1,1,()=>{Q[q]=null});let Ee=de(s[6]),fe=[];for(let q=0;qW(fe[q],1,1,()=>{fe[q]=null});return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("button"),ge(g.$$.fragment),_=j(),h=b("button"),ge(v.$$.fragment),S=j(),k=b("button"),ge(E.$$.fragment),L=j(),P=b("div"),K=b("div"),N=b("label"),N.textContent=T,A=j(),w=b("input"),D=j(),O=b("label"),O.textContent=I,V=j(),ge(R.$$.fragment),M=j(),F=b("label"),F.textContent=ee,ie=j(),Y=b("input"),z=j(),G=b("ul");for(let q=0;qs.interval,Cl=s=>s.interval;function Do(s,e,t){let l,n,r,o,a,i,c,d,f;_e(s,nt,G=>t(30,a=G)),_e(s,lt,G=>t(31,i=G)),_e(s,Mt,G=>t(32,c=G)),_e(s,Rs,G=>t(24,d=G));let g="C",_="Major",h=xt(g,_),v="",S,k=[],E=[];const P=_s().map(G=>({key:G.names[0],value:G.names[0]})),K=gt(Ve(!0),{key:"chords-hidden"});_e(s,K,G=>t(8,f=G));function N(){K.update(G=>!G)}function T(){const G=S&&60+S.semitones;if("err"in h||!G)t(3,k=[]),t(4,E=[]);else{const le=h.data;t(3,k=n.map(H=>os(G,le,H.intervals))),t(4,E=r.map(H=>os(G,le,H.intervals)))}}function A({currentTarget:{value:G}}){t(0,g=`${G.charAt(0).toUpperCase()}${G.charAt(1).toLowerCase()}`),h=xt(g,_),T()}function w(G){var le;return t(1,_=(le=P.find(H=>G===H.key))==null?void 0:le.value),h=xt(g,_),T(),!1}function D({currentTarget:{value:G}}){t(2,v=`${G.charAt(0).toUpperCase()}${G.charAt(1).toLowerCase()}`),t(9,S=Gs(v)),T()}function O(G){Le.toggleChords(le=>le.name===G.name?!le.selected:le.selected)}function I(){const G=H=>H.suffixes[0]==="maj"||H.suffixes[0]==="m",le=d.filter(G).every(H=>H.selected);Le.toggleChords(H=>G(H)?!le:H.selected)}function V(){const G=H=>H.suffixes[0]==="maj7"||H.suffixes[0]==="m7"||H.suffixes[0]==="7"||H.suffixes[0]==="dim7"||H.suffixes[0]==="aug7",le=d.filter(G).every(H=>H.selected);Le.toggleChords(H=>G(H)?!le:H.selected)}function R(){Le.toggleChords(G=>!o)}function M(){Le.toggleChords(G=>!0)}function F(G){if("err"in h)return;const le=c[0].midi+((S==null?void 0:S.semitones)||0),H=os(le,h.data,G.intervals);i==null||i.playChord(H.map(se=>se.midi),a.fixedVelocity)}const ee=G=>O(G),ie=G=>F(G),Y=G=>O(G),z=G=>F(G);return s.$$set=G=>{t(22,e=Ae(Ae({},e),Ne(G)))},s.$$.update=()=>{s.$$.dirty[0]&16777216&&t(23,l=d),s.$$.dirty[0]&8388608&&t(7,n=l.filter((G,le)=>lele>=l.length/2)),s.$$.dirty[0]&8388608&&t(5,o=l.every(G=>G.selected))},e=Ne(e),[g,_,v,k,E,o,r,n,f,S,P,K,N,A,w,D,O,I,V,R,M,F,e,l,d,ee,ie,Y,z]}class Lo extends qe{constructor(e){super(),We(this,e,Do,So,$e,{},null,[-1,-1])}}function Il(s,e,t){const l=s.slice();return l[12]=e[t],l}function Oo(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},p:me,i:me,o:me,d(t){t&&p(e)}}}function Po(s){let e,t,l="Played:",n,r=de(s[2]),o=[];for(let a=0;a0?4:5}t=d(s),l=c[t]=i[t](s);function f(h,v){return h[0]&&h[1]==="ended"?Ko:h[0]&&h[3].autoplay?Uo:h[0]?Ro:Mo}let g=f(s),_=g(s);return{c(){e=b("div"),l.c(),r=j(),o=b("div"),_.c(),this.h()},l(h){e=y(h,"DIV",{class:!0});var v=C(e);l.l(v),v.forEach(p),r=B(h),o=y(h,"DIV",{class:!0});var S=C(o);_.l(S),S.forEach(p),this.h()},h(){m(e,"class",n=Te(`${s[9].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),m(o,"class","mt-2 h-8 flex items-center")},m(h,v){U(h,e,v),c[t].m(e,null),U(h,r,v),U(h,o,v),_.m(o,null),a=!0},p(h,[v]){let S=t;t=d(h),t===S?c[t].p(h,v):(xe(),W(c[S],1,1,()=>{c[S]=null}),Fe(),l=c[t],l?l.p(h,v):(l=c[t]=i[t](h),l.c()),x(l,1),l.m(e,null)),(!a||v&512&&n!==(n=Te(`${h[9].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"))&&m(e,"class",n),g===(g=f(h))&&_?_.p(h,v):(_.d(1),_=g(h),_&&(_.c(),_.m(o,null)))},i(h){a||(x(l),a=!0)},o(h){W(l),a=!1},d(h){h&&(p(e),p(r),p(o)),c[t].d(),_.d()}}}const Al=s=>s.note,Nl=s=>s.note;function Fo(s,e,t){let l,n,r,o;_e(s,pt,h=>t(11,l=h)),_e(s,ht,h=>t(1,n=h)),_e(s,wt,h=>t(2,r=h)),_e(s,_t,h=>t(3,o=h));let{game:a}=e;function i(){Le.nextGuess()}function c(){Le.setOptionValue("autoplay",!0),Le.nextGuess()}function d(){a instanceof mt?Le.play(a.type,a.opts):a&&Le.play(a.type,void 0)}function f(){Le.clearGame()}function g(h){const v=l.notesMap.get(h%12);return dt({midi:h,...v})}const _=()=>Le.setOptionValue("autoplay",!1);return s.$$set=h=>{t(9,e=Ae(Ae({},e),Ne(h))),"game"in h&&t(0,a=h.game)},e=Ne(e),[a,n,r,o,i,c,d,f,g,e,_]}class Ho extends qe{constructor(e){super(),We(this,e,Fo,xo,$e,{game:0})}}const Ds={ar:{name:"Arabic",import:Ie(()=>import("./arabic-TJdw9TqS.cd2ea0d3.js"),[],import.meta.url)},hye:{name:"Armenian Eastern",import:Ie(()=>import("./armenianEastern-LNw2V_Kb.e28a3752.js"),[],import.meta.url)},hyw:{name:"Armenian Western",import:Ie(()=>import("./armenianWestern-zmIyLd1o.38785f27.js"),[],import.meta.url)},be:{name:"Belarusian",import:Ie(()=>import("./belarusian--mjombxK.1fcd2897.js"),[],import.meta.url)},bn:{name:"Bengali",import:Ie(()=>import("./bengali-2-qmZ9ZL.b883376f.js"),[],import.meta.url)},pt:{name:"Brazilian",import:Ie(()=>import("./brazilian-_aUR_EdS.2b1b1fd9.js"),[],import.meta.url)},my:{name:"Burmese",import:Ie(()=>import("./burmese-DNLMDG0C.87e404a2.js"),[],import.meta.url)},zh:{name:"Chinese",import:Ie(()=>import("./chinese-Vv6o_huT.c292fc41.js"),[],import.meta.url)},cs:{name:"Czech",import:Ie(()=>import("./czech-AAz70GMU.0cffa7b5.js"),[],import.meta.url)},en:{name:"English",import:Promise.resolve().then(()=>qo)},fa:{name:"Farsi",import:Ie(()=>import("./farsi-akNUiiy1.62727da0.js"),[],import.meta.url)},fr:{name:"French",import:Ie(()=>import("./french-GKHnJmdK.94658ac4.js"),[],import.meta.url)},ka:{name:"Georgian",import:Ie(()=>import("./georgian-SQFgQD3n.89ef2935.js"),[],import.meta.url)},de:{name:"German",import:Ie(()=>import("./german-Wy-4wNPv.fa6f994f.js"),[],import.meta.url)},el:{name:"Greek",import:Ie(()=>import("./greek-lay7OJjb.9c2c2556.js"),[],import.meta.url)},he:{name:"Hebrew",import:Ie(()=>import("./hebrew-V6ZtD_jG.48875cb9.js"),[],import.meta.url)},hi:{name:"Hindi",import:Ie(()=>import("./hindi-uNDpRlqm.76d6c741.js"),[],import.meta.url)},hu:{name:"Hungarian",import:Ie(()=>import("./hungarian-Wnxix6n4.45652951.js"),[],import.meta.url)},it:{name:"Italian",import:Ie(()=>import("./italian-eDgp6wHT.50798155.js"),[],import.meta.url)},ja:{name:"Japanese",import:Ie(()=>import("./japanese-Zv_Q1DDl.d78f358a.js"),[],import.meta.url)},mk:{name:"Macedonian",import:Ie(()=>import("./macedonian-Dot-tKLH.04517113.js"),[],import.meta.url)},yo:{name:"Nigerian",import:Ie(()=>import("./nigerian-IYPkF_j3.5b26cce3.js"),[],import.meta.url)},nko:{name:"Nko",import:Ie(()=>import("./nko-EI8QPheE.3268d6cd.js"),[],import.meta.url)},no:{name:"Norwegian",import:Ie(()=>import("./norwegian-sal6SH2s.847bc0b5.js"),[],import.meta.url)},pl:{name:"Polish",import:Ie(()=>import("./polish-yYQdl0aw.936f6a15.js"),[],import.meta.url)},pa:{name:"Punjabi",import:Ie(()=>import("./punjabi-0AIiTj_p.01c98b73.js"),[],import.meta.url)},ru:{name:"Russian",import:Ie(()=>import("./russian-sQ885m4A.ff7543fb.js"),[],import.meta.url)},es:{name:"Spanish",import:Ie(()=>import("./spanish-Ww3zYGV_.0ed27470.js"),[],import.meta.url)},sv:{name:"Swedish",import:Ie(()=>import("./swedish-RpPWxHx_.af07bd5e.js"),[],import.meta.url)},te:{name:"Telugu",import:Ie(()=>import("./telugu-WPb3GXn5.f8d401d9.js"),[],import.meta.url)},th:{name:"Thai",import:Ie(()=>import("./thai-Q-LTk3Id.1148f3d0.js"),[],import.meta.url)},tr:{name:"Turkish",import:Ie(()=>import("./turkish-qQEi80RS.cb967a2e.js"),[],import.meta.url)},uk:{name:"Ukrainian",import:Ie(()=>import("./ukrainian-CLoogq0p.3e4781c0.js"),[],import.meta.url)},ug:{name:"Uyghur",import:Ie(()=>import("./uyghur-eF-99IjK.066cbfdb.js"),[],import.meta.url)}};function Tn(s){if(!("default"in s.layout)||!("shift"in s.layout))throw console.error(s),Error("Invalid layout import");return{default:s.layout.default.slice(0,4)}}async function zo(s=["en"]){let e={code:"en",layout:Ds.en,index:99};Object.entries(Ds).forEach(([l,n])=>{for(let r=0;rr)&&(e={code:l,layout:n,index:r})});const t=await e.layout.import;return{code:e.code,name:e.layout.name,imported:Tn(t.default)}}const An={layout:{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]}},qo=Object.freeze(Object.defineProperty({__proto__:null,default:An},Symbol.toStringTag,{value:"Module"})),Nn=[0,2,4,5,7,9,11],Sn=[1,3,-1,6,8,10,-1];function Wo(s,e,t){const l=s.keyType==="white"?Nn:Sn,n=l[t%l.length];let r;if(n>=0){r=e[n];const o=Math.floor(t/l.length);return{...r,semitones:r.semitones+(o>0?o:0)*12}}}function Vt(s,e,t=0,l=0){const n=s.keyType==="white"?Nn:Sn;let r=-1,o=0,a=0;return s.keys.forEach((i,c)=>{if(i.key.charAt(0)!=="{"&&c>=t&&r===-1?r=c:r!==-1&&i.key==="{empty}"&&(o+=1),r!==-1&&i.key.charAt(0)!=="{"){const d=c-o-r+l,f=n[d%n.length];if(f>=0){const g=e[f],_=Math.floor(d/n.length);i.note={...g,semitones:g.semitones+(_>0?_:0)*12},a=c-r}}}),{firstIndex:r,lastIndex:a}}const Dn=[["IntlBackslash","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Digit0","Minus","Equal","Backspace"],["Tab","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Enter"],["Capslock","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","Backslash"],["ShiftLeft","Backquote","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","ShiftRight"]];function $o(s,e){let t=[];const l=s.default.map((o,a)=>{if(a===0){const i=o.split(" ").filter(c=>c!=="{bksp}");for(;i.length!==13;)i.length<13?i.unshift("{empty}"):i.shift();return[...i,"{bksp}"]}else if(a===1){const i=o.split(" ");return t=i.slice(13),[...i.slice(0,13),"{enter}"]}else{if(a===2)return[...o.split(" ").slice(0,13).filter(i=>i!=="{enter}"),...t].slice(0,13);if(a===3){const i=["{shift}",...o.split(" ").slice(1,12).filter(d=>d!=="{shift}"),"{shift}"];let c=1;for(;i.length<13;)i.splice(c,0,"{empty}"),c=c===1?-1:1;return i}else return o.split(" ")}});let n;s.codes?n=s.codes.map(o=>o.split(" ")):n=Dn;const r=[0,1,2,3].map(o=>l[o].map((a,i)=>({key:a,code:n[o][i]})));return[{keyType:e==="two-rows"?"black":null,startNoteOffset:2,availableNotes:11,keys:r[0]},{keyType:e==="two-rows"?"white":"black",startNoteOffset:e==="two-rows"?1:2,availableNotes:12,keys:r[1]},{keyType:e==="two-rows"?"black":"white",startNoteOffset:1,availableNotes:12,keys:r[2]},{keyType:e==="two-rows"?"white":null,startNoteOffset:1,availableNotes:11,keys:r[3]}]}const Sl=[{keyType:null,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:null,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:null,startNoteOffset:0,availableNotes:0,keys:[]},{keyType:null,startNoteOffset:0,availableNotes:0,keys:[]}];class Ln{constructor(e){return this.rows=Sl,this.setCustomRow={row:Sl[0],rowIndex:0,nextKeyIdx:-1,nextNoteOffset:0},this.opts={hotkeydRows:"middle-row",isCustom:!1,layout:{code:"en",name:"English",imported:Tn(An)},...e},this.loadRowsFromImport(this.opts.layout.imported)}setOptions(e){this.opts={...this.opts,...e}}loadRowsFromImport(e){return this.rows=$o(e,this.opts.hotkeydRows),this}setRows(e){return this.rows=e,this}setNotes(e){if(this.opts.hotkeydRows==="middle-row"){const{firstIndex:t}=Vt(this.rows[2],e);Vt(this.rows[1],e,1+t)}else{const{firstIndex:t,lastIndex:l}=Vt(this.rows[3],e);Vt(this.rows[2],e,t);const{firstIndex:n}=Vt(this.rows[1],e,0,l+1);Vt(this.rows[0],e,1+n,l+1)}}startSetCustomRow(e){const t={...this.rows[e],keys:this.rows[e].keys.map(a=>({...a}))},{availableNotes:l,startNoteOffset:n}=t,r=this.opts.hotkeydRows==="two-rows"&&(e===0||e===1)?3:-1,o=r!==-1?this.rows[r].keys.reduce((a,i)=>(a===-1&&i.note?a=0:a!==-1&&(i.key[0]!=="{"||i.key==="{empty}")&&(a+=1),a),-1)+1:0;return this.setCustomRow={row:t,rowIndex:e,nextKeyIdx:n,nextNoteOffset:o},{first:n,count:l}}setNextCustomNote(e,t,l){let n;const{nextKeyIdx:r,nextNoteOffset:o,row:a}=this.setCustomRow,i=r+o-a.startNoteOffset,c=Wo(a,l,i);return c?n={key:e,code:t,note:c}:n={key:e,code:t},this.setCustomRow.nextKeyIdx+=1,{index:this.setCustomRow.nextKeyIdx,key:n}}skipNextCustomNote(){return this.setCustomRow.nextKeyIdx+=1,this.setCustomRow.nextNoteOffset-=1,{index:this.setCustomRow.nextKeyIdx,key:{code:"EMPTY",key:"{empty}"}}}}function Jo(s){const e=[...s.map(n=>n.keys.map(r=>r.key).join(" "))],t=["","","",""];let l=!1;return s.forEach((n,r)=>{const o=[];for(let a=0;a({}),Ll=s=>({}),Qo=s=>({}),Ol=s=>({});function Pl(s){let e,t,l,n,r,o,a,i,c,d,f;const g=s[12].header,_=Os(g,s,s[11],Ll);let h=de(s[0]),v=[];for(let k=0;kW(v[k],1,1,()=>{v[k]=null});return{c(){e=b("button"),l=j(),n=b("ul"),r=b("li"),_&&_.c(),o=j();for(let k=0;k{c&&(t||(t=Ct(e,as,{duration:ns},!0)),t.run(1))}),x(_,k);for(let E=0;E{c&&(i||(i=Ct(n,is,{duration:ns},!0)),i.run(1))}),c=!0}},o(k){k&&(t||(t=Ct(e,as,{duration:ns},!1)),t.run(0)),W(_,k),v=v.filter(Boolean);for(let E=0;E{h[L]=null}),Fe(),n=h[l],n?n.p(s,E):(n=h[l]=_[l](s),n.c()),x(n,1),n.m(t,r)),(!d||E&1)&&a!==(a=s[16]+"")&&pe(i,a),(!d||E&9)&&J(t,"selected",s[15]===s[3])},i(k){d||(x(n),d=!0)},o(k){W(n),d=!1},d(k){k&&p(e),h[l].d(),f=!1,g()}}}function er(s){let e,t,l,n,r,o,a,i,c;const d=s[12].value,f=Os(d,s,s[11],Ol);let g=s[6]&&Pl(s);return{c(){e=b("div"),t=b("button"),f&&f.c(),r=j(),g&&g.c(),this.h()},l(_){e=y(_,"DIV",{class:!0,id:!0});var h=C(e);t=y(h,"BUTTON",{class:!0,title:!0});var v=C(t);f&&f.l(v),v.forEach(p),r=B(h),g&&g.l(h),h.forEach(p),this.h()},h(){m(t,"class",l=Te(`${s[9].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),m(t,"title",n=s[9].title||""),J(t,"disabled",s[4]),J(t,"open",s[6]),m(e,"class",o=Te(`relative ${s[2]||""}`)+" svelte-h65upg"),m(e,"id",s[1])},m(_,h){U(_,e,h),u(e,t),f&&f.m(t,null),u(e,r),g&&g.m(e,null),s[14](e),a=!0,i||(c=$(t,"click",s[7]),i=!0)},p(_,[h]){f&&f.p&&(!a||h&2048)&&Ps(f,d,_,_[11],a?js(d,_[11],h,Qo):Vs(_[11]),Ol),(!a||h&512&&l!==(l=Te(`${_[9].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&m(t,"class",l),(!a||h&512&&n!==(n=_[9].title||""))&&m(t,"title",n),(!a||h&528)&&J(t,"disabled",_[4]),(!a||h&576)&&J(t,"open",_[6]),_[6]?g?(g.p(_,h),h&64&&x(g,1)):(g=Pl(_),g.c(),x(g,1),g.m(e,null)):g&&(xe(),W(g,1,1,()=>{g=null}),Fe()),(!a||h&4&&o!==(o=Te(`relative ${_[2]||""}`)+" svelte-h65upg"))&&m(e,"class",o),(!a||h&2)&&m(e,"id",_[1])},i(_){a||(x(f,_),x(g),a=!0)},o(_){W(f,_),W(g),a=!1},d(_){_&&p(e),f&&f.d(_),g&&g.d(),s[14](null),i=!1,c()}}}const ns=400;function tr(s,e,t){let{$$slots:l={},$$scope:n}=e,{options:r,id:o=void 0,containerClass:a=void 0,selected:i=void 0,disabled:c=void 0,onSelect:d}=e,f,g=!1;function _(){c||t(6,g=!g)}function h(k){t(6,g=d(k))}const v=k=>h(k);function S(k){Bs[k?"unshift":"push"](()=>{f=k,t(5,f)})}return s.$$set=k=>{t(9,e=Ae(Ae({},e),Ne(k))),"options"in k&&t(0,r=k.options),"id"in k&&t(1,o=k.id),"containerClass"in k&&t(2,a=k.containerClass),"selected"in k&&t(3,i=k.selected),"disabled"in k&&t(4,c=k.disabled),"onSelect"in k&&t(10,d=k.onSelect),"$$scope"in k&&t(11,n=k.$$scope)},e=Ne(e),[r,o,a,i,c,f,g,_,h,e,d,n,l,v,S]}class sr extends qe{constructor(e){super(),We(this,e,tr,er,$e,{options:0,id:1,containerClass:2,selected:3,disabled:4,onSelect:10})}}function lr(s){let e,t,l,n,r,o,a;return{c(){e=b("label"),t=b("input"),l=j(),n=b("div"),this.h()},l(i){e=y(i,"LABEL",{class:!0});var c=C(e);t=y(c,"INPUT",{type:!0,class:!0}),l=B(c),n=y(c,"DIV",{class:!0}),C(n).forEach(p),c.forEach(p),this.h()},h(){t.checked=s[0],m(t,"type","checkbox"),m(t,"class","svelte-k5zciy"),m(n,"class","slider svelte-k5zciy"),m(e,"class",r=Te(`${s[3].class||""} toggle`)+" svelte-k5zciy")},m(i,c){U(i,e,c),u(e,t),s[5](t),u(e,l),u(e,n),o||(a=[$(t,"change",s[4]),$(t,"keydown",s[2])],o=!0)},p(i,[c]){c&1&&(t.checked=i[0]),c&8&&r!==(r=Te(`${i[3].class||""} toggle`)+" svelte-k5zciy")&&m(e,"class",r)},i:me,o:me,d(i){i&&p(e),s[5](null),o=!1,Xe(a)}}}function nr(s,e,t){let{checked:l}=e,n;function r(i){i.key==="Enter"&&n.click()}function o(i){ms.call(this,s,i)}function a(i){Bs[i?"unshift":"push"](()=>{n=i,t(1,n)})}return s.$$set=i=>{t(3,e=Ae(Ae({},e),Ne(i))),"checked"in i&&t(0,l=i.checked)},e=Ne(e),[l,n,r,e,o,a]}class or extends qe{constructor(e){super(),We(this,e,nr,lr,$e,{checked:0})}}function rr(s,e,t){return e==="Escape"?{e:"hotkeys-cancel"}:e==="Space"?{e:"hotkeys-skip-key"}:s.has(e)?{e:"hotkeys-no-key"}:(s.add(e),{e:"hotkeys-captured-key",data:{code:e,key:t}})}const Us=/^[a-gA-G]$/,On=/^[♭Bb#♯sS]$/,ar=/^[0-9]$/;let te="",Qe;function ir(s,e){const{useHotkeys:t}=we(nt),l=we(xs).get(s);if(t&&te.length===0&&l&&l.note)return te="",{e:"guessed-key",data:l.note.note};if(!t&&te.length===0&&Us.test(e))return te+=e.toUpperCase(),{e:"string",data:te};if(!t&&te.length>0&&On.test(e))return e==="b"||e==="B"?te+="♭":te+="♯",{e:"string",data:te};if(s==="Backspace"&&te.length>0)return te=te.slice(0,-1),{e:"string",data:te};if(s==="Enter"&&te.length>0){const n=te;return te="",{e:"guessed-key",data:n}}return!1}function cr(s,e){if(s==="Enter"&&te.length>0){const t={note:"",flats:0,sharps:0,chord:""};for(let l=0;l0?t.chord+=te[l].toLowerCase():te[l]==="♭"?(t.note+=te[l],t.flats+=1):te[l]==="♯"?(t.note+=te[l],t.sharps+=1):t.chord+=te[l].toLowerCase();return te="",{e:"guessed-chord",data:t}}else{if(s==="Backspace"&&te.length>0)return te=te.slice(0,-1),{e:"string",data:te};if(te.length===0&&Us.test(e))return te+=e.toUpperCase(),{e:"string",data:te};if(te.length>0&&e.length===1)return te.length===1&&(e==="b"||e==="B")?te+="♭":te.length===1&&e==="#"?te+="♯":te+=e,{e:"string",data:te}}return!1}function ur(s,e,t){const{useAutoOctave:l,useHotkeys:n}=we(nt);let r;const a=we(xs).get(s),i=(a==null?void 0:a.key)||"";let c=!1;if(!Qe&&n&&(a!=null&&a.note)?(Qe=a.note,l&&(r=ds({midi:we(Mt)[0].midi,flats:0,sharps:0})),c="note"):!n&&te.length===0&&Us.test(e)?(te+=e.toUpperCase(),c="input"):!n&&te.length>0&&On.test(e)?(e==="b"||e==="B"?te+="♭":te+="♯",c="input"):!n&&te.length>0&&s==="Enter"&&l&&(r=ds({midi:we(Mt)[0].midi,flats:0,sharps:0}),c="octave"),!c&&ar.test(i))try{r=parseInt(i),c="octave"}catch{}if(c&&(Qe||te)&&r!==void 0){const d=(Qe==null?void 0:Qe.note)??te;return t&&(r+=1),Qe&&(Qe==null?void 0:Qe.semitones)>=12&&(r+=Math.floor(Qe.semitones/12)),Qe=void 0,te="",{e:"guessed-note",data:{note:d,octave:r}}}else if(s==="Backspace"&&(Qe||te.length>0))return Qe=void 0,te=te.slice(0,-1),{e:"string",data:te};return c==="note"?{e:"note",data:Qe}:c==="input"?{e:"string",data:te}:!1}const Ks={code:"en",name:"English",imported:{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}"]}},Kt=new Set,Pn=new Ln({layout:Ks}),ft=Ve(void 0);Ht(ft,s=>s?[s.rowIndex,s.nextIndex]:[-1,-1]);const Et=gt(Ve({isCustom:!1,layout:Ks,hotkeydRows:"middle-row"}),{key:"keyboard-options"}),Rt=Ve(Pn.rows),Tt=Ve(Pn);pt.subscribe(s=>{const e=we(Tt);e.setNotes(Array.from(s.notesMap.values())),Rt.set(e.rows),Tt.set(e),console.log("SCALES CHANGED",e)});Et.subscribe(s=>{console.log("OLD",we(Tt));const e=new Ln(s),t=we(pt);e.setNotes(Array.from(t.notesMap.values())),Rt.set(e.rows),Tt.set(e),console.log("OPTIONS CHANGED",e)});const xs=Ht(Tt,s=>(console.log("HELLO ",s.rows[2]),new Map([...s.rows[0].keys.map(e=>[e.code,e]),...s.rows[1].keys.map(e=>[e.code,e]),...s.rows[2].keys.map(e=>[e.code,e]),...s.rows[3].keys.map(e=>[e.code,e])]))),fr=Ht(xs,s=>Array.from(s.values()).map(e=>e.note).filter(e=>e!==void 0).sort((e,t)=>e.semitones-t.semitones)),it={async setLayout(s){const e=await zo(s),t=we(Et);e.code!==t.layout.code&&Et.update(l=>({...l,isCustom:!1,layout:e}))},async setCustomLayout(s){s?Et.update(e=>({...e,isCustom:s,layout:{code:"custom",name:"Custom",imported:e.layout.imported}})):this.setLayout(navigator.languages)},toggleRows(s){Et.update(e=>({...e,hotkeydRows:s??(e.hotkeydRows==="middle-row"?"two-rows":"middle-row")}))},captureHotkeyRow(s){const e=we(Tt),t=we(pt),{first:l,count:n}=e.startSetCustomRow(s);console.log(`first ${l} count ${n}`),console.log("kbd",e.setCustomRow),ft.set({nextIndex:l,rowIndex:s,count:n,scaleNotes:Array.from(t.notesMap.values())})},findNote(s){return we(fr).find(e=>{if(e.note.charAt(0)===s.charAt(0)){const t=s.slice(1).split("").reduce((l,n)=>l+(n.toLowerCase()==="b"||n==="♭"?-1:n.toLowerCase()==="s"||n==="#"||n==="♯"?1:0),0);return t>0?e.sharps===t:t<0?e.flats===t*-1:e.flats===0&&e.sharps===0}})},handleHotkeyInput(s,e,t){const l=rr(Kt,e,t),n=we(Tt);console.log(`input: ${e} ${t} ${l.e}`);let r;console.log("kbd ",n.setCustomRow);const o=n.setCustomRow.nextKeyIdx;l.e==="hotkeys-cancel"?(ft.set(void 0),Kt.clear()):l.e==="hotkeys-skip-key"?r=n.skipNextCustomNote():l.e==="hotkeys-captured-key"&&(r=n.setNextCustomNote(l.data.key,l.data.code,s.scaleNotes));const a=we(Rt);if(r&&(a[s.rowIndex].keys[o]=r.key,Rt.set(a),console.log(`index ${o} NEXT `,r),ft.update(i=>i?{...i,nextIndex:r.index}:void 0)),s.count===o){const i=Jo(a);console.log("layout ",i),Et.update(c=>({...c,layout:{...c.layout,imported:i}})),ft.set(void 0),Kt.clear()}return l},handleInput(s,e,t=!1){const l=we(It),n=we(ft);return n?this.handleHotkeyInput(n,s,e):l instanceof Ft?ir(s,e.toUpperCase()):l instanceof mt&&l.type==="chords-write"?cr(s,e):we(nt).useKeyboard?ur(s,e.toUpperCase(),t):!1},cancelCapture(){ft.set(void 0),Kt.clear()},reset(){Et.set({isCustom:!1,layout:Ks,hotkeydRows:"middle-row"}),ft.set(void 0),Kt.clear()}};function jl(s){let e;return{c(){e=b("li"),this.h()},l(t){e=y(t,"LI",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","m-[0.175rem] mr-0")},m(t,l){U(t,e,l)},d(t){t&&p(e)}}}function Bl(s){let e;return{c(){e=b("div"),this.h()},l(t){e=y(t,"DIV",{class:!0}),C(e).forEach(p),this.h()},h(){m(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-1479mcy")},m(t,l){U(t,e,l)},d(t){t&&p(e)}}}function Gl(s){let e,t=s[0].note.note+"",l,n;return{c(){e=b("div"),l=X(t),n=X(s[3]),this.h()},l(r){e=y(r,"DIV",{class:!0});var o=C(e);l=Z(o,t),n=Z(o,s[3]),o.forEach(p),this.h()},h(){m(e,"class","absolute top-0 left-0")},m(r,o){U(r,e,o),u(e,l),u(e,n)},p(r,o){o&1&&t!==(t=r[0].note.note+"")&&pe(l,t),o&8&&pe(n,r[3])},d(r){r&&p(e)}}}function dr(s){let e,t,l,n,r,o,a=Rl(s[0].key)+"",i,c,d,f,g=s[0].key==="{enter}"&&jl(),_=s[0].key==="{enter}"&&Bl(),h=s[0].note&&Gl(s);return{c(){g&&g.c(),e=j(),t=b("li"),l=b("button"),_&&_.c(),n=j(),h&&h.c(),r=j(),o=b("div"),i=X(a),this.h()},l(v){g&&g.l(v),e=B(v),t=y(v,"LI",{class:!0});var S=C(t);l=y(S,"BUTTON",{class:!0});var k=C(l);_&&_.l(k),n=B(k),h&&h.l(k),r=B(k),o=y(k,"DIV",{});var E=C(o);i=Z(E,a),E.forEach(p),k.forEach(p),S.forEach(p),this.h()},h(){m(l,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex justify-center svelte-1479mcy"),J(l,"items-center",!s[0].note),J(l,"items-end",s[0].note),m(t,"class",c=Te(`${s[4].class||""} m-[0.175rem] ${Ml(s[1])} min-w-[32px]`)+" svelte-1479mcy"),J(t,"enter",s[0].key==="{enter}"),J(t,"captured",s[2])},m(v,S){g&&g.m(v,S),U(v,e,S),U(v,t,S),u(t,l),_&&_.m(l,null),u(l,n),h&&h.m(l,null),u(l,r),u(l,o),u(o,i),d||(f=$(l,"click",s[10]),d=!0)},p(v,[S]){v[0].key==="{enter}"?g||(g=jl(),g.c(),g.m(e.parentNode,e)):g&&(g.d(1),g=null),v[0].key==="{enter}"?_||(_=Bl(),_.c(),_.m(l,n)):_&&(_.d(1),_=null),v[0].note?h?h.p(v,S):(h=Gl(v),h.c(),h.m(l,r)):h&&(h.d(1),h=null),S&1&&a!==(a=Rl(v[0].key)+"")&&pe(i,a),S&1&&J(l,"items-center",!v[0].note),S&1&&J(l,"items-end",v[0].note),S&18&&c!==(c=Te(`${v[4].class||""} m-[0.175rem] ${Ml(v[1])} min-w-[32px]`)+" svelte-1479mcy")&&m(t,"class",c),S&19&&J(t,"enter",v[0].key==="{enter}"),S&22&&J(t,"captured",v[2])},i:me,o:me,d(v){v&&(p(e),p(t)),g&&g.d(v),_&&_.d(),h&&h.d(),d=!1,f()}}}function Ml(s){return s&&Number.isInteger(s)?`size-${s}`:s?`size-${Math.floor(s)}-${Math.floor(s*10)-Math.floor(s)*10}`:"size-1"}function Rl(s){return s==="{empty}"?"":s==="{bksp}"?"Backspace":s==="{tab}"?"Tab":s==="{enter}"?"Enter":s==="{lock}"?"Capslock":s==="{shift}"?"Shift":s}function hr(s,e,t){let l,n,r,o,a,i;_e(s,ft,_=>t(7,o=_)),_e(s,ps,_=>t(8,a=_)),_e(s,Rt,_=>t(9,i=_));let{rowIndex:c,keyIndex:d}=e,f;function g(_){ms.call(this,s,_)}return s.$$set=_=>{t(4,e=Ae(Ae({},e),Ne(_))),"rowIndex"in _&&t(5,c=_.rowIndex),"keyIndex"in _&&t(6,d=_.keyIndex)},s.$$.update=()=>{s.$$.dirty&608&&t(0,l=i[c].keys[d]),s.$$.dirty&257&&t(3,n=l.note?ds({midi:l.note.semitones+a[0],flats:0,sharps:0}):0),s.$$.dirty&224&&t(2,r=o&&o.rowIndex===c&&o.nextIndex===d),s.$$.dirty&65&&(l.key==="{bksp}"?t(1,f=2):l.key==="{tab}"?t(1,f=1.5):l.key==="{enter}"?t(1,f=2):l.key==="{lock}"?t(1,f=1.75):l.key==="{shift}"&&d===0?t(1,f=1.5):l.key==="{shift}"?t(1,f=2.5):t(1,f=1))},e=Ne(e),[l,f,r,n,e,c,d,o,a,i,g]}class mr extends qe{constructor(e){super(),We(this,e,hr,dr,$e,{rowIndex:5,keyIndex:6})}}function Ul(s,e,t){const l=s.slice();return l[13]=e[t],l[15]=t,l}function Kl(s,e,t){const l=s.slice();return l[16]=e[t],l[18]=t,l}function _r(s){let e,t=s[0].layout.name+"",l;return{c(){e=b("div"),l=X(t),this.h()},l(n){e=y(n,"DIV",{slot:!0});var r=C(e);l=Z(r,t),r.forEach(p),this.h()},h(){m(e,"slot","value")},m(n,r){U(n,e,r),u(e,l)},p(n,r){r&1&&t!==(t=n[0].layout.name+"")&&pe(l,t)},d(n){n&&p(e)}}}function xl(s){let e,t,l,n,r;t=new Ue({props:{icon:xn,width:20}});function o(){return s[12](s[15])}return{c(){e=b("button"),ge(t.$$.fragment),this.h()},l(a){e=y(a,"BUTTON",{class:!0});var i=C(e);ve(t.$$.fragment,i),i.forEach(p),this.h()},h(){m(e,"class","flex items-center justify-center rounded w-full h-full hover:bg-gray-300")},m(a,i){U(a,e,i),be(t,e,null),l=!0,n||(r=$(e,"click",o),n=!0)},p(a,i){s=a},i(a){l||(x(t.$$.fragment,a),l=!0)},o(a){W(t.$$.fragment,a),l=!1},d(a){a&&p(e),ye(t),n=!1,r()}}}function Fl(s){let e,t;return e=new mr({props:{rowIndex:s[15],keyIndex:s[18]}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},p:me,i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){W(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function Hl(s){let e,t,l,n,r=s[2][s[15]]&&s[0].isCustom&&xl(s),o=de(s[13].keys),a=[];for(let c=0;cW(a[c],1,1,()=>{a[c]=null});return{c(){e=b("li"),r&&r.c(),t=j();for(let c=0;c{r=null}),Fe()),d&8){o=de(c[13].keys);let f;for(f=0;fW(G[H],1,1,()=>{G[H]=null});return{c(){e=b("div"),t=b("div"),l=b("div"),n=b("div"),r=b("label"),r.textContent=o,a=j(),ge(i.$$.fragment),c=j(),d=b("div"),f=b("label"),f.textContent=g,_=j(),h=b("input"),S=j(),k=b("div"),E=b("label"),E.textContent=L,P=j(),ge(K.$$.fragment),N=j(),T=b("label"),T.textContent=A,w=j(),D=b("div"),O=b("button"),ge(I.$$.fragment),V=j(),R=b("div"),M=b("ul");for(let H=0;Ht(0,r=v)),_e(s,Rt,v=>t(11,o=v)),_e(s,Tt,v=>t(3,a=v)),bn(()=>{a.opts.isCustom||it.setLayout(navigator.languages)});const i=Object.entries(Ds).map(([v,S])=>({key:v,value:S.name}));function c(){it.reset(),it.setLayout(navigator.languages)}function d(v){return it.setLayout([v]),!1}function f(v){it.setCustomLayout(v.currentTarget.checked)}function g(v){it.captureHotkeyRow(v)}function _(){it.toggleRows()}const h=v=>g(v);return s.$$set=v=>{t(10,e=Ae(Ae({},e),Ne(v)))},s.$$.update=()=>{s.$$.dirty&2049&&t(2,l=o.map((v,S)=>r.hotkeydRows==="middle-row"?S===1||S===2:!0)),s.$$.dirty&1&&t(1,n=r.hotkeydRows==="middle-row")},e=Ne(e),[r,n,l,a,i,c,d,f,g,_,e,o,h]}class vr extends qe{constructor(e){super(),We(this,e,gr,pr,$e,{})}}function zl(s){let e,t;return e=new vr({props:{class:"mt-4"}}),{c(){ge(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,n){be(e,l,n),t=!0},i(l){t||(x(e.$$.fragment,l),t=!0)},o(l){W(e.$$.fragment,l),t=!1},d(l){ye(e,l)}}}function br(s){let e,t,l,n,r="I/O",o,a,i,c,d,f,g,_,h="Device",v,S,k,E,L,P,K="Prompt",N,T,A="Disable",w,D,O,I,V="Sound",R,M,F,ee,ie,Y,z="Fixed velocity",G,le,H,se,ce,Ce,oe="Keyboard",he,Q,ue,Ee,fe,He,q="Hotkeys",re,ke,tt,ne,je,Me,vt="Auto-octave",Nt,ze,Ke,St,st,Je,Fs=" ",gs,Dt,ct,vs,qt,bs,bt,yt,Hs="Fade timeout",ys,ut,ks,Wt,Ye,ws,zs;c=new Ue({props:{icon:zt,width:16}});let Ge=s[2]&&!s[4]&&zl();return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("div"),g=b("div"),_=b("label"),_.textContent=h,v=j(),S=b("input"),E=j(),L=b("div"),P=b("button"),P.textContent=K,N=j(),T=b("button"),T.textContent=A,w=j(),D=b("div"),O=b("div"),I=b("label"),I.textContent=V,R=j(),M=b("input"),ee=j(),ie=b("div"),Y=b("label"),Y.textContent=z,G=j(),le=b("input"),H=j(),se=b("div"),ce=b("div"),Ce=b("label"),Ce.textContent=oe,he=j(),Q=b("input"),Ee=j(),fe=b("div"),He=b("label"),He.textContent=q,re=j(),ke=b("input"),ne=j(),je=b("div"),Me=b("label"),Me.textContent=vt,Nt=j(),ze=b("input"),St=j(),st=b("div"),Je=b("div"),Je.textContent=Fs,gs=j(),Dt=b("div"),ct=b("button"),vs=X("Set hotkeys"),bs=j(),bt=b("div"),yt=b("label"),yt.textContent=Hs,ys=j(),ut=b("input"),ks=j(),Ge&&Ge.c(),this.h()},l(Se){e=y(Se,"DIV",{class:!0});var Re=C(e);t=y(Re,"FIELDSET",{class:!0});var ot=C(t);l=y(ot,"LEGEND",{class:!0});var qs=C(l);n=y(qs,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(n)!=="svelte-1jbbsti"&&(n.textContent=r),qs.forEach(p),o=B(ot),a=y(ot,"DIV",{class:!0});var Ws=C(a);i=y(Ws,"BUTTON",{class:!0});var $s=C(i);ve(c.$$.fragment,$s),$s.forEach(p),Ws.forEach(p),d=B(ot),f=y(ot,"DIV",{class:!0});var kt=C(f);g=y(kt,"DIV",{class:!0});var Lt=C(g);_=y(Lt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(_)!=="svelte-crpa7y"&&(_.textContent=h),v=B(Lt),S=y(Lt,"INPUT",{class:!0,id:!0}),E=B(Lt),L=y(Lt,"DIV",{class:!0});var $t=C(L);P=y($t,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(P)!=="svelte-mj6mct"&&(P.textContent=K),N=B($t),T=y($t,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(T)!=="svelte-1sl6oxh"&&(T.textContent=A),$t.forEach(p),Lt.forEach(p),w=B(kt),D=y(kt,"DIV",{class:!0});var Jt=C(D);O=y(Jt,"DIV",{class:!0});var Yt=C(O);I=y(Yt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(I)!=="svelte-wgxtkw"&&(I.textContent=V),R=B(Yt),M=y(Yt,"INPUT",{class:!0,id:!0,type:!0}),Yt.forEach(p),ee=B(Jt),ie=y(Jt,"DIV",{class:!0});var Qt=C(ie);Y=y(Qt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Y)!=="svelte-1tm2bth"&&(Y.textContent=z),G=B(Qt),le=y(Qt,"INPUT",{class:!0,id:!0,placeholder:!0}),Qt.forEach(p),Jt.forEach(p),H=B(kt),se=y(kt,"DIV",{class:!0});var Ot=C(se);ce=y(Ot,"DIV",{class:!0});var Xt=C(ce);Ce=y(Xt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Ce)!=="svelte-1js269u"&&(Ce.textContent=oe),he=B(Xt),Q=y(Xt,"INPUT",{class:!0,id:!0,type:!0}),Xt.forEach(p),Ee=B(Ot),fe=y(Ot,"DIV",{class:!0});var Zt=C(fe);He=y(Zt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(He)!=="svelte-21h39k"&&(He.textContent=q),re=B(Zt),ke=y(Zt,"INPUT",{class:!0,id:!0,type:!0}),Zt.forEach(p),ne=B(Ot),je=y(Ot,"DIV",{class:!0});var es=C(je);Me=y(es,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(Me)!=="svelte-33lczu"&&(Me.textContent=vt),Nt=B(es),ze=y(es,"INPUT",{class:!0,id:!0,type:!0}),es.forEach(p),Ot.forEach(p),St=B(kt),st=y(kt,"DIV",{class:!0});var Pt=C(st);Je=y(Pt,"DIV",{class:!0,"data-svelte-h":!0}),ae(Je)!=="svelte-dgefms"&&(Je.textContent=Fs),gs=B(Pt),Dt=y(Pt,"DIV",{class:!0});var Js=C(Dt);ct=y(Js,"BUTTON",{class:!0});var Ys=C(ct);vs=Z(Ys,"Set hotkeys"),Ys.forEach(p),Js.forEach(p),bs=B(Pt),bt=y(Pt,"DIV",{class:!0});var ts=C(bt);yt=y(ts,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(yt)!=="svelte-vd5i27"&&(yt.textContent=Hs),ys=B(ts),ut=y(ts,"INPUT",{class:!0,id:!0}),ts.forEach(p),Pt.forEach(p),kt.forEach(p),ks=B(ot),Ge&&Ge.l(ot),ot.forEach(p),Re.forEach(p),this.h()},h(){var Se;m(n,"class","px-1 rounded hover:bg-gray-100"),m(l,"class","text-base"),m(i,"class","rounded px-1 py-1 hover:bg-gray-200"),m(a,"class","absolute top-[-0.25rem] right-[0.5rem] flex items-center justify-center"),J(a,"hidden",s[4]),m(_,"class","font-bold"),m(_,"for","device"),m(S,"class","px-1 my-1 rounded w-50"),m(S,"id","device"),S.disabled=!0,S.value=k=((Se=s[5])==null?void 0:Se.name)??"No device",m(P,"class","btn-sm primary mr-2"),m(T,"class","btn-sm primary"),m(L,"class","flex my-[auto]"),m(g,"class","h-full flex flex-col"),m(I,"class","font-bold"),m(I,"for","sound"),m(M,"class","h-[20px]"),m(M,"id","sound"),m(M,"type","checkbox"),M.checked=F=s[3].useSound,m(O,"class","my-1 flex justify-between mr-12"),m(Y,"class","font-bold"),m(Y,"for","fixed-velocity"),m(le,"class","h-[20px] w-16"),m(le,"id","fixed-velocity"),m(le,"placeholder","0-127"),m(ie,"class","flex justify-between"),m(D,"class","flex flex-col h-full"),m(Ce,"class","font-bold"),m(Ce,"for","keyboard"),m(Q,"class","h-[20px]"),m(Q,"id","keyboard"),m(Q,"type","checkbox"),Q.checked=ue=s[3].useKeyboard,m(ce,"class","my-1 flex justify-between mr-12"),m(He,"class","font-bold"),m(He,"for","hotkeys"),m(ke,"class","h-[20px]"),m(ke,"id","hotkeys"),m(ke,"type","checkbox"),ke.checked=tt=s[3].useHotkeys,m(fe,"class","my-1 flex justify-between mr-12"),m(Me,"class","font-bold"),m(Me,"for","auto-octave"),m(ze,"class","h-[20px]"),m(ze,"id","auto-octave"),m(ze,"type","checkbox"),ze.checked=Ke=s[3].useAutoOctave,m(je,"class","my-1 flex justify-between mr-12"),m(se,"class","flex flex-col h-full"),m(Je,"class","h-[28px]"),m(ct,"class","w-full btn-sm primary"),ct.disabled=qt=!s[3].useHotkeys,m(Dt,"class","my-[2px] flex justify-between"),m(yt,"class","font-bold"),m(yt,"for","fade-timeout"),m(ut,"class","h-[20px] w-16"),m(ut,"id","fade-timeout"),ut.value=s[1],m(bt,"class","my-1 flex justify-between"),m(st,"class","flex flex-col h-full"),m(f,"class","body svelte-1bpw69s"),J(f,"hidden",s[4]),m(t,"class","relative flex flex-col max-w-full rounded border-2 px-4 pt-2 pb-4 my-4 text-sm svelte-1bpw69s"),J(t,"collapsed",s[4]),m(e,"class",Wt=Te(`${s[12].class||""}`)+" svelte-1bpw69s")},m(Se,Re){U(Se,e,Re),u(e,t),u(t,l),u(l,n),u(t,o),u(t,a),u(a,i),be(c,i,null),u(t,d),u(t,f),u(f,g),u(g,_),u(g,v),u(g,S),u(g,E),u(g,L),u(L,P),u(L,N),u(L,T),u(f,w),u(f,D),u(D,O),u(O,I),u(O,R),u(O,M),u(D,ee),u(D,ie),u(ie,Y),u(ie,G),u(ie,le),et(le,s[0]),u(f,H),u(f,se),u(se,ce),u(ce,Ce),u(ce,he),u(ce,Q),u(se,Ee),u(se,fe),u(fe,He),u(fe,re),u(fe,ke),u(se,ne),u(se,je),u(je,Me),u(je,Nt),u(je,ze),u(f,St),u(f,st),u(st,Je),u(st,gs),u(st,Dt),u(Dt,ct),u(ct,vs),u(st,bs),u(st,bt),u(bt,yt),u(bt,ys),u(bt,ut),u(t,ks),Ge&&Ge.m(t,null),Ye=!0,ws||(zs=[$(n,"click",s[7]),$(i,"click",s[11]),$(P,"click",Be.openMidi),$(T,"click",Be.disableMidi),$(M,"change",s[13]),$(le,"input",s[14]),$(le,"change",s[8]),$(Q,"change",s[15]),$(ke,"change",s[9]),$(ze,"change",s[16]),$(ct,"click",s[17]),$(ut,"input",s[10])],ws=!0)},p(Se,[Re]){var ot;(!Ye||Re&16)&&J(a,"hidden",Se[4]),(!Ye||Re&32&&k!==(k=((ot=Se[5])==null?void 0:ot.name)??"No device")&&S.value!==k)&&(S.value=k),(!Ye||Re&8&&F!==(F=Se[3].useSound))&&(M.checked=F),Re&1&&le.value!==Se[0]&&et(le,Se[0]),(!Ye||Re&8&&ue!==(ue=Se[3].useKeyboard))&&(Q.checked=ue),(!Ye||Re&8&&tt!==(tt=Se[3].useHotkeys))&&(ke.checked=tt),(!Ye||Re&8&&Ke!==(Ke=Se[3].useAutoOctave))&&(ze.checked=Ke),(!Ye||Re&8&&qt!==(qt=!Se[3].useHotkeys))&&(ct.disabled=qt),(!Ye||Re&2&&ut.value!==Se[1])&&(ut.value=Se[1]),(!Ye||Re&16)&&J(f,"hidden",Se[4]),Se[2]&&!Se[4]?Ge?Re&20&&x(Ge,1):(Ge=zl(),Ge.c(),x(Ge,1),Ge.m(t,null)):Ge&&(xe(),W(Ge,1,1,()=>{Ge=null}),Fe()),(!Ye||Re&16)&&J(t,"collapsed",Se[4]),(!Ye||Re&4096&&Wt!==(Wt=Te(`${Se[12].class||""}`)+" svelte-1bpw69s"))&&m(e,"class",Wt)},i(Se){Ye||(x(c.$$.fragment,Se),x(Ge),Ye=!0)},o(Se){W(c.$$.fragment,Se),W(Ge),Ye=!1},d(Se){Se&&p(e),ye(c),Ge&&Ge.d(),ws=!1,Xe(zs)}}}function yr(s,e,t){let l,n,r;_e(s,nt,P=>t(3,l=P)),_e(s,hs,P=>t(5,r=P));const o=gt(Ve(!1),{key:"inputs-hidden"});_e(s,o,P=>t(4,n=P));let a=l.fixedVelocity??"",i=l.keyFadeTimeout,c=!1;nt.subscribe(P=>{t(0,a=P.fixedVelocity??""),t(1,i=P.keyFadeTimeout)});function d(){o.update(P=>!P)}function f(P){const{value:K}=P.currentTarget;let N;if(K)try{N=parseInt(K)}catch{}N!==void 0&&N>=0&&N<=127?Be.setInputValue("fixedVelocity",N):K?t(0,a=l.fixedVelocity||""):Be.setInputValue("fixedVelocity",void 0)}function g(P){Be.setInputValue("useHotkeys",P.currentTarget.checked),P.currentTarget.checked||(t(2,c=!1),it.cancelCapture())}function _(P){try{const K=parseInt(P.currentTarget.value);Be.setInputValue("keyFadeTimeout",K)}catch{t(1,i=l.keyFadeTimeout)}}function h(){Be.setInputValue("useSound",!0),Be.setInputValue("fixedVelocity",void 0),Be.setInputValue("useKeyboard",!0),Be.setInputValue("useHotkeys",!0),Be.setInputValue("useAutoOctave",!0),Be.setInputValue("keyFadeTimeout",1500)}const v=P=>Be.setInputValue("useSound",P.currentTarget.checked);function S(){a=this.value,t(0,a)}const k=P=>Be.setInputValue("useKeyboard",P.currentTarget.checked),E=P=>Be.setInputValue("useAutoOctave",P.currentTarget.checked),L=()=>t(2,c=!c);return s.$$set=P=>{t(12,e=Ae(Ae({},e),Ne(P)))},e=Ne(e),[a,i,c,l,n,r,o,d,f,g,_,h,e,v,S,k,E,L]}class kr extends qe{constructor(e){super(),We(this,e,yr,br,$e,{})}}function wr(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},p:me,d(t){t&&p(e)}}}function Er(s){let e,t=s[1].note+"",l;return{c(){e=X("Input: "),l=X(t)},l(n){e=Z(n,"Input: "),l=Z(n,t)},m(n,r){U(n,e,r),U(n,l,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&pe(l,t)},d(n){n&&(p(e),p(l))}}}function Cr(s){let e,t;return{c(){e=X("Input: "),t=X(s[0])},l(l){e=Z(l,"Input: "),t=Z(l,s[0])},m(l,n){U(l,e,n),U(l,t,n)},p(l,n){n&1&&pe(t,l[0])},d(l){l&&(p(e),p(t))}}}function Ir(s){let e;return{c(){e=X(Ls)},l(t){e=Z(t,Ls)},m(t,l){U(t,e,l)},p:me,d(t){t&&p(e)}}}function Tr(s){let e,t,l,n;function r(i,c){return i[2].useKeyboard&&Ls?Ir:i[2].useKeyboard&&i[0]?Cr:i[2].useKeyboard&&i[1]?Er:wr}let o=r(s),a=o(s);return{c(){e=b("div"),a.c(),this.h()},l(i){e=y(i,"DIV",{class:!0});var c=C(e);a.l(c),c.forEach(p),this.h()},h(){m(e,"class",t=`${s[4].class||""}`)},m(i,c){U(i,e,c),a.m(e,null),l||(n=$(window,"keydown",s[3]),l=!0)},p(i,[c]){o===(o=r(i))&&a?a.p(i,c):(a.d(1),a=o(i),a&&(a.c(),a.m(e,null))),c&16&&t!==(t=`${i[4].class||""}`)&&m(e,"class",t)},i:me,o:me,d(i){i&&p(e),a.d(),l=!1,n()}}}let Ls="";function Ar(s,e,t){let l;_e(s,nt,c=>t(2,l=c));let{debounced:n}=e,r="",o;const a=Bn();function i(c){const d=c.target;if(n||!(d instanceof HTMLElement)||d.tagName==="INPUT")return;const f=it.handleInput(c.code,c.key,c.shiftKey);f&&f.e==="note"?t(1,o=f.data):f&&f.e==="string"?t(0,r=f.data):f&&(f.e==="guessed-key"||f.e==="guessed-chord"||f.e==="guessed-note")?(t(0,r=""),t(1,o=void 0),a(f.e,f.data),c.code==="Enter"&&c.preventDefault()):f&&c.preventDefault()}return s.$$set=c=>{t(4,e=Ae(Ae({},e),Ne(c))),"debounced"in c&&t(5,n=c.debounced)},e=Ne(e),[r,o,l,i,e,n]}class Nr extends qe{constructor(e){super(),We(this,e,Ar,Tr,$e,{debounced:5})}}function Sr(s){let e,t,l,n="Count",r,o,a,i,c,d="Duplicates",f,g,_,h,v,S,k="Autoplay",E,L,P,K,N,T,A="Wait seconds",w,D,O,I,V;return{c(){e=b("ul"),t=b("li"),l=b("label"),l.textContent=n,r=j(),o=b("input"),a=j(),i=b("li"),c=b("label"),c.textContent=d,f=j(),g=b("input"),h=j(),v=b("li"),S=b("label"),S.textContent=k,E=j(),L=b("input"),K=j(),N=b("li"),T=b("label"),T.textContent=A,w=j(),D=b("input"),this.h()},l(R){e=y(R,"UL",{class:!0});var M=C(e);t=y(M,"LI",{class:!0});var F=C(t);l=y(F,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(l)!=="svelte-wgq9fc"&&(l.textContent=n),r=B(F),o=y(F,"INPUT",{class:!0,id:!0,type:!0}),F.forEach(p),a=B(M),i=y(M,"LI",{class:!0});var ee=C(i);c=y(ee,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(c)!=="svelte-hcg9dq"&&(c.textContent=d),f=B(ee),g=y(ee,"INPUT",{class:!0,id:!0,type:!0}),ee.forEach(p),h=B(M),v=y(M,"LI",{class:!0});var ie=C(v);S=y(ie,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(S)!=="svelte-lr68n2"&&(S.textContent=k),E=B(ie),L=y(ie,"INPUT",{class:!0,id:!0,type:!0}),ie.forEach(p),K=B(M),N=y(M,"LI",{class:!0});var Y=C(N);T=y(Y,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ae(T)!=="svelte-1qj2vcy"&&(T.textContent=A),w=B(Y),D=y(Y,"INPUT",{class:!0,id:!0,type:!0}),Y.forEach(p),M.forEach(p),this.h()},h(){m(l,"class","font-bold"),m(l,"for","guess-count"),m(o,"class","h-[20px] w-10"),m(o,"id","guess-count"),m(o,"type","number"),m(t,"class","flex items-center justify-between svelte-1elvih2"),m(c,"class","font-bold"),m(c,"for","duplicates"),m(g,"class","h-[20px]"),m(g,"id","duplicates"),m(g,"type","checkbox"),g.checked=_=s[2].duplicates,m(i,"class","flex items-center justify-between mr-6 svelte-1elvih2"),m(S,"class","font-bold"),m(S,"for","autoplay"),m(L,"class","h-[20px]"),m(L,"id","autoplay"),m(L,"type","checkbox"),L.checked=P=s[2].autoplay,m(v,"class","flex items-center justify-between mr-6 svelte-1elvih2"),m(T,"class","font-bold"),m(T,"for","wait-ms"),m(D,"class","h-[20px] w-10"),m(D,"id","wait-ms"),m(D,"type","number"),m(N,"class","flex items-center justify-between svelte-1elvih2"),m(e,"class",O=Te(`${s[5].class||""}`)+" svelte-1elvih2")},m(R,M){U(R,e,M),u(e,t),u(t,l),u(t,r),u(t,o),et(o,s[0]),u(e,a),u(e,i),u(i,c),u(i,f),u(i,g),u(e,h),u(e,v),u(v,S),u(v,E),u(v,L),u(e,K),u(e,N),u(N,T),u(N,w),u(N,D),et(D,s[1]),I||(V=[$(o,"input",s[6]),$(o,"input",s[3]),$(g,"input",s[7]),$(L,"input",s[8]),$(D,"input",s[9]),$(D,"input",s[4])],I=!0)},p(R,[M]){M&1&&cs(o.value)!==R[0]&&et(o,R[0]),M&4&&_!==(_=R[2].duplicates)&&(g.checked=_),M&4&&P!==(P=R[2].autoplay)&&(L.checked=P),M&2&&cs(D.value)!==R[1]&&et(D,R[1]),M&32&&O!==(O=Te(`${R[5].class||""}`)+" svelte-1elvih2")&&m(e,"class",O)},i:me,o:me,d(R){R&&p(e),I=!1,Xe(V)}}}function Dr(s,e,t){let l;_e(s,_t,g=>t(2,l=g));let n=l.count||"",r=l.waitSeconds||"";_t.subscribe(g=>{t(0,n=g.count||""),t(1,r=g.waitSeconds||"")});function o({currentTarget:{value:g}}){let _;try{_=parseInt(g),_<=0&&(_=1),Le.setOptionValue("count",_)}catch{t(0,n=l.count)}}function a({currentTarget:{value:g}}){let _;try{_=parseInt(g),_<0&&(_=0),Le.setOptionValue("waitSeconds",_)}catch{t(1,r=l.waitSeconds)}}function i(){n=cs(this.value),t(0,n)}const c=g=>Le.setOptionValue("duplicates",g.currentTarget.checked),d=g=>Le.setOptionValue("autoplay",g.currentTarget.checked);function f(){r=cs(this.value),t(1,r)}return s.$$set=g=>{t(5,e=Ae(Ae({},e),Ne(g)))},e=Ne(e),[n,r,l,o,a,e,i,c,d,f]}class Lr extends qe{constructor(e){super(),We(this,e,Dr,Sr,$e,{})}}function ql(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l}function Wl(s,e,t){const l=s.slice();return l[22]=e[t].key,l[23]=e[t].value,l}function $l(s){let e,t,l=s[23]+"",n,r,o,a,i,c,d,f;function g(){return s[15](s[22])}a=new Ue({props:{icon:Ts,width:20}});function _(...h){return s[16](s[22],...h)}return{c(){e=b("li"),t=b("button"),n=X(l),r=j(),o=b("button"),ge(a.$$.fragment),i=j(),this.h()},l(h){e=y(h,"LI",{class:!0});var v=C(e);t=y(v,"BUTTON",{class:!0});var S=C(t);n=Z(S,l),S.forEach(p),r=B(v),o=y(v,"BUTTON",{class:!0});var k=C(o);ve(a.$$.fragment,k),k.forEach(p),i=B(v),v.forEach(p),this.h()},h(){m(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),J(t,"selected",s[22]===s[0]),m(o,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),m(e,"class","flex svelte-1okhpct")},m(h,v){U(h,e,v),u(e,t),u(t,n),u(e,r),u(e,o),be(a,o,null),u(e,i),c=!0,d||(f=[$(t,"click",g),$(o,"click",_)],d=!0)},p(h,v){s=h,(!c||v&17)&&J(t,"selected",s[22]===s[0])},i(h){c||(x(a.$$.fragment,h),c=!0)},o(h){W(a.$$.fragment,h),c=!1},d(h){h&&p(e),ye(a),d=!1,Xe(f)}}}function Jl(s){let e,t=de(s[3]),l=[];for(let n=0;nW(D[V],1,1,()=>{D[V]=null});let I=(s[0]==="chords-write"||s[0]==="chords-play")&&Jl(s);return d=new Lr({props:{class:"game-options"}}),k=new Ue({props:{class:"mr-1",icon:s[2]?Zs:Ts,width:20}}),{c(){e=b("fieldset"),t=b("legend"),t.textContent=l,n=j(),r=b("div"),o=b("ul");for(let V=0;Vt(12,o=N)),_e(s,_t,N=>t(20,a=N)),_e(s,ht,N=>t(13,i=N)),_e(s,It,N=>t(14,c=N));const d=[{key:"notes",value:"Play Notes"},{key:"pitches",value:"Guess Pitches"},{key:"keys-major",value:"Guess Major Keys"},{key:"keys-minor",value:"Guess Minor Keys"},{key:"chords-write",value:"Write Chords"},{key:"chords-play",value:"Play Chords"},{key:"chords-diatonic",value:"Play Diatonic Triads"}];let f=d[4].key,g="maj-m";a.count,a.waitSeconds,_t.subscribe(N=>{N.count,N.waitSeconds});function _(N,T){if(T==="chords-write"||T==="chords-play"||T==="chords-diatonic"){let A=[];g==="selected"?A=o.filter(w=>w.selected):g==="all"?A=o:g==="maj-m"?A=o.filter(w=>w.suffixes[0]==="maj"||w.suffixes[0]==="m"):g==="seventh"&&(A=o.filter(w=>w.suffixes[0]==="maj7"||w.suffixes[0]==="m7"||w.suffixes[0]==="7"||w.suffixes[0]==="dim7"||w.suffixes[0]==="aug7")),Le.play(T,{chords:A})}else Le.play(T,void 0);N.currentTarget instanceof HTMLElement&&N.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function h(N){t(0,f=N)}function v(N,T){t(0,f=T),_(N,T)}function S(N){t(1,g=N)}function k(){Le.clearGame(!0)}function E(N){l?Le.clearGame():_(N,f)}const L=N=>h(N),P=(N,T)=>v(T,N),K=N=>S(N);return s.$$set=N=>{t(10,e=Ae(Ae({},e),Ne(N)))},s.$$.update=()=>{s.$$.dirty&24576&&t(2,l=!!c&&i!=="ended"),s.$$.dirty&4096&&t(11,n=o.reduce((N,T)=>T.selected?N+1:N,0)),s.$$.dirty&2048&&t(3,r=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${n} chords`},{key:"all",value:"All"}])},e=Ne(e),[f,g,l,r,d,h,v,S,k,E,e,n,o,i,c,L,P,K]}class Vr extends qe{constructor(e){super(),We(this,e,Pr,Or,$e,{})}}function Ql(s,e,t){const l=s.slice();return l[7]=e[t],l}function Xl(s,e,t){const l=s.slice();return l[4]=e[t],l}function jr(s){let e,t=de(s[1]),l=[];for(let n=0;ns.interval;function Mr(s,e,t){let{scale:l,intervals:n}=e;function r(o){ms.call(this,s,o)}return s.$$set=o=>{t(2,e=Ae(Ae({},e),Ne(o))),"scale"in o&&t(0,l=o.scale),"intervals"in o&&t(1,n=o.intervals)},e=Ne(e),[l,n,e,r]}class Vn extends qe{constructor(e){super(),We(this,e,Mr,Gr,$e,{scale:0,intervals:1})}}function sn(s,e,t){const l=s.slice();return l[7]=e[t],l}function ln(s,e,t){const l=s.slice();return l[4]=e[t],l}function Rr(s){let e,t=de(s[0]),l=[];for(let n=0;n2),m(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(d,f){U(d,e,f),u(e,t),u(t,n),u(e,r),u(e,o),u(o,i),u(e,c)},p(d,f){f&1&&l!==(l=d[7].roman+"")&&pe(n,l),f&1&&a!==(a=d[7].suffix+"")&&pe(i,a),f&1&&J(o,"super-text",d[7].suffix.length>2)},d(d){d&&p(e)}}}function on(s){let e,t,l=s[4]+"",n,r;return{c(){e=b("span"),t=b("span"),n=X(l),r=j(),this.h()},l(o){e=y(o,"SPAN",{class:!0});var a=C(e);t=y(a,"SPAN",{});var i=C(t);n=Z(i,l),i.forEach(p),r=B(a),a.forEach(p),this.h()},h(){m(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(o,a){U(o,e,a),u(e,t),u(t,n),u(e,r)},p(o,a){a&2&&l!==(l=o[4]+"")&&pe(n,l)},d(o){o&&p(e)}}}function Kr(s){let e,t,l,n,r,o;function a(d,f){return d[1].length>0?Ur:Rr}let i=a(s),c=i(s);return{c(){e=b("div"),t=b("button"),c.c(),this.h()},l(d){e=y(d,"DIV",{class:!0,title:!0});var f=C(e);t=y(f,"BUTTON",{class:!0});var g=C(t);c.l(g),g.forEach(p),f.forEach(p),this.h()},h(){m(t,"class","triads flex flex-wrap svelte-1roj1mi"),m(e,"class",l=Te(`${s[2].class||""} `)+" svelte-1roj1mi"),m(e,"title",n=s[0].map(rn).join("-"))},m(d,f){U(d,e,f),u(e,t),c.m(t,null),r||(o=$(t,"click",s[3]),r=!0)},p(d,[f]){i===(i=a(d))&&c?c.p(d,f):(c.d(1),c=i(d),c&&(c.c(),c.m(t,null))),f&4&&l!==(l=Te(`${d[2].class||""} `)+" svelte-1roj1mi")&&m(e,"class",l),f&1&&n!==(n=d[0].map(rn).join("-"))&&m(e,"title",n)},i:me,o:me,d(d){d&&p(e),c.d(),r=!1,o()}}}const rn=s=>s.roman+s.suffix;function xr(s,e,t){let{triads:l,chords:n}=e;function r(o){ms.call(this,s,o)}return s.$$set=o=>{t(2,e=Ae(Ae({},e),Ne(o))),"triads"in o&&t(0,l=o.triads),"chords"in o&&t(1,n=o.chords)},e=Ne(e),[l,n,e,r]}class jn extends qe{constructor(e){super(),We(this,e,xr,Kr,$e,{triads:0,chords:1})}}function an(s,e,t){const l=s.slice();return l[23]=e[t],l}function cn(s,e,t){const l=s.slice();return l[23]=e[t],l}function un(s){let e,t,l=s[23].raw.names[0]+"",n,r,o,a,i,c,d;function f(){return s[11](s[23])}o=new Vn({props:{scale:s[23].scale,intervals:s[23].raw.intervals}}),o.$on("click",f);function g(){return s[12](s[23])}return i=new jn({props:{triads:s[23].triads,chords:s[23].triadChords}}),i.$on("click",g),{c(){e=b("li"),t=b("div"),n=X(l),r=j(),ge(o.$$.fragment),a=j(),ge(i.$$.fragment),c=j(),this.h()},l(_){e=y(_,"LI",{class:!0});var h=C(e);t=y(h,"DIV",{class:!0});var v=C(t);n=Z(v,l),v.forEach(p),r=B(h),ve(o.$$.fragment,h),a=B(h),ve(i.$$.fragment,h),c=B(h),h.forEach(p),this.h()},h(){m(t,"class","text-xs font-bold"),m(e,"class","svelte-4hctsl")},m(_,h){U(_,e,h),u(e,t),u(t,n),u(e,r),be(o,e,null),u(e,a),be(i,e,null),u(e,c),d=!0},p(_,h){s=_,(!d||h&4)&&l!==(l=s[23].raw.names[0]+"")&&pe(n,l);const v={};h&4&&(v.scale=s[23].scale),h&4&&(v.intervals=s[23].raw.intervals),o.$set(v);const S={};h&4&&(S.triads=s[23].triads),h&4&&(S.chords=s[23].triadChords),i.$set(S)},i(_){d||(x(o.$$.fragment,_),x(i.$$.fragment,_),d=!0)},o(_){W(o.$$.fragment,_),W(i.$$.fragment,_),d=!1},d(_){_&&p(e),ye(o),ye(i)}}}function fn(s){let e,t,l=s[23].raw.names[0]+"",n,r,o,a,i,c,d;function f(){return s[13](s[23])}o=new Vn({props:{scale:s[23].scale,intervals:s[23].raw.intervals}}),o.$on("click",f);function g(){return s[14](s[23])}return i=new jn({props:{triads:s[23].triads,chords:s[23].triadChords}}),i.$on("click",g),{c(){e=b("li"),t=b("div"),n=X(l),r=j(),ge(o.$$.fragment),a=j(),ge(i.$$.fragment),c=j(),this.h()},l(_){e=y(_,"LI",{class:!0});var h=C(e);t=y(h,"DIV",{class:!0});var v=C(t);n=Z(v,l),v.forEach(p),r=B(h),ve(o.$$.fragment,h),a=B(h),ve(i.$$.fragment,h),c=B(h),h.forEach(p),this.h()},h(){m(t,"class","text-xs font-bold"),m(e,"class","svelte-4hctsl")},m(_,h){U(_,e,h),u(e,t),u(t,n),u(e,r),be(o,e,null),u(e,a),be(i,e,null),u(e,c),d=!0},p(_,h){s=_,(!d||h&2)&&l!==(l=s[23].raw.names[0]+"")&&pe(n,l);const v={};h&2&&(v.scale=s[23].scale),h&2&&(v.intervals=s[23].raw.intervals),o.$set(v);const S={};h&2&&(S.triads=s[23].triads),h&2&&(S.chords=s[23].triadChords),i.$set(S)},i(_){d||(x(o.$$.fragment,_),x(i.$$.fragment,_),d=!0)},o(_){W(o.$$.fragment,_),W(i.$$.fragment,_),d=!1},d(_){_&&p(e),ye(o),ye(i)}}}function Fr(s){let e,t,l,n,r="Scales",o,a,i,c="Key",d,f,g,_,h,v,S,k,E,L,P,K=de(s[2]),N=[];for(let O=0;OW(N[O],1,1,()=>{N[O]=null});let A=de(s[1]),w=[];for(let O=0;OW(w[O],1,1,()=>{w[O]=null});return{c(){e=b("div"),t=b("fieldset"),l=b("legend"),n=b("button"),n.textContent=r,o=j(),a=b("div"),i=b("label"),i.textContent=c,d=j(),f=b("input"),g=j(),_=b("div"),h=b("ul");for(let O=0;Ot(17,r=w)),_e(s,pt,w=>t(18,o=w)),_e(s,nt,w=>t(19,a=w)),_e(s,lt,w=>t(20,i=w));let f=_s().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),g="",_=[o.key,o.scale],h;const v=gt(Ve(!0),{key:"scales-hidden"});_e(s,v,w=>t(3,c=w));function S(){v.update(w=>!w)}function k({currentTarget:{value:w}}){t(0,g=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,f=f.map(D=>{const O=xt(g,D.key),I=g&&"data"in O?O.data:void 0;let V=[];return I&&(V=D.triads.map((R,M)=>`${I.scaleNotes[M].note}${!R.suffix.includes("°")&&R.minor?"m":""}${R.suffix}`)),{...D,scale:I,triadChords:V}}))}function E(w,D,O){if(wV.midi),a.fixedVelocity),h=setTimeout(()=>E(w,D,O),O)}else De.setPlayed([]),De.setKeyAndScale(_[0],_[1])}function L(w){clearTimeout(h);let D,O;w.scale?(O=w.scale,_=[o.key,o.scale],De.setKeyAndScale(w.scale.key,w.scale.scale)):O=o;const I=r[0].midi+O.scaleNotes[0].semitones;D=w.raw.intervals.map(V=>[{...O.notesMap.get(V.semitones%12),midi:I+V.semitones}]),D[0][0].semitones!==D[D.length-1][0].semitones&&D.push(D[0].map(V=>({...V,midi:V.midi+12}))),E(0,D,500)}function P(w){clearTimeout(h);const{intervals:D}=w.raw;let O,I;w.scale?(I=w.scale,_=[o.key,o.scale],De.setKeyAndScale(w.scale.key,w.scale.scale)):I=o;const V=r[0].midi+I.scaleNotes[0].semitones;O=Cn(w.triads).map((M,F)=>os(V+I.intervals[F].semitones,I,M.intervals)),D[D.length-1].interval_seq!==1&&O.push(O[0].map(M=>({...M,midi:M.midi+12}))),E(0,O,750)}const K=w=>L(w),N=w=>P(w),T=w=>L(w),A=w=>P(w);return s.$$set=w=>{t(9,e=Ae(Ae({},e),Ne(w)))},s.$$.update=()=>{s.$$.dirty&1024&&t(2,l=f.filter((w,D)=>DD>=f.length/2))},e=Ne(e),[g,n,l,c,v,S,k,L,P,e,f,K,N,T,A]}class zr extends qe{constructor(e){super(),We(this,e,Hr,Fr,$e,{})}}function dn(s,e,t){const l=s.slice();return l[26]=e[t],l}function hn(s,e,t){const l=s.slice();return l[29]=e[t],l}function mn(s){let e,t;return{c(){e=b("div"),t=X(s[3]),this.h()},l(l){e=y(l,"DIV",{class:!0});var n=C(e);t=Z(n,s[3]),n.forEach(p),this.h()},h(){m(e,"class","error svelte-1u7ze7x")},m(l,n){U(l,e,n),u(e,t)},p(l,n){n[0]&8&&pe(t,l[3])},d(l){l&&p(e)}}}function _n(s){let e,t=de(s[5]),l=[];for(let n=0;nt(23,n=I)),_e(s,At,I=>t(24,r=I)),_e(s,It,I=>t(7,a=I)),_e(s,pt,I=>t(8,i=I));let c=dt(n[0]),d=dt(n[1]),f="";const g=gt(Ve(!1),{key:"score-options-hidden"});_e(s,g,I=>t(6,o=I));let _=r[0],h=r[1];const v=_s(),S=v.map(I=>({key:I.names[0],value:I.names[0]}));Mt.subscribe(I=>{t(1,c=dt(I[0])),t(2,d=dt(I[1]))}),At.subscribe(I=>{t(4,_=I[0]),t(0,h=I[1])});function k(I,V){const R=ro(V.currentTarget.value,!0,!0);if("data"in R){const{midi:M}=R.data,F=n,ee=[I==="min"?M:F[0].midi,I==="max"?M:F[1].midi];Be.setMidiRange(ee),t(3,f="")}else t(3,f=R.err),I==="min"?t(1,c=dt(n[0])):t(2,d=dt(n[1]))}function E(){t(3,f="")}function L({currentTarget:{value:I}}){t(4,_=`${I.charAt(0).toUpperCase()}${I.charAt(1).toLowerCase()}`),De.setKey(_)}function P(I){var V;return t(0,h=(V=S.find(R=>I===R.key))==null?void 0:V.value),De.setScale(h),!1}function K(){g.update(I=>!I)}function N(){De.clearScore(!0),Be.setMidiRange([60,84])}function T(){c=this.value,t(1,c)}const A=I=>k("min",I);function w(){d=this.value,t(2,d)}const D=I=>k("max",I);function O(){_=this.value,t(4,_)}return s.$$set=I=>{t(17,e=Ae(Ae({},e),Ne(I)))},s.$$.update=()=>{var I;s.$$.dirty[0]&1&&t(5,l=((I=v.find(V=>V.names[0]===h))==null?void 0:I.intervals)||[])},e=Ne(e),[h,c,d,f,_,l,o,a,i,g,S,k,E,L,P,K,N,e,T,A,w,D,O]}class $r extends qe{constructor(e){super(),We(this,e,Wr,qr,$e,{},null,[-1,-1])}}function Jr(s){s[21]=s[22].default}function Yr(s){return{c:me,l:me,m:me,i:me,o:me,d:me}}function Qr(s){Jr(s);let e,t,l;var n=s[21];function r(o,a){return{props:{class:"mx-4 md:mx-0"}}}return n&&(e=Rn(n,r())),{c(){e&&ge(e.$$.fragment),t=Oe()},l(o){e&&ve(e.$$.fragment,o),t=Oe()},m(o,a){e&&be(e,o,a),U(o,t,a),l=!0},i(o){l||(e&&x(e.$$.fragment,o),l=!0)},o(o){e&&W(e.$$.fragment,o),l=!1},d(o){o&&p(t),e&&ye(e,o)}}}function Xr(s){let e;return{c(){e=X(" ")},l(t){e=Z(t," ")},m(t,l){U(t,e,l)},i:me,o:me,d(t){t&&p(e)}}}function Zr(s){let e,t,l,n,r="MIDI Note Trainer",o,a,i,c,d,f,g,_="Introduction",h,v,S,k,E,L,P,K,N,T,A,w,D,O,I,V,R,M,F,ee,ie;c=new Ue({props:{icon:zt,width:24}}),S=new kr({}),E=new zr({}),P=new Lo({}),T=new $r({props:{class:"score-options mr-4"}}),w=new Vr({props:{class:"play-form"}});let Y={ctx:s,current:null,token:null,hasCatch:!1,pending:Xr,then:Qr,catch:Yr,value:22,blocks:[,,,]};return Gn(Ie(()=>import("./Score.dcfd86fb.js"),["./Score.dcfd86fb.js","./vendor_svelte.d337c9a7.js","./vendor.e9b0235c.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),Y),V=new Nr({props:{class:"min-h-32",debounced:!!s[0]}}),V.$on("guessed-chord",s[2]),V.$on("guessed-key",s[3]),V.$on("guessed-note",s[4]),M=new Ho({props:{game:s[1]}}),{c(){e=b("meta"),t=j(),l=b("h1"),n=b("a"),n.textContent=r,o=j(),a=b("div"),i=b("button"),ge(c.$$.fragment),d=j(),f=b("div"),g=b("button"),g.textContent=_,h=j(),v=b("section"),ge(S.$$.fragment),k=j(),ge(E.$$.fragment),L=j(),ge(P.$$.fragment),K=j(),N=b("div"),ge(T.$$.fragment),A=j(),ge(w.$$.fragment),D=j(),Y.block.c(),O=j(),I=b("section"),ge(V.$$.fragment),R=j(),ge(M.$$.fragment),this.h()},l(z){const G=Mn("svelte-1w2oado",document.head);e=y(G,"META",{name:!0,content:!0}),G.forEach(p),t=B(z),l=y(z,"H1",{class:!0});var le=C(l);n=y(le,"A",{class:!0,href:!0,"data-svelte-h":!0}),ae(n)!=="svelte-km4jns"&&(n.textContent=r),o=B(le),a=y(le,"DIV",{class:!0});var H=C(a);i=y(H,"BUTTON",{class:!0});var se=C(i);ve(c.$$.fragment,se),se.forEach(p),H.forEach(p),le.forEach(p),d=B(z),f=y(z,"DIV",{class:!0});var ce=C(f);g=y(ce,"BUTTON",{class:!0,"data-svelte-h":!0}),ae(g)!=="svelte-f34gar"&&(g.textContent=_),ce.forEach(p),h=B(z),v=y(z,"SECTION",{class:!0});var Ce=C(v);ve(S.$$.fragment,Ce),k=B(Ce),ve(E.$$.fragment,Ce),L=B(Ce),ve(P.$$.fragment,Ce),K=B(Ce),N=y(Ce,"DIV",{class:!0});var oe=C(N);ve(T.$$.fragment,oe),A=B(oe),ve(w.$$.fragment,oe),oe.forEach(p),Ce.forEach(p),D=B(z),Y.block.l(z),O=B(z),I=y(z,"SECTION",{class:!0});var he=C(I);ve(V.$$.fragment,he),R=B(he),ve(M.$$.fragment,he),he.forEach(p),this.h()},h(){m(e,"name","description"),m(e,"content","App to practise music notation, scales and chords using MIDI"),m(n,"class","hover:underline"),m(n,"href","https://github.com/TeemuKoivisto/midi-note-trainer"),m(i,"class","rounded p-2 hover:bg-gray-200"),m(a,"class","flex items-center justify-center"),m(l,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight flex items-center justify-between"),m(g,"class","btn-pill border-2 border-gray-300 hover:bg-gray-200"),m(f,"class","px-4 md:px-0"),m(N,"class","play svelte-qjpqy3"),m(v,"class","mx-4 md:mx-0"),m(I,"class","mb-8 ml-16 flex flex-col")},m(z,G){u(document.head,e),U(z,t,G),U(z,l,G),u(l,n),u(l,o),u(l,a),u(a,i),be(c,i,null),U(z,d,G),U(z,f,G),u(f,g),U(z,h,G),U(z,v,G),be(S,v,null),u(v,k),be(E,v,null),u(v,L),be(P,v,null),u(v,K),u(v,N),be(T,N,null),u(N,A),be(w,N,null),U(z,D,G),Y.block.m(z,Y.anchor=G),Y.mount=()=>O.parentNode,Y.anchor=O,U(z,O,G),U(z,I,G),be(V,I,null),u(I,R),be(M,I,null),F=!0,ee||(ie=[$(i,"click",s[5]),$(g,"click",s[6])],ee=!0)},p(z,[G]){s=z;const le={};G&1&&(le.debounced=!!s[0]),V.$set(le);const H={};G&2&&(H.game=s[1]),M.$set(H)},i(z){F||(x(c.$$.fragment,z),x(S.$$.fragment,z),x(E.$$.fragment,z),x(P.$$.fragment,z),x(T.$$.fragment,z),x(w.$$.fragment,z),x(Y.block),x(V.$$.fragment,z),x(M.$$.fragment,z),F=!0)},o(z){W(c.$$.fragment,z),W(S.$$.fragment,z),W(E.$$.fragment,z),W(P.$$.fragment,z),W(T.$$.fragment,z),W(w.$$.fragment,z);for(let G=0;G<3;G+=1){const le=Y.blocks[G];W(le)}W(V.$$.fragment,z),W(M.$$.fragment,z),F=!1},d(z){z&&(p(t),p(l),p(d),p(f),p(h),p(v),p(D),p(O),p(I)),p(e),ye(c),ye(S),ye(E),ye(P),ye(T),ye(w),Y.block.d(z),Y.token=null,Y=null,ye(V),ye(M),ee=!1,Xe(ie)}}}function ea(s,e,t){let l,n,r,o,a,i;_e(s,ht,T=>t(9,l=T)),_e(s,It,T=>t(1,n=T)),_e(s,_t,T=>t(10,r=T)),_e(s,nt,T=>t(11,o=T)),_e(s,lt,T=>t(12,a=T)),_e(s,Ns,T=>t(13,i=T));let c,d;bn(()=>(i&&P(),window.addEventListener("keydown",f),window.addEventListener("mousedown",f),window.addEventListener("touchstart",f),()=>{window.removeEventListener("keydown",f),window.removeEventListener("mousedown",f),window.removeEventListener("touchstart",f)})),hs.subscribe(T=>{T&&T.channels[1].addListener("noteon",g)});function f(){Be.initAudio(),window.removeEventListener("keydown",f),window.removeEventListener("mousedown",f),window.removeEventListener("touchstart",f)}function g(T){if(c)return;const A=T.rawData;_(A[1],A[2])}function _(T,A){const w=n;w instanceof jt&&!(w!=null&&w.ended)&&l==="waiting"?S(T):w instanceof mt&&!(w!=null&&w.ended)&&l==="waiting"?(w.addPlayedNote(T),d||(d=setTimeout(v,2e3))):w||De.pushPlayed(T),a&&a.noteOn(T,o.fixedVelocity??A)}function h(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&Le.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?Le.nextGuess():t(0,c=void 0)}function v(){var A;const T=n;if(T instanceof mt){const w=T.guess();De.setPlayed(((A=T.latestGuess.guessed)==null?void 0:A.notes)||[],w,-1),Le.updateState(w?"correct":"wrong"),h()}d=void 0}function S(T){const A=n;if(A instanceof jt&&l==="waiting"){De.setTarget([De.getNote(A.current)]);const w=A.guess(T);Le.updateState(w?"correct":"wrong"),De.pushPlayed(T,w,4e3),h()}}function k(T){const A=n;if(A instanceof mt&&l==="waiting"){const w=A.guessWrittenChord(T.detail);Le.updateState(w?"correct":"wrong"),h()}}function E(T){const A=n;if(A instanceof Ft&&l==="waiting"){const w=T.detail.replaceAll("♭","b").replaceAll("♯","#"),D=A.guess(w);Le.updateState(D?"correct":"wrong"),h()}}function L(T){const A=it.findNote(T.detail.note)??Gs(T.detail.note);A&&_(A.semitones+12+T.detail.octave*12,80)}async function P(){const T=await Be.openMidi();"data"in T?T.data.name:(T.err,console.error(T.err))}function K(){ho(),window.location.reload()}return[c,n,k,E,L,K,()=>Fn.open("introduction",void 0)]}class oa extends qe{constructor(e){super(),We(this,e,ea,Zr,$e,{})}}export{rl as F,mt as G,oa as P,Qn as S,jt as a,Le as b,It as c,wt as d,ds as e,ht as g,lt as p,pt as s,ul as t}; diff --git a/_app/immutable/chunks/Score.5d65f50b.js b/_app/immutable/chunks/Score.dcfd86fb.js similarity index 98% rename from _app/immutable/chunks/Score.5d65f50b.js rename to _app/immutable/chunks/Score.dcfd86fb.js index 4fff114a..a240ed69 100644 --- a/_app/immutable/chunks/Score.5d65f50b.js +++ b/_app/immutable/chunks/Score.dcfd86fb.js @@ -1 +1 @@ -import{S as Q,i as U,s as J,O as ne,e as A,J as F,a as C,b as E,K as B,d as y,f as S,N as I,g as W,h as V,L as j,q as re,t as D,l as $,M as K,P as X,Q as q,R as G,n as te,p as se,T as ue,v as de,H as he}from"./vendor_svelte.f9b78e98.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as ge,g as oe,c as Y,G as H,a as L,b as me,s as be,d as we,t as pe,e as ae,F as _e,S as ve}from"./3.06dc71f7.js";import{d as ye,a as Se}from"./vendor.e9b0235c.js";function Ne(i){let t,s,l,a,n,f,m;return l=new ne({props:{icon:ye,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var w=E(s);B(l.$$.fragment,w),w.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),I(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(m=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&I(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,m()}}}function ke(i,t,s){let l,a,n,f;X(i,ge,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function m(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(w=>w.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(w=>w.midi)):e instanceof L&&n==="waiting"?a==null||a.noteOn(e.current):e instanceof L&&(a==null||a.noteOn(e.latestGuess.target||0))}return i.$$set=e=>{s(2,t=q(q({},t),G(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=G(t),[l,m,t,f]}class Ae extends Q{constructor(t){super(),U(this,t,ke,Ne,J,{})}}function Ce(i){let t,s,l,a,n,f,m;return l=new ne({props:{icon:Se,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var w=E(s);B(l.$$.fragment,w),w.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded p-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),I(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(m=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&I(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,m()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){me.clearGame()}return i.$$set=n=>{s(2,t=q(q({},t),G(n)))},t=G(t),[l,a,t]}class Te extends Q{constructor(t){super(),U(this,t,Ee,Ce,J,{})}}function Ve(i){let t,s,l,a,n,f,m,e,c,w;return f=new Ae({}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),m=te(),F(e.$$.fragment),this.h()},l(u){t=C(u,"SECTION",{class:!0});var N=E(t);s=C(N,"DIV",{id:!0}),E(s).forEach(y),l=se(N),a=C(N,"DIV",{class:!0});var M=E(a);n=C(M,"DIV",{class:!0});var x=E(n);B(f.$$.fragment,x),m=se(x),B(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex flex-col"),S(a,"class","absolute left-0 top-[18.5rem]"),S(t,"class",c=`${i[1].class||""} relative`)},m(u,N){W(u,t,N),V(t,s),i[2](s),V(t,l),V(t,a),V(a,n),j(f,n,null),V(n,m),j(e,n,null),w=!0},p(u,[N]){(!w||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){w||(D(f.$$.fragment,u),D(e.$$.fragment,u),w=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),w=!1},d(u){u&&y(t),i[2](null),K(f),K(e)}}}function xe(i,t,s){const{Accidental:l,Formatter:a,Renderer:n,Stave:f,StaveNote:m}=v;let e=200,c,w,u;const N=ue([Y,oe,be,we,pe],([o,p,d,b,h])=>({game:o,guessed:p,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,p){const d=p.flats>0?p.flats:p.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",g=(p.flats>0?_e:ve).slice(0,d),r=g.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&g.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o)]}}function x(){w=new n(c,n.Backends.SVG),w.resize(732,360),u=w.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),p=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new m({keys:["g#/4"],duration:"q"}),new m({keys:["b/4"],duration:"qr"}),new m({keys:["c/4"],duration:"q"}),new m({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new m({clef:"bass",keys:["f/3"],duration:"q"}),new m({clef:"bass",keys:["b/3"],duration:"qr"}),new m({clef:"bass",keys:["b/2"],duration:"q"}),new m({clef:"bass",keys:["c/3","e/3","g/3"],duration:"q"})];d[0].addModifier(new l("#"),0);const h=new v.Voice({num_beats:4,beat_value:4}).addTickables(d),g=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),p.getNoteStartX());o.setNoteStartX(r),p.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([g]),_.format([h,g],e-10-r),h.draw(u,o),g.draw(u,p),o.setContext(u).draw(),p.setContext(u).draw()}function Z(o,p){const d=[],b=[];for(let g=0;g0){const g=new v.StaveNote({clef:"bass",keys:d.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","bass");d.forEach((r,_)=>{r.parts[1]&&g.addModifier(new l(r.parts[1]),_),r.color&&g.setStyle({fillStyle:r.color})}),h.push(g)}if(b.length>0){const g=new v.StaveNote({clef:"treble",keys:b.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","treble");b.forEach((r,_)=>{r.parts[1]&&g.addModifier(new l(r.parts[1]),_),r.color&&g.setStyle({fillStyle:r.color})}),h.push(g)}return h}function le(o,p){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&p.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&p.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...p.filter(h=>h.getAttribute("clef")==="treble")),b.push(...p.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:p,scale:d,played:b,target:h}){const g=d.majorSignature.replaceAll("♭","b").replaceAll("♯","#");e=200+Math.max(d.flats,d.sharps)*10,u.clear(),u.scale(.5,.5);const r=new f(0,0,e).addClef("treble").addKeySignature(g),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[R,P]=le(T,O),k=[];R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R)),P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P));const z=Math.max(r.getNoteStartX(),_.getNoteStartX());r.setNoteStartX(z),_.setNoteStartX(z);const ee=new v.Formatter;k.forEach(fe=>{ee.joinVoices([fe])}),k.length>0&&ee.format(k,e-10-z),R.length>0&&k[0].draw(u,r),P.length>0&&k[k.length-1].draw(u,_),r.setContext(u).draw(),_.setContext(u).draw()}function ie(o){he[o?"unshift":"push"](()=>{c=o,s(0,c)})}return i.$$set=o=>{s(1,t=q(q({},t),G(o)))},t=G(t),[c,t,ie]}class Xe extends Q{constructor(t){super(),U(this,t,xe,Ve,J,{})}}export{Xe as default}; +import{S as Q,i as U,s as J,O as ne,e as A,J as F,a as C,b as E,K as B,d as y,f as S,N as I,g as W,h as V,L as j,q as re,t as D,l as $,M as K,P as X,Q as q,R as G,n as te,p as se,T as ue,v as de,H as he}from"./vendor_svelte.d337c9a7.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as ge,g as oe,c as Y,G as H,a as L,b as me,s as be,d as we,t as pe,e as ae,F as _e,S as ve}from"./3.25ec78aa.js";import{d as ye,a as Se}from"./vendor.e9b0235c.js";function Ne(i){let t,s,l,a,n,f,m;return l=new ne({props:{icon:ye,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var w=E(s);B(l.$$.fragment,w),w.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),I(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(m=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&I(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,m()}}}function ke(i,t,s){let l,a,n,f;X(i,ge,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function m(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(w=>w.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(w=>w.midi)):e instanceof L&&n==="waiting"?a==null||a.noteOn(e.current):e instanceof L&&(a==null||a.noteOn(e.latestGuess.target||0))}return i.$$set=e=>{s(2,t=q(q({},t),G(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=G(t),[l,m,t,f]}class Ae extends Q{constructor(t){super(),U(this,t,ke,Ne,J,{})}}function Ce(i){let t,s,l,a,n,f,m;return l=new ne({props:{icon:Se,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var w=E(s);B(l.$$.fragment,w),w.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded p-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),I(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(m=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&I(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,m()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){me.clearGame()}return i.$$set=n=>{s(2,t=q(q({},t),G(n)))},t=G(t),[l,a,t]}class Te extends Q{constructor(t){super(),U(this,t,Ee,Ce,J,{})}}function Ve(i){let t,s,l,a,n,f,m,e,c,w;return f=new Ae({}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),m=te(),F(e.$$.fragment),this.h()},l(u){t=C(u,"SECTION",{class:!0});var N=E(t);s=C(N,"DIV",{id:!0}),E(s).forEach(y),l=se(N),a=C(N,"DIV",{class:!0});var M=E(a);n=C(M,"DIV",{class:!0});var x=E(n);B(f.$$.fragment,x),m=se(x),B(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex flex-col"),S(a,"class","absolute left-0 top-[18.5rem]"),S(t,"class",c=`${i[1].class||""} relative`)},m(u,N){W(u,t,N),V(t,s),i[2](s),V(t,l),V(t,a),V(a,n),j(f,n,null),V(n,m),j(e,n,null),w=!0},p(u,[N]){(!w||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){w||(D(f.$$.fragment,u),D(e.$$.fragment,u),w=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),w=!1},d(u){u&&y(t),i[2](null),K(f),K(e)}}}function xe(i,t,s){const{Accidental:l,Formatter:a,Renderer:n,Stave:f,StaveNote:m}=v;let e=200,c,w,u;const N=ue([Y,oe,be,we,pe],([o,p,d,b,h])=>({game:o,guessed:p,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,p){const d=p.flats>0?p.flats:p.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",g=(p.flats>0?_e:ve).slice(0,d),r=g.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&g.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o)]}}function x(){w=new n(c,n.Backends.SVG),w.resize(732,360),u=w.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),p=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new m({keys:["g#/4"],duration:"q"}),new m({keys:["b/4"],duration:"qr"}),new m({keys:["c/4"],duration:"q"}),new m({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new m({clef:"bass",keys:["f/3"],duration:"q"}),new m({clef:"bass",keys:["b/3"],duration:"qr"}),new m({clef:"bass",keys:["b/2"],duration:"q"}),new m({clef:"bass",keys:["c/3","e/3","g/3"],duration:"q"})];d[0].addModifier(new l("#"),0);const h=new v.Voice({num_beats:4,beat_value:4}).addTickables(d),g=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),p.getNoteStartX());o.setNoteStartX(r),p.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([g]),_.format([h,g],e-10-r),h.draw(u,o),g.draw(u,p),o.setContext(u).draw(),p.setContext(u).draw()}function Z(o,p){const d=[],b=[];for(let g=0;g0){const g=new v.StaveNote({clef:"bass",keys:d.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","bass");d.forEach((r,_)=>{r.parts[1]&&g.addModifier(new l(r.parts[1]),_),r.color&&g.setStyle({fillStyle:r.color})}),h.push(g)}if(b.length>0){const g=new v.StaveNote({clef:"treble",keys:b.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","treble");b.forEach((r,_)=>{r.parts[1]&&g.addModifier(new l(r.parts[1]),_),r.color&&g.setStyle({fillStyle:r.color})}),h.push(g)}return h}function le(o,p){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&p.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&p.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...p.filter(h=>h.getAttribute("clef")==="treble")),b.push(...p.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:p,scale:d,played:b,target:h}){const g=d.majorSignature.replaceAll("♭","b").replaceAll("♯","#");e=200+Math.max(d.flats,d.sharps)*10,u.clear(),u.scale(.5,.5);const r=new f(0,0,e).addClef("treble").addKeySignature(g),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[R,P]=le(T,O),k=[];R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R)),P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P));const z=Math.max(r.getNoteStartX(),_.getNoteStartX());r.setNoteStartX(z),_.setNoteStartX(z);const ee=new v.Formatter;k.forEach(fe=>{ee.joinVoices([fe])}),k.length>0&&ee.format(k,e-10-z),R.length>0&&k[0].draw(u,r),P.length>0&&k[k.length-1].draw(u,_),r.setContext(u).draw(),_.setContext(u).draw()}function ie(o){he[o?"unshift":"push"](()=>{c=o,s(0,c)})}return i.$$set=o=>{s(1,t=q(q({},t),G(o)))},t=G(t),[c,t,ie]}class Xe extends Q{constructor(t){super(),U(this,t,xe,Ve,J,{})}}export{Xe as default}; diff --git a/_app/immutable/chunks/modal.57c20595.js b/_app/immutable/chunks/modal.94ff3968.js similarity index 78% rename from _app/immutable/chunks/modal.57c20595.js rename to _app/immutable/chunks/modal.94ff3968.js index 875c0308..054edc1b 100644 --- a/_app/immutable/chunks/modal.57c20595.js +++ b/_app/immutable/chunks/modal.94ff3968.js @@ -1 +1 @@ -import{m as n,w as e}from"./vendor_svelte.f9b78e98.js";const a={introduction:void 0},c=e(a),t=e(null),i={open(...[o,s]){t.set(o),c.update(l=>({...l,[o]:s})),console.log("open ",o)},close(){t.set(null)},toggle(o){const s=n(t);!s||s&&s!==o?t.set(o):t.set(null)}};export{i as a,c as m,t as o}; +import{m as n,w as e}from"./vendor_svelte.d337c9a7.js";const a={introduction:void 0},c=e(a),t=e(null),i={open(...[o,s]){t.set(o),c.update(l=>({...l,[o]:s})),console.log("open ",o)},close(){t.set(null)},toggle(o){const s=n(t);!s||s&&s!==o?t.set(o):t.set(null)}};export{i as a,c as m,t as o}; diff --git a/_app/immutable/chunks/vendor_svelte.f9b78e98.js b/_app/immutable/chunks/vendor_svelte.d337c9a7.js similarity index 59% rename from _app/immutable/chunks/vendor_svelte.f9b78e98.js rename to _app/immutable/chunks/vendor_svelte.d337c9a7.js index e3223dac..36c81dcd 100644 --- a/_app/immutable/chunks/vendor_svelte.f9b78e98.js +++ b/_app/immutable/chunks/vendor_svelte.d337c9a7.js @@ -1,9 +1,9 @@ var Tn=Object.defineProperty;var Ln=(t,e,n)=>e in t?Tn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>(Ln(t,typeof e!="symbol"?e+"":e,n),n);import{u as Pn}from"./vendor.e9b0235c.js";function z(){}const Xe=t=>t;function bt(t,e){for(const n in e)t[n]=e[n];return t}function On(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Qe(t){return t()}function Ae(){return Object.create(null)}function rt(t){t.forEach(Qe)}function Mt(t){return typeof t=="function"}function ce(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Nn(t){return Object.keys(t).length===0}function le(t,...e){if(t==null){for(const r of e)r(void 0);return z}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function yi(t){let e;return le(t,n=>e=n)(),e}function jn(t,e,n){t.$$.on_destroy.push(le(e,n))}function wi(t,e,n,r){if(t){const i=Ze(t,e,n,r);return t[0](i)}}function Ze(t,e,n,r){return t[1]&&r?bt(n.ctx.slice(),t[1](r(e))):n.ctx}function bi(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],s=Math.max(e.dirty.length,i.length);for(let o=0;o32){const e=[],n=t.ctx.length/32;for(let r=0;rwindow.performance.now():()=>Date.now(),fe=tn?t=>requestAnimationFrame(t):z;const ct=new Set;function en(t){ct.forEach(e=>{e.c(t)||(ct.delete(e),e.f())}),ct.size!==0&&fe(en)}function In(t){let e;return ct.size===0&&fe(en),{promise:new Promise(n=>{ct.add(e={c:t,f:n})}),abort(){ct.delete(e)}}}let Ht=!1;function Un(){Ht=!0}function Dn(){Ht=!1}function Fn(t,e,n,r){for(;t>1);n(i)<=r?t=i+1:e=i}return t}function Mn(t){if(t.hydrate_init)return;t.hydrate_init=!0;let e=t.childNodes;if(t.nodeName==="HEAD"){const c=[];for(let l=0;l0&&e[n[i]].claim_order<=l?i+1:Fn(1,i,$=>e[n[$]].claim_order,l))-1;r[c]=n[d]+1;const m=d+1;n[m]=c,i=Math.max(m,i)}const a=[],s=[];let o=e.length-1;for(let c=n[i]+1;c!=0;c=r[c-1]){for(a.push(e[c-1]);o>=c;o--)s.push(e[o]);o--}for(;o>=0;o--)s.push(e[o]);a.reverse(),s.sort((c,l)=>c.claim_order-l.claim_order);for(let c=0,l=0;c=a[l].claim_order;)l++;const d=lt.removeEventListener(e,n,r)}function rn(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const Gn=["width","height"];function Te(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const r in e)e[r]==null?t.removeAttribute(r):r==="style"?t.style.cssText=e[r]:r==="__value"?t.value=t[r]=e[r]:n[r]&&n[r].set&&Gn.indexOf(r)===-1?t[r]=e[r]:rn(t,r,e[r])}function Le(t,e){for(const n in e)rn(t,n,e[n])}function Ei(t){return t.dataset.svelteH}function Ai(t){return t===""?null:+t}function xt(t){return Array.from(t.childNodes)}function an(t){t.claim_info===void 0&&(t.claim_info={last_index:0,total_claimed:0})}function on(t,e,n,r,i=!1){an(t);const a=(()=>{for(let s=t.claim_info.last_index;s=0;s--){const o=t[s];if(e(o)){const c=n(o);return c===void 0?t.splice(s,1):t[s]=c,i?c===void 0&&t.claim_info.last_index--:t.claim_info.last_index=s,o}}return r()})();return a.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,a}function sn(t,e,n,r){return on(t,i=>i.nodeName===e,i=>{const a=[];for(let s=0;si.removeAttribute(s))},()=>r(e))}function ie(t,e,n){return sn(t,e,n,ft)}function Wn(t,e,n){return sn(t,e,n,ue)}function ae(t,e){return on(t,n=>n.nodeType===3,n=>{const r=""+e;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>vt(e),!0)}function Kn(t){return ae(t," ")}function Pe(t,e,n){for(let r=n;r0&&n.push(i);return n}class Yn{constructor(e=!1){G(this,"is_svg",!1);G(this,"e");G(this,"n");G(this,"t");G(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,n,r=null){this.e||(this.is_svg?this.e=ue(n.nodeName):this.e=ft(n.nodeType===11?"TEMPLATE":n.nodeName),this.t=n.tagName!=="TEMPLATE"?n:n.content,this.c(e)),this.i(r)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let n=0;n>>0}function Qn(t,e){const n={stylesheet:zn(e),rules:{}};return jt.set(t,n),n}function Ne(t,e,n,r,i,a,s,o=0){const c=16.666/r;let l=`{ `;for(let R=0;R<=1;R+=c){const x=e+(n-e)*a(R);l+=R*100+`%{${s(x,1-x)}} `}const d=l+`100% {${s(n,1-n)}} -}`,m=`__svelte_${Xn(d)}_${o}`,$=nn(t),{stylesheet:P,rules:y}=jt.get($)||Qn($,t);y[m]||(y[m]=!0,P.insertRule(`@keyframes ${m} ${d}`,P.cssRules.length));const w=t.style.animation||"";return t.style.animation=`${w?`${w}, `:""}${m} ${r}ms linear ${i}ms 1 both`,Ct+=1,m}function Zn(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Ct-=i,Ct||tr())}function tr(){fe(()=>{Ct||(jt.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&H(e)}),jt.clear())})}let kt;function K(t){kt=t}function zt(){if(!kt)throw new Error("Function called outside component initialization");return kt}function Jt(t){zt().$$.on_mount.push(t)}function Ni(t){zt().$$.after_update.push(t)}function ji(){const t=zt();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const a=cn(e,n,{cancelable:r});return i.slice().forEach(s=>{s.call(t,a)}),!a.defaultPrevented}return!0}}function Ci(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const st=[],je=[];let lt=[];const Ce=[],ln=Promise.resolve();let oe=!1;function fn(){oe||(oe=!0,ln.then(de))}function Yt(){return fn(),ln}function It(t){lt.push(t)}const Xt=new Set;let it=0;function de(){if(it!==0)return;const t=kt;do{try{for(;itt.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),lt=e}let _t;function rr(){return _t||(_t=Promise.resolve(),_t.then(()=>{_t=null})),_t}function Qt(t,e,n){t.dispatchEvent(cn(`${e?"intro":"outro"}${n}`))}const Pt=new Set;let J;function ir(){J={r:0,c:[],p:J}}function ar(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function or(t,e,n,r){if(t&&t.o){if(Pt.has(t))return;Pt.add(t),J.c.push(()=>{Pt.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}const sr={duration:0};function Ii(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,c=null,l=null,d;function m(){l&&Zn(t,l)}function $(y,w){const R=y.b-s;return w*=Math.abs(R),{a:s,b:y.b,d:R,duration:w,start:y.start,end:y.start+w,group:y.group}}function P(y){const{delay:w=0,duration:R=300,easing:x=Xe,tick:v=z,css:L}=a||sr,Z={start:Cn()+w,b:y};y||(Z.group=J,J.r+=1),"inert"in t&&(y?d!==void 0&&(t.inert=d):(d=t.inert,t.inert=!0)),o||c?c=Z:(L&&(m(),l=Ne(t,s,y,R,w,x,L)),y&&v(0,1),o=$(Z,R),It(()=>Qt(t,y,"start")),In(V=>{if(c&&V>c.start&&(o=$(c,R),c=null,Qt(t,o.b,"start"),L&&(m(),l=Ne(t,s,o.b,o.duration,0,x,a.css))),o){if(V>=o.end)v(s=o.b,1-s),Qt(t,o.b,"end"),c||(o.b?m():--o.group.r||rt(o.group.c)),o=null;else if(V>=o.start){const Y=V-o.start;s=o.a+o.d*x(Y/o.duration),v(s,1-s)}}return!!(o||c)}))}return{run(y){Mt(a)?rr().then(()=>{a=a({direction:y?"in":"out"}),P(y)}):P(y)},end(){m(),o=c=null}}}function Ui(t,e){const n=e.token={};function r(i,a,s,o){if(e.token!==n)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const l=i&&(e.current=i)(c);let d=!1;e.block&&(e.blocks?e.blocks.forEach((m,$)=>{$!==a&&m&&(ir(),or(m,1,1,()=>{e.blocks[$]===m&&(e.blocks[$]=null)}),ar())}):e.block.d(1),l.c(),un(l,1),l.m(e.mount(),e.anchor),d=!0),e.block=l,e.blocks&&(e.blocks[a]=l),d&&de()}if(On(t)){const i=zt();if(t.then(a=>{K(i),r(e.then,1,e.value,a),K(null)},a=>{if(K(i),r(e.catch,2,e.error,a),K(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Di(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function dn(t,e){const n={},r={},i={$$scope:1};let a=t.length;for(;a--;){const s=t[a],o=e[a];if(o){for(const c in s)c in o||(r[c]=1);for(const c in o)i[c]||(n[c]=o[c],i[c]=1);t[a]=o}else for(const c in s)i[c]=1}for(const s in r)s in n||(n[s]=void 0);return n}function Fi(t){t&&t.c()}function Mi(t,e){t&&t.l(e)}function cr(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),It(()=>{const a=t.$$.on_mount.map(Qe).filter(Mt);t.$$.on_destroy?t.$$.on_destroy.push(...a):rt(a),t.$$.on_mount=[]}),i.forEach(It)}function lr(t,e){const n=t.$$;n.fragment!==null&&(nr(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function fr(t,e){t.$$.dirty[0]===-1&&(st.push(t),fn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=P.length?P[0]:$;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&fr(t,m)),$}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){Un();const m=xt(e.target);l.fragment&&l.fragment.l(m),m.forEach(H)}else l.fragment&&l.fragment.c();e.intro&&un(t.$$.fragment),cr(t,e.target,e.anchor),Dn(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){lr(this,1),this.$destroy=z}$on(e,n){if(!Mt(n))return z;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!Nn(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ur="4";function dr(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function hr(t){return t.split("%25").map(decodeURI).join("%25")}function pr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const _r=["href","pathname","search","searchParams","toString","toJSON"];function gr(t,e){const n=new URL(t);for(const r of _r)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return mr(n),n}function mr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const yr="/__data.json";function wr(t){return t.replace(/\/$/,"")+yr}function br(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let i=r.length;for(;i;)e=e*33^r[--i]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const _n=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&wt.delete(he(t)),_n(t,e));const wt=new Map;function vr(t,e){const n=he(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){const{body:i,...a}=JSON.parse(r.textContent),s=r.getAttribute("data-ttl");return s&&wt.set(n,{body:i,init:a,ttl:1e3*Number(s)}),Promise.resolve(new Response(i,a))}return window.fetch(t,e)}function xr(t,e,n){if(wt.size>0){const r=he(t,n),i=wt.get(r);if(i){if(performance.now(){const i=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(i)return e.push({name:i[1],matcher:i[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const a=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return Zt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return Zt(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=kr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,$,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!$,chained:$?l===1&&s[0]==="":!1}),$?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function Sr(t){return!/^\([^)]+\)$/.test(t)}function Er(t){return t.slice(1).split("/").filter(Sr)}function Ar(t,e,n){const r={},i=t.slice(1),a=i.filter(o=>o!==void 0);let s=0;for(let o=0;od).join("/"),s=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=e[o+1],m=i[o+1];d&&!d.rest&&d.optional&&m&&c.chained&&(s=0),!d&&!m&&Object.keys(r).length===a.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function Zt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Rr({nodes:t,server_loads:e,dictionary:n,matchers:r}){const i=new Set(e);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:m,params:$}=$r(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Ar(w,$,r)},errors:[1,...d||[]].map(y=>t[y]),layouts:[0,...l||[]].map(s),leaf:a(c)};return P.errors.length=P.layouts.length=Math.max(P.errors.length,P.layouts.length),P});function a(o){const c=o<0;return c&&(o=~o),[c,t[o]]}function s(o){return o===void 0?o:[i.has(o),t[o]]}}function gn(t){try{return JSON.parse(sessionStorage[t])}catch{}}function Ie(t,e){const n=JSON.stringify(e);try{sessionStorage[t]=n}catch{}}const at=[];function Tr(t,e){return{subscribe:Vt(t,e).subscribe}}function Vt(t,e=z){let n;const r=new Set;function i(o){if(ce(t,o)&&(t=o,n)){const c=!at.length;for(const l of r)l[1](),at.push(l,t);if(c){for(let l=0;l{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:s}}function Hi(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=e.length<2;return Tr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const $=()=>{if(d)return;m();const y=e(r?l[0]:l,s,o);a?s(y):m=Mt(y)?y:z},P=i.map((y,w)=>le(y,R=>{l[w]=R,d&=~(1<{d|=1<s)}function i(s){n=!1,e.set(s)}function a(s){let o;return e.subscribe(c=>{(o===void 0||n&&c!==o)&&s(o=c)})}return{notify:r,set:i,subscribe:a}}function Or(){const{set:t,subscribe:e}=Vt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Lr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Pr;return s&&(t(!0),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ot(t,e){return t.origin!==Dt||!t.pathname.startsWith(e)}function Nr(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const jr=new Set([...bn]);[...jr];async function Cr(t,e){var n;for(const r in t)if(typeof((n=t[r])==null?void 0:n.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([i,a])=>[i,await a])));return t}class yt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class He{constructor(e,n){this.status=e,this.location=n}}const Ir="x-sveltekit-invalidated",Ur="x-sveltekit-trailing-slash";function Dr(t){t.client}const W={url:Me({}),page:Me({}),navigating:Vt(null),updated:Or()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Fr(t,e){var $e;const n=Rr(t),r=t.nodes[0],i=t.nodes[1];r(),i();const a=document.documentElement,s=[],o=[];let c=null;const l={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},m=!1,$=!1,P=!0,y=!1,w=!1,R=!1,x=!1,v,L=($e=history.state)==null?void 0:$e[B];L||(L=Date.now(),history.replaceState({...history.state,[B]:L},"",location.href));const Z=et[L];Z&&(history.scrollRestoration="manual",scrollTo(Z.x,Z.y));let V,Y,ut;async function pe(){if(ut=ut||Promise.resolve(),await ut,!ut)return;ut=null;const f=new URL(location.href),_=ht(f,!0);c=null;const u=Y={},p=_&&await Gt(_);if(u===Y&&p){if(p.type==="redirect")return $t(new URL(p.location,f).href,{},1,u);p.props.page!==void 0&&(V=p.props.page),v.$set(p.props)}}function _e(f){o.some(_=>_==null?void 0:_.snapshot)&&(gt[f]=o.map(_=>{var u;return(u=_==null?void 0:_.snapshot)==null?void 0:u.capture()}))}function ge(f){var _;(_=gt[f])==null||_.forEach((u,p)=>{var h,g;(g=(h=o[p])==null?void 0:h.snapshot)==null||g.restore(u)})}function me(){ee(L),Ie(yn,et),_e(L),Ie(mn,gt)}async function $t(f,{noScroll:_=!1,replaceState:u=!1,keepFocus:p=!1,state:h={},invalidateAll:g=!1},b,A){return typeof f=="string"&&(f=new URL(f,Ue(document))),Rt({url:f,scroll:_?mt():null,keepfocus:p,redirect_count:b,details:{state:h,replaceState:u},nav_token:A,accepted:()=>{g&&(x=!0)},blocked:()=>{},type:"goto"})}async function ye(f){return c={id:f.id,promise:Gt(f).then(_=>(_.type==="loaded"&&_.state.error&&(c=null),_))},c.promise}async function St(...f){const u=n.filter(p=>f.some(h=>p.exec(h))).map(p=>Promise.all([...p.layouts,p.leaf].map(h=>h==null?void 0:h[1]())));await Promise.all(u)}function we(f){var p;d=f.state;const _=document.querySelector("style[data-sveltekit]");_&&_.remove(),V=f.props.page,v=new t.root({target:e,props:{...f.props,stores:W,components:o},hydrate:!0}),ge(L);const u={from:null,to:{params:d.params,route:{id:((p=d.route)==null?void 0:p.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};l.after_navigate.forEach(h=>h(u)),$=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const S of u)(S==null?void 0:S.slash)!==void 0&&(A=S.slash);f.pathname=dr(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Nr(u).map(S=>S.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!V,j=0;for(let S=0;S(A.route=!0,k[D])}),params:new Proxy(p,{get:(k,D)=>(A.params.add(D),k[D])}),data:(g==null?void 0:g.data)??null,url:gr(u,()=>{A.url=!0}),async fetch(k,D){let F;k instanceof Request?(F=k.url,D={body:k.method==="GET"||k.method==="HEAD"?void 0:await k.blob(),cache:k.cache,credentials:k.credentials,headers:k.headers,integrity:k.integrity,keepalive:k.keepalive,method:k.method,mode:k.mode,redirect:k.redirect,referrer:k.referrer,referrerPolicy:k.referrerPolicy,signal:k.signal,...D}):F=k;const q=new URL(F,u);return U(q.href),q.origin===u.origin&&(F=q.href.slice(u.origin.length)),$?xr(F,q.href,D):vr(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,S)??null,b=b?await Cr(b,h.id):null}return{node:T,loader:f,server:g,universal:(I=T.universal)!=null&&I.load?{type:"data",data:b,uses:A}:null,data:b??(g==null?void 0:g.data)??null,slash:((j=T.universal)==null?void 0:j.trailingSlash)??(g==null?void 0:g.slash)}}function be(f,_,u,p,h){if(x)return!0;if(!p)return!1;if(p.parent&&f||p.route&&_||p.url&&u)return!0;for(const g of p.params)if(h[g]!==d.params[g])return!0;for(const g of p.dependencies)if(s.some(b=>b(new URL(g))))return!0;return!1}function Bt(f,_){return(f==null?void 0:f.type)==="data"?f:(f==null?void 0:f.type)==="skip"?_??null:null}async function Gt({id:f,invalidating:_,url:u,params:p,route:h}){if((c==null?void 0:c.id)===f)return c.promise;const{errors:g,layouts:b,leaf:A}=h,T=[...b,A];g.forEach(O=>O==null?void 0:O().catch(()=>{})),T.forEach(O=>O==null?void 0:O[1]().catch(()=>{}));let E=null;const I=d.url?f!==d.url.pathname+d.url.search:!1,j=d.route?h.id!==d.route.id:!1;let U=!1;const S=T.map((O,C)=>{var tt;const N=d.branch[C],M=!!(O!=null&&O[0])&&((N==null?void 0:N.loader)!==O[1]||be(U,j,I,(tt=N.server)==null?void 0:tt.uses,p));return M&&(U=!0),M});if(S.some(Boolean)){try{E=await ze(u,S)}catch(O){return Et({status:O instanceof yt?O.status:500,error:await pt(O,{url:u,params:p,route:{id:h.id}}),url:u,route:h})}if(E.type==="redirect")return E}const k=E==null?void 0:E.nodes;let D=!1;const F=T.map(async(O,C)=>{var Wt;if(!O)return;const N=d.branch[C],M=k==null?void 0:k[C];if((!M||M.type==="skip")&&O[1]===(N==null?void 0:N.loader)&&!be(D,j,I,(Wt=N.universal)==null?void 0:Wt.uses,p))return N;if(D=!0,(M==null?void 0:M.type)==="error")throw M;return qt({loader:O[1],url:u,params:p,route:h,parent:async()=>{var Ee;const Se={};for(let Kt=0;Kt{});const q=[];for(let O=0;OPromise.resolve({}),server_data_node:Bt(g)}),T={node:await i(),loader:i,universal:null,server:null,data:null};return await dt({url:u,params:h,branch:[A,T],status:f,error:_,route:null})}function ht(f,_){if(Ot(f,X))return;const u=At(f);for(const p of n){const h=p.exec(u);if(h)return{id:f.pathname+f.search,invalidating:_,route:p,params:pr(h),url:f}}}function At(f){return hr(f.pathname.slice(X.length)||"/")}function xe({url:f,type:_,intent:u,delta:p}){let h=!1;const g=Ve(d,u,f,_);p!==void 0&&(g.navigation.delta=p);const b={...g.navigation,cancel:()=>{h=!0,g.reject(new Error("navigation was cancelled"))}};return w||l.before_navigate.forEach(A=>A(b)),h?null:g}async function Rt({url:f,scroll:_,keepfocus:u,redirect_count:p,details:h,type:g,delta:b,nav_token:A={},accepted:T,blocked:E}){var F,q,O;const I=ht(f,!1),j=xe({url:f,type:g,delta:b,intent:I});if(!j){E();return}const U=L;T(),w=!0,$&&W.navigating.set(j.navigation),Y=A;let S=I&&await Gt(I);if(!S){if(Ot(f,X))return await nt(f);S=await ke(f,{id:null},await pt(new Error(`Not found: ${f.pathname}`),{url:f,params:{},route:{id:null}}),404)}if(f=(I==null?void 0:I.url)||f,Y!==A)return j.reject(new Error("navigation was aborted")),!1;if(S.type==="redirect")if(p>=20)S=await Et({status:500,error:await pt(new Error("Redirect loop"),{url:f,params:{},route:{id:null}}),url:f,route:{id:null}});else return $t(new URL(S.location,f).href,{},p+1,A),!1;else((F=S.props.page)==null?void 0:F.status)>=400&&await W.updated.check()&&await nt(f);if(s.length=0,x=!1,y=!0,ee(U),_e(U),(q=S.props.page)!=null&&q.url&&S.props.page.url.pathname!==f.pathname&&(f.pathname=(O=S.props.page)==null?void 0:O.url.pathname),h){const C=h.replaceState?0:1;if(h.state[B]=L+=C,history[h.replaceState?"replaceState":"pushState"](h.state,"",f),!h.replaceState){let N=L+1;for(;gt[N]||et[N];)delete gt[N],delete et[N],N+=1}}if(c=null,$){d=S.state,S.props.page&&(S.props.page.url=f);const C=(await Promise.all(l.on_navigate.map(N=>N(j.navigation)))).filter(N=>typeof N=="function");if(C.length>0){let N=function(){l.after_navigate=l.after_navigate.filter(M=>!C.includes(M))};C.push(N),l.after_navigate.push(...C)}v.$set(S.props)}else we(S);const{activeElement:k}=document;if(await Yt(),P){const C=f.hash&&document.getElementById(decodeURIComponent(f.hash.slice(1)));_?scrollTo(_.x,_.y):C?C.scrollIntoView():scrollTo(0,0)}const D=document.activeElement!==k&&document.activeElement!==document.body;!u&&!D&&ne(),P=!0,S.props.page&&(V=S.props.page),w=!1,g==="popstate"&&ge(L),j.fulfil(void 0),l.after_navigate.forEach(C=>C(j.navigation)),W.navigating.set(null),y=!1}async function ke(f,_,u,p){return f.origin===Dt&&f.pathname===location.pathname&&!m?await Et({status:p,error:u,url:f,route:_}):await nt(f)}function Rn(){let f;a.addEventListener("mousemove",g=>{const b=g.target;clearTimeout(f),f=setTimeout(()=>{p(b,2)},20)});function _(g){p(g.composedPath()[0],1)}a.addEventListener("mousedown",_),a.addEventListener("touchstart",_,{passive:!0});const u=new IntersectionObserver(g=>{for(const b of g)b.isIntersecting&&(St(At(new URL(b.target.href))),u.unobserve(b.target))},{threshold:0});function p(g,b){const A=Fe(g,a);if(!A)return;const{url:T,external:E,download:I}=te(A,X);if(E||I)return;const j=Tt(A);if(!j.reload)if(b<=j.preload_data){const U=ht(T,!1);U&&ye(U)}else b<=j.preload_code&&St(At(T))}function h(){u.disconnect();for(const g of a.querySelectorAll("a")){const{url:b,external:A,download:T}=te(g,X);if(A||T)continue;const E=Tt(g);E.reload||(E.preload_code===Ut.viewport&&u.observe(g),E.preload_code===Ut.eager&&St(At(b)))}}l.after_navigate.push(h),h()}function pt(f,_){return f instanceof yt?f.body:t.hooks.handleError({error:f,event:_})??{message:_.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:f=>{Jt(()=>(l.after_navigate.push(f),()=>{const _=l.after_navigate.indexOf(f);l.after_navigate.splice(_,1)}))},before_navigate:f=>{Jt(()=>(l.before_navigate.push(f),()=>{const _=l.before_navigate.indexOf(f);l.before_navigate.splice(_,1)}))},on_navigate:f=>{Jt(()=>(l.on_navigate.push(f),()=>{const _=l.on_navigate.indexOf(f);l.on_navigate.splice(_,1)}))},disable_scroll_handling:()=>{(y||!$)&&(P=!1)},goto:(f,_={})=>$t(f,_,0),invalidate:f=>{if(typeof f=="function")s.push(f);else{const{href:_}=new URL(f,location.href);s.push(u=>u.href===_)}return pe()},invalidate_all:()=>(x=!0,pe()),preload_data:async f=>{const _=new URL(f,Ue(document)),u=ht(_,!1);if(!u)throw new Error(`Attempted to preload a URL that does not belong to this app: ${_}`);await ye(u)},preload_code:St,apply_action:async f=>{if(f.type==="error"){const _=new URL(location.href),{branch:u,route:p}=d;if(!p)return;const h=await ve(d.branch.length,u,p.errors);if(h){const g=await dt({url:_,params:d.params,branch:u.slice(0,h.idx).concat(h.node),status:f.status??500,error:f.error,route:p});d=g.state,v.$set(g.props),Yt().then(ne)}}else f.type==="redirect"?$t(f.location,{invalidateAll:!0},0):(v.$set({form:null,page:{...V,form:f.data,status:f.status}}),await Yt(),v.$set({form:f.data}),f.type==="success"&&ne())},_start_router:()=>{var _;history.scrollRestoration="manual",addEventListener("beforeunload",u=>{let p=!1;if(me(),!w){const h=Ve(d,void 0,null,"leave"),g={...h.navigation,cancel:()=>{p=!0,h.reject(new Error("navigation was cancelled"))}};l.before_navigate.forEach(b=>b(g))}p?(u.preventDefault(),u.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&me()}),(_=navigator.connection)!=null&&_.saveData||Rn(),a.addEventListener("click",u=>{var U;if(u.button||u.which!==1||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||u.defaultPrevented)return;const p=Fe(u.composedPath()[0],a);if(!p)return;const{url:h,external:g,target:b,download:A}=te(p,X);if(!h)return;if(b==="_parent"||b==="_top"){if(window.parent!==window)return}else if(b&&b!=="_self")return;const T=Tt(p);if(!(p instanceof SVGAElement)&&h.protocol!==location.protocol&&!(h.protocol==="https:"||h.protocol==="http:")||A)return;if(g||T.reload){xe({url:h,type:"link"})?w=!0:u.preventDefault();return}const[I,j]=h.href.split("#");if(j!==void 0&&I===location.href.split("#")[0]){if(d.url.hash===h.hash){u.preventDefault(),(U=p.ownerDocument.getElementById(j))==null||U.scrollIntoView();return}if(R=!0,ee(L),f(h),!T.replace_state)return;R=!1,u.preventDefault()}Rt({url:h,scroll:T.noscroll?mt():null,keepfocus:T.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:T.replace_state??h.href===location.href},accepted:()=>u.preventDefault(),blocked:()=>u.preventDefault(),type:"link"})}),a.addEventListener("submit",u=>{if(u.defaultPrevented)return;const p=HTMLFormElement.prototype.cloneNode.call(u.target),h=u.submitter;if(((h==null?void 0:h.formMethod)||p.method)!=="get")return;const b=new URL((h==null?void 0:h.hasAttribute("formaction"))&&(h==null?void 0:h.formAction)||p.action);if(Ot(b,X))return;const A=u.target,{keep_focus:T,noscroll:E,reload:I,replace_state:j}=Tt(A);if(I)return;u.preventDefault(),u.stopPropagation();const U=new FormData(A),S=h==null?void 0:h.getAttribute("name");S&&U.append(S,(h==null?void 0:h.getAttribute("value"))??""),b.search=new URLSearchParams(U).toString(),Rt({url:b,scroll:E?mt():null,keepfocus:T??!1,redirect_count:0,details:{state:{},replaceState:j??b.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async u=>{var p;if(Y={},(p=u.state)!=null&&p[B]){if(u.state[B]===L)return;const h=et[u.state[B]],g=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){f(g),et[L]=mt(),L=u.state[B],scrollTo(h.x,h.y);return}const b=u.state[B]-L;await Rt({url:g,scroll:h,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{L=u.state[B]},blocked:()=>{history.go(-b)},type:"popstate",delta:b,nav_token:Y})}else if(!R){const h=new URL(location.href);f(h)}}),addEventListener("hashchange",()=>{R&&(R=!1,history.replaceState({...history.state,[B]:++L},"",location.href))});for(const u of document.querySelectorAll("link"))u.rel==="icon"&&(u.href=u.href);addEventListener("pageshow",u=>{u.persisted&&W.navigating.set(null)});function f(u){d.url=u,W.page.set({...V,url:u}),W.page.notify()}},_hydrate:async({status:f=200,error:_,node_ids:u,params:p,route:h,data:g,form:b})=>{m=!0;const A=new URL(location.href);({params:p={},route:h={id:null}}=ht(A,!1)||{});let T;try{const E=u.map(async(U,S)=>{const k=g[S];return k!=null&&k.uses&&(k.uses=vn(k.uses)),qt({loader:t.nodes[U],url:A,params:p,route:h,parent:async()=>{const D={};for(let F=0;FU===h.id);if(j){const U=j.layouts;for(let S=0;Sa?"1":"0").join(""));const r=await _n(n.href);if((i=r.headers.get("content-type"))!=null&&i.includes("text/html")&&await nt(t),!r.ok)throw new yt(r.status,await r.json());return new Promise(async a=>{var m;const s=new Map,o=r.body.getReader(),c=new TextDecoder;function l($){return Pn($,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:$,value:P}=await o.read();if($&&!d)break;for(d+=!P&&d?` +}`,m=`__svelte_${Xn(d)}_${o}`,$=nn(t),{stylesheet:P,rules:y}=jt.get($)||Qn($,t);y[m]||(y[m]=!0,P.insertRule(`@keyframes ${m} ${d}`,P.cssRules.length));const w=t.style.animation||"";return t.style.animation=`${w?`${w}, `:""}${m} ${r}ms linear ${i}ms 1 both`,Ct+=1,m}function Zn(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Ct-=i,Ct||tr())}function tr(){fe(()=>{Ct||(jt.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&H(e)}),jt.clear())})}let kt;function K(t){kt=t}function zt(){if(!kt)throw new Error("Function called outside component initialization");return kt}function Jt(t){zt().$$.on_mount.push(t)}function Ni(t){zt().$$.after_update.push(t)}function ji(){const t=zt();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const a=cn(e,n,{cancelable:r});return i.slice().forEach(s=>{s.call(t,a)}),!a.defaultPrevented}return!0}}function Ci(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const st=[],je=[];let lt=[];const Ce=[],ln=Promise.resolve();let oe=!1;function fn(){oe||(oe=!0,ln.then(de))}function Yt(){return fn(),ln}function It(t){lt.push(t)}const Xt=new Set;let it=0;function de(){if(it!==0)return;const t=kt;do{try{for(;itt.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),lt=e}let _t;function rr(){return _t||(_t=Promise.resolve(),_t.then(()=>{_t=null})),_t}function Qt(t,e,n){t.dispatchEvent(cn(`${e?"intro":"outro"}${n}`))}const Pt=new Set;let J;function ir(){J={r:0,c:[],p:J}}function ar(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function or(t,e,n,r){if(t&&t.o){if(Pt.has(t))return;Pt.add(t),J.c.push(()=>{Pt.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}const sr={duration:0};function Ii(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,c=null,l=null,d;function m(){l&&Zn(t,l)}function $(y,w){const R=y.b-s;return w*=Math.abs(R),{a:s,b:y.b,d:R,duration:w,start:y.start,end:y.start+w,group:y.group}}function P(y){const{delay:w=0,duration:R=300,easing:x=Xe,tick:v=z,css:L}=a||sr,Z={start:Cn()+w,b:y};y||(Z.group=J,J.r+=1),"inert"in t&&(y?d!==void 0&&(t.inert=d):(d=t.inert,t.inert=!0)),o||c?c=Z:(L&&(m(),l=Ne(t,s,y,R,w,x,L)),y&&v(0,1),o=$(Z,R),It(()=>Qt(t,y,"start")),In(V=>{if(c&&V>c.start&&(o=$(c,R),c=null,Qt(t,o.b,"start"),L&&(m(),l=Ne(t,s,o.b,o.duration,0,x,a.css))),o){if(V>=o.end)v(s=o.b,1-s),Qt(t,o.b,"end"),c||(o.b?m():--o.group.r||rt(o.group.c)),o=null;else if(V>=o.start){const Y=V-o.start;s=o.a+o.d*x(Y/o.duration),v(s,1-s)}}return!!(o||c)}))}return{run(y){Mt(a)?rr().then(()=>{a=a({direction:y?"in":"out"}),P(y)}):P(y)},end(){m(),o=c=null}}}function Ui(t,e){const n=e.token={};function r(i,a,s,o){if(e.token!==n)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const l=i&&(e.current=i)(c);let d=!1;e.block&&(e.blocks?e.blocks.forEach((m,$)=>{$!==a&&m&&(ir(),or(m,1,1,()=>{e.blocks[$]===m&&(e.blocks[$]=null)}),ar())}):e.block.d(1),l.c(),un(l,1),l.m(e.mount(),e.anchor),d=!0),e.block=l,e.blocks&&(e.blocks[a]=l),d&&de()}if(On(t)){const i=zt();if(t.then(a=>{K(i),r(e.then,1,e.value,a),K(null)},a=>{if(K(i),r(e.catch,2,e.error,a),K(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Di(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function dn(t,e){const n={},r={},i={$$scope:1};let a=t.length;for(;a--;){const s=t[a],o=e[a];if(o){for(const c in s)c in o||(r[c]=1);for(const c in o)i[c]||(n[c]=o[c],i[c]=1);t[a]=o}else for(const c in s)i[c]=1}for(const s in r)s in n||(n[s]=void 0);return n}function Fi(t){t&&t.c()}function Mi(t,e){t&&t.l(e)}function cr(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),It(()=>{const a=t.$$.on_mount.map(Qe).filter(Mt);t.$$.on_destroy?t.$$.on_destroy.push(...a):rt(a),t.$$.on_mount=[]}),i.forEach(It)}function lr(t,e){const n=t.$$;n.fragment!==null&&(nr(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function fr(t,e){t.$$.dirty[0]===-1&&(st.push(t),fn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=P.length?P[0]:$;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&fr(t,m)),$}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){Un();const m=xt(e.target);l.fragment&&l.fragment.l(m),m.forEach(H)}else l.fragment&&l.fragment.c();e.intro&&un(t.$$.fragment),cr(t,e.target,e.anchor),Dn(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){lr(this,1),this.$destroy=z}$on(e,n){if(!Mt(n))return z;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!Nn(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ur="4";function dr(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function hr(t){return t.split("%25").map(decodeURI).join("%25")}function pr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const _r=["href","pathname","search","searchParams","toString","toJSON"];function gr(t,e){const n=new URL(t);for(const r of _r)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return mr(n),n}function mr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const yr="/__data.json";function wr(t){return t.replace(/\/$/,"")+yr}function br(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let i=r.length;for(;i;)e=e*33^r[--i]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const _n=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&wt.delete(he(t)),_n(t,e));const wt=new Map;function vr(t,e){const n=he(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){const{body:i,...a}=JSON.parse(r.textContent),s=r.getAttribute("data-ttl");return s&&wt.set(n,{body:i,init:a,ttl:1e3*Number(s)}),Promise.resolve(new Response(i,a))}return window.fetch(t,e)}function xr(t,e,n){if(wt.size>0){const r=he(t,n),i=wt.get(r);if(i){if(performance.now(){const i=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(i)return e.push({name:i[1],matcher:i[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const a=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return Zt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return Zt(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=kr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,$,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!$,chained:$?l===1&&s[0]==="":!1}),$?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function Sr(t){return!/^\([^)]+\)$/.test(t)}function Er(t){return t.slice(1).split("/").filter(Sr)}function Ar(t,e,n){const r={},i=t.slice(1),a=i.filter(o=>o!==void 0);let s=0;for(let o=0;od).join("/"),s=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=e[o+1],m=i[o+1];d&&!d.rest&&d.optional&&m&&c.chained&&(s=0),!d&&!m&&Object.keys(r).length===a.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function Zt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Rr({nodes:t,server_loads:e,dictionary:n,matchers:r}){const i=new Set(e);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:m,params:$}=$r(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Ar(w,$,r)},errors:[1,...d||[]].map(y=>t[y]),layouts:[0,...l||[]].map(s),leaf:a(c)};return P.errors.length=P.layouts.length=Math.max(P.errors.length,P.layouts.length),P});function a(o){const c=o<0;return c&&(o=~o),[c,t[o]]}function s(o){return o===void 0?o:[i.has(o),t[o]]}}function gn(t){try{return JSON.parse(sessionStorage[t])}catch{}}function Ie(t,e){const n=JSON.stringify(e);try{sessionStorage[t]=n}catch{}}const at=[];function Tr(t,e){return{subscribe:Vt(t,e).subscribe}}function Vt(t,e=z){let n;const r=new Set;function i(o){if(ce(t,o)&&(t=o,n)){const c=!at.length;for(const l of r)l[1](),at.push(l,t);if(c){for(let l=0;l{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:s}}function Hi(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=e.length<2;return Tr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const $=()=>{if(d)return;m();const y=e(r?l[0]:l,s,o);a?s(y):m=Mt(y)?y:z},P=i.map((y,w)=>le(y,R=>{l[w]=R,d&=~(1<{d|=1<s)}function i(s){n=!1,e.set(s)}function a(s){let o;return e.subscribe(c=>{(o===void 0||n&&c!==o)&&s(o=c)})}return{notify:r,set:i,subscribe:a}}function Or(){const{set:t,subscribe:e}=Vt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Lr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Pr;return s&&(t(!0),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ot(t,e){return t.origin!==Dt||!t.pathname.startsWith(e)}function Nr(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const jr=new Set([...bn]);[...jr];async function Cr(t,e){var n;for(const r in t)if(typeof((n=t[r])==null?void 0:n.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([i,a])=>[i,await a])));return t}class yt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class He{constructor(e,n){this.status=e,this.location=n}}const Ir="x-sveltekit-invalidated",Ur="x-sveltekit-trailing-slash";function Dr(t){t.client}const W={url:Me({}),page:Me({}),navigating:Vt(null),updated:Or()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Fr(t,e){var $e;const n=Rr(t),r=t.nodes[0],i=t.nodes[1];r(),i();const a=document.documentElement,s=[],o=[];let c=null;const l={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},m=!1,$=!1,P=!0,y=!1,w=!1,R=!1,x=!1,v,L=($e=history.state)==null?void 0:$e[B];L||(L=Date.now(),history.replaceState({...history.state,[B]:L},"",location.href));const Z=et[L];Z&&(history.scrollRestoration="manual",scrollTo(Z.x,Z.y));let V,Y,ut;async function pe(){if(ut=ut||Promise.resolve(),await ut,!ut)return;ut=null;const f=new URL(location.href),_=ht(f,!0);c=null;const u=Y={},p=_&&await Gt(_);if(u===Y&&p){if(p.type==="redirect")return $t(new URL(p.location,f).href,{},1,u);p.props.page!==void 0&&(V=p.props.page),v.$set(p.props)}}function _e(f){o.some(_=>_==null?void 0:_.snapshot)&&(gt[f]=o.map(_=>{var u;return(u=_==null?void 0:_.snapshot)==null?void 0:u.capture()}))}function ge(f){var _;(_=gt[f])==null||_.forEach((u,p)=>{var h,g;(g=(h=o[p])==null?void 0:h.snapshot)==null||g.restore(u)})}function me(){ee(L),Ie(yn,et),_e(L),Ie(mn,gt)}async function $t(f,{noScroll:_=!1,replaceState:u=!1,keepFocus:p=!1,state:h={},invalidateAll:g=!1},b,A){return typeof f=="string"&&(f=new URL(f,Ue(document))),Rt({url:f,scroll:_?mt():null,keepfocus:p,redirect_count:b,details:{state:h,replaceState:u},nav_token:A,accepted:()=>{g&&(x=!0)},blocked:()=>{},type:"goto"})}async function ye(f){return c={id:f.id,promise:Gt(f).then(_=>(_.type==="loaded"&&_.state.error&&(c=null),_))},c.promise}async function St(...f){const u=n.filter(p=>f.some(h=>p.exec(h))).map(p=>Promise.all([...p.layouts,p.leaf].map(h=>h==null?void 0:h[1]())));await Promise.all(u)}function we(f){var p;d=f.state;const _=document.querySelector("style[data-sveltekit]");_&&_.remove(),V=f.props.page,v=new t.root({target:e,props:{...f.props,stores:W,components:o},hydrate:!0}),ge(L);const u={from:null,to:{params:d.params,route:{id:((p=d.route)==null?void 0:p.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};l.after_navigate.forEach(h=>h(u)),$=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const S of u)(S==null?void 0:S.slash)!==void 0&&(A=S.slash);f.pathname=dr(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Nr(u).map(S=>S.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!V,j=0;for(let S=0;S(A.route=!0,k[D])}),params:new Proxy(p,{get:(k,D)=>(A.params.add(D),k[D])}),data:(g==null?void 0:g.data)??null,url:gr(u,()=>{A.url=!0}),async fetch(k,D){let F;k instanceof Request?(F=k.url,D={body:k.method==="GET"||k.method==="HEAD"?void 0:await k.blob(),cache:k.cache,credentials:k.credentials,headers:k.headers,integrity:k.integrity,keepalive:k.keepalive,method:k.method,mode:k.mode,redirect:k.redirect,referrer:k.referrer,referrerPolicy:k.referrerPolicy,signal:k.signal,...D}):F=k;const q=new URL(F,u);return U(q.href),q.origin===u.origin&&(F=q.href.slice(u.origin.length)),$?xr(F,q.href,D):vr(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,S)??null,b=b?await Cr(b,h.id):null}return{node:T,loader:f,server:g,universal:(I=T.universal)!=null&&I.load?{type:"data",data:b,uses:A}:null,data:b??(g==null?void 0:g.data)??null,slash:((j=T.universal)==null?void 0:j.trailingSlash)??(g==null?void 0:g.slash)}}function be(f,_,u,p,h){if(x)return!0;if(!p)return!1;if(p.parent&&f||p.route&&_||p.url&&u)return!0;for(const g of p.params)if(h[g]!==d.params[g])return!0;for(const g of p.dependencies)if(s.some(b=>b(new URL(g))))return!0;return!1}function Bt(f,_){return(f==null?void 0:f.type)==="data"?f:(f==null?void 0:f.type)==="skip"?_??null:null}async function Gt({id:f,invalidating:_,url:u,params:p,route:h}){if((c==null?void 0:c.id)===f)return c.promise;const{errors:g,layouts:b,leaf:A}=h,T=[...b,A];g.forEach(O=>O==null?void 0:O().catch(()=>{})),T.forEach(O=>O==null?void 0:O[1]().catch(()=>{}));let E=null;const I=d.url?f!==d.url.pathname+d.url.search:!1,j=d.route?h.id!==d.route.id:!1;let U=!1;const S=T.map((O,C)=>{var tt;const N=d.branch[C],M=!!(O!=null&&O[0])&&((N==null?void 0:N.loader)!==O[1]||be(U,j,I,(tt=N.server)==null?void 0:tt.uses,p));return M&&(U=!0),M});if(S.some(Boolean)){try{E=await ze(u,S)}catch(O){return Et({status:O instanceof yt?O.status:500,error:await pt(O,{url:u,params:p,route:{id:h.id}}),url:u,route:h})}if(E.type==="redirect")return E}const k=E==null?void 0:E.nodes;let D=!1;const F=T.map(async(O,C)=>{var Wt;if(!O)return;const N=d.branch[C],M=k==null?void 0:k[C];if((!M||M.type==="skip")&&O[1]===(N==null?void 0:N.loader)&&!be(D,j,I,(Wt=N.universal)==null?void 0:Wt.uses,p))return N;if(D=!0,(M==null?void 0:M.type)==="error")throw M;return qt({loader:O[1],url:u,params:p,route:h,parent:async()=>{var Ee;const Se={};for(let Kt=0;Kt{});const q=[];for(let O=0;OPromise.resolve({}),server_data_node:Bt(g)}),T={node:await i(),loader:i,universal:null,server:null,data:null};return await dt({url:u,params:h,branch:[A,T],status:f,error:_,route:null})}function ht(f,_){if(Ot(f,X))return;const u=At(f);for(const p of n){const h=p.exec(u);if(h)return{id:f.pathname+f.search,invalidating:_,route:p,params:pr(h),url:f}}}function At(f){return hr(f.pathname.slice(X.length)||"/")}function xe({url:f,type:_,intent:u,delta:p}){let h=!1;const g=Ve(d,u,f,_);p!==void 0&&(g.navigation.delta=p);const b={...g.navigation,cancel:()=>{h=!0,g.reject(new Error("navigation was cancelled"))}};return w||l.before_navigate.forEach(A=>A(b)),h?null:g}async function Rt({url:f,scroll:_,keepfocus:u,redirect_count:p,details:h,type:g,delta:b,nav_token:A={},accepted:T,blocked:E}){var F,q,O;const I=ht(f,!1),j=xe({url:f,type:g,delta:b,intent:I});if(!j){E();return}const U=L;T(),w=!0,$&&W.navigating.set(j.navigation),Y=A;let S=I&&await Gt(I);if(!S){if(Ot(f,X))return await nt(f);S=await ke(f,{id:null},await pt(new Error(`Not found: ${f.pathname}`),{url:f,params:{},route:{id:null}}),404)}if(f=(I==null?void 0:I.url)||f,Y!==A)return j.reject(new Error("navigation was aborted")),!1;if(S.type==="redirect")if(p>=20)S=await Et({status:500,error:await pt(new Error("Redirect loop"),{url:f,params:{},route:{id:null}}),url:f,route:{id:null}});else return $t(new URL(S.location,f).href,{},p+1,A),!1;else((F=S.props.page)==null?void 0:F.status)>=400&&await W.updated.check()&&await nt(f);if(s.length=0,x=!1,y=!0,ee(U),_e(U),(q=S.props.page)!=null&&q.url&&S.props.page.url.pathname!==f.pathname&&(f.pathname=(O=S.props.page)==null?void 0:O.url.pathname),h){const C=h.replaceState?0:1;if(h.state[B]=L+=C,history[h.replaceState?"replaceState":"pushState"](h.state,"",f),!h.replaceState){let N=L+1;for(;gt[N]||et[N];)delete gt[N],delete et[N],N+=1}}if(c=null,$){d=S.state,S.props.page&&(S.props.page.url=f);const C=(await Promise.all(l.on_navigate.map(N=>N(j.navigation)))).filter(N=>typeof N=="function");if(C.length>0){let N=function(){l.after_navigate=l.after_navigate.filter(M=>!C.includes(M))};C.push(N),l.after_navigate.push(...C)}v.$set(S.props)}else we(S);const{activeElement:k}=document;if(await Yt(),P){const C=f.hash&&document.getElementById(decodeURIComponent(f.hash.slice(1)));_?scrollTo(_.x,_.y):C?C.scrollIntoView():scrollTo(0,0)}const D=document.activeElement!==k&&document.activeElement!==document.body;!u&&!D&&ne(),P=!0,S.props.page&&(V=S.props.page),w=!1,g==="popstate"&&ge(L),j.fulfil(void 0),l.after_navigate.forEach(C=>C(j.navigation)),W.navigating.set(null),y=!1}async function ke(f,_,u,p){return f.origin===Dt&&f.pathname===location.pathname&&!m?await Et({status:p,error:u,url:f,route:_}):await nt(f)}function Rn(){let f;a.addEventListener("mousemove",g=>{const b=g.target;clearTimeout(f),f=setTimeout(()=>{p(b,2)},20)});function _(g){p(g.composedPath()[0],1)}a.addEventListener("mousedown",_),a.addEventListener("touchstart",_,{passive:!0});const u=new IntersectionObserver(g=>{for(const b of g)b.isIntersecting&&(St(At(new URL(b.target.href))),u.unobserve(b.target))},{threshold:0});function p(g,b){const A=Fe(g,a);if(!A)return;const{url:T,external:E,download:I}=te(A,X);if(E||I)return;const j=Tt(A);if(!j.reload)if(b<=j.preload_data){const U=ht(T,!1);U&&ye(U)}else b<=j.preload_code&&St(At(T))}function h(){u.disconnect();for(const g of a.querySelectorAll("a")){const{url:b,external:A,download:T}=te(g,X);if(A||T)continue;const E=Tt(g);E.reload||(E.preload_code===Ut.viewport&&u.observe(g),E.preload_code===Ut.eager&&St(At(b)))}}l.after_navigate.push(h),h()}function pt(f,_){return f instanceof yt?f.body:t.hooks.handleError({error:f,event:_})??{message:_.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:f=>{Jt(()=>(l.after_navigate.push(f),()=>{const _=l.after_navigate.indexOf(f);l.after_navigate.splice(_,1)}))},before_navigate:f=>{Jt(()=>(l.before_navigate.push(f),()=>{const _=l.before_navigate.indexOf(f);l.before_navigate.splice(_,1)}))},on_navigate:f=>{Jt(()=>(l.on_navigate.push(f),()=>{const _=l.on_navigate.indexOf(f);l.on_navigate.splice(_,1)}))},disable_scroll_handling:()=>{(y||!$)&&(P=!1)},goto:(f,_={})=>$t(f,_,0),invalidate:f=>{if(typeof f=="function")s.push(f);else{const{href:_}=new URL(f,location.href);s.push(u=>u.href===_)}return pe()},invalidate_all:()=>(x=!0,pe()),preload_data:async f=>{const _=new URL(f,Ue(document)),u=ht(_,!1);if(!u)throw new Error(`Attempted to preload a URL that does not belong to this app: ${_}`);await ye(u)},preload_code:St,apply_action:async f=>{if(f.type==="error"){const _=new URL(location.href),{branch:u,route:p}=d;if(!p)return;const h=await ve(d.branch.length,u,p.errors);if(h){const g=await dt({url:_,params:d.params,branch:u.slice(0,h.idx).concat(h.node),status:f.status??500,error:f.error,route:p});d=g.state,v.$set(g.props),Yt().then(ne)}}else f.type==="redirect"?$t(f.location,{invalidateAll:!0},0):(v.$set({form:null,page:{...V,form:f.data,status:f.status}}),await Yt(),v.$set({form:f.data}),f.type==="success"&&ne())},_start_router:()=>{var _;history.scrollRestoration="manual",addEventListener("beforeunload",u=>{let p=!1;if(me(),!w){const h=Ve(d,void 0,null,"leave"),g={...h.navigation,cancel:()=>{p=!0,h.reject(new Error("navigation was cancelled"))}};l.before_navigate.forEach(b=>b(g))}p?(u.preventDefault(),u.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&me()}),(_=navigator.connection)!=null&&_.saveData||Rn(),a.addEventListener("click",u=>{var U;if(u.button||u.which!==1||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||u.defaultPrevented)return;const p=Fe(u.composedPath()[0],a);if(!p)return;const{url:h,external:g,target:b,download:A}=te(p,X);if(!h)return;if(b==="_parent"||b==="_top"){if(window.parent!==window)return}else if(b&&b!=="_self")return;const T=Tt(p);if(!(p instanceof SVGAElement)&&h.protocol!==location.protocol&&!(h.protocol==="https:"||h.protocol==="http:")||A)return;if(g||T.reload){xe({url:h,type:"link"})?w=!0:u.preventDefault();return}const[I,j]=h.href.split("#");if(j!==void 0&&I===location.href.split("#")[0]){if(d.url.hash===h.hash){u.preventDefault(),(U=p.ownerDocument.getElementById(j))==null||U.scrollIntoView();return}if(R=!0,ee(L),f(h),!T.replace_state)return;R=!1,u.preventDefault()}Rt({url:h,scroll:T.noscroll?mt():null,keepfocus:T.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:T.replace_state??h.href===location.href},accepted:()=>u.preventDefault(),blocked:()=>u.preventDefault(),type:"link"})}),a.addEventListener("submit",u=>{if(u.defaultPrevented)return;const p=HTMLFormElement.prototype.cloneNode.call(u.target),h=u.submitter;if(((h==null?void 0:h.formMethod)||p.method)!=="get")return;const b=new URL((h==null?void 0:h.hasAttribute("formaction"))&&(h==null?void 0:h.formAction)||p.action);if(Ot(b,X))return;const A=u.target,{keep_focus:T,noscroll:E,reload:I,replace_state:j}=Tt(A);if(I)return;u.preventDefault(),u.stopPropagation();const U=new FormData(A),S=h==null?void 0:h.getAttribute("name");S&&U.append(S,(h==null?void 0:h.getAttribute("value"))??""),b.search=new URLSearchParams(U).toString(),Rt({url:b,scroll:E?mt():null,keepfocus:T??!1,redirect_count:0,details:{state:{},replaceState:j??b.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async u=>{var p;if(Y={},(p=u.state)!=null&&p[B]){if(u.state[B]===L)return;const h=et[u.state[B]],g=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){f(g),et[L]=mt(),L=u.state[B],scrollTo(h.x,h.y);return}const b=u.state[B]-L;await Rt({url:g,scroll:h,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{L=u.state[B]},blocked:()=>{history.go(-b)},type:"popstate",delta:b,nav_token:Y})}else if(!R){const h=new URL(location.href);f(h)}}),addEventListener("hashchange",()=>{R&&(R=!1,history.replaceState({...history.state,[B]:++L},"",location.href))});for(const u of document.querySelectorAll("link"))u.rel==="icon"&&(u.href=u.href);addEventListener("pageshow",u=>{u.persisted&&W.navigating.set(null)});function f(u){d.url=u,W.page.set({...V,url:u}),W.page.notify()}},_hydrate:async({status:f=200,error:_,node_ids:u,params:p,route:h,data:g,form:b})=>{m=!0;const A=new URL(location.href);({params:p={},route:h={id:null}}=ht(A,!1)||{});let T;try{const E=u.map(async(U,S)=>{const k=g[S];return k!=null&&k.uses&&(k.uses=vn(k.uses)),qt({loader:t.nodes[U],url:A,params:p,route:h,parent:async()=>{const D={};for(let F=0;FU===h.id);if(j){const U=j.layouts;for(let S=0;Sa?"1":"0").join(""));const r=await _n(n.href);if((i=r.headers.get("content-type"))!=null&&i.includes("text/html")&&await nt(t),!r.ok)throw new yt(r.status,await r.json());return new Promise(async a=>{var m;const s=new Map,o=r.body.getReader(),c=new TextDecoder;function l($){return Pn($,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:$,value:P}=await o.read();if($&&!d)break;for(d+=!P&&d?` `:c.decode(P);;){const y=d.indexOf(` `);if(y===-1)break;const w=JSON.parse(d.slice(0,y));if(d=d.slice(y+1),w.type==="redirect")return a(w);if(w.type==="data")(m=w.nodes)==null||m.forEach(R=>{(R==null?void 0:R.type)==="data"&&(R.uses=vn(R.uses),R.data=l(R.data))}),a(w);else if(w.type==="chunk"){const{id:R,data:x,error:v}=w,L=s.get(R);s.delete(R),v?L.reject(l(v)):L.fulfil(l(x))}}}})}function vn(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url)}}function ne(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const e=document.body,n=e.getAttribute("tabindex");e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),n!==null?e.setAttribute("tabindex",n):e.removeAttribute("tabindex");const r=getSelection();if(r&&r.type!=="None"){const i=[];for(let a=0;a{if(r.rangeCount===i.length){for(let a=0;a{i=d,a=m});return s.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url},to:n&&{params:(e==null?void 0:e.params)??null,route:{id:((l=e==null?void 0:e.route)==null?void 0:l.id)??null},url:n},willUnload:!e,type:r,complete:s},fulfil:i,reject:a}}async function zi(t,e,n){const r=Fr(t,e);Dr({client:r}),n?await r._hydrate(n):r.goto(location.href,{replaceState:!0}),r._start_router()}typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ur);function xn(t){const e=t-1;return e*e*e+1}function Vi(t,{delay:e=0,duration:n=400,easing:r=Xe}={}){const i=+getComputedStyle(t).opacity;return{delay:e,duration:n,easing:r,css:a=>`opacity: ${a*i}`}}function qi(t,{delay:e=0,duration:n=400,easing:r=xn,axis:i="y"}={}){const a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",c=parseFloat(a[o]),l=i==="y"?["top","bottom"]:["left","right"],d=l.map(x=>`${x[0].toUpperCase()}${x.slice(1)}`),m=parseFloat(a[`padding${d[0]}`]),$=parseFloat(a[`padding${d[1]}`]),P=parseFloat(a[`margin${d[0]}`]),y=parseFloat(a[`margin${d[1]}`]),w=parseFloat(a[`border${d[0]}Width`]),R=parseFloat(a[`border${d[1]}Width`]);return{delay:e,duration:n,easing:r,css:x=>`overflow: hidden;opacity: ${Math.min(x*20,1)*s};${o}: ${x*c}px;padding-${l[0]}: ${x*m}px;padding-${l[1]}: ${x*$}px;margin-${l[0]}: ${x*P}px;margin-${l[1]}: ${x*y}px;border-${l[0]}-width: ${x*w}px;border-${l[1]}-width: ${x*R}px;`}}function Bi(t,{delay:e=0,duration:n=400,easing:r=xn,start:i=0,opacity:a=0}={}){const s=getComputedStyle(t),o=+s.opacity,c=s.transform==="none"?"":s.transform,l=1-i,d=o*(1-a);return{delay:e,duration:n,easing:r,css:(m,$)=>` transform: ${c} scale(${1-l*$}); opacity: ${o-d*$} - `}}const kn=Object.freeze({left:0,top:0,width:16,height:16}),$n=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ft=Object.freeze({...kn,...$n});Object.freeze({...Ft,body:"",hidden:!1});({...kn});const Sn=Object.freeze({width:null,height:null}),En=Object.freeze({...Sn,...$n});function Mr(t,e){const n={...t};for(const r in e){const i=e[r],a=typeof i;r in Sn?(i===null||i&&(a==="string"||a==="number"))&&(n[r]=i):a===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const Hr=/[\s,]+/;function zr(t,e){e.split(Hr).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Vr(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:r(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let a=parseFloat(t.slice(0,t.length-n.length));return isNaN(a)?0:(a=a/i,a%1===0?r(a):0)}}return e}const qr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Br=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function qe(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(qr);if(r===null||!r.length)return t;const i=[];let a=r.shift(),s=Br.test(a);for(;;){if(s){const o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*e*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join("");s=!s}}const Gr=t=>t==="unset"||t==="undefined"||t==="none";function Wr(t,e){const n={...Ft,...t},r={...En,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let a=n.body;[n,r].forEach(y=>{const w=[],R=y.hFlip,x=y.vFlip;let v=y.rotate;R?x?v+=2:(w.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),w.push("scale(-1 1)"),i.top=i.left=0):x&&(w.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),w.push("scale(1 -1)"),i.top=i.left=0);let L;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:L=i.height/2+i.top,w.unshift("rotate(90 "+L.toString()+" "+L.toString()+")");break;case 2:w.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:L=i.width/2+i.left,w.unshift("rotate(-90 "+L.toString()+" "+L.toString()+")");break}v%2===1&&(i.left!==i.top&&(L=i.left,i.left=i.top,i.top=L),i.width!==i.height&&(L=i.width,i.width=i.height,i.height=L)),w.length&&(a=''+a+"")});const s=r.width,o=r.height,c=i.width,l=i.height;let d,m;s===null?(m=o===null?"1em":o==="auto"?l:o,d=qe(m,c/l)):(d=s==="auto"?c:s,m=o===null?qe(d,l/c):o==="auto"?l:o);const $={},P=(y,w)=>{Gr(w)||($[y]=w.toString())};return P("width",d),P("height",m),$.viewBox=i.left.toString()+" "+i.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:$,body:a}}const Kr=/\sid="(\S+)"/g,Jr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Yr=0;function Xr(t,e=Jr){const n=[];let r;for(;r=Kr.exec(t);)n.push(r[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(a=>{const s=typeof e=="function"?e(a):e+(Yr++).toString(),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}function Qr(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'"+t+""}function Zr(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function ti(t){return"data:image/svg+xml,"+Zr(t)}function ei(t){return'url("'+ti(t)+'")'}const Be={...En,inline:!1},ni={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ri={display:"inline-block"},se={"background-color":"currentColor"},An={"background-color":"transparent"},Ge={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},We={"-webkit-mask":se,mask:se,background:An};for(const t in We){const e=We[t];for(const n in Ge)e[t+"-"+n]=Ge[n]}function ii(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function ai(t,e){const n=Mr(Be,e),r=e.mode||"svg",i=r==="svg"?{...ni}:{};t.body.indexOf("xlink:")===-1&&delete i["xmlns:xlink"];let a=typeof e.style=="string"?e.style:"";for(let x in e){const v=e[x];if(v!==void 0)switch(x){case"icon":case"style":case"onLoad":case"mode":break;case"inline":case"hFlip":case"vFlip":n[x]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&zr(n,v);break;case"color":a=a+(a.length>0&&a.trim().slice(-1)!==";"?";":"")+"color: "+v+"; ";break;case"rotate":typeof v=="string"?n[x]=Vr(v):typeof v=="number"&&(n[x]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete i["aria-hidden"];break;default:if(x.slice(0,3)==="on:")break;Be[x]===void 0&&(i[x]=v)}}const s=Wr(t,n),o=s.attributes;if(n.inline&&(a="vertical-align: -0.125em; "+a),r==="svg"){Object.assign(i,o),a!==""&&(i.style=a);let x=0,v=e.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),{svg:!0,attributes:i,body:Xr(s.body,v?()=>v+"ID"+x++:"iconifySvelte")}}const{body:c,width:l,height:d}=t,m=r==="mask"||(r==="bg"?!1:c.indexOf("currentColor")!==-1),$=Qr(c,{...o,width:l+"",height:d+""}),y={"--svg":ei($)},w=x=>{const v=o[x];v&&(y[x]=ii(v))};w("width"),w("height"),Object.assign(y,ri,m?se:An);let R="";for(const x in y)R+=x+": "+y[x]+";";return i.style=R+a,{svg:!1,attributes:i}}const oi=Object.create(null);function si(t){const e=typeof t.icon=="string"?oi[t.icon]:typeof t.icon=="object"?{...Ft,...t.icon}:null;return e===null||typeof e!="object"||typeof e.body!="string"?null:ai({...Ft,...e},t)}function Ke(t){let e;function n(a,s){return a[0].svg?li:ci}let r=n(t),i=r(t);return{c(){i.c(),e=Nt()},l(a){i.l(a),e=Nt()},m(a,s){i.m(a,s),Q(a,e,s)},p(a,s){r===(r=n(a))&&i?i.p(a,s):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&H(e),i.d(a)}}}function ci(t){let e,n=[t[0].attributes],r={};for(let i=0;i{n(1,e=bt(bt({},e),Re(i)))},t.$$.update=()=>{n(0,r=si(e))},e=Re(e),[r]}class Gi extends pn{constructor(e){super(),hn(this,e,ui,fi,ce,{})}}const di=()=>{const t=W;return{page:{subscribe:t.page.subscribe},navigating:{subscribe:t.navigating.subscribe},updated:t.updated}},hi={subscribe(t){return di().page.subscribe(t)}};function pi(t){var c;let e,n=t[0].status+"",r,i,a,s=((c=t[0].error)==null?void 0:c.message)+"",o;return{c(){e=ft("h1"),r=vt(n),i=Bn(),a=ft("p"),o=vt(s)},l(l){e=ie(l,"H1",{});var d=xt(e);r=ae(d,n),d.forEach(H),i=Kn(l),a=ie(l,"P",{});var m=xt(a);o=ae(m,s),m.forEach(H)},m(l,d){Q(l,e,d),re(e,r),Q(l,i,d),Q(l,a,d),re(a,o)},p(l,[d]){var m;d&1&&n!==(n=l[0].status+"")&&Oe(r,n),d&1&&s!==(s=((m=l[0].error)==null?void 0:m.message)+"")&&Oe(o,s)},i:z,o:z,d(l){l&&(H(e),H(i),H(a))}}}function _i(t,e,n){let r;return jn(t,hi,i=>n(0,r=i)),[r]}let Wi=class extends pn{constructor(e){super(),hn(this,e,_i,pi,ce,{})}};export{rt as $,Ti as A,vt as B,ae as C,Oe as D,Wi as E,ir as F,Yt as G,je as H,Oi as I,Fi as J,Mi as K,cr as L,lr as M,Li as N,Gi as O,jn as P,bt as Q,Re as R,pn as S,Hi as T,Mt as U,It as V,Ii as W,Vi as X,Bi as Y,ki as Z,Ri as _,ie as a,Di as a0,qi as a1,$i as a2,Tr as a3,Ci as a4,ji as a5,Ai as a6,Ui as a7,Pi as a8,zi as a9,xt as b,wi as c,H as d,ft as e,rn as f,Q as g,re as h,hn as i,xi as j,bi as k,or as l,yi as m,Bn as n,Ei as o,Kn as p,Si as q,z as r,ce as s,un as t,vi as u,Jt as v,Vt as w,Nt as x,ar as y,Ni as z}; + `}}const kn=Object.freeze({left:0,top:0,width:16,height:16}),$n=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ft=Object.freeze({...kn,...$n});Object.freeze({...Ft,body:"",hidden:!1});({...kn});const Sn=Object.freeze({width:null,height:null}),En=Object.freeze({...Sn,...$n});function Mr(t,e){const n={...t};for(const r in e){const i=e[r],a=typeof i;r in Sn?(i===null||i&&(a==="string"||a==="number"))&&(n[r]=i):a===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const Hr=/[\s,]+/;function zr(t,e){e.split(Hr).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Vr(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:r(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let a=parseFloat(t.slice(0,t.length-n.length));return isNaN(a)?0:(a=a/i,a%1===0?r(a):0)}}return e}const qr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Br=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function qe(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(qr);if(r===null||!r.length)return t;const i=[];let a=r.shift(),s=Br.test(a);for(;;){if(s){const o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*e*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join("");s=!s}}const Gr=t=>t==="unset"||t==="undefined"||t==="none";function Wr(t,e){const n={...Ft,...t},r={...En,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let a=n.body;[n,r].forEach(y=>{const w=[],R=y.hFlip,x=y.vFlip;let v=y.rotate;R?x?v+=2:(w.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),w.push("scale(-1 1)"),i.top=i.left=0):x&&(w.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),w.push("scale(1 -1)"),i.top=i.left=0);let L;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:L=i.height/2+i.top,w.unshift("rotate(90 "+L.toString()+" "+L.toString()+")");break;case 2:w.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:L=i.width/2+i.left,w.unshift("rotate(-90 "+L.toString()+" "+L.toString()+")");break}v%2===1&&(i.left!==i.top&&(L=i.left,i.left=i.top,i.top=L),i.width!==i.height&&(L=i.width,i.width=i.height,i.height=L)),w.length&&(a=''+a+"")});const s=r.width,o=r.height,c=i.width,l=i.height;let d,m;s===null?(m=o===null?"1em":o==="auto"?l:o,d=qe(m,c/l)):(d=s==="auto"?c:s,m=o===null?qe(d,l/c):o==="auto"?l:o);const $={},P=(y,w)=>{Gr(w)||($[y]=w.toString())};return P("width",d),P("height",m),$.viewBox=i.left.toString()+" "+i.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:$,body:a}}const Kr=/\sid="(\S+)"/g,Jr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Yr=0;function Xr(t,e=Jr){const n=[];let r;for(;r=Kr.exec(t);)n.push(r[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(a=>{const s=typeof e=="function"?e(a):e+(Yr++).toString(),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}function Qr(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'"+t+""}function Zr(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function ti(t){return"data:image/svg+xml,"+Zr(t)}function ei(t){return'url("'+ti(t)+'")'}const Be={...En,inline:!1},ni={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ri={display:"inline-block"},se={"background-color":"currentColor"},An={"background-color":"transparent"},Ge={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},We={"-webkit-mask":se,mask:se,background:An};for(const t in We){const e=We[t];for(const n in Ge)e[t+"-"+n]=Ge[n]}function ii(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function ai(t,e){const n=Mr(Be,e),r=e.mode||"svg",i=r==="svg"?{...ni}:{};t.body.indexOf("xlink:")===-1&&delete i["xmlns:xlink"];let a=typeof e.style=="string"?e.style:"";for(let x in e){const v=e[x];if(v!==void 0)switch(x){case"icon":case"style":case"onLoad":case"mode":break;case"inline":case"hFlip":case"vFlip":n[x]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&zr(n,v);break;case"color":a=a+(a.length>0&&a.trim().slice(-1)!==";"?";":"")+"color: "+v+"; ";break;case"rotate":typeof v=="string"?n[x]=Vr(v):typeof v=="number"&&(n[x]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete i["aria-hidden"];break;default:if(x.slice(0,3)==="on:")break;Be[x]===void 0&&(i[x]=v)}}const s=Wr(t,n),o=s.attributes;if(n.inline&&(a="vertical-align: -0.125em; "+a),r==="svg"){Object.assign(i,o),a!==""&&(i.style=a);let x=0,v=e.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),{svg:!0,attributes:i,body:Xr(s.body,v?()=>v+"ID"+x++:"iconifySvelte")}}const{body:c,width:l,height:d}=t,m=r==="mask"||(r==="bg"?!1:c.indexOf("currentColor")!==-1),$=Qr(c,{...o,width:l+"",height:d+""}),y={"--svg":ei($)},w=x=>{const v=o[x];v&&(y[x]=ii(v))};w("width"),w("height"),Object.assign(y,ri,m?se:An);let R="";for(const x in y)R+=x+": "+y[x]+";";return i.style=R+a,{svg:!1,attributes:i}}const oi=Object.create(null);function si(t){const e=typeof t.icon=="string"?oi[t.icon]:typeof t.icon=="object"?{...Ft,...t.icon}:null;return e===null||typeof e!="object"||typeof e.body!="string"?null:ai({...Ft,...e},t)}function Ke(t){let e;function n(a,s){return a[0].svg?li:ci}let r=n(t),i=r(t);return{c(){i.c(),e=Nt()},l(a){i.l(a),e=Nt()},m(a,s){i.m(a,s),Q(a,e,s)},p(a,s){r===(r=n(a))&&i?i.p(a,s):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&H(e),i.d(a)}}}function ci(t){let e,n=[t[0].attributes],r={};for(let i=0;i{n(1,e=bt(bt({},e),Re(i)))},t.$$.update=()=>{n(0,r=si(e))},e=Re(e),[r]}class Gi extends pn{constructor(e){super(),hn(this,e,ui,fi,ce,{})}}const di=()=>{const t=W;return{page:{subscribe:t.page.subscribe},navigating:{subscribe:t.navigating.subscribe},updated:t.updated}},hi={subscribe(t){return di().page.subscribe(t)}};function pi(t){var c;let e,n=t[0].status+"",r,i,a,s=((c=t[0].error)==null?void 0:c.message)+"",o;return{c(){e=ft("h1"),r=vt(n),i=Bn(),a=ft("p"),o=vt(s)},l(l){e=ie(l,"H1",{});var d=xt(e);r=ae(d,n),d.forEach(H),i=Kn(l),a=ie(l,"P",{});var m=xt(a);o=ae(m,s),m.forEach(H)},m(l,d){Q(l,e,d),re(e,r),Q(l,i,d),Q(l,a,d),re(a,o)},p(l,[d]){var m;d&1&&n!==(n=l[0].status+"")&&Oe(r,n),d&1&&s!==(s=((m=l[0].error)==null?void 0:m.message)+"")&&Oe(o,s)},i:z,o:z,d(l){l&&(H(e),H(i),H(a))}}}function _i(t,e,n){let r;return jn(t,hi,i=>n(0,r=i)),[r]}let Wi=class extends pn{constructor(e){super(),hn(this,e,_i,pi,ce,{})}};export{rt as $,Ti as A,vt as B,ae as C,Oe as D,Wi as E,ir as F,Yt as G,je as H,Oi as I,Fi as J,Mi as K,cr as L,lr as M,Li as N,Gi as O,jn as P,bt as Q,Re as R,pn as S,Hi as T,Mt as U,It as V,Ii as W,Vi as X,Bi as Y,ki as Z,Ri as _,ie as a,Di as a0,qi as a1,$i as a2,Ci as a3,ji as a4,Ai as a5,Ui as a6,Pi as a7,zi as a8,xt as b,wi as c,H as d,ft as e,rn as f,Q as g,re as h,hn as i,xi as j,bi as k,or as l,yi as m,Bn as n,Ei as o,Kn as p,Si as q,z as r,ce as s,un as t,vi as u,Jt as v,Vt as w,Nt as x,ar as y,Ni as z}; diff --git a/_app/immutable/entry/app.275f0795.js b/_app/immutable/entry/app.c6eb7987.js similarity index 88% rename from _app/immutable/entry/app.275f0795.js rename to _app/immutable/entry/app.c6eb7987.js index 5e5f260c..7517e3c7 100644 --- a/_app/immutable/entry/app.275f0795.js +++ b/_app/immutable/entry/app.c6eb7987.js @@ -1 +1 @@ -import{_ as y}from"../chunks/preload-helper.a4192956.js";import{S as q,i as z,s as B,n as F,x as u,p as G,g as w,l as m,y as N,t as p,d,z as H,v as J,e as K,a as U,b as j,f as P,A as E,B as Q,C as W,D as X,F as D,G as Y,H as A,I as g,J as b,K as L,L as k,M as v}from"../chunks/vendor_svelte.f9b78e98.js";const ae={};function Z(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,c(o)),o[15](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[15](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[15](null),e&&v(e,t)}}}function x(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],$$slots:{default:[ie]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[14](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[14](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&65591&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[14](null),e&&v(e,t)}}}function ee(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,c(o)),o[13](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[13](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[13](null),e&&v(e,t)}}}function te(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],$$slots:{default:[ne]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[12](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[12](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&65575&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[12](null),e&&v(e,t)}}}function ne(o){let e,n,r;var i=o[1][2];function c(t,f){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,c(o)),o[11](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][2])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[11](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&32&&(s.data=t[5]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[11](null),e&&v(e,t)}}}function ie(o){let e,n,r,i;const c=[te,ee],t=[];function f(s,_){return s[1][2]?0:1}return e=f(o),n=t[e]=c[e](o),{c(){n.c(),r=u()},l(s){n.l(s),r=u()},m(s,_){t[e].m(s,_),w(s,r,_),i=!0},p(s,_){let l=e;e=f(s),e===l?t[e].p(s,_):(D(),m(t[l],1,1,()=>{t[l]=null}),N(),n=t[e],n?n.p(s,_):(n=t[e]=c[e](s),n.c()),p(n,1),n.m(r.parentNode,r))},i(s){i||(p(n),i=!0)},o(s){m(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function V(o){let e,n=o[7]&&O(o);return{c(){e=K("div"),n&&n.c(),this.h()},l(r){e=U(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=j(e);n&&n.l(i),i.forEach(d),this.h()},h(){P(e,"id","svelte-announcer"),P(e,"aria-live","assertive"),P(e,"aria-atomic","true"),E(e,"position","absolute"),E(e,"left","0"),E(e,"top","0"),E(e,"clip","rect(0 0 0 0)"),E(e,"clip-path","inset(50%)"),E(e,"overflow","hidden"),E(e,"white-space","nowrap"),E(e,"width","1px"),E(e,"height","1px")},m(r,i){w(r,e,i),n&&n.m(e,null)},p(r,i){r[7]?n?n.p(r,i):(n=O(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=Q(o[8])},l(n){e=W(n,o[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&X(e,n[8])},d(n){n&&d(e)}}}function se(o){let e,n,r,i,c;const t=[x,Z],f=[];function s(l,h){return l[1][1]?0:1}e=s(o),n=f[e]=t[e](o);let _=o[6]&&V(o);return{c(){n.c(),r=F(),_&&_.c(),i=u()},l(l){n.l(l),r=G(l),_&&_.l(l),i=u()},m(l,h){f[e].m(l,h),w(l,r,h),_&&_.m(l,h),w(l,i,h),c=!0},p(l,[h]){let I=e;e=s(l),e===I?f[e].p(l,h):(D(),m(f[I],1,1,()=>{f[I]=null}),N(),n=f[e],n?n.p(l,h):(n=f[e]=t[e](l),n.c()),p(n,1),n.m(r.parentNode,r)),l[6]?_?_.p(l,h):(_=V(l),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null)},i(l){c||(p(n),c=!0)},o(l){m(n),c=!1},d(l){l&&(d(r),d(i)),f[e].d(l),_&&_.d(l)}}}function re(o,e,n){let{stores:r}=e,{page:i}=e,{constructors:c}=e,{components:t=[]}=e,{form:f}=e,{data_0:s=null}=e,{data_1:_=null}=e,{data_2:l=null}=e;H(r.page.notify);let h=!1,I=!1,R=null;J(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,R=document.title||"untitled page")}))});return n(6,h=!0),a});function T(a){A[a?"unshift":"push"](()=>{t[2]=a,n(0,t)})}function $(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function C(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function M(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}return o.$$set=a=>{"stores"in a&&n(9,r=a.stores),"page"in a&&n(10,i=a.page),"constructors"in a&&n(1,c=a.constructors),"components"in a&&n(0,t=a.components),"form"in a&&n(2,f=a.form),"data_0"in a&&n(3,s=a.data_0),"data_1"in a&&n(4,_=a.data_1),"data_2"in a&&n(5,l=a.data_2)},o.$$.update=()=>{o.$$.dirty&1536&&r.page.set(i)},[t,c,f,s,_,l,h,I,R,r,i,T,$,C,M,S]}class le extends q{constructor(e){super(),z(this,e,re,se,B,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const _e=[()=>y(()=>import("../nodes/0.ce1eb4a5.js"),["../nodes/0.ce1eb4a5.js","../chunks/vendor_svelte.f9b78e98.js","../chunks/vendor.e9b0235c.js","../chunks/modal.57c20595.js","../assets/0.85919f6f.css","../assets/tailwind.d198e4fe.css"],import.meta.url),()=>y(()=>import("../nodes/1.9011f560.js"),["../nodes/1.9011f560.js","../chunks/vendor_svelte.f9b78e98.js","../chunks/vendor.e9b0235c.js"],import.meta.url),()=>y(()=>import("../nodes/2.0ecfafe8.js"),["../nodes/2.0ecfafe8.js","../chunks/vendor_svelte.f9b78e98.js","../chunks/vendor.e9b0235c.js","../assets/tailwind.d198e4fe.css"],import.meta.url),()=>y(()=>import("../nodes/3.44a288a2.js"),["../nodes/3.44a288a2.js","../chunks/3.06dc71f7.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.f9b78e98.js","../chunks/vendor.e9b0235c.js","../chunks/modal.57c20595.js","../assets/3.7770fb24.css"],import.meta.url),()=>y(()=>import("../nodes/4.b658c201.js"),["../nodes/4.b658c201.js","../chunks/vendor_svelte.f9b78e98.js","../chunks/vendor.e9b0235c.js"],import.meta.url)],ce=[],ue={"/(site)":[3,[2]],"/(site)/synth":[4,[2]]},me={handleError:({error:o})=>{console.error(o)}};export{ue as dictionary,me as hooks,ae as matchers,_e as nodes,le as root,ce as server_loads}; +import{_ as y}from"../chunks/preload-helper.a4192956.js";import{S as q,i as z,s as B,n as F,x as u,p as G,g as w,l as m,y as N,t as p,d,z as H,v as J,e as K,a as U,b as j,f as P,A as E,B as Q,C as W,D as X,F as D,G as Y,H as A,I as g,J as b,K as L,L as k,M as v}from"../chunks/vendor_svelte.d337c9a7.js";const ae={};function Z(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,c(o)),o[15](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[15](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[15](null),e&&v(e,t)}}}function x(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],$$slots:{default:[ie]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[14](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[14](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&65591&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[14](null),e&&v(e,t)}}}function ee(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,c(o)),o[13](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[13](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[13](null),e&&v(e,t)}}}function te(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],$$slots:{default:[ne]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[12](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[12](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&65575&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[12](null),e&&v(e,t)}}}function ne(o){let e,n,r;var i=o[1][2];function c(t,f){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,c(o)),o[11](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&L(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][2])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[11](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&32&&(s.data=t[5]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[11](null),e&&v(e,t)}}}function ie(o){let e,n,r,i;const c=[te,ee],t=[];function f(s,_){return s[1][2]?0:1}return e=f(o),n=t[e]=c[e](o),{c(){n.c(),r=u()},l(s){n.l(s),r=u()},m(s,_){t[e].m(s,_),w(s,r,_),i=!0},p(s,_){let l=e;e=f(s),e===l?t[e].p(s,_):(D(),m(t[l],1,1,()=>{t[l]=null}),N(),n=t[e],n?n.p(s,_):(n=t[e]=c[e](s),n.c()),p(n,1),n.m(r.parentNode,r))},i(s){i||(p(n),i=!0)},o(s){m(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function V(o){let e,n=o[7]&&O(o);return{c(){e=K("div"),n&&n.c(),this.h()},l(r){e=U(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=j(e);n&&n.l(i),i.forEach(d),this.h()},h(){P(e,"id","svelte-announcer"),P(e,"aria-live","assertive"),P(e,"aria-atomic","true"),E(e,"position","absolute"),E(e,"left","0"),E(e,"top","0"),E(e,"clip","rect(0 0 0 0)"),E(e,"clip-path","inset(50%)"),E(e,"overflow","hidden"),E(e,"white-space","nowrap"),E(e,"width","1px"),E(e,"height","1px")},m(r,i){w(r,e,i),n&&n.m(e,null)},p(r,i){r[7]?n?n.p(r,i):(n=O(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=Q(o[8])},l(n){e=W(n,o[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&X(e,n[8])},d(n){n&&d(e)}}}function se(o){let e,n,r,i,c;const t=[x,Z],f=[];function s(l,h){return l[1][1]?0:1}e=s(o),n=f[e]=t[e](o);let _=o[6]&&V(o);return{c(){n.c(),r=F(),_&&_.c(),i=u()},l(l){n.l(l),r=G(l),_&&_.l(l),i=u()},m(l,h){f[e].m(l,h),w(l,r,h),_&&_.m(l,h),w(l,i,h),c=!0},p(l,[h]){let I=e;e=s(l),e===I?f[e].p(l,h):(D(),m(f[I],1,1,()=>{f[I]=null}),N(),n=f[e],n?n.p(l,h):(n=f[e]=t[e](l),n.c()),p(n,1),n.m(r.parentNode,r)),l[6]?_?_.p(l,h):(_=V(l),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null)},i(l){c||(p(n),c=!0)},o(l){m(n),c=!1},d(l){l&&(d(r),d(i)),f[e].d(l),_&&_.d(l)}}}function re(o,e,n){let{stores:r}=e,{page:i}=e,{constructors:c}=e,{components:t=[]}=e,{form:f}=e,{data_0:s=null}=e,{data_1:_=null}=e,{data_2:l=null}=e;H(r.page.notify);let h=!1,I=!1,R=null;J(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,R=document.title||"untitled page")}))});return n(6,h=!0),a});function T(a){A[a?"unshift":"push"](()=>{t[2]=a,n(0,t)})}function $(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function C(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function M(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}return o.$$set=a=>{"stores"in a&&n(9,r=a.stores),"page"in a&&n(10,i=a.page),"constructors"in a&&n(1,c=a.constructors),"components"in a&&n(0,t=a.components),"form"in a&&n(2,f=a.form),"data_0"in a&&n(3,s=a.data_0),"data_1"in a&&n(4,_=a.data_1),"data_2"in a&&n(5,l=a.data_2)},o.$$.update=()=>{o.$$.dirty&1536&&r.page.set(i)},[t,c,f,s,_,l,h,I,R,r,i,T,$,C,M,S]}class le extends q{constructor(e){super(),z(this,e,re,se,B,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const _e=[()=>y(()=>import("../nodes/0.128aef10.js"),["../nodes/0.128aef10.js","../chunks/vendor_svelte.d337c9a7.js","../chunks/vendor.e9b0235c.js","../chunks/modal.94ff3968.js","../assets/0.85919f6f.css","../assets/tailwind.d198e4fe.css"],import.meta.url),()=>y(()=>import("../nodes/1.ae52f19f.js"),["../nodes/1.ae52f19f.js","../chunks/vendor_svelte.d337c9a7.js","../chunks/vendor.e9b0235c.js"],import.meta.url),()=>y(()=>import("../nodes/2.a24819b8.js"),["../nodes/2.a24819b8.js","../chunks/vendor_svelte.d337c9a7.js","../chunks/vendor.e9b0235c.js","../assets/tailwind.d198e4fe.css"],import.meta.url),()=>y(()=>import("../nodes/3.38cac6ce.js"),["../nodes/3.38cac6ce.js","../chunks/3.25ec78aa.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.d337c9a7.js","../chunks/vendor.e9b0235c.js","../chunks/modal.94ff3968.js","../assets/3.7770fb24.css"],import.meta.url),()=>y(()=>import("../nodes/4.fea51f44.js"),["../nodes/4.fea51f44.js","../chunks/vendor_svelte.d337c9a7.js","../chunks/vendor.e9b0235c.js"],import.meta.url)],ce=[],ue={"/(site)":[3,[2]],"/(site)/synth":[4,[2]]},me={handleError:({error:o})=>{console.error(o)}};export{ue as dictionary,me as hooks,ae as matchers,_e as nodes,le as root,ce as server_loads}; diff --git a/_app/immutable/entry/start.876838d3.js b/_app/immutable/entry/start.876838d3.js new file mode 100644 index 00000000..b8ad50fd --- /dev/null +++ b/_app/immutable/entry/start.876838d3.js @@ -0,0 +1 @@ +import{a8 as t}from"../chunks/vendor_svelte.d337c9a7.js";export{t as start}; diff --git a/_app/immutable/entry/start.da3e2a6a.js b/_app/immutable/entry/start.da3e2a6a.js deleted file mode 100644 index 43d4a386..00000000 --- a/_app/immutable/entry/start.da3e2a6a.js +++ /dev/null @@ -1 +0,0 @@ -import{a9 as t}from"../chunks/vendor_svelte.f9b78e98.js";export{t as start}; diff --git a/_app/immutable/nodes/0.ce1eb4a5.js b/_app/immutable/nodes/0.128aef10.js similarity index 99% rename from _app/immutable/nodes/0.ce1eb4a5.js rename to _app/immutable/nodes/0.128aef10.js index bf371cb2..9b890474 100644 --- a/_app/immutable/nodes/0.ce1eb4a5.js +++ b/_app/immutable/nodes/0.128aef10.js @@ -1,4 +1,4 @@ -import{S as O,i as S,s as C,O as N,e as v,B as R,J as x,n as A,a as g,b as w,C as J,K as H,d as u,p as z,o as X,f as y,g as E,h as m,L as q,q as U,U as Q,t as _,l as I,M as D,x as P,F as V,y as K,P as B,I as Y,V as L,W as T,X as W,Y as F,c as Z,u as ee,j as te,k as se}from"../chunks/vendor_svelte.f9b78e98.js";import{b as ae}from"../chunks/vendor.e9b0235c.js";import{o as ie,m as oe,a as ne}from"../chunks/modal.57c20595.js";/* empty css */const le=!0,ke=Object.freeze(Object.defineProperty({__proto__:null,prerender:le},Symbol.toStringTag,{value:"Module"}));function re(l){let s,i,e,o,t,a,n,c,b=`

Greetings! 👋

This is a tiny app that I made to help myself and hopefully others to learn music notation. I +import{S as O,i as S,s as C,O as N,e as v,B as R,J as x,n as A,a as g,b as w,C as J,K as H,d as u,p as z,o as X,f as y,g as E,h as m,L as q,q as U,U as Q,t as _,l as I,M as D,x as P,F as V,y as K,P as B,I as Y,V as L,W as T,X as W,Y as F,c as Z,u as ee,j as te,k as se}from"../chunks/vendor_svelte.d337c9a7.js";import{b as ae}from"../chunks/vendor.e9b0235c.js";import{o as ie,m as oe,a as ne}from"../chunks/modal.94ff3968.js";/* empty css */const le=!0,ke=Object.freeze(Object.defineProperty({__proto__:null,prerender:le},Symbol.toStringTag,{value:"Module"}));function re(l){let s,i,e,o,t,a,n,c,b=`

Greetings! 👋

This is a tiny app that I made to help myself and hopefully others to learn music notation. I strongly think that you have to really drill them down until reading music becomes as easy as reading a language.

To get the full benefits of this app, I advise you to connect your MIDI keyboard to your computer. For most modern keyboards, you can do this directly with USB but with older models diff --git a/_app/immutable/nodes/1.9011f560.js b/_app/immutable/nodes/1.9011f560.js deleted file mode 100644 index 29fe01ca..00000000 --- a/_app/immutable/nodes/1.9011f560.js +++ /dev/null @@ -1 +0,0 @@ -import{E as m}from"../chunks/vendor_svelte.f9b78e98.js";export{m as component}; diff --git a/_app/immutable/nodes/1.ae52f19f.js b/_app/immutable/nodes/1.ae52f19f.js new file mode 100644 index 00000000..66f8444b --- /dev/null +++ b/_app/immutable/nodes/1.ae52f19f.js @@ -0,0 +1 @@ +import{E as m}from"../chunks/vendor_svelte.d337c9a7.js";export{m as component}; diff --git a/_app/immutable/nodes/2.0ecfafe8.js b/_app/immutable/nodes/2.a24819b8.js similarity index 93% rename from _app/immutable/nodes/2.0ecfafe8.js rename to _app/immutable/nodes/2.a24819b8.js index 2541f7ed..8a92905d 100644 --- a/_app/immutable/nodes/2.0ecfafe8.js +++ b/_app/immutable/nodes/2.a24819b8.js @@ -1 +1 @@ -import{S as d,i as h,s as p,c as $,e as u,a as f,b as _,d as r,f as m,g as v,h as y,u as g,j,k as b,t as x,l as E}from"../chunks/vendor_svelte.f9b78e98.js";/* empty css */function I(i){let s,a,n;const o=i[1].default,e=$(o,i,i[0],null);return{c(){s=u("div"),a=u("main"),e&&e.c(),this.h()},l(t){s=f(t,"DIV",{class:!0});var l=_(s);a=f(l,"MAIN",{class:!0});var c=_(a);e&&e.l(c),c.forEach(r),l.forEach(r),this.h()},h(){m(a,"class","flex-col items-center justify-center h-full min-h-screen max-w-[764px] mx-[auto]"),m(s,"class","flex-col items-center justify-center")},m(t,l){v(t,s,l),y(s,a),e&&e.m(a,null),n=!0},p(t,[l]){e&&e.p&&(!n||l&1)&&g(e,o,t,t[0],n?b(o,t[0],l,null):j(t[0]),null)},i(t){n||(x(e,t),n=!0)},o(t){E(e,t),n=!1},d(t){t&&r(s),e&&e.d(t)}}}function S(i,s,a){let{$$slots:n={},$$scope:o}=s;return i.$$set=e=>{"$$scope"in e&&a(0,o=e.$$scope)},[o,n]}class w extends d{constructor(s){super(),h(this,s,S,I,p,{})}}export{w as component}; +import{S as d,i as h,s as p,c as $,e as u,a as f,b as _,d as r,f as m,g as v,h as y,u as g,j,k as b,t as x,l as E}from"../chunks/vendor_svelte.d337c9a7.js";/* empty css */function I(i){let s,a,n;const o=i[1].default,e=$(o,i,i[0],null);return{c(){s=u("div"),a=u("main"),e&&e.c(),this.h()},l(t){s=f(t,"DIV",{class:!0});var l=_(s);a=f(l,"MAIN",{class:!0});var c=_(a);e&&e.l(c),c.forEach(r),l.forEach(r),this.h()},h(){m(a,"class","flex-col items-center justify-center h-full min-h-screen max-w-[764px] mx-[auto]"),m(s,"class","flex-col items-center justify-center")},m(t,l){v(t,s,l),y(s,a),e&&e.m(a,null),n=!0},p(t,[l]){e&&e.p&&(!n||l&1)&&g(e,o,t,t[0],n?b(o,t[0],l,null):j(t[0]),null)},i(t){n||(x(e,t),n=!0)},o(t){E(e,t),n=!1},d(t){t&&r(s),e&&e.d(t)}}}function S(i,s,a){let{$$slots:n={},$$scope:o}=s;return i.$$set=e=>{"$$scope"in e&&a(0,o=e.$$scope)},[o,n]}class w extends d{constructor(s){super(),h(this,s,S,I,p,{})}}export{w as component}; diff --git a/_app/immutable/nodes/3.38cac6ce.js b/_app/immutable/nodes/3.38cac6ce.js new file mode 100644 index 00000000..0ff82a4b --- /dev/null +++ b/_app/immutable/nodes/3.38cac6ce.js @@ -0,0 +1 @@ +import{P as m}from"../chunks/3.25ec78aa.js";export{m as component}; diff --git a/_app/immutable/nodes/3.44a288a2.js b/_app/immutable/nodes/3.44a288a2.js deleted file mode 100644 index b401d8d7..00000000 --- a/_app/immutable/nodes/3.44a288a2.js +++ /dev/null @@ -1 +0,0 @@ -import{P as m}from"../chunks/3.06dc71f7.js";export{m as component}; diff --git a/_app/immutable/nodes/4.b658c201.js b/_app/immutable/nodes/4.fea51f44.js similarity index 93% rename from _app/immutable/nodes/4.b658c201.js rename to _app/immutable/nodes/4.fea51f44.js index eace70c2..96ccb178 100644 --- a/_app/immutable/nodes/4.b658c201.js +++ b/_app/immutable/nodes/4.fea51f44.js @@ -1 +1 @@ -import{S as v,i as y,s as C,e as u,n as b,a as m,o as _,p as g,b as k,d as c,f as p,g as d,h as S,q as P,r as x,v as T}from"../chunks/vendor_svelte.f9b78e98.js";function q(i){let t,l="Synth",o,n,s,h="Play",r,f;return{c(){t=u("h1"),t.textContent=l,o=b(),n=u("section"),s=u("button"),s.textContent=h,this.h()},l(e){t=m(e,"H1",{class:!0,"data-svelte-h":!0}),_(t)!=="svelte-5kacpm"&&(t.textContent=l),o=g(e),n=m(e,"SECTION",{class:!0});var a=k(n);s=m(a,"BUTTON",{class:!0,"data-svelte-h":!0}),_(s)!=="svelte-12ba69d"&&(s.textContent=h),a.forEach(c),this.h()},h(){p(t,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),p(s,"class","btn primary"),p(n,"class","px-4 md:px-0")},m(e,a){d(e,t,a),d(e,o,a),d(e,n,a),S(n,s),r||(f=P(s,"click",i[0]),r=!0)},p:x,i:x,o:x,d(e){e&&(c(t),c(o),c(n)),r=!1,f()}}}function E(i){let t;T(()=>{t=new AudioContext});function l(){t.resume().then(()=>{console.log("Playback resumed successfully")})}return[l]}class O extends v{constructor(t){super(),y(this,t,E,q,C,{})}}export{O as component}; +import{S as v,i as y,s as C,e as u,n as b,a as m,o as _,p as g,b as k,d as c,f as p,g as d,h as S,q as P,r as x,v as T}from"../chunks/vendor_svelte.d337c9a7.js";function q(i){let t,l="Synth",o,n,s,h="Play",r,f;return{c(){t=u("h1"),t.textContent=l,o=b(),n=u("section"),s=u("button"),s.textContent=h,this.h()},l(e){t=m(e,"H1",{class:!0,"data-svelte-h":!0}),_(t)!=="svelte-5kacpm"&&(t.textContent=l),o=g(e),n=m(e,"SECTION",{class:!0});var a=k(n);s=m(a,"BUTTON",{class:!0,"data-svelte-h":!0}),_(s)!=="svelte-12ba69d"&&(s.textContent=h),a.forEach(c),this.h()},h(){p(t,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),p(s,"class","btn primary"),p(n,"class","px-4 md:px-0")},m(e,a){d(e,t,a),d(e,o,a),d(e,n,a),S(n,s),r||(f=P(s,"click",i[0]),r=!0)},p:x,i:x,o:x,d(e){e&&(c(t),c(o),c(n)),r=!1,f()}}}function E(i){let t;T(()=>{t=new AudioContext});function l(){t.resume().then(()=>{console.log("Playback resumed successfully")})}return[l]}class O extends v{constructor(t){super(),y(this,t,E,q,C,{})}}export{O as component}; diff --git a/_app/version.json b/_app/version.json index fadcb028..bff3f1ae 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1711534142692"} \ No newline at end of file +{"version":"1711549546803"} \ No newline at end of file diff --git a/index.html b/index.html index 50358a34..5bb1864e 100644 --- a/index.html +++ b/index.html @@ -22,10 +22,10 @@ - - + + - + @@ -33,7 +33,7 @@