diff --git a/_app/immutable/assets/3.4b59a7fc.css b/_app/immutable/assets/3.4b59a7fc.css deleted file mode 100644 index ad18380b..00000000 --- a/_app/immutable/assets/3.4b59a7fc.css +++ /dev/null @@ -1 +0,0 @@ -.midi-body.svelte-5m5dii{display:grid;gap:.5rem;grid-template-columns:25% 25% 25%;grid-template-rows:auto;align-items:center}@media (width <= 475px){.midi-body.svelte-5m5dii{grid-template-columns:50% 50%}}.error.svelte-5m5dii{font-size:.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity))}.staff.svelte-115d3uv.svelte-115d3uv{font-family:Noto Music,sans-serif;position:relative}.staff.svelte-115d3uv .line.svelte-115d3uv{border-top:.1rem solid #222;margin:.75rem 0}.staff.svelte-115d3uv .line.invisible.svelte-115d3uv{border-color:transparent}.staff.svelte-115d3uv .g-clef.svelte-115d3uv{font-size:3.6rem;bottom:4.2rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-115d3uv .f-clef.svelte-115d3uv{bottom:-.7rem;font-size:3.6rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-115d3uv .note.svelte-115d3uv{font-size:3.6rem;position:absolute}.staff.svelte-115d3uv .target.svelte-115d3uv{display:none;left:6rem}.staff.svelte-115d3uv .played.svelte-115d3uv{display:none;left:9rem}.staff.svelte-115d3uv .ledger-line.svelte-115d3uv{position:relative}.staff.svelte-115d3uv .ledger-line.svelte-115d3uv:after{border-top:.1rem solid #222;bottom:1.35rem;content:" ";display:block;position:absolute;width:1.86rem}.wrong{color:red}.correct{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity))}.objective.svelte-1dxpmgm{display:flex} diff --git a/_app/immutable/assets/3.c62292fd.css b/_app/immutable/assets/3.c62292fd.css new file mode 100644 index 00000000..2148265e --- /dev/null +++ b/_app/immutable/assets/3.c62292fd.css @@ -0,0 +1 @@ +.midi-body.svelte-haigqy{display:grid;gap:.5rem;grid-template-columns:25% 25% 25% 25%;grid-template-rows:auto;align-items:center}@media (width <= 475px){.midi-body.svelte-haigqy{grid-template-columns:50% 50%}}.error.svelte-haigqy{font-size:.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity))}.staff.svelte-11g762w.svelte-11g762w{font-family:Noto Music,sans-serif;position:relative}.staff.svelte-11g762w .line.svelte-11g762w{border-top:.1rem solid #222;margin:.75rem 0}.staff.svelte-11g762w .line.invisible.svelte-11g762w{border-color:transparent}.staff.svelte-11g762w .g-clef.svelte-11g762w{font-size:3.6rem;bottom:4.12rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-11g762w .f-clef.svelte-11g762w{bottom:-.7rem;font-size:3.6rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-11g762w .note.svelte-11g762w{font-size:3.6rem;position:absolute}.staff.svelte-11g762w .target.svelte-11g762w{display:none;left:6rem}.staff.svelte-11g762w .played.svelte-11g762w{display:none;left:9rem}.staff.svelte-11g762w .ledger-line.svelte-11g762w{position:relative}.staff.svelte-11g762w .ledger-line.svelte-11g762w:after{border-top:.1rem solid #222;bottom:1.35rem;content:" ";display:block;position:absolute;width:1.86rem}.wrong{color:red}.correct{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity))}.objective.svelte-1dxpmgm{display:flex} diff --git a/_app/immutable/assets/_page.lm1KPwFM.css b/_app/immutable/assets/_page.lm1KPwFM.css deleted file mode 100644 index ad18380b..00000000 --- a/_app/immutable/assets/_page.lm1KPwFM.css +++ /dev/null @@ -1 +0,0 @@ -.midi-body.svelte-5m5dii{display:grid;gap:.5rem;grid-template-columns:25% 25% 25%;grid-template-rows:auto;align-items:center}@media (width <= 475px){.midi-body.svelte-5m5dii{grid-template-columns:50% 50%}}.error.svelte-5m5dii{font-size:.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity))}.staff.svelte-115d3uv.svelte-115d3uv{font-family:Noto Music,sans-serif;position:relative}.staff.svelte-115d3uv .line.svelte-115d3uv{border-top:.1rem solid #222;margin:.75rem 0}.staff.svelte-115d3uv .line.invisible.svelte-115d3uv{border-color:transparent}.staff.svelte-115d3uv .g-clef.svelte-115d3uv{font-size:3.6rem;bottom:4.2rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-115d3uv .f-clef.svelte-115d3uv{bottom:-.7rem;font-size:3.6rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-115d3uv .note.svelte-115d3uv{font-size:3.6rem;position:absolute}.staff.svelte-115d3uv .target.svelte-115d3uv{display:none;left:6rem}.staff.svelte-115d3uv .played.svelte-115d3uv{display:none;left:9rem}.staff.svelte-115d3uv .ledger-line.svelte-115d3uv{position:relative}.staff.svelte-115d3uv .ledger-line.svelte-115d3uv:after{border-top:.1rem solid #222;bottom:1.35rem;content:" ";display:block;position:absolute;width:1.86rem}.wrong{color:red}.correct{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity))}.objective.svelte-1dxpmgm{display:flex} diff --git a/_app/immutable/assets/_page.z0NKiEL6.css b/_app/immutable/assets/_page.z0NKiEL6.css new file mode 100644 index 00000000..2148265e --- /dev/null +++ b/_app/immutable/assets/_page.z0NKiEL6.css @@ -0,0 +1 @@ +.midi-body.svelte-haigqy{display:grid;gap:.5rem;grid-template-columns:25% 25% 25% 25%;grid-template-rows:auto;align-items:center}@media (width <= 475px){.midi-body.svelte-haigqy{grid-template-columns:50% 50%}}.error.svelte-haigqy{font-size:.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity))}.staff.svelte-11g762w.svelte-11g762w{font-family:Noto Music,sans-serif;position:relative}.staff.svelte-11g762w .line.svelte-11g762w{border-top:.1rem solid #222;margin:.75rem 0}.staff.svelte-11g762w .line.invisible.svelte-11g762w{border-color:transparent}.staff.svelte-11g762w .g-clef.svelte-11g762w{font-size:3.6rem;bottom:4.12rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-11g762w .f-clef.svelte-11g762w{bottom:-.7rem;font-size:3.6rem;left:1rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.staff.svelte-11g762w .note.svelte-11g762w{font-size:3.6rem;position:absolute}.staff.svelte-11g762w .target.svelte-11g762w{display:none;left:6rem}.staff.svelte-11g762w .played.svelte-11g762w{display:none;left:9rem}.staff.svelte-11g762w .ledger-line.svelte-11g762w{position:relative}.staff.svelte-11g762w .ledger-line.svelte-11g762w:after{border-top:.1rem solid #222;bottom:1.35rem;content:" ";display:block;position:absolute;width:1.86rem}.wrong{color:red}.correct{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity))}.objective.svelte-1dxpmgm{display:flex} diff --git a/_app/immutable/chunks/singletons.47934468.js b/_app/immutable/chunks/singletons.47934468.js deleted file mode 100644 index 998fd2e5..00000000 --- a/_app/immutable/chunks/singletons.47934468.js +++ /dev/null @@ -1 +0,0 @@ -import{w as u}from"./index.7d157e8c.js";var _;const k=((_=globalThis.__sveltekit_1j4mf6k)==null?void 0:_.base)??"/practise-music-reading";var g;const m=((g=globalThis.__sveltekit_1j4mf6k)==null?void 0:g.assets)??k,w="1705665785306",T="sveltekit:snapshot",y="sveltekit:scroll",I="sveltekit:index",f={tap:1,hover:2,viewport:3,eager:4,off:-1},h=location.origin;function S(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function x(){return{x:pageXOffset,y:pageYOffset}}function c(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const d={...f,"":f.hover};function b(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function O(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=b(e)}}function U(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=(n==null?void 0:n.origin)===h&&e.hasAttribute("download");return{url:n,external:r,target:o,download:l}}function L(e){let t=null,n=null,o=null,r=null,l=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=c(s,"preload-code")),r===null&&(r=c(s,"preload-data")),t===null&&(t=c(s,"keepfocus")),n===null&&(n=c(s,"noscroll")),l===null&&(l=c(s,"reload")),a===null&&(a=c(s,"replacestate")),s=b(s);function i(v){switch(v){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:d[o??"off"],preload_data:d[r??"off"],keep_focus:i(t),noscroll:i(n),reload:i(l),replace_state:i(a)}}function p(e){const t=u(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function l(a){let s;return t.subscribe(i=>{(s===void 0||n&&i!==s)&&a(s=i)})}return{notify:o,set:r,subscribe:l}}function E(){const{set:e,subscribe:t}=u(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${m}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==w;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==h||!e.pathname.startsWith(t)}function N(e){e.client}const j={url:p({}),page:p({}),navigating:u(null),updated:E()};export{I,f as P,y as S,T as a,U as b,L as c,j as d,k as e,O as f,S as g,N as h,A as i,h as o,x as s}; diff --git a/_app/immutable/chunks/singletons.48e6ff28.js b/_app/immutable/chunks/singletons.48e6ff28.js new file mode 100644 index 00000000..206ae295 --- /dev/null +++ b/_app/immutable/chunks/singletons.48e6ff28.js @@ -0,0 +1 @@ +import{w as u}from"./index.7d157e8c.js";var _;const k=((_=globalThis.__sveltekit_ikdznb)==null?void 0:_.base)??"/practise-music-reading";var g;const m=((g=globalThis.__sveltekit_ikdznb)==null?void 0:g.assets)??k,w="1705671758658",T="sveltekit:snapshot",y="sveltekit:scroll",I="sveltekit:index",f={tap:1,hover:2,viewport:3,eager:4,off:-1},h=location.origin;function S(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function x(){return{x:pageXOffset,y:pageYOffset}}function c(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const d={...f,"":f.hover};function b(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function O(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=b(e)}}function U(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=(n==null?void 0:n.origin)===h&&e.hasAttribute("download");return{url:n,external:r,target:o,download:l}}function L(e){let t=null,n=null,o=null,r=null,l=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=c(s,"preload-code")),r===null&&(r=c(s,"preload-data")),t===null&&(t=c(s,"keepfocus")),n===null&&(n=c(s,"noscroll")),l===null&&(l=c(s,"reload")),a===null&&(a=c(s,"replacestate")),s=b(s);function i(v){switch(v){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:d[o??"off"],preload_data:d[r??"off"],keep_focus:i(t),noscroll:i(n),reload:i(l),replace_state:i(a)}}function p(e){const t=u(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function l(a){let s;return t.subscribe(i=>{(s===void 0||n&&i!==s)&&a(s=i)})}return{notify:o,set:r,subscribe:l}}function E(){const{set:e,subscribe:t}=u(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${m}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==w;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==h||!e.pathname.startsWith(t)}function N(e){e.client}const P={url:p({}),page:p({}),navigating:u(null),updated:E()};export{I,f as P,y as S,T as a,U as b,L as c,P as d,k as e,O as f,S as g,N as h,A as i,h as o,x as s}; diff --git a/_app/immutable/entry/app.742aff23.js b/_app/immutable/entry/app.f839ec0e.js similarity index 96% rename from _app/immutable/entry/app.742aff23.js rename to _app/immutable/entry/app.f839ec0e.js index 374df007..0ed5a9b3 100644 --- a/_app/immutable/entry/app.742aff23.js +++ b/_app/immutable/entry/app.f839ec0e.js @@ -1 +1 @@ -import{s as U,a as j,o as W,t as z,b as L}from"../chunks/scheduler.e80da8ef.js";import{S as F,i as G,s as H,e as m,c as J,a as w,t as p,b as y,d as h,f as d,g as K,h as M,j as Q,k as S,l as E,m as X,n as Y,o as Z,p as R,q as g,r as b,u as P,v as k,w as v}from"../chunks/index.3d76737d.js";const x="modulepreload",ee=function(f,e){return new URL(f,e).href},I={},$=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=ee(a,r),a in I)return;I[a]=!0;const t=a.endsWith(".css"),o=t?'[rel="stylesheet"]':"";if(!!r)for(let l=i.length-1;l>=0;l--){const u=i[l];if(u.href===a&&(!t||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${o}`))return;const c=document.createElement("link");if(c.rel=t?"stylesheet":x,t||(c.as="script",c.crossOrigin=""),c.href=a,document.head.appendChild(c),t)return new Promise((l,u)=>{c.addEventListener("load",l),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e()).catch(a=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=a,window.dispatchEvent(t),!t.defaultPrevented)throw a})},_e={};function te(f){let e,n,r;var i=f[1][0];function a(t,o){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,a(f)),f[15](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][0])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[15](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&8&&(s.data=t[3]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[15](null),e&&v(e,t)}}}function ne(f){let e,n,r;var i=f[1][0];function a(t,o){return{props:{data:t[3],$$slots:{default:[oe]},$$scope:{ctx:t}}}}return i&&(e=g(i,a(f)),f[14](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][0])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[14](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&8&&(s.data=t[3]),o&65591&&(s.$$scope={dirty:o,ctx:t}),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[14](null),e&&v(e,t)}}}function ie(f){let e,n,r;var i=f[1][1];function a(t,o){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,a(f)),f[13](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][1])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[13](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&16&&(s.data=t[4]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[13](null),e&&v(e,t)}}}function se(f){let e,n,r;var i=f[1][1];function a(t,o){return{props:{data:t[4],$$slots:{default:[re]},$$scope:{ctx:t}}}}return i&&(e=g(i,a(f)),f[12](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][1])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[12](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&16&&(s.data=t[4]),o&65575&&(s.$$scope={dirty:o,ctx:t}),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[12](null),e&&v(e,t)}}}function re(f){let e,n,r;var i=f[1][2];function a(t,o){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,a(f)),f[11](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][2])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[11](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&32&&(s.data=t[5]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[11](null),e&&v(e,t)}}}function oe(f){let e,n,r,i;const a=[se,ie],t=[];function o(s,c){return s[1][2]?0:1}return e=o(f),n=t[e]=a[e](f),{c(){n.c(),r=m()},l(s){n.l(s),r=m()},m(s,c){t[e].m(s,c),w(s,r,c),i=!0},p(s,c){let l=e;e=o(s),e===l?t[e].p(s,c):(R(),p(t[l],1,1,()=>{t[l]=null}),y(),n=t[e],n?n.p(s,c):(n=t[e]=a[e](s),n.c()),h(n,1),n.m(r.parentNode,r))},i(s){i||(h(n),i=!0)},o(s){p(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function O(f){let e,n=f[7]&&T(f);return{c(){e=K("div"),n&&n.c(),this.h()},l(r){e=M(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=Q(e);n&&n.l(i),i.forEach(d),this.h()},h(){S(e,"id","svelte-announcer"),S(e,"aria-live","assertive"),S(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=T(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function T(f){let e;return{c(){e=X(f[8])},l(n){e=Y(n,f[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&Z(e,n[8])},d(n){n&&d(e)}}}function fe(f){let e,n,r,i,a;const t=[ne,te],o=[];function s(l,u){return l[1][1]?0:1}e=s(f),n=o[e]=t[e](f);let c=f[6]&&O(f);return{c(){n.c(),r=H(),c&&c.c(),i=m()},l(l){n.l(l),r=J(l),c&&c.l(l),i=m()},m(l,u){o[e].m(l,u),w(l,r,u),c&&c.m(l,u),w(l,i,u),a=!0},p(l,[u]){let N=e;e=s(l),e===N?o[e].p(l,u):(R(),p(o[N],1,1,()=>{o[N]=null}),y(),n=o[e],n?n.p(l,u):(n=o[e]=t[e](l),n.c()),h(n,1),n.m(r.parentNode,r)),l[6]?c?c.p(l,u):(c=O(l),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i(l){a||(h(n),a=!0)},o(l){p(n),a=!1},d(l){l&&(d(r),d(i)),o[e].d(l),c&&c.d(l)}}}function ae(f,e,n){let{stores:r}=e,{page:i}=e,{constructors:a}=e,{components:t=[]}=e,{form:o}=e,{data_0:s=null}=e,{data_1:c=null}=e,{data_2:l=null}=e;j(r.page.notify);let u=!1,N=!1,D=null;W(()=>{const _=r.page.subscribe(()=>{u&&(n(7,N=!0),z().then(()=>{n(8,D=document.title||"untitled page")}))});return n(6,u=!0),_});function V(_){L[_?"unshift":"push"](()=>{t[2]=_,n(0,t)})}function A(_){L[_?"unshift":"push"](()=>{t[1]=_,n(0,t)})}function C(_){L[_?"unshift":"push"](()=>{t[1]=_,n(0,t)})}function q(_){L[_?"unshift":"push"](()=>{t[0]=_,n(0,t)})}function B(_){L[_?"unshift":"push"](()=>{t[0]=_,n(0,t)})}return f.$$set=_=>{"stores"in _&&n(9,r=_.stores),"page"in _&&n(10,i=_.page),"constructors"in _&&n(1,a=_.constructors),"components"in _&&n(0,t=_.components),"form"in _&&n(2,o=_.form),"data_0"in _&&n(3,s=_.data_0),"data_1"in _&&n(4,c=_.data_1),"data_2"in _&&n(5,l=_.data_2)},f.$$.update=()=>{f.$$.dirty&1536&&r.page.set(i)},[t,a,o,s,c,l,u,N,D,r,i,V,A,C,q,B]}class ue extends F{constructor(e){super(),G(this,e,ae,fe,U,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const me=[()=>$(()=>import("../nodes/0.7cc727eb.js"),["../nodes/0.7cc727eb.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../assets/tailwind.b9bd0710.css"],import.meta.url),()=>$(()=>import("../nodes/1.40fe253f.js"),["../nodes/1.40fe253f.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../chunks/singletons.47934468.js","../chunks/index.7d157e8c.js"],import.meta.url),()=>$(()=>import("../nodes/2.e0dcdf55.js"),["../nodes/2.e0dcdf55.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../assets/tailwind.b9bd0710.css"],import.meta.url),()=>$(()=>import("../nodes/3.7ec0ec65.js"),["../nodes/3.7ec0ec65.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../chunks/index.7d157e8c.js","../assets/3.4b59a7fc.css"],import.meta.url)],pe=[],he={"/(site)":[3,[2]]},de={handleError:({error:f})=>{console.error(f)}};export{he as dictionary,de as hooks,_e as matchers,me as nodes,ue as root,pe as server_loads}; +import{s as U,a as j,o as W,t as z,b as L}from"../chunks/scheduler.e80da8ef.js";import{S as F,i as G,s as H,e as m,c as J,a as w,t as p,b as y,d as h,f as d,g as K,h as M,j as Q,k as S,l as E,m as X,n as Y,o as Z,p as R,q as g,r as b,u as P,v as k,w as v}from"../chunks/index.3d76737d.js";const x="modulepreload",ee=function(f,e){return new URL(f,e).href},I={},$=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=ee(a,r),a in I)return;I[a]=!0;const t=a.endsWith(".css"),o=t?'[rel="stylesheet"]':"";if(!!r)for(let l=i.length-1;l>=0;l--){const u=i[l];if(u.href===a&&(!t||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${o}`))return;const c=document.createElement("link");if(c.rel=t?"stylesheet":x,t||(c.as="script",c.crossOrigin=""),c.href=a,document.head.appendChild(c),t)return new Promise((l,u)=>{c.addEventListener("load",l),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e()).catch(a=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=a,window.dispatchEvent(t),!t.defaultPrevented)throw a})},_e={};function te(f){let e,n,r;var i=f[1][0];function a(t,o){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,a(f)),f[15](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][0])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[15](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&8&&(s.data=t[3]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[15](null),e&&v(e,t)}}}function ne(f){let e,n,r;var i=f[1][0];function a(t,o){return{props:{data:t[3],$$slots:{default:[oe]},$$scope:{ctx:t}}}}return i&&(e=g(i,a(f)),f[14](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][0])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[14](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&8&&(s.data=t[3]),o&65591&&(s.$$scope={dirty:o,ctx:t}),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[14](null),e&&v(e,t)}}}function ie(f){let e,n,r;var i=f[1][1];function a(t,o){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,a(f)),f[13](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][1])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[13](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&16&&(s.data=t[4]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[13](null),e&&v(e,t)}}}function se(f){let e,n,r;var i=f[1][1];function a(t,o){return{props:{data:t[4],$$slots:{default:[re]},$$scope:{ctx:t}}}}return i&&(e=g(i,a(f)),f[12](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][1])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[12](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&16&&(s.data=t[4]),o&65575&&(s.$$scope={dirty:o,ctx:t}),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[12](null),e&&v(e,t)}}}function re(f){let e,n,r;var i=f[1][2];function a(t,o){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,a(f)),f[11](e)),{c(){e&&b(e.$$.fragment),n=m()},l(t){e&&P(e.$$.fragment,t),n=m()},m(t,o){e&&k(e,t,o),w(t,n,o),r=!0},p(t,o){if(o&2&&i!==(i=t[1][2])){if(e){R();const s=e;p(s.$$.fragment,1,0,()=>{v(s,1)}),y()}i?(e=g(i,a(t)),t[11](e),b(e.$$.fragment),h(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};o&32&&(s.data=t[5]),o&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&h(e.$$.fragment,t),r=!0)},o(t){e&&p(e.$$.fragment,t),r=!1},d(t){t&&d(n),f[11](null),e&&v(e,t)}}}function oe(f){let e,n,r,i;const a=[se,ie],t=[];function o(s,c){return s[1][2]?0:1}return e=o(f),n=t[e]=a[e](f),{c(){n.c(),r=m()},l(s){n.l(s),r=m()},m(s,c){t[e].m(s,c),w(s,r,c),i=!0},p(s,c){let l=e;e=o(s),e===l?t[e].p(s,c):(R(),p(t[l],1,1,()=>{t[l]=null}),y(),n=t[e],n?n.p(s,c):(n=t[e]=a[e](s),n.c()),h(n,1),n.m(r.parentNode,r))},i(s){i||(h(n),i=!0)},o(s){p(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function O(f){let e,n=f[7]&&T(f);return{c(){e=K("div"),n&&n.c(),this.h()},l(r){e=M(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=Q(e);n&&n.l(i),i.forEach(d),this.h()},h(){S(e,"id","svelte-announcer"),S(e,"aria-live","assertive"),S(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=T(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function T(f){let e;return{c(){e=X(f[8])},l(n){e=Y(n,f[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&Z(e,n[8])},d(n){n&&d(e)}}}function fe(f){let e,n,r,i,a;const t=[ne,te],o=[];function s(l,u){return l[1][1]?0:1}e=s(f),n=o[e]=t[e](f);let c=f[6]&&O(f);return{c(){n.c(),r=H(),c&&c.c(),i=m()},l(l){n.l(l),r=J(l),c&&c.l(l),i=m()},m(l,u){o[e].m(l,u),w(l,r,u),c&&c.m(l,u),w(l,i,u),a=!0},p(l,[u]){let N=e;e=s(l),e===N?o[e].p(l,u):(R(),p(o[N],1,1,()=>{o[N]=null}),y(),n=o[e],n?n.p(l,u):(n=o[e]=t[e](l),n.c()),h(n,1),n.m(r.parentNode,r)),l[6]?c?c.p(l,u):(c=O(l),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i(l){a||(h(n),a=!0)},o(l){p(n),a=!1},d(l){l&&(d(r),d(i)),o[e].d(l),c&&c.d(l)}}}function ae(f,e,n){let{stores:r}=e,{page:i}=e,{constructors:a}=e,{components:t=[]}=e,{form:o}=e,{data_0:s=null}=e,{data_1:c=null}=e,{data_2:l=null}=e;j(r.page.notify);let u=!1,N=!1,D=null;W(()=>{const _=r.page.subscribe(()=>{u&&(n(7,N=!0),z().then(()=>{n(8,D=document.title||"untitled page")}))});return n(6,u=!0),_});function V(_){L[_?"unshift":"push"](()=>{t[2]=_,n(0,t)})}function A(_){L[_?"unshift":"push"](()=>{t[1]=_,n(0,t)})}function C(_){L[_?"unshift":"push"](()=>{t[1]=_,n(0,t)})}function q(_){L[_?"unshift":"push"](()=>{t[0]=_,n(0,t)})}function B(_){L[_?"unshift":"push"](()=>{t[0]=_,n(0,t)})}return f.$$set=_=>{"stores"in _&&n(9,r=_.stores),"page"in _&&n(10,i=_.page),"constructors"in _&&n(1,a=_.constructors),"components"in _&&n(0,t=_.components),"form"in _&&n(2,o=_.form),"data_0"in _&&n(3,s=_.data_0),"data_1"in _&&n(4,c=_.data_1),"data_2"in _&&n(5,l=_.data_2)},f.$$.update=()=>{f.$$.dirty&1536&&r.page.set(i)},[t,a,o,s,c,l,u,N,D,r,i,V,A,C,q,B]}class ue extends F{constructor(e){super(),G(this,e,ae,fe,U,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const me=[()=>$(()=>import("../nodes/0.7cc727eb.js"),["../nodes/0.7cc727eb.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../assets/tailwind.b9bd0710.css"],import.meta.url),()=>$(()=>import("../nodes/1.9123b1cf.js"),["../nodes/1.9123b1cf.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../chunks/singletons.48e6ff28.js","../chunks/index.7d157e8c.js"],import.meta.url),()=>$(()=>import("../nodes/2.e0dcdf55.js"),["../nodes/2.e0dcdf55.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../assets/tailwind.b9bd0710.css"],import.meta.url),()=>$(()=>import("../nodes/3.9cb6a4d0.js"),["../nodes/3.9cb6a4d0.js","../chunks/scheduler.e80da8ef.js","../chunks/index.3d76737d.js","../chunks/index.7d157e8c.js","../assets/3.c62292fd.css"],import.meta.url)],pe=[],he={"/(site)":[3,[2]]},de={handleError:({error:f})=>{console.error(f)}};export{he as dictionary,de as hooks,_e as matchers,me as nodes,ue as root,pe as server_loads}; diff --git a/_app/immutable/entry/start.394a0d9e.js b/_app/immutable/entry/start.96fc5f31.js similarity index 99% rename from _app/immutable/entry/start.394a0d9e.js rename to _app/immutable/entry/start.96fc5f31.js index 79a4901e..213b0096 100644 --- a/_app/immutable/entry/start.394a0d9e.js +++ b/_app/immutable/entry/start.96fc5f31.js @@ -1,3 +1,3 @@ -import{o as me,t as we}from"../chunks/scheduler.e80da8ef.js";import{S as Ge,a as Je,I as V,g as De,f as Ce,b as _e,c as le,s as te,i as ye,d as H,o as Me,e as G,P as Ve,h as Ze}from"../chunks/singletons.47934468.js";function Qe(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function et(t){return t.split("%25").map(decodeURI).join("%25")}function tt(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const nt=["href","pathname","search","searchParams","toString","toJSON"];function at(t,r){const f=new URL(t);for(const i of nt)Object.defineProperty(f,i,{get(){return r(),t[i]},enumerable:!0,configurable:!0});return rt(f),f}function rt(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const ot="/__data.json";function it(t){return t.replace(/\/$/,"")+ot}function st(...t){let r=5381;for(const f of t)if(typeof f=="string"){let i=f.length;for(;i;)r=r*33^f.charCodeAt(--i)}else if(ArrayBuffer.isView(f)){const i=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);let h=i.length;for(;h;)r=r*33^i[--h]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const Ke=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ae.delete(Se(t)),Ke(t,r));const ae=new Map;function ct(t,r){const f=Se(t,r),i=document.querySelector(f);if(i!=null&&i.textContent){const{body:h,...u}=JSON.parse(i.textContent),E=i.getAttribute("data-ttl");return E&&ae.set(f,{body:h,init:u,ttl:1e3*Number(E)}),Promise.resolve(new Response(h,u))}return window.fetch(t,r)}function lt(t,r,f){if(ae.size>0){const i=Se(t,f),h=ae.get(i);if(h){if(performance.now(){const h=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(i);if(h)return r.push({name:h[1],matcher:h[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const u=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(i);if(u)return r.push({name:u[1],matcher:u[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!i)return;const E=i.split(/\[(.+?)\](?!\])/);return"/"+E.map((g,m)=>{if(m%2){if(g.startsWith("x+"))return ve(String.fromCharCode(parseInt(g.slice(2),16)));if(g.startsWith("u+"))return ve(String.fromCharCode(...g.slice(2).split("-").map(U=>parseInt(U,16))));const d=ft.exec(g);if(!d)throw new Error(`Invalid param: ${g}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,j,T,R,C]=d;return r.push({name:R,matcher:C,optional:!!j,rest:!!T,chained:T?m===1&&E[0]==="":!1}),T?"(.*?)":j?"([^/]*)?":"([^/]+?)"}return ve(g)}).join("")}).join("")}/?$`),params:r}}function dt(t){return!/^\([^)]+\)$/.test(t)}function pt(t){return t.slice(1).split("/").filter(dt)}function ht(t,r,f){const i={},h=t.slice(1),u=h.filter(l=>l!==void 0);let E=0;for(let l=0;ld).join("/"),E=0),m===void 0){g.rest&&(i[g.name]="");continue}if(!g.matcher||f[g.matcher](m)){i[g.name]=m;const d=r[l+1],j=h[l+1];d&&!d.rest&&d.optional&&j&&g.chained&&(E=0),!d&&!j&&Object.keys(i).length===u.length&&(E=0);continue}if(g.optional&&g.chained){E++;continue}return}if(!E)return i}function ve(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function gt({nodes:t,server_loads:r,dictionary:f,matchers:i}){const h=new Set(r);return Object.entries(f).map(([l,[g,m,d]])=>{const{pattern:j,params:T}=ut(l),R={id:l,exec:C=>{const U=j.exec(C);if(U)return ht(U,T,i)},errors:[1,...d||[]].map(C=>t[C]),layouts:[0,...m||[]].map(E),leaf:u(g)};return R.errors.length=R.layouts.length=Math.max(R.errors.length,R.layouts.length),R});function u(l){const g=l<0;return g&&(l=~l),[g,t[l]]}function E(l){return l===void 0?l:[h.has(l),t[l]]}}function ze(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const f=JSON.stringify(r);try{sessionStorage[t]=f}catch{}}const mt=-1,wt=-2,_t=-3,yt=-4,vt=-5,bt=-6;function Et(t,r){if(typeof t=="number")return h(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const f=t,i=Array(f.length);function h(u,E=!1){if(u===mt)return;if(u===_t)return NaN;if(u===yt)return 1/0;if(u===vt)return-1/0;if(u===bt)return-0;if(E)throw new Error("Invalid input");if(u in i)return i[u];const l=f[u];if(!l||typeof l!="object")i[u]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const g=l[0],m=r==null?void 0:r[g];if(m)return i[u]=m(h(l[1]));switch(g){case"Date":i[u]=new Date(l[1]);break;case"Set":const d=new Set;i[u]=d;for(let R=1;Rr!=null)}const We=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...We];const kt=new Set([...We]);[...kt];async function Rt(t,r){var f;for(const i in t)if(typeof((f=t[i])==null?void 0:f.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([h,u])=>[h,await u])));return t}class ne{constructor(r,f){this.status=r,typeof f=="string"?this.body={message:f}:f?this.body=f:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,f){this.status=r,this.location=f}}const At="x-sveltekit-invalidated",It="x-sveltekit-trailing-slash",J=ze(Ge)??{},ee=ze(Je)??{};function be(t){J[t]=te()}function K(t){return location.href=t.href,new Promise(()=>{})}function Lt(t,r){var Ne;const f=gt(t),i=t.nodes[0],h=t.nodes[1];i(),h();const u=document.documentElement,E=[],l=[];let g=null;const m={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},j=!1,T=!1,R=!0,C=!1,U=!1,D=!1,z=!1,q,x=(Ne=history.state)==null?void 0:Ne[V];x||(x=Date.now(),history.replaceState({...history.state,[V]:x},"",location.href));const fe=J[x];fe&&(history.scrollRestoration="manual",scrollTo(fe.x,fe.y));let F,W,Y;async function ke(){if(Y=Y||Promise.resolve(),await Y,!Y)return;Y=null;const e=new URL(location.href),s=Z(e,!0);g=null;const n=W={},o=s&&await pe(s);if(n===W&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},1,n);o.props.page!==void 0&&(F=o.props.page),q.$set(o.props)}}function Re(e){l.some(s=>s==null?void 0:s.snapshot)&&(ee[e]=l.map(s=>{var n;return(n=s==null?void 0:s.snapshot)==null?void 0:n.capture()}))}function Ae(e){var s;(s=ee[e])==null||s.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Ie(){be(x),qe(Ge,J),Re(x),qe(Je,ee)}async function re(e,{noScroll:s=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},p,v){return typeof e=="string"&&(e=new URL(e,De(document))),ce({url:e,scroll:s?te():null,keepfocus:o,redirect_count:p,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(z=!0)},blocked:()=>{},type:"goto"})}async function Le(e){return g={id:e.id,promise:pe(e).then(s=>(s.type==="loaded"&&s.state.error&&(g=null),s))},g.promise}async function oe(...e){const n=f.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Pe(e){var o;d=e.state;const s=document.querySelector("style[data-sveltekit]");s&&s.remove(),F=e.props.page,q=new t.root({target:r,props:{...e.props,stores:H,components:l},hydrate:!0}),Ae(x);const n={from:null,to:{params:d.params,route:{id:((o=d.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};m.after_navigate.forEach(a=>a(n)),T=!0}async function X({url:e,params:s,branch:n,status:o,error:a,route:c,form:p}){let v="never";for(const _ of n)(_==null?void 0:_.slash)!==void 0&&(v=_.slash);e.pathname=Qe(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:s,branch:n,error:a,route:c},props:{constructors:St(n).map(_=>_.node.component)}};p!==void 0&&(b.props.form=p);let y={},L=!F,A=0;for(let _=0;_(v.route=!0,w[O])}),params:new Proxy(o,{get:(w,O)=>(v.params.add(O),w[O])}),data:(c==null?void 0:c.data)??null,url:at(n,()=>{v.url=!0}),async fetch(w,O){let N;w instanceof Request?(N=w.url,O={body:w.method==="GET"||w.method==="HEAD"?void 0:await w.blob(),cache:w.cache,credentials:w.credentials,headers:w.headers,integrity:w.integrity,keepalive:w.keepalive,method:w.method,mode:w.mode,redirect:w.redirect,referrer:w.referrer,referrerPolicy:w.referrerPolicy,signal:w.signal,...O}):N=w;const M=new URL(N,n);return P(M.href),M.origin===n.origin&&(N=M.href.slice(n.origin.length)),T?lt(N,M.href,O):ct(N,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,s()}};p=await b.universal.load.call(null,_)??null,p=p?await Rt(p,a.id):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:p,uses:v}:null,data:p??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Oe(e,s,n,o,a){if(z)return!0;if(!o)return!1;if(o.parent&&e||o.route&&s||o.url&&n)return!0;for(const c of o.params)if(a[c]!==d.params[c])return!0;for(const c of o.dependencies)if(E.some(p=>p(new URL(c))))return!0;return!1}function de(e,s){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?s??null:null}async function pe({id:e,invalidating:s,url:n,params:o,route:a}){if((g==null?void 0:g.id)===e)return g.promise;const{errors:c,layouts:p,leaf:v}=a,b=[...p,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let y=null;const L=d.url?e!==d.url.pathname+d.url.search:!1,A=d.route?a.id!==d.route.id:!1;let P=!1;const _=b.map((S,I)=>{var B;const k=d.branch[I],$=!!(S!=null&&S[0])&&((k==null?void 0:k.loader)!==S[1]||Oe(P,A,L,(B=k.server)==null?void 0:B.uses,o));return $&&(P=!0),$});if(_.some(Boolean)){try{y=await He(n,_)}catch(S){return ie({status:S instanceof ne?S.status:500,error:await Q(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(y.type==="redirect")return y}const w=y==null?void 0:y.nodes;let O=!1;const N=b.map(async(S,I)=>{var he;if(!S)return;const k=d.branch[I],$=w==null?void 0:w[I];if((!$||$.type==="skip")&&S[1]===(k==null?void 0:k.loader)&&!Oe(O,A,L,(he=k.universal)==null?void 0:he.uses,o))return k;if(O=!0,($==null?void 0:$.type)==="error")throw $;return ue({loader:S[1],url:n,params:o,route:a,parent:async()=>{var Te;const $e={};for(let ge=0;ge{});const M=[];for(let S=0;SPromise.resolve({}),server_data_node:de(c)}),b={node:await h(),loader:h,universal:null,server:null,data:null};return await X({url:n,params:a,branch:[v,b],status:e,error:s,route:null})}function Z(e,s){if(ye(e,G))return;const n=se(e);for(const o of f){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:s,route:o,params:tt(a),url:e}}}function se(e){return et(e.pathname.slice(G.length)||"/")}function Ue({url:e,type:s,intent:n,delta:o}){let a=!1;const c=Be(d,n,e,s);o!==void 0&&(c.navigation.delta=o);const p={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||m.before_navigate.forEach(v=>v(p)),a?null:c}async function ce({url:e,scroll:s,keepfocus:n,redirect_count:o,details:a,type:c,delta:p,nav_token:v={},accepted:b,blocked:y}){var N,M,S;const L=Z(e,!1),A=Ue({url:e,type:c,delta:p,intent:L});if(!A){y();return}const P=x;b(),U=!0,T&&H.navigating.set(A.navigation),W=v;let _=L&&await pe(L);if(!_){if(ye(e,G))return await K(e);_=await je(e,{id:null},await Q(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,W!==v)return A.reject(new Error("navigation was aborted")),!1;if(_.type==="redirect")if(o>=20)_=await ie({status:500,error:await Q(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(_.location,e).href,{},o+1,v),!1;else((N=_.props.page)==null?void 0:N.status)>=400&&await H.updated.check()&&await K(e);if(E.length=0,z=!1,C=!0,be(P),Re(P),(M=_.props.page)!=null&&M.url&&_.props.page.url.pathname!==e.pathname&&(e.pathname=(S=_.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[V]=x+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let k=x+1;for(;ee[k]||J[k];)delete ee[k],delete J[k],k+=1}}if(g=null,T){d=_.state,_.props.page&&(_.props.page.url=e);const I=(await Promise.all(m.on_navigate.map(k=>k(A.navigation)))).filter(k=>typeof k=="function");if(I.length>0){let k=function(){m.after_navigate=m.after_navigate.filter($=>!I.includes($))};I.push(k),m.after_navigate.push(...I)}q.$set(_.props)}else Pe(_);const{activeElement:w}=document;if(await we(),R){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));s?scrollTo(s.x,s.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==w&&document.activeElement!==document.body;!n&&!O&&Ee(),R=!0,_.props.page&&(F=_.props.page),U=!1,c==="popstate"&&Ae(x),A.fulfil(void 0),m.after_navigate.forEach(I=>I(A.navigation)),H.navigating.set(null),C=!1}async function je(e,s,n,o){return e.origin===Me&&e.pathname===location.pathname&&!j?await ie({status:o,error:n,url:e,route:s}):await K(e)}function Xe(){let e;u.addEventListener("mousemove",c=>{const p=c.target;clearTimeout(e),e=setTimeout(()=>{o(p,2)},20)});function s(c){o(c.composedPath()[0],1)}u.addEventListener("mousedown",s),u.addEventListener("touchstart",s,{passive:!0});const n=new IntersectionObserver(c=>{for(const p of c)p.isIntersecting&&(oe(se(new URL(p.target.href))),n.unobserve(p.target))},{threshold:0});function o(c,p){const v=Ce(c,u);if(!v)return;const{url:b,external:y,download:L}=_e(v,G);if(y||L)return;const A=le(v);if(!A.reload)if(p<=A.preload_data){const P=Z(b,!1);P&&Le(P)}else p<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of u.querySelectorAll("a")){const{url:p,external:v,download:b}=_e(c,G);if(v||b)continue;const y=le(c);y.reload||(y.preload_code===Ve.viewport&&n.observe(c),y.preload_code===Ve.eager&&oe(se(p)))}}m.after_navigate.push(a),a()}function Q(e,s){return e instanceof ne?e.body:t.hooks.handleError({error:e,event:s})??{message:s.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{me(()=>(m.after_navigate.push(e),()=>{const s=m.after_navigate.indexOf(e);m.after_navigate.splice(s,1)}))},before_navigate:e=>{me(()=>(m.before_navigate.push(e),()=>{const s=m.before_navigate.indexOf(e);m.before_navigate.splice(s,1)}))},on_navigate:e=>{me(()=>(m.on_navigate.push(e),()=>{const s=m.on_navigate.indexOf(e);m.on_navigate.splice(s,1)}))},disable_scroll_handling:()=>{(C||!T)&&(R=!1)},goto:(e,s={})=>re(e,s,0),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:s}=new URL(e,location.href);E.push(n=>n.href===s)}return ke()},invalidate_all:()=>(z=!0,ke()),preload_data:async e=>{const s=new URL(e,De(document)),n=Z(s,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${s}`);await Le(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const s=new URL(location.href),{branch:n,route:o}=d;if(!o)return;const a=await xe(d.branch.length,n,o.errors);if(a){const c=await X({url:s,params:d.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});d=c.state,q.$set(c.props),we().then(Ee)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},0):(q.$set({form:null,page:{...F,form:e.data,status:e.status}}),await we(),q.$set({form:e.data}),e.type==="success"&&Ee())},_start_router:()=>{var s;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Ie(),!U){const a=Be(d,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};m.before_navigate.forEach(p=>p(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ie()}),(s=navigator.connection)!=null&&s.saveData||Xe(),u.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Ce(n.composedPath()[0],u);if(!o)return;const{url:a,external:c,target:p,download:v}=_e(o,G);if(!a)return;if(p==="_parent"||p==="_top"){if(window.parent!==window)return}else if(p&&p!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){Ue({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(d.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(D=!0,be(x),e(a),!b.replace_state)return;D=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?te():null,keepfocus:b.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),u.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const p=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ye(p,G))return;const v=n.target,{keep_focus:b,noscroll:y,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),_=a==null?void 0:a.getAttribute("name");_&&P.append(_,(a==null?void 0:a.getAttribute("value"))??""),p.search=new URLSearchParams(P).toString(),ce({url:p,scroll:y?te():null,keepfocus:b??!1,redirect_count:0,details:{state:{},replaceState:A??p.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if(W={},(o=n.state)!=null&&o[V]){if(n.state[V]===x)return;const a=J[n.state[V]],c=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){e(c),J[x]=te(),x=n.state[V],scrollTo(a.x,a.y);return}const p=n.state[V]-x;await ce({url:c,scroll:a,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{x=n.state[V]},blocked:()=>{history.go(-p)},type:"popstate",delta:p,nav_token:W})}else if(!D){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{D&&(D=!1,history.replaceState({...history.state,[V]:++x},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&H.navigating.set(null)});function e(n){d.url=n,H.page.set({...F,url:n}),H.page.notify()}},_hydrate:async({status:e=200,error:s,node_ids:n,params:o,route:a,data:c,form:p})=>{j=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=Z(v,!1)||{});let b;try{const y=n.map(async(P,_)=>{const w=c[_];return w!=null&&w.uses&&(w.uses=Ye(w.uses)),ue({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let N=0;N<_;N+=1)Object.assign(O,(await y[N]).data);return O},server_data_node:de(w)})}),L=await Promise.all(y),A=f.find(({id:P})=>P===a.id);if(A){const P=A.layouts;for(let _=0;_u?"1":"0").join(""));const i=await Ke(f.href);if((h=i.headers.get("content-type"))!=null&&h.includes("text/html")&&await K(t),!i.ok)throw new ne(i.status,await i.json());return new Promise(async u=>{var j;const E=new Map,l=i.body.getReader(),g=new TextDecoder;function m(T){return Et(T,{Promise:R=>new Promise((C,U)=>{E.set(R,{fulfil:C,reject:U})})})}let d="";for(;;){const{done:T,value:R}=await l.read();if(T&&!d)break;for(d+=!R&&d?` +import{o as me,t as we}from"../chunks/scheduler.e80da8ef.js";import{S as Ge,a as Je,I as V,g as De,f as Ce,b as _e,c as le,s as te,i as ye,d as H,o as Me,e as G,P as Ve,h as Ze}from"../chunks/singletons.48e6ff28.js";function Qe(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function et(t){return t.split("%25").map(decodeURI).join("%25")}function tt(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const nt=["href","pathname","search","searchParams","toString","toJSON"];function at(t,r){const f=new URL(t);for(const i of nt)Object.defineProperty(f,i,{get(){return r(),t[i]},enumerable:!0,configurable:!0});return rt(f),f}function rt(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const ot="/__data.json";function it(t){return t.replace(/\/$/,"")+ot}function st(...t){let r=5381;for(const f of t)if(typeof f=="string"){let i=f.length;for(;i;)r=r*33^f.charCodeAt(--i)}else if(ArrayBuffer.isView(f)){const i=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);let h=i.length;for(;h;)r=r*33^i[--h]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const Ke=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ae.delete(Se(t)),Ke(t,r));const ae=new Map;function ct(t,r){const f=Se(t,r),i=document.querySelector(f);if(i!=null&&i.textContent){const{body:h,...u}=JSON.parse(i.textContent),E=i.getAttribute("data-ttl");return E&&ae.set(f,{body:h,init:u,ttl:1e3*Number(E)}),Promise.resolve(new Response(h,u))}return window.fetch(t,r)}function lt(t,r,f){if(ae.size>0){const i=Se(t,f),h=ae.get(i);if(h){if(performance.now(){const h=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(i);if(h)return r.push({name:h[1],matcher:h[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const u=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(i);if(u)return r.push({name:u[1],matcher:u[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!i)return;const E=i.split(/\[(.+?)\](?!\])/);return"/"+E.map((g,m)=>{if(m%2){if(g.startsWith("x+"))return ve(String.fromCharCode(parseInt(g.slice(2),16)));if(g.startsWith("u+"))return ve(String.fromCharCode(...g.slice(2).split("-").map(U=>parseInt(U,16))));const d=ft.exec(g);if(!d)throw new Error(`Invalid param: ${g}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,j,T,R,C]=d;return r.push({name:R,matcher:C,optional:!!j,rest:!!T,chained:T?m===1&&E[0]==="":!1}),T?"(.*?)":j?"([^/]*)?":"([^/]+?)"}return ve(g)}).join("")}).join("")}/?$`),params:r}}function dt(t){return!/^\([^)]+\)$/.test(t)}function pt(t){return t.slice(1).split("/").filter(dt)}function ht(t,r,f){const i={},h=t.slice(1),u=h.filter(l=>l!==void 0);let E=0;for(let l=0;ld).join("/"),E=0),m===void 0){g.rest&&(i[g.name]="");continue}if(!g.matcher||f[g.matcher](m)){i[g.name]=m;const d=r[l+1],j=h[l+1];d&&!d.rest&&d.optional&&j&&g.chained&&(E=0),!d&&!j&&Object.keys(i).length===u.length&&(E=0);continue}if(g.optional&&g.chained){E++;continue}return}if(!E)return i}function ve(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function gt({nodes:t,server_loads:r,dictionary:f,matchers:i}){const h=new Set(r);return Object.entries(f).map(([l,[g,m,d]])=>{const{pattern:j,params:T}=ut(l),R={id:l,exec:C=>{const U=j.exec(C);if(U)return ht(U,T,i)},errors:[1,...d||[]].map(C=>t[C]),layouts:[0,...m||[]].map(E),leaf:u(g)};return R.errors.length=R.layouts.length=Math.max(R.errors.length,R.layouts.length),R});function u(l){const g=l<0;return g&&(l=~l),[g,t[l]]}function E(l){return l===void 0?l:[h.has(l),t[l]]}}function ze(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const f=JSON.stringify(r);try{sessionStorage[t]=f}catch{}}const mt=-1,wt=-2,_t=-3,yt=-4,vt=-5,bt=-6;function Et(t,r){if(typeof t=="number")return h(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const f=t,i=Array(f.length);function h(u,E=!1){if(u===mt)return;if(u===_t)return NaN;if(u===yt)return 1/0;if(u===vt)return-1/0;if(u===bt)return-0;if(E)throw new Error("Invalid input");if(u in i)return i[u];const l=f[u];if(!l||typeof l!="object")i[u]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const g=l[0],m=r==null?void 0:r[g];if(m)return i[u]=m(h(l[1]));switch(g){case"Date":i[u]=new Date(l[1]);break;case"Set":const d=new Set;i[u]=d;for(let R=1;Rr!=null)}const We=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...We];const kt=new Set([...We]);[...kt];async function Rt(t,r){var f;for(const i in t)if(typeof((f=t[i])==null?void 0:f.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([h,u])=>[h,await u])));return t}class ne{constructor(r,f){this.status=r,typeof f=="string"?this.body={message:f}:f?this.body=f:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,f){this.status=r,this.location=f}}const At="x-sveltekit-invalidated",It="x-sveltekit-trailing-slash",J=ze(Ge)??{},ee=ze(Je)??{};function be(t){J[t]=te()}function K(t){return location.href=t.href,new Promise(()=>{})}function Lt(t,r){var Ne;const f=gt(t),i=t.nodes[0],h=t.nodes[1];i(),h();const u=document.documentElement,E=[],l=[];let g=null;const m={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},j=!1,T=!1,R=!0,C=!1,U=!1,D=!1,z=!1,q,x=(Ne=history.state)==null?void 0:Ne[V];x||(x=Date.now(),history.replaceState({...history.state,[V]:x},"",location.href));const fe=J[x];fe&&(history.scrollRestoration="manual",scrollTo(fe.x,fe.y));let F,W,Y;async function ke(){if(Y=Y||Promise.resolve(),await Y,!Y)return;Y=null;const e=new URL(location.href),s=Z(e,!0);g=null;const n=W={},o=s&&await pe(s);if(n===W&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},1,n);o.props.page!==void 0&&(F=o.props.page),q.$set(o.props)}}function Re(e){l.some(s=>s==null?void 0:s.snapshot)&&(ee[e]=l.map(s=>{var n;return(n=s==null?void 0:s.snapshot)==null?void 0:n.capture()}))}function Ae(e){var s;(s=ee[e])==null||s.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Ie(){be(x),qe(Ge,J),Re(x),qe(Je,ee)}async function re(e,{noScroll:s=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},p,v){return typeof e=="string"&&(e=new URL(e,De(document))),ce({url:e,scroll:s?te():null,keepfocus:o,redirect_count:p,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(z=!0)},blocked:()=>{},type:"goto"})}async function Le(e){return g={id:e.id,promise:pe(e).then(s=>(s.type==="loaded"&&s.state.error&&(g=null),s))},g.promise}async function oe(...e){const n=f.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Pe(e){var o;d=e.state;const s=document.querySelector("style[data-sveltekit]");s&&s.remove(),F=e.props.page,q=new t.root({target:r,props:{...e.props,stores:H,components:l},hydrate:!0}),Ae(x);const n={from:null,to:{params:d.params,route:{id:((o=d.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};m.after_navigate.forEach(a=>a(n)),T=!0}async function X({url:e,params:s,branch:n,status:o,error:a,route:c,form:p}){let v="never";for(const _ of n)(_==null?void 0:_.slash)!==void 0&&(v=_.slash);e.pathname=Qe(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:s,branch:n,error:a,route:c},props:{constructors:St(n).map(_=>_.node.component)}};p!==void 0&&(b.props.form=p);let y={},L=!F,A=0;for(let _=0;_(v.route=!0,w[O])}),params:new Proxy(o,{get:(w,O)=>(v.params.add(O),w[O])}),data:(c==null?void 0:c.data)??null,url:at(n,()=>{v.url=!0}),async fetch(w,O){let N;w instanceof Request?(N=w.url,O={body:w.method==="GET"||w.method==="HEAD"?void 0:await w.blob(),cache:w.cache,credentials:w.credentials,headers:w.headers,integrity:w.integrity,keepalive:w.keepalive,method:w.method,mode:w.mode,redirect:w.redirect,referrer:w.referrer,referrerPolicy:w.referrerPolicy,signal:w.signal,...O}):N=w;const M=new URL(N,n);return P(M.href),M.origin===n.origin&&(N=M.href.slice(n.origin.length)),T?lt(N,M.href,O):ct(N,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,s()}};p=await b.universal.load.call(null,_)??null,p=p?await Rt(p,a.id):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:p,uses:v}:null,data:p??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Oe(e,s,n,o,a){if(z)return!0;if(!o)return!1;if(o.parent&&e||o.route&&s||o.url&&n)return!0;for(const c of o.params)if(a[c]!==d.params[c])return!0;for(const c of o.dependencies)if(E.some(p=>p(new URL(c))))return!0;return!1}function de(e,s){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?s??null:null}async function pe({id:e,invalidating:s,url:n,params:o,route:a}){if((g==null?void 0:g.id)===e)return g.promise;const{errors:c,layouts:p,leaf:v}=a,b=[...p,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let y=null;const L=d.url?e!==d.url.pathname+d.url.search:!1,A=d.route?a.id!==d.route.id:!1;let P=!1;const _=b.map((S,I)=>{var B;const k=d.branch[I],$=!!(S!=null&&S[0])&&((k==null?void 0:k.loader)!==S[1]||Oe(P,A,L,(B=k.server)==null?void 0:B.uses,o));return $&&(P=!0),$});if(_.some(Boolean)){try{y=await He(n,_)}catch(S){return ie({status:S instanceof ne?S.status:500,error:await Q(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(y.type==="redirect")return y}const w=y==null?void 0:y.nodes;let O=!1;const N=b.map(async(S,I)=>{var he;if(!S)return;const k=d.branch[I],$=w==null?void 0:w[I];if((!$||$.type==="skip")&&S[1]===(k==null?void 0:k.loader)&&!Oe(O,A,L,(he=k.universal)==null?void 0:he.uses,o))return k;if(O=!0,($==null?void 0:$.type)==="error")throw $;return ue({loader:S[1],url:n,params:o,route:a,parent:async()=>{var Te;const $e={};for(let ge=0;ge{});const M=[];for(let S=0;SPromise.resolve({}),server_data_node:de(c)}),b={node:await h(),loader:h,universal:null,server:null,data:null};return await X({url:n,params:a,branch:[v,b],status:e,error:s,route:null})}function Z(e,s){if(ye(e,G))return;const n=se(e);for(const o of f){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:s,route:o,params:tt(a),url:e}}}function se(e){return et(e.pathname.slice(G.length)||"/")}function Ue({url:e,type:s,intent:n,delta:o}){let a=!1;const c=Be(d,n,e,s);o!==void 0&&(c.navigation.delta=o);const p={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||m.before_navigate.forEach(v=>v(p)),a?null:c}async function ce({url:e,scroll:s,keepfocus:n,redirect_count:o,details:a,type:c,delta:p,nav_token:v={},accepted:b,blocked:y}){var N,M,S;const L=Z(e,!1),A=Ue({url:e,type:c,delta:p,intent:L});if(!A){y();return}const P=x;b(),U=!0,T&&H.navigating.set(A.navigation),W=v;let _=L&&await pe(L);if(!_){if(ye(e,G))return await K(e);_=await je(e,{id:null},await Q(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,W!==v)return A.reject(new Error("navigation was aborted")),!1;if(_.type==="redirect")if(o>=20)_=await ie({status:500,error:await Q(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(_.location,e).href,{},o+1,v),!1;else((N=_.props.page)==null?void 0:N.status)>=400&&await H.updated.check()&&await K(e);if(E.length=0,z=!1,C=!0,be(P),Re(P),(M=_.props.page)!=null&&M.url&&_.props.page.url.pathname!==e.pathname&&(e.pathname=(S=_.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[V]=x+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let k=x+1;for(;ee[k]||J[k];)delete ee[k],delete J[k],k+=1}}if(g=null,T){d=_.state,_.props.page&&(_.props.page.url=e);const I=(await Promise.all(m.on_navigate.map(k=>k(A.navigation)))).filter(k=>typeof k=="function");if(I.length>0){let k=function(){m.after_navigate=m.after_navigate.filter($=>!I.includes($))};I.push(k),m.after_navigate.push(...I)}q.$set(_.props)}else Pe(_);const{activeElement:w}=document;if(await we(),R){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));s?scrollTo(s.x,s.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==w&&document.activeElement!==document.body;!n&&!O&&Ee(),R=!0,_.props.page&&(F=_.props.page),U=!1,c==="popstate"&&Ae(x),A.fulfil(void 0),m.after_navigate.forEach(I=>I(A.navigation)),H.navigating.set(null),C=!1}async function je(e,s,n,o){return e.origin===Me&&e.pathname===location.pathname&&!j?await ie({status:o,error:n,url:e,route:s}):await K(e)}function Xe(){let e;u.addEventListener("mousemove",c=>{const p=c.target;clearTimeout(e),e=setTimeout(()=>{o(p,2)},20)});function s(c){o(c.composedPath()[0],1)}u.addEventListener("mousedown",s),u.addEventListener("touchstart",s,{passive:!0});const n=new IntersectionObserver(c=>{for(const p of c)p.isIntersecting&&(oe(se(new URL(p.target.href))),n.unobserve(p.target))},{threshold:0});function o(c,p){const v=Ce(c,u);if(!v)return;const{url:b,external:y,download:L}=_e(v,G);if(y||L)return;const A=le(v);if(!A.reload)if(p<=A.preload_data){const P=Z(b,!1);P&&Le(P)}else p<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of u.querySelectorAll("a")){const{url:p,external:v,download:b}=_e(c,G);if(v||b)continue;const y=le(c);y.reload||(y.preload_code===Ve.viewport&&n.observe(c),y.preload_code===Ve.eager&&oe(se(p)))}}m.after_navigate.push(a),a()}function Q(e,s){return e instanceof ne?e.body:t.hooks.handleError({error:e,event:s})??{message:s.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{me(()=>(m.after_navigate.push(e),()=>{const s=m.after_navigate.indexOf(e);m.after_navigate.splice(s,1)}))},before_navigate:e=>{me(()=>(m.before_navigate.push(e),()=>{const s=m.before_navigate.indexOf(e);m.before_navigate.splice(s,1)}))},on_navigate:e=>{me(()=>(m.on_navigate.push(e),()=>{const s=m.on_navigate.indexOf(e);m.on_navigate.splice(s,1)}))},disable_scroll_handling:()=>{(C||!T)&&(R=!1)},goto:(e,s={})=>re(e,s,0),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:s}=new URL(e,location.href);E.push(n=>n.href===s)}return ke()},invalidate_all:()=>(z=!0,ke()),preload_data:async e=>{const s=new URL(e,De(document)),n=Z(s,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${s}`);await Le(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const s=new URL(location.href),{branch:n,route:o}=d;if(!o)return;const a=await xe(d.branch.length,n,o.errors);if(a){const c=await X({url:s,params:d.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});d=c.state,q.$set(c.props),we().then(Ee)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},0):(q.$set({form:null,page:{...F,form:e.data,status:e.status}}),await we(),q.$set({form:e.data}),e.type==="success"&&Ee())},_start_router:()=>{var s;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Ie(),!U){const a=Be(d,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};m.before_navigate.forEach(p=>p(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ie()}),(s=navigator.connection)!=null&&s.saveData||Xe(),u.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Ce(n.composedPath()[0],u);if(!o)return;const{url:a,external:c,target:p,download:v}=_e(o,G);if(!a)return;if(p==="_parent"||p==="_top"){if(window.parent!==window)return}else if(p&&p!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){Ue({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(d.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(D=!0,be(x),e(a),!b.replace_state)return;D=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?te():null,keepfocus:b.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),u.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const p=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ye(p,G))return;const v=n.target,{keep_focus:b,noscroll:y,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),_=a==null?void 0:a.getAttribute("name");_&&P.append(_,(a==null?void 0:a.getAttribute("value"))??""),p.search=new URLSearchParams(P).toString(),ce({url:p,scroll:y?te():null,keepfocus:b??!1,redirect_count:0,details:{state:{},replaceState:A??p.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if(W={},(o=n.state)!=null&&o[V]){if(n.state[V]===x)return;const a=J[n.state[V]],c=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){e(c),J[x]=te(),x=n.state[V],scrollTo(a.x,a.y);return}const p=n.state[V]-x;await ce({url:c,scroll:a,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{x=n.state[V]},blocked:()=>{history.go(-p)},type:"popstate",delta:p,nav_token:W})}else if(!D){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{D&&(D=!1,history.replaceState({...history.state,[V]:++x},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&H.navigating.set(null)});function e(n){d.url=n,H.page.set({...F,url:n}),H.page.notify()}},_hydrate:async({status:e=200,error:s,node_ids:n,params:o,route:a,data:c,form:p})=>{j=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=Z(v,!1)||{});let b;try{const y=n.map(async(P,_)=>{const w=c[_];return w!=null&&w.uses&&(w.uses=Ye(w.uses)),ue({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let N=0;N<_;N+=1)Object.assign(O,(await y[N]).data);return O},server_data_node:de(w)})}),L=await Promise.all(y),A=f.find(({id:P})=>P===a.id);if(A){const P=A.layouts;for(let _=0;_u?"1":"0").join(""));const i=await Ke(f.href);if((h=i.headers.get("content-type"))!=null&&h.includes("text/html")&&await K(t),!i.ok)throw new ne(i.status,await i.json());return new Promise(async u=>{var j;const E=new Map,l=i.body.getReader(),g=new TextDecoder;function m(T){return Et(T,{Promise:R=>new Promise((C,U)=>{E.set(R,{fulfil:C,reject:U})})})}let d="";for(;;){const{done:T,value:R}=await l.read();if(T&&!d)break;for(d+=!R&&d?` `:g.decode(R);;){const C=d.indexOf(` `);if(C===-1)break;const U=JSON.parse(d.slice(0,C));if(d=d.slice(C+1),U.type==="redirect")return u(U);if(U.type==="data")(j=U.nodes)==null||j.forEach(D=>{(D==null?void 0:D.type)==="data"&&(D.uses=Ye(D.uses),D.data=m(D.data))}),u(U);else if(U.type==="chunk"){const{id:D,data:z,error:q}=U,x=E.get(D);E.delete(D),q?x.reject(m(q)):x.fulfil(m(z))}}}})}function Ye(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 Ee(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const r=document.body,f=r.getAttribute("tabindex");r.tabIndex=-1,r.focus({preventScroll:!0,focusVisible:!1}),f!==null?r.setAttribute("tabindex",f):r.removeAttribute("tabindex");const i=getSelection();if(i&&i.type!=="None"){const h=[];for(let u=0;u{if(i.rangeCount===h.length){for(let u=0;u{h=d,u=j});return E.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((g=t.route)==null?void 0:g.id)??null},url:t.url},to:f&&{params:(r==null?void 0:r.params)??null,route:{id:((m=r==null?void 0:r.route)==null?void 0:m.id)??null},url:f},willUnload:!r,type:i,complete:E},fulfil:h,reject:u}}async function xt(t,r,f){const i=Lt(t,r);Ze({client:i}),f?await i._hydrate(f):i.goto(location.href,{replaceState:!0}),i._start_router()}export{xt as start}; diff --git a/_app/immutable/nodes/1.40fe253f.js b/_app/immutable/nodes/1.9123b1cf.js similarity index 93% rename from _app/immutable/nodes/1.40fe253f.js rename to _app/immutable/nodes/1.9123b1cf.js index ed1790ee..cc4e92e1 100644 --- a/_app/immutable/nodes/1.40fe253f.js +++ b/_app/immutable/nodes/1.9123b1cf.js @@ -1 +1 @@ -import{s as x,n as _,e as S}from"../chunks/scheduler.e80da8ef.js";import{S as j,i as q,g as f,m as d,s as y,h as g,j as h,n as v,f as u,c as C,a as m,x as $,o as E}from"../chunks/index.3d76737d.js";import{d as H}from"../chunks/singletons.47934468.js";const P=()=>{const s=H;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},k={subscribe(s){return P().page.subscribe(s)}};function w(s){var b;let t,r=s[0].status+"",o,n,i,c=((b=s[0].error)==null?void 0:b.message)+"",l;return{c(){t=f("h1"),o=d(r),n=y(),i=f("p"),l=d(c)},l(e){t=g(e,"H1",{});var a=h(t);o=v(a,r),a.forEach(u),n=C(e),i=g(e,"P",{});var p=h(i);l=v(p,c),p.forEach(u)},m(e,a){m(e,t,a),$(t,o),m(e,n,a),m(e,i,a),$(i,l)},p(e,[a]){var p;a&1&&r!==(r=e[0].status+"")&&E(o,r),a&1&&c!==(c=((p=e[0].error)==null?void 0:p.message)+"")&&E(l,c)},i:_,o:_,d(e){e&&(u(t),u(n),u(i))}}}function z(s,t,r){let o;return S(s,k,n=>r(0,o=n)),[o]}let F=class extends j{constructor(t){super(),q(this,t,z,w,x,{})}};export{F as component}; +import{s as x,n as _,e as S}from"../chunks/scheduler.e80da8ef.js";import{S as j,i as q,g as f,m as d,s as y,h as g,j as h,n as v,f as u,c as C,a as m,x as $,o as E}from"../chunks/index.3d76737d.js";import{d as H}from"../chunks/singletons.48e6ff28.js";const P=()=>{const s=H;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},k={subscribe(s){return P().page.subscribe(s)}};function w(s){var b;let t,r=s[0].status+"",o,n,i,c=((b=s[0].error)==null?void 0:b.message)+"",l;return{c(){t=f("h1"),o=d(r),n=y(),i=f("p"),l=d(c)},l(e){t=g(e,"H1",{});var a=h(t);o=v(a,r),a.forEach(u),n=C(e),i=g(e,"P",{});var p=h(i);l=v(p,c),p.forEach(u)},m(e,a){m(e,t,a),$(t,o),m(e,n,a),m(e,i,a),$(i,l)},p(e,[a]){var p;a&1&&r!==(r=e[0].status+"")&&E(o,r),a&1&&c!==(c=((p=e[0].error)==null?void 0:p.message)+"")&&E(l,c)},i:_,o:_,d(e){e&&(u(t),u(n),u(i))}}}function z(s,t,r){let o;return S(s,k,n=>r(0,o=n)),[o]}let F=class extends j{constructor(t){super(),q(this,t,z,w,x,{})}};export{F as component}; diff --git a/_app/immutable/nodes/3.7ec0ec65.js b/_app/immutable/nodes/3.9cb6a4d0.js similarity index 70% rename from _app/immutable/nodes/3.7ec0ec65.js rename to _app/immutable/nodes/3.9cb6a4d0.js index 86478eca..6e4c1a13 100644 --- a/_app/immutable/nodes/3.7ec0ec65.js +++ b/_app/immutable/nodes/3.9cb6a4d0.js @@ -1,4 +1,4 @@ -var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var ge=(i,e,t)=>(Je(i,typeof e!="symbol"?e+"":e,t),t);import{s as Me,f as _e,n as me,r as Ye,e as ve,h as Ne,i as ye,b as De,j as Qe,o as Xe}from"../chunks/scheduler.e80da8ef.js";import{S as Ie,i as Ae,g as f,s as C,h as m,j as I,y as G,c as T,f as E,k as p,a as L,x as d,z as be,A as $,m as W,n as K,o as ue,r as Be,u as Le,v as xe,d as Ue,t as Pe,w as Ge}from"../chunks/index.3d76737d.js";import{w as Ce}from"../chunks/index.7d157e8c.js";class J{constructor(e=!1){this.eventMap={},this.eventsSuspended=e==!0}addListener(e,t,n={}){if(typeof e=="string"&&e.length<1||e instanceof String&&e.length<1||typeof e!="string"&&!(e instanceof String)&&e!==J.ANY_EVENT)throw new TypeError("The 'event' parameter must be a string or EventEmitter.ANY_EVENT.");if(typeof t!="function")throw new TypeError("The callback must be a function.");const r=new ke(e,this,t,n);return this.eventMap[e]||(this.eventMap[e]=[]),n.prepend?this.eventMap[e].unshift(r):this.eventMap[e].push(r),r}addOneTimeListener(e,t,n={}){n.remaining=1,this.addListener(e,t,n)}static get ANY_EVENT(){return Symbol.for("Any event")}hasListener(e,t){return e===void 0?this.eventMap[J.ANY_EVENT]&&this.eventMap[J.ANY_EVENT].length>0?!0:Object.entries(this.eventMap).some(([,n])=>n.length>0):this.eventMap[e]&&this.eventMap[e].length>0?t instanceof ke?this.eventMap[e].filter(r=>r===t).length>0:typeof t=="function"?this.eventMap[e].filter(r=>r.callback===t).length>0:t==null:!1}get eventNames(){return Object.keys(this.eventMap)}getListeners(e){return this.eventMap[e]||[]}suspendEvent(e){this.getListeners(e).forEach(t=>{t.suspended=!0})}unsuspendEvent(e){this.getListeners(e).forEach(t=>{t.suspended=!1})}getListenerCount(e){return this.getListeners(e).length}emit(e,...t){if(typeof e!="string"&&!(e instanceof String))throw new TypeError("The 'event' parameter must be a string.");if(this.eventsSuspended)return;let n=[],r=this.eventMap[J.ANY_EVENT]||[];return this.eventMap[e]&&(r=r.concat(this.eventMap[e])),r.forEach(s=>{if(s.suspended)return;let l=[...t];Array.isArray(s.arguments)&&(l=l.concat(s.arguments)),s.remaining>0&&(n.push(s.callback.apply(s.context,l)),s.count++),--s.remaining<1&&s.remove()}),n}removeListener(e,t,n={}){if(e===void 0){this.eventMap={};return}else if(!this.eventMap[e])return;let r=this.eventMap[e].filter(s=>t&&s.callback!==t||n.remaining&&n.remaining!==s.remaining||n.context&&n.context!==s.context);r.length?this.eventMap[e]=r:delete this.eventMap[e]}async waitFor(e,t={}){return t.duration=parseInt(t.duration),(isNaN(t.duration)||t.duration<=0)&&(t.duration=1/0),new Promise((n,r)=>{let s,l=this.addListener(e,()=>{clearTimeout(s),n()},{remaining:1});t.duration!==1/0&&(s=setTimeout(()=>{l.remove(),r("The duration expired before the event was emitted.")},t.duration))})}get eventCount(){return Object.keys(this.eventMap).length}}class ke{constructor(e,t,n,r={}){if(typeof e!="string"&&!(e instanceof String)&&e!==J.ANY_EVENT)throw new TypeError("The 'event' parameter must be a string or EventEmitter.ANY_EVENT.");if(!t)throw new ReferenceError("The 'target' parameter is mandatory.");if(typeof n!="function")throw new TypeError("The 'callback' must be a function.");r.arguments!==void 0&&!Array.isArray(r.arguments)&&(r.arguments=[r.arguments]),r=Object.assign({context:t,remaining:1/0,arguments:void 0,duration:1/0},r),r.duration!==1/0&&setTimeout(()=>this.remove(),r.duration),this.arguments=r.arguments,this.callback=n,this.context=r.context,this.count=0,this.event=e,this.remaining=parseInt(r.remaining)>=1?parseInt(r.remaining):1/0,this.suspended=!1,this.target=t}remove(){this.target.removeListener(this.event,this.callback,{context:this.context,remaining:this.remaining})}}/** +var lt=Object.defineProperty;var ot=(i,e,t)=>e in i?lt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var ve=(i,e,t)=>(ot(i,typeof e!="symbol"?e+"":e,t),t);import{s as Be,f as Se,n as ge,r as rt,e as Ee,h as Me,i as Ie,b as Fe,j as ct,o as dt}from"../chunks/scheduler.e80da8ef.js";import{S as Le,i as Ue,g as u,s as R,h as m,j as C,y as H,c as O,f as p,k as f,a as P,x as o,z as we,A as X,m as j,n as Y,o as le,r as ze,u as je,v as Ye,d as qe,t as Ke,w as We}from"../chunks/index.3d76737d.js";import{w as Ae}from"../chunks/index.7d157e8c.js";class Z{constructor(e=!1){this.eventMap={},this.eventsSuspended=e==!0}addListener(e,t,n={}){if(typeof e=="string"&&e.length<1||e instanceof String&&e.length<1||typeof e!="string"&&!(e instanceof String)&&e!==Z.ANY_EVENT)throw new TypeError("The 'event' parameter must be a string or EventEmitter.ANY_EVENT.");if(typeof t!="function")throw new TypeError("The callback must be a function.");const r=new Je(e,this,t,n);return this.eventMap[e]||(this.eventMap[e]=[]),n.prepend?this.eventMap[e].unshift(r):this.eventMap[e].push(r),r}addOneTimeListener(e,t,n={}){n.remaining=1,this.addListener(e,t,n)}static get ANY_EVENT(){return Symbol.for("Any event")}hasListener(e,t){return e===void 0?this.eventMap[Z.ANY_EVENT]&&this.eventMap[Z.ANY_EVENT].length>0?!0:Object.entries(this.eventMap).some(([,n])=>n.length>0):this.eventMap[e]&&this.eventMap[e].length>0?t instanceof Je?this.eventMap[e].filter(r=>r===t).length>0:typeof t=="function"?this.eventMap[e].filter(r=>r.callback===t).length>0:t==null:!1}get eventNames(){return Object.keys(this.eventMap)}getListeners(e){return this.eventMap[e]||[]}suspendEvent(e){this.getListeners(e).forEach(t=>{t.suspended=!0})}unsuspendEvent(e){this.getListeners(e).forEach(t=>{t.suspended=!1})}getListenerCount(e){return this.getListeners(e).length}emit(e,...t){if(typeof e!="string"&&!(e instanceof String))throw new TypeError("The 'event' parameter must be a string.");if(this.eventsSuspended)return;let n=[],r=this.eventMap[Z.ANY_EVENT]||[];return this.eventMap[e]&&(r=r.concat(this.eventMap[e])),r.forEach(s=>{if(s.suspended)return;let l=[...t];Array.isArray(s.arguments)&&(l=l.concat(s.arguments)),s.remaining>0&&(n.push(s.callback.apply(s.context,l)),s.count++),--s.remaining<1&&s.remove()}),n}removeListener(e,t,n={}){if(e===void 0){this.eventMap={};return}else if(!this.eventMap[e])return;let r=this.eventMap[e].filter(s=>t&&s.callback!==t||n.remaining&&n.remaining!==s.remaining||n.context&&n.context!==s.context);r.length?this.eventMap[e]=r:delete this.eventMap[e]}async waitFor(e,t={}){return t.duration=parseInt(t.duration),(isNaN(t.duration)||t.duration<=0)&&(t.duration=1/0),new Promise((n,r)=>{let s,l=this.addListener(e,()=>{clearTimeout(s),n()},{remaining:1});t.duration!==1/0&&(s=setTimeout(()=>{l.remove(),r("The duration expired before the event was emitted.")},t.duration))})}get eventCount(){return Object.keys(this.eventMap).length}}class Je{constructor(e,t,n,r={}){if(typeof e!="string"&&!(e instanceof String)&&e!==Z.ANY_EVENT)throw new TypeError("The 'event' parameter must be a string or EventEmitter.ANY_EVENT.");if(!t)throw new ReferenceError("The 'target' parameter is mandatory.");if(typeof n!="function")throw new TypeError("The 'callback' must be a function.");r.arguments!==void 0&&!Array.isArray(r.arguments)&&(r.arguments=[r.arguments]),r=Object.assign({context:t,remaining:1/0,arguments:void 0,duration:1/0},r),r.duration!==1/0&&setTimeout(()=>this.remove(),r.duration),this.arguments=r.arguments,this.callback=n,this.context=r.context,this.count=0,this.event=e,this.remaining=parseInt(r.remaining)>=1?parseInt(r.remaining):1/0,this.suspended=!1,this.target=t}remove(){this.target.removeListener(this.event,this.callback,{context:this.context,remaining:this.remaining})}}/** * The `Enumerations` class contains enumerations and arrays of elements used throughout the * library. All its properties are static and should be referenced using the class name. For * example: `Enumerations.CHANNEL_MESSAGES`. @@ -28,13 +28,13 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * * @license Apache-2.0 * @since 3.0.0 - */class he{constructor(e,t={}){this.duration=o.defaults.note.duration,this.attack=o.defaults.note.attack,this.release=o.defaults.note.release,t.duration!=null&&(this.duration=t.duration),t.attack!=null&&(this.attack=t.attack),t.rawAttack!=null&&(this.attack=c.from7bitToFloat(t.rawAttack)),t.release!=null&&(this.release=t.release),t.rawRelease!=null&&(this.release=c.from7bitToFloat(t.rawRelease)),Number.isInteger(e)?this.identifier=c.toNoteIdentifier(e):this.identifier=e}get identifier(){return this._name+(this._accidental||"")+this._octave}set identifier(e){const t=c.getNoteDetails(e);if(o.validation&&!e)throw new Error("Invalid note identifier");this._name=t.name,this._accidental=t.accidental,this._octave=t.octave}get name(){return this._name}set name(e){if(o.validation&&(e=e.toUpperCase(),!["C","D","E","F","G","A","B"].includes(e)))throw new Error("Invalid name value");this._name=e}get accidental(){return this._accidental}set accidental(e){if(o.validation&&(e=e.toLowerCase(),!["#","##","b","bb"].includes(e)))throw new Error("Invalid accidental value");this._accidental=e}get octave(){return this._octave}set octave(e){if(o.validation&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid octave value");this._octave=e}get duration(){return this._duration}set duration(e){if(o.validation&&(e=parseFloat(e),isNaN(e)||e===null||e<0))throw new RangeError("Invalid duration value.");this._duration=e}get attack(){return this._attack}set attack(e){if(o.validation&&(e=parseFloat(e),isNaN(e)||!(e>=0&&e<=1)))throw new RangeError("Invalid attack value.");this._attack=e}get release(){return this._release}set release(e){if(o.validation&&(e=parseFloat(e),isNaN(e)||!(e>=0&&e<=1)))throw new RangeError("Invalid release value.");this._release=e}get rawAttack(){return c.fromFloatTo7Bit(this._attack)}set rawAttack(e){this._attack=c.from7bitToFloat(e)}get rawRelease(){return c.fromFloatTo7Bit(this._release)}set rawRelease(e){this._release=c.from7bitToFloat(e)}get number(){return c.toNoteNumber(this.identifier)}getOffsetNumber(e=0,t=0){return o.validation&&(e=parseInt(e)||0,t=parseInt(t)||0),Math.min(Math.max(this.number+e*12+t,0),127)}}/** + */class me{constructor(e,t={}){this.duration=c.defaults.note.duration,this.attack=c.defaults.note.attack,this.release=c.defaults.note.release,t.duration!=null&&(this.duration=t.duration),t.attack!=null&&(this.attack=t.attack),t.rawAttack!=null&&(this.attack=d.from7bitToFloat(t.rawAttack)),t.release!=null&&(this.release=t.release),t.rawRelease!=null&&(this.release=d.from7bitToFloat(t.rawRelease)),Number.isInteger(e)?this.identifier=d.toNoteIdentifier(e):this.identifier=e}get identifier(){return this._name+(this._accidental||"")+this._octave}set identifier(e){const t=d.getNoteDetails(e);if(c.validation&&!e)throw new Error("Invalid note identifier");this._name=t.name,this._accidental=t.accidental,this._octave=t.octave}get name(){return this._name}set name(e){if(c.validation&&(e=e.toUpperCase(),!["C","D","E","F","G","A","B"].includes(e)))throw new Error("Invalid name value");this._name=e}get accidental(){return this._accidental}set accidental(e){if(c.validation&&(e=e.toLowerCase(),!["#","##","b","bb"].includes(e)))throw new Error("Invalid accidental value");this._accidental=e}get octave(){return this._octave}set octave(e){if(c.validation&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid octave value");this._octave=e}get duration(){return this._duration}set duration(e){if(c.validation&&(e=parseFloat(e),isNaN(e)||e===null||e<0))throw new RangeError("Invalid duration value.");this._duration=e}get attack(){return this._attack}set attack(e){if(c.validation&&(e=parseFloat(e),isNaN(e)||!(e>=0&&e<=1)))throw new RangeError("Invalid attack value.");this._attack=e}get release(){return this._release}set release(e){if(c.validation&&(e=parseFloat(e),isNaN(e)||!(e>=0&&e<=1)))throw new RangeError("Invalid release value.");this._release=e}get rawAttack(){return d.fromFloatTo7Bit(this._attack)}set rawAttack(e){this._attack=d.from7bitToFloat(e)}get rawRelease(){return d.fromFloatTo7Bit(this._release)}set rawRelease(e){this._release=d.from7bitToFloat(e)}get number(){return d.toNoteNumber(this.identifier)}getOffsetNumber(e=0,t=0){return c.validation&&(e=parseInt(e)||0,t=parseInt(t)||0),Math.min(Math.max(this.number+e*12+t,0),127)}}/** * The `Utilities` class contains general-purpose utility methods. All methods are static and * should be called using the class name. For example: `Utilities.getNoteDetails("C4")`. * * @license Apache-2.0 * @since 3.0.0 - */class c{static toNoteNumber(e,t=0){if(t=t==null?0:parseInt(t),isNaN(t))throw new RangeError("Invalid 'octaveOffset' value");typeof e!="string"&&(e="");const n=this.getNoteDetails(e);if(!n)throw new TypeError("Invalid note identifier");const r={C:0,D:2,E:4,F:5,G:7,A:9,B:11};let s=(n.octave+1+t)*12;if(s+=r[n.name],n.accidental&&(n.accidental.startsWith("b")?s-=n.accidental.length:s+=n.accidental.length),s<0||s>127)throw new RangeError("Invalid octaveOffset value");return s}static getNoteDetails(e){Number.isInteger(e)&&(e=this.toNoteIdentifier(e));const t=e.match(/^([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)$/i);if(!t)throw new TypeError("Invalid note identifier");const n=t[1].toUpperCase(),r=parseInt(t[3]);let s=t[2].toLowerCase();return s=s===""?void 0:s,{accidental:s,identifier:n+(s||"")+r,name:n,octave:r}}static sanitizeChannels(e){let t;if(o.validation){if(e==="all")t=["all"];else if(e==="none")return[]}return Array.isArray(e)?t=e:t=[e],t.indexOf("all")>-1&&(t=a.MIDI_CHANNEL_NUMBERS),t.map(function(n){return parseInt(n)}).filter(function(n){return n>=1&&n<=16})}static toTimestamp(e){let t=!1;const n=parseFloat(e);return isNaN(n)?!1:(typeof e=="string"&&e.substring(0,1)==="+"?n>=0&&(t=o.time+n):n>=0&&(t=n),t)}static guessNoteNumber(e,t){t=parseInt(t)||0;let n=!1;if(Number.isInteger(e)&&e>=0&&e<=127)n=parseInt(e);else if(parseInt(e)>=0&&parseInt(e)<=127)n=parseInt(e);else if(typeof e=="string"||e instanceof String)try{n=this.toNoteNumber(e.trim(),t)}catch{return!1}return n}static toNoteIdentifier(e,t){if(e=parseInt(e),isNaN(e)||e<0||e>127)throw new RangeError("Invalid note number");if(t=t==null?0:parseInt(t),isNaN(t))throw new RangeError("Invalid octaveOffset value");const n=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],r=Math.floor(e/12-1)+t;return n[e%12]+r.toString()}static buildNote(e,t={}){if(t.octaveOffset=parseInt(t.octaveOffset)||0,e instanceof he)return e;let n=this.guessNoteNumber(e,t.octaveOffset);if(n===!1)throw new TypeError(`The input could not be parsed as a note (${e})`);return t.octaveOffset=void 0,new he(n,t)}static buildNoteArray(e,t={}){let n=[];return Array.isArray(e)||(e=[e]),e.forEach(r=>{n.push(this.buildNote(r,t))}),n}static from7bitToFloat(e){return e===1/0&&(e=127),e=parseInt(e)||0,Math.min(Math.max(e/127,0),1)}static fromFloatTo7Bit(e){return e===1/0&&(e=1),e=parseFloat(e)||0,Math.min(Math.max(Math.round(e*127),0),127)}static fromMsbLsbToFloat(e,t=0){o.validation&&(e=Math.min(Math.max(parseInt(e)||0,0),127),t=Math.min(Math.max(parseInt(t)||0,0),127));const n=((e<<7)+t)/16383;return Math.min(Math.max(n,0),1)}static fromFloatToMsbLsb(e){o.validation&&(e=Math.min(Math.max(parseFloat(e)||0,0),1));const t=Math.round(e*16383);return{msb:t>>7,lsb:t&127}}static offsetNumber(e,t=0,n=0){if(o.validation){if(e=parseInt(e),isNaN(e))throw new Error("Invalid note number");t=parseInt(t)||0,n=parseInt(n)||0}return Math.min(Math.max(e+t*12+n,0),127)}static getPropertyByValue(e,t){return Object.keys(e).find(n=>e[n]===t)}static getCcNameByNumber(e){if(!(o.validation&&(e=parseInt(e),!(e>=0&&e<=127))))return a.CONTROL_CHANGE_MESSAGES[e].name}static getCcNumberByName(e){let t=a.CONTROL_CHANGE_MESSAGES.find(n=>n.name===e);return t?t.number:a.MIDI_CONTROL_CHANGE_MESSAGES[e]}static getChannelModeByNumber(e){if(!(e>=120&&e<=127))return!1;for(let t in a.CHANNEL_MODE_MESSAGES)if(a.CHANNEL_MODE_MESSAGES.hasOwnProperty(t)&&e===a.CHANNEL_MODE_MESSAGES[t])return t;return!1}static get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}static get isBrowser(){return typeof window<"u"&&typeof window.document<"u"}}/** + */class d{static toNoteNumber(e,t=0){if(t=t==null?0:parseInt(t),isNaN(t))throw new RangeError("Invalid 'octaveOffset' value");typeof e!="string"&&(e="");const n=this.getNoteDetails(e);if(!n)throw new TypeError("Invalid note identifier");const r={C:0,D:2,E:4,F:5,G:7,A:9,B:11};let s=(n.octave+1+t)*12;if(s+=r[n.name],n.accidental&&(n.accidental.startsWith("b")?s-=n.accidental.length:s+=n.accidental.length),s<0||s>127)throw new RangeError("Invalid octaveOffset value");return s}static getNoteDetails(e){Number.isInteger(e)&&(e=this.toNoteIdentifier(e));const t=e.match(/^([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)$/i);if(!t)throw new TypeError("Invalid note identifier");const n=t[1].toUpperCase(),r=parseInt(t[3]);let s=t[2].toLowerCase();return s=s===""?void 0:s,{accidental:s,identifier:n+(s||"")+r,name:n,octave:r}}static sanitizeChannels(e){let t;if(c.validation){if(e==="all")t=["all"];else if(e==="none")return[]}return Array.isArray(e)?t=e:t=[e],t.indexOf("all")>-1&&(t=a.MIDI_CHANNEL_NUMBERS),t.map(function(n){return parseInt(n)}).filter(function(n){return n>=1&&n<=16})}static toTimestamp(e){let t=!1;const n=parseFloat(e);return isNaN(n)?!1:(typeof e=="string"&&e.substring(0,1)==="+"?n>=0&&(t=c.time+n):n>=0&&(t=n),t)}static guessNoteNumber(e,t){t=parseInt(t)||0;let n=!1;if(Number.isInteger(e)&&e>=0&&e<=127)n=parseInt(e);else if(parseInt(e)>=0&&parseInt(e)<=127)n=parseInt(e);else if(typeof e=="string"||e instanceof String)try{n=this.toNoteNumber(e.trim(),t)}catch{return!1}return n}static toNoteIdentifier(e,t){if(e=parseInt(e),isNaN(e)||e<0||e>127)throw new RangeError("Invalid note number");if(t=t==null?0:parseInt(t),isNaN(t))throw new RangeError("Invalid octaveOffset value");const n=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],r=Math.floor(e/12-1)+t;return n[e%12]+r.toString()}static buildNote(e,t={}){if(t.octaveOffset=parseInt(t.octaveOffset)||0,e instanceof me)return e;let n=this.guessNoteNumber(e,t.octaveOffset);if(n===!1)throw new TypeError(`The input could not be parsed as a note (${e})`);return t.octaveOffset=void 0,new me(n,t)}static buildNoteArray(e,t={}){let n=[];return Array.isArray(e)||(e=[e]),e.forEach(r=>{n.push(this.buildNote(r,t))}),n}static from7bitToFloat(e){return e===1/0&&(e=127),e=parseInt(e)||0,Math.min(Math.max(e/127,0),1)}static fromFloatTo7Bit(e){return e===1/0&&(e=1),e=parseFloat(e)||0,Math.min(Math.max(Math.round(e*127),0),127)}static fromMsbLsbToFloat(e,t=0){c.validation&&(e=Math.min(Math.max(parseInt(e)||0,0),127),t=Math.min(Math.max(parseInt(t)||0,0),127));const n=((e<<7)+t)/16383;return Math.min(Math.max(n,0),1)}static fromFloatToMsbLsb(e){c.validation&&(e=Math.min(Math.max(parseFloat(e)||0,0),1));const t=Math.round(e*16383);return{msb:t>>7,lsb:t&127}}static offsetNumber(e,t=0,n=0){if(c.validation){if(e=parseInt(e),isNaN(e))throw new Error("Invalid note number");t=parseInt(t)||0,n=parseInt(n)||0}return Math.min(Math.max(e+t*12+n,0),127)}static getPropertyByValue(e,t){return Object.keys(e).find(n=>e[n]===t)}static getCcNameByNumber(e){if(!(c.validation&&(e=parseInt(e),!(e>=0&&e<=127))))return a.CONTROL_CHANGE_MESSAGES[e].name}static getCcNumberByName(e){let t=a.CONTROL_CHANGE_MESSAGES.find(n=>n.name===e);return t?t.number:a.MIDI_CONTROL_CHANGE_MESSAGES[e]}static getChannelModeByNumber(e){if(!(e>=120&&e<=127))return!1;for(let t in a.CHANNEL_MODE_MESSAGES)if(a.CHANNEL_MODE_MESSAGES.hasOwnProperty(t)&&e===a.CHANNEL_MODE_MESSAGES[t])return t;return!1}static get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}static get isBrowser(){return typeof window<"u"&&typeof window.document<"u"}}/** * The `OutputChannel` class represents a single output MIDI channel. `OutputChannel` objects are * provided by an [`Output`](Output) port which, itself, is made available by a device. The * `OutputChannel` object is derived from the host's MIDI subsystem and should not be instantiated @@ -49,7 +49,7 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * @extends EventEmitter * @license Apache-2.0 * @since 3.0.0 - */class Ze extends J{constructor(e,t){super(),this._output=e,this._number=t,this._octaveOffset=0}destroy(){this._output=null,this._number=null,this._octaveOffset=0,this.removeListener()}send(e,t={time:0}){return this.output.send(e,t),this}sendKeyAftertouch(e,t,n={}){if(o.validation){if(n.useRawValue&&(n.rawValue=n.useRawValue),isNaN(parseFloat(t)))throw new RangeError("Invalid key aftertouch value.");if(n.rawValue){if(!(t>=0&&t<=127&&Number.isInteger(t)))throw new RangeError("Key aftertouch raw value must be an integer between 0 and 127.")}else if(!(t>=0&&t<=1))throw new RangeError("Key aftertouch value must be a float between 0 and 1.")}n.rawValue||(t=c.fromFloatTo7Bit(t));const r=o.octaveOffset+this.output.octaveOffset+this.octaveOffset;return Array.isArray(e)||(e=[e]),c.buildNoteArray(e).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.keyaftertouch<<4)+(this.number-1),s.getOffsetNumber(r),t],{time:c.toTimestamp(n.time)})}),this}sendControlChange(e,t,n={}){if(typeof e=="string"&&(e=c.getCcNumberByName(e)),Array.isArray(t)||(t=[t]),o.validation){if(e===void 0)throw new TypeError("Control change must be identified with a valid name or an integer between 0 and 127.");if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new TypeError("Control change number must be an integer between 0 and 127.");if(t=t.map(r=>{const s=Math.min(Math.max(parseInt(r),0),127);if(isNaN(s))throw new TypeError("Values must be integers between 0 and 127");return s}),t.length===2&&e>=32)throw new TypeError("To use a value array, the controller must be between 0 and 31")}return t.forEach((r,s)=>{this.send([(a.CHANNEL_MESSAGES.controlchange<<4)+(this.number-1),e+s*32,t[s]],{time:c.toTimestamp(n.time)})}),this}_selectNonRegisteredParameter(e,t={}){return this.sendControlChange(99,e[0],t),this.sendControlChange(98,e[1],t),this}_deselectRegisteredParameter(e={}){return this.sendControlChange(101,127,e),this.sendControlChange(100,127,e),this}_deselectNonRegisteredParameter(e={}){return this.sendControlChange(101,127,e),this.sendControlChange(100,127,e),this}_selectRegisteredParameter(e,t={}){return this.sendControlChange(101,e[0],t),this.sendControlChange(100,e[1],t),this}_setCurrentParameter(e,t={}){return e=[].concat(e),this.sendControlChange(6,e[0],t),e.length<2?this:(this.sendControlChange(38,e[1],t),this)}sendRpnDecrement(e,t={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),o.validation){if(e===void 0)throw new TypeError("The specified registered parameter is invalid.");let n=!1;if(Object.getOwnPropertyNames(a.REGISTERED_PARAMETERS).forEach(r=>{a.REGISTERED_PARAMETERS[r][0]===e[0]&&a.REGISTERED_PARAMETERS[r][1]===e[1]&&(n=!0)}),!n)throw new TypeError("The specified registered parameter is invalid.")}return this._selectRegisteredParameter(e,t),this.sendControlChange(97,0,t),this._deselectRegisteredParameter(t),this}sendRpnIncrement(e,t={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),o.validation){if(e===void 0)throw new TypeError("The specified registered parameter is invalid.");let n=!1;if(Object.getOwnPropertyNames(a.REGISTERED_PARAMETERS).forEach(r=>{a.REGISTERED_PARAMETERS[r][0]===e[0]&&a.REGISTERED_PARAMETERS[r][1]===e[1]&&(n=!0)}),!n)throw new TypeError("The specified registered parameter is invalid.")}return this._selectRegisteredParameter(e,t),this.sendControlChange(96,0,t),this._deselectRegisteredParameter(t),this}playNote(e,t={}){this.sendNoteOn(e,t);const n=Array.isArray(e)?e:[e];for(let r of n)if(parseInt(r.duration)>0){const s={time:(c.toTimestamp(t.time)||o.time)+parseInt(r.duration),release:r.release,rawRelease:r.rawRelease};this.sendNoteOff(r,s)}else if(parseInt(t.duration)>0){const s={time:(c.toTimestamp(t.time)||o.time)+parseInt(t.duration),release:t.release,rawRelease:t.rawRelease};this.sendNoteOff(r,s)}return this}sendNoteOff(e,t={}){if(o.validation){if(t.rawRelease!=null&&!(t.rawRelease>=0&&t.rawRelease<=127))throw new RangeError("The 'rawRelease' option must be an integer between 0 and 127");if(t.release!=null&&!(t.release>=0&&t.release<=1))throw new RangeError("The 'release' option must be an number between 0 and 1");t.rawVelocity&&(t.rawRelease=t.velocity,console.warn("The 'rawVelocity' option is deprecated. Use 'rawRelease' instead.")),t.velocity&&(t.release=t.velocity,console.warn("The 'velocity' option is deprecated. Use 'attack' instead."))}let n=64;t.rawRelease!=null?n=t.rawRelease:isNaN(t.release)||(n=Math.round(t.release*127));const r=o.octaveOffset+this.output.octaveOffset+this.octaveOffset;return c.buildNoteArray(e,{rawRelease:parseInt(n)}).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.noteoff<<4)+(this.number-1),s.getOffsetNumber(r),s.rawRelease],{time:c.toTimestamp(t.time)})}),this}stopNote(e,t={}){return this.sendNoteOff(e,t)}sendNoteOn(e,t={}){if(o.validation){if(t.rawAttack!=null&&!(t.rawAttack>=0&&t.rawAttack<=127))throw new RangeError("The 'rawAttack' option must be an integer between 0 and 127");if(t.attack!=null&&!(t.attack>=0&&t.attack<=1))throw new RangeError("The 'attack' option must be an number between 0 and 1");t.rawVelocity&&(t.rawAttack=t.velocity,t.rawRelease=t.release,console.warn("The 'rawVelocity' option is deprecated. Use 'rawAttack' or 'rawRelease'.")),t.velocity&&(t.attack=t.velocity,console.warn("The 'velocity' option is deprecated. Use 'attack' instead."))}let n=64;t.rawAttack!=null?n=t.rawAttack:isNaN(t.attack)||(n=Math.round(t.attack*127));const r=o.octaveOffset+this.output.octaveOffset+this.octaveOffset;return c.buildNoteArray(e,{rawAttack:n}).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.noteon<<4)+(this.number-1),s.getOffsetNumber(r),s.rawAttack],{time:c.toTimestamp(t.time)})}),this}sendChannelMode(e,t=0,n={}){if(typeof e=="string"&&(e=a.CHANNEL_MODE_MESSAGES[e]),o.validation){if(e===void 0)throw new TypeError("Invalid channel mode message name or number.");if(isNaN(e)||!(e>=120&&e<=127))throw new TypeError("Invalid channel mode message number.");if(isNaN(parseInt(t))||t<0||t>127)throw new RangeError("Value must be an integer between 0 and 127.")}return this.send([(a.CHANNEL_MESSAGES.controlchange<<4)+(this.number-1),e,t],{time:c.toTimestamp(n.time)}),this}sendOmniMode(e,t={}){return e===void 0||e?this.sendChannelMode("omnimodeon",0,t):this.sendChannelMode("omnimodeoff",0,t),this}sendChannelAftertouch(e,t={}){if(o.validation){if(isNaN(parseFloat(e)))throw new RangeError("Invalid channel aftertouch value.");if(t.rawValue){if(!(e>=0&&e<=127&&Number.isInteger(e)))throw new RangeError("Channel aftertouch raw value must be an integer between 0 and 127.")}else if(!(e>=0&&e<=1))throw new RangeError("Channel aftertouch value must be a float between 0 and 1.")}return t.rawValue||(e=c.fromFloatTo7Bit(e)),this.send([(a.CHANNEL_MESSAGES.channelaftertouch<<4)+(this.number-1),Math.round(e)],{time:c.toTimestamp(t.time)}),this}sendMasterTuning(e,t={}){if(e=parseFloat(e)||0,o.validation&&!(e>-65&&e<64))throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");let n=Math.floor(e)+64,r=e-Math.floor(e);r=Math.round((r+1)/2*16383);let s=r>>7&127,l=r&127;return this.sendRpnValue("channelcoarsetuning",n,t),this.sendRpnValue("channelfinetuning",[s,l],t),this}sendModulationRange(e,t,n={}){if(o.validation){if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new RangeError("The semitones value must be an integer between 0 and 127.");if(t!=null&&(!Number.isInteger(t)||!(t>=0&&t<=127)))throw new RangeError("If specified, the cents value must be an integer between 0 and 127.")}return t>=0&&t<=127||(t=0),this.sendRpnValue("modulationrange",[e,t],n),this}sendNrpnValue(e,t,n={}){if(t=[].concat(t),o.validation){if(!Array.isArray(e)||!Number.isInteger(e[0])||!Number.isInteger(e[1]))throw new TypeError("The specified NRPN is invalid.");if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The first byte of the NRPN must be between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The second byte of the NRPN must be between 0 and 127.");t.forEach(r=>{if(!(r>=0&&r<=127))throw new RangeError("The data bytes of the NRPN must be between 0 and 127.")})}return this._selectNonRegisteredParameter(e,n),this._setCurrentParameter(t,n),this._deselectNonRegisteredParameter(n),this}sendPitchBend(e,t={}){if(o.validation)if(t.rawValue&&Array.isArray(e)){if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The pitch bend MSB must be an integer between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The pitch bend LSB must be an integer between 0 and 127.")}else if(t.rawValue&&!Array.isArray(e)){if(!(e>=0&&e<=127))throw new RangeError("The pitch bend MSB must be an integer between 0 and 127.")}else{if(isNaN(e)||e===null)throw new RangeError("Invalid pitch bend value.");if(!(e>=-1&&e<=1))throw new RangeError("The pitch bend value must be a float between -1 and 1.")}let n=0,r=0;if(t.rawValue&&Array.isArray(e))n=e[0],r=e[1];else if(t.rawValue&&!Array.isArray(e))n=e;else{const s=c.fromFloatToMsbLsb((e+1)/2);n=s.msb,r=s.lsb}return this.send([(a.CHANNEL_MESSAGES.pitchbend<<4)+(this.number-1),r,n],{time:c.toTimestamp(t.time)}),this}sendPitchBendRange(e,t,n={}){if(o.validation){if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new RangeError("The semitones value must be an integer between 0 and 127.");if(!Number.isInteger(t)||!(t>=0&&t<=127))throw new RangeError("The cents value must be an integer between 0 and 127.")}return this.sendRpnValue("pitchbendrange",[e,t],n),this}sendProgramChange(e,t={}){if(e=parseInt(e)||0,o.validation&&!(e>=0&&e<=127))throw new RangeError("The program number must be between 0 and 127.");return this.send([(a.CHANNEL_MESSAGES.programchange<<4)+(this.number-1),e],{time:c.toTimestamp(t.time)}),this}sendRpnValue(e,t,n={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),o.validation){if(!Number.isInteger(e[0])||!Number.isInteger(e[1]))throw new TypeError("The specified NRPN is invalid.");if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The first byte of the RPN must be between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The second byte of the RPN must be between 0 and 127.");[].concat(t).forEach(r=>{if(!(r>=0&&r<=127))throw new RangeError("The data bytes of the RPN must be between 0 and 127.")})}return this._selectRegisteredParameter(e,n),this._setCurrentParameter(t,n),this._deselectRegisteredParameter(n),this}sendTuningBank(e,t={}){if(o.validation&&(!Number.isInteger(e)||!(e>=0&&e<=127)))throw new RangeError("The tuning bank number must be between 0 and 127.");return this.sendRpnValue("tuningbank",e,t),this}sendTuningProgram(e,t={}){if(o.validation&&(!Number.isInteger(e)||!(e>=0&&e<=127)))throw new RangeError("The tuning program number must be between 0 and 127.");return this.sendRpnValue("tuningprogram",e,t),this}sendLocalControl(e,t={}){return e?this.sendChannelMode("localcontrol",127,t):this.sendChannelMode("localcontrol",0,t)}sendAllNotesOff(e={}){return this.sendChannelMode("allnotesoff",0,e)}sendAllSoundOff(e={}){return this.sendChannelMode("allsoundoff",0,e)}sendResetAllControllers(e={}){return this.sendChannelMode("resetallcontrollers",0,e)}sendPolyphonicMode(e,t={}){return e==="mono"?this.sendChannelMode("monomodeon",0,t):this.sendChannelMode("polymodeon",0,t)}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get output(){return this._output}get number(){return this._number}}/** + */class ht extends Z{constructor(e,t){super(),this._output=e,this._number=t,this._octaveOffset=0}destroy(){this._output=null,this._number=null,this._octaveOffset=0,this.removeListener()}send(e,t={time:0}){return this.output.send(e,t),this}sendKeyAftertouch(e,t,n={}){if(c.validation){if(n.useRawValue&&(n.rawValue=n.useRawValue),isNaN(parseFloat(t)))throw new RangeError("Invalid key aftertouch value.");if(n.rawValue){if(!(t>=0&&t<=127&&Number.isInteger(t)))throw new RangeError("Key aftertouch raw value must be an integer between 0 and 127.")}else if(!(t>=0&&t<=1))throw new RangeError("Key aftertouch value must be a float between 0 and 1.")}n.rawValue||(t=d.fromFloatTo7Bit(t));const r=c.octaveOffset+this.output.octaveOffset+this.octaveOffset;return Array.isArray(e)||(e=[e]),d.buildNoteArray(e).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.keyaftertouch<<4)+(this.number-1),s.getOffsetNumber(r),t],{time:d.toTimestamp(n.time)})}),this}sendControlChange(e,t,n={}){if(typeof e=="string"&&(e=d.getCcNumberByName(e)),Array.isArray(t)||(t=[t]),c.validation){if(e===void 0)throw new TypeError("Control change must be identified with a valid name or an integer between 0 and 127.");if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new TypeError("Control change number must be an integer between 0 and 127.");if(t=t.map(r=>{const s=Math.min(Math.max(parseInt(r),0),127);if(isNaN(s))throw new TypeError("Values must be integers between 0 and 127");return s}),t.length===2&&e>=32)throw new TypeError("To use a value array, the controller must be between 0 and 31")}return t.forEach((r,s)=>{this.send([(a.CHANNEL_MESSAGES.controlchange<<4)+(this.number-1),e+s*32,t[s]],{time:d.toTimestamp(n.time)})}),this}_selectNonRegisteredParameter(e,t={}){return this.sendControlChange(99,e[0],t),this.sendControlChange(98,e[1],t),this}_deselectRegisteredParameter(e={}){return this.sendControlChange(101,127,e),this.sendControlChange(100,127,e),this}_deselectNonRegisteredParameter(e={}){return this.sendControlChange(101,127,e),this.sendControlChange(100,127,e),this}_selectRegisteredParameter(e,t={}){return this.sendControlChange(101,e[0],t),this.sendControlChange(100,e[1],t),this}_setCurrentParameter(e,t={}){return e=[].concat(e),this.sendControlChange(6,e[0],t),e.length<2?this:(this.sendControlChange(38,e[1],t),this)}sendRpnDecrement(e,t={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),c.validation){if(e===void 0)throw new TypeError("The specified registered parameter is invalid.");let n=!1;if(Object.getOwnPropertyNames(a.REGISTERED_PARAMETERS).forEach(r=>{a.REGISTERED_PARAMETERS[r][0]===e[0]&&a.REGISTERED_PARAMETERS[r][1]===e[1]&&(n=!0)}),!n)throw new TypeError("The specified registered parameter is invalid.")}return this._selectRegisteredParameter(e,t),this.sendControlChange(97,0,t),this._deselectRegisteredParameter(t),this}sendRpnIncrement(e,t={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),c.validation){if(e===void 0)throw new TypeError("The specified registered parameter is invalid.");let n=!1;if(Object.getOwnPropertyNames(a.REGISTERED_PARAMETERS).forEach(r=>{a.REGISTERED_PARAMETERS[r][0]===e[0]&&a.REGISTERED_PARAMETERS[r][1]===e[1]&&(n=!0)}),!n)throw new TypeError("The specified registered parameter is invalid.")}return this._selectRegisteredParameter(e,t),this.sendControlChange(96,0,t),this._deselectRegisteredParameter(t),this}playNote(e,t={}){this.sendNoteOn(e,t);const n=Array.isArray(e)?e:[e];for(let r of n)if(parseInt(r.duration)>0){const s={time:(d.toTimestamp(t.time)||c.time)+parseInt(r.duration),release:r.release,rawRelease:r.rawRelease};this.sendNoteOff(r,s)}else if(parseInt(t.duration)>0){const s={time:(d.toTimestamp(t.time)||c.time)+parseInt(t.duration),release:t.release,rawRelease:t.rawRelease};this.sendNoteOff(r,s)}return this}sendNoteOff(e,t={}){if(c.validation){if(t.rawRelease!=null&&!(t.rawRelease>=0&&t.rawRelease<=127))throw new RangeError("The 'rawRelease' option must be an integer between 0 and 127");if(t.release!=null&&!(t.release>=0&&t.release<=1))throw new RangeError("The 'release' option must be an number between 0 and 1");t.rawVelocity&&(t.rawRelease=t.velocity,console.warn("The 'rawVelocity' option is deprecated. Use 'rawRelease' instead.")),t.velocity&&(t.release=t.velocity,console.warn("The 'velocity' option is deprecated. Use 'attack' instead."))}let n=64;t.rawRelease!=null?n=t.rawRelease:isNaN(t.release)||(n=Math.round(t.release*127));const r=c.octaveOffset+this.output.octaveOffset+this.octaveOffset;return d.buildNoteArray(e,{rawRelease:parseInt(n)}).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.noteoff<<4)+(this.number-1),s.getOffsetNumber(r),s.rawRelease],{time:d.toTimestamp(t.time)})}),this}stopNote(e,t={}){return this.sendNoteOff(e,t)}sendNoteOn(e,t={}){if(c.validation){if(t.rawAttack!=null&&!(t.rawAttack>=0&&t.rawAttack<=127))throw new RangeError("The 'rawAttack' option must be an integer between 0 and 127");if(t.attack!=null&&!(t.attack>=0&&t.attack<=1))throw new RangeError("The 'attack' option must be an number between 0 and 1");t.rawVelocity&&(t.rawAttack=t.velocity,t.rawRelease=t.release,console.warn("The 'rawVelocity' option is deprecated. Use 'rawAttack' or 'rawRelease'.")),t.velocity&&(t.attack=t.velocity,console.warn("The 'velocity' option is deprecated. Use 'attack' instead."))}let n=64;t.rawAttack!=null?n=t.rawAttack:isNaN(t.attack)||(n=Math.round(t.attack*127));const r=c.octaveOffset+this.output.octaveOffset+this.octaveOffset;return d.buildNoteArray(e,{rawAttack:n}).forEach(s=>{this.send([(a.CHANNEL_MESSAGES.noteon<<4)+(this.number-1),s.getOffsetNumber(r),s.rawAttack],{time:d.toTimestamp(t.time)})}),this}sendChannelMode(e,t=0,n={}){if(typeof e=="string"&&(e=a.CHANNEL_MODE_MESSAGES[e]),c.validation){if(e===void 0)throw new TypeError("Invalid channel mode message name or number.");if(isNaN(e)||!(e>=120&&e<=127))throw new TypeError("Invalid channel mode message number.");if(isNaN(parseInt(t))||t<0||t>127)throw new RangeError("Value must be an integer between 0 and 127.")}return this.send([(a.CHANNEL_MESSAGES.controlchange<<4)+(this.number-1),e,t],{time:d.toTimestamp(n.time)}),this}sendOmniMode(e,t={}){return e===void 0||e?this.sendChannelMode("omnimodeon",0,t):this.sendChannelMode("omnimodeoff",0,t),this}sendChannelAftertouch(e,t={}){if(c.validation){if(isNaN(parseFloat(e)))throw new RangeError("Invalid channel aftertouch value.");if(t.rawValue){if(!(e>=0&&e<=127&&Number.isInteger(e)))throw new RangeError("Channel aftertouch raw value must be an integer between 0 and 127.")}else if(!(e>=0&&e<=1))throw new RangeError("Channel aftertouch value must be a float between 0 and 1.")}return t.rawValue||(e=d.fromFloatTo7Bit(e)),this.send([(a.CHANNEL_MESSAGES.channelaftertouch<<4)+(this.number-1),Math.round(e)],{time:d.toTimestamp(t.time)}),this}sendMasterTuning(e,t={}){if(e=parseFloat(e)||0,c.validation&&!(e>-65&&e<64))throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");let n=Math.floor(e)+64,r=e-Math.floor(e);r=Math.round((r+1)/2*16383);let s=r>>7&127,l=r&127;return this.sendRpnValue("channelcoarsetuning",n,t),this.sendRpnValue("channelfinetuning",[s,l],t),this}sendModulationRange(e,t,n={}){if(c.validation){if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new RangeError("The semitones value must be an integer between 0 and 127.");if(t!=null&&(!Number.isInteger(t)||!(t>=0&&t<=127)))throw new RangeError("If specified, the cents value must be an integer between 0 and 127.")}return t>=0&&t<=127||(t=0),this.sendRpnValue("modulationrange",[e,t],n),this}sendNrpnValue(e,t,n={}){if(t=[].concat(t),c.validation){if(!Array.isArray(e)||!Number.isInteger(e[0])||!Number.isInteger(e[1]))throw new TypeError("The specified NRPN is invalid.");if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The first byte of the NRPN must be between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The second byte of the NRPN must be between 0 and 127.");t.forEach(r=>{if(!(r>=0&&r<=127))throw new RangeError("The data bytes of the NRPN must be between 0 and 127.")})}return this._selectNonRegisteredParameter(e,n),this._setCurrentParameter(t,n),this._deselectNonRegisteredParameter(n),this}sendPitchBend(e,t={}){if(c.validation)if(t.rawValue&&Array.isArray(e)){if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The pitch bend MSB must be an integer between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The pitch bend LSB must be an integer between 0 and 127.")}else if(t.rawValue&&!Array.isArray(e)){if(!(e>=0&&e<=127))throw new RangeError("The pitch bend MSB must be an integer between 0 and 127.")}else{if(isNaN(e)||e===null)throw new RangeError("Invalid pitch bend value.");if(!(e>=-1&&e<=1))throw new RangeError("The pitch bend value must be a float between -1 and 1.")}let n=0,r=0;if(t.rawValue&&Array.isArray(e))n=e[0],r=e[1];else if(t.rawValue&&!Array.isArray(e))n=e;else{const s=d.fromFloatToMsbLsb((e+1)/2);n=s.msb,r=s.lsb}return this.send([(a.CHANNEL_MESSAGES.pitchbend<<4)+(this.number-1),r,n],{time:d.toTimestamp(t.time)}),this}sendPitchBendRange(e,t,n={}){if(c.validation){if(!Number.isInteger(e)||!(e>=0&&e<=127))throw new RangeError("The semitones value must be an integer between 0 and 127.");if(!Number.isInteger(t)||!(t>=0&&t<=127))throw new RangeError("The cents value must be an integer between 0 and 127.")}return this.sendRpnValue("pitchbendrange",[e,t],n),this}sendProgramChange(e,t={}){if(e=parseInt(e)||0,c.validation&&!(e>=0&&e<=127))throw new RangeError("The program number must be between 0 and 127.");return this.send([(a.CHANNEL_MESSAGES.programchange<<4)+(this.number-1),e],{time:d.toTimestamp(t.time)}),this}sendRpnValue(e,t,n={}){if(Array.isArray(e)||(e=a.REGISTERED_PARAMETERS[e]),c.validation){if(!Number.isInteger(e[0])||!Number.isInteger(e[1]))throw new TypeError("The specified NRPN is invalid.");if(!(e[0]>=0&&e[0]<=127))throw new RangeError("The first byte of the RPN must be between 0 and 127.");if(!(e[1]>=0&&e[1]<=127))throw new RangeError("The second byte of the RPN must be between 0 and 127.");[].concat(t).forEach(r=>{if(!(r>=0&&r<=127))throw new RangeError("The data bytes of the RPN must be between 0 and 127.")})}return this._selectRegisteredParameter(e,n),this._setCurrentParameter(t,n),this._deselectRegisteredParameter(n),this}sendTuningBank(e,t={}){if(c.validation&&(!Number.isInteger(e)||!(e>=0&&e<=127)))throw new RangeError("The tuning bank number must be between 0 and 127.");return this.sendRpnValue("tuningbank",e,t),this}sendTuningProgram(e,t={}){if(c.validation&&(!Number.isInteger(e)||!(e>=0&&e<=127)))throw new RangeError("The tuning program number must be between 0 and 127.");return this.sendRpnValue("tuningprogram",e,t),this}sendLocalControl(e,t={}){return e?this.sendChannelMode("localcontrol",127,t):this.sendChannelMode("localcontrol",0,t)}sendAllNotesOff(e={}){return this.sendChannelMode("allnotesoff",0,e)}sendAllSoundOff(e={}){return this.sendChannelMode("allsoundoff",0,e)}sendResetAllControllers(e={}){return this.sendChannelMode("resetallcontrollers",0,e)}sendPolyphonicMode(e,t={}){return e==="mono"?this.sendChannelMode("monomodeon",0,t):this.sendChannelMode("polymodeon",0,t)}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get output(){return this._output}get number(){return this._number}}/** * The `Output` class represents a single MIDI output port (not to be confused with a MIDI channel). * A port is made available by a MIDI device. A MIDI device can advertise several input and output * ports. Each port has 16 MIDI channels which can be accessed via the [`channels`](#channels) @@ -69,7 +69,7 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * * @extends EventEmitter * @license Apache-2.0 - */class Se extends J{constructor(e){super(),this._midiOutput=e,this._octaveOffset=0,this.channels=[];for(let t=1;t<=16;t++)this.channels[t]=new Ze(this,t);this._midiOutput.onstatechange=this._onStateChange.bind(this)}async destroy(){this.removeListener(),this.channels.forEach(e=>e.destroy()),this.channels=[],this._midiOutput&&(this._midiOutput.onstatechange=null),await this.close(),this._midiOutput=null}_onStateChange(e){let t={timestamp:o.time};e.port.connection==="open"?(t.type="opened",t.target=this,t.port=t.target,this.emit("opened",t)):e.port.connection==="closed"&&e.port.state==="connected"?(t.type="closed",t.target=this,t.port=t.target,this.emit("closed",t)):e.port.connection==="closed"&&e.port.state==="disconnected"?(t.type="disconnected",t.port={connection:e.port.connection,id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this.emit("disconnected",t)):e.port.connection==="pending"&&e.port.state==="disconnected"||console.warn("This statechange event was not caught:",e.port.connection,e.port.state)}async open(){try{return await this._midiOutput.open(),Promise.resolve(this)}catch(e){return Promise.reject(e)}}async close(){this._midiOutput?await this._midiOutput.close():await Promise.resolve()}send(e,t={time:0},n=0){if(e instanceof qe&&(e=c.isNode?e.data:e.rawData),e instanceof Uint8Array&&c.isNode&&(e=Array.from(e)),o.validation){if(!Array.isArray(e)&&!(e instanceof Uint8Array)&&(e=[e],Array.isArray(t)&&(e=e.concat(t)),t=isNaN(n)?{time:0}:{time:n}),!(parseInt(e[0])>=128&&parseInt(e[0])<=255))throw new RangeError("The first byte (status) must be an integer between 128 and 255.");e.slice(1).forEach(r=>{if(r=parseInt(r),!(r>=0&&r<=255))throw new RangeError("Data bytes must be integers between 0 and 255.")}),t||(t={time:0})}return this._midiOutput.send(e,c.toTimestamp(t.time)),this}sendSysex(e,t=[],n={}){if(e=[].concat(e),t instanceof Uint8Array){const r=new Uint8Array(1+e.length+t.length+1);r[0]=a.SYSTEM_MESSAGES.sysex,r.set(Uint8Array.from(e),1),r.set(t,1+e.length),r[r.length-1]=a.SYSTEM_MESSAGES.sysexend,this.send(r,{time:n.time})}else{const r=e.concat(t,a.SYSTEM_MESSAGES.sysexend);this.send([a.SYSTEM_MESSAGES.sysex].concat(r),{time:n.time})}return this}clear(){return this._midiOutput.clear?this._midiOutput.clear():o.validation&&console.warn("The 'clear()' method has not yet been implemented in your environment."),this}sendTimecodeQuarterFrame(e,t={}){if(o.validation&&(e=parseInt(e),isNaN(e)||!(e>=0&&e<=127)))throw new RangeError("The value must be an integer between 0 and 127.");return this.send([a.SYSTEM_MESSAGES.timecode,e],{time:t.time}),this}sendSongPosition(e=0,t={}){e=Math.floor(e)||0;var n=e>>7&127,r=e&127;return this.send([a.SYSTEM_MESSAGES.songposition,n,r],{time:t.time}),this}sendSongSelect(e=0,t={}){if(o.validation&&(e=parseInt(e),isNaN(e)||!(e>=0&&e<=127)))throw new RangeError("The program value must be between 0 and 127");return this.send([a.SYSTEM_MESSAGES.songselect,e],{time:t.time}),this}sendTuneRequest(e={}){return this.send([a.SYSTEM_MESSAGES.tunerequest],{time:e.time}),this}sendClock(e={}){return this.send([a.SYSTEM_MESSAGES.clock],{time:e.time}),this}sendStart(e={}){return this.send([a.SYSTEM_MESSAGES.start],{time:e.time}),this}sendContinue(e={}){return this.send([a.SYSTEM_MESSAGES.continue],{time:e.time}),this}sendStop(e={}){return this.send([a.SYSTEM_MESSAGES.stop],{time:e.time}),this}sendActiveSensing(e={}){return this.send([a.SYSTEM_MESSAGES.activesensing],{time:e.time}),this}sendReset(e={}){return this.send([a.SYSTEM_MESSAGES.reset],{time:e.time}),this}sendTuningRequest(e={}){return o.validation&&console.warn("The sendTuningRequest() method has been deprecated. Use sendTuningRequest() instead."),this.sendTuneRequest(e)}sendKeyAftertouch(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendKeyAftertouch(e,t,n)}),this}sendControlChange(e,t,n={},r={}){if(o.validation&&(Array.isArray(n)||Number.isInteger(n)||n==="all")){const s=n;n=r,n.channels=s,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)}return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(s=>{this.channels[s].sendControlChange(e,t,n)}),this}sendPitchBendRange(e=0,t=0,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendPitchBendRange(e,t,n)}),this}setPitchBendRange(e=0,t=0,n="all",r={}){return o.validation&&(console.warn("The setPitchBendRange() method is deprecated. Use sendPitchBendRange() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendPitchBendRange(e,t,r)}sendRpnValue(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendRpnValue(e,t,n)}),this}setRegisteredParameter(e,t=[],n="all",r={}){return o.validation&&(console.warn("The setRegisteredParameter() method is deprecated. Use sendRpnValue() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnValue(e,t,r)}sendChannelAftertouch(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendChannelAftertouch(e,t)}),this}sendPitchBend(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendPitchBend(e,t)}),this}sendProgramChange(e=0,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendProgramChange(e,t)}),this}sendModulationRange(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendModulationRange(e,t,n)}),this}setModulationRange(e=0,t=0,n="all",r={}){return o.validation&&(console.warn("The setModulationRange() method is deprecated. Use sendModulationRange() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendModulationRange(e,t,r)}sendMasterTuning(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendMasterTuning(e,t)}),this}setMasterTuning(e,t={},n={}){return o.validation&&(console.warn("The setMasterTuning() method is deprecated. Use sendMasterTuning() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendMasterTuning(e,n)}sendTuningProgram(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendTuningProgram(e,t)}),this}setTuningProgram(e,t="all",n={}){return o.validation&&(console.warn("The setTuningProgram() method is deprecated. Use sendTuningProgram() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendTuningProgram(e,n)}sendTuningBank(e=0,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendTuningBank(e,t)}),this}setTuningBank(e,t="all",n={}){return o.validation&&(console.warn("The setTuningBank() method is deprecated. Use sendTuningBank() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendTuningBank(e,n)}sendChannelMode(e,t=0,n={},r={}){if(o.validation&&(Array.isArray(n)||Number.isInteger(n)||n==="all")){const s=n;n=r,n.channels=s,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)}return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(s=>{this.channels[s].sendChannelMode(e,t,n)}),this}sendAllSoundOff(e={}){return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(e.channels).forEach(t=>{this.channels[t].sendAllSoundOff(e)}),this}sendAllNotesOff(e={}){return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(e.channels).forEach(t=>{this.channels[t].sendAllNotesOff(e)}),this}sendResetAllControllers(e={},t={}){if(o.validation&&(Array.isArray(e)||Number.isInteger(e)||e==="all")){const n=e;e=t,e.channels=n,e.channels==="all"&&(e.channels=a.MIDI_CHANNEL_NUMBERS)}return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(e.channels).forEach(n=>{this.channels[n].sendResetAllControllers(e)}),this}sendPolyphonicMode(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendPolyphonicMode(e,t)}),this}sendLocalControl(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendLocalControl(e,t)}),this}sendOmniMode(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendOmniMode(e,t)}),this}sendNrpnValue(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendNrpnValue(e,t,n)}),this}setNonRegisteredParameter(e,t=[],n="all",r={}){return o.validation&&(console.warn("The setNonRegisteredParameter() method is deprecated. Use sendNrpnValue() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendNrpnValue(e,t,r)}sendRpnIncrement(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendRpnIncrement(e,t)}),this}incrementRegisteredParameter(e,t="all",n={}){return o.validation&&(console.warn("The incrementRegisteredParameter() method is deprecated. Use sendRpnIncrement() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnIncrement(e,n)}sendRpnDecrement(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendRpnDecrement(e,t)}),this}decrementRegisteredParameter(e,t="all",n={}){return o.validation&&(console.warn("The decrementRegisteredParameter() method is deprecated. Use sendRpnDecrement() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnDecrement(e,n)}sendNoteOff(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendNoteOff(e,t)}),this}stopNote(e,t){return this.sendNoteOff(e,t)}playNote(e,t={},n={}){if(o.validation&&(t.rawVelocity&&console.warn("The 'rawVelocity' option is deprecated. Use 'rawAttack' instead."),t.velocity&&console.warn("The 'velocity' option is deprecated. Use 'velocity' instead."),Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].playNote(e,t)}),this}sendNoteOn(e,t={},n={}){if(o.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendNoteOn(e,t)}),this}get name(){return this._midiOutput.name}get id(){return this._midiOutput.id}get connection(){return this._midiOutput.connection}get manufacturer(){return this._midiOutput.manufacturer}get state(){return this._midiOutput.state}get type(){return this._midiOutput.type}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}}/** + */class Oe extends Z{constructor(e){super(),this._midiOutput=e,this._octaveOffset=0,this.channels=[];for(let t=1;t<=16;t++)this.channels[t]=new ht(this,t);this._midiOutput.onstatechange=this._onStateChange.bind(this)}async destroy(){this.removeListener(),this.channels.forEach(e=>e.destroy()),this.channels=[],this._midiOutput&&(this._midiOutput.onstatechange=null),await this.close(),this._midiOutput=null}_onStateChange(e){let t={timestamp:c.time};e.port.connection==="open"?(t.type="opened",t.target=this,t.port=t.target,this.emit("opened",t)):e.port.connection==="closed"&&e.port.state==="connected"?(t.type="closed",t.target=this,t.port=t.target,this.emit("closed",t)):e.port.connection==="closed"&&e.port.state==="disconnected"?(t.type="disconnected",t.port={connection:e.port.connection,id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this.emit("disconnected",t)):e.port.connection==="pending"&&e.port.state==="disconnected"||console.warn("This statechange event was not caught:",e.port.connection,e.port.state)}async open(){try{return await this._midiOutput.open(),Promise.resolve(this)}catch(e){return Promise.reject(e)}}async close(){this._midiOutput?await this._midiOutput.close():await Promise.resolve()}send(e,t={time:0},n=0){if(e instanceof st&&(e=d.isNode?e.data:e.rawData),e instanceof Uint8Array&&d.isNode&&(e=Array.from(e)),c.validation){if(!Array.isArray(e)&&!(e instanceof Uint8Array)&&(e=[e],Array.isArray(t)&&(e=e.concat(t)),t=isNaN(n)?{time:0}:{time:n}),!(parseInt(e[0])>=128&&parseInt(e[0])<=255))throw new RangeError("The first byte (status) must be an integer between 128 and 255.");e.slice(1).forEach(r=>{if(r=parseInt(r),!(r>=0&&r<=255))throw new RangeError("Data bytes must be integers between 0 and 255.")}),t||(t={time:0})}return this._midiOutput.send(e,d.toTimestamp(t.time)),this}sendSysex(e,t=[],n={}){if(e=[].concat(e),t instanceof Uint8Array){const r=new Uint8Array(1+e.length+t.length+1);r[0]=a.SYSTEM_MESSAGES.sysex,r.set(Uint8Array.from(e),1),r.set(t,1+e.length),r[r.length-1]=a.SYSTEM_MESSAGES.sysexend,this.send(r,{time:n.time})}else{const r=e.concat(t,a.SYSTEM_MESSAGES.sysexend);this.send([a.SYSTEM_MESSAGES.sysex].concat(r),{time:n.time})}return this}clear(){return this._midiOutput.clear?this._midiOutput.clear():c.validation&&console.warn("The 'clear()' method has not yet been implemented in your environment."),this}sendTimecodeQuarterFrame(e,t={}){if(c.validation&&(e=parseInt(e),isNaN(e)||!(e>=0&&e<=127)))throw new RangeError("The value must be an integer between 0 and 127.");return this.send([a.SYSTEM_MESSAGES.timecode,e],{time:t.time}),this}sendSongPosition(e=0,t={}){e=Math.floor(e)||0;var n=e>>7&127,r=e&127;return this.send([a.SYSTEM_MESSAGES.songposition,n,r],{time:t.time}),this}sendSongSelect(e=0,t={}){if(c.validation&&(e=parseInt(e),isNaN(e)||!(e>=0&&e<=127)))throw new RangeError("The program value must be between 0 and 127");return this.send([a.SYSTEM_MESSAGES.songselect,e],{time:t.time}),this}sendTuneRequest(e={}){return this.send([a.SYSTEM_MESSAGES.tunerequest],{time:e.time}),this}sendClock(e={}){return this.send([a.SYSTEM_MESSAGES.clock],{time:e.time}),this}sendStart(e={}){return this.send([a.SYSTEM_MESSAGES.start],{time:e.time}),this}sendContinue(e={}){return this.send([a.SYSTEM_MESSAGES.continue],{time:e.time}),this}sendStop(e={}){return this.send([a.SYSTEM_MESSAGES.stop],{time:e.time}),this}sendActiveSensing(e={}){return this.send([a.SYSTEM_MESSAGES.activesensing],{time:e.time}),this}sendReset(e={}){return this.send([a.SYSTEM_MESSAGES.reset],{time:e.time}),this}sendTuningRequest(e={}){return c.validation&&console.warn("The sendTuningRequest() method has been deprecated. Use sendTuningRequest() instead."),this.sendTuneRequest(e)}sendKeyAftertouch(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendKeyAftertouch(e,t,n)}),this}sendControlChange(e,t,n={},r={}){if(c.validation&&(Array.isArray(n)||Number.isInteger(n)||n==="all")){const s=n;n=r,n.channels=s,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)}return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(s=>{this.channels[s].sendControlChange(e,t,n)}),this}sendPitchBendRange(e=0,t=0,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendPitchBendRange(e,t,n)}),this}setPitchBendRange(e=0,t=0,n="all",r={}){return c.validation&&(console.warn("The setPitchBendRange() method is deprecated. Use sendPitchBendRange() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendPitchBendRange(e,t,r)}sendRpnValue(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendRpnValue(e,t,n)}),this}setRegisteredParameter(e,t=[],n="all",r={}){return c.validation&&(console.warn("The setRegisteredParameter() method is deprecated. Use sendRpnValue() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnValue(e,t,r)}sendChannelAftertouch(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendChannelAftertouch(e,t)}),this}sendPitchBend(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendPitchBend(e,t)}),this}sendProgramChange(e=0,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendProgramChange(e,t)}),this}sendModulationRange(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendModulationRange(e,t,n)}),this}setModulationRange(e=0,t=0,n="all",r={}){return c.validation&&(console.warn("The setModulationRange() method is deprecated. Use sendModulationRange() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendModulationRange(e,t,r)}sendMasterTuning(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendMasterTuning(e,t)}),this}setMasterTuning(e,t={},n={}){return c.validation&&(console.warn("The setMasterTuning() method is deprecated. Use sendMasterTuning() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendMasterTuning(e,n)}sendTuningProgram(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendTuningProgram(e,t)}),this}setTuningProgram(e,t="all",n={}){return c.validation&&(console.warn("The setTuningProgram() method is deprecated. Use sendTuningProgram() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendTuningProgram(e,n)}sendTuningBank(e=0,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendTuningBank(e,t)}),this}setTuningBank(e,t="all",n={}){return c.validation&&(console.warn("The setTuningBank() method is deprecated. Use sendTuningBank() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendTuningBank(e,n)}sendChannelMode(e,t=0,n={},r={}){if(c.validation&&(Array.isArray(n)||Number.isInteger(n)||n==="all")){const s=n;n=r,n.channels=s,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)}return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(s=>{this.channels[s].sendChannelMode(e,t,n)}),this}sendAllSoundOff(e={}){return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(e.channels).forEach(t=>{this.channels[t].sendAllSoundOff(e)}),this}sendAllNotesOff(e={}){return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(e.channels).forEach(t=>{this.channels[t].sendAllNotesOff(e)}),this}sendResetAllControllers(e={},t={}){if(c.validation&&(Array.isArray(e)||Number.isInteger(e)||e==="all")){const n=e;e=t,e.channels=n,e.channels==="all"&&(e.channels=a.MIDI_CHANNEL_NUMBERS)}return e.channels==null&&(e.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(e.channels).forEach(n=>{this.channels[n].sendResetAllControllers(e)}),this}sendPolyphonicMode(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendPolyphonicMode(e,t)}),this}sendLocalControl(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendLocalControl(e,t)}),this}sendOmniMode(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendOmniMode(e,t)}),this}sendNrpnValue(e,t,n={}){return n.channels==null&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].sendNrpnValue(e,t,n)}),this}setNonRegisteredParameter(e,t=[],n="all",r={}){return c.validation&&(console.warn("The setNonRegisteredParameter() method is deprecated. Use sendNrpnValue() instead."),r.channels=n,r.channels==="all"&&(r.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendNrpnValue(e,t,r)}sendRpnIncrement(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendRpnIncrement(e,t)}),this}incrementRegisteredParameter(e,t="all",n={}){return c.validation&&(console.warn("The incrementRegisteredParameter() method is deprecated. Use sendRpnIncrement() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnIncrement(e,n)}sendRpnDecrement(e,t={}){return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(n=>{this.channels[n].sendRpnDecrement(e,t)}),this}decrementRegisteredParameter(e,t="all",n={}){return c.validation&&(console.warn("The decrementRegisteredParameter() method is deprecated. Use sendRpnDecrement() instead."),n.channels=t,n.channels==="all"&&(n.channels=a.MIDI_CHANNEL_NUMBERS)),this.sendRpnDecrement(e,n)}sendNoteOff(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendNoteOff(e,t)}),this}stopNote(e,t){return this.sendNoteOff(e,t)}playNote(e,t={},n={}){if(c.validation&&(t.rawVelocity&&console.warn("The 'rawVelocity' option is deprecated. Use 'rawAttack' instead."),t.velocity&&console.warn("The 'velocity' option is deprecated. Use 'velocity' instead."),Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].playNote(e,t)}),this}sendNoteOn(e,t={},n={}){if(c.validation&&(Array.isArray(t)||Number.isInteger(t)||t==="all")){const r=t;t=n,t.channels=r,t.channels==="all"&&(t.channels=a.MIDI_CHANNEL_NUMBERS)}return t.channels==null&&(t.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(t.channels).forEach(r=>{this.channels[r].sendNoteOn(e,t)}),this}get name(){return this._midiOutput.name}get id(){return this._midiOutput.id}get connection(){return this._midiOutput.connection}get manufacturer(){return this._midiOutput.manufacturer}get state(){return this._midiOutput.state}get type(){return this._midiOutput.type}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}}/** * The `Forwarder` class allows the forwarding of MIDI messages to predetermined outputs. When you * call its [`forward()`](#forward) method, it will send the specified [`Message`](Message) object * to all the outputs listed in its [`destinations`](#destinations) property. @@ -82,7 +82,7 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * * @license Apache-2.0 * @since 3.0.0 - */class He{constructor(e=[],t={}){this.destinations=[],this.types=[...Object.keys(a.SYSTEM_MESSAGES),...Object.keys(a.CHANNEL_MESSAGES)],this.channels=a.MIDI_CHANNEL_NUMBERS,this.suspended=!1,Array.isArray(e)||(e=[e]),t.types&&!Array.isArray(t.types)&&(t.types=[t.types]),t.channels&&!Array.isArray(t.channels)&&(t.channels=[t.channels]),o.validation&&(e.forEach(n=>{if(!(n instanceof Se))throw new TypeError("Destinations must be of type 'Output'.")}),t.types!==void 0&&t.types.forEach(n=>{if(!a.SYSTEM_MESSAGES.hasOwnProperty(n)&&!a.CHANNEL_MESSAGES.hasOwnProperty(n))throw new TypeError("Type must be a valid message type.")}),t.channels!==void 0&&t.channels.forEach(n=>{if(!a.MIDI_CHANNEL_NUMBERS.includes(n))throw new TypeError("MIDI channel must be between 1 and 16.")})),this.destinations=e,t.types&&(this.types=t.types),t.channels&&(this.channels=t.channels)}forward(e){this.suspended||this.types.includes(e.type)&&(e.channel&&!this.channels.includes(e.channel)||this.destinations.forEach(t=>{o.validation&&!(t instanceof Se)||t.send(e)}))}}/** + */class Qe{constructor(e=[],t={}){this.destinations=[],this.types=[...Object.keys(a.SYSTEM_MESSAGES),...Object.keys(a.CHANNEL_MESSAGES)],this.channels=a.MIDI_CHANNEL_NUMBERS,this.suspended=!1,Array.isArray(e)||(e=[e]),t.types&&!Array.isArray(t.types)&&(t.types=[t.types]),t.channels&&!Array.isArray(t.channels)&&(t.channels=[t.channels]),c.validation&&(e.forEach(n=>{if(!(n instanceof Oe))throw new TypeError("Destinations must be of type 'Output'.")}),t.types!==void 0&&t.types.forEach(n=>{if(!a.SYSTEM_MESSAGES.hasOwnProperty(n)&&!a.CHANNEL_MESSAGES.hasOwnProperty(n))throw new TypeError("Type must be a valid message type.")}),t.channels!==void 0&&t.channels.forEach(n=>{if(!a.MIDI_CHANNEL_NUMBERS.includes(n))throw new TypeError("MIDI channel must be between 1 and 16.")})),this.destinations=e,t.types&&(this.types=t.types),t.channels&&(this.channels=t.channels)}forward(e){this.suspended||this.types.includes(e.type)&&(e.channel&&!this.channels.includes(e.channel)||this.destinations.forEach(t=>{c.validation&&!(t instanceof Oe)||t.send(e)}))}}/** * The `InputChannel` class represents a single MIDI input channel (1-16) from a single input * device. This object is derived from the host's MIDI subsystem and should not be instantiated * directly. @@ -193,13 +193,13 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * @extends EventEmitter * @license Apache-2.0 * @since 3.0.0 - */class $e extends J{constructor(e,t){super(),this._input=e,this._number=t,this._octaveOffset=0,this._nrpnBuffer=[],this._rpnBuffer=[],this.parameterNumberEventsEnabled=!0,this.notesState=new Array(128).fill(!1)}destroy(){this._input=null,this._number=null,this._octaveOffset=0,this._nrpnBuffer=[],this.notesState=new Array(128).fill(!1),this.parameterNumberEventsEnabled=!1,this.removeListener()}_processMidiMessageEvent(e){const t=Object.assign({},e);t.port=this.input,t.target=this,t.type="midimessage",this.emit(t.type,t),this._parseEventForStandardMessages(t)}_parseEventForStandardMessages(e){const t=Object.assign({},e);t.type=t.message.type||"unknownmessage";const n=e.message.dataBytes[0],r=e.message.dataBytes[1];if(t.type==="noteoff"||t.type==="noteon"&&r===0)this.notesState[n]=!1,t.type="noteoff",t.note=new he(c.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+o.octaveOffset),{rawAttack:0,rawRelease:r}),t.value=c.from7bitToFloat(r),t.rawValue=r,t.velocity=t.note.release,t.rawVelocity=t.note.rawRelease;else if(t.type==="noteon")this.notesState[n]=!0,t.note=new he(c.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+o.octaveOffset),{rawAttack:r}),t.value=c.from7bitToFloat(r),t.rawValue=r,t.velocity=t.note.attack,t.rawVelocity=t.note.rawAttack;else if(t.type==="keyaftertouch")t.note=new he(c.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+o.octaveOffset)),t.value=c.from7bitToFloat(r),t.rawValue=r,t.identifier=t.note.identifier,t.key=t.note.number,t.rawKey=n;else if(t.type==="controlchange"){t.controller={number:n,name:a.CONTROL_CHANGE_MESSAGES[n].name,description:a.CONTROL_CHANGE_MESSAGES[n].description,position:a.CONTROL_CHANGE_MESSAGES[n].position},t.subtype=t.controller.name||"controller"+n,t.value=c.from7bitToFloat(r),t.rawValue=r;const s=Object.assign({},t);s.type=`${t.type}-controller${n}`,delete s.subtype,this.emit(s.type,s);const l=Object.assign({},t);l.type=`${t.type}-`+a.CONTROL_CHANGE_MESSAGES[n].name,delete l.subtype,l.type.indexOf("controller")!==0&&this.emit(l.type,l),t.message.dataBytes[0]>=120&&this._parseChannelModeMessage(t),this.parameterNumberEventsEnabled&&this._isRpnOrNrpnController(t.message.dataBytes[0])&&this._parseEventForParameterNumber(t)}else t.type==="programchange"?(t.value=n,t.rawValue=t.value):t.type==="channelaftertouch"?(t.value=c.from7bitToFloat(n),t.rawValue=n):t.type==="pitchbend"?(t.value=((r<<7)+n-8192)/8192,t.rawValue=(r<<7)+n):t.type="unknownmessage";this.emit(t.type,t)}_parseChannelModeMessage(e){const t=Object.assign({},e);t.type=t.controller.name,t.type==="localcontrol"&&(t.value=t.message.data[2]===127,t.rawValue=t.message.data[2]),t.type==="omnimodeon"?(t.type="omnimode",t.value=!0,t.rawValue=t.message.data[2]):t.type==="omnimodeoff"&&(t.type="omnimode",t.value=!1,t.rawValue=t.message.data[2]),t.type==="monomodeon"?(t.type="monomode",t.value=!0,t.rawValue=t.message.data[2]):t.type==="polymodeon"&&(t.type="monomode",t.value=!1,t.rawValue=t.message.data[2]),this.emit(t.type,t)}_parseEventForParameterNumber(e){const t=e.message.dataBytes[0],n=e.message.dataBytes[1];t===99||t===101?(this._nrpnBuffer=[],this._rpnBuffer=[],t===99?this._nrpnBuffer=[e.message]:n!==127&&(this._rpnBuffer=[e.message])):t===98||t===100?t===98?(this._rpnBuffer=[],this._nrpnBuffer.length===1?this._nrpnBuffer.push(e.message):this._nrpnBuffer=[]):(this._nrpnBuffer=[],this._rpnBuffer.length===1&&n!==127?this._rpnBuffer.push(e.message):this._rpnBuffer=[]):(t===6||t===38||t===96||t===97)&&(this._rpnBuffer.length===2?this._dispatchParameterNumberEvent("rpn",this._rpnBuffer[0].dataBytes[1],this._rpnBuffer[1].dataBytes[1],e):this._nrpnBuffer.length===2?this._dispatchParameterNumberEvent("nrpn",this._nrpnBuffer[0].dataBytes[1],this._nrpnBuffer[1].dataBytes[1],e):(this._nrpnBuffer=[],this._rpnBuffer=[]))}_isRpnOrNrpnController(e){return e===6||e===38||e===96||e===97||e===98||e===99||e===100||e===101}_dispatchParameterNumberEvent(e,t,n,r){e=e==="nrpn"?"nrpn":"rpn";const s={target:r.target,timestamp:r.timestamp,message:r.message,parameterMsb:t,parameterLsb:n,value:c.from7bitToFloat(r.message.dataBytes[1]),rawValue:r.message.dataBytes[1]};e==="rpn"?s.parameter=Object.keys(a.REGISTERED_PARAMETERS).find(_=>a.REGISTERED_PARAMETERS[_][0]===t&&a.REGISTERED_PARAMETERS[_][1]===n):s.parameter=(t<<7)+n;const l=a.CONTROL_CHANGE_MESSAGES[r.message.dataBytes[0]].name;s.type=`${e}-${l}`,this.emit(s.type,s);const h=Object.assign({},s);h.type==="nrpn-dataincrement"?h.type="nrpn-databuttonincrement":h.type==="nrpn-datadecrement"?h.type="nrpn-databuttondecrement":h.type==="rpn-dataincrement"?h.type="rpn-databuttonincrement":h.type==="rpn-datadecrement"&&(h.type="rpn-databuttondecrement"),this.emit(h.type,h),s.type=e,s.subtype=l,this.emit(s.type,s)}getChannelModeByNumber(e){return o.validation&&(console.warn("The 'getChannelModeByNumber()' method has been moved to the 'Utilities' class."),e=Math.floor(e)),c.getChannelModeByNumber(e)}getCcNameByNumber(e){if(o.validation&&(console.warn("The 'getCcNameByNumber()' method has been moved to the 'Utilities' class."),e=parseInt(e),!(e>=0&&e<=127)))throw new RangeError("Invalid control change number.");return c.getCcNameByNumber(e)}getNoteState(e){e instanceof he&&(e=e.identifier);const t=c.guessNoteNumber(e,o.octaveOffset+this.input.octaveOffset+this.octaveOffset);return this.notesState[t]}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get input(){return this._input}get number(){return this._number}get nrpnEventsEnabled(){return this.parameterNumberEventsEnabled}set nrpnEventsEnabled(e){this.validation&&(e=!!e),this.parameterNumberEventsEnabled=e}}/** + */class ft extends Z{constructor(e,t){super(),this._input=e,this._number=t,this._octaveOffset=0,this._nrpnBuffer=[],this._rpnBuffer=[],this.parameterNumberEventsEnabled=!0,this.notesState=new Array(128).fill(!1)}destroy(){this._input=null,this._number=null,this._octaveOffset=0,this._nrpnBuffer=[],this.notesState=new Array(128).fill(!1),this.parameterNumberEventsEnabled=!1,this.removeListener()}_processMidiMessageEvent(e){const t=Object.assign({},e);t.port=this.input,t.target=this,t.type="midimessage",this.emit(t.type,t),this._parseEventForStandardMessages(t)}_parseEventForStandardMessages(e){const t=Object.assign({},e);t.type=t.message.type||"unknownmessage";const n=e.message.dataBytes[0],r=e.message.dataBytes[1];if(t.type==="noteoff"||t.type==="noteon"&&r===0)this.notesState[n]=!1,t.type="noteoff",t.note=new me(d.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+c.octaveOffset),{rawAttack:0,rawRelease:r}),t.value=d.from7bitToFloat(r),t.rawValue=r,t.velocity=t.note.release,t.rawVelocity=t.note.rawRelease;else if(t.type==="noteon")this.notesState[n]=!0,t.note=new me(d.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+c.octaveOffset),{rawAttack:r}),t.value=d.from7bitToFloat(r),t.rawValue=r,t.velocity=t.note.attack,t.rawVelocity=t.note.rawAttack;else if(t.type==="keyaftertouch")t.note=new me(d.offsetNumber(n,this.octaveOffset+this.input.octaveOffset+c.octaveOffset)),t.value=d.from7bitToFloat(r),t.rawValue=r,t.identifier=t.note.identifier,t.key=t.note.number,t.rawKey=n;else if(t.type==="controlchange"){t.controller={number:n,name:a.CONTROL_CHANGE_MESSAGES[n].name,description:a.CONTROL_CHANGE_MESSAGES[n].description,position:a.CONTROL_CHANGE_MESSAGES[n].position},t.subtype=t.controller.name||"controller"+n,t.value=d.from7bitToFloat(r),t.rawValue=r;const s=Object.assign({},t);s.type=`${t.type}-controller${n}`,delete s.subtype,this.emit(s.type,s);const l=Object.assign({},t);l.type=`${t.type}-`+a.CONTROL_CHANGE_MESSAGES[n].name,delete l.subtype,l.type.indexOf("controller")!==0&&this.emit(l.type,l),t.message.dataBytes[0]>=120&&this._parseChannelModeMessage(t),this.parameterNumberEventsEnabled&&this._isRpnOrNrpnController(t.message.dataBytes[0])&&this._parseEventForParameterNumber(t)}else t.type==="programchange"?(t.value=n,t.rawValue=t.value):t.type==="channelaftertouch"?(t.value=d.from7bitToFloat(n),t.rawValue=n):t.type==="pitchbend"?(t.value=((r<<7)+n-8192)/8192,t.rawValue=(r<<7)+n):t.type="unknownmessage";this.emit(t.type,t)}_parseChannelModeMessage(e){const t=Object.assign({},e);t.type=t.controller.name,t.type==="localcontrol"&&(t.value=t.message.data[2]===127,t.rawValue=t.message.data[2]),t.type==="omnimodeon"?(t.type="omnimode",t.value=!0,t.rawValue=t.message.data[2]):t.type==="omnimodeoff"&&(t.type="omnimode",t.value=!1,t.rawValue=t.message.data[2]),t.type==="monomodeon"?(t.type="monomode",t.value=!0,t.rawValue=t.message.data[2]):t.type==="polymodeon"&&(t.type="monomode",t.value=!1,t.rawValue=t.message.data[2]),this.emit(t.type,t)}_parseEventForParameterNumber(e){const t=e.message.dataBytes[0],n=e.message.dataBytes[1];t===99||t===101?(this._nrpnBuffer=[],this._rpnBuffer=[],t===99?this._nrpnBuffer=[e.message]:n!==127&&(this._rpnBuffer=[e.message])):t===98||t===100?t===98?(this._rpnBuffer=[],this._nrpnBuffer.length===1?this._nrpnBuffer.push(e.message):this._nrpnBuffer=[]):(this._nrpnBuffer=[],this._rpnBuffer.length===1&&n!==127?this._rpnBuffer.push(e.message):this._rpnBuffer=[]):(t===6||t===38||t===96||t===97)&&(this._rpnBuffer.length===2?this._dispatchParameterNumberEvent("rpn",this._rpnBuffer[0].dataBytes[1],this._rpnBuffer[1].dataBytes[1],e):this._nrpnBuffer.length===2?this._dispatchParameterNumberEvent("nrpn",this._nrpnBuffer[0].dataBytes[1],this._nrpnBuffer[1].dataBytes[1],e):(this._nrpnBuffer=[],this._rpnBuffer=[]))}_isRpnOrNrpnController(e){return e===6||e===38||e===96||e===97||e===98||e===99||e===100||e===101}_dispatchParameterNumberEvent(e,t,n,r){e=e==="nrpn"?"nrpn":"rpn";const s={target:r.target,timestamp:r.timestamp,message:r.message,parameterMsb:t,parameterLsb:n,value:d.from7bitToFloat(r.message.dataBytes[1]),rawValue:r.message.dataBytes[1]};e==="rpn"?s.parameter=Object.keys(a.REGISTERED_PARAMETERS).find(b=>a.REGISTERED_PARAMETERS[b][0]===t&&a.REGISTERED_PARAMETERS[b][1]===n):s.parameter=(t<<7)+n;const l=a.CONTROL_CHANGE_MESSAGES[r.message.dataBytes[0]].name;s.type=`${e}-${l}`,this.emit(s.type,s);const h=Object.assign({},s);h.type==="nrpn-dataincrement"?h.type="nrpn-databuttonincrement":h.type==="nrpn-datadecrement"?h.type="nrpn-databuttondecrement":h.type==="rpn-dataincrement"?h.type="rpn-databuttonincrement":h.type==="rpn-datadecrement"&&(h.type="rpn-databuttondecrement"),this.emit(h.type,h),s.type=e,s.subtype=l,this.emit(s.type,s)}getChannelModeByNumber(e){return c.validation&&(console.warn("The 'getChannelModeByNumber()' method has been moved to the 'Utilities' class."),e=Math.floor(e)),d.getChannelModeByNumber(e)}getCcNameByNumber(e){if(c.validation&&(console.warn("The 'getCcNameByNumber()' method has been moved to the 'Utilities' class."),e=parseInt(e),!(e>=0&&e<=127)))throw new RangeError("Invalid control change number.");return d.getCcNameByNumber(e)}getNoteState(e){e instanceof me&&(e=e.identifier);const t=d.guessNoteNumber(e,c.octaveOffset+this.input.octaveOffset+this.octaveOffset);return this.notesState[t]}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get input(){return this._input}get number(){return this._number}get nrpnEventsEnabled(){return this.parameterNumberEventsEnabled}set nrpnEventsEnabled(e){this.validation&&(e=!!e),this.parameterNumberEventsEnabled=e}}/** * The `Message` class represents a single MIDI message. It has several properties that make it * easy to make sense of the binary data it contains. * * @license Apache-2.0 * @since 3.0.0 - */class qe{constructor(e){this.rawData=e,this.data=Array.from(this.rawData),this.statusByte=this.rawData[0],this.rawDataBytes=this.rawData.slice(1),this.dataBytes=this.data.slice(1),this.isChannelMessage=!1,this.isSystemMessage=!1,this.command=void 0,this.channel=void 0,this.manufacturerId=void 0,this.type=void 0,this.statusByte<240?(this.isChannelMessage=!0,this.command=this.statusByte>>4,this.channel=(this.statusByte&15)+1):(this.isSystemMessage=!0,this.command=this.statusByte),this.isChannelMessage?this.type=c.getPropertyByValue(a.CHANNEL_MESSAGES,this.command):this.isSystemMessage&&(this.type=c.getPropertyByValue(a.SYSTEM_MESSAGES,this.command)),this.statusByte===a.SYSTEM_MESSAGES.sysex&&(this.dataBytes[0]===0?(this.manufacturerId=this.dataBytes.slice(0,3),this.dataBytes=this.dataBytes.slice(3,this.rawDataBytes.length-1),this.rawDataBytes=this.rawDataBytes.slice(3,this.rawDataBytes.length-1)):(this.manufacturerId=[this.dataBytes[0]],this.dataBytes=this.dataBytes.slice(1,this.dataBytes.length-1),this.rawDataBytes=this.rawDataBytes.slice(1,this.rawDataBytes.length-1)))}}/** + */class st{constructor(e){this.rawData=e,this.data=Array.from(this.rawData),this.statusByte=this.rawData[0],this.rawDataBytes=this.rawData.slice(1),this.dataBytes=this.data.slice(1),this.isChannelMessage=!1,this.isSystemMessage=!1,this.command=void 0,this.channel=void 0,this.manufacturerId=void 0,this.type=void 0,this.statusByte<240?(this.isChannelMessage=!0,this.command=this.statusByte>>4,this.channel=(this.statusByte&15)+1):(this.isSystemMessage=!0,this.command=this.statusByte),this.isChannelMessage?this.type=d.getPropertyByValue(a.CHANNEL_MESSAGES,this.command):this.isSystemMessage&&(this.type=d.getPropertyByValue(a.SYSTEM_MESSAGES,this.command)),this.statusByte===a.SYSTEM_MESSAGES.sysex&&(this.dataBytes[0]===0?(this.manufacturerId=this.dataBytes.slice(0,3),this.dataBytes=this.dataBytes.slice(3,this.rawDataBytes.length-1),this.rawDataBytes=this.rawDataBytes.slice(3,this.rawDataBytes.length-1)):(this.manufacturerId=[this.dataBytes[0]],this.dataBytes=this.dataBytes.slice(1,this.dataBytes.length-1),this.rawDataBytes=this.rawDataBytes.slice(1,this.rawDataBytes.length-1)))}}/** * The `Input` class represents a single MIDI input port. This object is automatically instantiated * by the library according to the host's MIDI subsystem and does not need to be directly * instantiated. Instead, you can access all `Input` objects by referring to the @@ -237,7 +237,7 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * * @extends EventEmitter * @license Apache-2.0 - */class et extends J{constructor(e){super(),this._midiInput=e,this._octaveOffset=0,this.channels=[];for(let t=1;t<=16;t++)this.channels[t]=new $e(this,t);this._forwarders=[],this._midiInput.onstatechange=this._onStateChange.bind(this),this._midiInput.onmidimessage=this._onMidiMessage.bind(this)}async destroy(){this.removeListener(),this.channels.forEach(e=>e.destroy()),this.channels=[],this._forwarders=[],this._midiInput&&(this._midiInput.onstatechange=null,this._midiInput.onmidimessage=null),await this.close(),this._midiInput=null}_onStateChange(e){let t={timestamp:o.time,target:this,port:this};e.port.connection==="open"?(t.type="opened",this.emit("opened",t)):e.port.connection==="closed"&&e.port.state==="connected"?(t.type="closed",this.emit("closed",t)):e.port.connection==="closed"&&e.port.state==="disconnected"?(t.type="disconnected",t.port={connection:e.port.connection,id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this.emit("disconnected",t)):e.port.connection==="pending"&&e.port.state==="disconnected"||console.warn("This statechange event was not caught: ",e.port.connection,e.port.state)}_onMidiMessage(e){const t=new qe(e.data),n={port:this,target:this,message:t,timestamp:e.timeStamp,type:"midimessage",data:t.data,rawData:t.data,statusByte:t.data[0],dataBytes:t.dataBytes};this.emit("midimessage",n),t.isSystemMessage?this._parseEvent(n):t.isChannelMessage&&this.channels[t.channel]._processMidiMessageEvent(n),this._forwarders.forEach(r=>r.forward(t))}_parseEvent(e){const t=Object.assign({},e);t.type=t.message.type||"unknownmidimessage",t.type==="songselect"&&(t.song=e.data[1]+1,t.value=e.data[1],t.rawValue=t.value),this.emit(t.type,t)}async open(){try{await this._midiInput.open()}catch(e){return Promise.reject(e)}return Promise.resolve(this)}async close(){if(!this._midiInput)return Promise.resolve(this);try{await this._midiInput.close()}catch(e){return Promise.reject(e)}return Promise.resolve(this)}getChannelModeByNumber(){o.validation&&console.warn("The 'getChannelModeByNumber()' method has been moved to the 'Utilities' class.")}addListener(e,t,n={}){if(o.validation&&typeof n=="function"){let r=t!=null?[].concat(t):void 0;t=n,n={channels:r}}if(a.CHANNEL_EVENTS.includes(e)){n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS);let r=[];return c.sanitizeChannels(n.channels).forEach(s=>{r.push(this.channels[s].addListener(e,t,n))}),r}else return super.addListener(e,t,n)}addOneTimeListener(e,t,n={}){return n.remaining=1,this.addListener(e,t,n)}on(e,t,n,r){return this.addListener(e,t,n,r)}hasListener(e,t,n={}){if(o.validation&&typeof n=="function"){let r=[].concat(t);t=n,n={channels:r}}return a.CHANNEL_EVENTS.includes(e)?(n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS),c.sanitizeChannels(n.channels).every(r=>this.channels[r].hasListener(e,t))):super.hasListener(e,t)}removeListener(e,t,n={}){if(o.validation&&typeof n=="function"){let r=[].concat(t);t=n,n={channels:r}}if(n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS),e==null)return c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r]&&this.channels[r].removeListener()}),super.removeListener();a.CHANNEL_EVENTS.includes(e)?c.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].removeListener(e,t,n)}):super.removeListener(e,t,n)}addForwarder(e,t={}){let n;return e instanceof He?n=e:n=new He(e,t),this._forwarders.push(n),n}removeForwarder(e){this._forwarders=this._forwarders.filter(t=>t!==e)}hasForwarder(e){return this._forwarders.includes(e)}get name(){return this._midiInput.name}get id(){return this._midiInput.id}get connection(){return this._midiInput.connection}get manufacturer(){return this._midiInput.manufacturer}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get state(){return this._midiInput.state}get type(){return this._midiInput.type}get nrpnEventsEnabled(){return o.validation&&console.warn("The 'nrpnEventsEnabled' property has been moved to the 'InputChannel' class."),!1}}/** + */class ut extends Z{constructor(e){super(),this._midiInput=e,this._octaveOffset=0,this.channels=[];for(let t=1;t<=16;t++)this.channels[t]=new ft(this,t);this._forwarders=[],this._midiInput.onstatechange=this._onStateChange.bind(this),this._midiInput.onmidimessage=this._onMidiMessage.bind(this)}async destroy(){this.removeListener(),this.channels.forEach(e=>e.destroy()),this.channels=[],this._forwarders=[],this._midiInput&&(this._midiInput.onstatechange=null,this._midiInput.onmidimessage=null),await this.close(),this._midiInput=null}_onStateChange(e){let t={timestamp:c.time,target:this,port:this};e.port.connection==="open"?(t.type="opened",this.emit("opened",t)):e.port.connection==="closed"&&e.port.state==="connected"?(t.type="closed",this.emit("closed",t)):e.port.connection==="closed"&&e.port.state==="disconnected"?(t.type="disconnected",t.port={connection:e.port.connection,id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this.emit("disconnected",t)):e.port.connection==="pending"&&e.port.state==="disconnected"||console.warn("This statechange event was not caught: ",e.port.connection,e.port.state)}_onMidiMessage(e){const t=new st(e.data),n={port:this,target:this,message:t,timestamp:e.timeStamp,type:"midimessage",data:t.data,rawData:t.data,statusByte:t.data[0],dataBytes:t.dataBytes};this.emit("midimessage",n),t.isSystemMessage?this._parseEvent(n):t.isChannelMessage&&this.channels[t.channel]._processMidiMessageEvent(n),this._forwarders.forEach(r=>r.forward(t))}_parseEvent(e){const t=Object.assign({},e);t.type=t.message.type||"unknownmidimessage",t.type==="songselect"&&(t.song=e.data[1]+1,t.value=e.data[1],t.rawValue=t.value),this.emit(t.type,t)}async open(){try{await this._midiInput.open()}catch(e){return Promise.reject(e)}return Promise.resolve(this)}async close(){if(!this._midiInput)return Promise.resolve(this);try{await this._midiInput.close()}catch(e){return Promise.reject(e)}return Promise.resolve(this)}getChannelModeByNumber(){c.validation&&console.warn("The 'getChannelModeByNumber()' method has been moved to the 'Utilities' class.")}addListener(e,t,n={}){if(c.validation&&typeof n=="function"){let r=t!=null?[].concat(t):void 0;t=n,n={channels:r}}if(a.CHANNEL_EVENTS.includes(e)){n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS);let r=[];return d.sanitizeChannels(n.channels).forEach(s=>{r.push(this.channels[s].addListener(e,t,n))}),r}else return super.addListener(e,t,n)}addOneTimeListener(e,t,n={}){return n.remaining=1,this.addListener(e,t,n)}on(e,t,n,r){return this.addListener(e,t,n,r)}hasListener(e,t,n={}){if(c.validation&&typeof n=="function"){let r=[].concat(t);t=n,n={channels:r}}return a.CHANNEL_EVENTS.includes(e)?(n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS),d.sanitizeChannels(n.channels).every(r=>this.channels[r].hasListener(e,t))):super.hasListener(e,t)}removeListener(e,t,n={}){if(c.validation&&typeof n=="function"){let r=[].concat(t);t=n,n={channels:r}}if(n.channels===void 0&&(n.channels=a.MIDI_CHANNEL_NUMBERS),e==null)return d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r]&&this.channels[r].removeListener()}),super.removeListener();a.CHANNEL_EVENTS.includes(e)?d.sanitizeChannels(n.channels).forEach(r=>{this.channels[r].removeListener(e,t,n)}):super.removeListener(e,t,n)}addForwarder(e,t={}){let n;return e instanceof Qe?n=e:n=new Qe(e,t),this._forwarders.push(n),n}removeForwarder(e){this._forwarders=this._forwarders.filter(t=>t!==e)}hasForwarder(e){return this._forwarders.includes(e)}get name(){return this._midiInput.name}get id(){return this._midiInput.id}get connection(){return this._midiInput.connection}get manufacturer(){return this._midiInput.manufacturer}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get state(){return this._midiInput.state}get type(){return this._midiInput.type}get nrpnEventsEnabled(){return c.validation&&console.warn("The 'nrpnEventsEnabled' property has been moved to the 'InputChannel' class."),!1}}/** * The `WebMidi` object makes it easier to work with the low-level Web MIDI API. Basically, it * simplifies sending outgoing MIDI messages and reacting to incoming MIDI messages. * @@ -256,10 +256,10 @@ var Ke=Object.defineProperty;var Je=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,config * * @extends EventEmitter * @license Apache-2.0 - */class tt extends J{constructor(){super(),this.defaults={note:{attack:c.from7bitToFloat(64),release:c.from7bitToFloat(64),duration:1/0}},this.interface=null,this.validation=!0,this._inputs=[],this._disconnectedInputs=[],this._outputs=[],this._disconnectedOutputs=[],this._stateChangeQueue=[],this._octaveOffset=0}async enable(e={},t=!1){if(c.isNode){try{window.navigator}catch{let h=await Object.getPrototypeOf(async function(){}).constructor(` + */class mt extends Z{constructor(){super(),this.defaults={note:{attack:d.from7bitToFloat(64),release:d.from7bitToFloat(64),duration:1/0}},this.interface=null,this.validation=!0,this._inputs=[],this._disconnectedInputs=[],this._outputs=[],this._disconnectedOutputs=[],this._stateChangeQueue=[],this._octaveOffset=0}async enable(e={},t=!1){if(d.isNode){try{window.navigator}catch{let h=await Object.getPrototypeOf(async function(){}).constructor(` let jzz = await import("jzz"); return jzz.default; `)();global.navigator||(global.navigator={}),Object.assign(global.navigator,h)}try{}catch{global.performance=await Object.getPrototypeOf(async function(){}).constructor(` let perf_hooks = await import("perf_hooks"); return perf_hooks.performance; - `)()}}if(this.validation=e.validation!==!1,this.validation&&(typeof e=="function"&&(e={callback:e,sysex:t}),t&&(e.sysex=!0)),this.enabled)return typeof e.callback=="function"&&e.callback(),Promise.resolve();const n={timestamp:this.time,target:this,type:"error",error:void 0},r={timestamp:this.time,target:this,type:"midiaccessgranted"},s={timestamp:this.time,target:this,type:"enabled"};try{typeof e.requestMIDIAccessFunction=="function"?this.interface=await e.requestMIDIAccessFunction({sysex:e.sysex,software:e.software}):this.interface=await navigator.requestMIDIAccess({sysex:e.sysex,software:e.software})}catch(l){return n.error=l,this.emit("error",n),typeof e.callback=="function"&&e.callback(l),Promise.reject(l)}this.emit("midiaccessgranted",r),this.interface.onstatechange=this._onInterfaceStateChange.bind(this);try{await this._updateInputsAndOutputs()}catch(l){return n.error=l,this.emit("error",n),typeof e.callback=="function"&&e.callback(l),Promise.reject(l)}return this.emit("enabled",s),typeof e.callback=="function"&&e.callback(),Promise.resolve(this)}async disable(){return this.interface&&(this.interface.onstatechange=void 0),this._destroyInputsAndOutputs().then(()=>{navigator&&typeof navigator.close=="function"&&navigator.close(),this.interface=null;let e={timestamp:this.time,target:this,type:"disabled"};this.emit("disabled",e),this.removeListener()})}getInputById(e,t={disconnected:!1}){if(this.validation){if(!this.enabled)throw new Error("WebMidi is not enabled.");if(!e)return}if(t.disconnected){for(let n=0;n=0&&e<=127?c.getNoteDetails(c.offsetNumber(e,this.octaveOffset)).octave:!1}sanitizeChannels(e){return this.validation&&console.warn("The sanitizeChannels() method has been moved to the utilities class."),c.sanitizeChannels(e)}toMIDIChannels(e){return this.validation&&console.warn("The toMIDIChannels() method has been deprecated. Use Utilities.sanitizeChannels() instead."),c.sanitizeChannels(e)}guessNoteNumber(e){return this.validation&&console.warn("The guessNoteNumber() method has been deprecated. Use Utilities.guessNoteNumber() instead."),c.guessNoteNumber(e,this.octaveOffset)}getValidNoteArray(e,t={}){return this.validation&&console.warn("The getValidNoteArray() method has been moved to the Utilities.buildNoteArray()"),c.buildNoteArray(e,t)}convertToTimestamp(e){return this.validation&&console.warn("The convertToTimestamp() method has been moved to Utilities.toTimestamp()."),c.toTimestamp(e)}async _destroyInputsAndOutputs(){let e=[];return this.inputs.forEach(t=>e.push(t.destroy())),this.outputs.forEach(t=>e.push(t.destroy())),Promise.all(e).then(()=>{this._inputs=[],this._outputs=[]})}_onInterfaceStateChange(e){this._updateInputsAndOutputs();let t={timestamp:e.timeStamp,type:e.port.state,target:this};if(e.port.state==="connected"&&e.port.connection==="open"){e.port.type==="output"?t.port=this.getOutputById(e.port.id):e.port.type==="input"&&(t.port=this.getInputById(e.port.id)),this.emit(e.port.state,t);const n=Object.assign({},t);n.type="portschanged",this.emit(n.type,n)}else if(e.port.state==="disconnected"&&e.port.connection==="pending"){e.port.type==="input"?t.port=this.getInputById(e.port.id,{disconnected:!0}):e.port.type==="output"&&(t.port=this.getOutputById(e.port.id,{disconnected:!0})),this.emit(e.port.state,t);const n=Object.assign({},t);n.type="portschanged",this.emit(n.type,n)}}async _updateInputsAndOutputs(){return Promise.all([this._updateInputs(),this._updateOutputs()])}async _updateInputs(){if(!this.interface)return;for(let t=this._inputs.length-1;t>=0;t--){const n=this._inputs[t];Array.from(this.interface.inputs.values()).find(s=>s===n._midiInput)||(this._disconnectedInputs.push(n),this._inputs.splice(t,1))}let e=[];return this.interface.inputs.forEach(t=>{if(!this._inputs.find(n=>n._midiInput===t)){let n=this._disconnectedInputs.find(r=>r._midiInput===t);n||(n=new et(t)),this._inputs.push(n),e.push(n.open())}}),Promise.all(e)}async _updateOutputs(){if(!this.interface)return;for(let t=this._outputs.length-1;t>=0;t--){const n=this._outputs[t];Array.from(this.interface.outputs.values()).find(s=>s===n._midiOutput)||(this._disconnectedOutputs.push(n),this._outputs.splice(t,1))}let e=[];return this.interface.outputs.forEach(t=>{if(!this._outputs.find(n=>n._midiOutput===t)){let n=this._disconnectedOutputs.find(r=>r._midiOutput===t);n||(n=new Se(t)),this._outputs.push(n),e.push(n.open())}}),Promise.all(e)}get enabled(){return this.interface!==null}get inputs(){return this._inputs}get isNode(){return this.validation&&console.warn("WebMidi.isNode has been deprecated. Use Utilities.isNode instead."),c.isNode}get isBrowser(){return this.validation&&console.warn("WebMidi.isBrowser has been deprecated. Use Utilities.isBrowser instead."),c.isBrowser}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get outputs(){return this._outputs}get supported(){return typeof navigator<"u"&&navigator.requestMIDIAccess}get sysexEnabled(){return!!(this.interface&&this.interface.sysexEnabled)}get time(){return performance.now()}get version(){return"3.1.8"}get flavour(){return"esm"}get CHANNEL_EVENTS(){return this.validation&&console.warn("The CHANNEL_EVENTS enum has been moved to Enumerations.CHANNEL_EVENTS."),a.CHANNEL_EVENTS}get MIDI_SYSTEM_MESSAGES(){return this.validation&&console.warn("The MIDI_SYSTEM_MESSAGES enum has been moved to Enumerations.SYSTEM_MESSAGES."),a.SYSTEM_MESSAGES}get MIDI_CHANNEL_MODE_MESSAGES(){return this.validation&&console.warn("The MIDI_CHANNEL_MODE_MESSAGES enum has been moved to Enumerations.CHANNEL_MODE_MESSAGES."),a.CHANNEL_MODE_MESSAGES}get MIDI_CONTROL_CHANGE_MESSAGES(){return this.validation&&console.warn("The MIDI_CONTROL_CHANGE_MESSAGES enum has been replaced by the Enumerations.CONTROL_CHANGE_MESSAGES array."),a.MIDI_CONTROL_CHANGE_MESSAGES}get MIDI_REGISTERED_PARAMETER(){return this.validation&&console.warn("The MIDI_REGISTERED_PARAMETER enum has been moved to Enumerations.REGISTERED_PARAMETERS."),a.REGISTERED_PARAMETERS}get NOTES(){return this.validation&&console.warn("The NOTES enum has been deprecated."),["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]}}const o=new tt;o.constructor=null;function nt(i,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(i)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function rt(i,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(i)),{data:void 0}}catch(n){return{err:`Failed to store the value: ${n}`,code:400}}}function st(i,e){const{key:t,storage:n="local"}=e,r=nt(t,n);return"data"in r&&r.data?i.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err),i.subscribe(s=>{const l=rt(e.serialize?e.serialize(s):s,t,n);"err"in l&&(e!=null&&e.debug)&&console.error(l.err)}),i}const pe=Ce(void 0),Te=st(Ce([60,84]),{key:"midi-range",storage:"session"}),Re={async openMidi(){return o.enable().then(()=>o.inputs.length>0?(pe.set(o.inputs[0]),{data:o.inputs[0]}):{err:"No MIDI device found.",code:400}).catch(i=>({err:i.toString(),code:403}))},setMidiRange(i){Te.set(i)}},We={0:{note:"C",steps:0,sharp:!1,flat:!1},1:{note:"C♯",steps:0,sharp:!0,flat:!1},2:{note:"D",steps:1,sharp:!1,flat:!1},3:{note:"E♭",steps:2,sharp:!1,flat:!0},4:{note:"E",steps:2,sharp:!1,flat:!1},5:{note:"F",steps:3,sharp:!1,flat:!1},6:{note:"F♯",steps:3,sharp:!0,flat:!1},7:{note:"G",steps:4,sharp:!1,flat:!1},8:{note:"G♯",steps:4,sharp:!0,flat:!1},9:{note:"A",steps:5,sharp:!1,flat:!1},10:{note:"B♭",steps:6,sharp:!1,flat:!0},11:{note:"B",steps:6,sharp:!1,flat:!1}};function ee(i){const e=i-12,t=Math.floor(e/12),n=We[e%12];return{...n,octave:t,absolute:`${n.note}${t}`}}function it(i){if(i.length===2||i.length===3){const e=i.slice(0,i.length-1).toUpperCase();let t;try{t=parseInt(i[i.length-1])}catch{return{err:`Couldn't parse note "${i}" octave`,code:400}}const n=Object.values(We).findIndex(r=>r.note===e);return n===-1?{err:`Note "${i}" not found in scale`,code:400}:{data:12+t*12+n}}else return{err:`Unrecognized note "${i}"`,code:400}}function Ve(i){let e,t;return{c(){e=f("div"),t=W(i[2]),this.h()},l(n){e=m(n,"DIV",{class:!0});var r=I(e);t=K(r,i[2]),r.forEach(E),this.h()},h(){p(e,"class","error svelte-5m5dii")},m(n,r){L(n,e,r),d(e,t)},p(n,r){r&4&&ue(t,n[2])},d(n){n&&E(e)}}}function at(i){let e,t,n,r="MIDI",s,l,h,_,y="Device",A,S,u,b,v,N,g="Prompt",w,R,O,F="Range",k,H,x,te,P,fe="—",ne,D,ie,z,V,q,ae="Use MIDI",j,Q,re=`
`,Y,X,M,U=i[2]&&Ve(i);return{c(){e=f("div"),t=f("fieldset"),n=f("legend"),n.textContent=r,s=C(),l=f("div"),h=f("div"),_=f("label"),_.textContent=y,A=C(),S=f("input"),b=C(),v=f("div"),N=f("button"),N.textContent=g,w=C(),R=f("div"),O=f("label"),O.textContent=F,k=C(),H=f("div"),x=f("input"),te=C(),P=f("span"),P.textContent=fe,ne=C(),D=f("input"),ie=C(),z=f("div"),U&&U.c(),V=C(),q=f("button"),q.textContent=ae,j=C(),Q=f("div"),Q.innerHTML=re,this.h()},l(B){e=m(B,"DIV",{class:!0});var Z=I(e);t=m(Z,"FIELDSET",{class:!0});var se=I(t);n=m(se,"LEGEND",{class:!0,"data-svelte-h":!0}),G(n)!=="svelte-dnpakp"&&(n.textContent=r),s=T(se),l=m(se,"DIV",{class:!0});var le=I(l);h=m(le,"DIV",{class:!0});var oe=I(h);_=m(oe,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),G(_)!=="svelte-crpa7y"&&(_.textContent=y),A=T(oe),S=m(oe,"INPUT",{class:!0,id:!0}),b=T(oe),v=m(oe,"DIV",{});var Oe=I(v);N=m(Oe,"BUTTON",{class:!0,"data-svelte-h":!0}),G(N)!=="svelte-r53s7o"&&(N.textContent=g),Oe.forEach(E),oe.forEach(E),w=T(le),R=m(le,"DIV",{class:!0});var ce=I(R);O=m(ce,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),G(O)!=="svelte-10u0679"&&(O.textContent=F),k=T(ce),H=m(ce,"DIV",{class:!0});var de=I(H);x=m(de,"INPUT",{class:!0,id:!0}),te=T(de),P=m(de,"SPAN",{class:!0,"data-svelte-h":!0}),G(P)!=="svelte-91k20l"&&(P.textContent=fe),ne=T(de),D=m(de,"INPUT",{class:!0,id:!0}),de.forEach(E),ie=T(ce),z=m(ce,"DIV",{});var Ee=I(z);U&&U.l(Ee),V=T(Ee),q=m(Ee,"BUTTON",{class:!0,"data-svelte-h":!0}),G(q)!=="svelte-1elgafa"&&(q.textContent=ae),Ee.forEach(E),ce.forEach(E),j=T(le),Q=m(le,"DIV",{class:!0,"data-svelte-h":!0}),G(Q)!=="svelte-1po95sj"&&(Q.innerHTML=re),le.forEach(E),se.forEach(E),Z.forEach(E),this.h()},h(){var B;p(n,"class","px-2 text-0A text-base"),p(_,"class","font-bold"),p(_,"for","device"),p(S,"class","my-1 w-50"),p(S,"id","device"),S.disabled=!0,S.value=u=((B=i[3])==null?void 0:B.name)??"No device",p(N,"class","btn primary"),p(h,"class","flex flex-col"),p(O,"class","font-bold"),p(O,"for","range_min"),p(x,"class","w-full"),p(x,"id","range_min"),p(P,"class","mx-4"),p(D,"class","w-full"),p(D,"id","range_max"),p(H,"class","my-1 flex w-full"),p(q,"class","btn primary"),p(R,"class","flex flex-col"),p(Q,"class","flex flex-col h-full"),p(l,"class","midi-body svelte-5m5dii"),p(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm"),p(e,"class",Y=_e(`${i[5].class||""}`)+" svelte-5m5dii")},m(B,Z){L(B,e,Z),d(e,t),d(t,n),d(t,s),d(t,l),d(l,h),d(h,_),d(h,A),d(h,S),d(h,b),d(h,v),d(v,N),d(l,w),d(l,R),d(R,O),d(R,k),d(R,H),d(H,x),be(x,i[0]),d(H,te),d(H,P),d(H,ne),d(H,D),be(D,i[1]),d(R,ie),d(R,z),U&&U.m(z,null),d(z,V),d(z,q),d(l,j),d(l,Q),X||(M=[$(N,"click",Re.openMidi),$(x,"input",i[6]),$(x,"change",i[7]),$(D,"input",i[8]),$(D,"change",i[9]),$(q,"click",lt)],X=!0)},p(B,[Z]){var se;Z&8&&u!==(u=((se=B[3])==null?void 0:se.name)??"No device")&&S.value!==u&&(S.value=u),Z&1&&x.value!==B[0]&&be(x,B[0]),Z&2&&D.value!==B[1]&&be(D,B[1]),B[2]?U?U.p(B,Z):(U=Ve(B),U.c(),U.m(z,V)):U&&(U.d(1),U=null),Z&32&&Y!==(Y=_e(`${B[5].class||""}`)+" svelte-5m5dii")&&p(e,"class",Y)},i:me,o:me,d(B){B&&E(e),U&&U.d(),X=!1,Ye(M)}}}function lt(){}function ot(i,e,t){let n,r;ve(i,Te,b=>t(10,n=b)),ve(i,pe,b=>t(3,r=b));let s=ee(n[0]).absolute,l=ee(n[1]).absolute,h="";function _(b,v){const N=it(v.currentTarget.value);if("data"in N){const g=n,w=[b==="min"?N.data:g[0],b==="max"?N.data:g[1]];Re.setMidiRange(w),t(2,h="")}else t(2,h=N.err),b==="min"?t(0,s=ee(n[0]).absolute):t(1,l=ee(n[1]).absolute)}function y(){s=this.value,t(0,s)}const A=b=>_("min",b);function S(){l=this.value,t(1,l)}const u=b=>_("max",b);return i.$$set=b=>{t(5,e=Ne(Ne({},e),ye(b)))},e=ye(e),[s,l,h,r,_,e,y,A,S,u]}class ct extends Ie{constructor(e){super(),Ae(this,e,ot,at,Me,{})}}function dt(i){let e,t,n,r,s,l,h,_,y,A,S,u,b,v,N,g,w,R,O,F,k,H,x,te,P,fe="𝄞",ne,D,ie="𝄢",z,V,q='
',ae,j,Q='
',re;return{c(){e=f("section"),t=f("div"),n=f("div"),r=C(),s=f("div"),l=C(),h=f("div"),_=C(),y=f("div"),A=C(),S=f("div"),u=C(),b=f("div"),v=C(),N=f("div"),g=C(),w=f("div"),R=C(),O=f("div"),F=C(),k=f("div"),H=C(),x=f("div"),te=C(),P=f("span"),P.textContent=fe,ne=C(),D=f("span"),D.textContent=ie,z=C(),V=f("div"),V.innerHTML=q,ae=C(),j=f("div"),j.innerHTML=Q,this.h()},l(Y){e=m(Y,"SECTION",{class:!0});var X=I(e);t=m(X,"DIV",{class:!0});var M=I(t);n=m(M,"DIV",{class:!0}),I(n).forEach(E),r=T(M),s=m(M,"DIV",{class:!0}),I(s).forEach(E),l=T(M),h=m(M,"DIV",{class:!0}),I(h).forEach(E),_=T(M),y=m(M,"DIV",{class:!0}),I(y).forEach(E),A=T(M),S=m(M,"DIV",{class:!0}),I(S).forEach(E),u=T(M),b=m(M,"DIV",{class:!0}),I(b).forEach(E),v=T(M),N=m(M,"DIV",{class:!0}),I(N).forEach(E),g=T(M),w=m(M,"DIV",{class:!0}),I(w).forEach(E),R=T(M),O=m(M,"DIV",{class:!0}),I(O).forEach(E),F=T(M),k=m(M,"DIV",{class:!0}),I(k).forEach(E),H=T(M),x=m(M,"DIV",{class:!0}),I(x).forEach(E),te=T(M),P=m(M,"SPAN",{class:!0,"data-svelte-h":!0}),G(P)!=="svelte-19670ev"&&(P.textContent=fe),ne=T(M),D=m(M,"SPAN",{class:!0,"data-svelte-h":!0}),G(D)!=="svelte-119te60"&&(D.textContent=ie),z=T(M),V=m(M,"DIV",{class:!0,"data-svelte-h":!0}),G(V)!=="svelte-1avvn9p"&&(V.innerHTML=q),ae=T(M),j=m(M,"DIV",{class:!0,"data-svelte-h":!0}),G(j)!=="svelte-1rv4bt9"&&(j.innerHTML=Q),M.forEach(E),X.forEach(E),this.h()},h(){p(n,"class","line svelte-115d3uv"),p(s,"class","line svelte-115d3uv"),p(h,"class","line svelte-115d3uv"),p(y,"class","line svelte-115d3uv"),p(S,"class","line svelte-115d3uv"),p(b,"class","line invisible svelte-115d3uv"),p(N,"class","line svelte-115d3uv"),p(w,"class","line svelte-115d3uv"),p(O,"class","line svelte-115d3uv"),p(k,"class","line svelte-115d3uv"),p(x,"class","line svelte-115d3uv"),p(P,"class","g-clef svelte-115d3uv"),p(D,"class","f-clef svelte-115d3uv"),p(V,"class","note target svelte-115d3uv"),p(j,"class","note played svelte-115d3uv"),p(t,"class","staff svelte-115d3uv"),p(e,"class",re=_e(`${i[2].class||""} score pt-12 pb-8`)+" svelte-115d3uv")},m(Y,X){L(Y,e,X),d(e,t),d(t,n),d(t,r),d(t,s),d(t,l),d(t,h),d(t,_),d(t,y),d(t,A),d(t,S),d(t,u),d(t,b),d(t,v),d(t,N),d(t,g),d(t,w),d(t,R),d(t,O),d(t,F),d(t,k),d(t,H),d(t,x),d(t,te),d(t,P),d(t,ne),d(t,D),d(t,z),d(t,V),i[5](V),d(t,ae),d(t,j),i[6](j)},p(Y,[X]){X&4&&re!==(re=_e(`${Y[2].class||""} score pt-12 pb-8`)+" svelte-115d3uv")&&p(e,"class",re)},i:me,o:me,d(Y){Y&&E(e),i[5](null),i[6](null)}}}function Fe(i,e,t){e?(i.style.display="block",i.style.bottom=ht(e)+"rem",i.firstChild&&(i.firstChild.textContent=`${e.flat?"♭":e.sharp?"♯":""}𝅝`),t!==void 0&&t?(i.classList.remove("wrong"),i.classList.add("correct")):t!==void 0&&(i.classList.remove("correct"),i.classList.add("wrong")),(e.value===60||e.value===61)&&i.lastChild instanceof HTMLElement||e.value===81&&i.lastChild instanceof HTMLElement?(i.lastChild.style.display="block",e.flat||e.sharp?i.lastChild.style.left="1.18rem":i.lastChild.style.left=""):i.lastChild instanceof HTMLElement&&(i.lastChild.style.display="none")):i.style.display="none"}function ht(i){const e=.42272727272,n=(i.octave-4)*7+i.steps;return 2.85+e*n}function ut(i,e,t){let{target:n=void 0,played:r=void 0}=e,s,l;function h(y){De[y?"unshift":"push"](()=>{l=y,t(1,l)})}function _(y){De[y?"unshift":"push"](()=>{s=y,t(0,s)})}return i.$$set=y=>{t(2,e=Ne(Ne({},e),ye(y))),"target"in y&&t(3,n=y.target),"played"in y&&t(4,r=y.played)},i.$$.update=()=>{i.$$.dirty&10&&l&&Fe(l,n),i.$$.dirty&17&&s&&Fe(s,r,r==null?void 0:r.correct)},e=ye(e),[s,l,e,n,r,h,_]}class ft extends Ie{constructor(e){super(),Ae(this,e,ut,dt,Me,{target:3,played:4})}}class mt{constructor(e){ge(this,"notes");ge(this,"correct",0);ge(this,"idx",0);this.notes=e}get current(){return this.notes[this.idx]}get ended(){return this.notes.length===this.idx+1}guess(e){const t=this.current===e;return t&&(this.correct+=1),this.idx+=1,t}}const we=Ce(void 0),ze={playGuessNotes(i=10){const e=[],t=Qe(Te);console.log("range",t);for(let r=0;rt(3,n=u));let r,s,l,h;Xe(()=>{y()}),pe.subscribe(u=>{u&&u.channels[1].addListener("noteon",_)});function _(u){if(l)return;console.log("noteon",u);const v=u.rawData[1];if(!n)t(1,s={...ee(v),value:v,correct:!1});else{t(0,r={...ee(n.current),value:n.current});const N=n.guess(v);t(2,h=N?"correct":"wrong"),t(1,s={...ee(v),value:v,correct:N}),l=setTimeout(()=>{n!=null&&n.ended?(t(0,r=void 0),t(2,h="ended")):n&&(t(0,r={...ee(n.current),value:n.current}),t(2,h="waiting")),t(1,s=void 0),l=void 0},2e3)}}async function y(){const u=await Re.openMidi();"data"in u?u.data.name:u.err}function A(){t(2,h="waiting");const u=ze.playGuessNotes(),b=ee(u.current);t(0,r={...b,value:u.current})}function S(){t(2,h="waiting"),ze.clearGame()}return[r,s,h,n,A,S]}class It extends Ie{constructor(e){super(),Ae(this,e,yt,Nt,Me,{})}}export{It as component}; + `)()}}if(this.validation=e.validation!==!1,this.validation&&(typeof e=="function"&&(e={callback:e,sysex:t}),t&&(e.sysex=!0)),this.enabled)return typeof e.callback=="function"&&e.callback(),Promise.resolve();const n={timestamp:this.time,target:this,type:"error",error:void 0},r={timestamp:this.time,target:this,type:"midiaccessgranted"},s={timestamp:this.time,target:this,type:"enabled"};try{typeof e.requestMIDIAccessFunction=="function"?this.interface=await e.requestMIDIAccessFunction({sysex:e.sysex,software:e.software}):this.interface=await navigator.requestMIDIAccess({sysex:e.sysex,software:e.software})}catch(l){return n.error=l,this.emit("error",n),typeof e.callback=="function"&&e.callback(l),Promise.reject(l)}this.emit("midiaccessgranted",r),this.interface.onstatechange=this._onInterfaceStateChange.bind(this);try{await this._updateInputsAndOutputs()}catch(l){return n.error=l,this.emit("error",n),typeof e.callback=="function"&&e.callback(l),Promise.reject(l)}return this.emit("enabled",s),typeof e.callback=="function"&&e.callback(),Promise.resolve(this)}async disable(){return this.interface&&(this.interface.onstatechange=void 0),this._destroyInputsAndOutputs().then(()=>{navigator&&typeof navigator.close=="function"&&navigator.close(),this.interface=null;let e={timestamp:this.time,target:this,type:"disabled"};this.emit("disabled",e),this.removeListener()})}getInputById(e,t={disconnected:!1}){if(this.validation){if(!this.enabled)throw new Error("WebMidi is not enabled.");if(!e)return}if(t.disconnected){for(let n=0;n=0&&e<=127?d.getNoteDetails(d.offsetNumber(e,this.octaveOffset)).octave:!1}sanitizeChannels(e){return this.validation&&console.warn("The sanitizeChannels() method has been moved to the utilities class."),d.sanitizeChannels(e)}toMIDIChannels(e){return this.validation&&console.warn("The toMIDIChannels() method has been deprecated. Use Utilities.sanitizeChannels() instead."),d.sanitizeChannels(e)}guessNoteNumber(e){return this.validation&&console.warn("The guessNoteNumber() method has been deprecated. Use Utilities.guessNoteNumber() instead."),d.guessNoteNumber(e,this.octaveOffset)}getValidNoteArray(e,t={}){return this.validation&&console.warn("The getValidNoteArray() method has been moved to the Utilities.buildNoteArray()"),d.buildNoteArray(e,t)}convertToTimestamp(e){return this.validation&&console.warn("The convertToTimestamp() method has been moved to Utilities.toTimestamp()."),d.toTimestamp(e)}async _destroyInputsAndOutputs(){let e=[];return this.inputs.forEach(t=>e.push(t.destroy())),this.outputs.forEach(t=>e.push(t.destroy())),Promise.all(e).then(()=>{this._inputs=[],this._outputs=[]})}_onInterfaceStateChange(e){this._updateInputsAndOutputs();let t={timestamp:e.timeStamp,type:e.port.state,target:this};if(e.port.state==="connected"&&e.port.connection==="open"){e.port.type==="output"?t.port=this.getOutputById(e.port.id):e.port.type==="input"&&(t.port=this.getInputById(e.port.id)),this.emit(e.port.state,t);const n=Object.assign({},t);n.type="portschanged",this.emit(n.type,n)}else if(e.port.state==="disconnected"&&e.port.connection==="pending"){e.port.type==="input"?t.port=this.getInputById(e.port.id,{disconnected:!0}):e.port.type==="output"&&(t.port=this.getOutputById(e.port.id,{disconnected:!0})),this.emit(e.port.state,t);const n=Object.assign({},t);n.type="portschanged",this.emit(n.type,n)}}async _updateInputsAndOutputs(){return Promise.all([this._updateInputs(),this._updateOutputs()])}async _updateInputs(){if(!this.interface)return;for(let t=this._inputs.length-1;t>=0;t--){const n=this._inputs[t];Array.from(this.interface.inputs.values()).find(s=>s===n._midiInput)||(this._disconnectedInputs.push(n),this._inputs.splice(t,1))}let e=[];return this.interface.inputs.forEach(t=>{if(!this._inputs.find(n=>n._midiInput===t)){let n=this._disconnectedInputs.find(r=>r._midiInput===t);n||(n=new ut(t)),this._inputs.push(n),e.push(n.open())}}),Promise.all(e)}async _updateOutputs(){if(!this.interface)return;for(let t=this._outputs.length-1;t>=0;t--){const n=this._outputs[t];Array.from(this.interface.outputs.values()).find(s=>s===n._midiOutput)||(this._disconnectedOutputs.push(n),this._outputs.splice(t,1))}let e=[];return this.interface.outputs.forEach(t=>{if(!this._outputs.find(n=>n._midiOutput===t)){let n=this._disconnectedOutputs.find(r=>r._midiOutput===t);n||(n=new Oe(t)),this._outputs.push(n),e.push(n.open())}}),Promise.all(e)}get enabled(){return this.interface!==null}get inputs(){return this._inputs}get isNode(){return this.validation&&console.warn("WebMidi.isNode has been deprecated. Use Utilities.isNode instead."),d.isNode}get isBrowser(){return this.validation&&console.warn("WebMidi.isBrowser has been deprecated. Use Utilities.isBrowser instead."),d.isBrowser}get octaveOffset(){return this._octaveOffset}set octaveOffset(e){if(this.validation&&(e=parseInt(e),isNaN(e)))throw new TypeError("The 'octaveOffset' property must be an integer.");this._octaveOffset=e}get outputs(){return this._outputs}get supported(){return typeof navigator<"u"&&navigator.requestMIDIAccess}get sysexEnabled(){return!!(this.interface&&this.interface.sysexEnabled)}get time(){return performance.now()}get version(){return"3.1.8"}get flavour(){return"esm"}get CHANNEL_EVENTS(){return this.validation&&console.warn("The CHANNEL_EVENTS enum has been moved to Enumerations.CHANNEL_EVENTS."),a.CHANNEL_EVENTS}get MIDI_SYSTEM_MESSAGES(){return this.validation&&console.warn("The MIDI_SYSTEM_MESSAGES enum has been moved to Enumerations.SYSTEM_MESSAGES."),a.SYSTEM_MESSAGES}get MIDI_CHANNEL_MODE_MESSAGES(){return this.validation&&console.warn("The MIDI_CHANNEL_MODE_MESSAGES enum has been moved to Enumerations.CHANNEL_MODE_MESSAGES."),a.CHANNEL_MODE_MESSAGES}get MIDI_CONTROL_CHANGE_MESSAGES(){return this.validation&&console.warn("The MIDI_CONTROL_CHANGE_MESSAGES enum has been replaced by the Enumerations.CONTROL_CHANGE_MESSAGES array."),a.MIDI_CONTROL_CHANGE_MESSAGES}get MIDI_REGISTERED_PARAMETER(){return this.validation&&console.warn("The MIDI_REGISTERED_PARAMETER enum has been moved to Enumerations.REGISTERED_PARAMETERS."),a.REGISTERED_PARAMETERS}get NOTES(){return this.validation&&console.warn("The NOTES enum has been deprecated."),["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]}}const c=new mt;c.constructor=null;function pt(i,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(i)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function Et(i,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(i)),{data:void 0}}catch(n){return{err:`Failed to store the value: ${n}`,code:400}}}function gt(i,e){const{key:t,storage:n="local"}=e,r=pt(t,n);return"data"in r&&r.data?i.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err),i.subscribe(s=>{const l=Et(e.serialize?e.serialize(s):s,t,n);"err"in l&&(e!=null&&e.debug)&&console.error(l.err)}),i}const be=Ae(void 0),xe=gt(Ae([60,84]),{key:"midi-range",storage:"session"}),Pe=Ae(!1),Ce={async openMidi(){return c.enable().then(()=>c.inputs.length>0?(be.set(c.inputs[0]),{data:c.inputs[0]}):{err:"No MIDI device found.",code:400}).catch(i=>({err:i.toString(),code:403}))},setMidiRange(i){xe.set(i)},setUseKeyboard(i){Pe.set(i)}},it={0:{note:"C",steps:0,sharp:!1,flat:!1},1:{note:"C♯",steps:0,sharp:!0,flat:!1},2:{note:"D",steps:1,sharp:!1,flat:!1},3:{note:"E♭",steps:2,sharp:!1,flat:!0},4:{note:"E",steps:2,sharp:!1,flat:!1},5:{note:"F",steps:3,sharp:!1,flat:!1},6:{note:"F♯",steps:3,sharp:!0,flat:!1},7:{note:"G",steps:4,sharp:!1,flat:!1},8:{note:"G♯",steps:4,sharp:!0,flat:!1},9:{note:"A",steps:5,sharp:!1,flat:!1},10:{note:"B♭",steps:6,sharp:!1,flat:!0},11:{note:"B",steps:6,sharp:!1,flat:!1}};function te(i){const e=i-12,t=Math.floor(e/12),n=it[e%12];return{...n,octave:t,absolute:`${n.note}${t}`}}function at(i){if(i.length===2||i.length===3){const e=i.slice(0,i.length-1).toUpperCase();let t;try{t=parseInt(i[i.length-1])}catch{return{err:`Couldn't parse note "${i}" octave`,code:400}}const n=Object.values(it).findIndex(r=>r.note===e);return n===-1?{err:`Note "${i}" not found in scale`,code:400}:{data:12+t*12+n}}else return{err:`Unrecognized note "${i}"`,code:400}}function Xe(i){let e,t;return{c(){e=u("div"),t=j(i[2]),this.h()},l(n){e=m(n,"DIV",{class:!0});var r=C(e);t=Y(r,i[2]),r.forEach(p),this.h()},h(){f(e,"class","error svelte-haigqy")},m(n,r){P(n,e,r),o(e,t)},p(n,r){r&4&&le(t,n[2])},d(n){n&&p(e)}}}function bt(i){let e,t,n,r="MIDI",s,l,h,b,_="Device",A,S,T,D,B,g,y="Prompt",M,v,N,E="Range",I,L,G,re,V,pe="—",se,x,oe,q,z,W,ce="Use MIDI",K,$,ie=`
`,J,F,w,Ge="Keyboard",Te,de,ee,_e,Re,ke,k=i[2]&&Xe(i);return{c(){e=u("div"),t=u("fieldset"),n=u("legend"),n.textContent=r,s=R(),l=u("div"),h=u("div"),b=u("label"),b.textContent=_,A=R(),S=u("input"),D=R(),B=u("div"),g=u("button"),g.textContent=y,M=R(),v=u("div"),N=u("label"),N.textContent=E,I=R(),L=u("div"),G=u("input"),re=R(),V=u("span"),V.textContent=pe,se=R(),x=u("input"),oe=R(),q=u("div"),k&&k.c(),z=R(),W=u("button"),W.textContent=ce,K=R(),$=u("div"),$.innerHTML=ie,J=R(),F=u("div"),w=u("label"),w.textContent=Ge,Te=R(),de=u("div"),ee=u("input"),this.h()},l(U){e=m(U,"DIV",{class:!0});var Q=C(e);t=m(Q,"FIELDSET",{class:!0});var ae=C(t);n=m(ae,"LEGEND",{class:!0,"data-svelte-h":!0}),H(n)!=="svelte-dnpakp"&&(n.textContent=r),s=O(ae),l=m(ae,"DIV",{class:!0});var ne=C(l);h=m(ne,"DIV",{class:!0});var he=C(h);b=m(he,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),H(b)!=="svelte-crpa7y"&&(b.textContent=_),A=O(he),S=m(he,"INPUT",{class:!0,id:!0}),D=O(he),B=m(he,"DIV",{});var He=C(B);g=m(He,"BUTTON",{class:!0,"data-svelte-h":!0}),H(g)!=="svelte-r53s7o"&&(g.textContent=y),He.forEach(p),he.forEach(p),M=O(ne),v=m(ne,"DIV",{class:!0});var fe=C(v);N=m(fe,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),H(N)!=="svelte-10u0679"&&(N.textContent=E),I=O(fe),L=m(fe,"DIV",{class:!0});var ue=C(L);G=m(ue,"INPUT",{class:!0,id:!0}),re=O(ue),V=m(ue,"SPAN",{class:!0,"data-svelte-h":!0}),H(V)!=="svelte-91k20l"&&(V.textContent=pe),se=O(ue),x=m(ue,"INPUT",{class:!0,id:!0}),ue.forEach(p),oe=O(fe),q=m(fe,"DIV",{});var Ne=C(q);k&&k.l(Ne),z=O(Ne),W=m(Ne,"BUTTON",{class:!0,"data-svelte-h":!0}),H(W)!=="svelte-1elgafa"&&(W.textContent=ce),Ne.forEach(p),fe.forEach(p),K=O(ne),$=m(ne,"DIV",{class:!0,"data-svelte-h":!0}),H($)!=="svelte-1po95sj"&&($.innerHTML=ie),J=O(ne),F=m(ne,"DIV",{class:!0});var ye=C(F);w=m(ye,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),H(w)!=="svelte-1js269u"&&(w.textContent=Ge),Te=O(ye),de=m(ye,"DIV",{class:!0});var Ve=C(de);ee=m(Ve,"INPUT",{class:!0,id:!0,type:!0}),Ve.forEach(p),ye.forEach(p),ne.forEach(p),ae.forEach(p),Q.forEach(p),this.h()},h(){var U;f(n,"class","px-2 text-0A text-base"),f(b,"class","font-bold"),f(b,"for","device"),f(S,"class","my-1 w-50"),f(S,"id","device"),S.disabled=!0,S.value=T=((U=i[3])==null?void 0:U.name)??"No device",f(g,"class","btn primary"),f(h,"class","flex flex-col"),f(N,"class","font-bold"),f(N,"for","range_min"),f(G,"class","w-full"),f(G,"id","range_min"),f(V,"class","mx-4"),f(x,"class","w-full"),f(x,"id","range_max"),f(L,"class","my-1 flex w-full"),f(W,"class","btn primary"),f(v,"class","flex flex-col"),f($,"class","flex flex-col h-full"),f(w,"class","font-bold"),f(w,"for","keyboard"),f(ee,"class","h-[20px]"),f(ee,"id","keyboard"),f(ee,"type","checkbox"),ee.checked=i[4],f(de,"class","my-1 flex"),f(F,"class","flex flex-col h-full"),f(l,"class","midi-body svelte-haigqy"),f(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm"),f(e,"class",_e=Se(`${i[7].class||""}`)+" svelte-haigqy")},m(U,Q){P(U,e,Q),o(e,t),o(t,n),o(t,s),o(t,l),o(l,h),o(h,b),o(h,A),o(h,S),o(h,D),o(h,B),o(B,g),o(l,M),o(l,v),o(v,N),o(v,I),o(v,L),o(L,G),we(G,i[0]),o(L,re),o(L,V),o(L,se),o(L,x),we(x,i[1]),o(v,oe),o(v,q),k&&k.m(q,null),o(q,z),o(q,W),o(l,K),o(l,$),o(l,J),o(l,F),o(F,w),o(F,Te),o(F,de),o(de,ee),Re||(ke=[X(g,"click",Ce.openMidi),X(G,"input",i[8]),X(G,"change",i[9]),X(x,"input",i[10]),X(x,"change",i[11]),X(W,"click",_t),X(ee,"change",i[6])],Re=!0)},p(U,[Q]){var ae;Q&8&&T!==(T=((ae=U[3])==null?void 0:ae.name)??"No device")&&S.value!==T&&(S.value=T),Q&1&&G.value!==U[0]&&we(G,U[0]),Q&2&&x.value!==U[1]&&we(x,U[1]),U[2]?k?k.p(U,Q):(k=Xe(U),k.c(),k.m(q,z)):k&&(k.d(1),k=null),Q&16&&(ee.checked=U[4]),Q&128&&_e!==(_e=Se(`${U[7].class||""}`)+" svelte-haigqy")&&f(e,"class",_e)},i:ge,o:ge,d(U){U&&p(e),k&&k.d(),Re=!1,rt(ke)}}}function _t(){}function Nt(i,e,t){let n,r,s;Ee(i,xe,g=>t(12,n=g)),Ee(i,be,g=>t(3,r=g)),Ee(i,Pe,g=>t(4,s=g));let l=te(n[0]).absolute,h=te(n[1]).absolute,b="";function _(g,y){const M=at(y.currentTarget.value);if("data"in M){const v=n,N=[g==="min"?M.data:v[0],g==="max"?M.data:v[1]];Ce.setMidiRange(N),t(2,b="")}else t(2,b=M.err),g==="min"?t(0,l=te(n[0]).absolute):t(1,h=te(n[1]).absolute)}function A(g){Ce.setUseKeyboard(g.currentTarget.checked)}function S(){l=this.value,t(0,l)}const T=g=>_("min",g);function D(){h=this.value,t(1,h)}const B=g=>_("max",g);return i.$$set=g=>{t(7,e=Me(Me({},e),Ie(g)))},e=Ie(e),[l,h,b,r,s,_,A,e,S,T,D,B]}class yt extends Le{constructor(e){super(),Ue(this,e,Nt,bt,Be,{})}}function vt(i){let e,t,n,r,s,l,h,b,_,A,S,T,D,B,g,y,M,v,N,E,I,L,G,re,V,pe="𝄞",se,x,oe="𝄢",q,z,W='
',ce,K,$='
',ie;return{c(){e=u("section"),t=u("div"),n=u("div"),r=R(),s=u("div"),l=R(),h=u("div"),b=R(),_=u("div"),A=R(),S=u("div"),T=R(),D=u("div"),B=R(),g=u("div"),y=R(),M=u("div"),v=R(),N=u("div"),E=R(),I=u("div"),L=R(),G=u("div"),re=R(),V=u("span"),V.textContent=pe,se=R(),x=u("span"),x.textContent=oe,q=R(),z=u("div"),z.innerHTML=W,ce=R(),K=u("div"),K.innerHTML=$,this.h()},l(J){e=m(J,"SECTION",{class:!0});var F=C(e);t=m(F,"DIV",{class:!0});var w=C(t);n=m(w,"DIV",{class:!0}),C(n).forEach(p),r=O(w),s=m(w,"DIV",{class:!0}),C(s).forEach(p),l=O(w),h=m(w,"DIV",{class:!0}),C(h).forEach(p),b=O(w),_=m(w,"DIV",{class:!0}),C(_).forEach(p),A=O(w),S=m(w,"DIV",{class:!0}),C(S).forEach(p),T=O(w),D=m(w,"DIV",{class:!0}),C(D).forEach(p),B=O(w),g=m(w,"DIV",{class:!0}),C(g).forEach(p),y=O(w),M=m(w,"DIV",{class:!0}),C(M).forEach(p),v=O(w),N=m(w,"DIV",{class:!0}),C(N).forEach(p),E=O(w),I=m(w,"DIV",{class:!0}),C(I).forEach(p),L=O(w),G=m(w,"DIV",{class:!0}),C(G).forEach(p),re=O(w),V=m(w,"SPAN",{class:!0,"data-svelte-h":!0}),H(V)!=="svelte-19670ev"&&(V.textContent=pe),se=O(w),x=m(w,"SPAN",{class:!0,"data-svelte-h":!0}),H(x)!=="svelte-119te60"&&(x.textContent=oe),q=O(w),z=m(w,"DIV",{class:!0,"data-svelte-h":!0}),H(z)!=="svelte-1avvn9p"&&(z.innerHTML=W),ce=O(w),K=m(w,"DIV",{class:!0,"data-svelte-h":!0}),H(K)!=="svelte-1rv4bt9"&&(K.innerHTML=$),w.forEach(p),F.forEach(p),this.h()},h(){f(n,"class","line svelte-11g762w"),f(s,"class","line svelte-11g762w"),f(h,"class","line svelte-11g762w"),f(_,"class","line svelte-11g762w"),f(S,"class","line svelte-11g762w"),f(D,"class","line invisible svelte-11g762w"),f(g,"class","line svelte-11g762w"),f(M,"class","line svelte-11g762w"),f(N,"class","line svelte-11g762w"),f(I,"class","line svelte-11g762w"),f(G,"class","line svelte-11g762w"),f(V,"class","g-clef svelte-11g762w"),f(x,"class","f-clef svelte-11g762w"),f(z,"class","note target svelte-11g762w"),f(K,"class","note played svelte-11g762w"),f(t,"class","staff svelte-11g762w"),f(e,"class",ie=Se(`${i[2].class||""} score pt-12 pb-8`)+" svelte-11g762w")},m(J,F){P(J,e,F),o(e,t),o(t,n),o(t,r),o(t,s),o(t,l),o(t,h),o(t,b),o(t,_),o(t,A),o(t,S),o(t,T),o(t,D),o(t,B),o(t,g),o(t,y),o(t,M),o(t,v),o(t,N),o(t,E),o(t,I),o(t,L),o(t,G),o(t,re),o(t,V),o(t,se),o(t,x),o(t,q),o(t,z),i[5](z),o(t,ce),o(t,K),i[6](K)},p(J,[F]){F&4&&ie!==(ie=Se(`${J[2].class||""} score pt-12 pb-8`)+" svelte-11g762w")&&f(e,"class",ie)},i:ge,o:ge,d(J){J&&p(e),i[5](null),i[6](null)}}}function Ze(i,e,t){e?(i.style.display="block",i.style.bottom=wt(e)+"rem",i.firstChild&&(i.firstChild.textContent=`${e.flat?"♭":e.sharp?"♯":""}𝅝`),t!==void 0&&t?(i.classList.remove("wrong"),i.classList.add("correct")):t!==void 0&&(i.classList.remove("correct"),i.classList.add("wrong")),(e.value===60||e.value===61)&&i.lastChild instanceof HTMLElement||e.value===81&&i.lastChild instanceof HTMLElement?(i.lastChild.style.display="block",e.flat||e.sharp?i.lastChild.style.left="1.18rem":i.lastChild.style.left=""):i.lastChild instanceof HTMLElement&&(i.lastChild.style.display="none")):i.style.display="none"}function wt(i){const e=.42272727272,n=(i.octave-4)*7+i.steps;return 2.85+e*n}function St(i,e,t){let{target:n=void 0,played:r=void 0}=e,s,l;function h(_){Fe[_?"unshift":"push"](()=>{l=_,t(1,l)})}function b(_){Fe[_?"unshift":"push"](()=>{s=_,t(0,s)})}return i.$$set=_=>{t(2,e=Me(Me({},e),Ie(_))),"target"in _&&t(3,n=_.target),"played"in _&&t(4,r=_.played)},i.$$.update=()=>{i.$$.dirty&10&&l&&Ze(l,n),i.$$.dirty&17&&s&&Ze(s,r,r==null?void 0:r.correct)},e=Ie(e),[s,l,e,n,r,h,b]}class Mt extends Le{constructor(e){super(),Ue(this,e,St,vt,Be,{target:3,played:4})}}class It{constructor(e){ve(this,"notes");ve(this,"correct",0);ve(this,"idx",0);this.notes=e}get current(){return this.notes[this.idx]}get ended(){return this.notes.length===this.idx+1}guess(e){const t=this.current===e;return t&&(this.correct+=1),this.idx+=1,t}}const De=Ae(void 0),$e={playGuessNotes(i=10){const e=[],t=ct(xe);console.log("range",t);for(let r=0;rt(4,n=y)),Ee(i,De,y=>t(5,r=y));let s,l,h,b,_="";dt(()=>{D()}),be.subscribe(y=>{y&&y.channels[1].addListener("noteon",A)});function A(y){if(h)return;console.log("noteon",y);const M=y.rawData;S(M[1])}function S(y){if(!r)t(1,l={...te(y),value:y,correct:!1});else{t(0,s={...te(r.current),value:r.current});const M=r.guess(y);t(2,b=M?"correct":"wrong"),t(1,l={...te(y),value:y,correct:M}),h=setTimeout(()=>{r!=null&&r.ended?(t(0,s=void 0),t(2,b="ended")):r&&(t(0,s={...te(r.current),value:r.current}),t(2,b="waiting")),t(1,l=void 0),h=void 0},2e3)}}function T(y){if(n){const M=y.key.toUpperCase(),v=_.length===0,N=_.length===1,E=_.length===2;if(v&&Bt.test(M))t(3,_+=M);else if(N&&M==="B")t(3,_+="♭");else if(N&&M==="S")t(3,_+="♯");else if(N&&nt.test(M)||E&&nt.test(M)){const I=at(_+M);"data"in I&&S(I.data),t(3,_="")}}}async function D(){const y=await Ce.openMidi();"data"in y?y.data.name:y.err}function B(){t(2,b="waiting");const y=$e.playGuessNotes(),M=te(y.current);t(0,s={...M,value:y.current})}function g(){t(2,b="waiting"),$e.clearGame()}return[s,l,b,_,n,r,T,B,g]}class kt extends Le{constructor(e){super(),Ue(this,e,Lt,Dt,Be,{})}}export{kt as component}; diff --git a/_app/version.json b/_app/version.json index 3e649df7..d8c54f97 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1705665785306"} \ No newline at end of file +{"version":"1705671758658"} \ No newline at end of file diff --git a/index.html b/index.html index 273eaf05..bf9fcf7e 100644 --- a/index.html +++ b/index.html @@ -22,11 +22,11 @@ - + - + - + @@ -34,7 +34,7 @@