zds-pickers 4.0.22 → 4.0.24
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/pickers/Select.js +2 -2
- package/dist/types/pickers/KnobPicker.d.ts +1 -1
- package/dist/types/pickers/ResponseCurvePicker.d.ts +1 -1
- package/dist/types/pickers/Select.d.ts +1 -1
- package/lib/pickers/Select.tsx +3 -3
- package/package.json +18 -18
package/dist/index.cjs.js
CHANGED
|
@@ -22,7 +22,7 @@ Valid keys: `+JSON.stringify(Object.keys(H),null," "));var O=ae(U,V,W,A,G+"."+V
|
|
|
22
22
|
Licensed under the MIT License (MIT), see
|
|
23
23
|
http://jedwatson.github.io/classnames
|
|
24
24
|
*/var yn;function Bu(){return yn||(yn=1,function(r){(function(){var a={}.hasOwnProperty;function t(){for(var o="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(o=n(o,e(i)))}return o}function e(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return t.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var i in o)a.call(o,i)&&o[i]&&(s=n(s,i));return s}function n(o,s){return s?o?o+" "+s:o+s:o}r.exports?(t.default=t,r.exports=t):window.classNames=t})()}(ct)),ct.exports}var Du=Bu();const Ue=We(Du);var st,Mn;function Ou(){if(Mn)return st;Mn=1;var r=200,a="__lodash_hash_undefined__",t=9007199254740991,e="[object Function]",n="[object GeneratorFunction]",o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,i=typeof Xe=="object"&&Xe&&Xe.Object===Object&&Xe,c=typeof self=="object"&&self&&self.Object===Object&&self,l=i||c||Function("return this")();function h(g,b,E){switch(E.length){case 0:return g.call(b);case 1:return g.call(b,E[0]);case 2:return g.call(b,E[0],E[1]);case 3:return g.call(b,E[0],E[1],E[2])}return g.apply(b,E)}function u(g,b){var E=g?g.length:0;return!!E&&m(g,b,0)>-1}function p(g,b){for(var E=-1,J=b.length,ce=g.length;++E<J;)g[ce+E]=b[E];return g}function d(g,b,E,J){for(var ce=g.length,Pe=E+-1;++Pe<ce;)if(b(g[Pe],Pe,g))return Pe;return-1}function m(g,b,E){if(b!==b)return d(g,f,E);for(var J=E-1,ce=g.length;++J<ce;)if(g[J]===b)return J;return-1}function f(g){return g!==g}function v(g,b){return g.has(b)}function x(g,b){return g==null?void 0:g[b]}function q(g){var b=!1;if(g!=null&&typeof g.toString!="function")try{b=!!(g+"")}catch{}return b}var R=Array.prototype,T=Function.prototype,P=Object.prototype,C=l["__core-js_shared__"],S=function(){var g=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||"");return g?"Symbol(src)_1."+g:""}(),_=T.toString,D=P.hasOwnProperty,K=P.toString,F=RegExp("^"+_.call(D).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=l.Symbol,ie=R.splice;X&&X.isConcatSpreadable;var oe=Math.max,de=ke(l,"Map"),Q=ke(Object,"create");function ee(g){var b=-1,E=g?g.length:0;for(this.clear();++b<E;){var J=g[b];this.set(J[0],J[1])}}function me(){this.__data__=Q?Q(null):{}}function le(g){return this.has(g)&&delete this.__data__[g]}function H(g){var b=this.__data__;if(Q){var E=b[g];return E===a?void 0:E}return D.call(b,g)?b[g]:void 0}function k(g){var b=this.__data__;return Q?b[g]!==void 0:D.call(b,g)}function j(g,b){var E=this.__data__;return E[g]=Q&&b===void 0?a:b,this}ee.prototype.clear=me,ee.prototype.delete=le,ee.prototype.get=H,ee.prototype.has=k,ee.prototype.set=j;function N(g){var b=-1,E=g?g.length:0;for(this.clear();++b<E;){var J=g[b];this.set(J[0],J[1])}}function W(){this.__data__=[]}function A(g){var b=this.__data__,E=ne(b,g);if(E<0)return!1;var J=b.length-1;return E==J?b.pop():ie.call(b,E,1),!0}function G(g){var b=this.__data__,E=ne(b,g);return E<0?void 0:b[E][1]}function U(g){return ne(this.__data__,g)>-1}function I(g,b){var E=this.__data__,J=ne(E,g);return J<0?E.push([g,b]):E[J][1]=b,this}N.prototype.clear=W,N.prototype.delete=A,N.prototype.get=G,N.prototype.has=U,N.prototype.set=I;function z(g){var b=-1,E=g?g.length:0;for(this.clear();++b<E;){var J=g[b];this.set(J[0],J[1])}}function V(){this.__data__={hash:new ee,map:new(de||N),string:new ee}}function ae(g){return ge(this,g).delete(g)}function O(g){return ge(this,g).get(g)}function te(g){return ge(this,g).has(g)}function Se(g,b){return ge(this,g).set(g,b),this}z.prototype.clear=V,z.prototype.delete=ae,z.prototype.get=O,z.prototype.has=te,z.prototype.set=Se;function fe(g){var b=-1,E=g?g.length:0;for(this.__data__=new z;++b<E;)this.add(g[b])}function Ee(g){return this.__data__.set(g,a),this}function Le(g){return this.__data__.has(g)}fe.prototype.add=fe.prototype.push=Ee,fe.prototype.has=Le;function ne(g,b){for(var E=g.length;E--;)if(Va(g[E][0],b))return E;return-1}function ue(g,b,E,J){var ce=-1,Pe=u,Te=!0,_e=g.length,we=[],Ya=b.length;if(!_e)return we;b.length>=r&&(Pe=v,Te=!1,b=new fe(b));e:for(;++ce<_e;){var ve=g[ce],Be=ve;if(ve=ve!==0?ve:0,Te&&Be===Be){for(var Ve=Ya;Ve--;)if(b[Ve]===Be)continue e;we.push(ve)}else Pe(b,Be,J)||we.push(ve)}return we}function Me(g,b,E,J,ce){var Pe=-1,Te=g.length;for(ce||(ce=[]);++Pe<Te;){var _e=g[Pe];E(_e)&&p(ce,_e)}return ce}function je(g){if(!Ie(g)||za(g))return!1;var b=Fe(g)||q(g)?F:s;return b.test(Fa(g))}function Ge(g,b){return b=oe(b===void 0?g.length-1:b,0),function(){for(var E=arguments,J=-1,ce=oe(E.length-b,0),Pe=Array(ce);++J<ce;)Pe[J]=E[b+J];J=-1;for(var Te=Array(b+1);++J<b;)Te[J]=E[J];return Te[b]=Pe,h(g,this,Te)}}function ge(g,b){var E=g.__data__;return ja(b)?E[typeof b=="string"?"string":"hash"]:E.map}function ke(g,b){var E=x(g,b);return je(E)?E:void 0}function ja(g){var b=typeof g;return b=="string"||b=="number"||b=="symbol"||b=="boolean"?g!=="__proto__":g===null}function za(g){return!!S&&S in g}function Fa(g){if(g!=null){try{return _.call(g)}catch{}try{return g+""}catch{}}return""}var Ia=Ge(function(g,b){return ze(g)?ue(g,Me(b,1,ze)):[]});function Va(g,b){return g===b||g!==g&&b!==b}function Xa(g){return g!=null&&Ja(g.length)&&!Fe(g)}function ze(g){return $a(g)&&Xa(g)}function Fe(g){var b=Ie(g)?K.call(g):"";return b==e||b==n}function Ja(g){return typeof g=="number"&&g>-1&&g%1==0&&g<=t}function Ie(g){var b=typeof g;return!!g&&(b=="object"||b=="function")}function $a(g){return!!g&&typeof g=="object"}return st=Ia,st}var Au=Ou();const kn=We(Au);function Eu(r,a){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var e,n,o,s,i=[],c=!0,l=!1;try{if(o=(t=t.call(r)).next,a!==0)for(;!(c=(e=o.call(t)).done)&&(i.push(e.value),i.length!==a);c=!0);}catch(h){l=!0,n=h}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw n}}return i}}function qa(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function Lu(r,a){for(var t=0;t<a.length;t++){var e=a[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,pc(e.key),e)}}function Na(r,a,t){return a&&Lu(r.prototype,a),Object.defineProperty(r,"prototype",{writable:!1}),r}function Z(r,a,t){return a=pc(a),a in r?Object.defineProperty(r,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[a]=t,r}function Lt(){return Lt=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},Lt.apply(this,arguments)}function Wa(r,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(a&&a.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),a&&Gt(r,a)}function Oa(r){return Oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oa(r)}function Gt(r,a){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Gt(r,a)}function Gu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function xu(r,a){if(r==null)return{};var t={},e=Object.keys(r),n,o;for(o=0;o<e.length;o++)n=e[o],!(a.indexOf(n)>=0)&&(t[n]=r[n]);return t}function Ku(r,a){if(r==null)return{};var t=xu(r,a),e,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)e=o[n],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(r,e)&&(t[e]=r[e])}return t}function se(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function qu(r,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return se(r)}function Ua(r){var a=Gu();return function(){var e=Oa(r),n;if(a){var o=Oa(this).constructor;n=Reflect.construct(e,arguments,o)}else n=e.apply(this,arguments);return qu(this,n)}}function Nu(r,a){return Wu(r)||Eu(r,a)||Uu(r,a)||ju()}function Wu(r){if(Array.isArray(r))return r}function Uu(r,a){if(r){if(typeof r=="string")return wn(r,a);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return wn(r,a)}}function wn(r,a){(a==null||a>r.length)&&(a=r.length);for(var t=0,e=new Array(a);t<a;t++)e[t]=r[t];return e}function ju(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
25
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zu(r,a){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var e=t.call(r,a||"default");if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(r)}function pc(r){var a=zu(r,"string");return typeof a=="symbol"?a:String(a)}var Fu=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],Iu=["Db","Eb","Gb","Ab","Bb"],Vu={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11},Aa=12,Vt=Aa,Xt=127,Xu=/([a-g])([#b]?)(\d+)/,xt=12;function Ju(r){if(!r)throw Error("Invalid note argument");var a=Xu.exec(r.toLowerCase());if(!a)throw Error("Invalid note argument");var t=Nu(a,4),e=t[1],n=t[2],o=t[3],s="".concat(e.toUpperCase()).concat(n),i=Vu[s];if(i==null)throw Error("Invalid note argument");return Aa+i+xt*parseInt(o,10)}function $u(r){var a=(r-Aa)%xt,t=Math.floor((r-Aa)/xt),e=Fu[a];return{note:"".concat(e).concat(t),pitchName:e,octave:t,midiNumber:r,isAccidental:Iu.includes(e)}}function Yu(){return Ft(Vt,Xt+1).reduce(function(r,a){return r[a]=$u(a),r},{})}var Qu=Yu();function hc(r){var a=Qu[r];if(!a)throw Error("Invalid MIDI number");return a}var Zu=Ft(Vt,Xt+1).filter(function(r){return!hc(r).isAccidental}),Ea={fromNote:Ju,getAttributes:hc,MIN_MIDI_NUMBER:Vt,MAX_MIDI_NUMBER:Xt,NATURAL_MIDI_NUMBERS:Zu},eP=60,Jt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"onPlayNoteInput",function(){e.props.onPlayNoteInput(e.props.midiNumber)}),Z(se(e),"onStopNoteInput",function(){e.props.onStopNoteInput(e.props.midiNumber),e.props.onKeyMouseLeave&&e.props.onKeyMouseLeave(e.props.midiNumber)}),e}return Na(t,[{key:"getAbsoluteKeyPosition",value:function(n){var o=7,s=Ea.getAttributes(n),i=s.octave,c=s.pitchName,l=this.props.pitchPositions[c],h=o*i;return l+h}},{key:"getRelativeKeyPosition",value:function(n){return this.getAbsoluteKeyPosition(n)-this.getAbsoluteKeyPosition(this.props.noteRange.first)}},{key:"render",value:function(){var n=this,o=this.props,s=o.naturalKeyWidth,i=o.accidentalWidthRatio,c=o.midiNumber,l=o.gliss,h=o.useTouchEvents,u=o.accidental,p=o.active,d=o.disabled,m=o.children,f=lt(u?this.getRelativeKeyPosition(c)*s:this.getRelativeKeyPosition(c)*s),v=lt(u?i*s:s);return B.createElement("div",{"data-midinumber":c,className:Ue("ReactPiano__Key",{"ReactPiano__Key--accidental":u,"ReactPiano__Key--natural":!u,"ReactPiano__Key--disabled":d,"ReactPiano__Key--active":p,"ReactPiano__Key--middleC":c===eP}),style:{left:f,width:v},onDoubleClick:function(){n.props.onDoubleClick&&n.props.onDoubleClick(c)},onMouseDown:h?null:this.onPlayNoteInput,onMouseUp:function(){n.props.onClick&&n.props.onClick(c),h||n.onStopNoteInput()},onMouseEnter:function(){n.props.onKeyMouseEnter&&n.props.onKeyMouseEnter({accidental:u,left:f,midiNumber:c,width:v}),l&&n.onPlayNoteInput()},onMouseLeave:this.onStopNoteInput,onTouchStart:h?this.onPlayNoteInput:null,onTouchCancel:h?this.onStopNoteInput:null,onTouchEnd:h?this.onStopNoteInput:null},B.createElement("div",{className:"ReactPiano__NoteLabelContainer"},m))}}]),t}(B.Component);Z(Jt,"propTypes",{midiNumber:L.number.isRequired,naturalKeyWidth:L.number.isRequired,gliss:L.bool.isRequired,useTouchEvents:L.bool.isRequired,accidental:L.bool.isRequired,active:L.bool.isRequired,disabled:L.bool.isRequired,onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,accidentalWidthRatio:L.number.isRequired,pitchPositions:L.object.isRequired,children:L.node});Z(Jt,"defaultProps",{accidentalWidthRatio:.65,onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,pitchPositions:{C:0,Db:.672,D:1,Eb:1.672,E:2,F:3,Gb:3.672,G:4,Ab:4.672,A:5,Bb:5.672,B:6}});function lt(r){return"".concat(r*100,"%")}var $t=function(r){Wa(t,r);var a=Ua(t);function t(){return qa(this,t),a.apply(this,arguments)}return Na(t,[{key:"getMidiNumbers",value:function(){return Ft(this.props.noteRange.first,this.props.noteRange.last+1)}},{key:"getNaturalKeyCount",value:function(){return this.getMidiNumbers().filter(function(n){var o=Ea.getAttributes(n),s=o.isAccidental;return!s}).length}},{key:"getNaturalKeyWidth",value:function(){return 1/this.getNaturalKeyCount()}},{key:"getWidth",value:function(){return this.props.width?this.props.width:"100%"}},{key:"getHeight",value:function(){if(!this.props.width)return"100%";var n=this.props.width*this.getNaturalKeyWidth();return"".concat(n/this.props.keyWidthToHeight,"px")}},{key:"render",value:function(){var n=this,o=this.getNaturalKeyWidth();return B.createElement("div",{className:Ue("ReactPiano__Keyboard",this.props.className),style:{width:this.getWidth(),height:this.getHeight()}},this.getMidiNumbers().map(function(s){var i=Ea.getAttributes(s);i.note;var c=i.isAccidental,l=!n.props.disabled&&n.props.activeNotes.includes(s);return B.createElement(Jt,{accidental:c,active:l,disabled:n.props.disabled,gliss:n.props.gliss,key:s,midiNumber:s,naturalKeyWidth:o,noteRange:n.props.noteRange,onClick:n.props.onClick,onDoubleClick:n.props.onDoubleClick,onKeyMouseEnter:n.props.onKeyMouseEnter,onKeyMouseLeave:n.props.onKeyMouseLeave,onPlayNoteInput:n.props.onPlayNoteInput,onStopNoteInput:n.props.onStopNoteInput,useTouchEvents:n.props.useTouchEvents},n.props.disabled?null:n.props.renderNoteLabel({isActive:l,isAccidental:c,midiNumber:s}))}))}}]),t}(B.Component);Z($t,"propTypes",{noteRange:rP,activeNotes:L.arrayOf(L.number),onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,renderNoteLabel:L.func.isRequired,keyWidthToHeight:L.number.isRequired,className:L.string,disabled:L.bool,gliss:L.bool,useTouchEvents:L.bool,width:L.number});Z($t,"defaultProps",{disabled:!1,gliss:!1,keyWidthToHeight:.33,onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,renderNoteLabel:function(){},useTouchEvents:!1});function Bn(r){return typeof r!="number"?!1:Ea.NATURAL_MIDI_NUMBERS.includes(r)}function rP(r,a,t){var e=r[a],n=e.first,o=e.last;if(!n||!o)return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a," must be an object with .first and .last values."));if(!Bn(n)||!Bn(o))return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a," values must be valid MIDI numbers, and should not be accidentals (sharp or flat notes)."));if(n>=o)return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a,".first must be smaller than ").concat(a,".last."))}var Yt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"state",{isMouseDown:!1,useTouchEvents:!1}),Z(se(e),"handleNoteChanges",function(i){var c=i.prevActiveNotes,l=i.nextActiveNotes;if(!e.props.disabled){var h=kn(c,l),u=kn(l,c);u.forEach(function(p){e.props.playNote(p)}),h.forEach(function(p){e.props.stopNote(p)})}}),Z(se(e),"getMidiNumberForKey",function(i){if(!e.props.keyboardShortcuts)return null;var c=e.props.keyboardShortcuts.find(function(l){return l.key===i});return c&&c.midiNumber}),Z(se(e),"getKeyForMidiNumber",function(i){if(!e.props.keyboardShortcuts)return null;var c=e.props.keyboardShortcuts.find(function(l){return l.midiNumber===i});return c&&c.key}),Z(se(e),"onKeyDown",function(i){if(!(i.ctrlKey||i.metaKey||i.shiftKey)){var c=e.getMidiNumberForKey(i.key);c&&e.onPlayNoteInput(c)}}),Z(se(e),"onKeyUp",function(i){var c=e.getMidiNumberForKey(i.key);c&&e.onStopNoteInput(c)}),Z(se(e),"onPlayNoteInput",function(i){e.props.disabled||e.props.onPlayNoteInput(i,e.props.activeNotes)}),Z(se(e),"onStopNoteInput",function(i){e.props.disabled||e.props.onStopNoteInput(i,e.props.activeNotes)}),Z(se(e),"onMouseDown",function(){e.setState({isMouseDown:!0})}),Z(se(e),"onMouseUp",function(){e.setState({isMouseDown:!1})}),Z(se(e),"onTouchStart",function(){e.setState({useTouchEvents:!0})}),Z(se(e),"renderNoteLabel",function(i){var c=i.midiNumber,l=i.isActive,h=i.isAccidental,u=e.getKeyForMidiNumber(c);return e.props.renderNoteLabel({keyboardShortcut:u,midiNumber:c,isActive:l,isAccidental:h})}),e}return Na(t,[{key:"componentDidMount",value:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)}},{key:"componentDidUpdate",value:function(n,o){this.props.activeNotes!==n.activeNotes&&this.handleNoteChanges({prevActiveNotes:n.activeNotes||[],nextActiveNotes:this.props.activeNotes||[]})}},{key:"render",value:function(){return B.createElement("div",{style:{width:"100%",height:"100%"},onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchStart:this.onTouchStart,"data-testid":"container"},B.createElement($t,{activeNotes:this.props.activeNotes,className:this.props.className,disabled:this.props.disabled,gliss:this.state.isMouseDown,keyWidthToHeight:this.props.keyWidthToHeight,noteRange:this.props.noteRange,onClick:this.props.onClick,onDoubleClick:this.props.onDoubleClick,onKeyMouseEnter:this.props.onKeyMouseEnter,onKeyMouseLeave:this.props.onKeyMouseLeave,onPlayNoteInput:this.onPlayNoteInput,onStopNoteInput:this.onStopNoteInput,renderNoteLabel:this.renderNoteLabel,useTouchEvents:this.state.useTouchEvents,width:this.props.width}))}}]),t}(B.Component);Z(Yt,"propTypes",{noteRange:L.object.isRequired,activeNotes:L.arrayOf(L.number.isRequired).isRequired,playNote:L.func.isRequired,stopNote:L.func.isRequired,onClick:L.func,onDoubleClick:L.func,onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,renderNoteLabel:L.func.isRequired,className:L.string,disabled:L.bool,width:L.number,keyWidthToHeight:L.number,keyboardShortcuts:L.arrayOf(L.shape({key:L.string.isRequired,midiNumber:L.number.isRequired}))});Z(Yt,"defaultProps",{onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,renderNoteLabel:function(a){var t=a.keyboardShortcut;a.midiNumber;var e=a.isActive,n=a.isAccidental;return t?B.createElement("div",{className:Ue("ReactPiano__NoteLabel",{"ReactPiano__NoteLabel--active":e,"ReactPiano__NoteLabel--accidental":n,"ReactPiano__NoteLabel--natural":!n})},t):null}});var aP=["activeNotes","onPlayNoteInput","onStopNoteInput"],Qt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"state",{activeNotes:e.props.activeNotes||[]}),Z(se(e),"handlePlayNoteInput",function(i){e.setState(function(c){return e.props.onPlayNoteInput&&e.props.onPlayNoteInput(i,{prevActiveNotes:c.activeNotes}),c.activeNotes.includes(i)?null:{activeNotes:c.activeNotes.concat(i)}})}),Z(se(e),"handleStopNoteInput",function(i){e.setState(function(c){return e.props.onStopNoteInput&&e.props.onStopNoteInput(i,{prevActiveNotes:e.state.activeNotes}),{activeNotes:c.activeNotes.filter(function(l){return i!==l})}})}),e}return Na(t,[{key:"componentDidUpdate",value:function(n){n.activeNotes!==this.props.activeNotes&&this.state.activeNotes!==this.props.activeNotes&&this.setState({activeNotes:this.props.activeNotes||[]})}},{key:"render",value:function(){var n=this.props;n.activeNotes,n.onPlayNoteInput,n.onStopNoteInput;var o=Ku(n,aP);return B.createElement(Yt,Lt({activeNotes:this.state.activeNotes,onPlayNoteInput:this.handlePlayNoteInput,onStopNoteInput:this.handleStopNoteInput},o))}}]),t}(B.Component);Z(Qt,"propTypes",{noteRange:L.object.isRequired,activeNotes:L.arrayOf(L.number.isRequired),playNote:L.func.isRequired,stopNote:L.func.isRequired,onPlayNoteInput:L.func,onStopNoteInput:L.func,renderNoteLabel:L.func,className:L.string,disabled:L.bool,width:L.number,keyWidthToHeight:L.number,keyboardShortcuts:L.arrayOf(L.shape({key:L.string.isRequired,midiNumber:L.number.isRequired}))});var ut={exports:{}},Pt={exports:{}},dt,Dn;function tP(){if(Dn)return dt;Dn=1;function r(t){return t>64&&t<91?t-65:t>96&&t<123?t-71:t>47&&t<58?t+4:t===43?62:t===47?63:0}function a(t,e){for(var n=t.replace(/[^A-Za-z0-9\+\/]/g,""),o=n.length,s=e?Math.ceil((o*3+1>>2)/e)*e:o*3+1>>2,i=new Uint8Array(s),c,l,h=0,u=0,p=0;p<o;p++)if(l=p&3,h|=r(n.charCodeAt(p))<<18-6*l,l===3||o-p===1){for(c=0;c<3&&u<s;c++,u++)i[u]=h>>>(16>>>c&24)&255;h=0}return i}return dt={decode:a},dt}var mt,On;function nP(){return On||(On=1,mt=function(r,a){return new Promise(function(t,e){var n=new XMLHttpRequest;a&&(n.responseType=a),n.open("GET",r),n.onload=function(){n.status===200?t(n.response):e(Error(n.statusText))},n.onerror=function(){e(Error("Network Error"))},n.send()})}),mt}var An;function oP(){return An||(An=1,function(r){var a=tP(),t=nP();function e(S){return function(_){return typeof _=="string"&&S.test(_)}}function n(S,_){return typeof S=="string"?S+_:typeof S=="function"?S(_):_}function o(S,_,D,K){var F=s(_)?i:c(_)?l:h(_)?u:p(_)?d:m(_)?f:v(_)?x:q(_)?R:T(_)?P:null,X=D||{};return F?F(S,_,X):K?Promise.resolve(K):Promise.reject("Source not valid ("+_+")")}o.fetch=t;function s(S){return S instanceof ArrayBuffer}function i(S,_,D){return new Promise(function(K,F){S.decodeAudioData(_,function(X){K(X)},function(){F("Can't decode audio data ("+_.slice(0,30)+"...)")})})}var c=e(/\.(mp3|wav|ogg)(\?.*)?$/i);function l(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"arraybuffer"),D)}function h(S){return S&&typeof S.then=="function"}function u(S,_,D){return _.then(function(K){return o(S,K,D)})}var p=Array.isArray;function d(S,_,D){return Promise.all(_.map(function(K){return o(S,K,D,K)}))}function m(S){return S&&typeof S=="object"}function f(S,_,D){var K={},F=Object.keys(_).map(function(X){if(D.only&&D.only.indexOf(X)===-1)return null;var ie=_[X];return o(S,ie,D,ie).then(function(oe){K[X]=oe})});return Promise.all(F).then(function(){return K})}var v=e(/\.json(\?.*)?$/i);function x(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"text").then(JSON.parse),D)}var q=e(/^data:audio/);function R(S,_,D){var K=_.indexOf(",");return o(S,a.decode(_.slice(K+1)).buffer,D)}var T=e(/\.js(\?.*)?$/i);function P(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"text").then(C),D)}function C(S){var _=S.indexOf("MIDI.Soundfont.");if(_<0)throw Error("Invalid MIDI.js Soundfont format");_=S.indexOf("=",_)+2;var D=S.lastIndexOf(",");return JSON.parse(S.slice(_,D)+"}")}r.exports&&(r.exports=o),typeof window<"u"&&(window.loadAudio=o)}(Pt)),Pt.exports}var pt={exports:{}},ht,En;function iP(){if(En)return ht;En=1,ht=r;function r(i){var c=i.createGain(),l=c._voltage=e(i),h=n(l),u=n(l),p=n(l);return c._startAmount=n(u),c._endAmount=n(p),c._multiplier=n(h),c._multiplier.connect(c),c._startAmount.connect(c),c._endAmount.connect(c),c.value=h.gain,c.startValue=u.gain,c.endValue=p.gain,c.startValue.value=0,c.endValue.value=0,Object.defineProperties(c,a),c}var a={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(i){var c=this._multiplier.gain,l=this._startAmount.gain,h=this._endAmount.gain;this._voltage.start(i),this._decayFrom=this._decayFrom=i+this.attack,this._startedAt=i;var u=this.sustain;c.cancelScheduledValues(i),l.cancelScheduledValues(i),h.cancelScheduledValues(i),h.setValueAtTime(0,i),this.attack?(c.setValueAtTime(0,i),c.linearRampToValueAtTime(1,i+this.attack),l.setValueAtTime(1,i),l.linearRampToValueAtTime(0,i+this.attack)):(c.setValueAtTime(1,i),l.setValueAtTime(0,i)),this.decay&&c.setTargetAtTime(u,this._decayFrom,o(this.decay))}},stop:{value:function(i,c){c&&(i=i-this.release);var l=i+this.release;if(this.release){var h=this._multiplier.gain,u=this._startAmount.gain,p=this._endAmount.gain;h.cancelScheduledValues(i),u.cancelScheduledValues(i),p.cancelScheduledValues(i);var d=o(this.release);if(this.attack&&i<this._decayFrom){var m=s(0,1,this._startedAt,this._decayFrom,i);h.linearRampToValueAtTime(m,i),u.linearRampToValueAtTime(1-m,i),u.setTargetAtTime(0,i,d)}p.setTargetAtTime(1,i,d),h.setTargetAtTime(0,i,d)}return this._voltage.stop(l),l}},onended:{get:function(){return this._voltage.onended},set:function(i){this._voltage.onended=i}}},t=new Float32Array([1,1]);function e(i){var c=i.createBufferSource(),l=i.createBuffer(1,2,i.sampleRate);return l.getChannelData(0).set(t),c.buffer=l,c.loop=!0,c}function n(i){var c=i.context.createGain();return i.connect(c),c}function o(i){return Math.log(i+1)/Math.log(100)}function s(i,c,l,h,u){var p=c-i,d=h-l,m=u-l,f=m/d,v=i+f*p;return v<=i&&(v=i),v>=c&&(v=c),v}return ht}var ft,Ln;function cP(){if(Ln)return ft;Ln=1;var r=iP(),a={},t={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function e(c,l,h){var u=!1,p=0,d={},m=c.createGain();m.gain.value=1;var f=Object.assign({},t,h),v={context:c,out:m,opts:f};return l instanceof AudioBuffer?v.buffer=l:v.buffers=l,v.start=function(R,T,P){if(v.buffer&&R!==null)return v.start(null,R,T);var C=R?v.buffers[R]:v.buffer;if(C){if(!u){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+R+" not found.");return}var S=P||a;T=Math.max(c.currentTime,T||0),v.emit("start",T,R,S);var _=q(R,C,S);return _.id=x(R,_),_.env.start(T),_.source.start(T),v.emit("started",T,_.id,_),S.duration&&_.stop(T+S.duration),_},v.play=function(R,T,P){return v.start(R,T,P)},v.stop=function(R,T){var P;return T=T||Object.keys(d),T.map(function(C){return P=d[C],P?(P.stop(R),P.id):null})},v.connect=function(R){return u=!0,m.connect(R),v},v.emit=function(R,T,P,C){v.onevent&&v.onevent(R,T,P,C);var S=v["on"+R];S&&S(T,P,C)},v;function x(R,T){return T.id=p++,d[T.id]=T,T.source.onended=function(){var P=c.currentTime;T.source.disconnect(),T.env.disconnect(),T.disconnect(),v.emit("ended",P,T.id,T)},T.id}function q(R,T,P){var C=c.createGain();return C.gain.value=0,C.connect(m),C.env=s(c,P,f),C.env.connect(C.gain),C.source=c.createBufferSource(),C.source.buffer=T,C.source.connect(C),C.source.loop=P.loop||f.loop,C.source.playbackRate.value=i(P.cents||f.cents),C.source.loopStart=P.loopStart||f.loopStart,C.source.loopEnd=P.loopEnd||f.loopEnd,C.stop=function(S){var _=S||c.currentTime;v.emit("stop",_,R);var D=C.env.stop(_);C.source.stop(D)},C}}function n(c){return typeof c=="number"}var o=["attack","decay","sustain","release"];function s(c,l,h){var u=r(c),p=l.adsr||h.adsr;return o.forEach(function(d,m){p?u[d]=p[m]:u[d]=l[d]||h[d]}),u.value.value=n(l.gain)?l.gain:n(h.gain)?h.gain:1,u}function i(c){return c?Math.pow(2,c/1200):1}return ft=e,ft}var gt,Gn;function sP(){if(Gn)return gt;Gn=1,gt=function(a){return a.on=function(t,e){if(arguments.length===1&&typeof t=="function")return a.on("event",t);var n="on"+t,o=a[n];return a[n]=o?r(o,e):e,a},a};function r(a,t){return function(e,n,o,s){a(e,n,o,s),t(e,n,o,s)}}return gt}var St,xn;function lP(){if(xn)return St;xn=1;var r=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function a(){return r}var t=[0,2,4,5,7,9,11];function e(i,c,l){if(typeof i!="string")return null;var h=r.exec(i);if(!h||!c&&h[4])return null;var u={letter:h[1].toUpperCase(),acc:h[2].replace(/x/g,"##")};return u.pc=u.letter+u.acc,u.step=(u.letter.charCodeAt(0)+3)%7,u.alt=u.acc[0]==="b"?-u.acc.length:u.acc.length,u.chroma=t[u.step]+u.alt,h[3]&&(u.oct=+h[3],u.midi=u.chroma+12*(u.oct+1),u.freq=n(u.midi,l)),c&&(u.tonicOf=h[4]),u}function n(i,c){return Math.pow(2,(i-69)/12)*(c||440)}var o={parse:e,regex:a,midiToFreq:n},s=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];return s.forEach(function(i){o[i]=function(c){var l=e(c);return l&&typeof l[i]<"u"?l[i]:null}}),St=o,St}var Tt,Kn;function uP(){if(Kn)return Tt;Kn=1;var r=lP(),a=function(n){return n!==null&&n!==[]&&n>=0&&n<129},t=function(n){return a(n)?+n:r.midi(n)};Tt=function(n){if(n.buffers){var o=n.opts.map,s=typeof o=="function"?o:t,i=function(l){return l?s(l)||l:null};n.buffers=e(n.buffers,i);var c=n.start;n.start=function(l,h,u){var p=i(l),d=p%1;return d&&(p=Math.floor(p),u=Object.assign(u||{},{cents:Math.floor(d*100)})),c(p,h,u)}}return n};function e(n,o){return Object.keys(n).reduce(function(s,i){return s[o(i)]=n[i],s},{})}return Tt}var Ct,qn;function PP(){if(qn)return Ct;qn=1;var r=Array.isArray,a=function(e){return e&&typeof e=="object"},t={};return Ct=function(e){return e.schedule=function(n,o){var s=e.context.currentTime,i=n<s?s:n;e.emit("schedule",i,o);var c,l,h,u;return o.map(function(p){if(p)r(p)?(c=p[0],l=p[1]):(c=p.time,l=p);else return null;return a(l)?(h=l.name||l.key||l.note||l.midi||null,u=l):(h=l,u=t),e.start(h,i+(c||0),u)})},e},Ct}function Ye(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vt={exports:{}},Nn;function dP(){return Nn||(Nn=1,function(r,a){(function(t){r.exports=t()})(function(){return function t(e,n,o){function s(l,h){if(!n[l]){if(!e[l]){var u=typeof Ye=="function"&&Ye;if(!h&&u)return u(l,!0);if(i)return i(l,!0);var p=new Error("Cannot find module '"+l+"'");throw p.code="MODULE_NOT_FOUND",p}var d=n[l]={exports:{}};e[l][0].call(d.exports,function(m){var f=e[l][1][m];return s(f||m)},d,d.exports,t,e,n,o)}return n[l].exports}for(var i=typeof Ye=="function"&&Ye,c=0;c<o.length;c++)s(o[c]);return s}({1:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o){function s(i){if(this._event=i,this._data=i.data,this.receivedTime=i.receivedTime,this._data&&this._data.length<2){console.warn("Illegal MIDI message of length",this._data.length);return}switch(this._messageCode=i.data[0]&240,this.channel=i.data[0]&15,this._messageCode){case 128:this.messageType="noteoff",this.key=i.data[1]&127,this.velocity=i.data[2]&127;break;case 144:this.messageType="noteon",this.key=i.data[1]&127,this.velocity=i.data[2]&127;break;case 160:this.messageType="keypressure",this.key=i.data[1]&127,this.pressure=i.data[2]&127;break;case 176:this.messageType="controlchange",this.controllerNumber=i.data[1]&127,this.controllerValue=i.data[2]&127,this.controllerNumber===120&&this.controllerValue===0?this.channelModeMessage="allsoundoff":this.controllerNumber===121?this.channelModeMessage="resetallcontrollers":this.controllerNumber===122?this.controllerValue===0?this.channelModeMessage="localcontroloff":this.channelModeMessage="localcontrolon":this.controllerNumber===123&&this.controllerValue===0?this.channelModeMessage="allnotesoff":this.controllerNumber===124&&this.controllerValue===0?this.channelModeMessage="omnimodeoff":this.controllerNumber===125&&this.controllerValue===0?this.channelModeMessage="omnimodeon":this.controllerNumber===126?this.channelModeMessage="monomodeon":this.controllerNumber===127&&(this.channelModeMessage="polymodeon");break;case 192:this.messageType="programchange",this.program=i.data[1];break;case 208:this.messageType="channelpressure",this.pressure=i.data[1]&127;break;case 224:this.messageType="pitchbendchange";var c=i.data[2]&127,l=i.data[1]&127;this.pitchBend=(c<<8)+l;break}}return new s(o)},e.exports=n.default},{}]},{},[1])(1)})}(vt)),vt.exports}var Rt,Wn;function mP(){if(Wn)return Rt;Wn=1;var r=dP();return Rt=function(a){return a.listenToMidi=function(t,e){var n={},o=e||{},s=o.gain||function(i){return i/127};return t.onmidimessage=function(i){var c=i.messageType?i:r(i);if(c.messageType==="noteon"&&c.velocity===0&&(c.messageType="noteoff"),!(o.channel&&c.channel!==o.channel))switch(c.messageType){case"noteon":n[c.key]=a.play(c.key,0,{gain:s(c.velocity)});break;case"noteoff":n[c.key]&&(n[c.key].stop(),delete n[c.key]);break}},a},a},Rt}var Un;function pP(){return Un||(Un=1,function(r){var a=cP(),t=sP(),e=uP(),n=PP(),o=mP();function s(i,c,l){return o(n(e(t(a(i,c,l)))))}r.exports&&(r.exports=s),typeof window<"u"&&(window.SamplePlayer=s)}(pt)),pt.exports}function jn(r,a){return Array(a+1).join(r)}function Zt(r){return typeof r=="number"}function hP(r){return typeof r=="string"}function fP(r){return typeof r<"u"}function fc(r,a){return Math.pow(2,(r-69)/12)*(a||440)}var gc=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function gP(){return gc}var SP=[0,2,4,5,7,9,11];function Ce(r,a,t){if(typeof r!="string")return null;var e=gc.exec(r);if(!e||!a&&e[4])return null;var n={letter:e[1].toUpperCase(),acc:e[2].replace(/x/g,"##")};n.pc=n.letter+n.acc,n.step=(n.letter.charCodeAt(0)+3)%7,n.alt=n.acc[0]==="b"?-n.acc.length:n.acc.length;var o=SP[n.step]+n.alt;return n.chroma=o<0?12+o:o%12,e[3]&&(n.oct=+e[3],n.midi=o+12*(n.oct+1),n.freq=fc(n.midi,t)),a&&(n.tonicOf=e[4]),n}var TP="CDEFGAB";function CP(r){return Zt(r)?r<0?jn("b",-r):jn("#",r):""}function vP(r){return Zt(r)?""+r:""}function Sc(r,a,t){return r===null||typeof r>"u"?null:r.step?Sc(r.step,r.alt,r.oct):r<0||r>6?null:TP.charAt(r)+CP(a)+vP(t)}function Tc(r){if((Zt(r)||hP(r))&&r>=0&&r<128)return+r;var a=Ce(r);return a&&fP(a.midi)?a.midi:null}function RP(r,a){var t=Tc(r);return t===null?null:fc(t,a)}function _P(r){return(Ce(r)||{}).letter}function bP(r){return(Ce(r)||{}).acc}function HP(r){return(Ce(r)||{}).pc}function yP(r){return(Ce(r)||{}).step}function MP(r){return(Ce(r)||{}).alt}function kP(r){return(Ce(r)||{}).chroma}function wP(r){return(Ce(r)||{}).oct}const BP=Object.freeze(Object.defineProperty({__proto__:null,acc:bP,alt:MP,build:Sc,chroma:kP,freq:RP,letter:_P,midi:Tc,oct:wP,parse:Ce,pc:HP,regex:gP,step:yP},Symbol.toStringTag,{value:"Module"})),DP=Cu(BP);var _t,zn;function OP(){if(zn)return _t;zn=1;var r=DP;function a(n,o){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof a))return new a(n);this.nameToUrl=o||a.nameToUrl,this.ctx=n,this.instruments={},this.promises=[]}a.prototype.onready=function(n){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(n)},a.prototype.instrument=function(n,o){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var s=this.ctx;if(n=n||"default",n in this.instruments)return this.instruments[n];var i={name:n,play:e(s,o)};if(this.instruments[n]=i,n!=="default"){var c=a.instrument(s,n,o).then(function(l){return i.play=l.play,i});this.promises.push(c),i.onready=function(l){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),c.then(l)}}else i.onready=function(l){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),l()};return i};function t(n,o,s){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),a.instrument(n,o,s).then(function(i){return i.buffers})}a.loadBuffers=t;function e(n,o){return o=o||{},function(s,i,c,l){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var h=s>0&&s<129?+s:r.midi(s),u=h?r.midiToFreq(h,440):null;if(u){c=c||.2,l=l||{};var p=l.destination||o.destination||n.destination,d=l.vcoType||o.vcoType||"sine",m=l.gain||o.gain||.4,f=n.createOscillator();f.type=d,f.frequency.value=u;var v=n.createGain();return v.gain.value=m,f.connect(v),v.connect(p),f.start(i),c>0&&f.stop(i+c),f}}}return a.noteToMidi=r.midi,_t=a,_t}var Fn;function AP(){return Fn||(Fn=1,function(r){var a=oP(),t=pP();function e(i,c,l){if(arguments.length===1)return function(m,f){return e(i,m,f)};var h=l||{},u=h.isSoundfontURL||n,p=h.nameToUrl||o,d=u(c)?c:p(c,h.soundfont,h.format);return a(i,d,{only:h.only||h.notes}).then(function(m){var f=t(i,m,h).connect(h.destination?h.destination:i.destination);return f.url=d,f.name=c,f})}function n(i){return/\.js(\?.*)?$/i.test(i)}function o(i,c,l){return l=l==="ogg"?l:"mp3",c=c==="FluidR3_GM"?c:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+c+"/"+i+"-"+l+".js"}var s=OP();s.instrument=e,s.nameToUrl=o,r.exports&&(r.exports=s),typeof window<"u"&&(window.Soundfont=s)}(ut)),ut.exports}var EP=AP();const In=We(EP),Vn=r=>r!=null&&!Number.isNaN(r),Cc=r=>{const{audioContext:a,format:t,hostname:e,instrumentName:n,onChange:o,render:s,soundfont:i}=r,[c,l]=B.useState(!0),[h,u]=B.useState({}),[p,d]=B.useState(null),m=B.useCallback(q=>{d(null),Vn(e)?In.instrument(a,q,{format:t,soundfont:i,nameToUrl:(R,T,P)=>`${e}/${T}/${R}-${P}.js`}).then(R=>{d(R)}):n?In.instrument(a,n).then(R=>{d(R)}):l(!1)},[a,t,e,n,i]);return B.useEffect(()=>{n&&m(n)},[n,m]),B.useEffect(()=>{Vn(n)&&l(!p)},[p,n]),s({isLoading:c,playNote:q=>{p&&a.resume().then(()=>{const R=p.play(String(q));u(T=>({...T,[q]:R}))})},stopNote:q=>{a.resume().then(()=>{if(!h[q])return;h[q].stop(),u(T=>{const{[q]:P,...C}=T;return C})}),o==null||o(q)},stopAllNotes:()=>{a.resume().then(()=>{const q=Object.values(h);for(const R of q)R&&R.stop();u(q)})}})},bt=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],LP=12,GP=LP*.7,xP=new window.AudioContext,KP=({octave:r,height:a,width:t,...e})=>{const o=(t/GP+2)/a,s=mn(bt[0]+String(r))||0,i=mn(bt[bt.length-1]+String(r))||0;return y.jsx("div",{children:y.jsx(Qt,{keyWidthToHeight:o,noteRange:{first:s,last:i},width:t,...e})})},qP=({format:r,height:a,hostname:t,instrumentName:e,octave:n=4,onChange:o,onClick:s,onDoubleClick:i,onKeyMouseEnter:c,onKeyMouseLeave:l,soundfont:h,Tooltip:u,width:p})=>y.jsx(Cc,{audioContext:xP,format:r,hostname:t,instrumentName:e,onChange:o,soundfont:h,render:({isLoading:d,playNote:m,stopNote:f})=>y.jsxs(y.Fragment,{children:[y.jsx("div",{children:y.jsxs("h2",{children:["Octave: ",n]})}),y.jsx(KP,{disabled:d,height:a,octave:n,onClick:s,onDoubleClick:i,onKeyMouseEnter:c,onKeyMouseLeave:l,playNote:m,stopNote:f,Tooltip:u,width:p})]})}),Kt="__react_svg_text_measurement_id",NP=(r,a,t,e)=>{const{lineHeight:n,spaceWidth:o,wordsWithComputedWidth:s}=a;return r.split(/\s+/).reduce((i,c)=>{const l=s[c],h=i[i.length-1];if(h&&h.width+l+o<t)h.words.push(c),h.width+=l+o;else{const u={words:[c],width:l,showLine:e?n*(i.length+1)<e:!0};i.push(u)}return i},[])},WP=(r,a,t)=>{var e;if(r&&a){Array.from(r).forEach(c=>a.style.setProperty(c,r.getPropertyValue(c),r.getPropertyPriority(c)));const o=[...new Set(String(t).split(/\s+/))].reduce((c,l)=>(a.textContent=l,{...c,[l]:a.getBBox().width}),{});a.textContent=" ";const s=((e=a==null?void 0:a.getComputedTextLength)==null?void 0:e.call(a))||8,i=a.getBBox().height;return a.setAttribute("style",""),{wordsWithComputedWidth:o,spaceWidth:s,lineHeight:i}}},qt=r=>{const{className:a="",dx:t=0,dy:e=0,maxHeight:n=1e3,maxWidth:o=1e3,text:s="",verticalAnchor:i="start",x:c=0,y:l=0,transform:h="",...u}=r,[p,d]=B.useState(),[m,f]=B.useState([]),[v,x]=B.useState(),q=B.useRef({}),R=B.useMemo(()=>{const C=m.filter(({showLine:S})=>S);return C.length?C:s.split(/\n/).map(S=>({words:[S],width:0,showLine:!0}))},[m,s]),T=B.useCallback(C=>{x(C!==null?window.getComputedStyle(C):void 0)},[]);B.useEffect(()=>{const C=document.getElementById(Kt);if(C===null){const S=document.createElementNS("http://www.w3.org/2000/svg","svg");return S.setAttribute("id",Kt),document.body.appendChild(S),S.appendChild(document.createElementNS("http://www.w3.org/2000/svg","text")),q.current=S,()=>{document.body.removeChild(S)}}q.current=C},[]),B.useEffect(()=>{const C=WP(v,q.current,s);d(C)},[s,v]),B.useEffect(()=>{if(o&&p){const C=s.split(/\n/).flatMap(S=>NP(S,p,o,n));f(C)}},[n,o,p,s]);const P=B.useMemo(()=>{if(p!=null&&p.lineHeight)switch(i){case"start":return p.lineHeight;case"middle":return-((R.length-1)*p.lineHeight/2);default:return-(R.length-1)*p.lineHeight}return 0},[R.length,i,p==null?void 0:p.lineHeight]);return y.jsx("text",{className:a,ref:T,dx:t,dy:e,x:c,y:l,transform:h,...u,children:y.jsxs(y.Fragment,{children:[R.map((C,S)=>y.jsx("tspan",{dx:c+t,dy:S===0?P+e:(p==null?void 0:p.lineHeight)||0,x:0,children:C.words.join(" ")},S)),m.length&&R.length!==m.length&&y.jsxs(y.Fragment,{children:[y.jsx("tspan",{children:"..."}),y.jsx("title",{children:s})]})]})})},Ae=255,{IndicatorsContainer:UP,Placeholder:Xn,ValueContainer:jP}=Dt.components,zP={label:"--",value:Ae},Jn=r=>{var n;const{children:a,...t}=r,e=(n=t.selectProps)==null?void 0:n.actionButton;return y.jsx(UP,{...t,children:y.jsxs("div",{onMouseDown:o=>{o.stopPropagation(),o.preventDefault()},style:{display:"flex"},children:[e,a]})})},FP=({children:r,...a})=>y.jsxs(jP,{...a,children:[y.jsx(Xn,{...a,innerProps:a.innerProps||{},className:a.hasValue||a.selectProps.inputValue?"shrunk":"",isFocused:a.isFocused??!1,children:a.selectProps.placeholder}),B.Children.map(r,t=>B.isValidElement(t)&&t.type!==Xn?t:null)]}),he=B.forwardRef((r,a)=>{const{components:t,disabled:e,label:n,onChange:o,options:s=[],preserveMenuWidth:i,shrinkLabel:c,value:l,...h}=r,u=B.useCallback(f=>{f&&o(f.value)},[o]),p=s.reduce((f,v)=>"entries"in v?f.concat(v.entries):f.concat(v),[]),d=p.find(f=>l===f.value)||void 0,m=B.useMemo(()=>{const f=i?{menu:v=>Ni("width")(v),menuList:v=>({...v,overflowX:"hidden"}),option:v=>({...v,whiteSpace:"nowrap",paddingRight:10})}:{};return c?{...f,container:v=>({...v,marginTop:10}),placeholder:(v,x)=>({position:"absolute",left:x.hasValue||x.selectProps.inputValue?-2:"4%",top:x.hasValue||x.selectProps.inputValue?-12:"50%",transition:"top 0.1s, font-size 0.1s, color 0.1s",fontSize:(x.hasValue||x.selectProps.inputValue)&&13}),valueContainer:v=>({...v,overflow:"visible"})}:{...f}},[i,c]);return c?y.jsx("div",{className:"zds-pickers__container",children:y.jsx(Dt,{...h,classNamePrefix:"zds-pickers",components:{IndicatorsContainer:Jn,ValueContainer:FP,...t},isDisabled:e,onChange:u,options:p,placeholder:n,ref:a,styles:m,value:d})}):y.jsxs("div",{className:"zds-pickers__container",children:[!!n&&y.jsx("span",{className:"zds-pickers__label",children:n}),y.jsx(Dt,{...h,classNamePrefix:"zds-pickers",components:{IndicatorsContainer:Jn,...t},isDisabled:e,onChange:u,options:p,ref:a,styles:m,value:d})]})}),IP=B.forwardRef((r,a)=>y.jsx(he,{...r,options:Wi,ref:a})),VP=Ne(16).map(r=>({value:r,label:r})),XP=B.forwardRef(({channels:r,className:a,...t},e)=>{const[n,o]=B.useState([]),s=B.useCallback(({value:i,label:c},{context:l})=>{if(i==="separator")return y.jsx("span",{className:"zds-mappings-user-mapping",children:c});if(typeof i!="number")return null;const h=r[i];return h?y.jsxs("span",{className:"mapping-entry",children:[y.jsx("b",{children:i!==Ae&&y.jsxs(y.Fragment,{children:[i+1,l==="value"&&" -"]})}),y.jsx("span",{className:"mapping-entry-label",children:h.label})]}):y.jsxs("span",{className:"mapping-entry empty-mapping-entry",children:[y.jsx("b",{children:i!==Ae&&y.jsxs(y.Fragment,{children:[i+1,l==="value"&&" -"]})}),y.jsx("span",{className:"mapping-entry-label",children:"no mapping"})]})},[r]);return B.useEffect(()=>{const i=VP.sort((h,u)=>typeof h.value=="number"&&typeof u.value=="number"&&r[h.value]&&!r[u.value]?-1:typeof h.value=="number"&&typeof u.value=="number"&&!r[h.value]&&r[u.value]?1:typeof h.value=="number"&&typeof u.value=="number"?h.value-u.value:0),c=i.filter(({value:h})=>typeof h=="number"&&!!r[h]||h===Ae).length,l=i.some(({value:h})=>h==="separator");c&&c<16&&!l&&i.splice(c,0,{label:y.jsx("hr",{}),value:"separator"}),o(i)},[r]),y.jsx(he,{...t,className:Ue(a,"channel-mapping-picker"),formatOptionLabel:s,options:n,ref:e})}),JP=Ne(16).map(r=>({value:r,label:`Channel ${r+1}`})),$P=(r,a)=>a?String(r.label).toLowerCase().includes(a.toLowerCase()):!0,YP=B.forwardRef(({className:r,value:a=Ae,...t},e)=>{const n=B.useCallback((o,{context:s})=>a===void 0?"--":s==="value"?o.label:Number.parseInt(String(o.value))+1,[a]);return y.jsx(he,{...t,className:Ue(r,"channel-picker"),filterOptions:$P,formatOptionLabel:n,options:JP,value:a,ref:e})}),en=r=>{const[a,t]=B.useState(r);return B.useEffect(()=>{t(r)},[r]),[a,t]};var Ht,$n;function QP(){return $n||($n=1,Ht=function(r){var a={};function t(e){if(a[e])return a[e].exports;var n=a[e]={i:e,l:!1,exports:{}};return r[e].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=r,t.c=a,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n||4&n&&typeof e=="object"&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&typeof e!="string")for(var s in e)t.d(o,s,(function(i){return e[i]}).bind(null,s));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([function(r,a){r.exports=B},function(r,a){r.exports=mc()},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e,n=t(0),o=((e=n)&&e.__esModule?e:{default:e}).default.createContext(null);a.default=o},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0}),a.SvgLoader=a.SvgProxy=void 0;var e=o(t(4)),n=o(t(8));function o(s){return s&&s.__esModule?s:{default:s}}a.SvgProxy=n.default,a.SvgLoader=e.default},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e=Object.assign||function(u){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var m in d)Object.prototype.hasOwnProperty.call(d,m)&&(u[m]=d[m])}return u},n=function(){function u(p,d){for(var m=0;m<d.length;m++){var f=d[m];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,d,m){return d&&u(p.prototype,d),m&&u(p,m),p}}(),o=l(t(0)),s=l(t(1)),i=l(t(5)),c=l(t(2));function l(u){return u&&u.__esModule?u:{default:u}}var h=function(u){function p(d){(function(f,v){if(!(f instanceof v))throw new TypeError("Cannot call a class as a function")})(this,p);var m=function(f,v){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!v||typeof v!="object"&&typeof v!="function"?f:v}(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,d));if(m.mounted=!1,m.state={svg:null,svgCount:0},o.default.Fragment==null)throw new Error("This version of React doesn't support Fragments, please update it");return m.onSVGReady=m.onSVGReady.bind(m),m}return function(d,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);d.prototype=Object.create(m&&m.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(d,m):d.__proto__=m)}(p,u),n(p,[{key:"componentDidMount",value:function(){this.mounted=!0}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"onSVGReady",value:function(d){var m=this;setTimeout(function(){m.mounted&&(m.setState(e({},m.state,{svg:d,svgCount:m.state.svgCount+1})),m.props.onSVGReady(d))},0)}},{key:"render",value:function(){var d=this.props,m=d.path,f=(d.onSVGReady,d.children,d.svgXML),v=function(q,R){var T={};for(var P in q)R.indexOf(P)>=0||Object.prototype.hasOwnProperty.call(q,P)&&(T[P]=q[P]);return T}(d,["path","onSVGReady","children","svgXML"]),x=this.state.svg!=null?this.props.children:null;return o.default.createElement(o.default.Fragment,null,o.default.createElement(i.default,e({path:m,callback:this.onSVGReady,svgXML:f},v)),o.default.createElement(c.default.Provider,{value:{path:m,svgCount:this.state.svgCount,svg:this.state.svg}},x))}}]),p}(o.default.Component);a.default=h,h.propTypes={path:s.default.string,svgXML:s.default.string,onSVGReady:s.default.func,style:s.default.object,children:s.default.any},h.defaultProps={path:null,svgXML:null,onSVGReady:function(){},style:null}},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e=Object.assign||function(u){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var m in d)Object.prototype.hasOwnProperty.call(d,m)&&(u[m]=d[m])}return u},n=function(){function u(p,d){for(var m=0;m<d.length;m++){var f=d[m];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,d,m){return d&&u(p.prototype,d),m&&u(p,m),p}}(),o=i(t(1)),s=i(t(0));function i(u){return u&&u.__esModule?u:{default:u}}function c(u,p){var d={};for(var m in u)p.indexOf(m)>=0||Object.prototype.hasOwnProperty.call(u,m)&&(d[m]=u[m]);return d}var l=typeof window<"u"?t(6):void 0,h=function(u){function p(){(function(m,f){if(!(m instanceof f))throw new TypeError("Cannot call a class as a function")})(this,p);var d=function(m,f){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!f||typeof f!="object"&&typeof f!="function"?m:f}(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.refCallback=d.refCallback.bind(d),d}return function(d,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);d.prototype=Object.create(m&&m.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(d,m):d.__proto__=m)}(p,u),n(p,[{key:"componentDidUpdate",value:function(d){this.props.path===d.path&&this.props.svgXML===d.svgXML||(this.container&&(this.container.innerHTML=""),this.renderSVG(this.props))}},{key:"refCallback",value:function(d){d&&(this.container=d,this.renderSVG())}},{key:"renderSVG",value:function(){var d=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props,f=this.container,v=m.callback,x=(m.path,m.svgXML),q=(m.className,c(m,["callback","path","svgXML","className"]));l(f,{each:function(R){if(R)throw new Error(R);v(d.container)},svgXML:x},function(){f&&q&&Object.keys(q).reduce(function(R,T){return T!=="style"&&R.setAttribute(T,q[T]),f},f)})}},{key:"render",value:function(){var d=this.props,m=(d.callback,d.path,d.svgXML,c(d,["callback","path","svgXML"]));return s.default.createElement("svg",e({ref:this.refCallback,"data-src":this.props.path},m))}}]),p}(s.default.Component);a.default=h,h.defaultProps={callback:function(){},path:null,svgXML:null},h.propTypes={callback:o.default.func,path:o.default.string,svgXML:o.default.string}},function(r,a,t){(function(e){var n,o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};/**
|
|
25
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zu(r,a){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var e=t.call(r,a||"default");if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(r)}function pc(r){var a=zu(r,"string");return typeof a=="symbol"?a:String(a)}var Fu=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],Iu=["Db","Eb","Gb","Ab","Bb"],Vu={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11},Aa=12,Vt=Aa,Xt=127,Xu=/([a-g])([#b]?)(\d+)/,xt=12;function Ju(r){if(!r)throw Error("Invalid note argument");var a=Xu.exec(r.toLowerCase());if(!a)throw Error("Invalid note argument");var t=Nu(a,4),e=t[1],n=t[2],o=t[3],s="".concat(e.toUpperCase()).concat(n),i=Vu[s];if(i==null)throw Error("Invalid note argument");return Aa+i+xt*parseInt(o,10)}function $u(r){var a=(r-Aa)%xt,t=Math.floor((r-Aa)/xt),e=Fu[a];return{note:"".concat(e).concat(t),pitchName:e,octave:t,midiNumber:r,isAccidental:Iu.includes(e)}}function Yu(){return Ft(Vt,Xt+1).reduce(function(r,a){return r[a]=$u(a),r},{})}var Qu=Yu();function hc(r){var a=Qu[r];if(!a)throw Error("Invalid MIDI number");return a}var Zu=Ft(Vt,Xt+1).filter(function(r){return!hc(r).isAccidental}),Ea={fromNote:Ju,getAttributes:hc,MIN_MIDI_NUMBER:Vt,MAX_MIDI_NUMBER:Xt,NATURAL_MIDI_NUMBERS:Zu},eP=60,Jt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"onPlayNoteInput",function(){e.props.onPlayNoteInput(e.props.midiNumber)}),Z(se(e),"onStopNoteInput",function(){e.props.onStopNoteInput(e.props.midiNumber),e.props.onKeyMouseLeave&&e.props.onKeyMouseLeave(e.props.midiNumber)}),e}return Na(t,[{key:"getAbsoluteKeyPosition",value:function(n){var o=7,s=Ea.getAttributes(n),i=s.octave,c=s.pitchName,l=this.props.pitchPositions[c],h=o*i;return l+h}},{key:"getRelativeKeyPosition",value:function(n){return this.getAbsoluteKeyPosition(n)-this.getAbsoluteKeyPosition(this.props.noteRange.first)}},{key:"render",value:function(){var n=this,o=this.props,s=o.naturalKeyWidth,i=o.accidentalWidthRatio,c=o.midiNumber,l=o.gliss,h=o.useTouchEvents,u=o.accidental,p=o.active,d=o.disabled,m=o.children,f=lt(u?this.getRelativeKeyPosition(c)*s:this.getRelativeKeyPosition(c)*s),v=lt(u?i*s:s);return B.createElement("div",{"data-midinumber":c,className:Ue("ReactPiano__Key",{"ReactPiano__Key--accidental":u,"ReactPiano__Key--natural":!u,"ReactPiano__Key--disabled":d,"ReactPiano__Key--active":p,"ReactPiano__Key--middleC":c===eP}),style:{left:f,width:v},onDoubleClick:function(){n.props.onDoubleClick&&n.props.onDoubleClick(c)},onMouseDown:h?null:this.onPlayNoteInput,onMouseUp:function(){n.props.onClick&&n.props.onClick(c),h||n.onStopNoteInput()},onMouseEnter:function(){n.props.onKeyMouseEnter&&n.props.onKeyMouseEnter({accidental:u,left:f,midiNumber:c,width:v}),l&&n.onPlayNoteInput()},onMouseLeave:this.onStopNoteInput,onTouchStart:h?this.onPlayNoteInput:null,onTouchCancel:h?this.onStopNoteInput:null,onTouchEnd:h?this.onStopNoteInput:null},B.createElement("div",{className:"ReactPiano__NoteLabelContainer"},m))}}]),t}(B.Component);Z(Jt,"propTypes",{midiNumber:L.number.isRequired,naturalKeyWidth:L.number.isRequired,gliss:L.bool.isRequired,useTouchEvents:L.bool.isRequired,accidental:L.bool.isRequired,active:L.bool.isRequired,disabled:L.bool.isRequired,onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,accidentalWidthRatio:L.number.isRequired,pitchPositions:L.object.isRequired,children:L.node});Z(Jt,"defaultProps",{accidentalWidthRatio:.65,onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,pitchPositions:{C:0,Db:.672,D:1,Eb:1.672,E:2,F:3,Gb:3.672,G:4,Ab:4.672,A:5,Bb:5.672,B:6}});function lt(r){return"".concat(r*100,"%")}var $t=function(r){Wa(t,r);var a=Ua(t);function t(){return qa(this,t),a.apply(this,arguments)}return Na(t,[{key:"getMidiNumbers",value:function(){return Ft(this.props.noteRange.first,this.props.noteRange.last+1)}},{key:"getNaturalKeyCount",value:function(){return this.getMidiNumbers().filter(function(n){var o=Ea.getAttributes(n),s=o.isAccidental;return!s}).length}},{key:"getNaturalKeyWidth",value:function(){return 1/this.getNaturalKeyCount()}},{key:"getWidth",value:function(){return this.props.width?this.props.width:"100%"}},{key:"getHeight",value:function(){if(!this.props.width)return"100%";var n=this.props.width*this.getNaturalKeyWidth();return"".concat(n/this.props.keyWidthToHeight,"px")}},{key:"render",value:function(){var n=this,o=this.getNaturalKeyWidth();return B.createElement("div",{className:Ue("ReactPiano__Keyboard",this.props.className),style:{width:this.getWidth(),height:this.getHeight()}},this.getMidiNumbers().map(function(s){var i=Ea.getAttributes(s);i.note;var c=i.isAccidental,l=!n.props.disabled&&n.props.activeNotes.includes(s);return B.createElement(Jt,{accidental:c,active:l,disabled:n.props.disabled,gliss:n.props.gliss,key:s,midiNumber:s,naturalKeyWidth:o,noteRange:n.props.noteRange,onClick:n.props.onClick,onDoubleClick:n.props.onDoubleClick,onKeyMouseEnter:n.props.onKeyMouseEnter,onKeyMouseLeave:n.props.onKeyMouseLeave,onPlayNoteInput:n.props.onPlayNoteInput,onStopNoteInput:n.props.onStopNoteInput,useTouchEvents:n.props.useTouchEvents},n.props.disabled?null:n.props.renderNoteLabel({isActive:l,isAccidental:c,midiNumber:s}))}))}}]),t}(B.Component);Z($t,"propTypes",{noteRange:rP,activeNotes:L.arrayOf(L.number),onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,renderNoteLabel:L.func.isRequired,keyWidthToHeight:L.number.isRequired,className:L.string,disabled:L.bool,gliss:L.bool,useTouchEvents:L.bool,width:L.number});Z($t,"defaultProps",{disabled:!1,gliss:!1,keyWidthToHeight:.33,onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,renderNoteLabel:function(){},useTouchEvents:!1});function Bn(r){return typeof r!="number"?!1:Ea.NATURAL_MIDI_NUMBERS.includes(r)}function rP(r,a,t){var e=r[a],n=e.first,o=e.last;if(!n||!o)return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a," must be an object with .first and .last values."));if(!Bn(n)||!Bn(o))return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a," values must be valid MIDI numbers, and should not be accidentals (sharp or flat notes)."));if(n>=o)return new Error("Invalid prop ".concat(a," supplied to ").concat(t,". ").concat(a,".first must be smaller than ").concat(a,".last."))}var Yt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"state",{isMouseDown:!1,useTouchEvents:!1}),Z(se(e),"handleNoteChanges",function(i){var c=i.prevActiveNotes,l=i.nextActiveNotes;if(!e.props.disabled){var h=kn(c,l),u=kn(l,c);u.forEach(function(p){e.props.playNote(p)}),h.forEach(function(p){e.props.stopNote(p)})}}),Z(se(e),"getMidiNumberForKey",function(i){if(!e.props.keyboardShortcuts)return null;var c=e.props.keyboardShortcuts.find(function(l){return l.key===i});return c&&c.midiNumber}),Z(se(e),"getKeyForMidiNumber",function(i){if(!e.props.keyboardShortcuts)return null;var c=e.props.keyboardShortcuts.find(function(l){return l.midiNumber===i});return c&&c.key}),Z(se(e),"onKeyDown",function(i){if(!(i.ctrlKey||i.metaKey||i.shiftKey)){var c=e.getMidiNumberForKey(i.key);c&&e.onPlayNoteInput(c)}}),Z(se(e),"onKeyUp",function(i){var c=e.getMidiNumberForKey(i.key);c&&e.onStopNoteInput(c)}),Z(se(e),"onPlayNoteInput",function(i){e.props.disabled||e.props.onPlayNoteInput(i,e.props.activeNotes)}),Z(se(e),"onStopNoteInput",function(i){e.props.disabled||e.props.onStopNoteInput(i,e.props.activeNotes)}),Z(se(e),"onMouseDown",function(){e.setState({isMouseDown:!0})}),Z(se(e),"onMouseUp",function(){e.setState({isMouseDown:!1})}),Z(se(e),"onTouchStart",function(){e.setState({useTouchEvents:!0})}),Z(se(e),"renderNoteLabel",function(i){var c=i.midiNumber,l=i.isActive,h=i.isAccidental,u=e.getKeyForMidiNumber(c);return e.props.renderNoteLabel({keyboardShortcut:u,midiNumber:c,isActive:l,isAccidental:h})}),e}return Na(t,[{key:"componentDidMount",value:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)}},{key:"componentDidUpdate",value:function(n,o){this.props.activeNotes!==n.activeNotes&&this.handleNoteChanges({prevActiveNotes:n.activeNotes||[],nextActiveNotes:this.props.activeNotes||[]})}},{key:"render",value:function(){return B.createElement("div",{style:{width:"100%",height:"100%"},onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchStart:this.onTouchStart,"data-testid":"container"},B.createElement($t,{activeNotes:this.props.activeNotes,className:this.props.className,disabled:this.props.disabled,gliss:this.state.isMouseDown,keyWidthToHeight:this.props.keyWidthToHeight,noteRange:this.props.noteRange,onClick:this.props.onClick,onDoubleClick:this.props.onDoubleClick,onKeyMouseEnter:this.props.onKeyMouseEnter,onKeyMouseLeave:this.props.onKeyMouseLeave,onPlayNoteInput:this.onPlayNoteInput,onStopNoteInput:this.onStopNoteInput,renderNoteLabel:this.renderNoteLabel,useTouchEvents:this.state.useTouchEvents,width:this.props.width}))}}]),t}(B.Component);Z(Yt,"propTypes",{noteRange:L.object.isRequired,activeNotes:L.arrayOf(L.number.isRequired).isRequired,playNote:L.func.isRequired,stopNote:L.func.isRequired,onClick:L.func,onDoubleClick:L.func,onKeyMouseEnter:L.func,onKeyMouseLeave:L.func,onPlayNoteInput:L.func.isRequired,onStopNoteInput:L.func.isRequired,renderNoteLabel:L.func.isRequired,className:L.string,disabled:L.bool,width:L.number,keyWidthToHeight:L.number,keyboardShortcuts:L.arrayOf(L.shape({key:L.string.isRequired,midiNumber:L.number.isRequired}))});Z(Yt,"defaultProps",{onKeyMouseEnter:void 0,onKeyMouseLeave:void 0,renderNoteLabel:function(a){var t=a.keyboardShortcut;a.midiNumber;var e=a.isActive,n=a.isAccidental;return t?B.createElement("div",{className:Ue("ReactPiano__NoteLabel",{"ReactPiano__NoteLabel--active":e,"ReactPiano__NoteLabel--accidental":n,"ReactPiano__NoteLabel--natural":!n})},t):null}});var aP=["activeNotes","onPlayNoteInput","onStopNoteInput"],Qt=function(r){Wa(t,r);var a=Ua(t);function t(){var e;qa(this,t);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=a.call.apply(a,[this].concat(o)),Z(se(e),"state",{activeNotes:e.props.activeNotes||[]}),Z(se(e),"handlePlayNoteInput",function(i){e.setState(function(c){return e.props.onPlayNoteInput&&e.props.onPlayNoteInput(i,{prevActiveNotes:c.activeNotes}),c.activeNotes.includes(i)?null:{activeNotes:c.activeNotes.concat(i)}})}),Z(se(e),"handleStopNoteInput",function(i){e.setState(function(c){return e.props.onStopNoteInput&&e.props.onStopNoteInput(i,{prevActiveNotes:e.state.activeNotes}),{activeNotes:c.activeNotes.filter(function(l){return i!==l})}})}),e}return Na(t,[{key:"componentDidUpdate",value:function(n){n.activeNotes!==this.props.activeNotes&&this.state.activeNotes!==this.props.activeNotes&&this.setState({activeNotes:this.props.activeNotes||[]})}},{key:"render",value:function(){var n=this.props;n.activeNotes,n.onPlayNoteInput,n.onStopNoteInput;var o=Ku(n,aP);return B.createElement(Yt,Lt({activeNotes:this.state.activeNotes,onPlayNoteInput:this.handlePlayNoteInput,onStopNoteInput:this.handleStopNoteInput},o))}}]),t}(B.Component);Z(Qt,"propTypes",{noteRange:L.object.isRequired,activeNotes:L.arrayOf(L.number.isRequired),playNote:L.func.isRequired,stopNote:L.func.isRequired,onPlayNoteInput:L.func,onStopNoteInput:L.func,renderNoteLabel:L.func,className:L.string,disabled:L.bool,width:L.number,keyWidthToHeight:L.number,keyboardShortcuts:L.arrayOf(L.shape({key:L.string.isRequired,midiNumber:L.number.isRequired}))});var ut={exports:{}},Pt={exports:{}},dt,Dn;function tP(){if(Dn)return dt;Dn=1;function r(t){return t>64&&t<91?t-65:t>96&&t<123?t-71:t>47&&t<58?t+4:t===43?62:t===47?63:0}function a(t,e){for(var n=t.replace(/[^A-Za-z0-9\+\/]/g,""),o=n.length,s=e?Math.ceil((o*3+1>>2)/e)*e:o*3+1>>2,i=new Uint8Array(s),c,l,h=0,u=0,p=0;p<o;p++)if(l=p&3,h|=r(n.charCodeAt(p))<<18-6*l,l===3||o-p===1){for(c=0;c<3&&u<s;c++,u++)i[u]=h>>>(16>>>c&24)&255;h=0}return i}return dt={decode:a},dt}var mt,On;function nP(){return On||(On=1,mt=function(r,a){return new Promise(function(t,e){var n=new XMLHttpRequest;a&&(n.responseType=a),n.open("GET",r),n.onload=function(){n.status===200?t(n.response):e(Error(n.statusText))},n.onerror=function(){e(Error("Network Error"))},n.send()})}),mt}var An;function oP(){return An||(An=1,function(r){var a=tP(),t=nP();function e(S){return function(_){return typeof _=="string"&&S.test(_)}}function n(S,_){return typeof S=="string"?S+_:typeof S=="function"?S(_):_}function o(S,_,D,K){var F=s(_)?i:c(_)?l:h(_)?u:p(_)?d:m(_)?f:v(_)?x:q(_)?R:T(_)?P:null,X=D||{};return F?F(S,_,X):K?Promise.resolve(K):Promise.reject("Source not valid ("+_+")")}o.fetch=t;function s(S){return S instanceof ArrayBuffer}function i(S,_,D){return new Promise(function(K,F){S.decodeAudioData(_,function(X){K(X)},function(){F("Can't decode audio data ("+_.slice(0,30)+"...)")})})}var c=e(/\.(mp3|wav|ogg)(\?.*)?$/i);function l(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"arraybuffer"),D)}function h(S){return S&&typeof S.then=="function"}function u(S,_,D){return _.then(function(K){return o(S,K,D)})}var p=Array.isArray;function d(S,_,D){return Promise.all(_.map(function(K){return o(S,K,D,K)}))}function m(S){return S&&typeof S=="object"}function f(S,_,D){var K={},F=Object.keys(_).map(function(X){if(D.only&&D.only.indexOf(X)===-1)return null;var ie=_[X];return o(S,ie,D,ie).then(function(oe){K[X]=oe})});return Promise.all(F).then(function(){return K})}var v=e(/\.json(\?.*)?$/i);function x(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"text").then(JSON.parse),D)}var q=e(/^data:audio/);function R(S,_,D){var K=_.indexOf(",");return o(S,a.decode(_.slice(K+1)).buffer,D)}var T=e(/\.js(\?.*)?$/i);function P(S,_,D){var K=n(D.from,_);return o(S,o.fetch(K,"text").then(C),D)}function C(S){var _=S.indexOf("MIDI.Soundfont.");if(_<0)throw Error("Invalid MIDI.js Soundfont format");_=S.indexOf("=",_)+2;var D=S.lastIndexOf(",");return JSON.parse(S.slice(_,D)+"}")}r.exports&&(r.exports=o),typeof window<"u"&&(window.loadAudio=o)}(Pt)),Pt.exports}var pt={exports:{}},ht,En;function iP(){if(En)return ht;En=1,ht=r;function r(i){var c=i.createGain(),l=c._voltage=e(i),h=n(l),u=n(l),p=n(l);return c._startAmount=n(u),c._endAmount=n(p),c._multiplier=n(h),c._multiplier.connect(c),c._startAmount.connect(c),c._endAmount.connect(c),c.value=h.gain,c.startValue=u.gain,c.endValue=p.gain,c.startValue.value=0,c.endValue.value=0,Object.defineProperties(c,a),c}var a={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(i){var c=this._multiplier.gain,l=this._startAmount.gain,h=this._endAmount.gain;this._voltage.start(i),this._decayFrom=this._decayFrom=i+this.attack,this._startedAt=i;var u=this.sustain;c.cancelScheduledValues(i),l.cancelScheduledValues(i),h.cancelScheduledValues(i),h.setValueAtTime(0,i),this.attack?(c.setValueAtTime(0,i),c.linearRampToValueAtTime(1,i+this.attack),l.setValueAtTime(1,i),l.linearRampToValueAtTime(0,i+this.attack)):(c.setValueAtTime(1,i),l.setValueAtTime(0,i)),this.decay&&c.setTargetAtTime(u,this._decayFrom,o(this.decay))}},stop:{value:function(i,c){c&&(i=i-this.release);var l=i+this.release;if(this.release){var h=this._multiplier.gain,u=this._startAmount.gain,p=this._endAmount.gain;h.cancelScheduledValues(i),u.cancelScheduledValues(i),p.cancelScheduledValues(i);var d=o(this.release);if(this.attack&&i<this._decayFrom){var m=s(0,1,this._startedAt,this._decayFrom,i);h.linearRampToValueAtTime(m,i),u.linearRampToValueAtTime(1-m,i),u.setTargetAtTime(0,i,d)}p.setTargetAtTime(1,i,d),h.setTargetAtTime(0,i,d)}return this._voltage.stop(l),l}},onended:{get:function(){return this._voltage.onended},set:function(i){this._voltage.onended=i}}},t=new Float32Array([1,1]);function e(i){var c=i.createBufferSource(),l=i.createBuffer(1,2,i.sampleRate);return l.getChannelData(0).set(t),c.buffer=l,c.loop=!0,c}function n(i){var c=i.context.createGain();return i.connect(c),c}function o(i){return Math.log(i+1)/Math.log(100)}function s(i,c,l,h,u){var p=c-i,d=h-l,m=u-l,f=m/d,v=i+f*p;return v<=i&&(v=i),v>=c&&(v=c),v}return ht}var ft,Ln;function cP(){if(Ln)return ft;Ln=1;var r=iP(),a={},t={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function e(c,l,h){var u=!1,p=0,d={},m=c.createGain();m.gain.value=1;var f=Object.assign({},t,h),v={context:c,out:m,opts:f};return l instanceof AudioBuffer?v.buffer=l:v.buffers=l,v.start=function(R,T,P){if(v.buffer&&R!==null)return v.start(null,R,T);var C=R?v.buffers[R]:v.buffer;if(C){if(!u){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+R+" not found.");return}var S=P||a;T=Math.max(c.currentTime,T||0),v.emit("start",T,R,S);var _=q(R,C,S);return _.id=x(R,_),_.env.start(T),_.source.start(T),v.emit("started",T,_.id,_),S.duration&&_.stop(T+S.duration),_},v.play=function(R,T,P){return v.start(R,T,P)},v.stop=function(R,T){var P;return T=T||Object.keys(d),T.map(function(C){return P=d[C],P?(P.stop(R),P.id):null})},v.connect=function(R){return u=!0,m.connect(R),v},v.emit=function(R,T,P,C){v.onevent&&v.onevent(R,T,P,C);var S=v["on"+R];S&&S(T,P,C)},v;function x(R,T){return T.id=p++,d[T.id]=T,T.source.onended=function(){var P=c.currentTime;T.source.disconnect(),T.env.disconnect(),T.disconnect(),v.emit("ended",P,T.id,T)},T.id}function q(R,T,P){var C=c.createGain();return C.gain.value=0,C.connect(m),C.env=s(c,P,f),C.env.connect(C.gain),C.source=c.createBufferSource(),C.source.buffer=T,C.source.connect(C),C.source.loop=P.loop||f.loop,C.source.playbackRate.value=i(P.cents||f.cents),C.source.loopStart=P.loopStart||f.loopStart,C.source.loopEnd=P.loopEnd||f.loopEnd,C.stop=function(S){var _=S||c.currentTime;v.emit("stop",_,R);var D=C.env.stop(_);C.source.stop(D)},C}}function n(c){return typeof c=="number"}var o=["attack","decay","sustain","release"];function s(c,l,h){var u=r(c),p=l.adsr||h.adsr;return o.forEach(function(d,m){p?u[d]=p[m]:u[d]=l[d]||h[d]}),u.value.value=n(l.gain)?l.gain:n(h.gain)?h.gain:1,u}function i(c){return c?Math.pow(2,c/1200):1}return ft=e,ft}var gt,Gn;function sP(){if(Gn)return gt;Gn=1,gt=function(a){return a.on=function(t,e){if(arguments.length===1&&typeof t=="function")return a.on("event",t);var n="on"+t,o=a[n];return a[n]=o?r(o,e):e,a},a};function r(a,t){return function(e,n,o,s){a(e,n,o,s),t(e,n,o,s)}}return gt}var St,xn;function lP(){if(xn)return St;xn=1;var r=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function a(){return r}var t=[0,2,4,5,7,9,11];function e(i,c,l){if(typeof i!="string")return null;var h=r.exec(i);if(!h||!c&&h[4])return null;var u={letter:h[1].toUpperCase(),acc:h[2].replace(/x/g,"##")};return u.pc=u.letter+u.acc,u.step=(u.letter.charCodeAt(0)+3)%7,u.alt=u.acc[0]==="b"?-u.acc.length:u.acc.length,u.chroma=t[u.step]+u.alt,h[3]&&(u.oct=+h[3],u.midi=u.chroma+12*(u.oct+1),u.freq=n(u.midi,l)),c&&(u.tonicOf=h[4]),u}function n(i,c){return Math.pow(2,(i-69)/12)*(c||440)}var o={parse:e,regex:a,midiToFreq:n},s=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];return s.forEach(function(i){o[i]=function(c){var l=e(c);return l&&typeof l[i]<"u"?l[i]:null}}),St=o,St}var Tt,Kn;function uP(){if(Kn)return Tt;Kn=1;var r=lP(),a=function(n){return n!==null&&n!==[]&&n>=0&&n<129},t=function(n){return a(n)?+n:r.midi(n)};Tt=function(n){if(n.buffers){var o=n.opts.map,s=typeof o=="function"?o:t,i=function(l){return l?s(l)||l:null};n.buffers=e(n.buffers,i);var c=n.start;n.start=function(l,h,u){var p=i(l),d=p%1;return d&&(p=Math.floor(p),u=Object.assign(u||{},{cents:Math.floor(d*100)})),c(p,h,u)}}return n};function e(n,o){return Object.keys(n).reduce(function(s,i){return s[o(i)]=n[i],s},{})}return Tt}var Ct,qn;function PP(){if(qn)return Ct;qn=1;var r=Array.isArray,a=function(e){return e&&typeof e=="object"},t={};return Ct=function(e){return e.schedule=function(n,o){var s=e.context.currentTime,i=n<s?s:n;e.emit("schedule",i,o);var c,l,h,u;return o.map(function(p){if(p)r(p)?(c=p[0],l=p[1]):(c=p.time,l=p);else return null;return a(l)?(h=l.name||l.key||l.note||l.midi||null,u=l):(h=l,u=t),e.start(h,i+(c||0),u)})},e},Ct}function Ye(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vt={exports:{}},Nn;function dP(){return Nn||(Nn=1,function(r,a){(function(t){r.exports=t()})(function(){return function t(e,n,o){function s(l,h){if(!n[l]){if(!e[l]){var u=typeof Ye=="function"&&Ye;if(!h&&u)return u(l,!0);if(i)return i(l,!0);var p=new Error("Cannot find module '"+l+"'");throw p.code="MODULE_NOT_FOUND",p}var d=n[l]={exports:{}};e[l][0].call(d.exports,function(m){var f=e[l][1][m];return s(f||m)},d,d.exports,t,e,n,o)}return n[l].exports}for(var i=typeof Ye=="function"&&Ye,c=0;c<o.length;c++)s(o[c]);return s}({1:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o){function s(i){if(this._event=i,this._data=i.data,this.receivedTime=i.receivedTime,this._data&&this._data.length<2){console.warn("Illegal MIDI message of length",this._data.length);return}switch(this._messageCode=i.data[0]&240,this.channel=i.data[0]&15,this._messageCode){case 128:this.messageType="noteoff",this.key=i.data[1]&127,this.velocity=i.data[2]&127;break;case 144:this.messageType="noteon",this.key=i.data[1]&127,this.velocity=i.data[2]&127;break;case 160:this.messageType="keypressure",this.key=i.data[1]&127,this.pressure=i.data[2]&127;break;case 176:this.messageType="controlchange",this.controllerNumber=i.data[1]&127,this.controllerValue=i.data[2]&127,this.controllerNumber===120&&this.controllerValue===0?this.channelModeMessage="allsoundoff":this.controllerNumber===121?this.channelModeMessage="resetallcontrollers":this.controllerNumber===122?this.controllerValue===0?this.channelModeMessage="localcontroloff":this.channelModeMessage="localcontrolon":this.controllerNumber===123&&this.controllerValue===0?this.channelModeMessage="allnotesoff":this.controllerNumber===124&&this.controllerValue===0?this.channelModeMessage="omnimodeoff":this.controllerNumber===125&&this.controllerValue===0?this.channelModeMessage="omnimodeon":this.controllerNumber===126?this.channelModeMessage="monomodeon":this.controllerNumber===127&&(this.channelModeMessage="polymodeon");break;case 192:this.messageType="programchange",this.program=i.data[1];break;case 208:this.messageType="channelpressure",this.pressure=i.data[1]&127;break;case 224:this.messageType="pitchbendchange";var c=i.data[2]&127,l=i.data[1]&127;this.pitchBend=(c<<8)+l;break}}return new s(o)},e.exports=n.default},{}]},{},[1])(1)})}(vt)),vt.exports}var Rt,Wn;function mP(){if(Wn)return Rt;Wn=1;var r=dP();return Rt=function(a){return a.listenToMidi=function(t,e){var n={},o=e||{},s=o.gain||function(i){return i/127};return t.onmidimessage=function(i){var c=i.messageType?i:r(i);if(c.messageType==="noteon"&&c.velocity===0&&(c.messageType="noteoff"),!(o.channel&&c.channel!==o.channel))switch(c.messageType){case"noteon":n[c.key]=a.play(c.key,0,{gain:s(c.velocity)});break;case"noteoff":n[c.key]&&(n[c.key].stop(),delete n[c.key]);break}},a},a},Rt}var Un;function pP(){return Un||(Un=1,function(r){var a=cP(),t=sP(),e=uP(),n=PP(),o=mP();function s(i,c,l){return o(n(e(t(a(i,c,l)))))}r.exports&&(r.exports=s),typeof window<"u"&&(window.SamplePlayer=s)}(pt)),pt.exports}function jn(r,a){return Array(a+1).join(r)}function Zt(r){return typeof r=="number"}function hP(r){return typeof r=="string"}function fP(r){return typeof r<"u"}function fc(r,a){return Math.pow(2,(r-69)/12)*(a||440)}var gc=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function gP(){return gc}var SP=[0,2,4,5,7,9,11];function Ce(r,a,t){if(typeof r!="string")return null;var e=gc.exec(r);if(!e||!a&&e[4])return null;var n={letter:e[1].toUpperCase(),acc:e[2].replace(/x/g,"##")};n.pc=n.letter+n.acc,n.step=(n.letter.charCodeAt(0)+3)%7,n.alt=n.acc[0]==="b"?-n.acc.length:n.acc.length;var o=SP[n.step]+n.alt;return n.chroma=o<0?12+o:o%12,e[3]&&(n.oct=+e[3],n.midi=o+12*(n.oct+1),n.freq=fc(n.midi,t)),a&&(n.tonicOf=e[4]),n}var TP="CDEFGAB";function CP(r){return Zt(r)?r<0?jn("b",-r):jn("#",r):""}function vP(r){return Zt(r)?""+r:""}function Sc(r,a,t){return r===null||typeof r>"u"?null:r.step?Sc(r.step,r.alt,r.oct):r<0||r>6?null:TP.charAt(r)+CP(a)+vP(t)}function Tc(r){if((Zt(r)||hP(r))&&r>=0&&r<128)return+r;var a=Ce(r);return a&&fP(a.midi)?a.midi:null}function RP(r,a){var t=Tc(r);return t===null?null:fc(t,a)}function _P(r){return(Ce(r)||{}).letter}function bP(r){return(Ce(r)||{}).acc}function HP(r){return(Ce(r)||{}).pc}function yP(r){return(Ce(r)||{}).step}function MP(r){return(Ce(r)||{}).alt}function kP(r){return(Ce(r)||{}).chroma}function wP(r){return(Ce(r)||{}).oct}const BP=Object.freeze(Object.defineProperty({__proto__:null,acc:bP,alt:MP,build:Sc,chroma:kP,freq:RP,letter:_P,midi:Tc,oct:wP,parse:Ce,pc:HP,regex:gP,step:yP},Symbol.toStringTag,{value:"Module"})),DP=Cu(BP);var _t,zn;function OP(){if(zn)return _t;zn=1;var r=DP;function a(n,o){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof a))return new a(n);this.nameToUrl=o||a.nameToUrl,this.ctx=n,this.instruments={},this.promises=[]}a.prototype.onready=function(n){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(n)},a.prototype.instrument=function(n,o){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var s=this.ctx;if(n=n||"default",n in this.instruments)return this.instruments[n];var i={name:n,play:e(s,o)};if(this.instruments[n]=i,n!=="default"){var c=a.instrument(s,n,o).then(function(l){return i.play=l.play,i});this.promises.push(c),i.onready=function(l){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),c.then(l)}}else i.onready=function(l){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),l()};return i};function t(n,o,s){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),a.instrument(n,o,s).then(function(i){return i.buffers})}a.loadBuffers=t;function e(n,o){return o=o||{},function(s,i,c,l){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var h=s>0&&s<129?+s:r.midi(s),u=h?r.midiToFreq(h,440):null;if(u){c=c||.2,l=l||{};var p=l.destination||o.destination||n.destination,d=l.vcoType||o.vcoType||"sine",m=l.gain||o.gain||.4,f=n.createOscillator();f.type=d,f.frequency.value=u;var v=n.createGain();return v.gain.value=m,f.connect(v),v.connect(p),f.start(i),c>0&&f.stop(i+c),f}}}return a.noteToMidi=r.midi,_t=a,_t}var Fn;function AP(){return Fn||(Fn=1,function(r){var a=oP(),t=pP();function e(i,c,l){if(arguments.length===1)return function(m,f){return e(i,m,f)};var h=l||{},u=h.isSoundfontURL||n,p=h.nameToUrl||o,d=u(c)?c:p(c,h.soundfont,h.format);return a(i,d,{only:h.only||h.notes}).then(function(m){var f=t(i,m,h).connect(h.destination?h.destination:i.destination);return f.url=d,f.name=c,f})}function n(i){return/\.js(\?.*)?$/i.test(i)}function o(i,c,l){return l=l==="ogg"?l:"mp3",c=c==="FluidR3_GM"?c:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+c+"/"+i+"-"+l+".js"}var s=OP();s.instrument=e,s.nameToUrl=o,r.exports&&(r.exports=s),typeof window<"u"&&(window.Soundfont=s)}(ut)),ut.exports}var EP=AP();const In=We(EP),Vn=r=>r!=null&&!Number.isNaN(r),Cc=r=>{const{audioContext:a,format:t,hostname:e,instrumentName:n,onChange:o,render:s,soundfont:i}=r,[c,l]=B.useState(!0),[h,u]=B.useState({}),[p,d]=B.useState(null),m=B.useCallback(q=>{d(null),Vn(e)?In.instrument(a,q,{format:t,soundfont:i,nameToUrl:(R,T,P)=>`${e}/${T}/${R}-${P}.js`}).then(R=>{d(R)}):n?In.instrument(a,n).then(R=>{d(R)}):l(!1)},[a,t,e,n,i]);return B.useEffect(()=>{n&&m(n)},[n,m]),B.useEffect(()=>{Vn(n)&&l(!p)},[p,n]),s({isLoading:c,playNote:q=>{p&&a.resume().then(()=>{const R=p.play(String(q));u(T=>({...T,[q]:R}))})},stopNote:q=>{a.resume().then(()=>{if(!h[q])return;h[q].stop(),u(T=>{const{[q]:P,...C}=T;return C})}),o==null||o(q)},stopAllNotes:()=>{a.resume().then(()=>{const q=Object.values(h);for(const R of q)R&&R.stop();u(q)})}})},bt=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],LP=12,GP=LP*.7,xP=new window.AudioContext,KP=({octave:r,height:a,width:t,...e})=>{const o=(t/GP+2)/a,s=mn(bt[0]+String(r))||0,i=mn(bt[bt.length-1]+String(r))||0;return y.jsx("div",{children:y.jsx(Qt,{keyWidthToHeight:o,noteRange:{first:s,last:i},width:t,...e})})},qP=({format:r,height:a,hostname:t,instrumentName:e,octave:n=4,onChange:o,onClick:s,onDoubleClick:i,onKeyMouseEnter:c,onKeyMouseLeave:l,soundfont:h,Tooltip:u,width:p})=>y.jsx(Cc,{audioContext:xP,format:r,hostname:t,instrumentName:e,onChange:o,soundfont:h,render:({isLoading:d,playNote:m,stopNote:f})=>y.jsxs(y.Fragment,{children:[y.jsx("div",{children:y.jsxs("h2",{children:["Octave: ",n]})}),y.jsx(KP,{disabled:d,height:a,octave:n,onClick:s,onDoubleClick:i,onKeyMouseEnter:c,onKeyMouseLeave:l,playNote:m,stopNote:f,Tooltip:u,width:p})]})}),Kt="__react_svg_text_measurement_id",NP=(r,a,t,e)=>{const{lineHeight:n,spaceWidth:o,wordsWithComputedWidth:s}=a;return r.split(/\s+/).reduce((i,c)=>{const l=s[c],h=i[i.length-1];if(h&&h.width+l+o<t)h.words.push(c),h.width+=l+o;else{const u={words:[c],width:l,showLine:e?n*(i.length+1)<e:!0};i.push(u)}return i},[])},WP=(r,a,t)=>{var e;if(r&&a){Array.from(r).forEach(c=>a.style.setProperty(c,r.getPropertyValue(c),r.getPropertyPriority(c)));const o=[...new Set(String(t).split(/\s+/))].reduce((c,l)=>(a.textContent=l,{...c,[l]:a.getBBox().width}),{});a.textContent=" ";const s=((e=a==null?void 0:a.getComputedTextLength)==null?void 0:e.call(a))||8,i=a.getBBox().height;return a.setAttribute("style",""),{wordsWithComputedWidth:o,spaceWidth:s,lineHeight:i}}},qt=r=>{const{className:a="",dx:t=0,dy:e=0,maxHeight:n=1e3,maxWidth:o=1e3,text:s="",verticalAnchor:i="start",x:c=0,y:l=0,transform:h="",...u}=r,[p,d]=B.useState(),[m,f]=B.useState([]),[v,x]=B.useState(),q=B.useRef({}),R=B.useMemo(()=>{const C=m.filter(({showLine:S})=>S);return C.length?C:s.split(/\n/).map(S=>({words:[S],width:0,showLine:!0}))},[m,s]),T=B.useCallback(C=>{x(C!==null?window.getComputedStyle(C):void 0)},[]);B.useEffect(()=>{const C=document.getElementById(Kt);if(C===null){const S=document.createElementNS("http://www.w3.org/2000/svg","svg");return S.setAttribute("id",Kt),document.body.appendChild(S),S.appendChild(document.createElementNS("http://www.w3.org/2000/svg","text")),q.current=S,()=>{document.body.removeChild(S)}}q.current=C},[]),B.useEffect(()=>{const C=WP(v,q.current,s);d(C)},[s,v]),B.useEffect(()=>{if(o&&p){const C=s.split(/\n/).flatMap(S=>NP(S,p,o,n));f(C)}},[n,o,p,s]);const P=B.useMemo(()=>{if(p!=null&&p.lineHeight)switch(i){case"start":return p.lineHeight;case"middle":return-((R.length-1)*p.lineHeight/2);default:return-(R.length-1)*p.lineHeight}return 0},[R.length,i,p==null?void 0:p.lineHeight]);return y.jsx("text",{className:a,ref:T,dx:t,dy:e,x:c,y:l,transform:h,...u,children:y.jsxs(y.Fragment,{children:[R.map((C,S)=>y.jsx("tspan",{dx:c+t,dy:S===0?P+e:(p==null?void 0:p.lineHeight)||0,x:0,children:C.words.join(" ")},S)),m.length&&R.length!==m.length&&y.jsxs(y.Fragment,{children:[y.jsx("tspan",{children:"..."}),y.jsx("title",{children:s})]})]})})},Ae=255,{IndicatorsContainer:UP,Placeholder:Xn,ValueContainer:jP}=Dt.components,zP={label:"--",value:Ae},Jn=r=>{var n;const{children:a,...t}=r,e=(n=t.selectProps)==null?void 0:n.actionButton;return y.jsx(UP,{...t,children:y.jsxs("div",{onMouseDown:o=>{o.stopPropagation(),o.preventDefault()},style:{display:"flex"},children:[e,a]})})},FP=({children:r,...a})=>y.jsxs(jP,{...a,children:[y.jsx(Xn,{...a,innerProps:a.innerProps||{},className:a.hasValue||a.selectProps.inputValue?"shrunk":"",isFocused:a.isFocused??!1,children:a.selectProps.placeholder}),B.Children.map(r,t=>B.isValidElement(t)&&t.type!==Xn?t:null)]}),he=B.forwardRef((r,a)=>{const{components:t,disabled:e,label:n,onChange:o,options:s=[],preserveMenuWidth:i,shrinkLabel:c,value:l,...h}=r,u=B.useCallback(f=>{f&&o(f.value)},[o]),p=s.reduce((f,v)=>"options"in v?f.concat(v.options):f.concat(v),[]),d=p.find(f=>l===f.value)||void 0,m=B.useMemo(()=>{const f=i?{menu:v=>Ni("width")(v),menuList:v=>({...v,overflowX:"hidden"}),option:v=>({...v,whiteSpace:"nowrap",paddingRight:10})}:{};return c?{...f,container:v=>({...v,marginTop:10}),placeholder:(v,x)=>({position:"absolute",left:x.hasValue||x.selectProps.inputValue?-2:"4%",top:x.hasValue||x.selectProps.inputValue?-12:"50%",transition:"top 0.1s, font-size 0.1s, color 0.1s",fontSize:(x.hasValue||x.selectProps.inputValue)&&13}),valueContainer:v=>({...v,overflow:"visible"})}:{...f}},[i,c]);return c?y.jsx("div",{className:"zds-pickers__container",children:y.jsx(Dt,{...h,classNamePrefix:"zds-pickers",components:{IndicatorsContainer:Jn,ValueContainer:FP,...t},isDisabled:e,onChange:u,options:p,placeholder:n,ref:a,styles:m,value:d})}):y.jsxs("div",{className:"zds-pickers__container",children:[!!n&&y.jsx("span",{className:"zds-pickers__label",children:n}),y.jsx(Dt,{...h,classNamePrefix:"zds-pickers",components:{IndicatorsContainer:Jn,...t},isDisabled:e,onChange:u,options:p,ref:a,styles:m,value:d})]})}),IP=B.forwardRef((r,a)=>y.jsx(he,{...r,options:Wi,ref:a})),VP=Ne(16).map(r=>({value:r,label:r})),XP=B.forwardRef(({channels:r,className:a,...t},e)=>{const[n,o]=B.useState([]),s=B.useCallback(({value:i,label:c},{context:l})=>{if(i==="separator")return y.jsx("span",{className:"zds-mappings-user-mapping",children:c});if(typeof i!="number")return null;const h=r[i];return h?y.jsxs("span",{className:"mapping-entry",children:[y.jsx("b",{children:i!==Ae&&y.jsxs(y.Fragment,{children:[i+1,l==="value"&&" -"]})}),y.jsx("span",{className:"mapping-entry-label",children:h.label})]}):y.jsxs("span",{className:"mapping-entry empty-mapping-entry",children:[y.jsx("b",{children:i!==Ae&&y.jsxs(y.Fragment,{children:[i+1,l==="value"&&" -"]})}),y.jsx("span",{className:"mapping-entry-label",children:"no mapping"})]})},[r]);return B.useEffect(()=>{const i=VP.sort((h,u)=>typeof h.value=="number"&&typeof u.value=="number"&&r[h.value]&&!r[u.value]?-1:typeof h.value=="number"&&typeof u.value=="number"&&!r[h.value]&&r[u.value]?1:typeof h.value=="number"&&typeof u.value=="number"?h.value-u.value:0),c=i.filter(({value:h})=>typeof h=="number"&&!!r[h]||h===Ae).length,l=i.some(({value:h})=>h==="separator");c&&c<16&&!l&&i.splice(c,0,{label:y.jsx("hr",{}),value:"separator"}),o(i)},[r]),y.jsx(he,{...t,className:Ue(a,"channel-mapping-picker"),formatOptionLabel:s,options:n,ref:e})}),JP=Ne(16).map(r=>({value:r,label:`Channel ${r+1}`})),$P=(r,a)=>a?String(r.label).toLowerCase().includes(a.toLowerCase()):!0,YP=B.forwardRef(({className:r,value:a=Ae,...t},e)=>{const n=B.useCallback((o,{context:s})=>a===void 0?"--":s==="value"?o.label:Number.parseInt(String(o.value))+1,[a]);return y.jsx(he,{...t,className:Ue(r,"channel-picker"),filterOptions:$P,formatOptionLabel:n,options:JP,value:a,ref:e})}),en=r=>{const[a,t]=B.useState(r);return B.useEffect(()=>{t(r)},[r]),[a,t]};var Ht,$n;function QP(){return $n||($n=1,Ht=function(r){var a={};function t(e){if(a[e])return a[e].exports;var n=a[e]={i:e,l:!1,exports:{}};return r[e].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=r,t.c=a,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n||4&n&&typeof e=="object"&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&typeof e!="string")for(var s in e)t.d(o,s,(function(i){return e[i]}).bind(null,s));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([function(r,a){r.exports=B},function(r,a){r.exports=mc()},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e,n=t(0),o=((e=n)&&e.__esModule?e:{default:e}).default.createContext(null);a.default=o},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0}),a.SvgLoader=a.SvgProxy=void 0;var e=o(t(4)),n=o(t(8));function o(s){return s&&s.__esModule?s:{default:s}}a.SvgProxy=n.default,a.SvgLoader=e.default},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e=Object.assign||function(u){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var m in d)Object.prototype.hasOwnProperty.call(d,m)&&(u[m]=d[m])}return u},n=function(){function u(p,d){for(var m=0;m<d.length;m++){var f=d[m];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,d,m){return d&&u(p.prototype,d),m&&u(p,m),p}}(),o=l(t(0)),s=l(t(1)),i=l(t(5)),c=l(t(2));function l(u){return u&&u.__esModule?u:{default:u}}var h=function(u){function p(d){(function(f,v){if(!(f instanceof v))throw new TypeError("Cannot call a class as a function")})(this,p);var m=function(f,v){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!v||typeof v!="object"&&typeof v!="function"?f:v}(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,d));if(m.mounted=!1,m.state={svg:null,svgCount:0},o.default.Fragment==null)throw new Error("This version of React doesn't support Fragments, please update it");return m.onSVGReady=m.onSVGReady.bind(m),m}return function(d,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);d.prototype=Object.create(m&&m.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(d,m):d.__proto__=m)}(p,u),n(p,[{key:"componentDidMount",value:function(){this.mounted=!0}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"onSVGReady",value:function(d){var m=this;setTimeout(function(){m.mounted&&(m.setState(e({},m.state,{svg:d,svgCount:m.state.svgCount+1})),m.props.onSVGReady(d))},0)}},{key:"render",value:function(){var d=this.props,m=d.path,f=(d.onSVGReady,d.children,d.svgXML),v=function(q,R){var T={};for(var P in q)R.indexOf(P)>=0||Object.prototype.hasOwnProperty.call(q,P)&&(T[P]=q[P]);return T}(d,["path","onSVGReady","children","svgXML"]),x=this.state.svg!=null?this.props.children:null;return o.default.createElement(o.default.Fragment,null,o.default.createElement(i.default,e({path:m,callback:this.onSVGReady,svgXML:f},v)),o.default.createElement(c.default.Provider,{value:{path:m,svgCount:this.state.svgCount,svg:this.state.svg}},x))}}]),p}(o.default.Component);a.default=h,h.propTypes={path:s.default.string,svgXML:s.default.string,onSVGReady:s.default.func,style:s.default.object,children:s.default.any},h.defaultProps={path:null,svgXML:null,onSVGReady:function(){},style:null}},function(r,a,t){Object.defineProperty(a,"__esModule",{value:!0});var e=Object.assign||function(u){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var m in d)Object.prototype.hasOwnProperty.call(d,m)&&(u[m]=d[m])}return u},n=function(){function u(p,d){for(var m=0;m<d.length;m++){var f=d[m];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,d,m){return d&&u(p.prototype,d),m&&u(p,m),p}}(),o=i(t(1)),s=i(t(0));function i(u){return u&&u.__esModule?u:{default:u}}function c(u,p){var d={};for(var m in u)p.indexOf(m)>=0||Object.prototype.hasOwnProperty.call(u,m)&&(d[m]=u[m]);return d}var l=typeof window<"u"?t(6):void 0,h=function(u){function p(){(function(m,f){if(!(m instanceof f))throw new TypeError("Cannot call a class as a function")})(this,p);var d=function(m,f){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!f||typeof f!="object"&&typeof f!="function"?m:f}(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.refCallback=d.refCallback.bind(d),d}return function(d,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);d.prototype=Object.create(m&&m.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(d,m):d.__proto__=m)}(p,u),n(p,[{key:"componentDidUpdate",value:function(d){this.props.path===d.path&&this.props.svgXML===d.svgXML||(this.container&&(this.container.innerHTML=""),this.renderSVG(this.props))}},{key:"refCallback",value:function(d){d&&(this.container=d,this.renderSVG())}},{key:"renderSVG",value:function(){var d=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props,f=this.container,v=m.callback,x=(m.path,m.svgXML),q=(m.className,c(m,["callback","path","svgXML","className"]));l(f,{each:function(R){if(R)throw new Error(R);v(d.container)},svgXML:x},function(){f&&q&&Object.keys(q).reduce(function(R,T){return T!=="style"&&R.setAttribute(T,q[T]),f},f)})}},{key:"render",value:function(){var d=this.props,m=(d.callback,d.path,d.svgXML,c(d,["callback","path","svgXML"]));return s.default.createElement("svg",e({ref:this.refCallback,"data-src":this.props.path},m))}}]),p}(s.default.Component);a.default=h,h.defaultProps={callback:function(){},path:null,svgXML:null},h.propTypes={callback:o.default.func,path:o.default.string,svgXML:o.default.string}},function(r,a,t){(function(e){var n,o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};/**
|
|
26
26
|
* Changes:
|
|
27
27
|
* - Don't replace the node. Justs its innerHTML
|
|
28
28
|
* Adapted from:
|