diff --git a/_app/immutable/chunks/3.497149d2.js b/_app/immutable/chunks/3.497149d2.js deleted file mode 100644 index 48f09fb7..00000000 --- a/_app/immutable/chunks/3.497149d2.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as ie}from"./preload-helper.a4192956.js";import{R as ye,Q as Nt,T as Be,U as hn,S as He,i as ze,s as qe,O as rt,V as se,e as p,m as j,H as _e,a as v,b as S,n as Z,d as _,o as P,I as pe,f as h,L as q,W as Ie,g as K,h as u,J as ve,p as $,t as F,C as st,w as lt,l as W,K as ge,X as je,Y as it,M as oe,N as Ee,P as we,z as J,A as Y,B as ae,v as Pe,q as fe,c as Hl,u as zl,j as ql,k as Wl,Z as Ns,_ as $t,F as mn,$ as Ls,a0 as Ds,a1 as ps,r as Jl,a2 as Qe,a3 as _n,a4 as Wt,a5 as pn,a6 as vn,G as gn}from"./vendor_svelte.4e97ec88.js";import{w as Ht,b as bn,c as yn,e as js,f as Ps,g as Yl,h as Jt,i as Yt,a as Vs,j as cs}from"./vendor.1acf520b.js";const Os={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function Fe(l,e=0,t=0){return{interval:`${l}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:l,semitones:Ql(l,e,t),flats:e,sharps:t}}function Ql(l,e,t){return(l<8?Os[l]:Os[l%7])-e+t+Math.floor(l/8)*12}function Xl(l){let e,t=0,s=0;l<0?(t=1+Math.floor(-l/100),e=-l%100):l>100?(s=Math.floor(l/100),e=l%100):e=l;const n=Ql(e,t,s);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(s)}`,interval_seq:e,semitones:n,flats:t,sharps:s}}const kn=[[["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 rs=[];function Zl(){return kn.map(l=>{const e=l[3].map(Xl);return{suffixes:l[0],name:l[1][0],type:l[2],intervals:e}})}function Dt(l){rs.length===0&&(rs=Zl());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return rs.find(t=>t.suffixes.find(s=>s===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function En(l,e,t){let s=e<0?l.flats-e:l.flats,n=e>0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function us(l,e,t){const s=[];for(let n=0;nm.semitones===a%12),o=r.flats>0,c=r.sharps>0,f=(o?a+1:c?a-1:a)%12,d=o?-1:c?1:0;s.push(En(i??e.notesMap.get(f),i?0:d,a))}return s}const Bs=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],wn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],Gs=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 Cn(l){let e=0,t=0;for(let s=0;sa.note.slice(0,2)===Bs[s]),r=l.find(a=>a.note.slice(0,2)===wn[s]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:Gs.get(e*-1)}:{flats:0,sharps:t,majorSignature:Gs.get(t)}}function An(l){return l>=9?`${l>=10?"X":""}${l===9?"IX":"I".repeat(l%10)}`:`${l>=5?"V":""}${l===4?"IV":"I".repeat(l%5)}`}function en(l){return l.map(e=>{const t=[Fe(1)];let s;return e.major?(t.push(Fe(3)),e.suffix.startsWith("+")?t.push(Fe(5,0,1)):e.suffix.startsWith("6")?t.push(Fe(6)):e.suffix.startsWith("7")?t.push(Fe(7,1)):e.suffix.startsWith("maj7")?t.push(Fe(7)):s=Dt("maj")):e.minor?(t.push(Fe(3,1)),e.suffix.startsWith("°")?t.push(Fe(5,1)):e.suffix.startsWith("6")?(t.push(Fe(6)),s=Dt("m"+e.suffix)):e.suffix.startsWith("7")?(t.push(Fe(7,1)),s=Dt("m"+e.suffix)):s=Dt("m")):e.suffix.startsWith("sus2")?t.push(Fe(2)):e.suffix.startsWith("sus4")&&t.push(Fe(4)),t.length<=2&&t.push(Fe(5)),t.length<=2&&t.push(Fe(8)),s||(s=Dt(e.suffix)),{...s,intervals:t}})}function Tn(l,e){let t=e.has(4)&&e.has(7),s=e.has(3)&&e.has(7);const n=An(l);let r="";return t||s||(e.has(3)&&e.has(6)?(r="°",s=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(s=!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",s=!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:l,roman:s?n.toLowerCase():n,suffix:r,major:t,minor:s,semitones:e}}function In(l){const e=l.length;return l.map((t,s)=>{const n=t.semitones,r=new Set;for(let a=1;a{const e=l[0],t=l[1].map(Xl),s=In(t);return{names:e,intervals:t,triads:s}})}function Nn(l){is.length===0&&(is=vs());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return is.find(t=>t.names.find(s=>s.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const Ln=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,Dn=/^[0-9]$/,et=[{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 tn(l){return l===12?1:Math.floor((l-12)/12)}function Xe(l){return`${l.note}${tn(l.midi)}`}function Tt(l){const t=(l-12)%12;return{...et[t],semitones:t,midi:l}}function jn(l,e=!0,t=!1){if(e&&!Ln.test(l))return{err:`Unrecognized note "${l}"`,code:400};const s=l.trim(),n=s.charAt(0).toUpperCase(),r=et.find(d=>d.note.charAt(0)===n&&d.note.length===1);if(!r)return{err:`Unable to find note ${s}`,code:500};const a=s.slice(1).split("").reduce((d,m)=>d+(m.toLowerCase()==="b"||m==="♭"?-1:m==="#"||m==="♯"?1:0),0);let i;if(Dn.test(s.charAt(s.length-1)))try{i=parseInt(s.charAt(s.length-1),10)}catch{}if(t&&i===void 0)return{err:`No octave provided: ${l}`,code:400};i===void 0&&(i=0);let o=(r.semitones+a)%12;o=o<0?o+12:o;const c=a<0?-a:0,f=a>0?a:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(f)}`,semitones:o,midi:12+i*12+o,flats:c,sharps:f}}}function sn(l){const e=et.find(t=>t.note.charAt(0)===l.charAt(0)&&t.note.length===1);if(e){const t=l.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),s=(e.semitones+t)%12;return{note:l,semitones:s<0?s+12:s,flats:t<0?-t:0,sharps:t>0?t:0}}}const Pn=/^[a-gA-G][♭b#♯]?$/,os="ABCDEFG";function Vn(l,e){return e.map(t=>os.charAt((os.indexOf(l)+t.interval_seq-1)%os.length))}function On(l,e,t){return t.map((s,n)=>{const r=e[n],a=(l+s.semitones)%12,i=et[a],o=i.note.charAt(0);if(or||o==="A"&&r==="G"){let c=1,f=a===0?et.length-1:a-c,d=et[f];for(;d.note.charAt(0)!==r;)c+=1,f=f===0?et.length-1:f-1,d=et[f];return{semitones:a,note:d.note+"♯".repeat(c),flats:0,sharps:c+(d.note.includes("♯")?1:0)}}else return{semitones:a,note:i.note,flats:i.flats,sharps:i.sharps}})}function Qt(l,e){if(!Pn.test(l))return{err:`Unknown key: ${l}`,code:400};const t=Nn(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const s=`${l.charAt(0).toUpperCase()}${l.charAt(1).replace("b","♭").replace("#","♯")}`,n=sn(s);if(!n)return{err:`Unable to find root for note: ${s}`,code:404};const r=Vn(s.charAt(0),t.intervals),a=On(n.semitones,r,t.intervals),i=new Map(et.map(o=>{const c=a.find(f=>f.semitones===o.semitones);return c?[o.semitones,c]:[o.semitones,{...o}]}));return{data:{key:s,scale:t.names[0],names:t.names,...Cn(a),intervals:t.intervals.map(o=>({...o})),triads:t.triads.map(o=>({...o})),scaleNotes:a,notesMap:i}}}const fs=new Map;function Bn(l,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(l)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function Gn(l,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(l)),{data:void 0}}catch(s){return{err:`Failed to store the value: ${s}`,code:400}}}function ht(l,e){const{key:t,storage:s="local",namespace:n="default"}=e,r=Bn(t,s),a=ye(l);"data"in r?l.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const i=l.subscribe(c=>{const f=Gn(e.serialize?e.serialize(c):c,t,s);"err"in f&&(e!=null&&e.debug)&&console.error(f.err)}),o=fs.get(n);return o?o.push({key:t,storage:s,value:l,defaultValue:a,unsubscribe:i}):fs.set(n,[{key:t,storage:s,value:l,defaultValue:a,unsubscribe:i}]),l}function Mn(l=["default"],e){l.forEach(t=>{var s;(s=fs.get(t))==null||s.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 Un(l,e){const t=await fetch(l);if(!t.ok)return{err:t.statusText,code:t.status};const s=await t.arrayBuffer();return{data:await e.decodeAudioData(s)}}async function Kn(l,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],s=await Promise.all(t.map(r=>Un(`${l}${r}`,e))),n=[];return s.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class xn{constructor(e,t,s,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(s),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(s))}on(e,t,s,n,r,a,i,o){this.noteA.buffer=e,this.noteA.playbackRate.value=s,this.biquadFilter.frequency.value=r,this.gainA.gain.value=a,this.gain.gain.value=o,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=i,this.noteB.start(0)),this.noteA.start(0)}off(e,t,s){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(s),this.noteB.stop(s),(n=this.damp)==null||n.start(0)}}class Rn{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,s)=>{this.bufferlists.push(t),s===8?this.damper=t:s===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(s=>{this.noteOn(s,t)})}noteOn(e,t=80){if(e<109&&e>20){const s=this.notes.get(e);s&&(s.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,a=n*12+21,i=2**((e-69)/12)*440,o=t/127;let c=i*(2-(e-21)/50)+3*i*o;e<60&&(c=440*(3-(60-21)/50)+3*i*o);const f=1-(e%12/12+1)/12,d=Math.pow(2,(e-a)/12),m=0,b=0,g=o**1.4,T=new xn(e,this.context,this.directGain,this.damper);T.on(this.bufferlists[n],this.bufferlists[r],d,m,c,f,b,g),this.notes.set(e,T)}}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[Tt(l[0]),Tt(l[1])]),Ms=Be(void 0),tt=Be(void 0),nt=ht(Be({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),$e={async openMidi(){return Ht.enable().then(()=>(ds.set(!0),Ht.inputs.length>0?(Xt.set(Ht.inputs[0]),{data:Ht.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(l=>({err:l.toString(),code:403}))},disableMidi(){ds.set(!1),Xt.set(void 0)},setMidiRange(l){gs.set(l)},setInputValue(l,e){nt.update(t=>({...t,[l]:e})),l==="useSound"&&!e?tt.set(void 0):l==="useSound"&&!ye(tt)&&this.initAudio()},async initAudio(){let l=ye(Ms);if(l||(l=new AudioContext,Ms.set(l)),!ye(tt)){const e=new Rn(l),t=await Kn(`${Fn}audio`,l);e.load(t),tt.set(e)}}};let Ze;hn({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 kt=Be(["C","Major"]),St=Nt(kt,l=>{const e=Qt(l[0],l[1]);return"data"in e?e.data:{key:l[0],scale:l[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),Us=Be([]),gt=Be([]);function hs(l,e){if(l.length>0){const t=Date.now();let s=t;const n=l.filter(r=>(r.started+e>t&&(s=Math.min(s,r.started)),r.started+e>t));return!Ze&&n.length>0&&(Ze=setTimeout(()=>{Ze=void 0,gt.update(r=>hs(r,e))},e-(t-s)+100)),n}return l}const me={setKey(l){kt.update(e=>[l,e[1]])},setScale(l){kt.update(e=>[e[0],l])},setKeyAndScale(l,e){kt.set([l,e])},setTarget(l=[]){Us.set(l)},getNote(l){return{...ye(St).notesMap.get(l%12),midi:l}},pushPlayed(l,e,t){const n={...ye(St).notesMap.get(l%12),midi:l},r=Date.now(),a=e===void 0?"default":e?"correct":"wrong";if(gt.update(i=>{const o=i.findIndex(c=>c.midi===l);return o>=0&&i.splice(o,1),[...i,{...n,color:a,started:r}]}),!Ze&&t!==-1){const i=t??ye(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,gt.update(o=>hs(o,i))},i)}},setPlayed(l,e,t){const s=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(gt.update(r=>[...l.map(a=>({...a,color:n,started:s}))]),!Ze&&t!==-1){const r=t??ye(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,gt.update(a=>hs(a,r))},r)}},clearPlayed(){gt.set([]),clearTimeout(Ze),Ze=void 0},clearScore(l=!1){l&&kt.set(["C","Major"]),Us.set([]),gt.set([])}};class bs{constructor(e,t,s){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=s;const n=[],{count:r}=s,a=t.map(o=>typeof o=="object"&&o!==null?{...o}:o);let i=s.duplicates;!s.duplicates&&r>a.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),i=!0);for(let o=0;o0&&n.push(f[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?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function Hn(l,e,t){const s=[];for(let n=0;nm.semitones===a%12),o=r.flats>0,c=r.sharps>0,f=(o?a+1:c?a-1:a)%12,d=o?-1:c?1:0;s.push($n(i??e.notesMap.get(f),i?0:d,a))}return s}const zn=[{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 qn(l){const t=(l-12)%12;return{...zn[t],semitones:t,midi:l}}function Wn(l){return`${l.note.trim().charAt(0).toUpperCase()}${"♭".repeat(l.flats)}${"♯".repeat(l.sharps)}`}class ft extends bs{constructor(e,t,s){const n=t.range[0],r=t.range[1],a=new Set(t.scale.scaleNotes.map(o=>o.semitones)),i=s.chords.flatMap(o=>{const c=[],f=o.intervals.reduce((d,m)=>m.semitones>d?m.semitones:d,0);for(let d=n;d<=r-f;d+=1)if((!s.onlyScale||a.has(d%12))&&(!o.allowed||o.allowed.has(d%12))){const m=Hn(d,t.scale,o.intervals);c.push({...o,rootNote:m[0].note,chord:`${m[0].note}${o.suffixes[0]}`,notes:m})}return c});super(e,i,t),this.played=new Set,this.opts=s}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${Wn(e)}${e.chord.toLowerCase()}`,notes:[]},s=this.current.chord===t.chord;return this.addGuessed(t,s)}guess(){const e=Array.from(this.played.values()).map(n=>qn(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},s=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,s)}}const Jn={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 jt extends bs{constructor(e,t){const s=e==="keys-major"?"major":"minor";super(e,Object.keys(Jn[s]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class It extends bs{constructor(e,t){const s=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-s+1)).map((r,a)=>s+a),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const ln={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},bt=Be("waiting"),dt=ht(Be(ln),{key:"game-options"}),yt=Be(void 0),ys=Be(Zl().map(l=>({...l,selected:!0}))),ke={play(...[l,e]){var o,c,f;let t;const s=ye(St),n=ye(gs),r=ye(dt),a={scale:s,range:n,duplicates:r.duplicates,count:r.count};let i=[s.key,s.scale];if(l==="notes")t=new It(l,a),me.setTarget([me.getNote(t.current)]),(o=ye(tt))==null||o.noteOn(t.current);else if(l==="pitches")t=new It(l,a),me.setTarget(),$e.setInputValue("useSound",!0),(c=ye(tt))==null||c.noteOn(t.current);else if(l==="keys-major"||l=="keys-minor")t=new jt(l,a),i=[t.current,l==="keys-major"?"major":"minor"];else if(l==="chords-play"||l==="chords-write")t=new ft(l,a,e);else if(l==="chords-diatonic"){const d=en(s.triads).map((m,b)=>({...m,allowed:new Set([s.scaleNotes[b].semitones])}));t=new ft(l,a,{chords:d})}else throw Error("Unknown game type: "+l);return typeof t.current!="number"&&typeof t.current!="string"&&((f=ye(tt))==null||f.playChord(t.current.notes.map(d=>d.midi)),me.setTarget(t.current.notes)),me.setKeyAndScale(i[0],i[1]),me.clearPlayed(),bt.set("waiting"),yt.set(t),t},updateState(l){bt.set(l)},setOptionValue(l,e){dt.update(t=>({...t,[l]:e}))},toggleChords(l){ys.update(e=>e.map(t=>({...t,selected:l(t)})))},nextGuess(){var e,t;const l=ye(yt);l!=null&&l.ended?bt.set("ended"):l instanceof It?(l.type==="notes"?me.setTarget([me.getNote(l.current)]):me.setTarget(),me.clearPlayed(),(e=ye(tt))==null||e.noteOn(l.current),ke.updateState("waiting"),l.startTime()):l instanceof ft?(me.setTarget(l.current.notes),me.clearPlayed(),(t=ye(tt))==null||t.playChord(l==null?void 0:l.current.notes.map(s=>s.midi)),bt.set("waiting"),l.startTime()):l instanceof jt&&(me.setKey(l.current),bt.set("waiting"),l.startTime())},clearGame(l=!1){const e=ye(yt);e&&me.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),l&&dt.set(ln),yt.set(void 0),bt.set("waiting"),me.clearScore()}};function Ks(l,e,t){const s=l.slice();return s[25]=e[t],s[27]=t,s}function xs(l,e,t){const s=l.slice();return s[30]=e[t],s}function Rs(l,e,t){const s=l.slice();return s[8]=e[t],s}function Fs(l,e,t){const s=l.slice();return s[25]=e[t],s[27]=t,s}function $s(l,e,t){const s=l.slice();return s[30]=e[t],s}function Hs(l,e,t){const s=l.slice();return s[8]=e[t],s}function Yn(l){let e,t=se(l[25].intervals),s=[];for(let n=0;n0?Qn:Yn}let N=E(l),I=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),_e(n.$$.fragment),r=j(),a=p("div"),o=J(i),c=j(),f=p("li"),I.c(),m=j(),b=p("li"),T=J(g),this.h()},l(L){e=v(L,"LI",{});var M=S(e);t=v(M,"BUTTON",{class:!0});var w=S(t);s=v(w,"SPAN",{class:!0});var G=S(s);pe(n.$$.fragment,G),G.forEach(_),r=P(w),a=v(w,"DIV",{class:!0});var C=S(a);o=Y(C,i),C.forEach(_),w.forEach(_),M.forEach(_),c=P(L),f=v(L,"LI",{class:!0,title:!0});var k=S(f);I.l(k),k.forEach(_),m=P(L),b=v(L,"LI",{class:!0});var A=S(b);T=Y(A,g),A.forEach(_),this.h()},h(){h(s,"class","px-1 py-1 rounded"),q(s,"text-green-500",l[25].selected),q(s,"text-gray-400",!l[25].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),q(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[25].intervals.map(Zs).join("-")),h(b,"class","text-xs")},m(L,M){K(L,e,M),u(e,t),u(t,s),ve(n,s,null),u(t,r),u(t,a),u(a,o),K(L,c,M),K(L,f,M),I.m(f,null),K(L,m,M),K(L,b,M),u(b,T),y=!0,D||(O=$(t,"click",V),D=!0)},p(L,M){l=L;const w={};M[0]&64&&(w.icon=l[25].selected?Jt:Yt),n.$set(w),(!y||M[0]&64)&&q(s,"text-green-500",l[25].selected),(!y||M[0]&64)&&q(s,"text-gray-400",!l[25].selected),(!y||M[0]&64)&&i!==(i=l[25].suffixes[0]+"")&&ae(o,i),(!y||M[0]&128)&&q(t,"hidden",l[7]),N===(N=E(l))&&I?I.p(l,M):(I.d(1),I=N(l),I&&(I.c(),I.m(f,null))),(!y||M[0]&64&&d!==(d=l[25].intervals.map(Zs).join("-")))&&h(f,"title",d),(!y||M[0]&64)&&g!==(g=l[25].name+"")&&ae(T,g)},i(L){y||(F(n.$$.fragment,L),y=!0)},o(L){W(n.$$.fragment,L),y=!1},d(L){L&&(_(e),_(c),_(f),_(m),_(b)),ge(n),I.d(),D=!1,O()}}}function Xn(l){let e,t=se(l[25].intervals),s=[];for(let n=0;n0?Zn:Xn}let N=E(l),I=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),_e(n.$$.fragment),r=j(),a=p("div"),o=J(i),c=j(),f=p("li"),I.c(),m=j(),b=p("li"),T=J(g),this.h()},l(L){e=v(L,"LI",{});var M=S(e);t=v(M,"BUTTON",{class:!0});var w=S(t);s=v(w,"SPAN",{class:!0});var G=S(s);pe(n.$$.fragment,G),G.forEach(_),r=P(w),a=v(w,"DIV",{class:!0});var C=S(a);o=Y(C,i),C.forEach(_),w.forEach(_),M.forEach(_),c=P(L),f=v(L,"LI",{class:!0,title:!0});var k=S(f);I.l(k),k.forEach(_),m=P(L),b=v(L,"LI",{class:!0});var A=S(b);T=Y(A,g),A.forEach(_),this.h()},h(){h(s,"class","px-1 py-1 rounded"),q(s,"text-green-500",l[25].selected),q(s,"text-gray-400",!l[25].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),q(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[25].intervals.map(el).join("-")),h(b,"class","text-xs")},m(L,M){K(L,e,M),u(e,t),u(t,s),ve(n,s,null),u(t,r),u(t,a),u(a,o),K(L,c,M),K(L,f,M),I.m(f,null),K(L,m,M),K(L,b,M),u(b,T),y=!0,D||(O=$(t,"click",V),D=!0)},p(L,M){l=L;const w={};M[0]&32&&(w.icon=l[25].selected?Jt:Yt),n.$set(w),(!y||M[0]&32)&&q(s,"text-green-500",l[25].selected),(!y||M[0]&32)&&q(s,"text-gray-400",!l[25].selected),(!y||M[0]&32)&&i!==(i=l[25].suffixes[0]+"")&&ae(o,i),(!y||M[0]&128)&&q(t,"hidden",l[7]),N===(N=E(l))&&I?I.p(l,M):(I.d(1),I=N(l),I&&(I.c(),I.m(f,null))),(!y||M[0]&32&&d!==(d=l[25].intervals.map(el).join("-")))&&h(f,"title",d),(!y||M[0]&32)&&g!==(g=l[25].name+"")&&ae(T,g)},i(L){y||(F(n.$$.fragment,L),y=!0)},o(L){W(n.$$.fragment,L),y=!1},d(L){L&&(_(e),_(c),_(f),_(m),_(b)),ge(n),I.d(),D=!1,O()}}}function ea(l){let e,t,s,n,r="Chords",a,i,o,c,f,d,m,b,g,T,y,D,O,V,E,N,I,L="Key",M,w,G,C,k="Scale",A,B,U,R,z="Note",le,te,de,ue,Ne,Re,Ge,be,We,xe;c=new rt({props:{icon:bn,width:20}}),m=new rt({props:{icon:yn,width:16}}),T=new rt({props:{icon:l[4]?js:Ps,width:16}}),O=new rt({props:{icon:Yl,width:16}});let Le=se(l[6]),re=[];for(let x=0;xW(re[x],1,1,()=>{re[x]=null});let he=se(l[5]),Q=[];for(let x=0;xW(Q[x],1,1,()=>{Q[x]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("button"),_e(c.$$.fragment),f=j(),d=p("button"),_e(m.$$.fragment),b=j(),g=p("button"),_e(T.$$.fragment),y=j(),D=p("button"),_e(O.$$.fragment),V=j(),E=p("div"),N=p("div"),I=p("label"),I.textContent=L,M=j(),w=p("input"),G=j(),C=p("label"),C.textContent=k,A=j(),B=p("input"),U=j(),R=p("label"),R.textContent=z,le=j(),te=p("input"),de=j(),ue=p("ul");for(let x=0;xl.interval,el=l=>l.interval;function ta(l,e,t){let s,n,r,a,i,o;oe(l,ys,C=>t(20,i=C));let c="C",f=Qt(c,Xs),d="",m,b=[],g=[];const T=ht(Be(!0),{key:"chords-hidden"});oe(l,T,C=>t(7,o=C));function y(){T.update(C=>!C)}function D(){const C=m&&60+m.semitones;if("err"in f||!C)t(2,b=[]),t(3,g=[]);else{const k=f.data;t(2,b=n.map(A=>us(C,k,A.intervals))),t(3,g=r.map(A=>us(C,k,A.intervals)))}}function O({currentTarget:{value:C}}){t(0,c=`${C.charAt(0).toUpperCase()}${C.charAt(1).toLowerCase()}`),f=Qt(c,Xs),D()}function V({currentTarget:{value:C}}){t(1,d=`${C.charAt(0).toUpperCase()}${C.charAt(1).toLowerCase()}`),t(8,m=sn(d)),D()}function E(C){ke.toggleChords(k=>k.name===C.name?!k.selected:k.selected)}function N(){const C=A=>A.suffixes[0]==="maj"||A.suffixes[0]==="m",k=i.filter(C).every(A=>A.selected);ke.toggleChords(A=>C(A)?!k:A.selected)}function I(){const C=A=>A.suffixes[0]==="maj7"||A.suffixes[0]==="m7"||A.suffixes[0]==="7"||A.suffixes[0]==="dim7"||A.suffixes[0]==="aug7",k=i.filter(C).every(A=>A.selected);ke.toggleChords(A=>C(A)?!k:A.selected)}function L(){ke.toggleChords(C=>!a)}function M(){ke.toggleChords(C=>!0)}const w=C=>E(C),G=C=>E(C);return l.$$set=C=>{t(18,e=Ee(Ee({},e),we(C)))},l.$$.update=()=>{l.$$.dirty[0]&1048576&&t(19,s=i),l.$$.dirty[0]&524288&&t(6,n=s.filter((C,k)=>kk>=s.length/2)),l.$$.dirty[0]&524288&&t(4,a=s.every(C=>C.selected))},e=we(e),[c,d,b,g,a,r,n,o,m,T,y,O,V,E,N,I,L,M,e,s,i,w,G]}class sa extends He{constructor(e){super(),ze(this,e,ta,ea,qe,{},null,[-1,-1])}}function tl(l,e,t){const s=l.slice();return s[10]=e[t],s}function la(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function na(l){let e,t,s="Played:",n,r=se(l[2]),a=[];for(let i=0;i0?na:la}let a=r(l),i=a(l);function o(d,m){return d[0]&&d[1]==="ended"?da:d[0]&&d[3].autoplay?fa:d[0]?ua:ca}let c=o(l),f=c(l);return{c(){e=p("div"),i.c(),s=j(),n=p("div"),f.c(),this.h()},l(d){e=v(d,"DIV",{class:!0});var m=S(e);i.l(m),m.forEach(_),s=P(d),n=v(d,"DIV",{class:!0});var b=S(n);f.l(b),b.forEach(_),this.h()},h(){h(e,"class",t=Ie(`${l[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),h(n,"class","mt-2 h-8")},m(d,m){K(d,e,m),i.m(e,null),K(d,s,m),K(d,n,m),f.m(n,null)},p(d,[m]){a===(a=r(d))&&i?i.p(d,m):(i.d(1),i=a(d),i&&(i.c(),i.m(e,null))),m&256&&t!==(t=Ie(`${d[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs")&&h(e,"class",t),c===(c=o(d))&&f?f.p(d,m):(f.d(1),f=c(d),f&&(f.c(),f.m(n,null)))},i:fe,o:fe,d(d){d&&(_(e),_(s),_(n)),i.d(),f.d()}}}const ll=l=>l.note,nl=l=>l.note;function ma(l,e,t){let s,n,r;oe(l,bt,m=>t(1,s=m)),oe(l,gt,m=>t(2,n=m)),oe(l,dt,m=>t(3,r=m));let{game:a}=e;function i(){ke.nextGuess()}function o(){ke.setOptionValue("autoplay",!0),ke.nextGuess()}function c(){a instanceof ft?ke.play(a.type,a.opts):a&&ke.play(a.type,void 0)}function f(){ke.clearGame()}const d=()=>ke.setOptionValue("autoplay",!1);return l.$$set=m=>{t(8,e=Ee(Ee({},e),we(m))),"game"in m&&t(0,a=m.game)},e=we(e),[a,s,n,r,i,o,c,f,e,d]}class _a extends He{constructor(e){super(),ze(this,e,ma,ha,qe,{game:0})}}function al(l,e,t){const s=l.slice();return s[14]=e[t].key,s[15]=e[t].value,s[16]=e[t].icon,s[18]=t,s}const pa=l=>({}),rl=l=>({}),va=l=>({}),il=l=>({});function ol(l){let e,t,s,n,r,a,i,o,c,f;const d=l[11].header,m=Hl(d,l,l[10],rl);let b=se(l[0]),g=[];for(let y=0;yW(g[y],1,1,()=>{g[y]=null});return{c(){e=p("button"),s=j(),n=p("ul"),r=p("li"),m&&m.c(),a=j();for(let y=0;y{o&&(t||(t=$t(e,Ls,{duration:zt},!0)),t.run(1))}),F(m,y);for(let D=0;D{o&&(i||(i=$t(n,Ds,{duration:zt},!0)),i.run(1))}),o=!0}},o(y){y&&(t||(t=$t(e,Ls,{duration:zt},!1)),t.run(0)),W(m,y),g=g.filter(Boolean);for(let D=0;D{g[V]=null}),lt(),n=g[s],n?n.p(l,O):(n=g[s]=b[s](l),n.c()),F(n,1),n.m(t,r)),(!f||O&1)&&i!==(i=l[15]+"")&&ae(o,i),(!f||O&5)&&q(t,"selected",l[14]===l[2])},i(D){f||(F(n),f=!0)},o(D){W(n),f=!1},d(D){D&&_(e),g[s].d(),d=!1,m()}}}function ya(l){let e,t,s,n,r,a,i,o;const c=l[11].value,f=Hl(c,l,l[10],il);let d=l[5]&&ol(l);return{c(){e=p("div"),t=p("button"),f&&f.c(),r=j(),d&&d.c(),this.h()},l(m){e=v(m,"DIV",{class:!0,id:!0});var b=S(e);t=v(b,"BUTTON",{class:!0,title:!0});var g=S(t);f&&f.l(g),g.forEach(_),r=P(b),d&&d.l(b),b.forEach(_),this.h()},h(){h(t,"class",s=Ie(`${l[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),h(t,"title",n=l[8].title||""),q(t,"disabled",l[3]),q(t,"open",l[5]),h(e,"class","relative"),h(e,"id",l[1])},m(m,b){K(m,e,b),u(e,t),f&&f.m(t,null),u(e,r),d&&d.m(e,null),l[13](e),a=!0,i||(o=$(t,"click",l[6]),i=!0)},p(m,[b]){f&&f.p&&(!a||b&1024)&&zl(f,c,m,m[10],a?Wl(c,m[10],b,va):ql(m[10]),il),(!a||b&256&&s!==(s=Ie(`${m[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&h(t,"class",s),(!a||b&256&&n!==(n=m[8].title||""))&&h(t,"title",n),(!a||b&264)&&q(t,"disabled",m[3]),(!a||b&288)&&q(t,"open",m[5]),m[5]?d?(d.p(m,b),b&32&&F(d,1)):(d=ol(m),d.c(),F(d,1),d.m(e,null)):d&&(st(),W(d,1,1,()=>{d=null}),lt()),(!a||b&2)&&h(e,"id",m[1])},i(m){a||(F(f,m),F(d),a=!0)},o(m){W(f,m),W(d),a=!1},d(m){m&&_(e),f&&f.d(m),d&&d.d(),l[13](null),i=!1,o()}}}const zt=400;function ka(l,e,t){let{$$slots:s={},$$scope:n}=e,{options:r,id:a=void 0,selected:i=void 0,disabled:o=void 0,onSelect:c}=e,f,d=!1;function m(){o||t(5,d=!d)}function b(y){t(5,d=c(y))}const g=y=>b(y);function T(y){mn[y?"unshift":"push"](()=>{f=y,t(4,f)})}return l.$$set=y=>{t(8,e=Ee(Ee({},e),we(y))),"options"in y&&t(0,r=y.options),"id"in y&&t(1,a=y.id),"selected"in y&&t(2,i=y.selected),"disabled"in y&&t(3,o=y.disabled),"onSelect"in y&&t(9,c=y.onSelect),"$$scope"in y&&t(10,n=y.$$scope)},e=we(e),[r,a,i,o,f,d,m,b,e,c,n,s,g,T]}class nn extends He{constructor(e){super(),ze(this,e,ka,ya,qe,{options:0,id:1,selected:2,disabled:3,onSelect:9})}}function ul(l){let e;return{c(){e=p("li"),this.h()},l(t){e=v(t,"LI",{class:!0}),S(e).forEach(_),this.h()},h(){h(e,"class","m-[0.175rem] mr-0")},m(t,s){K(t,e,s)},d(t){t&&_(e)}}}function fl(l){let e;return{c(){e=p("div"),this.h()},l(t){e=v(t,"DIV",{class:!0}),S(e).forEach(_),this.h()},h(){h(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-jvhfju")},m(t,s){K(t,e,s)},d(t){t&&_(e)}}}function dl(l){let e,t=l[0].note.note+"",s;return{c(){e=p("div"),s=J(t),this.h()},l(n){e=v(n,"DIV",{class:!0});var r=S(e);s=Y(r,t),r.forEach(_),this.h()},h(){h(e,"class","absolute top-0 left-0")},m(n,r){K(n,e,r),u(e,s)},p(n,r){r&1&&t!==(t=n[0].note.note+"")&&ae(s,t)},d(n){n&&_(e)}}}function Ea(l){let e,t,s,n,r,a,i=l[0].key+"",o,c,f,d,m=l[0].key==="{enter}"&&ul(),b=l[0].key==="{enter}"&&fl(),g=l[0].note&&dl(l);return{c(){m&&m.c(),e=j(),t=p("li"),s=p("button"),b&&b.c(),n=j(),g&&g.c(),r=j(),a=p("div"),o=J(i),this.h()},l(T){m&&m.l(T),e=P(T),t=v(T,"LI",{class:!0});var y=S(t);s=v(y,"BUTTON",{class:!0});var D=S(s);b&&b.l(D),n=P(D),g&&g.l(D),r=P(D),a=v(D,"DIV",{});var O=S(a);o=Y(O,i),O.forEach(_),D.forEach(_),y.forEach(_),this.h()},h(){h(s,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex items-center justify-center svelte-jvhfju"),h(t,"class",c=Ie(`${l[1].class||""} m-[0.175rem] ${hl(l[0].size)}`)+" svelte-jvhfju"),q(t,"enter",l[0].key==="{enter}")},m(T,y){m&&m.m(T,y),K(T,e,y),K(T,t,y),u(t,s),b&&b.m(s,null),u(s,n),g&&g.m(s,null),u(s,r),u(s,a),u(a,o),f||(d=$(s,"click",l[2]),f=!0)},p(T,[y]){T[0].key==="{enter}"?m||(m=ul(),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),T[0].key==="{enter}"?b||(b=fl(),b.c(),b.m(s,n)):b&&(b.d(1),b=null),T[0].note?g?g.p(T,y):(g=dl(T),g.c(),g.m(s,r)):g&&(g.d(1),g=null),y&1&&i!==(i=T[0].key+"")&&ae(o,i),y&3&&c!==(c=Ie(`${T[1].class||""} m-[0.175rem] ${hl(T[0].size)}`)+" svelte-jvhfju")&&h(t,"class",c),y&3&&q(t,"enter",T[0].key==="{enter}")},i:fe,o:fe,d(T){T&&(_(e),_(t)),m&&m.d(T),b&&b.d(),g&&g.d(),f=!1,d()}}}function hl(l){return l&&Number.isInteger(l)?`size-${l}`:l?`size-${Math.floor(l)}-${Math.floor(l*10)-Math.floor(l)*10}`:"size-1"}function wa(l,e,t){let{value:s}=e;function n(r){ps.call(this,l,r)}return l.$$set=r=>{t(1,e=Ee(Ee({},e),we(r))),"value"in r&&t(0,s=r.value)},e=we(e),[s,e,n]}class Ca extends He{constructor(e){super(),ze(this,e,wa,Ea,qe,{value:0})}}const ms={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(()=>Aa)},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)},ku:{name:"Kurdish",import:ie(()=>import("./kurdish-eencXZUC.4cb27155.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 an(l){if(!("default"in l.layout)||!("shift"in l.layout))throw console.error(l),Error("Invalid layout import");return{default:l.layout.default,shift:l.layout.shift}}async function rn(l=["en"]){let e={code:"en",layout:ms.en,index:99};Object.entries(ms).forEach(([s,n])=>{for(let r=0;rr)&&(e={code:s,layout:n,index:r})});const t=await e.layout.import;return{code:e.code,name:e.layout.name,imported:an(t.default)}}const on={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}"]}},Aa=Object.freeze(Object.defineProperty({__proto__:null,default:on},Symbol.toStringTag,{value:"Module"}));function Ta(l,e){return l[1].forEach((t,s)=>{let n;s===2?n={...e[1]}:s===3?n={...e[3]}:s===5?n={...e[6]}:s===6?n={...e[8]}:s===7?n={...e[10]}:s===9?(n={...e[1]},n.semitones+=12):s===10&&(n={...e[3]},n.semitones+=12),l[1][s].note=n}),l[2].forEach((t,s)=>{let n;s===1?n={...e[0]}:s===2?n={...e[2]}:s===3?n={...e[4]}:s===4?n={...e[5]}:s===5?n={...e[7]}:s===6?n={...e[9]}:s===7?n={...e[11]}:s===8?(n={...e[0]},n.semitones+=12):s===9?(n={...e[2]},n.semitones+=12):s===10?(n={...e[4]},n.semitones+=12):s===11?(n={...e[5]},n.semitones+=12):s===12&&(n={...e[7]},n.semitones+=12),l[2][s].note=n}),l}const qt=[["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 Ia(l){let e=[];const t=l.default.map((s,n)=>{if(n===0)return s.split(" ").reverse().slice(0,14).reverse();if(n===1){const r=s.split(" ");return e=r.slice(13),[...r.slice(0,13),"{enter}"]}else{if(n===2)return[...s.split(" ").slice(0,13).filter(r=>r!=="{enter}"),...e].slice(0,13);if(n===3){const r=["{shift}",...s.split(" ").slice(1,12).filter(i=>i!=="{shift}"),"{shift}"];let a=1;for(;r.length<13;)r.splice(a,0,"{empty}"),a=a===1?-1:1;return r}else return s.split(" ")}});return[t[0].map((s,n)=>({key:s,code:qt[0][n]})),t[1].map((s,n)=>({key:s,code:qt[1][n]})),t[2].map((s,n)=>({key:s,code:qt[2][n]})),t[3].map((s,n)=>({key:s,code:qt[3][n]}))]}class Sa{constructor(e){this.rows=[[],[],[],[]],this.opts={hotkeydRows:"middle-row",layout:{code:"en",name:"English",imported:an(on)},...e},this.setLayout(this.opts.layout.imported)}setOptions(e){this.opts={...this.opts,...e}}setLayout(e){this.rows=Ia(e)}setNotes(e){if(this.opts.hotkeydRows==="middle-row")this.rows=Ta(this.rows,e);else throw Error("not implemented")}}const ks=/^[a-gA-G]$/,cn=/^[♭Bb#♯sS]$/,Na=/^[0-9]$/;let H="",ut;const La={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}"]}},Es=ht(Be({layout:La,hotkeydRows:"middle-row"}),{key:"keyboard-options"}),un=Nt([St,Es],([l,e])=>{const t=new Sa(e);return t.setNotes(Array.from(l.notesMap.values())),t}),Da=Nt(un,l=>l.rows.map(e=>e.map((t,s)=>{let n;return t.key==="{bksp}"?n=2:t.key==="{tab}"?n=1.5:t.key==="{enter}"?n=2:t.key==="{lock}"?n=1.75:t.key==="{shift}"&&s===0?n=1.5:t.key==="{shift}"&&(n=2.5),n?{...t,size:n}:t}))),es=Nt(un,l=>new Map([...l.rows[0].map(e=>[e.code,e]),...l.rows[1].map(e=>[e.code,e]),...l.rows[2].map(e=>[e.code,e]),...l.rows[3].map(e=>[e.code,e])])),ja=Nt(es,l=>Array.from(l.values()).map(e=>e.note).filter(e=>e!==void 0));function Pa(l,e){const{useHotkeys:t}=ye(nt),s=ye(es).get(l);if(t&&H.length===0&&s&&s.note)return H="",{e:"guessed-key",data:s.note.note};if(!t&&H.length===0&&ks.test(e))return H+=e.toUpperCase(),{e:"string",data:H};if(!t&&H.length>0&&cn.test(e))return e==="b"||e==="B"?H+="♭":H+="♯",{e:"string",data:H};if(l==="Backspace"&&H.length>0)return H=H.slice(0,-1),{e:"string",data:H};if(l==="Enter"&&H.length>0){const n=H;return H="",{e:"guessed-key",data:n}}return!1}function Va(l,e){if(l==="Enter"&&H.length>0){const t={note:"",flats:0,sharps:0,chord:""};for(let s=0;s0?t.chord+=H[s].toLowerCase():H[s]==="♭"?(t.note+=H[s],t.flats+=1):H[s]==="♯"?(t.note+=H[s],t.sharps+=1):t.chord+=H[s].toLowerCase();return H="",{e:"guessed-chord",data:t}}else{if(l==="Backspace"&&H.length>0)return H=H.slice(0,-1),{e:"string",data:H};if(H.length===0&&ks.test(e))return H+=e.toUpperCase(),{e:"string",data:H};if(H.length>0&&e.length===1)return H.length===1&&(e==="b"||e==="B")?H+="♭":H.length===1&&e==="#"?H+="♯":H+=e,{e:"string",data:H}}return!1}function Oa(l,e,t){const{useAutoOctave:s,useHotkeys:n}=ye(nt);let r;const i=ye(es).get(l),o=(i==null?void 0:i.key)||"";let c=!1;if(!ut&&n&&(i!=null&&i.note)?(ut=i.note,s&&(r=tn(ye(Zt)[0].midi)),c="note"):!n&&H.length===0&&ks.test(e)?(H+=e.toUpperCase(),c="input"):!n&&H.length>0&&cn.test(e)&&(e==="b"||e==="B"?H+="♭":H+="♯",c="input"),Na.test(o))try{r=parseInt(o)}catch{}if(ut&&r!==void 0){const f=ut.semitones+(r+1+(t?1:0))*12;return ut=void 0,{e:"guessed-note",data:f}}else if(H&&r!==void 0){const f=ws.findNote(H),d=f?f.semitones+(r+1)*12:void 0;return ut=void 0,H="",d!==void 0?{e:"guessed-note",data:d}:{e:"string",data:H}}else if(l==="Backspace"&&(ut||H.length>0))return ut=void 0,H=H.slice(0,-1),{e:"string",data:H};return c==="note"?{e:"note",data:ut}:c==="input"?{e:"string",data:H}:!1}const ws={async setLayout(l){const e=await rn([l]);Es.update(t=>({...t,layout:e}))},findNote(l){return ye(ja).find(e=>{if(e.note.charAt(0)===l.charAt(0)){const t=l.slice(1).split("").reduce((s,n)=>s+(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}})},handleInput(l,e,t=!1){const s=ye(yt);return s instanceof jt?Pa(l,e.toUpperCase()):s instanceof ft&&s.type==="chords-write"?Va(l,e):ye(nt).useKeyboard?Oa(l,e.toUpperCase(),t):!1}};function ml(l,e,t){const s=l.slice();return s[10]=e[t],s[12]=t,s}function _l(l,e,t){const s=l.slice();return s[13]=e[t],s}function Ba(l){let e,t=l[2].layout.name+"",s;return{c(){e=p("div"),s=J(t),this.h()},l(n){e=v(n,"DIV",{slot:!0});var r=S(e);s=Y(r,t),r.forEach(_),this.h()},h(){h(e,"slot","value")},m(n,r){K(n,e,r),u(e,s)},p(n,r){r&4&&t!==(t=n[2].layout.name+"")&&ae(s,t)},d(n){n&&_(e)}}}function pl(l){let e,t;return e=new Ca({props:{value:l[13]}}),{c(){_e(e.$$.fragment)},l(s){pe(e.$$.fragment,s)},m(s,n){ve(e,s,n),t=!0},p(s,n){const r={};n&8&&(r.value=s[13]),e.$set(r)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){W(e.$$.fragment,s),t=!1},d(s){ge(e,s)}}}function vl(l){let e,t,s,n,r=se(l[10]),a=[];for(let o=0;oW(a[o],1,1,()=>{a[o]=null});return{c(){e=p("li"),t=j();for(let o=0;oW(k[B],1,1,()=>{k[B]=null});return{c(){e=p("div"),t=p("div"),s=p("div"),n=p("label"),n.textContent=r,a=j(),_e(i.$$.fragment),o=j(),c=p("div"),f=p("label"),f.textContent=d,m=j(),b=p("input"),g=j(),T=p("div"),y=p("label"),y.textContent=D,O=j(),V=p("input"),E=j(),N=p("div"),I=p("ul");for(let B=0;Bt(9,s=m)),oe(l,Es,m=>t(2,n=m)),oe(l,Da,m=>t(3,r=m)),Jl(async()=>{console.log(s);const m=await rn(["sw"]);console.log(m),window.layout=m});let a=!0,i=!1;const o=Object.entries(ms).map(([m,b])=>({key:m,value:b.name}));function c(m){return console.log("key ",m),ws.setLayout(m),!1}function f(){a=this.checked,t(0,a)}function d(){i=this.checked,t(1,i)}return l.$$set=m=>{t(6,e=Ee(Ee({},e),we(m)))},e=we(e),[a,i,n,r,o,c,e,f,d]}class Ua extends He{constructor(e){super(),ze(this,e,Ma,Ga,qe,{})}}function gl(l){let e,t;return e=new Ua({props:{class:"mt-4"}}),{c(){_e(e.$$.fragment)},l(s){pe(e.$$.fragment,s)},m(s,n){ve(e,s,n),t=!0},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){W(e.$$.fragment,s),t=!1},d(s){ge(e,s)}}}function Ka(l){let e,t,s,n,r="I/O",a,i,o,c,f="Device",d,m,b,g,T,y,D="Prompt",O,V,E="Disable",N,I,L,M,w="Sound",G,C,k,A,B,U,R="Fixed velocity",z,le,te,de,ue,Ne,Re="Keyboard",Ge,be,We,xe,Le,re,Se="Hotkeys",he,Q,ne,x,X,ce,ee="Auto-octave",Ce,Ve,at,Je,Me,De,Ae,Lt="Set hotkeys",Et,Ue,mt,Cs="Fade timeout",ts,ot,ss,_t,Pt,ls,pt,As="Reset all",ns,Vt,Ye,as,Ts,Oe=l[2]&&gl();return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("div"),c=p("label"),c.textContent=f,d=j(),m=p("input"),g=j(),T=p("div"),y=p("button"),y.textContent=D,O=j(),V=p("button"),V.textContent=E,N=j(),I=p("div"),L=p("div"),M=p("label"),M.textContent=w,G=j(),C=p("input"),A=j(),B=p("div"),U=p("label"),U.textContent=R,z=j(),le=p("input"),te=j(),de=p("div"),ue=p("div"),Ne=p("label"),Ne.textContent=Re,Ge=j(),be=p("input"),xe=j(),Le=p("div"),re=p("label"),re.textContent=Se,he=j(),Q=p("input"),x=j(),X=p("div"),ce=p("label"),ce.textContent=ee,Ce=j(),Ve=p("input"),Je=j(),Me=p("div"),De=p("div"),Ae=p("button"),Ae.textContent=Lt,Et=j(),Ue=p("div"),mt=p("label"),mt.textContent=Cs,ts=j(),ot=p("input"),ss=j(),_t=p("div"),Pt=p("div"),ls=j(),pt=p("button"),pt.textContent=As,ns=j(),Oe&&Oe.c(),this.h()},l(Te){e=v(Te,"DIV",{class:!0});var Ke=S(e);t=v(Ke,"FIELDSET",{class:!0});var ct=S(t);s=v(ct,"LEGEND",{class:!0});var Is=S(s);n=v(Is,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(n)!=="svelte-1jbbsti"&&(n.textContent=r),Is.forEach(_),a=P(ct),i=v(ct,"DIV",{class:!0});var vt=S(i);o=v(vt,"DIV",{class:!0});var wt=S(o);c=v(wt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(c)!=="svelte-crpa7y"&&(c.textContent=f),d=P(wt),m=v(wt,"INPUT",{class:!0,id:!0}),g=P(wt),T=v(wt,"DIV",{class:!0});var Ot=S(T);y=v(Ot,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(y)!=="svelte-mj6mct"&&(y.textContent=D),O=P(Ot),V=v(Ot,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(V)!=="svelte-1sl6oxh"&&(V.textContent=E),Ot.forEach(_),wt.forEach(_),N=P(vt),I=v(vt,"DIV",{class:!0});var Bt=S(I);L=v(Bt,"DIV",{class:!0});var Gt=S(L);M=v(Gt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(M)!=="svelte-wgxtkw"&&(M.textContent=w),G=P(Gt),C=v(Gt,"INPUT",{class:!0,id:!0,type:!0}),Gt.forEach(_),A=P(Bt),B=v(Bt,"DIV",{class:!0});var Mt=S(B);U=v(Mt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(U)!=="svelte-1tm2bth"&&(U.textContent=R),z=P(Mt),le=v(Mt,"INPUT",{class:!0,id:!0,placeholder:!0}),Mt.forEach(_),Bt.forEach(_),te=P(vt),de=v(vt,"DIV",{class:!0});var Ct=S(de);ue=v(Ct,"DIV",{class:!0});var Ut=S(ue);Ne=v(Ut,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(Ne)!=="svelte-1js269u"&&(Ne.textContent=Re),Ge=P(Ut),be=v(Ut,"INPUT",{class:!0,id:!0,type:!0}),Ut.forEach(_),xe=P(Ct),Le=v(Ct,"DIV",{class:!0});var Kt=S(Le);re=v(Kt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(re)!=="svelte-21h39k"&&(re.textContent=Se),he=P(Kt),Q=v(Kt,"INPUT",{class:!0,id:!0,type:!0}),Kt.forEach(_),x=P(Ct),X=v(Ct,"DIV",{class:!0});var xt=S(X);ce=v(xt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(ce)!=="svelte-33lczu"&&(ce.textContent=ee),Ce=P(xt),Ve=v(xt,"INPUT",{class:!0,id:!0,type:!0}),xt.forEach(_),Ct.forEach(_),Je=P(vt),Me=v(vt,"DIV",{class:!0});var At=S(Me);De=v(At,"DIV",{class:!0});var Ss=S(De);Ae=v(Ss,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(Ae)!=="svelte-1v9okg9"&&(Ae.textContent=Lt),Ss.forEach(_),Et=P(At),Ue=v(At,"DIV",{class:!0});var Rt=S(Ue);mt=v(Rt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(mt)!=="svelte-vd5i27"&&(mt.textContent=Cs),ts=P(Rt),ot=v(Rt,"INPUT",{class:!0,id:!0}),Rt.forEach(_),ss=P(At),_t=v(At,"DIV",{class:!0});var Ft=S(_t);Pt=v(Ft,"DIV",{}),S(Pt).forEach(_),ls=P(Ft),pt=v(Ft,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(pt)!=="svelte-jjt0c3"&&(pt.textContent=As),Ft.forEach(_),At.forEach(_),vt.forEach(_),ns=P(ct),Oe&&Oe.l(ct),ct.forEach(_),Ke.forEach(_),this.h()},h(){var Te;h(n,"class","px-1 rounded hover:bg-gray-100"),h(s,"class","text-base"),h(c,"class","font-bold"),h(c,"for","device"),h(m,"class","px-1 my-1 rounded w-50"),h(m,"id","device"),m.disabled=!0,m.value=b=((Te=l[5])==null?void 0:Te.name)??"No device",h(y,"class","btn-sm primary mr-2"),h(V,"class","btn-sm primary"),h(T,"class","flex my-[auto]"),h(o,"class","h-full flex flex-col"),h(M,"class","font-bold"),h(M,"for","sound"),h(C,"class","h-[20px]"),h(C,"id","sound"),h(C,"type","checkbox"),C.checked=k=l[3].useSound,h(L,"class","my-1 flex justify-between mr-12"),h(U,"class","font-bold"),h(U,"for","fixed-velocity"),h(le,"class","h-[20px] w-16"),h(le,"id","fixed-velocity"),h(le,"placeholder","0-127"),h(B,"class","flex justify-between"),h(I,"class","flex flex-col h-full"),h(Ne,"class","font-bold"),h(Ne,"for","keyboard"),h(be,"class","h-[20px]"),h(be,"id","keyboard"),h(be,"type","checkbox"),be.checked=We=l[3].useKeyboard,h(ue,"class","my-1 flex justify-between mr-12"),h(re,"class","font-bold"),h(re,"for","hotkeys"),h(Q,"class","h-[20px]"),h(Q,"id","hotkeys"),h(Q,"type","checkbox"),Q.checked=ne=l[3].useHotkeys,h(Le,"class","my-1 flex justify-between mr-12"),h(ce,"class","font-bold"),h(ce,"for","auto-octave"),h(Ve,"class","h-[20px]"),h(Ve,"id","auto-octave"),h(Ve,"type","checkbox"),Ve.checked=at=l[3].useAutoOctave,h(X,"class","my-1 flex justify-between mr-12"),h(de,"class","flex flex-col h-full"),h(Ae,"class","w-full btn-sm primary"),h(De,"class","flex justify-between"),h(mt,"class","font-bold"),h(mt,"for","fade-timeout"),h(ot,"class","h-[20px] w-16"),h(ot,"id","fade-timeout"),ot.value=l[1],h(Ue,"class","flex justify-between"),h(pt,"class","btn-sm primary"),h(_t,"class","flex justify-between"),h(Me,"class","flex flex-col justify-between h-full"),h(i,"class","body svelte-1bpw69s"),q(i,"hidden",l[4]),h(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm svelte-1bpw69s"),q(t,"collapsed",l[4]),h(e,"class",Vt=Ie(`${l[11].class||""}`)+" svelte-1bpw69s")},m(Te,Ke){K(Te,e,Ke),u(e,t),u(t,s),u(s,n),u(t,a),u(t,i),u(i,o),u(o,c),u(o,d),u(o,m),u(o,g),u(o,T),u(T,y),u(T,O),u(T,V),u(i,N),u(i,I),u(I,L),u(L,M),u(L,G),u(L,C),u(I,A),u(I,B),u(B,U),u(B,z),u(B,le),Qe(le,l[0]),u(i,te),u(i,de),u(de,ue),u(ue,Ne),u(ue,Ge),u(ue,be),u(de,xe),u(de,Le),u(Le,re),u(Le,he),u(Le,Q),u(de,x),u(de,X),u(X,ce),u(X,Ce),u(X,Ve),u(i,Je),u(i,Me),u(Me,De),u(De,Ae),u(Me,Et),u(Me,Ue),u(Ue,mt),u(Ue,ts),u(Ue,ot),u(Me,ss),u(Me,_t),u(_t,Pt),u(_t,ls),u(_t,pt),u(t,ns),Oe&&Oe.m(t,null),Ye=!0,as||(Ts=[$(n,"click",l[7]),$(y,"click",$e.openMidi),$(V,"click",$e.disableMidi),$(C,"change",l[12]),$(le,"input",l[13]),$(le,"change",l[8]),$(be,"change",l[14]),$(Q,"change",l[15]),$(Ve,"change",l[16]),$(Ae,"click",l[17]),$(ot,"input",l[9]),$(pt,"click",l[10])],as=!0)},p(Te,[Ke]){var ct;(!Ye||Ke&32&&b!==(b=((ct=Te[5])==null?void 0:ct.name)??"No device")&&m.value!==b)&&(m.value=b),(!Ye||Ke&8&&k!==(k=Te[3].useSound))&&(C.checked=k),Ke&1&&le.value!==Te[0]&&Qe(le,Te[0]),(!Ye||Ke&8&&We!==(We=Te[3].useKeyboard))&&(be.checked=We),(!Ye||Ke&8&&ne!==(ne=Te[3].useHotkeys))&&(Q.checked=ne),(!Ye||Ke&8&&at!==(at=Te[3].useAutoOctave))&&(Ve.checked=at),(!Ye||Ke&2&&ot.value!==Te[1])&&(ot.value=Te[1]),(!Ye||Ke&16)&&q(i,"hidden",Te[4]),Te[2]?Oe?Ke&4&&F(Oe,1):(Oe=gl(),Oe.c(),F(Oe,1),Oe.m(t,null)):Oe&&(st(),W(Oe,1,1,()=>{Oe=null}),lt()),(!Ye||Ke&16)&&q(t,"collapsed",Te[4]),(!Ye||Ke&2048&&Vt!==(Vt=Ie(`${Te[11].class||""}`)+" svelte-1bpw69s"))&&h(e,"class",Vt)},i(Te){Ye||(F(Oe),Ye=!0)},o(Te){W(Oe),Ye=!1},d(Te){Te&&_(e),Oe&&Oe.d(),as=!1,it(Ts)}}}function xa(l,e,t){let s,n,r;oe(l,nt,E=>t(3,s=E)),oe(l,Xt,E=>t(5,r=E));const a=ht(Be(!1),{key:"inputs-hidden"});oe(l,a,E=>t(4,n=E));let i=s.fixedVelocity??"",o=s.keyFadeTimeout,c=!1;nt.subscribe(E=>{t(0,i=E.fixedVelocity??""),t(1,o=E.keyFadeTimeout)});function f(){a.update(E=>!E)}function d(E){const{value:N}=E.currentTarget;let I;if(N)try{I=parseInt(N)}catch{}I!==void 0&&I>=0&&I<=127?$e.setInputValue("fixedVelocity",I):N?t(0,i=s.fixedVelocity||""):$e.setInputValue("fixedVelocity",void 0)}function m(E){try{const N=parseInt(E.currentTarget.value);$e.setInputValue("keyFadeTimeout",N)}catch{t(1,o=s.keyFadeTimeout)}}function b(){Mn()}const g=E=>$e.setInputValue("useSound",E.currentTarget.checked);function T(){i=this.value,t(0,i)}const y=E=>$e.setInputValue("useKeyboard",E.currentTarget.checked),D=E=>$e.setInputValue("useHotkeys",E.currentTarget.checked),O=E=>$e.setInputValue("useAutoOctave",E.currentTarget.checked),V=()=>t(2,c=!c);return l.$$set=E=>{t(11,e=Ee(Ee({},e),we(E)))},e=we(e),[i,o,c,s,n,r,a,f,d,m,b,e,g,T,y,D,O,V]}class Ra extends He{constructor(e){super(),ze(this,e,xa,Ka,qe,{})}}function Fa(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function $a(l){let e,t=l[1].note+"",s;return{c(){e=J("Input: "),s=J(t)},l(n){e=Y(n,"Input: "),s=Y(n,t)},m(n,r){K(n,e,r),K(n,s,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&ae(s,t)},d(n){n&&(_(e),_(s))}}}function Ha(l){let e,t;return{c(){e=J("Input: "),t=J(l[0])},l(s){e=Y(s,"Input: "),t=Y(s,l[0])},m(s,n){K(s,e,n),K(s,t,n)},p(s,n){n&1&&ae(t,s[0])},d(s){s&&(_(e),_(t))}}}function za(l){let e;return{c(){e=J(_s)},l(t){e=Y(t,_s)},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function qa(l){let e,t,s,n;function r(o,c){return o[2].useKeyboard&&_s?za:o[2].useKeyboard&&o[0]?Ha:o[2].useKeyboard&&o[1]?$a:Fa}let a=r(l),i=a(l);return{c(){e=p("div"),i.c(),this.h()},l(o){e=v(o,"DIV",{class:!0});var c=S(e);i.l(c),c.forEach(_),this.h()},h(){h(e,"class",t=`${l[4].class||""}`)},m(o,c){K(o,e,c),i.m(e,null),s||(n=$(window,"keydown",l[3]),s=!0)},p(o,[c]){a===(a=r(o))&&i?i.p(o,c):(i.d(1),i=a(o),i&&(i.c(),i.m(e,null))),c&16&&t!==(t=`${o[4].class||""}`)&&h(e,"class",t)},i:fe,o:fe,d(o){o&&_(e),i.d(),s=!1,n()}}}let _s="";function Wa(l,e,t){let s;oe(l,nt,c=>t(2,s=c));let{debounced:n}=e,r="",a;const i=_n();function o(c){const f=c.target;if(n||!(f instanceof HTMLElement)||f.tagName==="INPUT")return;const d=ws.handleInput(c.code,c.key,c.shiftKey);d&&d.e==="note"?t(1,a=d.data):d&&d.e==="string"?t(0,r=d.data):d&&(t(0,r=""),t(1,a=void 0),i(d.e,d.data))}return l.$$set=c=>{t(4,e=Ee(Ee({},e),we(c))),"debounced"in c&&t(5,n=c.debounced)},e=we(e),[r,a,s,o,e,n]}class Ja extends He{constructor(e){super(),ze(this,e,Wa,qa,qe,{debounced:5})}}function Ya(l){let e,t,s,n="Count",r,a,i,o,c,f="Duplicates",d,m,b,g,T,y,D="Autoplay",O,V,E,N,I,L,M="Wait seconds",w,G,C,k,A;return{c(){e=p("ul"),t=p("li"),s=p("label"),s.textContent=n,r=j(),a=p("input"),i=j(),o=p("li"),c=p("label"),c.textContent=f,d=j(),m=p("input"),g=j(),T=p("li"),y=p("label"),y.textContent=D,O=j(),V=p("input"),N=j(),I=p("li"),L=p("label"),L.textContent=M,w=j(),G=p("input"),this.h()},l(B){e=v(B,"UL",{class:!0});var U=S(e);t=v(U,"LI",{class:!0});var R=S(t);s=v(R,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(s)!=="svelte-wgq9fc"&&(s.textContent=n),r=P(R),a=v(R,"INPUT",{class:!0,id:!0,type:!0}),R.forEach(_),i=P(U),o=v(U,"LI",{class:!0});var z=S(o);c=v(z,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(c)!=="svelte-hcg9dq"&&(c.textContent=f),d=P(z),m=v(z,"INPUT",{class:!0,id:!0,type:!0}),z.forEach(_),g=P(U),T=v(U,"LI",{class:!0});var le=S(T);y=v(le,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(y)!=="svelte-lr68n2"&&(y.textContent=D),O=P(le),V=v(le,"INPUT",{class:!0,id:!0,type:!0}),le.forEach(_),N=P(U),I=v(U,"LI",{class:!0});var te=S(I);L=v(te,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(L)!=="svelte-1qj2vcy"&&(L.textContent=M),w=P(te),G=v(te,"INPUT",{class:!0,id:!0,type:!0}),te.forEach(_),U.forEach(_),this.h()},h(){h(s,"class","font-bold"),h(s,"for","guess-count"),h(a,"class","h-[20px] w-10"),h(a,"id","guess-count"),h(a,"type","number"),h(t,"class","flex items-center justify-between svelte-1elvih2"),h(c,"class","font-bold"),h(c,"for","duplicates"),h(m,"class","h-[20px]"),h(m,"id","duplicates"),h(m,"type","checkbox"),m.checked=b=l[2].duplicates,h(o,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(y,"class","font-bold"),h(y,"for","autoplay"),h(V,"class","h-[20px]"),h(V,"id","autoplay"),h(V,"type","checkbox"),V.checked=E=l[2].autoplay,h(T,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(L,"class","font-bold"),h(L,"for","wait-ms"),h(G,"class","h-[20px] w-10"),h(G,"id","wait-ms"),h(G,"type","number"),h(I,"class","flex items-center justify-between svelte-1elvih2"),h(e,"class",C=Ie(`${l[5].class||""}`)+" svelte-1elvih2")},m(B,U){K(B,e,U),u(e,t),u(t,s),u(t,r),u(t,a),Qe(a,l[0]),u(e,i),u(e,o),u(o,c),u(o,d),u(o,m),u(e,g),u(e,T),u(T,y),u(T,O),u(T,V),u(e,N),u(e,I),u(I,L),u(I,w),u(I,G),Qe(G,l[1]),k||(A=[$(a,"input",l[6]),$(a,"input",l[3]),$(m,"input",l[7]),$(V,"input",l[8]),$(G,"input",l[9]),$(G,"input",l[4])],k=!0)},p(B,[U]){U&1&&Wt(a.value)!==B[0]&&Qe(a,B[0]),U&4&&b!==(b=B[2].duplicates)&&(m.checked=b),U&4&&E!==(E=B[2].autoplay)&&(V.checked=E),U&2&&Wt(G.value)!==B[1]&&Qe(G,B[1]),U&32&&C!==(C=Ie(`${B[5].class||""}`)+" svelte-1elvih2")&&h(e,"class",C)},i:fe,o:fe,d(B){B&&_(e),k=!1,it(A)}}}function Qa(l,e,t){let s;oe(l,dt,m=>t(2,s=m));let n=s.count||"",r=s.waitSeconds||"";dt.subscribe(m=>{t(0,n=m.count||""),t(1,r=m.waitSeconds||"")});function a({currentTarget:{value:m}}){let b;try{b=parseInt(m),b<=0&&(b=1),ke.setOptionValue("count",b)}catch{t(0,n=s.count)}}function i({currentTarget:{value:m}}){let b;try{b=parseInt(m),b<0&&(b=0),ke.setOptionValue("waitSeconds",b)}catch{t(1,r=s.waitSeconds)}}function o(){n=Wt(this.value),t(0,n)}const c=m=>ke.setOptionValue("duplicates",m.currentTarget.checked),f=m=>ke.setOptionValue("autoplay",m.currentTarget.checked);function d(){r=Wt(this.value),t(1,r)}return l.$$set=m=>{t(5,e=Ee(Ee({},e),we(m)))},e=we(e),[n,r,s,a,i,e,o,c,f,d]}class Xa extends He{constructor(e){super(),ze(this,e,Qa,Ya,qe,{})}}function bl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function yl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function kl(l){let e,t,s=l[21]+"",n,r,a,i,o,c,f,d;function m(){return l[13](l[20])}i=new rt({props:{icon:cs,width:20}});function b(...g){return l[14](l[20],...g)}return{c(){e=p("li"),t=p("button"),n=J(s),r=j(),a=p("button"),_e(i.$$.fragment),o=j(),this.h()},l(g){e=v(g,"LI",{class:!0});var T=S(e);t=v(T,"BUTTON",{class:!0});var y=S(t);n=Y(y,s),y.forEach(_),r=P(T),a=v(T,"BUTTON",{class:!0});var D=S(a);pe(i.$$.fragment,D),D.forEach(_),o=P(T),T.forEach(_),this.h()},h(){h(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),q(t,"selected",l[20]===l[0]),h(a,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),h(e,"class","flex svelte-1okhpct")},m(g,T){K(g,e,T),u(e,t),u(t,n),u(e,r),u(e,a),ve(i,a,null),u(e,o),c=!0,f||(d=[$(t,"click",m),$(a,"click",b)],f=!0)},p(g,T){l=g,(!c||T&17)&&q(t,"selected",l[20]===l[0])},i(g){c||(F(i.$$.fragment,g),c=!0)},o(g){W(i.$$.fragment,g),c=!1},d(g){g&&_(e),ge(i),f=!1,it(d)}}}function El(l){let e,t=se(l[2]),s=[];for(let n=0;nW(G[A],1,1,()=>{G[A]=null});let k=(l[0]==="chords-write"||l[0]==="chords-play")&&El(l);return f=new Xa({props:{class:"game-options"}}),D=new rt({props:{class:"mr-1",icon:l[3]?Vs:cs,width:20}}),{c(){e=p("fieldset"),t=p("legend"),t.textContent=s,n=j(),r=p("div"),a=p("ul");for(let A=0;At(12,r=E)),oe(l,dt,E=>t(19,a=E)),oe(l,yt,E=>t(3,i=E));const o=[{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 c=o[4].key,f="maj-m";a.count,a.waitSeconds,dt.subscribe(E=>{E.count,E.waitSeconds});function d(){ke.clearGame(!0)}function m(E,N){if(N==="chords-write"||N==="chords-play"||N==="chords-diatonic"){let I=[];f==="selected"?I=r.filter(L=>L.selected):f==="all"?I=r:f==="maj-m"?I=r.filter(L=>L.suffixes[0]==="maj"||L.suffixes[0]==="m"):f==="seventh"&&(I=r.filter(L=>L.suffixes[0]==="maj7"||L.suffixes[0]==="m7"||L.suffixes[0]==="7"||L.suffixes[0]==="dim7"||L.suffixes[0]==="aug7")),ke.play(N,{chords:I})}else ke.play(N,void 0);E.currentTarget instanceof HTMLElement&&E.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function b(E){t(0,c=E)}function g(E,N){t(0,c=N),m(E,N)}function T(E){t(1,f=E)}const y=E=>b(E),D=(E,N)=>g(N,E),O=E=>T(E),V=E=>m(E,c);return l.$$set=E=>{t(10,e=Ee(Ee({},e),we(E)))},l.$$.update=()=>{l.$$.dirty&4096&&t(11,s=r.reduce((E,N)=>N.selected?E+1:E,0)),l.$$.dirty&2048&&t(2,n=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${s} chords`},{key:"all",value:"All"}])},e=we(e),[c,f,n,i,o,d,m,b,g,T,e,s,r,y,D,O,V]}class tr extends He{constructor(e){super(),ze(this,e,er,Za,qe,{})}}function Cl(l,e,t){const s=l.slice();return s[7]=e[t],s}function Al(l,e,t){const s=l.slice();return s[4]=e[t],s}function sr(l){let e,t=se(l[1]),s=[];for(let n=0;nl.interval;function ar(l,e,t){let{scale:s,intervals:n}=e;function r(a){ps.call(this,l,a)}return l.$$set=a=>{t(2,e=Ee(Ee({},e),we(a))),"scale"in a&&t(0,s=a.scale),"intervals"in a&&t(1,n=a.intervals)},e=we(e),[s,n,e,r]}class fn extends He{constructor(e){super(),ze(this,e,ar,nr,qe,{scale:0,intervals:1})}}function Nl(l,e,t){const s=l.slice();return s[7]=e[t],s}function Ll(l,e,t){const s=l.slice();return s[4]=e[t],s}function rr(l){let e,t=se(l[0]),s=[];for(let n=0;n2),h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(f,d){K(f,e,d),u(e,t),u(t,n),u(e,r),u(e,a),u(a,o),u(e,c)},p(f,d){d&1&&s!==(s=f[7].roman+"")&&ae(n,s),d&1&&i!==(i=f[7].suffix+"")&&ae(o,i),d&1&&q(a,"super-text",f[7].suffix.length>2)},d(f){f&&_(e)}}}function jl(l){let e,t,s=l[4]+"",n,r;return{c(){e=p("span"),t=p("span"),n=J(s),r=j(),this.h()},l(a){e=v(a,"SPAN",{class:!0});var i=S(e);t=v(i,"SPAN",{});var o=S(t);n=Y(o,s),o.forEach(_),r=P(i),i.forEach(_),this.h()},h(){h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(a,i){K(a,e,i),u(e,t),u(t,n),u(e,r)},p(a,i){i&2&&s!==(s=a[4]+"")&&ae(n,s)},d(a){a&&_(e)}}}function or(l){let e,t,s,n,r,a;function i(f,d){return f[1].length>0?ir:rr}let o=i(l),c=o(l);return{c(){e=p("div"),t=p("button"),c.c(),this.h()},l(f){e=v(f,"DIV",{class:!0,title:!0});var d=S(e);t=v(d,"BUTTON",{class:!0});var m=S(t);c.l(m),m.forEach(_),d.forEach(_),this.h()},h(){h(t,"class","triads flex flex-wrap svelte-1roj1mi"),h(e,"class",s=Ie(`${l[2].class||""} `)+" svelte-1roj1mi"),h(e,"title",n=l[0].map(Pl).join("-"))},m(f,d){K(f,e,d),u(e,t),c.m(t,null),r||(a=$(t,"click",l[3]),r=!0)},p(f,[d]){o===(o=i(f))&&c?c.p(f,d):(c.d(1),c=o(f),c&&(c.c(),c.m(t,null))),d&4&&s!==(s=Ie(`${f[2].class||""} `)+" svelte-1roj1mi")&&h(e,"class",s),d&1&&n!==(n=f[0].map(Pl).join("-"))&&h(e,"title",n)},i:fe,o:fe,d(f){f&&_(e),c.d(),r=!1,a()}}}const Pl=l=>l.roman+l.suffix;function cr(l,e,t){let{triads:s,chords:n}=e;function r(a){ps.call(this,l,a)}return l.$$set=a=>{t(2,e=Ee(Ee({},e),we(a))),"triads"in a&&t(0,s=a.triads),"chords"in a&&t(1,n=a.chords)},e=we(e),[s,n,e,r]}class dn extends He{constructor(e){super(),ze(this,e,cr,or,qe,{triads:0,chords:1})}}function Vl(l,e,t){const s=l.slice();return s[23]=e[t],s}function Ol(l,e,t){const s=l.slice();return s[23]=e[t],s}function Bl(l){let e,t,s=l[23].raw.names[0]+"",n,r,a,i,o,c,f;function d(){return l[11](l[23])}a=new fn({props:{scale:l[23].scale,intervals:l[23].raw.intervals}}),a.$on("click",d);function m(){return l[12](l[23])}return o=new dn({props:{triads:l[23].triads,chords:l[23].triadChords}}),o.$on("click",m),{c(){e=p("li"),t=p("div"),n=J(s),r=j(),_e(a.$$.fragment),i=j(),_e(o.$$.fragment),c=j(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=S(e);t=v(g,"DIV",{class:!0});var T=S(t);n=Y(T,s),T.forEach(_),r=P(g),pe(a.$$.fragment,g),i=P(g),pe(o.$$.fragment,g),c=P(g),g.forEach(_),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){K(b,e,g),u(e,t),u(t,n),u(e,r),ve(a,e,null),u(e,i),ve(o,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&4)&&s!==(s=l[23].raw.names[0]+"")&&ae(n,s);const T={};g&4&&(T.scale=l[23].scale),g&4&&(T.intervals=l[23].raw.intervals),a.$set(T);const y={};g&4&&(y.triads=l[23].triads),g&4&&(y.chords=l[23].triadChords),o.$set(y)},i(b){f||(F(a.$$.fragment,b),F(o.$$.fragment,b),f=!0)},o(b){W(a.$$.fragment,b),W(o.$$.fragment,b),f=!1},d(b){b&&_(e),ge(a),ge(o)}}}function Gl(l){let e,t,s=l[23].raw.names[0]+"",n,r,a,i,o,c,f;function d(){return l[13](l[23])}a=new fn({props:{scale:l[23].scale,intervals:l[23].raw.intervals}}),a.$on("click",d);function m(){return l[14](l[23])}return o=new dn({props:{triads:l[23].triads,chords:l[23].triadChords}}),o.$on("click",m),{c(){e=p("li"),t=p("div"),n=J(s),r=j(),_e(a.$$.fragment),i=j(),_e(o.$$.fragment),c=j(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=S(e);t=v(g,"DIV",{class:!0});var T=S(t);n=Y(T,s),T.forEach(_),r=P(g),pe(a.$$.fragment,g),i=P(g),pe(o.$$.fragment,g),c=P(g),g.forEach(_),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){K(b,e,g),u(e,t),u(t,n),u(e,r),ve(a,e,null),u(e,i),ve(o,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&2)&&s!==(s=l[23].raw.names[0]+"")&&ae(n,s);const T={};g&2&&(T.scale=l[23].scale),g&2&&(T.intervals=l[23].raw.intervals),a.$set(T);const y={};g&2&&(y.triads=l[23].triads),g&2&&(y.chords=l[23].triadChords),o.$set(y)},i(b){f||(F(a.$$.fragment,b),F(o.$$.fragment,b),f=!0)},o(b){W(a.$$.fragment,b),W(o.$$.fragment,b),f=!1},d(b){b&&_(e),ge(a),ge(o)}}}function ur(l){let e,t,s,n,r="Scales",a,i,o,c,f="Key",d,m,b,g,T,y,D,O,V,E,N=se(l[2]),I=[];for(let C=0;CW(I[C],1,1,()=>{I[C]=null});let M=se(l[1]),w=[];for(let C=0;CW(w[C],1,1,()=>{w[C]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("div"),c=p("label"),c.textContent=f,d=j(),m=p("input"),b=j(),g=p("ul");for(let C=0;Ct(17,r=w)),oe(l,St,w=>t(18,a=w)),oe(l,nt,w=>t(19,i=w)),oe(l,tt,w=>t(20,o=w));let d=vs().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),m="",b=[a.key,a.scale],g;const T=ht(Be(!0),{key:"scales-hidden"});oe(l,T,w=>t(3,c=w));function y(){T.update(w=>!w)}function D({currentTarget:{value:w}}){t(0,m=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,d=d.map(G=>{const C=Qt(m,G.key),k=m&&"data"in C?C.data:void 0;let A=[];return k&&(A=G.triads.map((B,U)=>`${k.scaleNotes[U].note}${!B.suffix.includes("°")&&B.minor?"m":""}${B.suffix}`)),{...G,scale:k,triadChords:A}}))}function O(w,G,C){if(wA.midi),i.fixedVelocity),g=setTimeout(()=>O(w,G,C),C)}else me.setPlayed([]),me.setKeyAndScale(b[0],b[1])}function V(w){clearTimeout(g);let G,C;w.scale?(C=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):C=a;const k=r[0].midi+C.scaleNotes[0].semitones;G=w.raw.intervals.map(A=>[{...C.notesMap.get(A.semitones%12),midi:k+A.semitones}]),G[0][0].semitones!==G[G.length-1][0].semitones&&G.push(G[0].map(A=>({...A,midi:A.midi+12}))),O(0,G,500)}function E(w){clearTimeout(g);const{intervals:G}=w.raw;let C,k;w.scale?(k=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):k=a;const A=r[0].midi+k.scaleNotes[0].semitones;C=en(w.triads).map((U,R)=>us(A+k.intervals[R].semitones,k,U.intervals)),G[G.length-1].interval_seq!==1&&C.push(C[0].map(U=>({...U,midi:U.midi+12}))),O(0,C,750)}const N=w=>V(w),I=w=>E(w),L=w=>V(w),M=w=>E(w);return l.$$set=w=>{t(9,e=Ee(Ee({},e),we(w)))},l.$$.update=()=>{l.$$.dirty&1024&&t(2,s=d.filter((w,G)=>GG>=d.length/2))},e=we(e),[m,n,s,c,T,y,D,V,E,e,d,N,I,L,M]}class dr extends He{constructor(e){super(),ze(this,e,fr,ur,qe,{})}}function Ml(l,e,t){const s=l.slice();return s[26]=e[t],s}function Ul(l,e,t){const s=l.slice();return s[29]=e[t],s}function Kl(l){let e,t;return{c(){e=p("div"),t=J(l[3]),this.h()},l(s){e=v(s,"DIV",{class:!0});var n=S(e);t=Y(n,l[3]),n.forEach(_),this.h()},h(){h(e,"class","error svelte-1u7ze7x")},m(s,n){K(s,e,n),u(e,t)},p(s,n){n[0]&8&&ae(t,s[3])},d(s){s&&_(e)}}}function hr(l){let e,t;return{c(){e=p("div"),t=J(l[0]),this.h()},l(s){e=v(s,"DIV",{slot:!0});var n=S(e);t=Y(n,l[0]),n.forEach(_),this.h()},h(){h(e,"slot","value")},m(s,n){K(s,e,n),u(e,t)},p(s,n){n[0]&1&&ae(t,s[0])},d(s){s&&_(e)}}}function xl(l){let e,t=se(l[5]),s=[];for(let n=0;nt(23,n=k)),oe(l,kt,k=>t(24,r=k)),oe(l,yt,k=>t(7,i=k)),oe(l,St,k=>t(8,o=k));let c=Xe(n[0]),f=Xe(n[1]),d="";const m=ht(Be(!1),{key:"score-options-hidden"});oe(l,m,k=>t(6,a=k));let b=r[0],g=r[1];const T=vs(),y=T.map(k=>({key:k.names[0],value:k.names[0]}));Zt.subscribe(k=>{t(1,c=Xe(k[0])),t(2,f=Xe(k[1]))}),kt.subscribe(k=>{t(4,b=k[0]),t(0,g=k[1])});function D(k,A){const B=jn(A.currentTarget.value,!0,!0);if("data"in B){const{midi:U}=B.data,R=n,z=[k==="min"?U:R[0].midi,k==="max"?U:R[1].midi];$e.setMidiRange(z),t(3,d="")}else t(3,d=B.err),k==="min"?t(1,c=Xe(n[0])):t(2,f=Xe(n[1]))}function O(){t(3,d="")}function V({currentTarget:{value:k}}){t(4,b=`${k.charAt(0).toUpperCase()}${k.charAt(1).toLowerCase()}`),me.setKey(b)}function E(k){var A;return t(0,g=(A=y.find(B=>k===B.key))==null?void 0:A.value),me.setScale(g),!1}function N(){m.update(k=>!k)}function I(){me.clearScore(!0),$e.setMidiRange([60,84])}function L(){c=this.value,t(1,c)}const M=k=>D("min",k);function w(){f=this.value,t(2,f)}const G=k=>D("max",k);function C(){b=this.value,t(4,b)}return l.$$set=k=>{t(17,e=Ee(Ee({},e),we(k)))},l.$$.update=()=>{var k;l.$$.dirty[0]&1&&t(5,s=((k=T.find(A=>A.names[0]===g))==null?void 0:k.intervals)||[])},e=we(e),[g,c,f,d,b,s,a,i,o,m,y,D,O,V,E,N,I,e,L,M,w,G,C]}class pr extends He{constructor(e){super(),ze(this,e,_r,mr,qe,{},null,[-1,-1])}}function vr(l){l[19]=l[20].default}function gr(l){return{c:fe,l:fe,m:fe,i:fe,o:fe,d:fe}}function br(l){vr(l);let e,t,s;var n=l[19];function r(a,i){return{props:{class:"px-4 md:px-0"}}}return n&&(e=gn(n,r())),{c(){e&&_e(e.$$.fragment),t=Pe()},l(a){e&&pe(e.$$.fragment,a),t=Pe()},m(a,i){e&&ve(e,a,i),K(a,t,i),s=!0},i(a){s||(e&&F(e.$$.fragment,a),s=!0)},o(a){e&&W(e.$$.fragment,a),s=!1},d(a){a&&_(t),e&&ge(e,a)}}}function yr(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},i:fe,o:fe,d(t){t&&_(e)}}}function kr(l){let e,t,s,n='MIDI Note Trainer',r,a,i,o,c,f,d,m,b,g,T,y,D,O,V,E,N,I,L;i=new Ra({}),c=new dr({}),d=new sa({}),g=new pr({props:{class:"score-options mr-4"}}),y=new tr({props:{class:"play-form"}});let M={ctx:l,current:null,token:null,hasCatch:!1,pending:yr,then:br,catch:gr,value:20,blocks:[,,,]};return pn(ie(()=>import("./Score.d5ae0699.js"),["./Score.d5ae0699.js","./vendor_svelte.4e97ec88.js","./vendor.1acf520b.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),M),E=new Ja({props:{class:"min-h-32",debounced:!!l[0]}}),E.$on("guessed-chord",l[2]),E.$on("guessed-key",l[3]),E.$on("guessed-note",l[4]),I=new _a({props:{game:l[1]}}),{c(){e=p("meta"),t=j(),s=p("h1"),s.innerHTML=n,r=j(),a=p("section"),_e(i.$$.fragment),o=j(),_e(c.$$.fragment),f=j(),_e(d.$$.fragment),m=j(),b=p("div"),_e(g.$$.fragment),T=j(),_e(y.$$.fragment),D=j(),M.block.c(),O=j(),V=p("section"),_e(E.$$.fragment),N=j(),_e(I.$$.fragment),this.h()},l(w){const G=vn("svelte-1w2oado",document.head);e=v(G,"META",{name:!0,content:!0}),G.forEach(_),t=P(w),s=v(w,"H1",{class:!0,"data-svelte-h":!0}),Z(s)!=="svelte-1l8ebwf"&&(s.innerHTML=n),r=P(w),a=v(w,"SECTION",{class:!0});var C=S(a);pe(i.$$.fragment,C),o=P(C),pe(c.$$.fragment,C),f=P(C),pe(d.$$.fragment,C),m=P(C),b=v(C,"DIV",{class:!0});var k=S(b);pe(g.$$.fragment,k),T=P(k),pe(y.$$.fragment,k),k.forEach(_),C.forEach(_),D=P(w),M.block.l(w),O=P(w),V=v(w,"SECTION",{class:!0});var A=S(V);pe(E.$$.fragment,A),N=P(A),pe(I.$$.fragment,A),A.forEach(_),this.h()},h(){h(e,"name","description"),h(e,"content","App to practise music notation, scales and chords using MIDI"),h(s,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),h(b,"class","play svelte-qjpqy3"),h(a,"class","px-4 md:px-0"),h(V,"class","mb-8 px-4 md:px-0 flex flex-col")},m(w,G){u(document.head,e),K(w,t,G),K(w,s,G),K(w,r,G),K(w,a,G),ve(i,a,null),u(a,o),ve(c,a,null),u(a,f),ve(d,a,null),u(a,m),u(a,b),ve(g,b,null),u(b,T),ve(y,b,null),K(w,D,G),M.block.m(w,M.anchor=G),M.mount=()=>O.parentNode,M.anchor=O,K(w,O,G),K(w,V,G),ve(E,V,null),u(V,N),ve(I,V,null),L=!0},p(w,[G]){l=w;const C={};G&1&&(C.debounced=!!l[0]),E.$set(C);const k={};G&2&&(k.game=l[1]),I.$set(k)},i(w){L||(F(i.$$.fragment,w),F(c.$$.fragment,w),F(d.$$.fragment,w),F(g.$$.fragment,w),F(y.$$.fragment,w),F(M.block),F(E.$$.fragment,w),F(I.$$.fragment,w),L=!0)},o(w){W(i.$$.fragment,w),W(c.$$.fragment,w),W(d.$$.fragment,w),W(g.$$.fragment,w),W(y.$$.fragment,w);for(let G=0;G<3;G+=1){const C=M.blocks[G];W(C)}W(E.$$.fragment,w),W(I.$$.fragment,w),L=!1},d(w){w&&(_(t),_(s),_(r),_(a),_(D),_(O),_(V)),_(e),ge(i),ge(c),ge(d),ge(g),ge(y),M.block.d(w),M.token=null,M=null,ge(E),ge(I)}}}function Er(l,e,t){let s,n,r,a,i,o;oe(l,bt,N=>t(7,s=N)),oe(l,yt,N=>t(1,n=N)),oe(l,dt,N=>t(8,r=N)),oe(l,nt,N=>t(9,a=N)),oe(l,tt,N=>t(10,i=N)),oe(l,ds,N=>t(11,o=N));let c,f;Jl(()=>(o&&E(),window.addEventListener("keydown",d),window.addEventListener("mousedown",d),window.addEventListener("touchstart",d),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)})),Xt.subscribe(N=>{N&&N.channels[1].addListener("noteon",m)});function d(){$e.initAudio(),window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)}function m(N){if(c)return;const I=N.rawData;b(I[1],I[2])}function b(N,I){const L=n;L instanceof It&&!(L!=null&&L.ended)&&s==="waiting"?y(N):L instanceof ft&&!(L!=null&&L.ended)&&s==="waiting"?(L.addPlayedNote(N),f||(f=setTimeout(T,2e3))):L||me.pushPlayed(N),i&&i.noteOn(N,a.fixedVelocity??I)}function g(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&ke.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?ke.nextGuess():t(0,c=void 0)}function T(){var I;const N=n;if(N instanceof ft){const L=N.guess();me.setPlayed(((I=N.latestGuess.guessed)==null?void 0:I.notes)||[],L,-1),ke.updateState(L?"correct":"wrong"),g()}f=void 0}function y(N){const I=n;if(I instanceof It&&s==="waiting"){me.setTarget([me.getNote(I.current)]);const L=I.guess(N);ke.updateState(L?"correct":"wrong"),me.pushPlayed(N,L,4e3),g()}}function D(N){const I=n;if(I instanceof ft&&s==="waiting"){const L=I.guessWrittenChord(N.detail);ke.updateState(L?"correct":"wrong"),g()}}function O(N){const I=n;if(I instanceof jt&&s==="waiting"){const L=N.detail.replaceAll("♭","b").replaceAll("♯","#"),M=I.guess(L);ke.updateState(M?"correct":"wrong"),g()}}function V(N){b(N.detail,80)}async function E(){const N=await $e.openMidi();"data"in N?N.data.name:(N.err,console.error(N.err))}return[c,n,D,O,V]}class Tr extends He{constructor(e){super(),ze(this,e,Er,kr,qe,{})}}export{Bs as F,ft as G,Tr as P,wn as S,It as a,ke as b,yt as c,gt as d,tn as e,bt as g,tt as p,St as s,Us as t}; diff --git a/_app/immutable/chunks/3.841cbed9.js b/_app/immutable/chunks/3.841cbed9.js new file mode 100644 index 00000000..06671764 --- /dev/null +++ b/_app/immutable/chunks/3.841cbed9.js @@ -0,0 +1 @@ +import{_ as ie}from"./preload-helper.a4192956.js";import{R as ye,Q as Nt,T as Be,U as hn,S as He,i as ze,s as qe,O as rt,V as se,e as p,m as j,H as _e,a as v,b as S,n as Z,d as _,o as P,I as pe,f as h,L as q,W as Ie,g as K,h as u,J as ve,p as $,t as F,C as st,w as lt,l as W,K as ge,X as je,Y as it,M as oe,N as Ee,P as we,z as J,A as Y,B as ae,v as Pe,q as fe,c as Hl,u as zl,j as ql,k as Wl,Z as Ns,_ as $t,F as mn,$ as Ls,a0 as Ds,a1 as ps,r as Jl,a2 as Qe,a3 as _n,a4 as Wt,a5 as pn,a6 as vn,G as gn}from"./vendor_svelte.abb8ca64.js";import{w as Ht,b as bn,c as yn,e as js,f as Ps,g as Yl,h as Jt,i as Yt,a as Vs,j as cs}from"./vendor.1acf520b.js";const Os={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function Fe(l,e=0,t=0){return{interval:`${l}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:l,semitones:Ql(l,e,t),flats:e,sharps:t}}function Ql(l,e,t){return(l<8?Os[l]:Os[l%7])-e+t+Math.floor(l/8)*12}function Xl(l){let e,t=0,s=0;l<0?(t=1+Math.floor(-l/100),e=-l%100):l>100?(s=Math.floor(l/100),e=l%100):e=l;const n=Ql(e,t,s);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(s)}`,interval_seq:e,semitones:n,flats:t,sharps:s}}const kn=[[["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 rs=[];function Zl(){return kn.map(l=>{const e=l[3].map(Xl);return{suffixes:l[0],name:l[1][0],type:l[2],intervals:e}})}function Dt(l){rs.length===0&&(rs=Zl());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return rs.find(t=>t.suffixes.find(s=>s===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function En(l,e,t){let s=e<0?l.flats-e:l.flats,n=e>0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function us(l,e,t){const s=[];for(let n=0;nm.semitones===a%12),o=r.flats>0,c=r.sharps>0,f=(o?a+1:c?a-1:a)%12,d=o?-1:c?1:0;s.push(En(i??e.notesMap.get(f),i?0:d,a))}return s}const Bs=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],wn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],Gs=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 Cn(l){let e=0,t=0;for(let s=0;sa.note.slice(0,2)===Bs[s]),r=l.find(a=>a.note.slice(0,2)===wn[s]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:Gs.get(e*-1)}:{flats:0,sharps:t,majorSignature:Gs.get(t)}}function An(l){return l>=9?`${l>=10?"X":""}${l===9?"IX":"I".repeat(l%10)}`:`${l>=5?"V":""}${l===4?"IV":"I".repeat(l%5)}`}function en(l){return l.map(e=>{const t=[Fe(1)];let s;return e.major?(t.push(Fe(3)),e.suffix.startsWith("+")?t.push(Fe(5,0,1)):e.suffix.startsWith("6")?t.push(Fe(6)):e.suffix.startsWith("7")?t.push(Fe(7,1)):e.suffix.startsWith("maj7")?t.push(Fe(7)):s=Dt("maj")):e.minor?(t.push(Fe(3,1)),e.suffix.startsWith("°")?t.push(Fe(5,1)):e.suffix.startsWith("6")?(t.push(Fe(6)),s=Dt("m"+e.suffix)):e.suffix.startsWith("7")?(t.push(Fe(7,1)),s=Dt("m"+e.suffix)):s=Dt("m")):e.suffix.startsWith("sus2")?t.push(Fe(2)):e.suffix.startsWith("sus4")&&t.push(Fe(4)),t.length<=2&&t.push(Fe(5)),t.length<=2&&t.push(Fe(8)),s||(s=Dt(e.suffix)),{...s,intervals:t}})}function Tn(l,e){let t=e.has(4)&&e.has(7),s=e.has(3)&&e.has(7);const n=An(l);let r="";return t||s||(e.has(3)&&e.has(6)?(r="°",s=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(s=!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",s=!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:l,roman:s?n.toLowerCase():n,suffix:r,major:t,minor:s,semitones:e}}function In(l){const e=l.length;return l.map((t,s)=>{const n=t.semitones,r=new Set;for(let a=1;a{const e=l[0],t=l[1].map(Xl),s=In(t);return{names:e,intervals:t,triads:s}})}function Nn(l){is.length===0&&(is=vs());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return is.find(t=>t.names.find(s=>s.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const Ln=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,Dn=/^[0-9]$/,et=[{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 tn(l){return l===12?1:Math.floor((l-12)/12)}function Xe(l){return`${l.note}${tn(l.midi)}`}function Tt(l){const t=(l-12)%12;return{...et[t],semitones:t,midi:l}}function jn(l,e=!0,t=!1){if(e&&!Ln.test(l))return{err:`Unrecognized note "${l}"`,code:400};const s=l.trim(),n=s.charAt(0).toUpperCase(),r=et.find(d=>d.note.charAt(0)===n&&d.note.length===1);if(!r)return{err:`Unable to find note ${s}`,code:500};const a=s.slice(1).split("").reduce((d,m)=>d+(m.toLowerCase()==="b"||m==="♭"?-1:m==="#"||m==="♯"?1:0),0);let i;if(Dn.test(s.charAt(s.length-1)))try{i=parseInt(s.charAt(s.length-1),10)}catch{}if(t&&i===void 0)return{err:`No octave provided: ${l}`,code:400};i===void 0&&(i=0);let o=(r.semitones+a)%12;o=o<0?o+12:o;const c=a<0?-a:0,f=a>0?a:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(f)}`,semitones:o,midi:12+i*12+o,flats:c,sharps:f}}}function sn(l){const e=et.find(t=>t.note.charAt(0)===l.charAt(0)&&t.note.length===1);if(e){const t=l.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),s=(e.semitones+t)%12;return{note:l,semitones:s<0?s+12:s,flats:t<0?-t:0,sharps:t>0?t:0}}}const Pn=/^[a-gA-G][♭b#♯]?$/,os="ABCDEFG";function Vn(l,e){return e.map(t=>os.charAt((os.indexOf(l)+t.interval_seq-1)%os.length))}function On(l,e,t){return t.map((s,n)=>{const r=e[n],a=(l+s.semitones)%12,i=et[a],o=i.note.charAt(0);if(or||o==="A"&&r==="G"){let c=1,f=a===0?et.length-1:a-c,d=et[f];for(;d.note.charAt(0)!==r;)c+=1,f=f===0?et.length-1:f-1,d=et[f];return{semitones:a,note:d.note+"♯".repeat(c),flats:0,sharps:c+(d.note.includes("♯")?1:0)}}else return{semitones:a,note:i.note,flats:i.flats,sharps:i.sharps}})}function Qt(l,e){if(!Pn.test(l))return{err:`Unknown key: ${l}`,code:400};const t=Nn(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const s=`${l.charAt(0).toUpperCase()}${l.charAt(1).replace("b","♭").replace("#","♯")}`,n=sn(s);if(!n)return{err:`Unable to find root for note: ${s}`,code:404};const r=Vn(s.charAt(0),t.intervals),a=On(n.semitones,r,t.intervals),i=new Map(et.map(o=>{const c=a.find(f=>f.semitones===o.semitones);return c?[o.semitones,c]:[o.semitones,{...o}]}));return{data:{key:s,scale:t.names[0],names:t.names,...Cn(a),intervals:t.intervals.map(o=>({...o})),triads:t.triads.map(o=>({...o})),scaleNotes:a,notesMap:i}}}const fs=new Map;function Bn(l,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(l)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function Gn(l,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(l)),{data:void 0}}catch(s){return{err:`Failed to store the value: ${s}`,code:400}}}function ht(l,e){const{key:t,storage:s="local",namespace:n="default"}=e,r=Bn(t,s),a=ye(l);"data"in r?l.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const i=l.subscribe(c=>{const f=Gn(e.serialize?e.serialize(c):c,t,s);"err"in f&&(e!=null&&e.debug)&&console.error(f.err)}),o=fs.get(n);return o?o.push({key:t,storage:s,value:l,defaultValue:a,unsubscribe:i}):fs.set(n,[{key:t,storage:s,value:l,defaultValue:a,unsubscribe:i}]),l}function Mn(l=["default"],e){l.forEach(t=>{var s;(s=fs.get(t))==null||s.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 Un(l,e){const t=await fetch(l);if(!t.ok)return{err:t.statusText,code:t.status};const s=await t.arrayBuffer();return{data:await e.decodeAudioData(s)}}async function Kn(l,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],s=await Promise.all(t.map(r=>Un(`${l}${r}`,e))),n=[];return s.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class xn{constructor(e,t,s,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(s),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(s))}on(e,t,s,n,r,a,i,o){this.noteA.buffer=e,this.noteA.playbackRate.value=s,this.biquadFilter.frequency.value=r,this.gainA.gain.value=a,this.gain.gain.value=o,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=i,this.noteB.start(0)),this.noteA.start(0)}off(e,t,s){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(s),this.noteB.stop(s),(n=this.damp)==null||n.start(0)}}class Rn{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,s)=>{this.bufferlists.push(t),s===8?this.damper=t:s===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(s=>{this.noteOn(s,t)})}noteOn(e,t=80){if(e<109&&e>20){const s=this.notes.get(e);s&&(s.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,a=n*12+21,i=2**((e-69)/12)*440,o=t/127;let c=i*(2-(e-21)/50)+3*i*o;e<60&&(c=440*(3-(60-21)/50)+3*i*o);const f=1-(e%12/12+1)/12,d=Math.pow(2,(e-a)/12),m=0,b=0,g=o**1.4,T=new xn(e,this.context,this.directGain,this.damper);T.on(this.bufferlists[n],this.bufferlists[r],d,m,c,f,b,g),this.notes.set(e,T)}}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[Tt(l[0]),Tt(l[1])]),Ms=Be(void 0),tt=Be(void 0),nt=ht(Be({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),$e={async openMidi(){return Ht.enable().then(()=>(ds.set(!0),Ht.inputs.length>0?(Xt.set(Ht.inputs[0]),{data:Ht.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(l=>({err:l.toString(),code:403}))},disableMidi(){ds.set(!1),Xt.set(void 0)},setMidiRange(l){gs.set(l)},setInputValue(l,e){nt.update(t=>({...t,[l]:e})),l==="useSound"&&!e?tt.set(void 0):l==="useSound"&&!ye(tt)&&this.initAudio()},async initAudio(){let l=ye(Ms);if(l||(l=new AudioContext,Ms.set(l)),!ye(tt)){const e=new Rn(l),t=await Kn(`${Fn}audio`,l);e.load(t),tt.set(e)}}};let Ze;hn({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 kt=Be(["C","Major"]),St=Nt(kt,l=>{const e=Qt(l[0],l[1]);return"data"in e?e.data:{key:l[0],scale:l[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),Us=Be([]),gt=Be([]);function hs(l,e){if(l.length>0){const t=Date.now();let s=t;const n=l.filter(r=>(r.started+e>t&&(s=Math.min(s,r.started)),r.started+e>t));return!Ze&&n.length>0&&(Ze=setTimeout(()=>{Ze=void 0,gt.update(r=>hs(r,e))},e-(t-s)+100)),n}return l}const me={setKey(l){kt.update(e=>[l,e[1]])},setScale(l){kt.update(e=>[e[0],l])},setKeyAndScale(l,e){kt.set([l,e])},setTarget(l=[]){Us.set(l)},getNote(l){return{...ye(St).notesMap.get(l%12),midi:l}},pushPlayed(l,e,t){const n={...ye(St).notesMap.get(l%12),midi:l},r=Date.now(),a=e===void 0?"default":e?"correct":"wrong";if(gt.update(i=>{const o=i.findIndex(c=>c.midi===l);return o>=0&&i.splice(o,1),[...i,{...n,color:a,started:r}]}),!Ze&&t!==-1){const i=t??ye(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,gt.update(o=>hs(o,i))},i)}},setPlayed(l,e,t){const s=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(gt.update(r=>[...l.map(a=>({...a,color:n,started:s}))]),!Ze&&t!==-1){const r=t??ye(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,gt.update(a=>hs(a,r))},r)}},clearPlayed(){gt.set([]),clearTimeout(Ze),Ze=void 0},clearScore(l=!1){l&&kt.set(["C","Major"]),Us.set([]),gt.set([])}};class bs{constructor(e,t,s){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=s;const n=[],{count:r}=s,a=t.map(o=>typeof o=="object"&&o!==null?{...o}:o);let i=s.duplicates;!s.duplicates&&r>a.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),i=!0);for(let o=0;o0&&n.push(f[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?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function Hn(l,e,t){const s=[];for(let n=0;nm.semitones===a%12),o=r.flats>0,c=r.sharps>0,f=(o?a+1:c?a-1:a)%12,d=o?-1:c?1:0;s.push($n(i??e.notesMap.get(f),i?0:d,a))}return s}const zn=[{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 qn(l){const t=(l-12)%12;return{...zn[t],semitones:t,midi:l}}function Wn(l){return`${l.note.trim().charAt(0).toUpperCase()}${"♭".repeat(l.flats)}${"♯".repeat(l.sharps)}`}class ft extends bs{constructor(e,t,s){const n=t.range[0],r=t.range[1],a=new Set(t.scale.scaleNotes.map(o=>o.semitones)),i=s.chords.flatMap(o=>{const c=[],f=o.intervals.reduce((d,m)=>m.semitones>d?m.semitones:d,0);for(let d=n;d<=r-f;d+=1)if((!s.onlyScale||a.has(d%12))&&(!o.allowed||o.allowed.has(d%12))){const m=Hn(d,t.scale,o.intervals);c.push({...o,rootNote:m[0].note,chord:`${m[0].note}${o.suffixes[0]}`,notes:m})}return c});super(e,i,t),this.played=new Set,this.opts=s}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${Wn(e)}${e.chord.toLowerCase()}`,notes:[]},s=this.current.chord===t.chord;return this.addGuessed(t,s)}guess(){const e=Array.from(this.played.values()).map(n=>qn(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},s=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,s)}}const Jn={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 jt extends bs{constructor(e,t){const s=e==="keys-major"?"major":"minor";super(e,Object.keys(Jn[s]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class It extends bs{constructor(e,t){const s=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-s+1)).map((r,a)=>s+a),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const ln={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},bt=Be("waiting"),dt=ht(Be(ln),{key:"game-options"}),yt=Be(void 0),ys=Be(Zl().map(l=>({...l,selected:!0}))),ke={play(...[l,e]){var o,c,f;let t;const s=ye(St),n=ye(gs),r=ye(dt),a={scale:s,range:n,duplicates:r.duplicates,count:r.count};let i=[s.key,s.scale];if(l==="notes")t=new It(l,a),me.setTarget([me.getNote(t.current)]),(o=ye(tt))==null||o.noteOn(t.current);else if(l==="pitches")t=new It(l,a),me.setTarget(),$e.setInputValue("useSound",!0),(c=ye(tt))==null||c.noteOn(t.current);else if(l==="keys-major"||l=="keys-minor")t=new jt(l,a),i=[t.current,l==="keys-major"?"major":"minor"];else if(l==="chords-play"||l==="chords-write")t=new ft(l,a,e);else if(l==="chords-diatonic"){const d=en(s.triads).map((m,b)=>({...m,allowed:new Set([s.scaleNotes[b].semitones])}));t=new ft(l,a,{chords:d})}else throw Error("Unknown game type: "+l);return typeof t.current!="number"&&typeof t.current!="string"&&((f=ye(tt))==null||f.playChord(t.current.notes.map(d=>d.midi)),me.setTarget(t.current.notes)),me.setKeyAndScale(i[0],i[1]),me.clearPlayed(),bt.set("waiting"),yt.set(t),t},updateState(l){bt.set(l)},setOptionValue(l,e){dt.update(t=>({...t,[l]:e}))},toggleChords(l){ys.update(e=>e.map(t=>({...t,selected:l(t)})))},nextGuess(){var e,t;const l=ye(yt);l!=null&&l.ended?bt.set("ended"):l instanceof It?(l.type==="notes"?me.setTarget([me.getNote(l.current)]):me.setTarget(),me.clearPlayed(),(e=ye(tt))==null||e.noteOn(l.current),ke.updateState("waiting"),l.startTime()):l instanceof ft?(me.setTarget(l.current.notes),me.clearPlayed(),(t=ye(tt))==null||t.playChord(l==null?void 0:l.current.notes.map(s=>s.midi)),bt.set("waiting"),l.startTime()):l instanceof jt&&(me.setKey(l.current),bt.set("waiting"),l.startTime())},clearGame(l=!1){const e=ye(yt);e&&me.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),l&&dt.set(ln),yt.set(void 0),bt.set("waiting"),me.clearScore()}};function Ks(l,e,t){const s=l.slice();return s[25]=e[t],s[27]=t,s}function xs(l,e,t){const s=l.slice();return s[30]=e[t],s}function Rs(l,e,t){const s=l.slice();return s[8]=e[t],s}function Fs(l,e,t){const s=l.slice();return s[25]=e[t],s[27]=t,s}function $s(l,e,t){const s=l.slice();return s[30]=e[t],s}function Hs(l,e,t){const s=l.slice();return s[8]=e[t],s}function Yn(l){let e,t=se(l[25].intervals),s=[];for(let n=0;n0?Qn:Yn}let N=E(l),I=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),_e(n.$$.fragment),r=j(),a=p("div"),o=J(i),c=j(),f=p("li"),I.c(),m=j(),b=p("li"),T=J(g),this.h()},l(L){e=v(L,"LI",{});var M=S(e);t=v(M,"BUTTON",{class:!0});var w=S(t);s=v(w,"SPAN",{class:!0});var G=S(s);pe(n.$$.fragment,G),G.forEach(_),r=P(w),a=v(w,"DIV",{class:!0});var C=S(a);o=Y(C,i),C.forEach(_),w.forEach(_),M.forEach(_),c=P(L),f=v(L,"LI",{class:!0,title:!0});var k=S(f);I.l(k),k.forEach(_),m=P(L),b=v(L,"LI",{class:!0});var A=S(b);T=Y(A,g),A.forEach(_),this.h()},h(){h(s,"class","px-1 py-1 rounded"),q(s,"text-green-500",l[25].selected),q(s,"text-gray-400",!l[25].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),q(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[25].intervals.map(Zs).join("-")),h(b,"class","text-xs")},m(L,M){K(L,e,M),u(e,t),u(t,s),ve(n,s,null),u(t,r),u(t,a),u(a,o),K(L,c,M),K(L,f,M),I.m(f,null),K(L,m,M),K(L,b,M),u(b,T),y=!0,D||(O=$(t,"click",V),D=!0)},p(L,M){l=L;const w={};M[0]&64&&(w.icon=l[25].selected?Jt:Yt),n.$set(w),(!y||M[0]&64)&&q(s,"text-green-500",l[25].selected),(!y||M[0]&64)&&q(s,"text-gray-400",!l[25].selected),(!y||M[0]&64)&&i!==(i=l[25].suffixes[0]+"")&&ae(o,i),(!y||M[0]&128)&&q(t,"hidden",l[7]),N===(N=E(l))&&I?I.p(l,M):(I.d(1),I=N(l),I&&(I.c(),I.m(f,null))),(!y||M[0]&64&&d!==(d=l[25].intervals.map(Zs).join("-")))&&h(f,"title",d),(!y||M[0]&64)&&g!==(g=l[25].name+"")&&ae(T,g)},i(L){y||(F(n.$$.fragment,L),y=!0)},o(L){W(n.$$.fragment,L),y=!1},d(L){L&&(_(e),_(c),_(f),_(m),_(b)),ge(n),I.d(),D=!1,O()}}}function Xn(l){let e,t=se(l[25].intervals),s=[];for(let n=0;n0?Zn:Xn}let N=E(l),I=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),_e(n.$$.fragment),r=j(),a=p("div"),o=J(i),c=j(),f=p("li"),I.c(),m=j(),b=p("li"),T=J(g),this.h()},l(L){e=v(L,"LI",{});var M=S(e);t=v(M,"BUTTON",{class:!0});var w=S(t);s=v(w,"SPAN",{class:!0});var G=S(s);pe(n.$$.fragment,G),G.forEach(_),r=P(w),a=v(w,"DIV",{class:!0});var C=S(a);o=Y(C,i),C.forEach(_),w.forEach(_),M.forEach(_),c=P(L),f=v(L,"LI",{class:!0,title:!0});var k=S(f);I.l(k),k.forEach(_),m=P(L),b=v(L,"LI",{class:!0});var A=S(b);T=Y(A,g),A.forEach(_),this.h()},h(){h(s,"class","px-1 py-1 rounded"),q(s,"text-green-500",l[25].selected),q(s,"text-gray-400",!l[25].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),q(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[25].intervals.map(el).join("-")),h(b,"class","text-xs")},m(L,M){K(L,e,M),u(e,t),u(t,s),ve(n,s,null),u(t,r),u(t,a),u(a,o),K(L,c,M),K(L,f,M),I.m(f,null),K(L,m,M),K(L,b,M),u(b,T),y=!0,D||(O=$(t,"click",V),D=!0)},p(L,M){l=L;const w={};M[0]&32&&(w.icon=l[25].selected?Jt:Yt),n.$set(w),(!y||M[0]&32)&&q(s,"text-green-500",l[25].selected),(!y||M[0]&32)&&q(s,"text-gray-400",!l[25].selected),(!y||M[0]&32)&&i!==(i=l[25].suffixes[0]+"")&&ae(o,i),(!y||M[0]&128)&&q(t,"hidden",l[7]),N===(N=E(l))&&I?I.p(l,M):(I.d(1),I=N(l),I&&(I.c(),I.m(f,null))),(!y||M[0]&32&&d!==(d=l[25].intervals.map(el).join("-")))&&h(f,"title",d),(!y||M[0]&32)&&g!==(g=l[25].name+"")&&ae(T,g)},i(L){y||(F(n.$$.fragment,L),y=!0)},o(L){W(n.$$.fragment,L),y=!1},d(L){L&&(_(e),_(c),_(f),_(m),_(b)),ge(n),I.d(),D=!1,O()}}}function ea(l){let e,t,s,n,r="Chords",a,i,o,c,f,d,m,b,g,T,y,D,O,V,E,N,I,L="Key",M,w,G,C,k="Scale",A,B,U,R,z="Note",le,te,de,ue,Ne,Re,Ge,be,We,xe;c=new rt({props:{icon:bn,width:20}}),m=new rt({props:{icon:yn,width:16}}),T=new rt({props:{icon:l[4]?js:Ps,width:16}}),O=new rt({props:{icon:Yl,width:16}});let Le=se(l[6]),re=[];for(let x=0;xW(re[x],1,1,()=>{re[x]=null});let he=se(l[5]),Q=[];for(let x=0;xW(Q[x],1,1,()=>{Q[x]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("button"),_e(c.$$.fragment),f=j(),d=p("button"),_e(m.$$.fragment),b=j(),g=p("button"),_e(T.$$.fragment),y=j(),D=p("button"),_e(O.$$.fragment),V=j(),E=p("div"),N=p("div"),I=p("label"),I.textContent=L,M=j(),w=p("input"),G=j(),C=p("label"),C.textContent=k,A=j(),B=p("input"),U=j(),R=p("label"),R.textContent=z,le=j(),te=p("input"),de=j(),ue=p("ul");for(let x=0;xl.interval,el=l=>l.interval;function ta(l,e,t){let s,n,r,a,i,o;oe(l,ys,C=>t(20,i=C));let c="C",f=Qt(c,Xs),d="",m,b=[],g=[];const T=ht(Be(!0),{key:"chords-hidden"});oe(l,T,C=>t(7,o=C));function y(){T.update(C=>!C)}function D(){const C=m&&60+m.semitones;if("err"in f||!C)t(2,b=[]),t(3,g=[]);else{const k=f.data;t(2,b=n.map(A=>us(C,k,A.intervals))),t(3,g=r.map(A=>us(C,k,A.intervals)))}}function O({currentTarget:{value:C}}){t(0,c=`${C.charAt(0).toUpperCase()}${C.charAt(1).toLowerCase()}`),f=Qt(c,Xs),D()}function V({currentTarget:{value:C}}){t(1,d=`${C.charAt(0).toUpperCase()}${C.charAt(1).toLowerCase()}`),t(8,m=sn(d)),D()}function E(C){ke.toggleChords(k=>k.name===C.name?!k.selected:k.selected)}function N(){const C=A=>A.suffixes[0]==="maj"||A.suffixes[0]==="m",k=i.filter(C).every(A=>A.selected);ke.toggleChords(A=>C(A)?!k:A.selected)}function I(){const C=A=>A.suffixes[0]==="maj7"||A.suffixes[0]==="m7"||A.suffixes[0]==="7"||A.suffixes[0]==="dim7"||A.suffixes[0]==="aug7",k=i.filter(C).every(A=>A.selected);ke.toggleChords(A=>C(A)?!k:A.selected)}function L(){ke.toggleChords(C=>!a)}function M(){ke.toggleChords(C=>!0)}const w=C=>E(C),G=C=>E(C);return l.$$set=C=>{t(18,e=Ee(Ee({},e),we(C)))},l.$$.update=()=>{l.$$.dirty[0]&1048576&&t(19,s=i),l.$$.dirty[0]&524288&&t(6,n=s.filter((C,k)=>kk>=s.length/2)),l.$$.dirty[0]&524288&&t(4,a=s.every(C=>C.selected))},e=we(e),[c,d,b,g,a,r,n,o,m,T,y,O,V,E,N,I,L,M,e,s,i,w,G]}class sa extends He{constructor(e){super(),ze(this,e,ta,ea,qe,{},null,[-1,-1])}}function tl(l,e,t){const s=l.slice();return s[10]=e[t],s}function la(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function na(l){let e,t,s="Played:",n,r=se(l[2]),a=[];for(let i=0;i0?na:la}let a=r(l),i=a(l);function o(d,m){return d[0]&&d[1]==="ended"?da:d[0]&&d[3].autoplay?fa:d[0]?ua:ca}let c=o(l),f=c(l);return{c(){e=p("div"),i.c(),s=j(),n=p("div"),f.c(),this.h()},l(d){e=v(d,"DIV",{class:!0});var m=S(e);i.l(m),m.forEach(_),s=P(d),n=v(d,"DIV",{class:!0});var b=S(n);f.l(b),b.forEach(_),this.h()},h(){h(e,"class",t=Ie(`${l[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),h(n,"class","mt-2 h-8")},m(d,m){K(d,e,m),i.m(e,null),K(d,s,m),K(d,n,m),f.m(n,null)},p(d,[m]){a===(a=r(d))&&i?i.p(d,m):(i.d(1),i=a(d),i&&(i.c(),i.m(e,null))),m&256&&t!==(t=Ie(`${d[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs")&&h(e,"class",t),c===(c=o(d))&&f?f.p(d,m):(f.d(1),f=c(d),f&&(f.c(),f.m(n,null)))},i:fe,o:fe,d(d){d&&(_(e),_(s),_(n)),i.d(),f.d()}}}const ll=l=>l.note,nl=l=>l.note;function ma(l,e,t){let s,n,r;oe(l,bt,m=>t(1,s=m)),oe(l,gt,m=>t(2,n=m)),oe(l,dt,m=>t(3,r=m));let{game:a}=e;function i(){ke.nextGuess()}function o(){ke.setOptionValue("autoplay",!0),ke.nextGuess()}function c(){a instanceof ft?ke.play(a.type,a.opts):a&&ke.play(a.type,void 0)}function f(){ke.clearGame()}const d=()=>ke.setOptionValue("autoplay",!1);return l.$$set=m=>{t(8,e=Ee(Ee({},e),we(m))),"game"in m&&t(0,a=m.game)},e=we(e),[a,s,n,r,i,o,c,f,e,d]}class _a extends He{constructor(e){super(),ze(this,e,ma,ha,qe,{game:0})}}function al(l,e,t){const s=l.slice();return s[14]=e[t].key,s[15]=e[t].value,s[16]=e[t].icon,s[18]=t,s}const pa=l=>({}),rl=l=>({}),va=l=>({}),il=l=>({});function ol(l){let e,t,s,n,r,a,i,o,c,f;const d=l[11].header,m=Hl(d,l,l[10],rl);let b=se(l[0]),g=[];for(let y=0;yW(g[y],1,1,()=>{g[y]=null});return{c(){e=p("button"),s=j(),n=p("ul"),r=p("li"),m&&m.c(),a=j();for(let y=0;y{o&&(t||(t=$t(e,Ls,{duration:zt},!0)),t.run(1))}),F(m,y);for(let D=0;D{o&&(i||(i=$t(n,Ds,{duration:zt},!0)),i.run(1))}),o=!0}},o(y){y&&(t||(t=$t(e,Ls,{duration:zt},!1)),t.run(0)),W(m,y),g=g.filter(Boolean);for(let D=0;D{g[V]=null}),lt(),n=g[s],n?n.p(l,O):(n=g[s]=b[s](l),n.c()),F(n,1),n.m(t,r)),(!f||O&1)&&i!==(i=l[15]+"")&&ae(o,i),(!f||O&5)&&q(t,"selected",l[14]===l[2])},i(D){f||(F(n),f=!0)},o(D){W(n),f=!1},d(D){D&&_(e),g[s].d(),d=!1,m()}}}function ya(l){let e,t,s,n,r,a,i,o;const c=l[11].value,f=Hl(c,l,l[10],il);let d=l[5]&&ol(l);return{c(){e=p("div"),t=p("button"),f&&f.c(),r=j(),d&&d.c(),this.h()},l(m){e=v(m,"DIV",{class:!0,id:!0});var b=S(e);t=v(b,"BUTTON",{class:!0,title:!0});var g=S(t);f&&f.l(g),g.forEach(_),r=P(b),d&&d.l(b),b.forEach(_),this.h()},h(){h(t,"class",s=Ie(`${l[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),h(t,"title",n=l[8].title||""),q(t,"disabled",l[3]),q(t,"open",l[5]),h(e,"class","relative"),h(e,"id",l[1])},m(m,b){K(m,e,b),u(e,t),f&&f.m(t,null),u(e,r),d&&d.m(e,null),l[13](e),a=!0,i||(o=$(t,"click",l[6]),i=!0)},p(m,[b]){f&&f.p&&(!a||b&1024)&&zl(f,c,m,m[10],a?Wl(c,m[10],b,va):ql(m[10]),il),(!a||b&256&&s!==(s=Ie(`${m[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&h(t,"class",s),(!a||b&256&&n!==(n=m[8].title||""))&&h(t,"title",n),(!a||b&264)&&q(t,"disabled",m[3]),(!a||b&288)&&q(t,"open",m[5]),m[5]?d?(d.p(m,b),b&32&&F(d,1)):(d=ol(m),d.c(),F(d,1),d.m(e,null)):d&&(st(),W(d,1,1,()=>{d=null}),lt()),(!a||b&2)&&h(e,"id",m[1])},i(m){a||(F(f,m),F(d),a=!0)},o(m){W(f,m),W(d),a=!1},d(m){m&&_(e),f&&f.d(m),d&&d.d(),l[13](null),i=!1,o()}}}const zt=400;function ka(l,e,t){let{$$slots:s={},$$scope:n}=e,{options:r,id:a=void 0,selected:i=void 0,disabled:o=void 0,onSelect:c}=e,f,d=!1;function m(){o||t(5,d=!d)}function b(y){t(5,d=c(y))}const g=y=>b(y);function T(y){mn[y?"unshift":"push"](()=>{f=y,t(4,f)})}return l.$$set=y=>{t(8,e=Ee(Ee({},e),we(y))),"options"in y&&t(0,r=y.options),"id"in y&&t(1,a=y.id),"selected"in y&&t(2,i=y.selected),"disabled"in y&&t(3,o=y.disabled),"onSelect"in y&&t(9,c=y.onSelect),"$$scope"in y&&t(10,n=y.$$scope)},e=we(e),[r,a,i,o,f,d,m,b,e,c,n,s,g,T]}class nn extends He{constructor(e){super(),ze(this,e,ka,ya,qe,{options:0,id:1,selected:2,disabled:3,onSelect:9})}}function ul(l){let e;return{c(){e=p("li"),this.h()},l(t){e=v(t,"LI",{class:!0}),S(e).forEach(_),this.h()},h(){h(e,"class","m-[0.175rem] mr-0")},m(t,s){K(t,e,s)},d(t){t&&_(e)}}}function fl(l){let e;return{c(){e=p("div"),this.h()},l(t){e=v(t,"DIV",{class:!0}),S(e).forEach(_),this.h()},h(){h(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-jvhfju")},m(t,s){K(t,e,s)},d(t){t&&_(e)}}}function dl(l){let e,t=l[0].note.note+"",s;return{c(){e=p("div"),s=J(t),this.h()},l(n){e=v(n,"DIV",{class:!0});var r=S(e);s=Y(r,t),r.forEach(_),this.h()},h(){h(e,"class","absolute top-0 left-0")},m(n,r){K(n,e,r),u(e,s)},p(n,r){r&1&&t!==(t=n[0].note.note+"")&&ae(s,t)},d(n){n&&_(e)}}}function Ea(l){let e,t,s,n,r,a,i=l[0].key+"",o,c,f,d,m=l[0].key==="{enter}"&&ul(),b=l[0].key==="{enter}"&&fl(),g=l[0].note&&dl(l);return{c(){m&&m.c(),e=j(),t=p("li"),s=p("button"),b&&b.c(),n=j(),g&&g.c(),r=j(),a=p("div"),o=J(i),this.h()},l(T){m&&m.l(T),e=P(T),t=v(T,"LI",{class:!0});var y=S(t);s=v(y,"BUTTON",{class:!0});var D=S(s);b&&b.l(D),n=P(D),g&&g.l(D),r=P(D),a=v(D,"DIV",{});var O=S(a);o=Y(O,i),O.forEach(_),D.forEach(_),y.forEach(_),this.h()},h(){h(s,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex items-center justify-center svelte-jvhfju"),h(t,"class",c=Ie(`${l[1].class||""} m-[0.175rem] ${hl(l[0].size)}`)+" svelte-jvhfju"),q(t,"enter",l[0].key==="{enter}")},m(T,y){m&&m.m(T,y),K(T,e,y),K(T,t,y),u(t,s),b&&b.m(s,null),u(s,n),g&&g.m(s,null),u(s,r),u(s,a),u(a,o),f||(d=$(s,"click",l[2]),f=!0)},p(T,[y]){T[0].key==="{enter}"?m||(m=ul(),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),T[0].key==="{enter}"?b||(b=fl(),b.c(),b.m(s,n)):b&&(b.d(1),b=null),T[0].note?g?g.p(T,y):(g=dl(T),g.c(),g.m(s,r)):g&&(g.d(1),g=null),y&1&&i!==(i=T[0].key+"")&&ae(o,i),y&3&&c!==(c=Ie(`${T[1].class||""} m-[0.175rem] ${hl(T[0].size)}`)+" svelte-jvhfju")&&h(t,"class",c),y&3&&q(t,"enter",T[0].key==="{enter}")},i:fe,o:fe,d(T){T&&(_(e),_(t)),m&&m.d(T),b&&b.d(),g&&g.d(),f=!1,d()}}}function hl(l){return l&&Number.isInteger(l)?`size-${l}`:l?`size-${Math.floor(l)}-${Math.floor(l*10)-Math.floor(l)*10}`:"size-1"}function wa(l,e,t){let{value:s}=e;function n(r){ps.call(this,l,r)}return l.$$set=r=>{t(1,e=Ee(Ee({},e),we(r))),"value"in r&&t(0,s=r.value)},e=we(e),[s,e,n]}class Ca extends He{constructor(e){super(),ze(this,e,wa,Ea,qe,{value:0})}}const ms={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(()=>Aa)},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 an(l){if(!("default"in l.layout)||!("shift"in l.layout))throw console.error(l),Error("Invalid layout import");return{default:l.layout.default,shift:l.layout.shift}}async function rn(l=["en"]){let e={code:"en",layout:ms.en,index:99};Object.entries(ms).forEach(([s,n])=>{for(let r=0;rr)&&(e={code:s,layout:n,index:r})});const t=await e.layout.import;return{code:e.code,name:e.layout.name,imported:an(t.default)}}const on={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}"]}},Aa=Object.freeze(Object.defineProperty({__proto__:null,default:on},Symbol.toStringTag,{value:"Module"}));function Ta(l,e){return l[1].forEach((t,s)=>{let n;s===2?n={...e[1]}:s===3?n={...e[3]}:s===5?n={...e[6]}:s===6?n={...e[8]}:s===7?n={...e[10]}:s===9?(n={...e[1]},n.semitones+=12):s===10&&(n={...e[3]},n.semitones+=12),l[1][s].note=n}),l[2].forEach((t,s)=>{let n;s===1?n={...e[0]}:s===2?n={...e[2]}:s===3?n={...e[4]}:s===4?n={...e[5]}:s===5?n={...e[7]}:s===6?n={...e[9]}:s===7?n={...e[11]}:s===8?(n={...e[0]},n.semitones+=12):s===9?(n={...e[2]},n.semitones+=12):s===10?(n={...e[4]},n.semitones+=12):s===11?(n={...e[5]},n.semitones+=12):s===12&&(n={...e[7]},n.semitones+=12),l[2][s].note=n}),l}const qt=[["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 Ia(l){let e=[];const t=l.default.map((s,n)=>{if(n===0){const r=s.split(" ").filter(a=>a!=="{bksp}");for(;r.length!==13;)r.length<13?r.push("{empty}"):r.shift();return[...r,"{bksp}"]}else if(n===1){const r=s.split(" ");return e=r.slice(13),[...r.slice(0,13),"{enter}"]}else{if(n===2)return[...s.split(" ").slice(0,13).filter(r=>r!=="{enter}"),...e].slice(0,13);if(n===3){const r=["{shift}",...s.split(" ").slice(1,12).filter(i=>i!=="{shift}"),"{shift}"];let a=1;for(;r.length<13;)r.splice(a,0,"{empty}"),a=a===1?-1:1;return r}else return s.split(" ")}});return[t[0].map((s,n)=>({key:s,code:qt[0][n]})),t[1].map((s,n)=>({key:s,code:qt[1][n]})),t[2].map((s,n)=>({key:s,code:qt[2][n]})),t[3].map((s,n)=>({key:s,code:qt[3][n]}))]}class Sa{constructor(e){this.rows=[[],[],[],[]],this.opts={hotkeydRows:"middle-row",layout:{code:"en",name:"English",imported:an(on)},...e},this.setLayout(this.opts.layout.imported)}setOptions(e){this.opts={...this.opts,...e}}setLayout(e){this.rows=Ia(e)}setNotes(e){if(this.opts.hotkeydRows==="middle-row")this.rows=Ta(this.rows,e);else throw Error("not implemented")}}const ks=/^[a-gA-G]$/,cn=/^[♭Bb#♯sS]$/,Na=/^[0-9]$/;let H="",ut;const La={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}"]}},Es=ht(Be({layout:La,hotkeydRows:"middle-row"}),{key:"keyboard-options"}),un=Nt([St,Es],([l,e])=>{const t=new Sa(e);return t.setNotes(Array.from(l.notesMap.values())),t}),Da=Nt(un,l=>l.rows.map(e=>e.map((t,s)=>{let n;return t.key==="{bksp}"?n=2:t.key==="{tab}"?n=1.5:t.key==="{enter}"?n=2:t.key==="{lock}"?n=1.75:t.key==="{shift}"&&s===0?n=1.5:t.key==="{shift}"&&(n=2.5),n?{...t,size:n}:t}))),es=Nt(un,l=>new Map([...l.rows[0].map(e=>[e.code,e]),...l.rows[1].map(e=>[e.code,e]),...l.rows[2].map(e=>[e.code,e]),...l.rows[3].map(e=>[e.code,e])])),ja=Nt(es,l=>Array.from(l.values()).map(e=>e.note).filter(e=>e!==void 0));function Pa(l,e){const{useHotkeys:t}=ye(nt),s=ye(es).get(l);if(t&&H.length===0&&s&&s.note)return H="",{e:"guessed-key",data:s.note.note};if(!t&&H.length===0&&ks.test(e))return H+=e.toUpperCase(),{e:"string",data:H};if(!t&&H.length>0&&cn.test(e))return e==="b"||e==="B"?H+="♭":H+="♯",{e:"string",data:H};if(l==="Backspace"&&H.length>0)return H=H.slice(0,-1),{e:"string",data:H};if(l==="Enter"&&H.length>0){const n=H;return H="",{e:"guessed-key",data:n}}return!1}function Va(l,e){if(l==="Enter"&&H.length>0){const t={note:"",flats:0,sharps:0,chord:""};for(let s=0;s0?t.chord+=H[s].toLowerCase():H[s]==="♭"?(t.note+=H[s],t.flats+=1):H[s]==="♯"?(t.note+=H[s],t.sharps+=1):t.chord+=H[s].toLowerCase();return H="",{e:"guessed-chord",data:t}}else{if(l==="Backspace"&&H.length>0)return H=H.slice(0,-1),{e:"string",data:H};if(H.length===0&&ks.test(e))return H+=e.toUpperCase(),{e:"string",data:H};if(H.length>0&&e.length===1)return H.length===1&&(e==="b"||e==="B")?H+="♭":H.length===1&&e==="#"?H+="♯":H+=e,{e:"string",data:H}}return!1}function Oa(l,e,t){const{useAutoOctave:s,useHotkeys:n}=ye(nt);let r;const i=ye(es).get(l),o=(i==null?void 0:i.key)||"";let c=!1;if(!ut&&n&&(i!=null&&i.note)?(ut=i.note,s&&(r=tn(ye(Zt)[0].midi)),c="note"):!n&&H.length===0&&ks.test(e)?(H+=e.toUpperCase(),c="input"):!n&&H.length>0&&cn.test(e)&&(e==="b"||e==="B"?H+="♭":H+="♯",c="input"),Na.test(o))try{r=parseInt(o)}catch{}if(ut&&r!==void 0){const f=ut.semitones+(r+1+(t?1:0))*12;return ut=void 0,{e:"guessed-note",data:f}}else if(H&&r!==void 0){const f=ws.findNote(H),d=f?f.semitones+(r+1)*12:void 0;return ut=void 0,H="",d!==void 0?{e:"guessed-note",data:d}:{e:"string",data:H}}else if(l==="Backspace"&&(ut||H.length>0))return ut=void 0,H=H.slice(0,-1),{e:"string",data:H};return c==="note"?{e:"note",data:ut}:c==="input"?{e:"string",data:H}:!1}const ws={async setLayout(l){const e=await rn([l]);Es.update(t=>({...t,layout:e}))},findNote(l){return ye(ja).find(e=>{if(e.note.charAt(0)===l.charAt(0)){const t=l.slice(1).split("").reduce((s,n)=>s+(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}})},handleInput(l,e,t=!1){const s=ye(yt);return s instanceof jt?Pa(l,e.toUpperCase()):s instanceof ft&&s.type==="chords-write"?Va(l,e):ye(nt).useKeyboard?Oa(l,e.toUpperCase(),t):!1}};function ml(l,e,t){const s=l.slice();return s[10]=e[t],s[12]=t,s}function _l(l,e,t){const s=l.slice();return s[13]=e[t],s}function Ba(l){let e,t=l[2].layout.name+"",s;return{c(){e=p("div"),s=J(t),this.h()},l(n){e=v(n,"DIV",{slot:!0});var r=S(e);s=Y(r,t),r.forEach(_),this.h()},h(){h(e,"slot","value")},m(n,r){K(n,e,r),u(e,s)},p(n,r){r&4&&t!==(t=n[2].layout.name+"")&&ae(s,t)},d(n){n&&_(e)}}}function pl(l){let e,t;return e=new Ca({props:{value:l[13]}}),{c(){_e(e.$$.fragment)},l(s){pe(e.$$.fragment,s)},m(s,n){ve(e,s,n),t=!0},p(s,n){const r={};n&8&&(r.value=s[13]),e.$set(r)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){W(e.$$.fragment,s),t=!1},d(s){ge(e,s)}}}function vl(l){let e,t,s,n,r=se(l[10]),a=[];for(let o=0;oW(a[o],1,1,()=>{a[o]=null});return{c(){e=p("li"),t=j();for(let o=0;oW(k[B],1,1,()=>{k[B]=null});return{c(){e=p("div"),t=p("div"),s=p("div"),n=p("label"),n.textContent=r,a=j(),_e(i.$$.fragment),o=j(),c=p("div"),f=p("label"),f.textContent=d,m=j(),b=p("input"),g=j(),T=p("div"),y=p("label"),y.textContent=D,O=j(),V=p("input"),E=j(),N=p("div"),I=p("ul");for(let B=0;Bt(9,s=m)),oe(l,Es,m=>t(2,n=m)),oe(l,Da,m=>t(3,r=m)),Jl(async()=>{console.log(s);const m=await rn(["sw"]);console.log(m),window.layout=m});let a=!0,i=!1;const o=Object.entries(ms).map(([m,b])=>({key:m,value:b.name}));function c(m){return console.log("key ",m),ws.setLayout(m),!1}function f(){a=this.checked,t(0,a)}function d(){i=this.checked,t(1,i)}return l.$$set=m=>{t(6,e=Ee(Ee({},e),we(m)))},e=we(e),[a,i,n,r,o,c,e,f,d]}class Ua extends He{constructor(e){super(),ze(this,e,Ma,Ga,qe,{})}}function gl(l){let e,t;return e=new Ua({props:{class:"mt-4"}}),{c(){_e(e.$$.fragment)},l(s){pe(e.$$.fragment,s)},m(s,n){ve(e,s,n),t=!0},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){W(e.$$.fragment,s),t=!1},d(s){ge(e,s)}}}function Ka(l){let e,t,s,n,r="I/O",a,i,o,c,f="Device",d,m,b,g,T,y,D="Prompt",O,V,E="Disable",N,I,L,M,w="Sound",G,C,k,A,B,U,R="Fixed velocity",z,le,te,de,ue,Ne,Re="Keyboard",Ge,be,We,xe,Le,re,Se="Hotkeys",he,Q,ne,x,X,ce,ee="Auto-octave",Ce,Ve,at,Je,Me,De,Ae,Lt="Set hotkeys",Et,Ue,mt,Cs="Fade timeout",ts,ot,ss,_t,Pt,ls,pt,As="Reset all",ns,Vt,Ye,as,Ts,Oe=l[2]&&gl();return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("div"),c=p("label"),c.textContent=f,d=j(),m=p("input"),g=j(),T=p("div"),y=p("button"),y.textContent=D,O=j(),V=p("button"),V.textContent=E,N=j(),I=p("div"),L=p("div"),M=p("label"),M.textContent=w,G=j(),C=p("input"),A=j(),B=p("div"),U=p("label"),U.textContent=R,z=j(),le=p("input"),te=j(),de=p("div"),ue=p("div"),Ne=p("label"),Ne.textContent=Re,Ge=j(),be=p("input"),xe=j(),Le=p("div"),re=p("label"),re.textContent=Se,he=j(),Q=p("input"),x=j(),X=p("div"),ce=p("label"),ce.textContent=ee,Ce=j(),Ve=p("input"),Je=j(),Me=p("div"),De=p("div"),Ae=p("button"),Ae.textContent=Lt,Et=j(),Ue=p("div"),mt=p("label"),mt.textContent=Cs,ts=j(),ot=p("input"),ss=j(),_t=p("div"),Pt=p("div"),ls=j(),pt=p("button"),pt.textContent=As,ns=j(),Oe&&Oe.c(),this.h()},l(Te){e=v(Te,"DIV",{class:!0});var Ke=S(e);t=v(Ke,"FIELDSET",{class:!0});var ct=S(t);s=v(ct,"LEGEND",{class:!0});var Is=S(s);n=v(Is,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(n)!=="svelte-1jbbsti"&&(n.textContent=r),Is.forEach(_),a=P(ct),i=v(ct,"DIV",{class:!0});var vt=S(i);o=v(vt,"DIV",{class:!0});var wt=S(o);c=v(wt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(c)!=="svelte-crpa7y"&&(c.textContent=f),d=P(wt),m=v(wt,"INPUT",{class:!0,id:!0}),g=P(wt),T=v(wt,"DIV",{class:!0});var Ot=S(T);y=v(Ot,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(y)!=="svelte-mj6mct"&&(y.textContent=D),O=P(Ot),V=v(Ot,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(V)!=="svelte-1sl6oxh"&&(V.textContent=E),Ot.forEach(_),wt.forEach(_),N=P(vt),I=v(vt,"DIV",{class:!0});var Bt=S(I);L=v(Bt,"DIV",{class:!0});var Gt=S(L);M=v(Gt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(M)!=="svelte-wgxtkw"&&(M.textContent=w),G=P(Gt),C=v(Gt,"INPUT",{class:!0,id:!0,type:!0}),Gt.forEach(_),A=P(Bt),B=v(Bt,"DIV",{class:!0});var Mt=S(B);U=v(Mt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(U)!=="svelte-1tm2bth"&&(U.textContent=R),z=P(Mt),le=v(Mt,"INPUT",{class:!0,id:!0,placeholder:!0}),Mt.forEach(_),Bt.forEach(_),te=P(vt),de=v(vt,"DIV",{class:!0});var Ct=S(de);ue=v(Ct,"DIV",{class:!0});var Ut=S(ue);Ne=v(Ut,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(Ne)!=="svelte-1js269u"&&(Ne.textContent=Re),Ge=P(Ut),be=v(Ut,"INPUT",{class:!0,id:!0,type:!0}),Ut.forEach(_),xe=P(Ct),Le=v(Ct,"DIV",{class:!0});var Kt=S(Le);re=v(Kt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(re)!=="svelte-21h39k"&&(re.textContent=Se),he=P(Kt),Q=v(Kt,"INPUT",{class:!0,id:!0,type:!0}),Kt.forEach(_),x=P(Ct),X=v(Ct,"DIV",{class:!0});var xt=S(X);ce=v(xt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(ce)!=="svelte-33lczu"&&(ce.textContent=ee),Ce=P(xt),Ve=v(xt,"INPUT",{class:!0,id:!0,type:!0}),xt.forEach(_),Ct.forEach(_),Je=P(vt),Me=v(vt,"DIV",{class:!0});var At=S(Me);De=v(At,"DIV",{class:!0});var Ss=S(De);Ae=v(Ss,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(Ae)!=="svelte-1v9okg9"&&(Ae.textContent=Lt),Ss.forEach(_),Et=P(At),Ue=v(At,"DIV",{class:!0});var Rt=S(Ue);mt=v(Rt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(mt)!=="svelte-vd5i27"&&(mt.textContent=Cs),ts=P(Rt),ot=v(Rt,"INPUT",{class:!0,id:!0}),Rt.forEach(_),ss=P(At),_t=v(At,"DIV",{class:!0});var Ft=S(_t);Pt=v(Ft,"DIV",{}),S(Pt).forEach(_),ls=P(Ft),pt=v(Ft,"BUTTON",{class:!0,"data-svelte-h":!0}),Z(pt)!=="svelte-jjt0c3"&&(pt.textContent=As),Ft.forEach(_),At.forEach(_),vt.forEach(_),ns=P(ct),Oe&&Oe.l(ct),ct.forEach(_),Ke.forEach(_),this.h()},h(){var Te;h(n,"class","px-1 rounded hover:bg-gray-100"),h(s,"class","text-base"),h(c,"class","font-bold"),h(c,"for","device"),h(m,"class","px-1 my-1 rounded w-50"),h(m,"id","device"),m.disabled=!0,m.value=b=((Te=l[5])==null?void 0:Te.name)??"No device",h(y,"class","btn-sm primary mr-2"),h(V,"class","btn-sm primary"),h(T,"class","flex my-[auto]"),h(o,"class","h-full flex flex-col"),h(M,"class","font-bold"),h(M,"for","sound"),h(C,"class","h-[20px]"),h(C,"id","sound"),h(C,"type","checkbox"),C.checked=k=l[3].useSound,h(L,"class","my-1 flex justify-between mr-12"),h(U,"class","font-bold"),h(U,"for","fixed-velocity"),h(le,"class","h-[20px] w-16"),h(le,"id","fixed-velocity"),h(le,"placeholder","0-127"),h(B,"class","flex justify-between"),h(I,"class","flex flex-col h-full"),h(Ne,"class","font-bold"),h(Ne,"for","keyboard"),h(be,"class","h-[20px]"),h(be,"id","keyboard"),h(be,"type","checkbox"),be.checked=We=l[3].useKeyboard,h(ue,"class","my-1 flex justify-between mr-12"),h(re,"class","font-bold"),h(re,"for","hotkeys"),h(Q,"class","h-[20px]"),h(Q,"id","hotkeys"),h(Q,"type","checkbox"),Q.checked=ne=l[3].useHotkeys,h(Le,"class","my-1 flex justify-between mr-12"),h(ce,"class","font-bold"),h(ce,"for","auto-octave"),h(Ve,"class","h-[20px]"),h(Ve,"id","auto-octave"),h(Ve,"type","checkbox"),Ve.checked=at=l[3].useAutoOctave,h(X,"class","my-1 flex justify-between mr-12"),h(de,"class","flex flex-col h-full"),h(Ae,"class","w-full btn-sm primary"),h(De,"class","flex justify-between"),h(mt,"class","font-bold"),h(mt,"for","fade-timeout"),h(ot,"class","h-[20px] w-16"),h(ot,"id","fade-timeout"),ot.value=l[1],h(Ue,"class","flex justify-between"),h(pt,"class","btn-sm primary"),h(_t,"class","flex justify-between"),h(Me,"class","flex flex-col justify-between h-full"),h(i,"class","body svelte-1bpw69s"),q(i,"hidden",l[4]),h(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm svelte-1bpw69s"),q(t,"collapsed",l[4]),h(e,"class",Vt=Ie(`${l[11].class||""}`)+" svelte-1bpw69s")},m(Te,Ke){K(Te,e,Ke),u(e,t),u(t,s),u(s,n),u(t,a),u(t,i),u(i,o),u(o,c),u(o,d),u(o,m),u(o,g),u(o,T),u(T,y),u(T,O),u(T,V),u(i,N),u(i,I),u(I,L),u(L,M),u(L,G),u(L,C),u(I,A),u(I,B),u(B,U),u(B,z),u(B,le),Qe(le,l[0]),u(i,te),u(i,de),u(de,ue),u(ue,Ne),u(ue,Ge),u(ue,be),u(de,xe),u(de,Le),u(Le,re),u(Le,he),u(Le,Q),u(de,x),u(de,X),u(X,ce),u(X,Ce),u(X,Ve),u(i,Je),u(i,Me),u(Me,De),u(De,Ae),u(Me,Et),u(Me,Ue),u(Ue,mt),u(Ue,ts),u(Ue,ot),u(Me,ss),u(Me,_t),u(_t,Pt),u(_t,ls),u(_t,pt),u(t,ns),Oe&&Oe.m(t,null),Ye=!0,as||(Ts=[$(n,"click",l[7]),$(y,"click",$e.openMidi),$(V,"click",$e.disableMidi),$(C,"change",l[12]),$(le,"input",l[13]),$(le,"change",l[8]),$(be,"change",l[14]),$(Q,"change",l[15]),$(Ve,"change",l[16]),$(Ae,"click",l[17]),$(ot,"input",l[9]),$(pt,"click",l[10])],as=!0)},p(Te,[Ke]){var ct;(!Ye||Ke&32&&b!==(b=((ct=Te[5])==null?void 0:ct.name)??"No device")&&m.value!==b)&&(m.value=b),(!Ye||Ke&8&&k!==(k=Te[3].useSound))&&(C.checked=k),Ke&1&&le.value!==Te[0]&&Qe(le,Te[0]),(!Ye||Ke&8&&We!==(We=Te[3].useKeyboard))&&(be.checked=We),(!Ye||Ke&8&&ne!==(ne=Te[3].useHotkeys))&&(Q.checked=ne),(!Ye||Ke&8&&at!==(at=Te[3].useAutoOctave))&&(Ve.checked=at),(!Ye||Ke&2&&ot.value!==Te[1])&&(ot.value=Te[1]),(!Ye||Ke&16)&&q(i,"hidden",Te[4]),Te[2]?Oe?Ke&4&&F(Oe,1):(Oe=gl(),Oe.c(),F(Oe,1),Oe.m(t,null)):Oe&&(st(),W(Oe,1,1,()=>{Oe=null}),lt()),(!Ye||Ke&16)&&q(t,"collapsed",Te[4]),(!Ye||Ke&2048&&Vt!==(Vt=Ie(`${Te[11].class||""}`)+" svelte-1bpw69s"))&&h(e,"class",Vt)},i(Te){Ye||(F(Oe),Ye=!0)},o(Te){W(Oe),Ye=!1},d(Te){Te&&_(e),Oe&&Oe.d(),as=!1,it(Ts)}}}function xa(l,e,t){let s,n,r;oe(l,nt,E=>t(3,s=E)),oe(l,Xt,E=>t(5,r=E));const a=ht(Be(!1),{key:"inputs-hidden"});oe(l,a,E=>t(4,n=E));let i=s.fixedVelocity??"",o=s.keyFadeTimeout,c=!1;nt.subscribe(E=>{t(0,i=E.fixedVelocity??""),t(1,o=E.keyFadeTimeout)});function f(){a.update(E=>!E)}function d(E){const{value:N}=E.currentTarget;let I;if(N)try{I=parseInt(N)}catch{}I!==void 0&&I>=0&&I<=127?$e.setInputValue("fixedVelocity",I):N?t(0,i=s.fixedVelocity||""):$e.setInputValue("fixedVelocity",void 0)}function m(E){try{const N=parseInt(E.currentTarget.value);$e.setInputValue("keyFadeTimeout",N)}catch{t(1,o=s.keyFadeTimeout)}}function b(){Mn()}const g=E=>$e.setInputValue("useSound",E.currentTarget.checked);function T(){i=this.value,t(0,i)}const y=E=>$e.setInputValue("useKeyboard",E.currentTarget.checked),D=E=>$e.setInputValue("useHotkeys",E.currentTarget.checked),O=E=>$e.setInputValue("useAutoOctave",E.currentTarget.checked),V=()=>t(2,c=!c);return l.$$set=E=>{t(11,e=Ee(Ee({},e),we(E)))},e=we(e),[i,o,c,s,n,r,a,f,d,m,b,e,g,T,y,D,O,V]}class Ra extends He{constructor(e){super(),ze(this,e,xa,Ka,qe,{})}}function Fa(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function $a(l){let e,t=l[1].note+"",s;return{c(){e=J("Input: "),s=J(t)},l(n){e=Y(n,"Input: "),s=Y(n,t)},m(n,r){K(n,e,r),K(n,s,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&ae(s,t)},d(n){n&&(_(e),_(s))}}}function Ha(l){let e,t;return{c(){e=J("Input: "),t=J(l[0])},l(s){e=Y(s,"Input: "),t=Y(s,l[0])},m(s,n){K(s,e,n),K(s,t,n)},p(s,n){n&1&&ae(t,s[0])},d(s){s&&(_(e),_(t))}}}function za(l){let e;return{c(){e=J(_s)},l(t){e=Y(t,_s)},m(t,s){K(t,e,s)},p:fe,d(t){t&&_(e)}}}function qa(l){let e,t,s,n;function r(o,c){return o[2].useKeyboard&&_s?za:o[2].useKeyboard&&o[0]?Ha:o[2].useKeyboard&&o[1]?$a:Fa}let a=r(l),i=a(l);return{c(){e=p("div"),i.c(),this.h()},l(o){e=v(o,"DIV",{class:!0});var c=S(e);i.l(c),c.forEach(_),this.h()},h(){h(e,"class",t=`${l[4].class||""}`)},m(o,c){K(o,e,c),i.m(e,null),s||(n=$(window,"keydown",l[3]),s=!0)},p(o,[c]){a===(a=r(o))&&i?i.p(o,c):(i.d(1),i=a(o),i&&(i.c(),i.m(e,null))),c&16&&t!==(t=`${o[4].class||""}`)&&h(e,"class",t)},i:fe,o:fe,d(o){o&&_(e),i.d(),s=!1,n()}}}let _s="";function Wa(l,e,t){let s;oe(l,nt,c=>t(2,s=c));let{debounced:n}=e,r="",a;const i=_n();function o(c){const f=c.target;if(n||!(f instanceof HTMLElement)||f.tagName==="INPUT")return;const d=ws.handleInput(c.code,c.key,c.shiftKey);d&&d.e==="note"?t(1,a=d.data):d&&d.e==="string"?t(0,r=d.data):d&&(t(0,r=""),t(1,a=void 0),i(d.e,d.data))}return l.$$set=c=>{t(4,e=Ee(Ee({},e),we(c))),"debounced"in c&&t(5,n=c.debounced)},e=we(e),[r,a,s,o,e,n]}class Ja extends He{constructor(e){super(),ze(this,e,Wa,qa,qe,{debounced:5})}}function Ya(l){let e,t,s,n="Count",r,a,i,o,c,f="Duplicates",d,m,b,g,T,y,D="Autoplay",O,V,E,N,I,L,M="Wait seconds",w,G,C,k,A;return{c(){e=p("ul"),t=p("li"),s=p("label"),s.textContent=n,r=j(),a=p("input"),i=j(),o=p("li"),c=p("label"),c.textContent=f,d=j(),m=p("input"),g=j(),T=p("li"),y=p("label"),y.textContent=D,O=j(),V=p("input"),N=j(),I=p("li"),L=p("label"),L.textContent=M,w=j(),G=p("input"),this.h()},l(B){e=v(B,"UL",{class:!0});var U=S(e);t=v(U,"LI",{class:!0});var R=S(t);s=v(R,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(s)!=="svelte-wgq9fc"&&(s.textContent=n),r=P(R),a=v(R,"INPUT",{class:!0,id:!0,type:!0}),R.forEach(_),i=P(U),o=v(U,"LI",{class:!0});var z=S(o);c=v(z,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(c)!=="svelte-hcg9dq"&&(c.textContent=f),d=P(z),m=v(z,"INPUT",{class:!0,id:!0,type:!0}),z.forEach(_),g=P(U),T=v(U,"LI",{class:!0});var le=S(T);y=v(le,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(y)!=="svelte-lr68n2"&&(y.textContent=D),O=P(le),V=v(le,"INPUT",{class:!0,id:!0,type:!0}),le.forEach(_),N=P(U),I=v(U,"LI",{class:!0});var te=S(I);L=v(te,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),Z(L)!=="svelte-1qj2vcy"&&(L.textContent=M),w=P(te),G=v(te,"INPUT",{class:!0,id:!0,type:!0}),te.forEach(_),U.forEach(_),this.h()},h(){h(s,"class","font-bold"),h(s,"for","guess-count"),h(a,"class","h-[20px] w-10"),h(a,"id","guess-count"),h(a,"type","number"),h(t,"class","flex items-center justify-between svelte-1elvih2"),h(c,"class","font-bold"),h(c,"for","duplicates"),h(m,"class","h-[20px]"),h(m,"id","duplicates"),h(m,"type","checkbox"),m.checked=b=l[2].duplicates,h(o,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(y,"class","font-bold"),h(y,"for","autoplay"),h(V,"class","h-[20px]"),h(V,"id","autoplay"),h(V,"type","checkbox"),V.checked=E=l[2].autoplay,h(T,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(L,"class","font-bold"),h(L,"for","wait-ms"),h(G,"class","h-[20px] w-10"),h(G,"id","wait-ms"),h(G,"type","number"),h(I,"class","flex items-center justify-between svelte-1elvih2"),h(e,"class",C=Ie(`${l[5].class||""}`)+" svelte-1elvih2")},m(B,U){K(B,e,U),u(e,t),u(t,s),u(t,r),u(t,a),Qe(a,l[0]),u(e,i),u(e,o),u(o,c),u(o,d),u(o,m),u(e,g),u(e,T),u(T,y),u(T,O),u(T,V),u(e,N),u(e,I),u(I,L),u(I,w),u(I,G),Qe(G,l[1]),k||(A=[$(a,"input",l[6]),$(a,"input",l[3]),$(m,"input",l[7]),$(V,"input",l[8]),$(G,"input",l[9]),$(G,"input",l[4])],k=!0)},p(B,[U]){U&1&&Wt(a.value)!==B[0]&&Qe(a,B[0]),U&4&&b!==(b=B[2].duplicates)&&(m.checked=b),U&4&&E!==(E=B[2].autoplay)&&(V.checked=E),U&2&&Wt(G.value)!==B[1]&&Qe(G,B[1]),U&32&&C!==(C=Ie(`${B[5].class||""}`)+" svelte-1elvih2")&&h(e,"class",C)},i:fe,o:fe,d(B){B&&_(e),k=!1,it(A)}}}function Qa(l,e,t){let s;oe(l,dt,m=>t(2,s=m));let n=s.count||"",r=s.waitSeconds||"";dt.subscribe(m=>{t(0,n=m.count||""),t(1,r=m.waitSeconds||"")});function a({currentTarget:{value:m}}){let b;try{b=parseInt(m),b<=0&&(b=1),ke.setOptionValue("count",b)}catch{t(0,n=s.count)}}function i({currentTarget:{value:m}}){let b;try{b=parseInt(m),b<0&&(b=0),ke.setOptionValue("waitSeconds",b)}catch{t(1,r=s.waitSeconds)}}function o(){n=Wt(this.value),t(0,n)}const c=m=>ke.setOptionValue("duplicates",m.currentTarget.checked),f=m=>ke.setOptionValue("autoplay",m.currentTarget.checked);function d(){r=Wt(this.value),t(1,r)}return l.$$set=m=>{t(5,e=Ee(Ee({},e),we(m)))},e=we(e),[n,r,s,a,i,e,o,c,f,d]}class Xa extends He{constructor(e){super(),ze(this,e,Qa,Ya,qe,{})}}function bl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function yl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function kl(l){let e,t,s=l[21]+"",n,r,a,i,o,c,f,d;function m(){return l[13](l[20])}i=new rt({props:{icon:cs,width:20}});function b(...g){return l[14](l[20],...g)}return{c(){e=p("li"),t=p("button"),n=J(s),r=j(),a=p("button"),_e(i.$$.fragment),o=j(),this.h()},l(g){e=v(g,"LI",{class:!0});var T=S(e);t=v(T,"BUTTON",{class:!0});var y=S(t);n=Y(y,s),y.forEach(_),r=P(T),a=v(T,"BUTTON",{class:!0});var D=S(a);pe(i.$$.fragment,D),D.forEach(_),o=P(T),T.forEach(_),this.h()},h(){h(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),q(t,"selected",l[20]===l[0]),h(a,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),h(e,"class","flex svelte-1okhpct")},m(g,T){K(g,e,T),u(e,t),u(t,n),u(e,r),u(e,a),ve(i,a,null),u(e,o),c=!0,f||(d=[$(t,"click",m),$(a,"click",b)],f=!0)},p(g,T){l=g,(!c||T&17)&&q(t,"selected",l[20]===l[0])},i(g){c||(F(i.$$.fragment,g),c=!0)},o(g){W(i.$$.fragment,g),c=!1},d(g){g&&_(e),ge(i),f=!1,it(d)}}}function El(l){let e,t=se(l[2]),s=[];for(let n=0;nW(G[A],1,1,()=>{G[A]=null});let k=(l[0]==="chords-write"||l[0]==="chords-play")&&El(l);return f=new Xa({props:{class:"game-options"}}),D=new rt({props:{class:"mr-1",icon:l[3]?Vs:cs,width:20}}),{c(){e=p("fieldset"),t=p("legend"),t.textContent=s,n=j(),r=p("div"),a=p("ul");for(let A=0;At(12,r=E)),oe(l,dt,E=>t(19,a=E)),oe(l,yt,E=>t(3,i=E));const o=[{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 c=o[4].key,f="maj-m";a.count,a.waitSeconds,dt.subscribe(E=>{E.count,E.waitSeconds});function d(){ke.clearGame(!0)}function m(E,N){if(N==="chords-write"||N==="chords-play"||N==="chords-diatonic"){let I=[];f==="selected"?I=r.filter(L=>L.selected):f==="all"?I=r:f==="maj-m"?I=r.filter(L=>L.suffixes[0]==="maj"||L.suffixes[0]==="m"):f==="seventh"&&(I=r.filter(L=>L.suffixes[0]==="maj7"||L.suffixes[0]==="m7"||L.suffixes[0]==="7"||L.suffixes[0]==="dim7"||L.suffixes[0]==="aug7")),ke.play(N,{chords:I})}else ke.play(N,void 0);E.currentTarget instanceof HTMLElement&&E.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function b(E){t(0,c=E)}function g(E,N){t(0,c=N),m(E,N)}function T(E){t(1,f=E)}const y=E=>b(E),D=(E,N)=>g(N,E),O=E=>T(E),V=E=>m(E,c);return l.$$set=E=>{t(10,e=Ee(Ee({},e),we(E)))},l.$$.update=()=>{l.$$.dirty&4096&&t(11,s=r.reduce((E,N)=>N.selected?E+1:E,0)),l.$$.dirty&2048&&t(2,n=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${s} chords`},{key:"all",value:"All"}])},e=we(e),[c,f,n,i,o,d,m,b,g,T,e,s,r,y,D,O,V]}class tr extends He{constructor(e){super(),ze(this,e,er,Za,qe,{})}}function Cl(l,e,t){const s=l.slice();return s[7]=e[t],s}function Al(l,e,t){const s=l.slice();return s[4]=e[t],s}function sr(l){let e,t=se(l[1]),s=[];for(let n=0;nl.interval;function ar(l,e,t){let{scale:s,intervals:n}=e;function r(a){ps.call(this,l,a)}return l.$$set=a=>{t(2,e=Ee(Ee({},e),we(a))),"scale"in a&&t(0,s=a.scale),"intervals"in a&&t(1,n=a.intervals)},e=we(e),[s,n,e,r]}class fn extends He{constructor(e){super(),ze(this,e,ar,nr,qe,{scale:0,intervals:1})}}function Nl(l,e,t){const s=l.slice();return s[7]=e[t],s}function Ll(l,e,t){const s=l.slice();return s[4]=e[t],s}function rr(l){let e,t=se(l[0]),s=[];for(let n=0;n2),h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(f,d){K(f,e,d),u(e,t),u(t,n),u(e,r),u(e,a),u(a,o),u(e,c)},p(f,d){d&1&&s!==(s=f[7].roman+"")&&ae(n,s),d&1&&i!==(i=f[7].suffix+"")&&ae(o,i),d&1&&q(a,"super-text",f[7].suffix.length>2)},d(f){f&&_(e)}}}function jl(l){let e,t,s=l[4]+"",n,r;return{c(){e=p("span"),t=p("span"),n=J(s),r=j(),this.h()},l(a){e=v(a,"SPAN",{class:!0});var i=S(e);t=v(i,"SPAN",{});var o=S(t);n=Y(o,s),o.forEach(_),r=P(i),i.forEach(_),this.h()},h(){h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(a,i){K(a,e,i),u(e,t),u(t,n),u(e,r)},p(a,i){i&2&&s!==(s=a[4]+"")&&ae(n,s)},d(a){a&&_(e)}}}function or(l){let e,t,s,n,r,a;function i(f,d){return f[1].length>0?ir:rr}let o=i(l),c=o(l);return{c(){e=p("div"),t=p("button"),c.c(),this.h()},l(f){e=v(f,"DIV",{class:!0,title:!0});var d=S(e);t=v(d,"BUTTON",{class:!0});var m=S(t);c.l(m),m.forEach(_),d.forEach(_),this.h()},h(){h(t,"class","triads flex flex-wrap svelte-1roj1mi"),h(e,"class",s=Ie(`${l[2].class||""} `)+" svelte-1roj1mi"),h(e,"title",n=l[0].map(Pl).join("-"))},m(f,d){K(f,e,d),u(e,t),c.m(t,null),r||(a=$(t,"click",l[3]),r=!0)},p(f,[d]){o===(o=i(f))&&c?c.p(f,d):(c.d(1),c=o(f),c&&(c.c(),c.m(t,null))),d&4&&s!==(s=Ie(`${f[2].class||""} `)+" svelte-1roj1mi")&&h(e,"class",s),d&1&&n!==(n=f[0].map(Pl).join("-"))&&h(e,"title",n)},i:fe,o:fe,d(f){f&&_(e),c.d(),r=!1,a()}}}const Pl=l=>l.roman+l.suffix;function cr(l,e,t){let{triads:s,chords:n}=e;function r(a){ps.call(this,l,a)}return l.$$set=a=>{t(2,e=Ee(Ee({},e),we(a))),"triads"in a&&t(0,s=a.triads),"chords"in a&&t(1,n=a.chords)},e=we(e),[s,n,e,r]}class dn extends He{constructor(e){super(),ze(this,e,cr,or,qe,{triads:0,chords:1})}}function Vl(l,e,t){const s=l.slice();return s[23]=e[t],s}function Ol(l,e,t){const s=l.slice();return s[23]=e[t],s}function Bl(l){let e,t,s=l[23].raw.names[0]+"",n,r,a,i,o,c,f;function d(){return l[11](l[23])}a=new fn({props:{scale:l[23].scale,intervals:l[23].raw.intervals}}),a.$on("click",d);function m(){return l[12](l[23])}return o=new dn({props:{triads:l[23].triads,chords:l[23].triadChords}}),o.$on("click",m),{c(){e=p("li"),t=p("div"),n=J(s),r=j(),_e(a.$$.fragment),i=j(),_e(o.$$.fragment),c=j(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=S(e);t=v(g,"DIV",{class:!0});var T=S(t);n=Y(T,s),T.forEach(_),r=P(g),pe(a.$$.fragment,g),i=P(g),pe(o.$$.fragment,g),c=P(g),g.forEach(_),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){K(b,e,g),u(e,t),u(t,n),u(e,r),ve(a,e,null),u(e,i),ve(o,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&4)&&s!==(s=l[23].raw.names[0]+"")&&ae(n,s);const T={};g&4&&(T.scale=l[23].scale),g&4&&(T.intervals=l[23].raw.intervals),a.$set(T);const y={};g&4&&(y.triads=l[23].triads),g&4&&(y.chords=l[23].triadChords),o.$set(y)},i(b){f||(F(a.$$.fragment,b),F(o.$$.fragment,b),f=!0)},o(b){W(a.$$.fragment,b),W(o.$$.fragment,b),f=!1},d(b){b&&_(e),ge(a),ge(o)}}}function Gl(l){let e,t,s=l[23].raw.names[0]+"",n,r,a,i,o,c,f;function d(){return l[13](l[23])}a=new fn({props:{scale:l[23].scale,intervals:l[23].raw.intervals}}),a.$on("click",d);function m(){return l[14](l[23])}return o=new dn({props:{triads:l[23].triads,chords:l[23].triadChords}}),o.$on("click",m),{c(){e=p("li"),t=p("div"),n=J(s),r=j(),_e(a.$$.fragment),i=j(),_e(o.$$.fragment),c=j(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=S(e);t=v(g,"DIV",{class:!0});var T=S(t);n=Y(T,s),T.forEach(_),r=P(g),pe(a.$$.fragment,g),i=P(g),pe(o.$$.fragment,g),c=P(g),g.forEach(_),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){K(b,e,g),u(e,t),u(t,n),u(e,r),ve(a,e,null),u(e,i),ve(o,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&2)&&s!==(s=l[23].raw.names[0]+"")&&ae(n,s);const T={};g&2&&(T.scale=l[23].scale),g&2&&(T.intervals=l[23].raw.intervals),a.$set(T);const y={};g&2&&(y.triads=l[23].triads),g&2&&(y.chords=l[23].triadChords),o.$set(y)},i(b){f||(F(a.$$.fragment,b),F(o.$$.fragment,b),f=!0)},o(b){W(a.$$.fragment,b),W(o.$$.fragment,b),f=!1},d(b){b&&_(e),ge(a),ge(o)}}}function ur(l){let e,t,s,n,r="Scales",a,i,o,c,f="Key",d,m,b,g,T,y,D,O,V,E,N=se(l[2]),I=[];for(let C=0;CW(I[C],1,1,()=>{I[C]=null});let M=se(l[1]),w=[];for(let C=0;CW(w[C],1,1,()=>{w[C]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=j(),i=p("div"),o=p("div"),c=p("label"),c.textContent=f,d=j(),m=p("input"),b=j(),g=p("ul");for(let C=0;Ct(17,r=w)),oe(l,St,w=>t(18,a=w)),oe(l,nt,w=>t(19,i=w)),oe(l,tt,w=>t(20,o=w));let d=vs().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),m="",b=[a.key,a.scale],g;const T=ht(Be(!0),{key:"scales-hidden"});oe(l,T,w=>t(3,c=w));function y(){T.update(w=>!w)}function D({currentTarget:{value:w}}){t(0,m=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,d=d.map(G=>{const C=Qt(m,G.key),k=m&&"data"in C?C.data:void 0;let A=[];return k&&(A=G.triads.map((B,U)=>`${k.scaleNotes[U].note}${!B.suffix.includes("°")&&B.minor?"m":""}${B.suffix}`)),{...G,scale:k,triadChords:A}}))}function O(w,G,C){if(wA.midi),i.fixedVelocity),g=setTimeout(()=>O(w,G,C),C)}else me.setPlayed([]),me.setKeyAndScale(b[0],b[1])}function V(w){clearTimeout(g);let G,C;w.scale?(C=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):C=a;const k=r[0].midi+C.scaleNotes[0].semitones;G=w.raw.intervals.map(A=>[{...C.notesMap.get(A.semitones%12),midi:k+A.semitones}]),G[0][0].semitones!==G[G.length-1][0].semitones&&G.push(G[0].map(A=>({...A,midi:A.midi+12}))),O(0,G,500)}function E(w){clearTimeout(g);const{intervals:G}=w.raw;let C,k;w.scale?(k=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):k=a;const A=r[0].midi+k.scaleNotes[0].semitones;C=en(w.triads).map((U,R)=>us(A+k.intervals[R].semitones,k,U.intervals)),G[G.length-1].interval_seq!==1&&C.push(C[0].map(U=>({...U,midi:U.midi+12}))),O(0,C,750)}const N=w=>V(w),I=w=>E(w),L=w=>V(w),M=w=>E(w);return l.$$set=w=>{t(9,e=Ee(Ee({},e),we(w)))},l.$$.update=()=>{l.$$.dirty&1024&&t(2,s=d.filter((w,G)=>GG>=d.length/2))},e=we(e),[m,n,s,c,T,y,D,V,E,e,d,N,I,L,M]}class dr extends He{constructor(e){super(),ze(this,e,fr,ur,qe,{})}}function Ml(l,e,t){const s=l.slice();return s[26]=e[t],s}function Ul(l,e,t){const s=l.slice();return s[29]=e[t],s}function Kl(l){let e,t;return{c(){e=p("div"),t=J(l[3]),this.h()},l(s){e=v(s,"DIV",{class:!0});var n=S(e);t=Y(n,l[3]),n.forEach(_),this.h()},h(){h(e,"class","error svelte-1u7ze7x")},m(s,n){K(s,e,n),u(e,t)},p(s,n){n[0]&8&&ae(t,s[3])},d(s){s&&_(e)}}}function hr(l){let e,t;return{c(){e=p("div"),t=J(l[0]),this.h()},l(s){e=v(s,"DIV",{slot:!0});var n=S(e);t=Y(n,l[0]),n.forEach(_),this.h()},h(){h(e,"slot","value")},m(s,n){K(s,e,n),u(e,t)},p(s,n){n[0]&1&&ae(t,s[0])},d(s){s&&_(e)}}}function xl(l){let e,t=se(l[5]),s=[];for(let n=0;nt(23,n=k)),oe(l,kt,k=>t(24,r=k)),oe(l,yt,k=>t(7,i=k)),oe(l,St,k=>t(8,o=k));let c=Xe(n[0]),f=Xe(n[1]),d="";const m=ht(Be(!1),{key:"score-options-hidden"});oe(l,m,k=>t(6,a=k));let b=r[0],g=r[1];const T=vs(),y=T.map(k=>({key:k.names[0],value:k.names[0]}));Zt.subscribe(k=>{t(1,c=Xe(k[0])),t(2,f=Xe(k[1]))}),kt.subscribe(k=>{t(4,b=k[0]),t(0,g=k[1])});function D(k,A){const B=jn(A.currentTarget.value,!0,!0);if("data"in B){const{midi:U}=B.data,R=n,z=[k==="min"?U:R[0].midi,k==="max"?U:R[1].midi];$e.setMidiRange(z),t(3,d="")}else t(3,d=B.err),k==="min"?t(1,c=Xe(n[0])):t(2,f=Xe(n[1]))}function O(){t(3,d="")}function V({currentTarget:{value:k}}){t(4,b=`${k.charAt(0).toUpperCase()}${k.charAt(1).toLowerCase()}`),me.setKey(b)}function E(k){var A;return t(0,g=(A=y.find(B=>k===B.key))==null?void 0:A.value),me.setScale(g),!1}function N(){m.update(k=>!k)}function I(){me.clearScore(!0),$e.setMidiRange([60,84])}function L(){c=this.value,t(1,c)}const M=k=>D("min",k);function w(){f=this.value,t(2,f)}const G=k=>D("max",k);function C(){b=this.value,t(4,b)}return l.$$set=k=>{t(17,e=Ee(Ee({},e),we(k)))},l.$$.update=()=>{var k;l.$$.dirty[0]&1&&t(5,s=((k=T.find(A=>A.names[0]===g))==null?void 0:k.intervals)||[])},e=we(e),[g,c,f,d,b,s,a,i,o,m,y,D,O,V,E,N,I,e,L,M,w,G,C]}class pr extends He{constructor(e){super(),ze(this,e,_r,mr,qe,{},null,[-1,-1])}}function vr(l){l[19]=l[20].default}function gr(l){return{c:fe,l:fe,m:fe,i:fe,o:fe,d:fe}}function br(l){vr(l);let e,t,s;var n=l[19];function r(a,i){return{props:{class:"px-4 md:px-0"}}}return n&&(e=gn(n,r())),{c(){e&&_e(e.$$.fragment),t=Pe()},l(a){e&&pe(e.$$.fragment,a),t=Pe()},m(a,i){e&&ve(e,a,i),K(a,t,i),s=!0},i(a){s||(e&&F(e.$$.fragment,a),s=!0)},o(a){e&&W(e.$$.fragment,a),s=!1},d(a){a&&_(t),e&&ge(e,a)}}}function yr(l){let e;return{c(){e=J(" ")},l(t){e=Y(t," ")},m(t,s){K(t,e,s)},i:fe,o:fe,d(t){t&&_(e)}}}function kr(l){let e,t,s,n='MIDI Note Trainer',r,a,i,o,c,f,d,m,b,g,T,y,D,O,V,E,N,I,L;i=new Ra({}),c=new dr({}),d=new sa({}),g=new pr({props:{class:"score-options mr-4"}}),y=new tr({props:{class:"play-form"}});let M={ctx:l,current:null,token:null,hasCatch:!1,pending:yr,then:br,catch:gr,value:20,blocks:[,,,]};return pn(ie(()=>import("./Score.18b18b70.js"),["./Score.18b18b70.js","./vendor_svelte.abb8ca64.js","./vendor.1acf520b.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),M),E=new Ja({props:{class:"min-h-32",debounced:!!l[0]}}),E.$on("guessed-chord",l[2]),E.$on("guessed-key",l[3]),E.$on("guessed-note",l[4]),I=new _a({props:{game:l[1]}}),{c(){e=p("meta"),t=j(),s=p("h1"),s.innerHTML=n,r=j(),a=p("section"),_e(i.$$.fragment),o=j(),_e(c.$$.fragment),f=j(),_e(d.$$.fragment),m=j(),b=p("div"),_e(g.$$.fragment),T=j(),_e(y.$$.fragment),D=j(),M.block.c(),O=j(),V=p("section"),_e(E.$$.fragment),N=j(),_e(I.$$.fragment),this.h()},l(w){const G=vn("svelte-1w2oado",document.head);e=v(G,"META",{name:!0,content:!0}),G.forEach(_),t=P(w),s=v(w,"H1",{class:!0,"data-svelte-h":!0}),Z(s)!=="svelte-1l8ebwf"&&(s.innerHTML=n),r=P(w),a=v(w,"SECTION",{class:!0});var C=S(a);pe(i.$$.fragment,C),o=P(C),pe(c.$$.fragment,C),f=P(C),pe(d.$$.fragment,C),m=P(C),b=v(C,"DIV",{class:!0});var k=S(b);pe(g.$$.fragment,k),T=P(k),pe(y.$$.fragment,k),k.forEach(_),C.forEach(_),D=P(w),M.block.l(w),O=P(w),V=v(w,"SECTION",{class:!0});var A=S(V);pe(E.$$.fragment,A),N=P(A),pe(I.$$.fragment,A),A.forEach(_),this.h()},h(){h(e,"name","description"),h(e,"content","App to practise music notation, scales and chords using MIDI"),h(s,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),h(b,"class","play svelte-qjpqy3"),h(a,"class","px-4 md:px-0"),h(V,"class","mb-8 px-4 md:px-0 flex flex-col")},m(w,G){u(document.head,e),K(w,t,G),K(w,s,G),K(w,r,G),K(w,a,G),ve(i,a,null),u(a,o),ve(c,a,null),u(a,f),ve(d,a,null),u(a,m),u(a,b),ve(g,b,null),u(b,T),ve(y,b,null),K(w,D,G),M.block.m(w,M.anchor=G),M.mount=()=>O.parentNode,M.anchor=O,K(w,O,G),K(w,V,G),ve(E,V,null),u(V,N),ve(I,V,null),L=!0},p(w,[G]){l=w;const C={};G&1&&(C.debounced=!!l[0]),E.$set(C);const k={};G&2&&(k.game=l[1]),I.$set(k)},i(w){L||(F(i.$$.fragment,w),F(c.$$.fragment,w),F(d.$$.fragment,w),F(g.$$.fragment,w),F(y.$$.fragment,w),F(M.block),F(E.$$.fragment,w),F(I.$$.fragment,w),L=!0)},o(w){W(i.$$.fragment,w),W(c.$$.fragment,w),W(d.$$.fragment,w),W(g.$$.fragment,w),W(y.$$.fragment,w);for(let G=0;G<3;G+=1){const C=M.blocks[G];W(C)}W(E.$$.fragment,w),W(I.$$.fragment,w),L=!1},d(w){w&&(_(t),_(s),_(r),_(a),_(D),_(O),_(V)),_(e),ge(i),ge(c),ge(d),ge(g),ge(y),M.block.d(w),M.token=null,M=null,ge(E),ge(I)}}}function Er(l,e,t){let s,n,r,a,i,o;oe(l,bt,N=>t(7,s=N)),oe(l,yt,N=>t(1,n=N)),oe(l,dt,N=>t(8,r=N)),oe(l,nt,N=>t(9,a=N)),oe(l,tt,N=>t(10,i=N)),oe(l,ds,N=>t(11,o=N));let c,f;Jl(()=>(o&&E(),window.addEventListener("keydown",d),window.addEventListener("mousedown",d),window.addEventListener("touchstart",d),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)})),Xt.subscribe(N=>{N&&N.channels[1].addListener("noteon",m)});function d(){$e.initAudio(),window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)}function m(N){if(c)return;const I=N.rawData;b(I[1],I[2])}function b(N,I){const L=n;L instanceof It&&!(L!=null&&L.ended)&&s==="waiting"?y(N):L instanceof ft&&!(L!=null&&L.ended)&&s==="waiting"?(L.addPlayedNote(N),f||(f=setTimeout(T,2e3))):L||me.pushPlayed(N),i&&i.noteOn(N,a.fixedVelocity??I)}function g(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&ke.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?ke.nextGuess():t(0,c=void 0)}function T(){var I;const N=n;if(N instanceof ft){const L=N.guess();me.setPlayed(((I=N.latestGuess.guessed)==null?void 0:I.notes)||[],L,-1),ke.updateState(L?"correct":"wrong"),g()}f=void 0}function y(N){const I=n;if(I instanceof It&&s==="waiting"){me.setTarget([me.getNote(I.current)]);const L=I.guess(N);ke.updateState(L?"correct":"wrong"),me.pushPlayed(N,L,4e3),g()}}function D(N){const I=n;if(I instanceof ft&&s==="waiting"){const L=I.guessWrittenChord(N.detail);ke.updateState(L?"correct":"wrong"),g()}}function O(N){const I=n;if(I instanceof jt&&s==="waiting"){const L=N.detail.replaceAll("♭","b").replaceAll("♯","#"),M=I.guess(L);ke.updateState(M?"correct":"wrong"),g()}}function V(N){b(N.detail,80)}async function E(){const N=await $e.openMidi();"data"in N?N.data.name:(N.err,console.error(N.err))}return[c,n,D,O,V]}class Tr extends He{constructor(e){super(),ze(this,e,Er,kr,qe,{})}}export{Bs as F,ft as G,Tr as P,wn as S,It as a,ke as b,yt as c,gt as d,tn as e,bt as g,tt as p,St as s,Us as t}; diff --git a/_app/immutable/chunks/Score.d5ae0699.js b/_app/immutable/chunks/Score.18b18b70.js similarity index 98% rename from _app/immutable/chunks/Score.d5ae0699.js rename to _app/immutable/chunks/Score.18b18b70.js index 8de399b4..2e8c7c66 100644 --- a/_app/immutable/chunks/Score.d5ae0699.js +++ b/_app/immutable/chunks/Score.18b18b70.js @@ -1 +1 @@ -import{S as Q,i as U,s as J,O as ne,e as A,H as F,a as C,b as E,I,d as y,f as S,L as B,g as W,h as V,J as j,p as re,t as D,l as $,K,M as X,N as G,P as q,m as te,o as se,Q as ue,r as de,F as he}from"./vendor_svelte.4e97ec88.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as me,g as oe,c as Y,G as H,a as L,b as ge,s as be,d as pe,t as we,e as ae,F as _e,S as ve}from"./3.497149d2.js";import{d as ye,a as Se}from"./vendor.1acf520b.js";function Ne(i){let t,s,l,a,n,f,g;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 p=E(s);I(l.$$.fragment,p),p.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||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=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)&&B(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,g()}}}function ke(i,t,s){let l,a,n,f;X(i,me,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function g(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(p=>p.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(p=>p.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=G(G({},t),q(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=q(t),[l,g,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,g;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 p=E(s);I(l.$$.fragment,p),p.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||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=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)&&B(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,g()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){ge.clearGame()}return i.$$set=n=>{s(2,t=G(G({},t),q(n)))},t=q(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,g,e,c,p;return f=new Ae({props:{class:"mr-2"}}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),g=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);I(f.$$.fragment,x),g=se(x),I(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex"),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,g),j(e,n,null),p=!0},p(u,[N]){(!p||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){p||(D(f.$$.fragment,u),D(e.$$.fragment,u),p=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),p=!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:g}=v;let e=200,c,p,u;const N=ue([Y,oe,be,pe,we],([o,w,d,b,h])=>({game:o,guessed:w,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,w){const d=w.flats>0?w.flats:w.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",m=(w.flats>0?_e:ve).slice(0,d),r=m.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&m.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o.midi)]}}function x(){p=new n(c,n.Backends.SVG),p.resize(732,360),u=p.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),w=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new g({keys:["g#/4"],duration:"q"}),new g({keys:["b/4"],duration:"qr"}),new g({keys:["c/4"],duration:"q"}),new g({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new g({clef:"bass",keys:["f/3"],duration:"q"}),new g({clef:"bass",keys:["b/3"],duration:"qr"}),new g({clef:"bass",keys:["b/2"],duration:"q"}),new g({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),m=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),w.getNoteStartX());o.setNoteStartX(r),w.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([m]),_.format([h,m],e-10-r),h.draw(u,o),m.draw(u,w),o.setContext(u).draw(),w.setContext(u).draw()}function Z(o,w){const d=[],b=[];for(let m=0;m0){const m=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]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}if(b.length>0){const m=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]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}return h}function le(o,w){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&w.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&w.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...w.filter(h=>h.getAttribute("clef")==="treble")),b.push(...w.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:w,scale:d,played:b,target:h}){const m=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(m),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[P,R]=le(T,O),k=[];P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P)),R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R));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),P.length>0&&k[0].draw(u,r),R.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=G(G({},t),q(o)))},t=q(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,H as F,a as C,b as E,I,d as y,f as S,L as B,g as W,h as V,J as j,p as re,t as D,l as $,K,M as X,N as G,P as q,m as te,o as se,Q as ue,r as de,F as he}from"./vendor_svelte.abb8ca64.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as me,g as oe,c as Y,G as H,a as L,b as ge,s as be,d as pe,t as we,e as ae,F as _e,S as ve}from"./3.841cbed9.js";import{d as ye,a as Se}from"./vendor.1acf520b.js";function Ne(i){let t,s,l,a,n,f,g;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 p=E(s);I(l.$$.fragment,p),p.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||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=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)&&B(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,g()}}}function ke(i,t,s){let l,a,n,f;X(i,me,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function g(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(p=>p.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(p=>p.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=G(G({},t),q(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=q(t),[l,g,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,g;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 p=E(s);I(l.$$.fragment,p),p.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||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=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)&&B(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,g()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){ge.clearGame()}return i.$$set=n=>{s(2,t=G(G({},t),q(n)))},t=q(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,g,e,c,p;return f=new Ae({props:{class:"mr-2"}}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),g=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);I(f.$$.fragment,x),g=se(x),I(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex"),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,g),j(e,n,null),p=!0},p(u,[N]){(!p||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){p||(D(f.$$.fragment,u),D(e.$$.fragment,u),p=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),p=!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:g}=v;let e=200,c,p,u;const N=ue([Y,oe,be,pe,we],([o,w,d,b,h])=>({game:o,guessed:w,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,w){const d=w.flats>0?w.flats:w.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",m=(w.flats>0?_e:ve).slice(0,d),r=m.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&m.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o.midi)]}}function x(){p=new n(c,n.Backends.SVG),p.resize(732,360),u=p.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),w=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new g({keys:["g#/4"],duration:"q"}),new g({keys:["b/4"],duration:"qr"}),new g({keys:["c/4"],duration:"q"}),new g({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new g({clef:"bass",keys:["f/3"],duration:"q"}),new g({clef:"bass",keys:["b/3"],duration:"qr"}),new g({clef:"bass",keys:["b/2"],duration:"q"}),new g({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),m=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),w.getNoteStartX());o.setNoteStartX(r),w.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([m]),_.format([h,m],e-10-r),h.draw(u,o),m.draw(u,w),o.setContext(u).draw(),w.setContext(u).draw()}function Z(o,w){const d=[],b=[];for(let m=0;m0){const m=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]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}if(b.length>0){const m=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]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}return h}function le(o,w){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&w.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&w.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...w.filter(h=>h.getAttribute("clef")==="treble")),b.push(...w.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:w,scale:d,played:b,target:h}){const m=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(m),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[P,R]=le(T,O),k=[];P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P)),R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R));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),P.length>0&&k[0].draw(u,r),R.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=G(G({},t),q(o)))},t=q(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/kurdish-eencXZUC.4cb27155.js b/_app/immutable/chunks/kurdish-eencXZUC.4cb27155.js deleted file mode 100644 index 9126d87b..00000000 --- a/_app/immutable/chunks/kurdish-eencXZUC.4cb27155.js +++ /dev/null @@ -1 +0,0 @@ -const t={layout:{default:["١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ ٠ - = {bksp}","{tab} ق و ە ر ت ی ئ ع ۆ پ","{lock} ا س د ف گ ه ژ ک ل {enter}","{shift} ز خ ج ڤ ب ن م {shift}",".com @ {space}"],shift:["! @ # $ ٪ ^ & * ( ) _ + {bksp}","{tab} ٯ وو ي ڕ ط ێ ء ح ؤ ث","{lock} آ ش ذ إ غ ‌ أ ك ڵ {enter}","{shift} ض ص چ ظ ى ة ـ {shift}",".com @ {space}"]}};export{t as default}; diff --git a/_app/immutable/chunks/vendor_svelte.4e97ec88.js b/_app/immutable/chunks/vendor_svelte.abb8ca64.js similarity index 57% rename from _app/immutable/chunks/vendor_svelte.4e97ec88.js rename to _app/immutable/chunks/vendor_svelte.abb8ca64.js index 8a046b45..f6e6a394 100644 --- a/_app/immutable/chunks/vendor_svelte.4e97ec88.js +++ b/_app/immutable/chunks/vendor_svelte.abb8ca64.js @@ -1,6 +1,6 @@ -var Rn=Object.defineProperty;var Tn=(t,e,n)=>e in t?Rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>(Tn(t,typeof e!="symbol"?e+"":e,n),n);import{u as Ln}from"./vendor.1acf520b.js";function z(){}const Xe=t=>t;function bt(t,e){for(const n in e)t[n]=e[n];return t}function Pn(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 On(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 Nn(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 Cn(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 In(){Ht=!0}function Un(){Ht=!1}function Dn(t,e,n,r){for(;t>1);n(i)<=r?t=i+1:e=i}return t}function Fn(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:Dn(1,i,S=>e[n[S]].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 Bn=["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&&Bn.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 Gn(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 Wn(t){return ae(t," ")}function Pe(t,e,n){for(let r=n;r0&&n.push(i);return n}class Jn{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 Xn(t,e){const n={stylesheet:Hn(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=`{ +var Rn=Object.defineProperty;var Tn=(t,e,n)=>e in t?Rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>(Tn(t,typeof e!="symbol"?e+"":e,n),n);import{u as Ln}from"./vendor.1acf520b.js";function z(){}const Xe=t=>t;function bt(t,e){for(const n in e)t[n]=e[n];return t}function Pn(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 On(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 Nn(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 Cn(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 In(){Ht=!0}function Un(){Ht=!1}function Dn(t,e,n,r){for(;t>1);n(i)<=r?t=i+1:e=i}return t}function Fn(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:Dn(1,i,S=>e[n[S]].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 Bn=["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&&Bn.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 Gn(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 Wn(t){return ae(t," ")}function Pe(t,e,n){for(let r=n;r0&&n.push(i);return n}class Jn{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 Xn(t,e){const n={stylesheet:Hn(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_${Yn(d)}_${o}`,S=nn(t),{stylesheet:P,rules:y}=jt.get(S)||Xn(S,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 Qn(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||Zn())}function Zn(){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 nr(){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 rr(){J={r:0,c:[],p:J}}function ir(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function ar(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 or={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&&Qn(t,l)}function S(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||or,Z={start:jn()+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=S(Z,R),It(()=>Qt(t,y,"start")),Cn(q=>{if(c&&q>c.start&&(o=S(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(q>=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(q>=o.start){const Y=q-o.start;s=o.a+o.d*x(Y/o.duration),v(s,1-s)}}return!!(o||c)}))}return{run(y){Mt(a)?nr().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,S)=>{S!==a&&m&&(rr(),ar(m,1,1,()=>{e.blocks[S]===m&&(e.blocks[S]=null)}),ir())}):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(Pn(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 sr(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 cr(t,e){const n=t.$$;n.fragment!==null&&(er(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function lr(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]:S;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&lr(t,m)),S}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){In();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),sr(t,e.target,e.anchor),Un(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){cr(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&&!On(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const fr="4";function ur(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function dr(t){return t.split("%25").map(decodeURI).join("%25")}function hr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const pr=["href","pathname","search","searchParams","toString","toJSON"];function _r(t,e){const n=new URL(t);for(const r of pr)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return gr(n),n}function gr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const mr="/__data.json";function yr(t){return t.replace(/\/$/,"")+mr}function wr(...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 br(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 vr(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=xr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,S,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!S,chained:S?l===1&&s[0]==="":!1}),S?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function $r(t){return!/^\([^)]+\)$/.test(t)}function Sr(t){return t.slice(1).split("/").filter($r)}function Er(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 Ar({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:S}=kr(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Er(w,S,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 Rr(t,e){return{subscribe:qt(t,e).subscribe}}function qt(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 Rr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const S=()=>{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 Pr(){const{set:t,subscribe:e}=qt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Tr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Lr;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 Or(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const Nr=new Set([...bn]);[...Nr];async function jr(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 Cr="x-sveltekit-invalidated",Ir="x-sveltekit-trailing-slash";function Ur(t){t.client}const W={url:Me({}),page:Me({}),navigating:qt(null),updated:Pr()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Dr(t,e){var $e;const n=Ar(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,S=!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 q,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&&(q=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(),q=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)),S=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const $ of u)($==null?void 0:$.slash)!==void 0&&(A=$.slash);f.pathname=ur(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Or(u).map($=>$.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!q,j=0;for(let $=0;$(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:_r(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 V=new URL(F,u);return U(V.href),V.origin===u.origin&&(F=V.href.slice(u.origin.length)),S?vr(F,V.href,D):br(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,$)??null,b=b?await jr(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 $=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($.some(Boolean)){try{E=await ze(u,$)}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 Vt({loader:O[1],url:u,params:p,route:h,parent:async()=>{var Ee;const Se={};for(let Kt=0;Kt{});const V=[];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:hr(h),url:f}}}function At(f){return dr(f.pathname.slice(X.length)||"/")}function xe({url:f,type:_,intent:u,delta:p}){let h=!1;const g=qe(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,V,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,S&&W.navigating.set(j.navigation),Y=A;let $=I&&await Gt(I);if(!$){if(Ot(f,X))return await nt(f);$=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($.type==="redirect")if(p>=20)$=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($.location,f).href,{},p+1,A),!1;else((F=$.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),(V=$.props.page)!=null&&V.url&&$.props.page.url.pathname!==f.pathname&&(f.pathname=(O=$.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,S){d=$.state,$.props.page&&($.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($.props)}else we($);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,$.props.page&&(q=$.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 An(){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||!S)&&(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:{...q,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=qe(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||An(),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),$=h==null?void 0:h.getAttribute("name");$&&U.append($,(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({...q,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,$)=>{const k=g[$];return k!=null&&k.uses&&(k.uses=vn(k.uses)),Vt({loader:t.nodes[U],url:A,params:p,route:h,parent:async()=>{const D={};for(let F=0;F<$;F+=1)Object.assign(D,(await E[F]).data);return D},server_data_node:Bt(k)})}),I=await Promise.all(E),j=n.find(({id:U})=>U===h.id);if(j){const U=j.layouts;for(let $=0;$a?"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(S){return Ln(S,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:S,value:P}=await o.read();if(S&&!d)break;for(d+=!P&&d?` +}`,m=`__svelte_${Yn(d)}_${o}`,S=nn(t),{stylesheet:P,rules:y}=jt.get(S)||Xn(S,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 Qn(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||Zn())}function Zn(){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 nr(){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 rr(){J={r:0,c:[],p:J}}function ir(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function ar(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 or={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&&Qn(t,l)}function S(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||or,Z={start:jn()+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=S(Z,R),It(()=>Qt(t,y,"start")),Cn(V=>{if(c&&V>c.start&&(o=S(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)?nr().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,S)=>{S!==a&&m&&(rr(),ar(m,1,1,()=>{e.blocks[S]===m&&(e.blocks[S]=null)}),ir())}):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(Pn(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 sr(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 cr(t,e){const n=t.$$;n.fragment!==null&&(er(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function lr(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]:S;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&lr(t,m)),S}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){In();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),sr(t,e.target,e.anchor),Un(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){cr(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&&!On(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const fr="4";function ur(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function dr(t){return t.split("%25").map(decodeURI).join("%25")}function hr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const pr=["href","pathname","search","searchParams","toString","toJSON"];function _r(t,e){const n=new URL(t);for(const r of pr)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return gr(n),n}function gr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const mr="/__data.json";function yr(t){return t.replace(/\/$/,"")+mr}function wr(...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 br(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 vr(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=xr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,S,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!S,chained:S?l===1&&s[0]==="":!1}),S?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function $r(t){return!/^\([^)]+\)$/.test(t)}function Sr(t){return t.slice(1).split("/").filter($r)}function Er(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 Ar({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:S}=kr(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Er(w,S,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 Rr(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 Rr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const S=()=>{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 Pr(){const{set:t,subscribe:e}=Vt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Tr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Lr;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 Or(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const Nr=new Set([...bn]);[...Nr];async function jr(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 Cr="x-sveltekit-invalidated",Ir="x-sveltekit-trailing-slash";function Ur(t){t.client}const W={url:Me({}),page:Me({}),navigating:Vt(null),updated:Pr()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Dr(t,e){var $e;const n=Ar(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,S=!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)),S=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const $ of u)($==null?void 0:$.slash)!==void 0&&(A=$.slash);f.pathname=ur(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Or(u).map($=>$.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!V,j=0;for(let $=0;$(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:_r(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)),S?vr(F,q.href,D):br(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,$)??null,b=b?await jr(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 $=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($.some(Boolean)){try{E=await ze(u,$)}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:hr(h),url:f}}}function At(f){return dr(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,S&&W.navigating.set(j.navigation),Y=A;let $=I&&await Gt(I);if(!$){if(Ot(f,X))return await nt(f);$=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($.type==="redirect")if(p>=20)$=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($.location,f).href,{},p+1,A),!1;else((F=$.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=$.props.page)!=null&&q.url&&$.props.page.url.pathname!==f.pathname&&(f.pathname=(O=$.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,S){d=$.state,$.props.page&&($.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($.props)}else we($);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,$.props.page&&(V=$.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 An(){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||!S)&&(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||An(),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),$=h==null?void 0:h.getAttribute("name");$&&U.append($,(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,$)=>{const k=g[$];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;F<$;F+=1)Object.assign(D,(await E[F]).data);return D},server_data_node:Bt(k)})}),I=await Promise.all(E),j=n.find(({id:U})=>U===h.id);if(j){const U=j.layouts;for(let $=0;$a?"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(S){return Ln(S,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:S,value:P}=await o.read();if(S&&!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=Dr(t,e);Ur({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(fr);const Fr=()=>{const t=W;return{page:{subscribe:t.page.subscribe},navigating:{subscribe:t.navigating.subscribe},updated:t.updated}},Mr={subscribe(t){return Fr().page.subscribe(t)}};function Hr(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=Vn(),a=ft("p"),o=vt(s)},l(l){e=ie(l,"H1",{});var d=xt(e);r=ae(d,n),d.forEach(H),i=Wn(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 zr(t,e,n){let r;return Nn(t,Mr,i=>n(0,r=i)),[r]}let qi=class extends pn{constructor(e){super(),hn(this,e,zr,Hr,ce,{})}};const xn=Object.freeze({left:0,top:0,width:16,height:16}),kn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ft=Object.freeze({...xn,...kn});Object.freeze({...Ft,body:"",hidden:!1});({...xn});const $n=Object.freeze({width:null,height:null}),Sn=Object.freeze({...$n,...kn});function qr(t,e){const n={...t};for(const r in e){const i=e[r],a=typeof i;r in $n?(i===null||i&&(a==="string"||a==="number"))&&(n[r]=i):a===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const Vr=/[\s,]+/;function Br(t,e){e.split(Vr).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Gr(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 Wr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Kr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ve(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(Wr);if(r===null||!r.length)return t;const i=[];let a=r.shift(),s=Kr.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 Jr=t=>t==="unset"||t==="undefined"||t==="none";function Yr(t,e){const n={...Ft,...t},r={...Sn,...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=Ve(m,c/l)):(d=s==="auto"?c:s,m=o===null?Ve(d,l/c):o==="auto"?l:o);const S={},P=(y,w)=>{Jr(w)||(S[y]=w.toString())};return P("width",d),P("height",m),S.viewBox=i.left.toString()+" "+i.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:S,body:a}}const Xr=/\sid="(\S+)"/g,Qr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Zr=0;function ti(t,e=Qr){const n=[];let r;for(;r=Xr.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+(Zr++).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 ei(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 ni(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function ri(t){return"data:image/svg+xml,"+ni(t)}function ii(t){return'url("'+ri(t)+'")'}const Be={...Sn,inline:!1},ai={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},oi={display:"inline-block"},se={"background-color":"currentColor"},En={"background-color":"transparent"},Ge={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},We={"-webkit-mask":se,mask:se,background:En};for(const t in We){const e=We[t];for(const n in Ge)e[t+"-"+n]=Ge[n]}function si(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function ci(t,e){const n=qr(Be,e),r=e.mode||"svg",i=r==="svg"?{...ai}:{};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"&&Br(n,v);break;case"color":a=a+(a.length>0&&a.trim().slice(-1)!==";"?";":"")+"color: "+v+"; ";break;case"rotate":typeof v=="string"?n[x]=Gr(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=Yr(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:ti(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),S=ei(c,{...o,width:l+"",height:d+""}),y={"--svg":ii(S)},w=x=>{const v=o[x];v&&(y[x]=si(v))};w("width"),w("height"),Object.assign(y,oi,m?se:En);let R="";for(const x in y)R+=x+": "+y[x]+";";return i.style=R+a,{svg:!1,attributes:i}}const li=Object.create(null);function fi(t){const e=typeof t.icon=="string"?li[t.icon]:typeof t.icon=="object"?{...Ft,...t.icon}:null;return e===null||typeof e!="object"||typeof e.body!="string"?null:ci({...Ft,...e},t)}function Ke(t){let e;function n(a,s){return a[0].svg?di:ui}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 ui(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=fi(e))},e=Re(e),[r]}class Bi extends pn{constructor(e){super(),hn(this,e,pi,hi,ce,{})}}function _i(t){const e=t-1;return e*e*e+1}function Gi(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 Wi(t,{delay:e=0,duration:n=400,easing:r=_i,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]}`]),S=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*S}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;`}}export{Gi as $,ae as A,Oe as B,rr as C,Yt as D,qi as E,je as F,Oi as G,Fi as H,Mi as I,sr as J,cr as K,Li as L,Nn as M,bt as N,Bi as O,Re as P,Hi as Q,yi as R,pn as S,qt as T,Rr as U,Di as V,ki as W,$i as X,rt as Y,It as Z,Ii as _,ie as a,Wi as a0,Ci as a1,Ri as a2,ji as a3,Ai as a4,Ui as a5,Pi as a6,zi as a7,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,ar as l,Vn as m,Ei as n,Wn as o,Si as p,z as q,Jt as r,ce as s,un as t,vi as u,Nt as v,ir as w,Ni as x,Ti as y,vt as z}; +`);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=Dr(t,e);Ur({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(fr);const Fr=()=>{const t=W;return{page:{subscribe:t.page.subscribe},navigating:{subscribe:t.navigating.subscribe},updated:t.updated}},Mr={subscribe(t){return Fr().page.subscribe(t)}};function Hr(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=qn(),a=ft("p"),o=vt(s)},l(l){e=ie(l,"H1",{});var d=xt(e);r=ae(d,n),d.forEach(H),i=Wn(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 zr(t,e,n){let r;return Nn(t,Mr,i=>n(0,r=i)),[r]}let Vi=class extends pn{constructor(e){super(),hn(this,e,zr,Hr,ce,{})}};const xn=Object.freeze({left:0,top:0,width:16,height:16}),kn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ft=Object.freeze({...xn,...kn});Object.freeze({...Ft,body:"",hidden:!1});({...xn});const $n=Object.freeze({width:null,height:null}),Sn=Object.freeze({...$n,...kn});function Vr(t,e){const n={...t};for(const r in e){const i=e[r],a=typeof i;r in $n?(i===null||i&&(a==="string"||a==="number"))&&(n[r]=i):a===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const qr=/[\s,]+/;function Br(t,e){e.split(qr).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Gr(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 Wr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Kr=/^-?[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(Wr);if(r===null||!r.length)return t;const i=[];let a=r.shift(),s=Kr.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 Jr=t=>t==="unset"||t==="undefined"||t==="none";function Yr(t,e){const n={...Ft,...t},r={...Sn,...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 S={},P=(y,w)=>{Jr(w)||(S[y]=w.toString())};return P("width",d),P("height",m),S.viewBox=i.left.toString()+" "+i.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:S,body:a}}const Xr=/\sid="(\S+)"/g,Qr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Zr=0;function ti(t,e=Qr){const n=[];let r;for(;r=Xr.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+(Zr++).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 ei(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 ni(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function ri(t){return"data:image/svg+xml,"+ni(t)}function ii(t){return'url("'+ri(t)+'")'}const Be={...Sn,inline:!1},ai={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},oi={display:"inline-block"},se={"background-color":"currentColor"},En={"background-color":"transparent"},Ge={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},We={"-webkit-mask":se,mask:se,background:En};for(const t in We){const e=We[t];for(const n in Ge)e[t+"-"+n]=Ge[n]}function si(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function ci(t,e){const n=Vr(Be,e),r=e.mode||"svg",i=r==="svg"?{...ai}:{};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"&&Br(n,v);break;case"color":a=a+(a.length>0&&a.trim().slice(-1)!==";"?";":"")+"color: "+v+"; ";break;case"rotate":typeof v=="string"?n[x]=Gr(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=Yr(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:ti(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),S=ei(c,{...o,width:l+"",height:d+""}),y={"--svg":ii(S)},w=x=>{const v=o[x];v&&(y[x]=si(v))};w("width"),w("height"),Object.assign(y,oi,m?se:En);let R="";for(const x in y)R+=x+": "+y[x]+";";return i.style=R+a,{svg:!1,attributes:i}}const li=Object.create(null);function fi(t){const e=typeof t.icon=="string"?li[t.icon]:typeof t.icon=="object"?{...Ft,...t.icon}:null;return e===null||typeof e!="object"||typeof e.body!="string"?null:ci({...Ft,...e},t)}function Ke(t){let e;function n(a,s){return a[0].svg?di:ui}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 ui(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=fi(e))},e=Re(e),[r]}class Bi extends pn{constructor(e){super(),hn(this,e,pi,hi,ce,{})}}function _i(t){const e=t-1;return e*e*e+1}function Gi(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 Wi(t,{delay:e=0,duration:n=400,easing:r=_i,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]}`]),S=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*S}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;`}}export{Gi as $,ae as A,Oe as B,rr as C,Yt as D,Vi as E,je as F,Oi as G,Fi as H,Mi as I,sr as J,cr as K,Li as L,Nn as M,bt as N,Bi as O,Re as P,Hi as Q,yi as R,pn as S,Vt as T,Rr as U,Di as V,ki as W,$i as X,rt as Y,It as Z,Ii as _,ie as a,Wi as a0,Ci as a1,Ri as a2,ji as a3,Ai as a4,Ui as a5,Pi as a6,zi as a7,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,ar as l,qn as m,Ei as n,Wn as o,Si as p,z as q,Jt as r,ce as s,un as t,vi as u,Nt as v,ir as w,Ni as x,Ti as y,vt as z}; diff --git a/_app/immutable/entry/app.33bb3f63.js b/_app/immutable/entry/app.245f9055.js similarity index 89% rename from _app/immutable/entry/app.33bb3f63.js rename to _app/immutable/entry/app.245f9055.js index c32a091d..b7fa7043 100644 --- a/_app/immutable/entry/app.33bb3f63.js +++ b/_app/immutable/entry/app.245f9055.js @@ -1 +1 @@ -import{_ as y}from"../chunks/preload-helper.a4192956.js";import{S as z,i as B,s as F,m as G,v as u,o as H,g as w,l as m,w as N,t as p,d,x as J,r as K,e as M,a as U,b as j,f as R,y as E,z as Q,A as W,B as X,C as D,D as Y,F as A,G as g,H as b,I as P,J as k,K as v}from"../chunks/vendor_svelte.4e97ec88.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&&P(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&&P(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&&P(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&&P(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&&P(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 L(o){let e,n=o[7]&&O(o);return{c(){e=M("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(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(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]&&L(o);return{c(){n.c(),r=G(),_&&_.c(),i=u()},l(l){n.l(l),r=H(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):(_=L(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;J(r.page.notify);let h=!1,I=!1,V=null;K(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,V=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 S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function q(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,V,r,i,T,$,C,S,q]}class le extends z{constructor(e){super(),B(this,e,re,se,F,{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.ec510e05.js"),["../nodes/0.ec510e05.js","../chunks/vendor_svelte.4e97ec88.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/1.d7c29b47.js"),["../nodes/1.d7c29b47.js","../chunks/vendor_svelte.4e97ec88.js","../chunks/vendor.1acf520b.js"],import.meta.url),()=>y(()=>import("../nodes/2.9da74483.js"),["../nodes/2.9da74483.js","../chunks/vendor_svelte.4e97ec88.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/3.e35b7e69.js"),["../nodes/3.e35b7e69.js","../chunks/3.497149d2.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.4e97ec88.js","../chunks/vendor.1acf520b.js","../assets/3.09e3bbae.css"],import.meta.url),()=>y(()=>import("../nodes/4.33764810.js"),["../nodes/4.33764810.js","../chunks/vendor_svelte.4e97ec88.js","../chunks/vendor.1acf520b.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 z,i as B,s as F,m as G,v as u,o as H,g as w,l as m,w as N,t as p,d,x as J,r as K,e as M,a as U,b as j,f as R,y as E,z as Q,A as W,B as X,C as D,D as Y,F as A,G as g,H as b,I as P,J as k,K as v}from"../chunks/vendor_svelte.abb8ca64.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&&P(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&&P(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&&P(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&&P(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&&P(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 L(o){let e,n=o[7]&&O(o);return{c(){e=M("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(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(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]&&L(o);return{c(){n.c(),r=G(),_&&_.c(),i=u()},l(l){n.l(l),r=H(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):(_=L(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;J(r.page.notify);let h=!1,I=!1,V=null;K(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,V=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 S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function q(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,V,r,i,T,$,C,S,q]}class le extends z{constructor(e){super(),B(this,e,re,se,F,{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.a8589cdf.js"),["../nodes/0.a8589cdf.js","../chunks/vendor_svelte.abb8ca64.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/1.be36a4a4.js"),["../nodes/1.be36a4a4.js","../chunks/vendor_svelte.abb8ca64.js","../chunks/vendor.1acf520b.js"],import.meta.url),()=>y(()=>import("../nodes/2.336d65a0.js"),["../nodes/2.336d65a0.js","../chunks/vendor_svelte.abb8ca64.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/3.db9fbe4e.js"),["../nodes/3.db9fbe4e.js","../chunks/3.841cbed9.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.abb8ca64.js","../chunks/vendor.1acf520b.js","../assets/3.09e3bbae.css"],import.meta.url),()=>y(()=>import("../nodes/4.e35c602e.js"),["../nodes/4.e35c602e.js","../chunks/vendor_svelte.abb8ca64.js","../chunks/vendor.1acf520b.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.1bd097c7.js b/_app/immutable/entry/start.1bd097c7.js deleted file mode 100644 index 597cfc8f..00000000 --- a/_app/immutable/entry/start.1bd097c7.js +++ /dev/null @@ -1 +0,0 @@ -import{a7 as t}from"../chunks/vendor_svelte.4e97ec88.js";export{t as start}; diff --git a/_app/immutable/entry/start.b14af70f.js b/_app/immutable/entry/start.b14af70f.js new file mode 100644 index 00000000..2d3c9517 --- /dev/null +++ b/_app/immutable/entry/start.b14af70f.js @@ -0,0 +1 @@ +import{a7 as t}from"../chunks/vendor_svelte.abb8ca64.js";export{t as start}; diff --git a/_app/immutable/nodes/0.ec510e05.js b/_app/immutable/nodes/0.a8589cdf.js similarity index 91% rename from _app/immutable/nodes/0.ec510e05.js rename to _app/immutable/nodes/0.a8589cdf.js index a31b7c98..fbebcdf7 100644 --- a/_app/immutable/nodes/0.ec510e05.js +++ b/_app/immutable/nodes/0.a8589cdf.js @@ -1 +1 @@ -import{S as a,i as r,s as i,c as u,u as _,j as f,k as c,t as p,l as m}from"../chunks/vendor_svelte.4e97ec88.js";/* empty css */const d=!0,S=Object.freeze(Object.defineProperty({__proto__:null,prerender:d},Symbol.toStringTag,{value:"Module"}));function $(n){let s;const l=n[1].default,e=u(l,n,n[0],null);return{c(){e&&e.c()},l(t){e&&e.l(t)},m(t,o){e&&e.m(t,o),s=!0},p(t,[o]){e&&e.p&&(!s||o&1)&&_(e,l,t,t[0],s?c(l,t[0],o,null):f(t[0]),null)},i(t){s||(p(e,t),s=!0)},o(t){m(e,t),s=!1},d(t){e&&e.d(t)}}}function g(n,s,l){let{$$slots:e={},$$scope:t}=s;return n.$$set=o=>{"$$scope"in o&&l(0,t=o.$$scope)},[t,e]}class j extends a{constructor(s){super(),r(this,s,g,$,i,{})}}export{j as component,S as universal}; +import{S as a,i as r,s as i,c as u,u as _,j as f,k as c,t as p,l as m}from"../chunks/vendor_svelte.abb8ca64.js";/* empty css */const d=!0,S=Object.freeze(Object.defineProperty({__proto__:null,prerender:d},Symbol.toStringTag,{value:"Module"}));function $(n){let s;const l=n[1].default,e=u(l,n,n[0],null);return{c(){e&&e.c()},l(t){e&&e.l(t)},m(t,o){e&&e.m(t,o),s=!0},p(t,[o]){e&&e.p&&(!s||o&1)&&_(e,l,t,t[0],s?c(l,t[0],o,null):f(t[0]),null)},i(t){s||(p(e,t),s=!0)},o(t){m(e,t),s=!1},d(t){e&&e.d(t)}}}function g(n,s,l){let{$$slots:e={},$$scope:t}=s;return n.$$set=o=>{"$$scope"in o&&l(0,t=o.$$scope)},[t,e]}class j extends a{constructor(s){super(),r(this,s,g,$,i,{})}}export{j as component,S as universal}; diff --git a/_app/immutable/nodes/1.be36a4a4.js b/_app/immutable/nodes/1.be36a4a4.js new file mode 100644 index 00000000..d9e83723 --- /dev/null +++ b/_app/immutable/nodes/1.be36a4a4.js @@ -0,0 +1 @@ +import{E as m}from"../chunks/vendor_svelte.abb8ca64.js";export{m as component}; diff --git a/_app/immutable/nodes/1.d7c29b47.js b/_app/immutable/nodes/1.d7c29b47.js deleted file mode 100644 index be964c55..00000000 --- a/_app/immutable/nodes/1.d7c29b47.js +++ /dev/null @@ -1 +0,0 @@ -import{E as m}from"../chunks/vendor_svelte.4e97ec88.js";export{m as component}; diff --git a/_app/immutable/nodes/2.9da74483.js b/_app/immutable/nodes/2.336d65a0.js similarity index 93% rename from _app/immutable/nodes/2.9da74483.js rename to _app/immutable/nodes/2.336d65a0.js index a09bb31b..09dcac71 100644 --- a/_app/immutable/nodes/2.9da74483.js +++ b/_app/immutable/nodes/2.336d65a0.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.4e97ec88.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.abb8ca64.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.db9fbe4e.js b/_app/immutable/nodes/3.db9fbe4e.js new file mode 100644 index 00000000..9126eba7 --- /dev/null +++ b/_app/immutable/nodes/3.db9fbe4e.js @@ -0,0 +1 @@ +import{P as m}from"../chunks/3.841cbed9.js";export{m as component}; diff --git a/_app/immutable/nodes/3.e35b7e69.js b/_app/immutable/nodes/3.e35b7e69.js deleted file mode 100644 index 8d865c67..00000000 --- a/_app/immutable/nodes/3.e35b7e69.js +++ /dev/null @@ -1 +0,0 @@ -import{P as m}from"../chunks/3.497149d2.js";export{m as component}; diff --git a/_app/immutable/nodes/4.33764810.js b/_app/immutable/nodes/4.e35c602e.js similarity index 93% rename from _app/immutable/nodes/4.33764810.js rename to _app/immutable/nodes/4.e35c602e.js index 3f14de47..902a80bb 100644 --- a/_app/immutable/nodes/4.33764810.js +++ b/_app/immutable/nodes/4.e35c602e.js @@ -1 +1 @@ -import{S as y,i as C,s as v,e as u,m as b,a as m,n as _,o as g,b as k,d as c,f as p,g as d,h as S,p as P,q as x,r as T}from"../chunks/vendor_svelte.4e97ec88.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 y{constructor(t){super(),C(this,t,E,q,v,{})}}export{O as component}; +import{S as y,i as C,s as v,e as u,m as b,a as m,n as _,o as g,b as k,d as c,f as p,g as d,h as S,p as P,q as x,r as T}from"../chunks/vendor_svelte.abb8ca64.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 y{constructor(t){super(),C(this,t,E,q,v,{})}}export{O as component}; diff --git a/_app/version.json b/_app/version.json index 53e3a7b0..5cf60e13 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1709756716509"} \ No newline at end of file +{"version":"1709757443013"} \ No newline at end of file diff --git a/index.html b/index.html index c91369d8..fc9c1c22 100644 --- a/index.html +++ b/index.html @@ -22,10 +22,10 @@ - - + + - + @@ -33,7 +33,7 @@