(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["musicWidgetsBrowser"]=e():t["musicWidgetsBrowser"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fae3")}({"0241":function(t,e,n){const r=n("b37a"),i=n("33e9"),o=800,u=.24*o,a=t=>Math.tanh(t/u),s=function(t,e,{softIndexFactor:n=1}={}){e=Number(e);const r=t[e];if(e>0){const i=t[e-1];console.assert(null!=r.start,"note.start is null",r),console.assert(null!=i.start,"lastNote.start is null",i),r.deltaSi=a((r.start-i.start)*n),r.softIndex=i.softIndex+r.deltaSi,console.assert(!Number.isNaN(r.deltaSi),"note.deltaSi is NaN.",r.start,i.start)}else r.softIndex=0,r.deltaSi=0},c=function(t,e,n=r.zero()){t.matches=[];const i=e.pitchMap[t.pitch];if(i)for(const o of i){const e=new r(t,o);n&&e.evaluatePrev(n),t.matches.push(e)}},l=function(t,{softIndexFactor:e=1}={}){for(let n=0;nnew Promise(t=>requestAnimationFrame(t));class o{constructor(t,{cacheSpan:e=600,onMidi:n,onPlayFinish:i,onTurnCursor:o}={}){let u;this.cacheSpan=e,this.onMidi=n,this.onPlayFinish=i,this.onTurnCursor=o,u=t.notes&&Number.isFinite(t.endTime)?t:r.parseMidi(t),this.notation=u,this.events=u.events,this.isPlaying=!1,this.progressTime=0,this.startTime=performance.now(),this.duration=u.endTime,this.cursorTurnDelta=0,console.assert(u.tempos&&u.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)}async play({nextFrame:t=i}={}){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(;nthis.progressTime+this.cacheSpan)break;"channel"===t.data.type&&this.startTime+t.time>=e&&this.onMidi&&this.onMidi(t.data,this.startTime+t.time)}if(await 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+tthis.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=o},"2ef0":function(t,e,n){(function(t,r){var i; /** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(){var o,u="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",d=1,v=2,g=4,m=1,y=2,w=1,_=2,b=4,A=8,k=16,x=32,I=64,S=128,T=256,q=512,E=30,C="...",O=800,M=16,N=1,B=2,j=3,U=1/0,P=9007199254740991,R=17976931348623157e292,F=NaN,D=4294967295,W=D-1,K=D>>>1,V=[["ary",S],["bind",w],["bindKey",_],["curry",A],["curryRight",k],["flip",q],["partial",x],["partialRight",I],["rearg",T]],z="[object Arguments]",L="[object Array]",Z="[object AsyncFunction]",J="[object Boolean]",G="[object Date]",Y="[object DOMException]",Q="[object Error]",X="[object Function]",H="[object GeneratorFunction]",$="[object Map]",tt="[object Number]",et="[object Null]",nt="[object Object]",rt="[object Promise]",it="[object Proxy]",ot="[object RegExp]",ut="[object Set]",at="[object String]",st="[object Symbol]",ct="[object Undefined]",lt="[object WeakMap]",ft="[object WeakSet]",ht="[object ArrayBuffer]",pt="[object DataView]",dt="[object Float32Array]",vt="[object Float64Array]",gt="[object Int8Array]",mt="[object Int16Array]",yt="[object Int32Array]",wt="[object Uint8Array]",_t="[object Uint8ClampedArray]",bt="[object Uint16Array]",At="[object Uint32Array]",kt=/\b__p \+= '';/g,xt=/\b(__p \+=) '' \+/g,It=/(__e\(.*?\)|\b__t\)) \+\n'';/g,St=/&(?:amp|lt|gt|quot|#39);/g,Tt=/[&<>"']/g,qt=RegExp(St.source),Et=RegExp(Tt.source),Ct=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,Mt=/<%=([\s\S]+?)%>/g,Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Bt=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ut=/[\\^$.*+?()[\]{}|]/g,Pt=RegExp(Ut.source),Rt=/^\s+/,Ft=/\s/,Dt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Wt=/\{\n\/\* \[wrapped with (.+)\] \*/,Kt=/,? & /,Vt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zt=/[()=,{}\[\]\/\s]/,Lt=/\\(\\)?/g,Zt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Jt=/\w*$/,Gt=/^[-+]0x[0-9a-f]+$/i,Yt=/^0b[01]+$/i,Qt=/^\[object .+?Constructor\]$/,Xt=/^0o[0-7]+$/i,Ht=/^(?:0|[1-9]\d*)$/,$t=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,te=/($^)/,ee=/['\n\r\u2028\u2029\\]/g,ne="\\ud800-\\udfff",re="\\u0300-\\u036f",ie="\\ufe20-\\ufe2f",oe="\\u20d0-\\u20ff",ue=re+ie+oe,ae="\\u2700-\\u27bf",se="a-z\\xdf-\\xf6\\xf8-\\xff",ce="\\xac\\xb1\\xd7\\xf7",le="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fe="\\u2000-\\u206f",he=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="A-Z\\xc0-\\xd6\\xd8-\\xde",de="\\ufe0e\\ufe0f",ve=ce+le+fe+he,ge="['’]",me="["+ne+"]",ye="["+ve+"]",we="["+ue+"]",_e="\\d+",be="["+ae+"]",Ae="["+se+"]",ke="[^"+ne+ve+_e+ae+se+pe+"]",xe="\\ud83c[\\udffb-\\udfff]",Ie="(?:"+we+"|"+xe+")",Se="[^"+ne+"]",Te="(?:\\ud83c[\\udde6-\\uddff]){2}",qe="[\\ud800-\\udbff][\\udc00-\\udfff]",Ee="["+pe+"]",Ce="\\u200d",Oe="(?:"+Ae+"|"+ke+")",Me="(?:"+Ee+"|"+ke+")",Ne="(?:"+ge+"(?:d|ll|m|re|s|t|ve))?",Be="(?:"+ge+"(?:D|LL|M|RE|S|T|VE))?",je=Ie+"?",Ue="["+de+"]?",Pe="(?:"+Ce+"(?:"+[Se,Te,qe].join("|")+")"+Ue+je+")*",Re="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fe="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",De=Ue+je+Pe,We="(?:"+[be,Te,qe].join("|")+")"+De,Ke="(?:"+[Se+we+"?",we,Te,qe,me].join("|")+")",Ve=RegExp(ge,"g"),ze=RegExp(we,"g"),Le=RegExp(xe+"(?="+xe+")|"+Ke+De,"g"),Ze=RegExp([Ee+"?"+Ae+"+"+Ne+"(?="+[ye,Ee,"$"].join("|")+")",Me+"+"+Be+"(?="+[ye,Ee+Oe,"$"].join("|")+")",Ee+"?"+Oe+"+"+Ne,Ee+"+"+Be,Fe,Re,_e,We].join("|"),"g"),Je=RegExp("["+Ce+ne+ue+de+"]"),Ge=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ye=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qe=-1,Xe={};Xe[dt]=Xe[vt]=Xe[gt]=Xe[mt]=Xe[yt]=Xe[wt]=Xe[_t]=Xe[bt]=Xe[At]=!0,Xe[z]=Xe[L]=Xe[ht]=Xe[J]=Xe[pt]=Xe[G]=Xe[Q]=Xe[X]=Xe[$]=Xe[tt]=Xe[nt]=Xe[ot]=Xe[ut]=Xe[at]=Xe[lt]=!1;var He={};He[z]=He[L]=He[ht]=He[pt]=He[J]=He[G]=He[dt]=He[vt]=He[gt]=He[mt]=He[yt]=He[$]=He[tt]=He[nt]=He[ot]=He[ut]=He[at]=He[st]=He[wt]=He[_t]=He[bt]=He[At]=!0,He[Q]=He[X]=He[lt]=!1;var $e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},tn={"&":"&","<":"<",">":">",'"':""","'":"'"},en={"&":"&","<":"<",">":">",""":'"',"'":"'"},nn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rn=parseFloat,on=parseInt,un="object"==typeof t&&t&&t.Object===Object&&t,an="object"==typeof self&&self&&self.Object===Object&&self,sn=un||an||Function("return this")(),cn=e&&!e.nodeType&&e,ln=cn&&"object"==typeof r&&r&&!r.nodeType&&r,fn=ln&&ln.exports===cn,hn=fn&&un.process,pn=function(){try{var t=ln&&ln.require&&ln.require("util").types;return t||hn&&hn.binding&&hn.binding("util")}catch(e){}}(),dn=pn&&pn.isArrayBuffer,vn=pn&&pn.isDate,gn=pn&&pn.isMap,mn=pn&&pn.isRegExp,yn=pn&&pn.isSet,wn=pn&&pn.isTypedArray;function _n(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function bn(t,e,n,r){var i=-1,o=null==t?0:t.length;while(++i-1}function Tn(t,e,n){var r=-1,i=null==t?0:t.length;while(++r-1);return n}function tr(t,e){var n=t.length;while(n--&&Rn(e,t[n],0)>-1);return n}function er(t,e){var n=t.length,r=0;while(n--)t[n]===e&&++r;return r}var nr=Vn($e),rr=Vn(tn);function ir(t){return"\\"+nn[t]}function or(t,e){return null==t?o:t[e]}function ur(t){return Je.test(t)}function ar(t){return Ge.test(t)}function sr(t){var e,n=[];while(!(e=t.next()).done)n.push(e.value);return n}function cr(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function lr(t,e){return function(n){return t(e(n))}}function fr(t,e){var n=-1,r=t.length,i=0,o=[];while(++n-1}function Kr(t,e){var n=this.__data__,r=li(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Vr(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e=e?t:e)),t}function mi(t,e,n,r,i,u){var a,s=e&d,c=e&v,l=e&g;if(n&&(a=i?n(t,r,i,u):n(t)),a!==o)return a;if(!xl(t))return t;var f=sl(t);if(f){if(a=ea(t),!s)return iu(t,a)}else{var h=Xu(t),p=h==X||h==H;if(pl(t))return Go(t,s);if(h==nt||h==z||p&&!i){if(a=c||p?{}:na(t),!s)return c?au(t,pi(a,t)):uu(t,hi(a,t))}else{if(!He[h])return i?t:{};a=ra(t,h,s)}}u||(u=new Hr);var m=u.get(t);if(m)return m;u.set(t,a),Pl(t)?t.forEach((function(r){a.add(mi(r,e,n,r,t,u))})):Sl(t)&&t.forEach((function(r,i){a.set(i,mi(r,e,n,i,t,u))}));var y=l?c?Du:Fu:c?xf:kf,w=f?o:y(t);return An(w||t,(function(r,i){w&&(i=r,r=t[i]),ci(a,i,mi(r,e,n,i,t,u))})),a}function yi(t){var e=kf(t);return function(n){return wi(n,t,e)}}function wi(t,e,n){var r=n.length;if(null==t)return!r;t=ne(t);while(r--){var i=n[r],u=e[i],a=t[i];if(a===o&&!(i in t)||!u(a))return!1}return!0}function _i(t,e,n){if("function"!=typeof t)throw new oe(c);return Ia((function(){t.apply(o,n)}),e)}function bi(t,e,n,r){var i=-1,o=Sn,u=!0,s=t.length,c=[],l=e.length;if(!s)return c;n&&(e=qn(e,Qn(n))),r?(o=Tn,u=!1):e.length>=a&&(o=Hn,u=!1,e=new Yr(e));t:while(++ii?0:i+n),r=r===o||r>i?i:Gl(r),r<0&&(r+=i),r=n>r?0:Yl(r);while(n0&&n(a)?e>1?qi(a,e-1,n,r,i):En(i,a):r||(i[i.length]=a)}return i}var Ei=fu(),Ci=fu(!0);function Oi(t,e){return t&&Ei(t,e,kf)}function Mi(t,e){return t&&Ci(t,e,kf)}function Ni(t,e){return In(e,(function(e){return bl(t[e])}))}function Bi(t,e){e=zo(e,t);var n=0,r=e.length;while(null!=t&&ne}function Ri(t,e){return null!=t&&fe.call(t,e)}function Fi(t,e){return null!=t&&e in ne(t)}function Di(t,e,n){return t>=We(e,n)&&t=120&&h.length>=120)?new Yr(s&&h):o}h=t[0];var p=-1,d=c[0];t:while(++p-1)a!==t&&Ie.call(a,s,1),Ie.call(t,s,1)}return t}function mo(t,e){var n=t?e.length:0,r=n-1;while(n--){var i=e[n];if(n==r||i!==o){var o=i;ua(i)?Ie.call(t,i,1):Uo(t,i)}}return t}function yo(t,e){return t+Be(Ze()*(e-t+1))}function wo(t,e,r,i){var o=-1,u=De(Ne((e-t)/(r||1)),0),a=n(u);while(u--)a[i?u:++o]=t,t+=r;return a}function _o(t,e){var n="";if(!t||e<1||e>P)return n;do{e%2&&(n+=t),e=Be(e/2),e&&(t+=t)}while(e);return n}function bo(t,e){return Sa(_a(t,e,Oh),t+"")}function Ao(t){return oi(Kf(t))}function ko(t,e){var n=Kf(t);return Ea(n,gi(e,0,n.length))}function xo(t,e,n,r){if(!xl(t))return t;e=zo(e,t);var i=-1,u=e.length,a=u-1,s=t;while(null!=s&&++io?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;var u=n(o);while(++i>>1,u=t[o];null!==u&&!Fl(u)&&(n?u<=e:u=a){var l=e?null:Eu(t);if(l)return hr(l);u=!1,i=Hn,c=new Yr}else c=e?[]:s;t:while(++r=r?t:qo(t,e,n)}var Jo=Ce||function(t){return sn.clearTimeout(t)};function Go(t,e){if(e)return t.slice();var n=t.length,r=be?be(n):new t.constructor(n);return t.copy(r),r}function Yo(t){var e=new t.constructor(t.byteLength);return new _e(e).set(new _e(t)),e}function Qo(t,e){var n=e?Yo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function Xo(t){var e=new t.constructor(t.source,Jt.exec(t));return e.lastIndex=t.lastIndex,e}function Ho(t){return dr?ne(dr.call(t)):{}}function $o(t,e){var n=e?Yo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function tu(t,e){if(t!==e){var n=t!==o,r=null===t,i=t===t,u=Fl(t),a=e!==o,s=null===e,c=e===e,l=Fl(e);if(!s&&!l&&!u&&t>e||u&&a&&c&&!s&&!l||r&&a&&c||!n&&c||!i)return 1;if(!r&&!u&&!l&&t=a)return s;var c=n[r];return s*("desc"==c?-1:1)}}return t.index-e.index}function nu(t,e,r,i){var o=-1,u=t.length,a=r.length,s=-1,c=e.length,l=De(u-a,0),f=n(c+l),h=!i;while(++s1?n[i-1]:o,a=i>2?n[2]:o;u=t.length>3&&"function"==typeof u?(i--,u):o,a&&aa(n[0],n[1],a)&&(u=i<3?o:u,i=1),e=ne(e);while(++r-1?i[u?e[a]:a]:o}}function yu(t){return Ru((function(e){var n=e.length,r=n,i=Sr.prototype.thru;t&&e.reverse();while(r--){var u=e[r];if("function"!=typeof u)throw new oe(c);if(i&&!a&&"wrapper"==Ku(u))var a=new Sr([],!0)}r=a?r:n;while(++r1&&w.reverse(),h&&ls))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var h=-1,p=!0,d=n&y?new Yr:o;u.set(t,e),u.set(e,t);while(++h1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Dt,"{\n/* [wrapped with "+e+"] */\n")}function oa(t){return sl(t)||al(t)||!!(Se&&t&&t[Se])}function ua(t,e){var n=typeof t;return e=null==e?P:e,!!e&&("number"==n||"symbol"!=n&&Ht.test(t))&&t>-1&&t%1==0&&t0){if(++e>=O)return arguments[0]}else e=0;return t.apply(o,arguments)}}function Ea(t,e){var n=-1,r=t.length,i=r-1;e=e===o?r:e;while(++n1?t[e-1]:o;return n="function"==typeof n?(t.pop(),n):o,Us(t,n)}));function Ls(t){var e=br(t);return e.__chain__=!0,e}function Zs(t,e){return e(t),t}function Js(t,e){return e(t)}var Gs=Ru((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return vi(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Tr&&ua(n)?(r=r.slice(n,+n+(e?1:0)),r.__actions__.push({func:Js,args:[i],thisArg:o}),new Sr(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(o),t}))):this.thru(i)}));function Ys(){return Ls(this)}function Qs(){return new Sr(this.value(),this.__chain__)}function Xs(){this.__values__===o&&(this.__values__=Zl(this.value()));var t=this.__index__>=this.__values__.length,e=t?o:this.__values__[this.__index__++];return{done:t,value:e}}function Hs(){return this}function $s(t){var e,n=this;while(n instanceof Ir){var r=Ba(n);r.__index__=0,r.__values__=o,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e}function tc(){var t=this.__wrapped__;if(t instanceof Tr){var e=t;return this.__actions__.length&&(e=new Tr(this)),e=e.reverse(),e.__actions__.push({func:Js,args:[ds],thisArg:o}),new Sr(e,this.__chain__)}return this.thru(ds)}function ec(){return Fo(this.__wrapped__,this.__actions__)}var nc=su((function(t,e,n){fe.call(t,n)?++t[n]:di(t,n,1)}));function rc(t,e,n){var r=sl(t)?xn:xi;return n&&aa(t,e,n)&&(e=o),r(t,zu(e,3))}function ic(t,e){var n=sl(t)?In:Ti;return n(t,zu(e,3))}var oc=mu(Za),uc=mu(Ja);function ac(t,e){return qi(gc(t,e),1)}function sc(t,e){return qi(gc(t,e),U)}function cc(t,e,n){return n=n===o?1:Gl(n),qi(gc(t,e),n)}function lc(t,e){var n=sl(t)?An:Ai;return n(t,zu(e,3))}function fc(t,e){var n=sl(t)?kn:ki;return n(t,zu(e,3))}var hc=su((function(t,e,n){fe.call(t,n)?t[n].push(e):di(t,n,[e])}));function pc(t,e,n,r){t=ll(t)?t:Kf(t),n=n&&!r?Gl(n):0;var i=t.length;return n<0&&(n=De(i+n,0)),Rl(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Rn(t,e,n)>-1}var dc=bo((function(t,e,r){var i=-1,o="function"==typeof e,u=ll(t)?n(t.length):[];return Ai(t,(function(t){u[++i]=o?_n(e,t,r):Vi(t,e,r)})),u})),vc=su((function(t,e,n){di(t,n,e)}));function gc(t,e){var n=sl(t)?qn:oo;return n(t,zu(e,3))}function mc(t,e,n,r){return null==t?[]:(sl(e)||(e=null==e?[]:[e]),n=r?o:n,sl(n)||(n=null==n?[]:[n]),fo(t,e,n))}var yc=su((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));function wc(t,e,n){var r=sl(t)?Cn:zn,i=arguments.length<3;return r(t,zu(e,4),n,i,Ai)}function _c(t,e,n){var r=sl(t)?On:zn,i=arguments.length<3;return r(t,zu(e,4),n,i,ki)}function bc(t,e){var n=sl(t)?In:Ti;return n(t,Wc(zu(e,3)))}function Ac(t){var e=sl(t)?oi:Ao;return e(t)}function kc(t,e,n){e=(n?aa(t,e,n):e===o)?1:Gl(e);var r=sl(t)?ui:ko;return r(t,e)}function xc(t){var e=sl(t)?ai:To;return e(t)}function Ic(t){if(null==t)return 0;if(ll(t))return Rl(t)?gr(t):t.length;var e=Xu(t);return e==$||e==ut?t.size:no(t).length}function Sc(t,e,n){var r=sl(t)?Mn:Eo;return n&&aa(t,e,n)&&(e=o),r(t,zu(e,3))}var Tc=bo((function(t,e){if(null==t)return[];var n=e.length;return n>1&&aa(t,e[0],e[1])?e=[]:n>2&&aa(e[0],e[1],e[2])&&(e=[e[0]]),fo(t,qi(e,1),[])})),qc=Oe||function(){return sn.Date.now()};function Ec(t,e){if("function"!=typeof e)throw new oe(c);return t=Gl(t),function(){if(--t<1)return e.apply(this,arguments)}}function Cc(t,e,n){return e=n?o:e,e=t&&null==e?t.length:e,Ou(t,S,o,o,o,o,e)}function Oc(t,e){var n;if("function"!=typeof e)throw new oe(c);return t=Gl(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=o),n}}var Mc=bo((function(t,e,n){var r=w;if(n.length){var i=fr(n,Vu(Mc));r|=x}return Ou(t,r,e,n,i)})),Nc=bo((function(t,e,n){var r=w|_;if(n.length){var i=fr(n,Vu(Nc));r|=x}return Ou(e,r,t,n,i)}));function Bc(t,e,n){e=n?o:e;var r=Ou(t,A,o,o,o,o,o,e);return r.placeholder=Bc.placeholder,r}function jc(t,e,n){e=n?o:e;var r=Ou(t,k,o,o,o,o,o,e);return r.placeholder=jc.placeholder,r}function Uc(t,e,n){var r,i,u,a,s,l,f=0,h=!1,p=!1,d=!0;if("function"!=typeof t)throw new oe(c);function v(e){var n=r,u=i;return r=i=o,f=e,a=t.apply(u,n),a}function g(t){return f=t,s=Ia(w,e),h?v(t):a}function m(t){var n=t-l,r=t-f,i=e-n;return p?We(i,u-r):i}function y(t){var n=t-l,r=t-f;return l===o||n>=e||n<0||p&&r>=u}function w(){var t=qc();if(y(t))return _(t);s=Ia(w,m(t))}function _(t){return s=o,d&&r?v(t):(r=i=o,a)}function b(){s!==o&&Jo(s),f=0,r=l=i=s=o}function A(){return s===o?a:_(qc())}function k(){var t=qc(),n=y(t);if(r=arguments,i=this,l=t,n){if(s===o)return g(l);if(p)return Jo(s),s=Ia(w,e),v(l)}return s===o&&(s=Ia(w,e)),a}return e=Ql(e)||0,xl(n)&&(h=!!n.leading,p="maxWait"in n,u=p?De(Ql(n.maxWait)||0,e):u,d="trailing"in n?!!n.trailing:d),k.cancel=b,k.flush=A,k}var Pc=bo((function(t,e){return _i(t,1,e)})),Rc=bo((function(t,e,n){return _i(t,Ql(e)||0,n)}));function Fc(t){return Ou(t,q)}function Dc(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new oe(c);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var u=t.apply(this,r);return n.cache=o.set(i,u)||o,u};return n.cache=new(Dc.Cache||Vr),n}function Wc(t){if("function"!=typeof t)throw new oe(c);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Kc(t){return Oc(2,t)}Dc.Cache=Vr;var Vc=Lo((function(t,e){e=1==e.length&&sl(e[0])?qn(e[0],Qn(zu())):qn(qi(e,1),Qn(zu()));var n=e.length;return bo((function(r){var i=-1,o=We(r.length,n);while(++i=e})),al=zi(function(){return arguments}())?zi:function(t){return Il(t)&&fe.call(t,"callee")&&!xe.call(t,"callee")},sl=n.isArray,cl=dn?Qn(dn):Li;function ll(t){return null!=t&&kl(t.length)&&!bl(t)}function fl(t){return Il(t)&&ll(t)}function hl(t){return!0===t||!1===t||Il(t)&&Ui(t)==J}var pl=Ue||Yh,dl=vn?Qn(vn):Zi;function vl(t){return Il(t)&&1===t.nodeType&&!Bl(t)}function gl(t){if(null==t)return!0;if(ll(t)&&(sl(t)||"string"==typeof t||"function"==typeof t.splice||pl(t)||Dl(t)||al(t)))return!t.length;var e=Xu(t);if(e==$||e==ut)return!t.size;if(pa(t))return!no(t).length;for(var n in t)if(fe.call(t,n))return!1;return!0}function ml(t,e){return Ji(t,e)}function yl(t,e,n){n="function"==typeof n?n:o;var r=n?n(t,e):o;return r===o?Ji(t,e,o,n):!!r}function wl(t){if(!Il(t))return!1;var e=Ui(t);return e==Q||e==Y||"string"==typeof t.message&&"string"==typeof t.name&&!Bl(t)}function _l(t){return"number"==typeof t&&Pe(t)}function bl(t){if(!xl(t))return!1;var e=Ui(t);return e==X||e==H||e==Z||e==it}function Al(t){return"number"==typeof t&&t==Gl(t)}function kl(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=P}function xl(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Il(t){return null!=t&&"object"==typeof t}var Sl=gn?Qn(gn):Yi;function Tl(t,e){return t===e||Qi(t,e,Zu(e))}function ql(t,e,n){return n="function"==typeof n?n:o,Qi(t,e,Zu(e),n)}function El(t){return Nl(t)&&t!=+t}function Cl(t){if(ha(t))throw new i(s);return Xi(t)}function Ol(t){return null===t}function Ml(t){return null==t}function Nl(t){return"number"==typeof t||Il(t)&&Ui(t)==tt}function Bl(t){if(!Il(t)||Ui(t)!=nt)return!1;var e=Ae(t);if(null===e)return!0;var n=fe.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&le.call(n)==ve}var jl=mn?Qn(mn):Hi;function Ul(t){return Al(t)&&t>=-P&&t<=P}var Pl=yn?Qn(yn):$i;function Rl(t){return"string"==typeof t||!sl(t)&&Il(t)&&Ui(t)==at}function Fl(t){return"symbol"==typeof t||Il(t)&&Ui(t)==st}var Dl=wn?Qn(wn):to;function Wl(t){return t===o}function Kl(t){return Il(t)&&Xu(t)==lt}function Vl(t){return Il(t)&&Ui(t)==ft}var zl=Su(io),Ll=Su((function(t,e){return t<=e}));function Zl(t){if(!t)return[];if(ll(t))return Rl(t)?mr(t):iu(t);if(Te&&t[Te])return sr(t[Te]());var e=Xu(t),n=e==$?cr:e==ut?hr:Kf;return n(t)}function Jl(t){if(!t)return 0===t?t:0;if(t=Ql(t),t===U||t===-U){var e=t<0?-1:1;return e*R}return t===t?t:0}function Gl(t){var e=Jl(t),n=e%1;return e===e?n?e-n:e:0}function Yl(t){return t?gi(Gl(t),0,D):0}function Ql(t){if("number"==typeof t)return t;if(Fl(t))return F;if(xl(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=xl(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Yn(t);var n=Yt.test(t);return n||Xt.test(t)?on(t.slice(2),n?2:8):Gt.test(t)?F:+t}function Xl(t){return ou(t,xf(t))}function Hl(t){return t?gi(Gl(t),-P,P):0===t?t:0}function $l(t){return null==t?"":Bo(t)}var tf=cu((function(t,e){if(pa(e)||ll(e))ou(e,kf(e),t);else for(var n in e)fe.call(e,n)&&ci(t,n,e[n])})),ef=cu((function(t,e){ou(e,xf(e),t)})),nf=cu((function(t,e,n,r){ou(e,xf(e),t,r)})),rf=cu((function(t,e,n,r){ou(e,kf(e),t,r)})),of=Ru(vi);function uf(t,e){var n=kr(t);return null==e?n:hi(n,e)}var af=bo((function(t,e){t=ne(t);var n=-1,r=e.length,i=r>2?e[2]:o;i&&aa(e[0],e[1],i)&&(r=1);while(++n1),e})),ou(t,Du(t),n),r&&(n=mi(n,d|v|g,Bu));var i=e.length;while(i--)Uo(n,e[i]);return n}));function Cf(t,e){return Mf(t,Wc(zu(e)))}var Of=Ru((function(t,e){return null==t?{}:ho(t,e)}));function Mf(t,e){if(null==t)return{};var n=qn(Du(t),(function(t){return[t]}));return e=zu(e),po(t,n,(function(t,n){return e(t,n[0])}))}function Nf(t,e,n){e=zo(e,t);var r=-1,i=e.length;i||(i=1,t=o);while(++re){var r=t;t=e,e=r}if(n||t%1||e%1){var i=Ze();return We(t+i*(e-t+rn("1e-"+((i+"").length-1))),e)}return yo(t,e)}var Jf=du((function(t,e,n){return e=e.toLowerCase(),t+(n?Gf(e):e)}));function Gf(t){return bh($l(t).toLowerCase())}function Yf(t){return t=$l(t),t&&t.replace($t,nr).replace(ze,"")}function Qf(t,e,n){t=$l(t),e=Bo(e);var r=t.length;n=n===o?r:gi(Gl(n),0,r);var i=n;return n-=e.length,n>=0&&t.slice(n,i)==e}function Xf(t){return t=$l(t),t&&Et.test(t)?t.replace(Tt,rr):t}function Hf(t){return t=$l(t),t&&Pt.test(t)?t.replace(Ut,"\\$&"):t}var $f=du((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),th=du((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),eh=pu("toLowerCase");function nh(t,e,n){t=$l(t),e=Gl(e);var r=e?gr(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return ku(Be(i),n)+t+ku(Ne(i),n)}function rh(t,e,n){t=$l(t),e=Gl(e);var r=e?gr(t):0;return e&&r>>0,n?(t=$l(t),t&&("string"==typeof e||null!=e&&!jl(e))&&(e=Bo(e),!e&&ur(t))?Zo(mr(t),0,n):t.split(e,n)):[]}var lh=du((function(t,e,n){return t+(n?" ":"")+bh(e)}));function fh(t,e,n){return t=$l(t),n=null==n?0:gi(Gl(n),0,t.length),e=Bo(e),t.slice(n,n+e.length)==e}function hh(t,e,n){var r=br.templateSettings;n&&aa(t,e,n)&&(e=o),t=$l(t),e=nf({},e,r,Mu);var u,a,s=nf({},e.imports,r.imports,Mu),c=kf(s),f=Xn(s,c),h=0,p=e.interpolate||te,d="__p += '",v=re((e.escape||te).source+"|"+p.source+"|"+(p===Mt?Zt:te).source+"|"+(e.evaluate||te).source+"|$","g"),g="//# sourceURL="+(fe.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qe+"]")+"\n";t.replace(v,(function(e,n,r,i,o,s){return r||(r=i),d+=t.slice(h,s).replace(ee,ir),n&&(u=!0,d+="' +\n__e("+n+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),h=s+e.length,e})),d+="';\n";var m=fe.call(e,"variable")&&e.variable;if(m){if(zt.test(m))throw new i(l)}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(kt,""):d).replace(xt,"$1").replace(It,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var y=kh((function(){return Ft(c,g+"return "+d).apply(o,f)}));if(y.source=d,wl(y))throw y;return y}function ph(t){return $l(t).toLowerCase()}function dh(t){return $l(t).toUpperCase()}function vh(t,e,n){if(t=$l(t),t&&(n||e===o))return Yn(t);if(!t||!(e=Bo(e)))return t;var r=mr(t),i=mr(e),u=$n(r,i),a=tr(r,i)+1;return Zo(r,u,a).join("")}function gh(t,e,n){if(t=$l(t),t&&(n||e===o))return t.slice(0,yr(t)+1);if(!t||!(e=Bo(e)))return t;var r=mr(t),i=tr(r,mr(e))+1;return Zo(r,0,i).join("")}function mh(t,e,n){if(t=$l(t),t&&(n||e===o))return t.replace(Rt,"");if(!t||!(e=Bo(e)))return t;var r=mr(t),i=$n(r,mr(e));return Zo(r,i).join("")}function yh(t,e){var n=E,r=C;if(xl(e)){var i="separator"in e?e.separator:i;n="length"in e?Gl(e.length):n,r="omission"in e?Bo(e.omission):r}t=$l(t);var u=t.length;if(ur(t)){var a=mr(t);u=a.length}if(n>=u)return t;var s=n-gr(r);if(s<1)return r;var c=a?Zo(a,0,s).join(""):t.slice(0,s);if(i===o)return c+r;if(a&&(s+=c.length-s),jl(i)){if(t.slice(s).search(i)){var l,f=c;i.global||(i=re(i.source,$l(Jt.exec(i))+"g")),i.lastIndex=0;while(l=i.exec(f))var h=l.index;c=c.slice(0,h===o?s:h)}}else if(t.indexOf(Bo(i),s)!=s){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+r}function wh(t){return t=$l(t),t&&qt.test(t)?t.replace(St,wr):t}var _h=du((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),bh=pu("toUpperCase");function Ah(t,e,n){return t=$l(t),e=n?o:e,e===o?ar(t)?Ar(t):jn(t):t.match(e)||[]}var kh=bo((function(t,e){try{return _n(t,o,e)}catch(n){return wl(n)?n:new i(n)}})),xh=Ru((function(t,e){return An(e,(function(e){e=Oa(e),di(t,e,Mc(t[e],t))})),t}));function Ih(t){var e=null==t?0:t.length,n=zu();return t=e?qn(t,(function(t){if("function"!=typeof t[1])throw new oe(c);return[n(t[0]),t[1]]})):[],bo((function(n){var r=-1;while(++rP)return[];var n=D,r=We(t,D);e=zu(e),t-=D;var i=Jn(r,e);while(++n0||e<0)?new Tr(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==o&&(e=Gl(e),n=e<0?n.dropRight(-e):n.take(e-t)),n)},Tr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Tr.prototype.toArray=function(){return this.take(D)},Oi(Tr.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=br[r?"take"+("last"==e?"Right":""):e],u=r||/^find/.test(e);i&&(br.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof Tr,c=a[0],l=s||sl(e),f=function(t){var e=i.apply(br,En([t],a));return r&&h?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(s=l=!1);var h=this.__chain__,p=!!this.__actions__.length,d=u&&!h,v=s&&!p;if(!u&&l){e=v?e:new Tr(this);var g=t.apply(e,a);return g.__actions__.push({func:Js,args:[f],thisArg:o}),new Sr(g,h)}return d&&v?t.apply(this,a):(g=this.thru(f),d?r?g.value()[0]:g.value():g)})})),An(["pop","push","shift","sort","splice","unshift"],(function(t){var e=ue[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);br.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(sl(i)?i:[],t)}return this[n]((function(n){return e.apply(sl(n)?n:[],t)}))}})),Oi(Tr.prototype,(function(t,e){var n=br[e];if(n){var r=n.name+"";fe.call(cn,r)||(cn[r]=[]),cn[r].push({name:e,func:n})}})),cn[wu(o,_).name]=[{name:"wrapper",func:o}],Tr.prototype.clone=qr,Tr.prototype.reverse=Er,Tr.prototype.value=Cr,br.prototype.at=Gs,br.prototype.chain=Ys,br.prototype.commit=Qs,br.prototype.next=Xs,br.prototype.plant=$s,br.prototype.reverse=tc,br.prototype.toJSON=br.prototype.valueOf=br.prototype.value=ec,br.prototype.first=br.prototype.head,Te&&(br.prototype[Te]=Hs),br},xr=kr();sn._=xr,i=function(){return xr}.call(e,n,e,r),i===o||(r.exports=i)}).call(this)}).call(this,n("c8ba"),n("62e4")(t))},"33e9":function(t,e,n){const r=n("4620"),i=n("b37a");class o{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=i.zero(),this.zeroNode.offset=this.getCursorOffset()||0,this.relocationThreshold=n.relocationThreshold||r.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.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.LagOffsetCost&&n>-2/r.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 r=null;for(let i=e;i>=t;){const t=this.sample.notes[i];if(!t.matches.length||t.matches[0].prior<-.01||t.matches[0].totalCost>=1){n[i]=-1,--i;continue}null!=r&&(t.matches.forEach(t=>t.backPrior=t.totalCost<1.99?t.priorByOffset(r):-1),t.matches.sort((t,e)=>e.backPrior-t.backPrior));const e=t.matches[0];e.path.forEach((t,e)=>n[e]=t),r=e.root.offset,i=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}}t.exports=o},"3b0d":function(t,e){t.exports=class{constructor(){this.buffer=""}write(t){this.buffer+=t}writeInt32(t){this.buffer+=String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)}writeInt16(t){this.buffer+=String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)}writeInt8(t){this.buffer+=String.fromCharCode(255&t)}writeVarInt(t){if(t<0)throw new Error("OStream.writeVarInt minus number: "+t);const e=127&t;t>>=7;let n=String.fromCharCode(e);while(t){const e=127&t;t>>=7,n=String.fromCharCode(128|e)+n}this.buffer+=n}getBuffer(){return this.buffer}getArrayBuffer(){return Uint8Array.from(this.buffer.split("").map(t=>t.charCodeAt(0))).buffer}}},"3b97":function(t,e){const n=(t,{timeWarp:e=1}={})=>{const n=[];let r=120;const i=t.header.ticksPerBeat;for(let c=0;c0){const e=u.ticksToEvent/i;t=e/(r/60)}"meta"==u.event.type&&"setTempo"==u.event.subtype&&(r=6e7/u.event.microsecondsPerBeat);const n=1e3*t*e||0;a.push([u,n]),u=o()}if(u=o())while(u)t()}return s(),a},r=t=>{const e=new Map;return t.filter(([{event:t,ticksToEvent:n}])=>{if(n>0&&e.clear(),"channel"!==t.type)return!0;const r=`${t.subtype}|${t.channel}|${t.noteNumber}`;return!e.get(r)&&(e.set(r,t),!0)})},i=t=>{const e=new Map,n=new Map,r=[];let i=-1;return t.forEach(([{event:t,ticksToEvent:o}],u)=>{if(o>0&&(i=u),"channel"!==t.type)return;const a=`${t.channel}|${t.noteNumber}`;switch(t.subtype){case"noteOn":e.get(a)?n.set(a,i):e.set(a,i);break;case"noteOff":n.get(a)?(r.push([n.get(a),u]),n.delete(a)):e.delete(a);break}}),r.forEach((t,e)=>{for(let n=e-1;n>=0;--n){const e=r[n];if(e[1]e[0]&&++t[0]}}),r.forEach(([e,n])=>{if(n>=t.length-1||e<0)return;const r=t[n],i=t[n+1],o=t[e];if(!o[0].ticksToEvent)return void console.warn("invalid front index:",e,n,o);const u=o[1]/o[0].ticksToEvent;i[1]+=r[1],i[0].ticksToEvent+=r[0].ticksToEvent,r[0].ticksToEvent=o[0].ticksToEvent-1,o[0].ticksToEvent=1,r[1]=r[0].ticksToEvent*u,o[1]=o[0].ticksToEvent*u,t.splice(n,1),t.splice(e,0,r)}),t};t.exports={midiToSequence:n,trimSequence:r,fixOverlapNotes:i}},4620:function(t,e){t.exports={CostStepAttenuation:.6,SkipDeep:3,PriorDistanceSigmoidFactor:.1,PriorValueSigmoidFactor:.12,SkipCost:.5,LagOffsetCost:1,LeadOffsetCost:1.6,ZeroOffsetCost:.58,RelocationThreshold:6}},"4a2c":function(t,e,n){const r=n("3b0d");t.exports=function({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;case"sequencerSpecific":t.writeInt8(127),t.writeVarInt(e.data.length),t.write(e.data);break;default:throw new Error("unhandled event subtype:"+e.subtype)}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"noteOn":t.writeInt8(144|e.channel),t.writeInt8(e.noteNumber),t.writeInt8(e.velocity);break;case"noteOff":t.writeInt8(128|e.channel),t.writeInt8(e.noteNumber),t.writeInt8(e.velocity?e.velocity:0);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(255&e.value),t.writeInt8(e.value>>7&255);break;default:throw new Error("unhandled event subtype:"+e.subtype)}break;default:throw new Error("unhandled event type:"+e.type)}}const o=new r,u=new r;u.writeInt16(t.formatType),u.writeInt16(e.length),u.writeInt16(t.ticksPerBeat),n(o,"MThd",u.getBuffer());for(let a=0;a=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}}}},"62e4":function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},8875:function(t,e,n){var r,i,o;(function(n,u){i=[],r=u,o="function"===typeof r?r.apply(e,i):r,void 0===o||(t.exports=o)})("undefined"!==typeof self&&self,(function(){function t(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(f){var t,e,n,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,i=/@([^@]*):(\d+):(\d+)\s*$/gi,o=r.exec(f.stack)||i.exec(f.stack),u=o&&o[1]||!1,a=o&&o[2]||!1,s=document.location.href.replace(document.location.hash,""),c=document.getElementsByTagName("script");u===s&&(t=document.documentElement.outerHTML,e=new RegExp("(?:[^\\n]+?\\n){0,"+(a-2)+"}[^<]*