lilylet-live-editor 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +81 -0
- package/README.md +78 -0
- package/package.json +50 -0
- package/scripts/build-docs.js +523 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/components/Editor.svelte +164 -0
- package/src/lib/components/Player.svelte +529 -0
- package/src/lib/components/Preview.svelte +496 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/lilylet/highlight.ts +179 -0
- package/src/lib/lilylet/index.ts +93 -0
- package/src/lib/stores/editor.ts +119 -0
- package/src/lib/utils/share.ts +68 -0
- package/src/lib/verovio/toolkit.ts +83 -0
- package/src/modules.d.ts +41 -0
- package/src/routes/+layout.svelte +8 -0
- package/src/routes/+layout.ts +3 -0
- package/src/routes/+page.svelte +596 -0
- package/src/routes/markdown/+page.svelte +980 -0
- package/static/docs/lilylet-tutorial.md +932 -0
- package/static/js/.gitkeep +7 -0
- package/static/js/musicWidgetsBrowser.umd.min.js +2 -0
- package/static/soundfont/acoustic_grand_piano-mp3.js +93 -0
- package/static/soundfont/acoustic_grand_piano-ogg.js +93 -0
- package/svelte.config.js +22 -0
- package/tsconfig.json +15 -0
- package/vite.config.ts +15 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["musicWidgetsBrowser"]=e(require("vue")):t["musicWidgetsBrowser"]=e(t["Vue"])})("undefined"!==typeof self?self:this,t=>(()=>{var e={57:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(830);Object.defineProperty(e,"parseMidiData",{enumerable:!0,get:function(){return r.default}});var s=n(807);Object.defineProperty(e,"encodeMidiFile",{enumerable:!0,get:function(){return s.default}}),o(n(830),e)},69:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t["default"]=e}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToMIDI=e.encodeToMIDIData=e.sliceMidi=void 0;const s=r(n(57)),a=t=>{let e=0;t.forEach(t=>{e+=t.deltaTime,t.tick=e})},c=t=>{let e=0;t.sort((t,e)=>t.tick-e.tick).forEach(t=>{t.deltaTime=t.tick-e,e=t.tick})},l=(t,e,n)=>{a(t);const i=[],o={};return t.forEach(t=>{if(t.tick>=e&&t.tick<=n&&"endOfTrack"!==t.subtype)i.push(Object.assign(Object.assign({},t),{tick:t.tick-e}));else if(t.tick<e)switch(t.type){case"meta":o[t.subtype]=t;break}}),Object.values(o).forEach(t=>i.push(Object.assign({},t,{tick:0}))),i.push({tick:n-e,type:"meta",subtype:"endOfTrack"}),c(i),i},u=(t,e,n)=>({header:t.header,tracks:t.tracks.map(t=>l(t,e,n))});e.sliceMidi=u;const h=480,d=["endOfTrack","trackName","noteOn","noteOff"];function f(t,{startTime:e,unclosedNoteDuration:n=3e4}={}){t.microsecondsPerBeat=t.microsecondsPerBeat||5e5;const i=h,o=1e3*i/t.microsecondsPerBeat,r={formatType:0,ticksPerBeat:i,trackCount:1},s=[];if(!Number.isFinite(e)){if(!t.notes||!t.notes[0])throw new Error("encodeToMidiData: no start time specificed");e=t.notes[0].start}s.push({time:e,type:"meta",subtype:"copyrightNotice",text:`Composed by MusicWdigets. BUILT on ${new Date(Number("1761632868896")).toDateString()}`});const a=t.events&&t.events.find(t=>"setTempo"==t.subtype);a||(s.push({time:e,type:"meta",subtype:"timeSignature",numerator:4,denominator:4,thirtyseconds:8}),s.push({time:e,type:"meta",subtype:"setTempo",microsecondsPerBeat:t.microsecondsPerBeat}));let c=e||0;if(t.notes)for(const l of t.notes)s.push({time:l.start,type:"channel",subtype:"noteOn",channel:l.channel||0,noteNumber:l.pitch,velocity:l.velocity,finger:l.finger}),c=Math.max(c,l.start),Number.isFinite(n)&&(l.duration=l.duration||n),l.duration&&(s.push({time:l.start+l.duration,type:"channel",subtype:"noteOff",channel:l.channel||0,noteNumber:l.pitch,velocity:0}),c=Math.max(c,l.start+l.duration));if(t.events){const e=t.notes?t.events.filter(t=>!d.includes(t.data.subtype)):t.events;for(const t of e){const e=Object.assign({},t.data);s.push(Object.assign({time:t.time},e)),c=Math.max(c,t.time)}}return s.push({time:c+100,type:"meta",subtype:"endOfTrack"}),s.sort(function(t,e){return t.time-e.time}),s.map((t,e)=>({event:t,index:e})).filter(({event:t})=>"noteOn"==t.subtype&&null!=t.finger).reverse().forEach(({event:t,index:e})=>s.splice(e+1,0,{time:t.time,type:"meta",subtype:"text",text:`fingering(${t.finger})`})),s.forEach(t=>t.tick=Math.round((t.time-e)*o)),s.forEach((t,e)=>t.deltaTime=t.tick-(e>0?s[e-1].tick:0)),{header:r,tracks:[s]}}function p(t,e){const n=f(t,e);return s.encodeMidiFile(n)}e.encodeToMIDIData=f,e.encodeToMIDI=p},76:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n{constructor(){this.data=[]}write(t){for(let e=0;e<t.length;++e)this.data.push(t.charCodeAt(e))}writeInt32(t){this.data.push(t>>24&255),this.data.push(t>>16&255),this.data.push(t>>8&255),this.data.push(255&t)}writeInt16(t){this.data.push(t>>8&255),this.data.push(255&t)}writeInt8(t){this.data.push(255&t)}writeVarInt(t){const e=[];while(t)e.push(127&t),t>>=7;for(let n=e.length-1;n>=0;--n)this.data.push(e[n]|(n?128:0))}getBuffer(){return String.fromCharCode(...this.data)}getArrayBuffer(){return new Uint8Array(this.data)}}e["default"]=n},181:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n{constructor(t){t instanceof Uint8Array?this.array=t:(Array.isArray(t),this.array=new Uint8Array(t)),this.position=0}eof(){return this.position>=this.array.length}read(t){const e=this.array.slice(this.position,this.position+t);return this.position+=t,e}readString(t){const e=Array.from(this.read(t));return e.map(t=>String.fromCharCode(t)).join("")}readInt32(){const t=(this.array[this.position]<<24)+(this.array[this.position+1]<<16)+(this.array[this.position+2]<<8)+this.array[this.position+3];return this.position+=4,t}readInt16(){const t=(this.array[this.position]<<8)+this.array[this.position+1];return this.position+=2,t}readInt8(t){let e=this.array[this.position];return t&&e>127&&(e-=256),this.position+=1,e}readVarInt(){let t=0;while(1){const e=this.readInt8();if(!(128&e))return t+e;t+=127&e,t<<=7}}}e["default"]=n},183:function(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(252)),r=i(n(278));class s{constructor(t,e,n={}){this.criterion=t,this.sample=e,this.getCursorOffset=n.getCursorOffset||(()=>null),this.outOfPage=n.outOfPage,this.bestNode=null,this.fineCursor=null,this.breakingSI=e.notes.length-1,this.zeroNode=o.default.zero(),this.zeroNode.offset=this.getCursorOffset()||0,this.relocationThreshold=n.relocationThreshold||r.default.RelocationThreshold}step(t){const e=this.sample.notes[t];if(e.matches.length>0){e.matches.forEach(e=>{e.evaluatePrev(this.zeroNode);for(let n=t-1;n>=Math.max(this.breakingSI+1,t-r.default.SkipDeep);--n){const i=this.sample.notes[n];console.assert(i,"prevNote is null:",n,t,this.sample.notes),i.matches.forEach(t=>{const n=e.offset-t.offset;n<2/r.default.LagOffsetCost&&n>-2/r.default.LeadOffsetCost&&e.evaluatePrev(t)})}if(e.prior=e.totalCost>1.99?-1:e.priorByOffset(this.zeroNode.offset),e.prior>0&&this.outOfPage){const t=this.criterion.notes[e.ci].startTick;this.outOfPage(t)&&(e.prior-=.7)}}),e.matches.sort((t,e)=>e.prior-t.prior),this.cursors=e.matches;let n=null;const i=this.nullSteps(t),o=this.cursors[0];o&&o.totalCost<1&&(o.prior>0||o.totalCost<.4&&Math.log(Math.max(i*o.value,.001))>this.relocationThreshold)&&(this.zeroNode.offset=o.offset,n=o,(!this.bestNode||o.value>this.bestNode.value)&&(this.bestNode=o)),n?this.fineCursor=n:this.resetCursor(t,{breaking:!1})||(this.zeroNode.offset+=e.deltaSi*Math.tanh(i),console.assert(!Number.isNaN(this.zeroNode.offset),"zeroNode.offset is NaN.",e.deltaSi,i))}else this.cursors=[]}path({fromIndex:t=0,toIndex:e=this.sample.notes.length-1}={}){const n=[];let i=null;for(let o=e;o>=t;){const t=this.sample.notes[o];if(!t.matches.length||t.matches[0].prior<-.01||t.matches[0].totalCost>=1){n[o]=-1,--o;continue}null!=i&&(t.matches.forEach(t=>t.backPrior=t.totalCost<1.99?t.priorByOffset(i):-1),t.matches.sort((t,e)=>e.backPrior-t.backPrior));const e=t.matches[0];e.path.forEach((t,e)=>n[e]=t),i=e.root.offset,o=e.rootSi-1}return console.assert(n.length==e+1,"path length error:",n,t,e+1,this.sample.notes.length,this.sample.notes.length?this.sample.notes[this.sample.notes.length-1].index:null),n}nullSteps(t){return t-(this.fineCursor?this.fineCursor.si:-1)-1}resetCursor(t,{breaking:e=!0}={}){e&&(this.breakingSI=t);const n=this.getCursorOffset();return null!=n&&(this.zeroNode.offset=n,this.zeroNode.si=t,this.fineCursor=null,console.assert(!Number.isNaN(this.zeroNode.offset),"zeroNode.offset is NaN.",n),!0)}get relocationTendency(){const t=this.cursors&&this.cursors[0];if(!t)return null;const e=this.nullSteps(t.si);return e<=0?0:Math.log(Math.max(e*t.value,.001))/this.relocationThreshold}}e["default"]=s},219:(t,e,n)=>{var i=n(792);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var o=n(548).A;o("db9b4666",i,!0,{sourceMap:!1,shadowMode:!1})},252:function(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(278)),r=(t,e)=>{const n={};return e.forEach(e=>{n[e]=t[e]}),n};class s{constructor(t,e){this.s_note=t,this.c_note=e,console.assert(null!=this.s_note.softIndex,"s_note softIndex is null"),this.offset=this.s_note.softIndex-this.c_note.softIndex,this._prev=null,this._totalCost=0,this._value=0,this.cacheDirty=!0}get prev(){return this._prev}set prev(t){t!=this._prev&&(this._prev=t,this.cacheDirty=!0)}get si(){return this.s_note.index}get ci(){return this.c_note.index}get root(){return this.prev.root||this}get rootSi(){return this.prev.zero?this.si:this.prev.rootSi}get id(){return`${this.s_note.index},${this.c_note.index}`}static cost(t,e,n){return t*o.default.CostStepAttenuation+Math.tanh(e*o.default.SkipCost)+Math.tanh(.5*n)}updateCache(){this.cacheDirty&&(this._totalCost=s.cost(this.prev.totalCost,this.si-this.prev.si-1,this.selfCost),this._value=this.prev.value+1-Math.tanh(.5*this.selfCost),this.cacheDirty=!1)}get totalCost(){return this.updateCache(),this._totalCost}get value(){return this.updateCache(),this._value}get deep(){return this.prev.deep+1}get path(){const t=[];for(let e=this;!e.zero;e=e.prev)t[e.si]=e.ci;for(let e=0;e<t.length;++e)"number"!=typeof t[e]&&(t[e]=-1);return t}dump(){return r(this,["id","si","ci","rootSi","value","deep","rootSi","offset","prior","selfCost","totalCost"])}evaluatePrev(t){const e=this.evaluatePrevCost(t);console.assert(this.si-t.si>=1,"node index error:",this,t);const n=s.cost(t.totalCost,this.si-t.si-1,e);return(!this.prev||n<this.totalCost)&&(this.prev=t,this.selfCost=e,!0)}evaluatePrevCost(t){let e=0;if(null!=t.offset){const n=this.offset-t.offset,i=t.zero?o.default.ZeroOffsetCost:n>0?o.default.LagOffsetCost:o.default.LeadOffsetCost;e+=Math.pow(n*i,2)}return e}priorByOffset(t){const e=Math.abs(this.offset-t)/1;return Math.tanh(this.value*o.default.PriorValueSigmoidFactor)-Math.tanh(e*o.default.PriorDistanceSigmoidFactor)}static zero(){return{zero:!0,totalCost:0,value:0,si:-1,ci:-1,deep:0,offset:0}}}e["default"]=s},262:(t,e)=>{"use strict";e.A=(t,e)=>{const n=t.__vccOpts||t;for(const[i,o]of e)n[i]=o;return n}},278:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n={CostStepAttenuation:.6,SkipDeep:3,PriorDistanceSigmoidFactor:.1,PriorValueSigmoidFactor:.12,SkipCost:.5,LagOffsetCost:1,LeadOffsetCost:1.6,ZeroOffsetCost:.58,RelocationThreshold:6};e["default"]=n},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",i="undefined"!==typeof e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,i,o,r){"string"===typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<t.length;l++){var u=[].concat(t[l]);i&&s[u[0]]||("undefined"!==typeof r&&("undefined"===typeof u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=r),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},350:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var i=n(601),o=n.n(i),r=n(314),s=n.n(r),a=s()(o());a.push([t.id,"g.mw-svg-piano-roll .note{cursor:pointer;opacity:.6}g.mw-svg-piano-roll .note:hover line,g.mw-svg-piano-roll .note:hover rect{opacity:.9;stroke:orange;stroke-width:.08px}g.mw-svg-piano-roll .note.on rect{fill:#2a2}g.mw-svg-piano-roll .note rect{fill:#555}g.mw-svg-piano-roll .note line{stroke:#111;stroke-width:.12px}",""]);const c=a},429:(t,e,n)=>{var i=n(350);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var o=n(548).A;o("a0aa941c",i,!0,{sourceMap:!1,shadowMode:!1})},548:(t,e,n)=>{"use strict";function i(t,e){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],s=r[0],a=r[1],c=r[2],l=r[3],u={id:t+":"+o,css:a,media:c,sourceMap:l};i[s]?i[s].parts.push(u):n.push(i[s]={id:s,parts:[u]})}return n}n.d(e,{A:()=>p});var o="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var r={},s=o&&(document.head||document.getElementsByTagName("head")[0]),a=null,c=0,l=!1,u=function(){},h=null,d="data-vue-ssr-id",f="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function p(t,e,n,o){l=n,h=o||{};var s=i(t,e);return m(s),function(e){for(var n=[],o=0;o<s.length;o++){var a=s[o],c=r[a.id];c.refs--,n.push(c)}e?(s=i(t,e),m(s)):s=[];for(o=0;o<n.length;o++){c=n[o];if(0===c.refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete r[c.id]}}}}function m(t){for(var e=0;e<t.length;e++){var n=t[e],i=r[n.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](n.parts[o]);for(;o<n.parts.length;o++)i.parts.push(y(n.parts[o]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var s=[];for(o=0;o<n.parts.length;o++)s.push(y(n.parts[o]));r[n.id]={id:n.id,refs:1,parts:s}}}}function g(){var t=document.createElement("style");return t.type="text/css",s.appendChild(t),t}function y(t){var e,n,i=document.querySelector("style["+d+'~="'+t.id+'"]');if(i){if(l)return u;i.parentNode.removeChild(i)}if(f){var o=c++;i=a||(a=g()),e=v.bind(null,i,o,!1),n=v.bind(null,i,o,!0)}else i=g(),e=w.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}var b=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function v(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=b(e,o);else{var r=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function w(t,e){var n=e.css,i=e.media,o=e.sourceMap;if(i&&t.setAttribute("media",i),h.ssrId&&t.setAttribute(d,e.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{while(t.firstChild)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}},601:t=>{"use strict";t.exports=function(t){return t[1]}},694:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||i(e,t,n)},r=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function s(t){try{c(i.next(t))}catch(e){r(e)}}function a(t){try{c(i["throw"](t))}catch(e){r(e)}}function c(t){t.done?n(t.value):o(t.value).then(s,a)}c((i=i.apply(t,e||[])).next())})},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MatchNode=e.Navigator=e.runNavigation=e.genNotationContext=e.makeMatchNodes=e.makeNoteSoftIndex=e.normalizeInterval=void 0;const a=s(n(252));e.MatchNode=a.default;const c=s(n(183));e.Navigator=c.default;const l=800,u=.24*l,h=t=>Math.tanh(t/u);e.normalizeInterval=h;const d=function(t,e,{softIndexFactor:n=1}={}){e=Number(e);const i=t[e];if(e>0){const o=t[e-1];console.assert(null!=i.start,"note.start is null",i),console.assert(null!=o.start,"lastNote.start is null",o),i.deltaSi=h((i.start-o.start)*n),i.softIndex=o.softIndex+i.deltaSi,console.assert(!Number.isNaN(i.deltaSi),"note.deltaSi is NaN.",i.start,o.start)}else i.softIndex=0,i.deltaSi=0};e.makeNoteSoftIndex=d;const f=function(t,e,n=a.default.zero()){t.matches=[];const i=e.pitchMap[t.pitch];if(i)for(const o of i){const e=new a.default(t,o);n&&e.evaluatePrev(n),t.matches.push(e)}};e.makeMatchNodes=f;const p=function(t,{softIndexFactor:e=1}={}){for(let n=0;n<t.notes.length;++n)d(t.notes,n,{softIndexFactor:e})};e.genNotationContext=p;const m=function(t,e,n=null){return r(this,void 0,void 0,function*(){const i=new c.default(t,e);i.resetCursor(-1);for(let t=0;t<e.notes.length;++t){i.step(t);const e=yield n&&n(t,i);if(e===Symbol.for("end"))return void console.log("Navigation interrupted.")}return i})};e.runNavigation=m,o(n(755),e)},731:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fixOverlapNotes=e.trimSequence=e.midiToSequence=void 0,e.midiToSequence=(t,{timeWarp:e=1}={})=>{const n=[];let i=120;const o=t.header.ticksPerBeat;for(let l=0;l<t.tracks.length;l++)n[l]={nextEventIndex:0,ticksToNextEvent:t.tracks[l].length?t.tracks[l][0].deltaTime:null};function r(){let e=null,i=null,o=null;for(let t=0;t<n.length;t++)null!=n[t].ticksToNextEvent&&(null==e||n[t].ticksToNextEvent<e)&&(e=n[t].ticksToNextEvent,i=t,o=n[t].nextEventIndex);if(null!=i){const r=t.tracks[i][o];t.tracks[i][o+1]?n[i].ticksToNextEvent+=t.tracks[i][o+1].deltaTime:n[i].ticksToNextEvent=null,n[i].nextEventIndex+=1;for(let t=0;t<n.length;t++)null!=n[t].ticksToNextEvent&&(n[t].ticksToNextEvent-=e);return{ticksToEvent:e,event:r,track:i}}return null}let s=null;const a=[];function c(){function t(){let t=0;if(s.ticksToEvent>0){const e=s.ticksToEvent/o;t=e/(i/60)}"meta"==s.event.type&&"setTempo"==s.event.subtype&&(i=6e7/s.event.microsecondsPerBeat);const n=1e3*t*e||0;a.push([s,n]),s=r()}if(s=r())while(s)t()}return c(),a},e.trimSequence=t=>{const e=new Map;return t.filter(([{event:t,ticksToEvent:n}])=>{if(n>0&&e.clear(),"channel"!==t.type)return!0;const i=`${t.subtype}|${t.channel}|${t.noteNumber}`;return!e.get(i)&&(e.set(i,t),!0)})},e.fixOverlapNotes=t=>{const e=new Map,n=new Map,i=[];let o=-1;return t.forEach(([{event:t,ticksToEvent:r}],s)=>{if(r>0&&(o=s),"channel"!==t.type)return;const a=`${t.channel}|${t.noteNumber}`;switch(t.subtype){case"noteOn":e.get(a)?n.set(a,o):e.set(a,o);break;case"noteOff":n.get(a)?(i.push([n.get(a),s]),n.delete(a)):e.delete(a);break}}),i.forEach((t,e)=>{for(let n=e-1;n>=0;--n){const e=i[n];if(e[1]<t[0])break;t[0]>e[0]&&++t[0]}}),i.forEach(([e,n])=>{if(n>=t.length-1||e<0)return;const i=t[n],o=t[n+1],r=t[e];if(!r[0].ticksToEvent)return void console.warn("invalid front index:",e,n,r);const s=r[1]/r[0].ticksToEvent;o[1]+=i[1],o[0].ticksToEvent+=i[0].ticksToEvent,i[0].ticksToEvent=r[0].ticksToEvent-1,r[0].ticksToEvent=1,i[1]=i[0].ticksToEvent*s,r[1]=r[0].ticksToEvent*s,t.splice(n,1),t.splice(e,0,i)}),t}},755:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},792:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var i=n(601),o=n.n(i),r=n(314),s=n.n(r),a=s()(o());a.push([t.id,"svg.mw-midi-roll .scales line{stroke:#000;stroke-width:.1}svg.mw-midi-roll .scales text{font-size:2px;text-anchor:middle;-webkit-user-select:none;-moz-user-select:none;user-select:none}svg.mw-midi-roll .bar line{stroke:#000;stroke-width:.01}svg.mw-midi-roll .pitch-bar line,svg.mw-midi-roll .time-bar line{stroke:#000;stroke-width:.06}svg.mw-midi-roll .pitch-padding{fill:#fffc}svg.mw-midi-roll .progress rect{fill:#afa1}svg.mw-midi-roll .progress line{stroke:#0a0;stroke-width:.04}",""]);const c=a},807:function(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(76));function r({header:t,tracks:e}){function n(t,e,n){console.assert(4===e.length,"chunk id must be 4 byte"),t.write(e),t.writeInt32(n.length),t.write(n)}function i(t,e){if("unknown"!==e.subtype)switch(t.writeVarInt(e.deltaTime),e.type){case"meta":switch(t.writeInt8(255),e.subtype){case"sequenceNumber":t.writeInt8(0),t.writeVarInt(2),t.writeInt16(e.number);break;case"text":t.writeInt8(1),t.writeVarInt(e.text.length),t.write(e.text);break;case"copyrightNotice":t.writeInt8(2),t.writeVarInt(e.text.length),t.write(e.text);break;case"trackName":t.writeInt8(3),t.writeVarInt(e.text.length),t.write(e.text);break;case"instrumentName":t.writeInt8(4),t.writeVarInt(e.text.length),t.write(e.text);break;case"lyrics":t.writeInt8(5),t.writeVarInt(e.text.length),t.write(e.text);break;case"marker":t.writeInt8(6),t.writeVarInt(e.text.length),t.write(e.text);break;case"cuePoint":t.writeInt8(7),t.writeVarInt(e.text.length),t.write(e.text);break;case"midiChannelPrefix":t.writeInt8(32),t.writeVarInt(1),t.writeInt8(e.channel);break;case"endOfTrack":t.writeInt8(47),t.writeVarInt(0);break;case"setTempo":t.writeInt8(81),t.writeVarInt(3),t.writeInt8(e.microsecondsPerBeat>>16&255),t.writeInt8(e.microsecondsPerBeat>>8&255),t.writeInt8(255&e.microsecondsPerBeat);break;case"smpteOffset":t.writeInt8(84),t.writeVarInt(5);var n={24:0,25:32,29:64,30:96}[e.frameRate];t.writeInt8(e.hour|n),t.writeInt8(e.min),t.writeInt8(e.sec),t.writeInt8(e.frame),t.writeInt8(e.subframe);break;case"timeSignature":t.writeInt8(88),t.writeVarInt(4),t.writeInt8(e.numerator),t.writeInt8(Math.log2(e.denominator)),t.writeInt8(e.metronome),t.writeInt8(e.thirtyseconds);break;case"keySignature":t.writeInt8(89),t.writeVarInt(2),t.writeInt8(e.key),t.writeInt8(e.scale);break;default:t.writeInt8(127),t.writeVarInt(e.data.length),t.write(e.data);break}break;case"sysEx":t.writeInt8(240),t.writeVarInt(e.data.length),t.write(e.data);break;case"dividedSysEx":t.writeInt8(247),t.writeVarInt(e.data.length),t.write(e.data);break;case"channel":switch(e.subtype){case"noteOff":t.writeInt8(144|e.channel),t.writeInt8(e.noteNumber),t.writeInt8(e.velocity);break;case"noteOn":t.writeInt8(128|e.channel),t.writeInt8(e.noteNumber),t.writeInt8(e.velocity);break;case"noteAftertouch":t.writeInt8(160|e.channel),t.writeInt8(e.noteNumber),t.writeInt8(e.amount);break;case"controller":t.writeInt8(176|e.channel),t.writeInt8(e.controllerType),t.writeInt8(e.value);break;case"programChange":t.writeInt8(192|e.channel),t.writeInt8(e.programNumber);break;case"channelAftertouch":t.writeInt8(208|e.channel),t.writeInt8(e.amount);break;case"pitchBend":t.writeInt8(224|e.channel),t.writeInt8(127&e.value),t.writeInt8(e.value>>7&127);break;default:throw new Error("Unrecognised MIDI event type: "+e.subtype)}break;default:throw new Error("Unrecognised event type: "+e.type)}}const r=new o.default,s=new o.default;s.writeInt16(t.formatType),s.writeInt16(e.length),s.writeInt16(t.ticksPerBeat),n(r,"MThd",s.getBuffer());for(let a=0;a<e.length;++a){const t=new o.default;for(let n=0;n<e[a].length;++n)i(t,e[a][n]);n(r,"MTrk",t.getBuffer())}return r.getArrayBuffer()}e["default"]=r},830:function(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MidiFile=void 0;const o=i(n(181));class r{constructor(t){Object.assign(this,t)}static parse(t){function e(t){const e=t.readString(4),n=t.readInt32();return{id:e,length:n,data:t.read(n)}}let n;function i(t){const e={deltaTime:null,type:null};e.deltaTime=t.readVarInt();let i=t.readInt8();if(240===(240&i)){if(255!==i){if(240===i){e.type="sysEx";const n=t.readVarInt();return e.data=t.readString(n),e}if(247===i){e.type="dividedSysEx";const n=t.readVarInt();return e.data=t.readString(n),e}throw new Error("Unrecognised MIDI event type byte: "+i)}{e.type="meta";const n=t.readInt8(),i=t.readVarInt();switch(n){case 0:if(e.subtype="sequenceNumber",2!==i)throw new Error("Expected length for sequenceNumber event is 2, got "+i);return e.number=t.readInt16(),e;case 1:return e.subtype="text",e.text=t.readString(i),e;case 2:return e.subtype="copyrightNotice",e.text=t.readString(i),e;case 3:return e.subtype="trackName",e.text=t.readString(i),e;case 4:return e.subtype="instrumentName",e.text=t.readString(i),e;case 5:return e.subtype="lyrics",e.text=t.readString(i),e;case 6:return e.subtype="marker",e.text=t.readString(i),e;case 7:return e.subtype="cuePoint",e.text=t.readString(i),e;case 32:if(e.subtype="midiChannelPrefix",1!==i)throw new Error("Expected length for midiChannelPrefix event is 1, got "+i);return e.channel=t.readInt8(),e;case 47:if(e.subtype="endOfTrack",0!==i)throw new Error("Expected length for endOfTrack event is 0, got "+i);return e;case 81:if(e.subtype="setTempo",3!==i)throw new Error("Expected length for setTempo event is 3, got "+i);return e.microsecondsPerBeat=(t.readInt8()<<16)+(t.readInt8()<<8)+t.readInt8(),e;case 84:if(e.subtype="smpteOffset",5!==i)throw new Error("Expected length for smpteOffset event is 5, got "+i);const n=t.readInt8();return e.frameRate={0:24,32:25,64:29,96:30}[96&n],e.hour=31&n,e.min=t.readInt8(),e.sec=t.readInt8(),e.frame=t.readInt8(),e.subframe=t.readInt8(),e;case 88:if(e.subtype="timeSignature",4!==i)throw new Error("Expected length for timeSignature event is 4, got "+i);return e.numerator=t.readInt8(),e.denominator=Math.pow(2,t.readInt8()),e.metronome=t.readInt8(),e.thirtyseconds=t.readInt8(),e;case 89:if(e.subtype="keySignature",2!==i)throw new Error("Expected length for keySignature event is 2, got "+i);return e.key=t.readInt8(),e.scale=t.readInt8(),e;case 127:return e.subtype="sequencerSpecific",e.data=t.readString(i),e;default:return e.subtype="unknown",e.data=t.readString(i),e}}}else{let o;0===(128&i)?(o=i,i=n):(o=t.readInt8(),n=i);const r=i>>4;switch(e.channel=15&i,e.type="channel",r){case 8:return e.subtype="noteOff",e.noteNumber=o,e.velocity=t.readInt8(),e;case 9:return e.noteNumber=o,e.velocity=t.readInt8(),0===e.velocity?e.subtype="noteOff":e.subtype="noteOn",e;case 10:return e.subtype="noteAftertouch",e.noteNumber=o,e.amount=t.readInt8(),e;case 11:return e.subtype="controller",e.controllerType=o,e.value=t.readInt8(),e;case 12:return e.subtype="programChange",e.programNumber=o,e;case 13:return e.subtype="channelAftertouch",e.amount=o,e;case 14:return e.subtype="pitchBend",e.value=o+(t.readInt8()<<7),e;default:throw new Error("Unrecognised MIDI event type: "+r)}}}let s=t;"string"===typeof t?s=new Uint8Array(t.split("").map(t=>t.charCodeAt(0))).buffer:s instanceof Uint8Array&&(s=s.buffer);const a=new o.default(s),c=e(a);if("MThd"!==c.id||6!==c.length)throw new Error("Bad .mid file - header not found");const l=new o.default(c.data),u=l.readInt16(),h=l.readInt16(),d=l.readInt16();let f;if(32768&d)throw new Error("Expressing time division in SMTPE frames is not supported yet");f=d;const p={formatType:u,trackCount:h,ticksPerBeat:f},m=[];for(let r=0;r<p.trackCount;r++){const t=e(a);if("MTrk"!==t.id)throw new Error("Unexpected chunk - expected MTrk, got "+t.id);const n=new o.default(t.data),r=[];let s=!1;while(!n.eof()){const t=i(n);r.push(t),"endOfTrack"===t.subtype&&(s=!0)}s||r.push({deltaTime:0,type:"meta",subtype:"endOfTrack"}),m.push(r)}return new r({header:p,tracks:m})}}e.MidiFile=r,e["default"]=t=>r.parse(t)},834:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Notation=void 0;const i=n(731),o={64:"Sustain",65:"Portamento",66:"Sostenuto",67:"Soft"};class r{constructor(t){Object.assign(this,t),this.notes=[];for(const e of this.channels)if(e)for(const t of e)this.notes.push(t);this.notes.sort(function(t,e){return t.start-e.start});for(const e in this.notes)this.notes[e].index=Number(e);this.duration=this.notes.length>0?this.endTime-this.notes[0].start:0,this.pitchMap=[];for(const e in this.channels)for(const t in this.channels[e]){const n=this.channels[e][t].pitch;this.pitchMap[n]=this.pitchMap[n]||[],this.pitchMap[n].push(this.channels[e][t])}if(this.pitchMap.forEach(t=>t.sort((t,e)=>t.start-e.start)),this.meta.beatInfos)for(let e=0;e<this.meta.beatInfos.length;++e){const t=this.meta.beatInfos[e];if(e>0){const n=this.meta.beatInfos[e-1];t.beatIndex=n.beatIndex+Math.ceil((t.tick-n.tick)/this.ticksPerBeat)}else t.beatIndex=0}{let t=0,e=0,n=5e5;for(const i of this.tempos){const o=i.tick-e;t+=n/1e3*o/this.ticksPerBeat,e=i.tick,n=i.tempo,i.time=t}}}static parseMidi(t,{fixOverlap:e=!0,logger:n=null}={}){const s=[],a={},c={},l=[],u=[];let h=0,d=5e3,f=0,p=4,m=0;const g={};let y,b=0,v=0;const w=[],k=t.header.ticksPerBeat;let A=i.midiToSequence(t);e&&(A=i.trimSequence(i.fixOverlapNotes(A)));const S=A.map(t=>({data:t[0].event,track:t[0].track,deltaTime:t[1],deltaTicks:t[0].ticksToEvent}));let x=0;const I=1;for(const i of S){if(b+=i.deltaTicks,v=Math.round(b*I),i.deltaTicks>0){const t=i.deltaTicks/k;for(let e=Math.ceil(f);e<f+t;++e){const t=h+(e-f)*d;u.push({time:t,index:m%p}),++m}f+=t}h+=i.deltaTime,i.time=h,i.ticks=v;const t=i.data;switch(t.type){case"channel":switch(t.subtype){case"noteOn":{const e=t.noteNumber;s.push({channel:t.channel,pitch:e,startTick:v,start:h,velocity:t.velocity,beats:f,track:i.track}),g.low=Math.min(g.low||e,e),i.index=x,++x}break;case"noteOff":{const e=t.noteNumber;l[t.channel]=l[t.channel]||[];const i=s.findIndex(n=>n.channel==t.channel&&n.pitch==e);if(i>=0){const n=s.splice(i,1)[0];l[t.channel].push({channel:t.channel,startTick:n.startTick,endTick:v,pitch:e,start:n.start,duration:h-n.start,velocity:n.velocity,beats:n.beats,track:n.track,finger:n.finger})}else n&&n.debug&&n.debug("unexpected noteOff: ",h,t);g.high=Math.max(g.high||e,e)}break;case"controller":switch(t.controllerType){case 64:case 65:case 66:case 67:const e=o[t.controllerType];a[t.channel]=a[t.channel]||{},c[t.channel]=c[t.channel]||[];const n=a[t.channel][e];n&&c[t.channel].push({type:e,start:n.start,duration:h-n.start,value:n.value}),a[t.channel][e]={start:h,value:t.value};break}break}break;case"meta":switch(t.subtype){case"setTempo":d=t.microsecondsPerBeat/1e3,w.push({tempo:t.microsecondsPerBeat,tick:v,time:h});break;case"timeSignature":p=t.numerator,m=0;break;case"text":if(!y&&/^find-corres:/.test(t.text)){const e=t.text.match(/:([\d\,-]+)/),n=e&&e[1]||"";y=n.split(",").map(t=>Number(t))}else if(/fingering\(.*\)/.test(t.text)){const[e,n]=t.text.match(/\((.+)\)/),i=Number(n);if(!Number.isNaN(i)){const t=s[s.length-1];t&&(t.finger=i);const e=S.find(t=>t.index==x-1);e&&(e.data.finger=i)}}break;case"copyrightNotice":n&&n.log&&n.log("MIDI copyright:",t.text);break}break}}return s.forEach(t=>{n&&n.debug&&n.debug("unclosed noteOn event at",t.startTick,t),l[t.channel]=l[t.channel]||[],l[t.channel].push({startTick:t.startTick,endTick:v,pitch:t.pitch,start:t.start,duration:h-t.start,velocity:t.velocity,beats:t.beats,track:t.track,finger:t.finger})}),new r({channels:l,keyRange:g,pedals:c,bars:u,endTime:h,endTick:v,correspondences:y,events:S,tempos:w,ticksPerBeat:k,meta:{},logger:n})}findChordBySoftindex(t,e=.8){return this.notes.filter(n=>Math.abs(n.softIndex-t)<e)}averageTempo(t=null){t=t||{from:0,to:this.endTick},this.logger&&this.logger.assert(this.tempos,"no tempos."),this.logger&&this.logger.assert(t.to>t.from,"range is invalid:",t);const e=e=>{const n=Math.max(t.from,this.tempos[e].tick),i=e<this.tempos.length-1?Math.min(this.tempos[e+1].tick,t.to):t.to;return Math.max(0,i-n)},n=this.tempos.reduce((t,n,i)=>t+n.tempo*e(i),0),i=n/(t.to-t.from);return 6e7/i}ticksToTime(t){this.logger&&this.logger.assert(Number.isFinite(t),"invalid tick value:",t),this.logger&&this.logger.assert(this.tempos&&this.tempos.length,"no tempos.");const e=this.tempos.findIndex(e=>e.tick>t),n=e<0?this.tempos.length-1:Math.max(e-1,0),i=this.tempos[n];return i.time+(t-i.tick)*i.tempo*.001/this.ticksPerBeat}timeToTicks(t){this.logger&&this.logger.assert(Number.isFinite(t),"invalid time value:",t),this.logger&&this.logger.assert(this.tempos&&this.tempos.length,"no tempos.");const e=this.tempos.findIndex(e=>e.time>t),n=e<0?this.tempos.length-1:Math.max(e-1,0),i=this.tempos[n];return i.tick+(t-i.time)*this.ticksPerBeat/(.001*i.tempo)}tickRangeToTimeRange(t){return this.logger&&this.logger.assert(t.to>=t.from,"invalid tick range:",t),{from:this.ticksToTime(t.from),to:this.ticksToTime(t.to)}}scaleTempo({factor:t,headTempo:e}){this.logger&&this.logger.assert(this.tempos&&this.tempos.length,"[Notation.scaleTempo] tempos is empty."),e&&(t=e/this.tempos[0].tempo),this.logger&&this.logger.assert(Number.isFinite(t)&&t>0,"[Notation.scaleTempo] invalid factor:",t),this.tempos.forEach(e=>{e.tempo*=t,e.time*=t}),this.events.forEach(e=>{e.deltaTime*=t,e.time*=t}),this.notes.forEach(e=>{e.start*=t,e.duration*=t}),this.endTime*=t}}e.Notation=r},893:e=>{"use strict";e.exports=t},947:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t["default"]=e}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},s=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function s(t){try{c(i.next(t))}catch(e){r(e)}}function a(t){try{c(i["throw"](t))}catch(e){r(e)}}function c(t){t.done?n(t.value):o(t.value).then(s,a)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const a=r(n(834)),c=()=>new Promise(t=>requestAnimationFrame(t));class l{constructor(t,{cacheSpan:e=600,onMidi:n,onPlayFinish:i,onTurnCursor:o}={}){let r;this.cacheSpan=e,this.onMidi=n,this.onPlayFinish=i,this.onTurnCursor=o,r=t.notes&&Number.isFinite(t.endTime)?t:a.Notation.parseMidi(t),this.notation=r,this.events=r.events,this.isPlaying=!1,this.progressTime=0,this.startTime=performance.now(),this.duration=r.endTime,this.cursorTurnDelta=0,console.assert(r.tempos&&r.tempos.length,"[MidiPlayer] invalid notation, tempos is empty.")}dispose(){this.isPlaying=!1,this.progressTime=0}get progressTicks(){return this.notation.timeToTicks(this.progressTime)}set progressTicks(t){this.progressTime=this.notation.ticksToTime(t),this.onTurnCursor&&this.onTurnCursor(this.progressTime)}play({nextFrame:t=c}={}){return s(this,void 0,void 0,function*(){this.progressTime>=this.duration&&(this.progressTime=0);let e=performance.now();this.startTime=e-this.progressTime,this.isPlaying=!0;let n=this.events.findIndex(t=>t.time>=e-this.startTime);while(this.isPlaying){for(;n<this.events.length;++n){const t=this.events[n];if(!t||t.time>this.progressTime+this.cacheSpan)break;"channel"===t.data.type&&this.startTime+t.time>=e&&this.onMidi&&this.onMidi(t.data,this.startTime+t.time)}if(yield t(),!this.isPlaying)break;if(0!==this.cursorTurnDelta){const t=this.cursorTurnDelta<0;if(this.startTime-=this.cursorTurnDelta,this.cursorTurnDelta=0,t)for(;n>0;--n){const t=this.events[n].time;if(this.startTime+t<e)break}}e=performance.now(),this.progressTime=e-this.startTime,this.progressTime>this.duration&&(this.isPlaying=!1,this.onPlayFinish&&this.onPlayFinish())}})}pause(){this.isPlaying=!1}turnCursor(t){this.isPlaying?this.cursorTurnDelta+=t-this.progressTime:this.progressTime=t,this.onTurnCursor&&this.onTurnCursor(t)}}t.exports=l}},n={};function i(t){var o=n[t];if(void 0!==o)return o.exports;var r=n[t]={id:t,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}(()=>{i.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return i.d(e,{a:e}),e}})(),(()=>{i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}})(),(()=>{i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{i.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})(),(()=>{i.p=""})();var o={};return(()=>{"use strict";if(i.r(o),i.d(o,{MIDI:()=>n,Matcher:()=>c,MidiAudio:()=>N,MidiPlayer:()=>a(),MidiRoll:()=>lt,MidiUtils:()=>E,MusicNotation:()=>r}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(i.p=e[1])}var n=i(57),r=i(834),s=i(947),a=i.n(s),c=i(694);const l={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeArrayBuffer:function(t){const e=Math.ceil(3*t.length/4),n=new ArrayBuffer(e);return this.decode(t,n),n},decode:function(t,e){const n=this._keyStr.indexOf(t.charAt(t.length-1)),i=this._keyStr.indexOf(t.charAt(t.length-1));let o,r,s,a,c,l,u,h,d=Math.ceil(3*t.length/4);64===n&&d--,64===i&&d--;let f=0,p=0;for(o=e?new Uint8Array(e):new Uint8Array(d),t=t.replace(/[^A-Za-z0-9+/=]/g,""),f=0;f<d;f+=3)c=this._keyStr.indexOf(t.charAt(p++)),l=this._keyStr.indexOf(t.charAt(p++)),u=this._keyStr.indexOf(t.charAt(p++)),h=this._keyStr.indexOf(t.charAt(p++)),r=c<<2|l>>4,s=(15&l)<<4|u>>2,a=(3&u)<<6|h,o[f]=r,64!==u&&(o[f+1]=s),64!==h&&(o[f+2]=a);return o}},u=l,h=window.MIDI||{};window.MIDI=h;const d=function(t){h.api=t.api,h.setVolume=t.setVolume,h.programChange=t.programChange,h.noteOn=t.noteOn,h.noteOff=t.noteOff,h.chordOn=t.chordOn,h.chordOff=t.chordOff,h.stopAllNotes=t.stopAllNotes,h.getInput=t.getInput,h.getOutputs=t.getOutputs};(function(){var t=null,e=null;const n=h.WebMIDI={api:"webmidi"};n.setVolume=function(t,n){e.send([176+t,7,n])},n.programChange=function(t,n){e.send([192+t,n])},n.noteOn=function(t,n,i,o){e.send([144+t,n,i],1e3*o)},n.noteOff=function(t,n,i){e.send([128+t,n,0],1e3*i)},n.chordOn=function(t,n,i,o){for(var r=0;r<n.length;r++){var s=n[r];e.send([144+t,s,i],1e3*o)}},n.chordOff=function(t,n,i){for(var o=0;o<n.length;o++){var r=n[o];e.send([128+t,r,0],1e3*i)}},n.stopAllNotes=function(){for(var t=0;t<16;t++)e.send([176+t,123,0])},n.getInput=function(){return t.getInputs()},n.getOutputs=function(){return t.getOutputs()},n.connect=function(i){d(n),navigator.requestMIDIAccess().then(function(n){t=n;const o=[...t.outputs];e=o[i.outputDeviceIndex||0][1],i.callback&&i.callback()},function(){window.AudioContext||window.webkitAudioContext?i.api="webaudio":window.Audio?i.api="audiotag":i.api="flash",h.loadPlugin(i)})}})(),(window.AudioContext||window.webkitAudioContext)&&function(){if(window.MIDI&&window.MIDI.WebAudio)return void(h.WebAudio=window.MIDI.WebAudio);const t=window.AudioContext||window.webkitAudioContext,e=h.WebAudio={api:"webaudio",pendingInstruments:{}};let n;const i={};let o=127;const r={},s=function(t,e,i,o,s){const a=h.GeneralMIDI.byName[t],c=a.number,l=e[i];if(!h.Soundfont[t][l])return s(t);const d=h.Soundfont[t][l].split(",")[1],f=u.decodeArrayBuffer(d);n.decodeAudioData(f,function(n){let u=l;while(u.length<3)u+=" ";if("undefined"!==typeof h.loader&&h.loader.update(null,a.instrument+"<br>Processing: "+(i/87*100|0)+"%<br>"+u),n.id=l,o[i]=n,o.length===e.length){while(o.length){if(n=o.pop(),!n)continue;const t=h.keyToNote[n.id];r[c+""+t]=n}s(t)}})},a=t=>Math.max(.001*(t-performance.now())+n.currentTime,0);e.setVolume=function(t,e){o=e},e.empty=function(){return!Object.keys(r).length},e.hasPending=function(){return!Object.keys(e.pendingInstruments).length},e.programChange=function(t,e){h.channels[t].instrument=e},e.noteOn=function(t,e,s,c=0){if(!h.channels[t])return;const l=h.channels[t].instrument;if(!r[l+""+e])return;const u=a(c),d=n.createBufferSource();i[t+""+e]=d,d.buffer=r[l+""+e],d.connect(n.destination),n.createGain?d.gainNode=n.createGain():d.gainNode=n.createGainNode();const f=s/127*(o/127)*2-1;return d.gainNode.connect(n.destination),d.gainNode.gain.setTargetAtTime(Math.max(-1,f),n.currentTime,0),d.connect(d.gainNode),d.noteOn?d.noteOn(u):d.start(u),d},e.noteOff=function(t,e,n=0){const o=a(n),r=i[t+""+e];if(r){if(r.gainNode){const t=r.gainNode.gain;t.linearRampToValueAtTime(t.value,o),t.linearRampToValueAtTime(-1,o+.2)}r.noteOff?r.noteOff(o+.3):r.stop(o+.3),delete i[t+""+e]}},e.chordOn=function(t,n,i,o){for(var r,s={},a=0,c=n.length;a<c;a++)s[r=n[a]]=e.noteOn(t,r,i,o);return s},e.chordOff=function(t,n,i){for(var o,r={},s=0,a=n.length;s<a;s++)r[o=n[s]]=e.noteOff(t,o,i);return r},e.stopAllNotes=function(){for(var t in i){var e=0;e<n.currentTime&&(e+=n.currentTime),i[t].gainNode.gain.linearRampToValueAtTime(1,e),i[t].gainNode.gain.linearRampToValueAtTime(0,e+.2),delete i[t]}},e.connect=function(i){d(e),n=new t;const o=[];for(const t in h.keyToNote)o.push(t);const r=[],a={},c=function(t){for(var e in delete a[t],a)break;!e&&i.callback&&i.callback()};for(const t in h.Soundfont){a[t]=!0;for(let e=0;e<o.length;e++)s(t,o,e,r,c)}}}(),window.Audio&&function(){const t=h.AudioTag={api:"audiotag"};for(var e={},n=127,i=-1,o=[],r=[],s={},a=0;a<12;a++)o[a]=new Audio;var c=function(t,e){if(h.channels[t]){var a=h.channels[t].instrument,c=h.GeneralMIDI.byId[a].id,l=s[e];if(l){var u=c+""+l.id,d=(i+1)%o.length,f=o[d];r[d]=u,f.src=h.Soundfont[c][l.id],f.volume=n/127,f.play(),i=d}}},l=function(t,e){if(h.channels[t]){var n=h.channels[t].instrument,a=h.GeneralMIDI.byId[n].id,c=s[e];if(c)for(var l=a+""+c.id,u=0;u<o.length;u++){var d=(u+i+1)%o.length,f=r[d];if(f&&f===l)return o[d].pause(),void(r[d]=null)}}};t.programChange=function(t,e){h.channels[t].instrument=e},t.setVolume=function(t,e){n=e},t.noteOn=function(t,n,i,o){var r=e[n];if(s[r])return o?window.setTimeout(function(){c(t,r)},1e3*o):void c(t,r)},t.noteOff=function(t,n,i){var o=e[n];if(s[o])return i?setTimeout(function(){l(t,o)},1e3*i):void l(t,o)},t.chordOn=function(t,n,i,o){for(var r=0;r<n.length;r++){var a=n[r],l=e[a];if(s[l]){if(o)return window.setTimeout(function(){c(t,l)},1e3*o);c(t,l)}}},t.chordOff=function(t,n,i){for(var o=0;o<n.length;o++){var r=n[o],a=e[r];if(s[a]){if(i)return window.setTimeout(function(){l(t,a)},1e3*i);l(t,a)}}},t.stopAllNotes=function(){for(var t=0,e=o.length;t<e;t++)o[t].pause()},t.connect=function(n){for(var i in console.log("AudioTag.connect:",n),h.keyToNote)e[h.keyToNote[i]]=i,s[i]={id:i};d(t),n.callback&&n.callback()}}(),h.GeneralMIDI=function(t){var e=function(t){return t.replace(/[^a-z0-9 ]/gi,"").replace(/[ ]/g,"_").toLowerCase()},n={byName:{},byId:{},byCategory:{}};for(var i in t)for(var o=t[i],r=0,s=o.length;r<s;r++){var a=o[r];if(a){var c=parseInt(a.substr(0,a.indexOf(" ")),10);a=a.replace(c+" ",""),n.byId[--c]=n.byName[e(a)]=n.byCategory[e(i)]={id:e(a),instrument:a,number:c,category:i}}}return n}({Piano:["1 Acoustic Grand Piano","2 Bright Acoustic Piano","3 Electric Grand Piano","4 Honky-tonk Piano","5 Electric Piano 1","6 Electric Piano 2","7 Harpsichord","8 Clavinet"],"Chromatic Percussion":["9 Celesta","10 Glockenspiel","11 Music Box","12 Vibraphone","13 Marimba","14 Xylophone","15 Tubular Bells","16 Dulcimer"],Organ:["17 Drawbar Organ","18 Percussive Organ","19 Rock Organ","20 Church Organ","21 Reed Organ","22 Accordion","23 Harmonica","24 Tango Accordion"],Guitar:["25 Acoustic Guitar (nylon)","26 Acoustic Guitar (steel)","27 Electric Guitar (jazz)","28 Electric Guitar (clean)","29 Electric Guitar (muted)","30 Overdriven Guitar","31 Distortion Guitar","32 Guitar Harmonics"],Bass:["33 Acoustic Bass","34 Electric Bass (finger)","35 Electric Bass (pick)","36 Fretless Bass","37 Slap Bass 1","38 Slap Bass 2","39 Synth Bass 1","40 Synth Bass 2"],Strings:["41 Violin","42 Viola","43 Cello","44 Contrabass","45 Tremolo Strings","46 Pizzicato Strings","47 Orchestral Harp","48 Timpani"],Ensemble:["49 String Ensemble 1","50 String Ensemble 2","51 Synth Strings 1","52 Synth Strings 2","53 Choir Aahs","54 Voice Oohs","55 Synth Choir","56 Orchestra Hit"],Brass:["57 Trumpet","58 Trombone","59 Tuba","60 Muted Trumpet","61 French Horn","62 Brass Section","63 Synth Brass 1","64 Synth Brass 2"],Reed:["65 Soprano Sax","66 Alto Sax","67 Tenor Sax","68 Baritone Sax","69 Oboe","70 English Horn","71 Bassoon","72 Clarinet"],Pipe:["73 Piccolo","74 Flute","75 Recorder","76 Pan Flute","77 Blown Bottle","78 Shakuhachi","79 Whistle","80 Ocarina"],"Synth Lead":["81 Lead 1 (square)","82 Lead 2 (sawtooth)","83 Lead 3 (calliope)","84 Lead 4 (chiff)","85 Lead 5 (charang)","86 Lead 6 (voice)","87 Lead 7 (fifths)","88 Lead 8 (bass + lead)"],"Synth Pad":["89 Pad 1 (new age)","90 Pad 2 (warm)","91 Pad 3 (polysynth)","92 Pad 4 (choir)","93 Pad 5 (bowed)","94 Pad 6 (metallic)","95 Pad 7 (halo)","96 Pad 8 (sweep)"],"Synth Effects":["97 FX 1 (rain)","98 FX 2 (soundtrack)","99 FX 3 (crystal)","100 FX 4 (atmosphere)","101 FX 5 (brightness)","102 FX 6 (goblins)","103 FX 7 (echoes)","104 FX 8 (sci-fi)"],Ethnic:["105 Sitar","106 Banjo","107 Shamisen","108 Koto","109 Kalimba","110 Bagpipe","111 Fiddle","112 Shanai"],Percussive:["113 Tinkle Bell","114 Agogo","115 Steel Drums","116 Woodblock","117 Taiko Drum","118 Melodic Tom","119 Synth Drum"],"Sound effects":["120 Reverse Cymbal","121 Guitar Fret Noise","122 Breath Noise","123 Seashore","124 Bird Tweet","125 Telephone Ring","126 Helicopter","127 Applause","128 Gunshot"]}),h.channels=function(){for(var t={},e=0;e<16;e++)t[e]={instrument:0,mute:!1,mono:!1,omni:!1,solo:!1};return t}(),h.pianoKeyOffset=21,h.keyToNote={},h.noteToKey={},function(){for(var t=21,e=108,n=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],i=t;i<=e;i++){var o=(i-12)/12|0,r=n[i%12]+o;h.keyToNote[r]=i,h.noteToKey[i]=r}}();const f=h,p={};let m=0;const g=function(t){m++;const e=new Audio,n=t.split(";")[0];e.id="audio",e.setAttribute("preload","auto"),e.setAttribute("audiobuffer",!0),e.addEventListener("error",function(){p[n]=!1,m--},!1),e.addEventListener("canplaythrough",function(){p[n]=!0,m--},!1),e.src="data:"+t,document.body.appendChild(e)};function y(t){if("undefined"===typeof Audio)return t({});const e=new Audio;if("undefined"===typeof e.canPlayType)return t(p);let n=e.canPlayType('audio/ogg; codecs="vorbis"');n="probably"===n||"maybe"===n;let i=e.canPlayType("audio/mpeg");if(i="probably"===i||"maybe"===i,!n&&!i)return void t(p);n&&g("audio/ogg;base64,T2dnUwACAAAAAAAAAADqnjMlAAAAAOyyzPIBHgF2b3JiaXMAAAAAAUAfAABAHwAAQB8AAEAfAACZAU9nZ1MAAAAAAAAAAAAA6p4zJQEAAAANJGeqCj3//////////5ADdm9yYmlzLQAAAFhpcGguT3JnIGxpYlZvcmJpcyBJIDIwMTAxMTAxIChTY2hhdWZlbnVnZ2V0KQAAAAABBXZvcmJpcw9CQ1YBAAABAAxSFCElGVNKYwiVUlIpBR1jUFtHHWPUOUYhZBBTiEkZpXtPKpVYSsgRUlgpRR1TTFNJlVKWKUUdYxRTSCFT1jFloXMUS4ZJCSVsTa50FkvomWOWMUYdY85aSp1j1jFFHWNSUkmhcxg6ZiVkFDpGxehifDA6laJCKL7H3lLpLYWKW4q91xpT6y2EGEtpwQhhc+211dxKasUYY4wxxsXiUyiC0JBVAAABAABABAFCQ1YBAAoAAMJQDEVRgNCQVQBABgCAABRFcRTHcRxHkiTLAkJDVgEAQAAAAgAAKI7hKJIjSZJkWZZlWZameZaouaov+64u667t6roOhIasBACAAAAYRqF1TCqDEEPKQ4QUY9AzoxBDDEzGHGNONKQMMogzxZAyiFssLqgQBKEhKwKAKAAAwBjEGGIMOeekZFIi55iUTkoDnaPUUcoolRRLjBmlEluJMYLOUeooZZRCjKXFjFKJscRUAABAgAMAQICFUGjIigAgCgCAMAYphZRCjCnmFHOIMeUcgwwxxiBkzinoGJNOSuWck85JiRhjzjEHlXNOSuekctBJyaQTAAAQ4AAAEGAhFBqyIgCIEwAwSJKmWZomipamiaJniqrqiaKqWp5nmp5pqqpnmqpqqqrrmqrqypbnmaZnmqrqmaaqiqbquqaquq6nqrZsuqoum65q267s+rZru77uqapsm6or66bqyrrqyrbuurbtS56nqqKquq5nqq6ruq5uq65r25pqyq6purJtuq4tu7Js664s67pmqq5suqotm64s667s2rYqy7ovuq5uq7Ks+6os+75s67ru2rrwi65r66os674qy74x27bwy7ouHJMnqqqnqq7rmarrqq5r26rr2rqmmq5suq4tm6or26os67Yry7aumaosm64r26bryrIqy77vyrJui67r66Ys67oqy8Lu6roxzLat+6Lr6roqy7qvyrKuu7ru+7JuC7umqrpuyrKvm7Ks+7auC8us27oxuq7vq7It/KosC7+u+8Iy6z5jdF1fV21ZGFbZ9n3d95Vj1nVhWW1b+V1bZ7y+bgy7bvzKrQvLstq2scy6rSyvrxvDLux8W/iVmqratum6um7Ksq/Lui60dd1XRtf1fdW2fV+VZd+3hV9pG8OwjK6r+6os68Jry8ov67qw7MIvLKttK7+r68ow27qw3L6wLL/uC8uq277v6rrStXVluX2fsSu38QsAABhwAAAIMKEMFBqyIgCIEwBAEHIOKQahYgpCCKGkEEIqFWNSMuakZM5JKaWUFEpJrWJMSuaclMwxKaGUlkopqYRSWiqlxBRKaS2l1mJKqcVQSmulpNZKSa2llGJMrcUYMSYlc05K5pyUklJrJZXWMucoZQ5K6iCklEoqraTUYuacpA46Kx2E1EoqMZWUYgupxFZKaq2kFGMrMdXUWo4hpRhLSrGVlFptMdXWWqs1YkxK5pyUzDkqJaXWSiqtZc5J6iC01DkoqaTUYiopxco5SR2ElDLIqJSUWiupxBJSia20FGMpqcXUYq4pxRZDSS2WlFosqcTWYoy1tVRTJ6XFklKMJZUYW6y5ttZqDKXEVkqLsaSUW2sx1xZjjqGkFksrsZWUWmy15dhayzW1VGNKrdYWY40x5ZRrrT2n1mJNMdXaWqy51ZZbzLXnTkprpZQWS0oxttZijTHmHEppraQUWykpxtZara3FXEMpsZXSWiypxNhirLXFVmNqrcYWW62ltVprrb3GVlsurdXcYqw9tZRrrLXmWFNtBQAADDgAAASYUAYKDVkJAEQBAADGMMYYhEYpx5yT0ijlnHNSKucghJBS5hyEEFLKnINQSkuZcxBKSSmUklJqrYVSUmqttQIAAAocAAACbNCUWByg0JCVAEAqAIDBcTRNFFXVdX1fsSxRVFXXlW3jVyxNFFVVdm1b+DVRVFXXtW3bFn5NFFVVdmXZtoWiqrqybduybgvDqKqua9uybeuorqvbuq3bui9UXVmWbVu3dR3XtnXd9nVd+Bmzbeu2buu+8CMMR9/4IeTj+3RCCAAAT3AAACqwYXWEk6KxwEJDVgIAGQAAgDFKGYUYM0gxphhjTDHGmAAAgAEHAIAAE8pAoSErAoAoAADAOeecc84555xzzjnnnHPOOeecc44xxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY0wAwE6EA8BOhIVQaMhKACAcAABACCEpKaWUUkoRU85BSSmllFKqFIOMSkoppZRSpBR1lFJKKaWUIqWgpJJSSimllElJKaWUUkoppYw6SimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaVUSimllFJKKaWUUkoppRQAYPLgAACVYOMMK0lnhaPBhYasBAByAwAAhRiDEEJpraRUUkolVc5BKCWUlEpKKZWUUqqYgxBKKqmlklJKKbXSQSihlFBKKSWUUkooJYQQSgmhlFRCK6mEUkoHoYQSQimhhFRKKSWUzkEoIYUOQkmllNRCSB10VFIpIZVSSiklpZQ6CKGUklJLLZVSWkqpdBJSKamV1FJqqbWSUgmhpFZKSSWl0lpJJbUSSkklpZRSSymFVFJJJYSSUioltZZaSqm11lJIqZWUUkqppdRSSiWlkEpKqZSSUmollZRSaiGVlEpJKaTUSimlpFRCSamlUlpKLbWUSkmptFRSSaWUlEpJKaVSSksppRJKSqmllFpJKYWSUkoplZJSSyW1VEoKJaWUUkmptJRSSymVklIBAEAHDgAAAUZUWoidZlx5BI4oZJiAAgAAQABAgAkgMEBQMApBgDACAQAAAADAAAAfAABHARAR0ZzBAUKCwgJDg8MDAAAAAAAAAAAAAACAT2dnUwAEAAAAAAAAAADqnjMlAgAAADzQPmcBAQA="),i&&g("audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");const o=(new Date).getTime(),r=window.setInterval(function(){const e=(new Date).getTime(),n=e-o>5e3;m&&!n||(window.clearInterval(r),t(p))},1)}const b=function(){return this.loaded={},this.loading={},this};b.prototype.add=function(t){const e=this;"string"===typeof t&&(t={src:t});let n=t.srcs;"undefined"===typeof n&&(n=[{src:t.src,verify:t.verify}]);const i=document.getElementsByTagName("head")[0],o=function(t,n){e.loaded[t.src]||n&&"undefined"===typeof window[n]||(e.loaded[t.src]=!0,e.loading[t.src]&&e.loading[t.src](),delete e.loading[t.src],t.callback&&t.callback(),"undefined"!==typeof getNext&&getNext())},r=[],s=function(n){if("string"===typeof n&&(n={src:n,verify:t.verify}),/([\w\d.])$/.test(n.verify))if(n.test=n.verify,"object"===typeof n.test)for(const t in n.test)r.push(n.test[t]);else r.push(n.test);if(e.loaded[n.src])return;const s=document.createElement("script");s.onreadystatechange=function(){"loaded"!==this.readyState&&"complete"!==this.readyState||o(n)},s.onload=function(){o(n)},s.onerror=function(){},s.setAttribute("type","text/javascript"),s.setAttribute("src",n.src),i.appendChild(s),e.loading[n.src]=function(){}},a=function(e){if(e)o(e,e.test);else for(let t=0;t<n.length;t++)o(n[t],n[t].test);let i=!0;for(let t=0;t<r.length;t++){let e=r[t];if(e&&-1!==e.indexOf(".")){e=e.split(".");const t=window[e[0]];if("undefined"===typeof t)continue;2===e.length?"undefined"===typeof t[e[1]]&&(i=!1):3===e.length&&"undefined"===typeof t[e[1]][e[2]]&&(i=!1)}else"undefined"===typeof window[e]&&(i=!1)}!t.strictOrder&&i?t.callback&&t.callback():setTimeout(function(){a(e)},10)};if(t.strictOrder){let i=-1;const o=function(){if(i++,n[i]){const t=n[i],r=t.src;e.loading[r]?e.loading[r]=function(){t.callback&&t.callback(),o()}:e.loaded[r]?o():(s(t),a(t))}else t.callback&&t.callback()};o()}else{for(let t=0;t<n.length;t++)s(n[t]);a()}};const v=new b,w=v;function k(t){fetch(t.url,t.data).then(t=>t.text()).then(e=>{t.onload&&t.onload({responseText:e})}).catch(e=>{console.warn("DOMLoader.sendRequest error:",e),t.onerror&&t.onerror(e,!1)})}const A={script:w,sendRequest:k};f.Soundfont=window.MIDI&&window.MIDI.Soundfont||{},window.MIDI=f,f.audioDetect=y;const S=!1,x={};f.loadPlugin=function(t={}){"function"===typeof t&&(t={callback:t});var e=t.instruments||t.instrument||"acoustic_grand_piano";"object"!==typeof e&&(e=[e]);for(var n=0;n<e.length;n++){var i=e[n];"number"===typeof i&&(e[n]=f.GeneralMIDI.byId[i])}if(f.soundfontUrl=t.soundfontUrl||f.soundfontUrl||"./soundfont/",f.audioDetect(function(n){var i="";if(i=I[t.api]?t.api:S&&navigator.requestMIDIAccess?"webmidi":window.webkitAudioContext||window.AudioContext?"webaudio":window.Audio?"audiotag":"flash",!x[i])return;let o;o=t.targetFormat?t.targetFormat:n["audio/ogg"]?"ogg":"mp3",f.lang=i,f.supports=n,x[i](o,e,t)}),!t.callback)return new Promise(e=>t.callback=e)},x.webmidi=function(t,e,n){f.loader&&f.loader.message("Web MIDI API..."),f.WebMIDI.connect(n)},x.flash=function(t,e,n){f.loader&&f.loader.message("Flash API..."),A.script.add({src:n.soundManagerUrl||"./inc/SoundManager2/script/soundmanager2.js",verify:"SoundManager",callback:function(){f.Flash.connect(e,n)}})},x.audiotag=function(t,e,n){f.loader&&f.loader.message("HTML5 Audio API...");const i=M({items:e,getNext(e){f.Soundfont[e]?i.getNext():A.sendRequest({url:f.soundfontUrl+e+"-"+t+".js",onprogress:q,onload(t){T(t.responseText),f.loader&&f.loader.update(null,"Downloading",100),i.getNext()}})},onComplete(){f.AudioTag.connect(n)}})},x.webaudio=function(t,e,n){f.loader&&f.loader.message("Web Audio API...");const i=M({items:e,getNext(n){f.Soundfont[n]?i.getNext():(f.WebAudio.pendingInstruments[e]=!0,A.sendRequest({url:f.soundfontUrl+n+"-"+t+".js",onprogress:q,onload(t){T(t.responseText),f.loader&&f.loader.update(null,"Downloading...",100),i.getNext(),delete f.WebAudio.pendingInstruments[e]},onerror(t){f.loader&&f.loader.update(t,"Download failed."),delete f.WebAudio.pendingInstruments[e]}}))},onComplete(){f.WebAudio.connect(n)}})};const I={webmidi:!0,webaudio:!0,audiotag:!0,flash:!0},T=function(t){var e=document.createElement("script");e.language="javascript",e.type="text/javascript",e.text=t,document.body.appendChild(e)},q=function(t){this.totalSize||(this.getResponseHeader("Content-Length-Raw")?this.totalSize=parseInt(this.getResponseHeader("Content-Length-Raw")):this.totalSize=t.total);const e=this.totalSize?Math.round(t.loaded/this.totalSize*100):"";f.loader&&f.loader.update(null,"Downloading...",e)},M=function(t){const e={queue:[]};for(const n in t.items)t.items.hasOwnProperty(n)&&e.queue.push(t.items[n]);return e.getNext=function(){if(!e.queue.length)return t.onComplete();t.getNext(e.queue.shift())},setTimeout(e.getNext,1),e},N=(f.loadPlugin,f);var E=i(69),C=i(893);const O=["viewBox","height"],B=["transform"],P={key:0,class:"progress"},U=["height","width"],D=["x1","x2","y1"],F={key:1},V=["x1","x2","y1"],_=["x2","y1","y2"],j={key:0,class:"scales"},R=["height"],K=["y1"],W=["x2","y1","y2"],J=["y1","y2"],Z=["y"],L=["transform"],Y=["x1","x2","y1","y2"],G=["x","y"];function z(t,e,n,i,o,r){return(0,C.openBlock)(),(0,C.createElementBlock)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:r.viewBox,height:n.height,class:"mw-midi-roll",onClick:e[0]||(e[0]=(...t)=>r.onClickCanvas&&r.onClickCanvas(...t)),onMousewheel:e[1]||(e[1]=(...t)=>r.onMouseWheel&&r.onMouseWheel(...t))},[(0,C.createElementVNode)("g",{transform:`translate(${-r.xScroll}, 0)`},[r.progressTime&&o.notation?((0,C.openBlock)(),(0,C.createElementBlock)("g",P,[(0,C.createElementVNode)("rect",{x:0,y:-120,height:121-o.notation.keyRange.low,width:r.progressTime*n.timeScale},null,8,U),(0,C.createElementVNode)("line",{x1:r.progressTime*n.timeScale,x2:r.progressTime*n.timeScale,y1:1-o.notation.keyRange.low,y2:"-120"},null,8,D)])):(0,C.createCommentVNode)("",!0),o.notation?((0,C.openBlock)(),(0,C.createElementBlock)("g",F,[((0,C.openBlock)(!0),(0,C.createElementBlock)(C.Fragment,null,(0,C.renderList)(o.notation.bars,(t,e)=>((0,C.openBlock)(),(0,C.createElementBlock)("g",{class:"bar measure",key:e},[0===t.index?((0,C.openBlock)(),(0,C.createElementBlock)("line",{key:0,x1:t.time*n.timeScale,x2:t.time*n.timeScale,y1:1-o.notation.keyRange.low,y2:"-120"},null,8,V)):(0,C.createCommentVNode)("",!0)]))),128)),((0,C.openBlock)(!0),(0,C.createElementBlock)(C.Fragment,null,(0,C.renderList)(r.pitchScales,t=>((0,C.openBlock)(),(0,C.createElementBlock)("g",{class:"bar pitch-group",key:`p-${t}`},[(0,C.createElementVNode)("line",{x1:0,x2:n.timeScale*o.notation.endTime,y1:1-t,y2:1-t},null,8,_)]))),128))])):(0,C.createCommentVNode)("",!0),o.notation?((0,C.openBlock)(),(0,C.createBlock)((0,C.resolveDynamicComponent)(o.SvgPianoRoll),{key:2,notation:o.notation,timeScale:n.timeScale,pitchScale:1},null,8,["notation","timeScale"])):(0,C.createCommentVNode)("",!0)],8,B),o.notation?((0,C.openBlock)(),(0,C.createElementBlock)("g",j,[(0,C.createElementVNode)("rect",{class:"pitch-padding",x:-10,y:-120,width:10,height:121-o.notation.keyRange.low},null,8,R),(0,C.createElementVNode)("line",{x1:"0",x2:"0",y1:1-o.notation.keyRange.low,y2:"-120"},null,8,K),(0,C.createElementVNode)("line",{x1:"0",x2:n.timeScale*o.notation.endTime-r.xScroll,y1:1-o.notation.keyRange.low,y2:1-o.notation.keyRange.low},null,8,W),((0,C.openBlock)(!0),(0,C.createElementBlock)(C.Fragment,null,(0,C.renderList)(r.pitchScales,t=>((0,C.openBlock)(),(0,C.createElementBlock)("g",{class:"pitch-bar",key:`p-${t}`},[(0,C.createElementVNode)("line",{x1:"-.8",x2:"0",y1:.5-t,y2:.5-t},null,8,J),(0,C.createElementVNode)("text",{x:"-2",y:1-t},(0,C.toDisplayString)(t),9,Z)]))),128)),(0,C.createElementVNode)("g",{transform:`translate(${-r.xScroll}, 0)`},[((0,C.openBlock)(!0),(0,C.createElementBlock)(C.Fragment,null,(0,C.renderList)(r.timeScales,t=>((0,C.openBlock)(),(0,C.createElementBlock)("g",{class:"time-bar",key:`t-${t}`},[(0,C.createElementVNode)("line",{x1:t*n.timeScale,x2:t*n.timeScale,y1:1-o.notation.keyRange.low,y2:1.8-o.notation.keyRange.low},null,8,Y),(0,C.createElementVNode)("text",{x:t*n.timeScale,y:4-o.notation.keyRange.low},(0,C.toDisplayString)(.001*t)+"s",9,G)]))),128))],8,L)])):(0,C.createCommentVNode)("",!0)],40,O)}const Q={class:"piano-roll-root mw-svg-piano-roll"},X=["transform"],H=["width","height","onClick"],$=["y2"],tt={key:0};function et(t,e,n,i,o,r){return(0,C.openBlock)(),(0,C.createElementBlock)("g",Q,[((0,C.openBlock)(!0),(0,C.createElementBlock)(C.Fragment,null,(0,C.renderList)(r.notationObj.notes,(t,e)=>((0,C.openBlock)(),(0,C.createElementBlock)("g",{key:e,class:"note",transform:`translate(${t.start*n.timeScale}, ${-t.pitch*n.pitchScale})`},[(0,C.createElementVNode)("rect",{width:t.duration*n.timeScale,height:n.pitchScale,onClick:e=>r.onClickNote(t),class:(0,C.normalizeClass)([{focus:t.index===n.focusNoteIndex,on:t.on},t.classes])},null,10,H),(0,C.createElementVNode)("line",{x1:0,x2:0,y1:0,y2:n.pitchScale},null,8,$),n.tooltips?((0,C.openBlock)(),(0,C.createElementBlock)("title",tt,"\n\t\t\t\tp: "+(0,C.toDisplayString)(t.pitch)+'\n\t\t\t\t<tspan v-if="note.id">\n\t\t\t\t\tid: '+(0,C.toDisplayString)(t.id)+"\n\t\t\t\t</tspan>\n\t\t\t",1)):(0,C.createCommentVNode)("",!0)],8,X))),128))])}const nt={name:"svg-piano-roll",props:{notation:Object,notations:Object,timeScale:{type:Number,default:.001},pitchScale:{type:Number,default:1},focusNoteIndex:Number,tooltips:{type:Boolean,default:!1}},computed:{notationObj(){return this.notation?this.notation:this.notations?(console.warn("property of 'notations' deprecated, replace by 'notation'."),this.notations):(console.warn("property of 'notation' is required."),null)}},methods:{onClickNote(t){this.$emit("clickNote",t)}}};i(429);var it=i(262);const ot=(0,it.A)(nt,[["render",et]]),rt=ot,st={left:3,right:1},at={name:"midi-roll",props:{midiURL:String,player:Object,height:{type:Number,default:200},width:Number,timeScale:{type:Number,default:.001}},components:{"svg-piano-roll":rt},data(){return{notation:null,timeScroll:0,SvgPianoRoll:rt}},computed:{widthLimited(){return Number.isFinite(this.width)},aspectRatio(){return this.widthLimited?this.width/this.height:1.6},viewHeight(){if(this.notation){const{low:t,high:e}=this.notation.keyRange;return e-t+5}return 90},justifyWidth(){const t=this.notation?this.notation.endTime:this.height*this.aspectRatio;return t*this.timeScale+st.left+st.right},viewWidth(){return this.widthLimited?this.width*this.viewHeight/this.height:this.justifyWidth},viewBox(){return`-${st.left} ${this.notation?-this.notation.keyRange.high-1:0} ${this.viewWidth} ${this.viewHeight}`},pitchScales(){return this.notation?Array(9).fill().map((t,e)=>12*e).filter(t=>t>=this.notation.keyRange.low):[]},timeScales(){return this.notation?Array(Math.ceil(this.notation.endTime/15e3)).fill().map((t,e)=>15e3*e):[]},progressTime(){return this.player?this.player.progressTime:null},visibleTimeSpan(){return this.widthLimited?(this.viewWidth-(st.left+st.right))/this.timeScale:1/0},xScroll(){return this.timeScroll*this.timeScale}},created(){this.load()},methods:{async load(){if(this.notation=null,this.player)this.notation=this.player.notation,this.updateNoteStatus(),this.$forceUpdate();else if(this.midiURL){const t=await(await fetch(this.midiURL)).arrayBuffer(),e=(0,n.parseMidiData)(t);this.notation=r.Notation.parseMidi(e)}},updateNoteStatus(){if(!this.notation)return;const t=Number.isFinite(this.progressTime);for(const e of this.notation.notes)e.on=t&&e.start<this.progressTime&&e.start+e.duration>this.progressTime},onClickCanvas(t){if(this.player){const e=(this.notation.keyRange.high-this.notation.keyRange.low+5)/this.height,n=t.offsetX*e-st.left+this.xScroll,i=n/this.timeScale;i>=0&&i<this.notation.endTime&&this.player.turnCursor(i)}},onMouseWheel(t){this.timeScroll+=.4*t.deltaY/this.timeScale},adjustTimeScroll(){this.progressTime-this.timeScroll>.6*this.visibleTimeSpan?this.timeScroll=Math.max(Math.min(this.progressTime-.6*this.visibleTimeSpan,this.notation.endTime-this.visibleTimeSpan),0):this.progressTime-this.timeScroll<.4*this.visibleTimeSpan&&(this.timeScroll=Math.max(this.progressTime-.4*this.visibleTimeSpan,0))}},watch:{midiURL:"load",player:"load",progressTime(){this.updateNoteStatus(),this.widthLimited&&this.adjustTimeScroll()}}};i(219);const ct=(0,it.A)(at,[["render",z]]),lt=ct})(),o})());
|
|
2
|
+
//# sourceMappingURL=musicWidgetsBrowser.umd.min.js.map
|