audio-mixer-ui 0.1.0 → 0.1.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(b,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],t):(b=typeof globalThis<"u"?globalThis:b||self,t(b.ChoirMixerUI={},b.Vue,b.Pinia))})(this,function(b,t,X){"use strict";var re=function(){if(typeof Map<"u")return Map;function e(a,n){var r=-1;return a.some(function(s,i){return s[0]===n?(r=i,!0):!1}),r}return function(){function a(){this.__entries__=[]}return Object.defineProperty(a.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),a.prototype.get=function(n){var r=e(this.__entries__,n),s=this.__entries__[r];return s&&s[1]},a.prototype.set=function(n,r){var s=e(this.__entries__,n);~s?this.__entries__[s][1]=r:this.__entries__.push([n,r])},a.prototype.delete=function(n){var r=this.__entries__,s=e(r,n);~s&&r.splice(s,1)},a.prototype.has=function(n){return!!~e(this.__entries__,n)},a.prototype.clear=function(){this.__entries__.splice(0)},a.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var s=0,i=this.__entries__;s<i.length;s++){var c=i[s];n.call(r,c[1],c[0])}},a}()}(),J=typeof window<"u"&&typeof document<"u"&&window.document===document,G=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Ee=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(G):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Be=2;function Ce(e,a){var n=!1,r=!1,s=0;function i(){n&&(n=!1,e()),r&&h()}function c(){Ee(i)}function h(){var u=Date.now();if(n){if(u-s<Be)return;r=!0}else n=!0,r=!1,setTimeout(c,a);s=u}return h}var Ve=20,Te=["top","right","bottom","left","width","height","size","weight"],we=typeof MutationObserver<"u",xe=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ce(this.refresh.bind(this),Ve)}return e.prototype.addObserver=function(a){~this.observers_.indexOf(a)||this.observers_.push(a),this.connected_||this.connect_()},e.prototype.removeObserver=function(a){var n=this.observers_,r=n.indexOf(a);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var a=this.updateObservers_();a&&this.refresh()},e.prototype.updateObservers_=function(){var a=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return a.forEach(function(n){return n.broadcastActive()}),a.length>0},e.prototype.connect_=function(){!J||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),we?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!J||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(a){var n=a.propertyName,r=n===void 0?"":n,s=Te.some(function(i){return!!~r.indexOf(i)});s&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),se=function(e,a){for(var n=0,r=Object.keys(a);n<r.length;n++){var s=r[n];Object.defineProperty(e,s,{value:a[s],enumerable:!1,writable:!1,configurable:!0})}return e},A=function(e){var a=e&&e.ownerDocument&&e.ownerDocument.defaultView;return a||G},oe=K(0,0,0,0);function Z(e){return parseFloat(e)||0}function ie(e){for(var a=[],n=1;n<arguments.length;n++)a[n-1]=arguments[n];return a.reduce(function(r,s){var i=e["border-"+s+"-width"];return r+Z(i)},0)}function Ne(e){for(var a=["top","right","bottom","left"],n={},r=0,s=a;r<s.length;r++){var i=s[r],c=e["padding-"+i];n[i]=Z(c)}return n}function Pe(e){var a=e.getBBox();return K(0,0,a.width,a.height)}function Oe(e){var a=e.clientWidth,n=e.clientHeight;if(!a&&!n)return oe;var r=A(e).getComputedStyle(e),s=Ne(r),i=s.left+s.right,c=s.top+s.bottom,h=Z(r.width),u=Z(r.height);if(r.boxSizing==="border-box"&&(Math.round(h+i)!==a&&(h-=ie(r,"left","right")+i),Math.round(u+c)!==n&&(u-=ie(r,"top","bottom")+c)),!De(e)){var o=Math.round(h+i)-a,m=Math.round(u+c)-n;Math.abs(o)!==1&&(h-=o),Math.abs(m)!==1&&(u-=m)}return K(s.left,s.top,h,u)}var Ae=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof A(e).SVGGraphicsElement}:function(e){return e instanceof A(e).SVGElement&&typeof e.getBBox=="function"}}();function De(e){return e===A(e).document.documentElement}function Ie(e){return J?Ae(e)?Pe(e):Oe(e):oe}function Le(e){var a=e.x,n=e.y,r=e.width,s=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(i.prototype);return se(c,{x:a,y:n,width:r,height:s,top:n,right:a+r,bottom:s+n,left:a}),c}function K(e,a,n,r){return{x:e,y:a,width:n,height:r}}var Re=function(){function e(a){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=K(0,0,0,0),this.target=a}return e.prototype.isActive=function(){var a=Ie(this.target);return this.contentRect_=a,a.width!==this.broadcastWidth||a.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var a=this.contentRect_;return this.broadcastWidth=a.width,this.broadcastHeight=a.height,a},e}(),$e=function(){function e(a,n){var r=Le(n);se(this,{target:a,contentRect:r})}return e}(),ze=function(){function e(a,n,r){if(this.activeObservations_=[],this.observations_=new re,typeof a!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=a,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(a){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(a instanceof A(a).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(a)||(n.set(a,new Re(a)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(a){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(a instanceof A(a).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(a)&&(n.delete(a),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var a=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&a.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var a=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new $e(r.target,r.broadcastRect())});this.callback_.call(a,n,a),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),le=typeof WeakMap<"u"?new WeakMap:new re,ce=function(){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=xe.getInstance(),r=new ze(a,n,this);le.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ce.prototype[e]=function(){var a;return(a=le.get(this))[e].apply(a,arguments)}});var Fe=function(){return typeof G.ResizeObserver<"u"?G.ResizeObserver:ce}();function w(e){const a=t.ref(0),n=t.ref(0);let r=null;const s=()=>{r&&(r.disconnect(),r=null)},i=()=>{s();const c=t.unref(e);if(!c)return;r=new Fe(u=>{const o=u[0];o&&(a.value=o.contentRect.width,n.value=o.contentRect.height)}),r.observe(c);const h=c.getBoundingClientRect();a.value=h.width,n.value=h.height};return t.watch(()=>t.unref(e),i,{immediate:!0}),t.onScopeDispose(s),{width:t.readonly(a),height:t.readonly(n)}}const C=(e,a)=>{const n=e.__vccOpts||e;for(const[r,s]of a)n[r]=s;return n},Ue={key:0,class:"level"},q=C({__name:"AudioSlider",props:t.mergeModels({min:{type:Number,default:0},max:{type:Number,default:1},step:{type:Number,default:.01},colour:{type:String,default:"grey"},style:{type:String,default:"volume"},thumbLength:{type:Number,default:1},showLevel:{type:Boolean,default:!1},level:{type:Number,default:.5}},{value:{default:.75},valueModifiers:{}}),emits:["update:value"],setup(e){t.useCssVars(f=>({"3d436468":g.value,"345b6e65":v.value,"3327b972":L.value,"5ae48cf2":M.value,"01a7bd27":E.value}));const a=e,n=t.useTemplateRef("root"),{width:r,height:s}=w(n),i=t.computed(()=>Math.min(r.value,s.value)),c=t.computed(()=>Math.max(r.value,s.value)),h=t.computed(()=>r.value>s.value),u=t.computed(()=>h.value?"h-slide":"v-slide"),o=t.useModel(e,"value"),m=t.computed(()=>i.value*.8),p=t.computed(()=>i.value*a.thumbLength*.8),v=t.computed(()=>(h.value?p:m).value+"px"),g=t.computed(()=>(h.value?m:p).value+"px"),M=t.computed(()=>i.value*.1+"px"),E=t.computed(()=>(c.value-p.value)*(o.value-a.min)/(a.max-a.min)+"px"),L=t.computed(()=>h.value?"90deg":"0deg"),S=t.ref(!1),R=t.ref(0),x=f=>{if(!n.value)return o.value;const V=n.value.getBoundingClientRect(),z=f.touches?f.touches[0].clientX:f.clientX,ne=f.touches?f.touches[0].clientY:f.clientY;let F;if(h.value){const U=z-V.left-m.value/2,H=V.width-m.value;F=Math.max(0,Math.min(1,U/H))}else{const U=V.bottom-ne-m.value/2,H=V.height-m.value;F=Math.max(0,Math.min(1,U/H))}const Q=a.min+F*(a.max-a.min);return a.step>0?Math.round(Q/a.step)*a.step:Q},W=f=>{f.preventDefault(),S.value=!0,R.value=o.value,o.value=x(f),n.value&&n.value.setPointerCapture&&n.value.setPointerCapture(f.pointerId),document.addEventListener("mousemove",O),document.addEventListener("mouseup",$)},O=f=>{S.value&&(f.preventDefault(),o.value=x(f))},$=f=>{if(S.value){if(f.preventDefault(),S.value=!1,n.value&&n.value.releasePointerCapture)try{n.value.releasePointerCapture(f.pointerId)}catch{}document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",$)}},y=f=>{f.preventDefault(),f.touches.length===1&&(S.value=!0,R.value=o.value,o.value=x(f),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",B),document.addEventListener("touchcancel",B))},_=f=>{S.value&&(f.preventDefault(),f.touches.length===1&&(o.value=x(f)))},B=f=>{S.value&&(f.preventDefault(),S.value=!1,document.removeEventListener("touchmove",_),document.removeEventListener("touchend",B),document.removeEventListener("touchcancel",B))},T=f=>Math.min(1,Math.max(0,a.level*10-f+1));return(f,V)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(u.value),ref_key:"root",ref:n,onMousedown:W,onTouchstart:y,style:{userSelect:"none",touchAction:"none"}},[V[0]||(V[0]=t.createElementVNode("div",{class:"track"},null,-1)),e.showLevel?(t.openBlock(),t.createElementBlock("div",Ue,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(10,z=>t.createElementVNode("div",{class:t.normalizeClass(["led","led"+z])},[t.createElementVNode("div",{class:"on",style:t.normalizeStyle({opacity:T(z)})},null,4)],2)),64))])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["thumb",{dragging:S.value,[e.colour]:!0,[e.style]:!0}])},null,2)],34))}},[["__scopeId","data-v-1580ed15"]]),ee=C({__name:"TitleText",props:{align:{type:String,default:"left"}},setup(e){t.useCssVars(h=>({"5fddb56d":c.value}));const a=t.useTemplateRef("el"),{width:n,height:r}=w(a),s=t.computed(()=>Math.min(n.value,r.value)),i=t.computed(()=>n.value>r.value?"h-text":"v-text"),c=t.computed(()=>s.value*3/4+"px");return(h,u)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:a,class:"outer"},[t.createElementVNode("div",{class:t.normalizeClass({[i.value]:!0,[e.align]:!0})},[t.renderSlot(h.$slots,"default",{},void 0,!0)],2)],512))}},[["__scopeId","data-v-3ce29e77"]]),ue=C({__name:"TriState",props:{mute:{default:!1},muteModifiers:{},solo:{default:!1},soloModifiers:{}},emits:["update:mute","update:solo"],setup(e){const a=t.useModel(e,"mute"),n=t.useModel(e,"solo"),r=t.useTemplateRef("outer"),{width:s,height:i}=w(r),c=t.computed(()=>s.value>i.value*1.9);function h(){a.value=!a.value,n.value=!1}function u(){n.value=!n.value,a.value=!1}return(o,m)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"outer",ref:r},[t.createElementVNode("div",{class:t.normalizeClass(["solo",{on:n.value}]),onClick:u},null,2),t.createElementVNode("div",{class:"s-label",onClick:u},t.toDisplayString(c.value?"SOLO":"S"),1),t.createElementVNode("div",{class:t.normalizeClass(["mute",{on:a.value}]),onClick:h},null,2),t.createElementVNode("div",{class:"m-label",onClick:h},t.toDisplayString(c.value?"MUTE":"M"),1)],512))}},[["__scopeId","data-v-143eade0"]]),Y={enabled:!1,features:{beatAnimation:!0,randomLevelIndicators:!0,debugMode:!1}},qe=()=>Y.enabled,te=e=>Y.enabled&&Y.features[e],N=X.defineStore("audioState",{state:()=>({isPlaying:!1,currentTime:0,playbackSpeed:1,currentBar:1,currentBeat:1,currentRepeat:0,masterVolume:.75,partVolumes:{},partMuted:{},isLeadInActive:!1,isStartingNotesActive:!1,leadInBars:1}),getters:{formattedTime:e=>{const a=Math.floor(e.currentTime/60),n=Math.floor(e.currentTime%60);return`${a}:${n.toString().padStart(2,"0")}`},getPartVolume:e=>a=>e.partVolumes[a]??.75,isPartMuted:e=>a=>e.partMuted[a]??!1,currentPosition:e=>{let a=`${e.currentBar}.${e.currentBeat}`;return e.currentRepeat>0&&(a+=` (R${e.currentRepeat})`),a}},actions:{setPlaybackState(e){this.isPlaying=e},setCurrentTime(e){this.currentTime=e},setPlaybackSpeed(e){this.playbackSpeed=e},setCurrentBar(e,a=1,n=0){this.currentBar=e,this.currentBeat=a,this.currentRepeat=n},setMasterVolume(e){this.masterVolume=Math.max(0,Math.min(1,e))},setPartVolume(e,a){this.partVolumes[e]=Math.max(0,Math.min(1,a))},setPartMuted(e,a){this.partMuted[e]=a},setLeadInActive(e,a=1){this.isLeadInActive=e,this.leadInBars=a},setStartingNotesActive(e){this.isStartingNotesActive=e},initializeParts(e){e.forEach(a=>{a.name in this.partVolumes||(this.partVolumes[a.name]=a.volume||.75),a.name in this.partMuted||(this.partMuted[a.name]=!1)})}}}),D=X.defineStore("musicData",{state:()=>({beats:[],practiceMarks:{},parts:[],title:"",totalDuration:0,maxBar:0,timeSignature:4,baseTempo:80}),getters:{getTimeFromBar:e=>(a,n=0)=>{const r=e.beats.find(s=>s.bar===a&&s.beat===1&&s.repeat===n);return r?r.time:null},getBarFromTime:e=>a=>{if(!e.beats||e.beats.length===0)return null;let n=null;for(let r=e.beats.length-1;r>=0;r--)if(e.beats[r].time<=a){n=e.beats[r];break}return n?{bar:n.bar,beat:n.beat,repeat:n.repeat,tempo:n.tempo,timeSig:n.timeSig}:null},practiceMarkLetters:e=>Object.keys(e.practiceMarks).sort(),getBarForMark:e=>a=>e.practiceMarks[a],allBars:e=>{const a=new Set;return e.beats.forEach(n=>{n.beat===1&&a.add(n.bar)}),Array.from(a).sort((n,r)=>n-r)},hasRepeats:e=>a=>e.beats.some(n=>n.bar===a&&n.repeat>0)},actions:{loadMusicData(e){this.title=e.title||"Untitled",this.beats=e.beats||[],this.practiceMarks=e.practiceMarks||e.marks||{},this.parts=e.parts||[],this.calculateDuration(),this.calculateMaxBar(),this.extractTimeSignature()},calculateDuration(){this.beats.length>0&&(this.totalDuration=Math.max(...this.beats.map(e=>e.time)))},calculateMaxBar(){this.beats.length>0&&(this.maxBar=Math.max(...this.beats.map(e=>e.bar)))},extractTimeSignature(){this.beats.length>0&&this.beats[0].timeSig&&(this.timeSignature=this.beats[0].timeSig),this.beats.length>0&&this.beats[0].tempo&&(this.baseTempo=this.beats[0].tempo)},setPracticeMark(e,a){this.practiceMarks[e]=a},removePracticeMark(e){delete this.practiceMarks[e]},isValidBar(e,a=0){return this.beats.some(n=>n.bar===e&&n.repeat===a)}}}),de=X.defineStore("playbackState",{state:()=>({transportState:"stopped",autoPlay:!1,loopEnabled:!1,loopStart:1,loopEnd:null,leadInEnabled:!0,leadInBars:1,startingNotesEnabled:!0,startingNotesSequential:!0,metronomeEnabled:!1,metronomeVolume:.5,showTransportControls:!0,showPartControls:!0,showNavigationControls:!0,lastBarPosition:1,lastPracticeMarkUsed:null}),getters:{isPlaying:e=>e.transportState==="playing",isPaused:e=>e.transportState==="paused",isStopped:e=>e.transportState==="stopped",isLoopConfigured:e=>e.loopEnabled&&e.loopStart&&e.loopEnd&&e.loopEnd>e.loopStart,loopRange:e=>!e.loopEnabled||!e.loopStart||!e.loopEnd?null:`${e.loopStart}-${e.loopEnd}`},actions:{setTransportState(e){["stopped","playing","paused"].includes(e)&&(this.transportState=e)},play(){this.setTransportState("playing")},pause(){this.setTransportState("paused")},stop(){this.setTransportState("stopped")},setAutoPlay(e){this.autoPlay=e},setLoop(e,a=null,n=null){this.loopEnabled=e,a!==null&&(this.loopStart=a),n!==null&&(this.loopEnd=n)},setLoopStart(e){this.loopStart=e,this.loopEnd&&this.loopEnd<=e&&(this.loopEnd=e+4)},setLoopEnd(e){this.loopEnd=e,this.loopStart&&this.loopStart>=e&&(this.loopStart=Math.max(1,e-4))},setLeadInEnabled(e){this.leadInEnabled=e},setLeadInBars(e){this.leadInBars=Math.max(1,Math.min(4,e))},setStartingNotesEnabled(e){this.startingNotesEnabled=e},setStartingNotesSequential(e){this.startingNotesSequential=e},setMetronomeEnabled(e){this.metronomeEnabled=e},setMetronomeVolume(e){this.metronomeVolume=Math.max(0,Math.min(1,e))},setTransportControlsVisible(e){this.showTransportControls=e},setPartControlsVisible(e){this.showPartControls=e},setNavigationControlsVisible(e){this.showNavigationControls=e},updateLastBarPosition(e){this.lastBarPosition=e},updateLastPracticeMarkUsed(e){this.lastPracticeMarkUsed=e},resetToDefaults(){this.transportState="stopped",this.autoPlay=!1,this.loopEnabled=!1,this.loopStart=1,this.loopEnd=null,this.leadInEnabled=!0,this.leadInBars=1,this.startingNotesEnabled=!0,this.startingNotesSequential=!0,this.metronomeEnabled=!1,this.metronomeVolume=.5}}});function We(e){return{all:e=e||new Map,on:function(a,n){var r=e.get(a);r?r.push(n):e.set(a,[n])},off:function(a,n){var r=e.get(a);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(a,[]))},emit:function(a,n){var r=e.get(a);r&&r.slice().map(function(s){s(n)}),(r=e.get("*"))&&r.slice().map(function(s){s(a,n)})}}}class me{constructor(){this.eventBus=We(),this.currentTime=0,this.isPlaying=!1,this.playbackSpeed=1,this.masterVolume=.75,this.parts=new Map,this.playbackTimer=null,this.lastTimestamp=0}initialize(a){if(this.musicData=a,this.beats=a.beats||[],this.practiceMarks=a.practiceMarks||{},this.beats.length>0){const n=this.beats[this.beats.length-1],r=n.tempo>0?60/n.tempo:.75;this.songDuration=n.time+r,this.maxBar=Math.max(...this.beats.map(s=>s.bar))}else this.songDuration=0,this.maxBar=0;a.parts&&a.parts.forEach(n=>{this.parts.set(n.name,{name:n.name,volume:n.volume||.75,muted:!1})}),this.eventBus.emit("initialized",{parts:Array.from(this.parts.values())})}play(){this.isPlaying||(this.isPlaying=!0,this.lastTimestamp=performance.now(),this.startPlaybackTimer(),this.eventBus.emit("playbackStateChanged",{isPlaying:!0,currentTime:this.currentTime}))}stop(){this.isPlaying&&(this.isPlaying=!1,this.stopPlaybackTimer(),this.eventBus.emit("playbackStateChanged",{isPlaying:!1,currentTime:this.currentTime}))}pause(){this.stop()}setTime(a){this.currentTime=Math.max(0,a),this.eventBus.emit("timeChanged",{currentTime:this.currentTime});const n=this.getBarFromTime(this.currentTime);n&&this.eventBus.emit("barChanged",n)}getCurrentTime(){return this.currentTime}setBar(a,n=0){const r=this.getTimeFromBar(a,n);r!==null&&this.setTime(r)}goToPracticeMark(a){const n=this.practiceMarks[a];n!==void 0&&(this.setBar(n),this.eventBus.emit("practiceMarkChanged",{mark:a,bar:n}))}setPlaybackSpeed(a){this.playbackSpeed=Math.max(.25,Math.min(2,a)),this.eventBus.emit("speedChanged",{speed:this.playbackSpeed})}getPlaybackSpeed(){return this.playbackSpeed}setMasterVolume(a){this.masterVolume=Math.max(0,Math.min(1,a)),this.eventBus.emit("masterVolumeChanged",{volume:this.masterVolume})}getMasterVolume(){return this.masterVolume}setPartVolume(a,n){const r=this.parts.get(a);r&&(r.volume=Math.max(0,Math.min(1,n)),this.eventBus.emit("partVolumeChanged",{partName:a,volume:r.volume}))}setPartMuted(a,n){const r=this.parts.get(a);r&&(r.muted=n,this.eventBus.emit("partMutedChanged",{partName:a,muted:n}))}getParts(){return Array.from(this.parts.values())}playLeadIn(a=1){this.eventBus.emit("leadInStarted",{bars:a}),setTimeout(()=>{this.eventBus.emit("leadInCompleted")},1e3*a)}playStartingNotes(){this.eventBus.emit("startingNotesStarted"),setTimeout(()=>{this.eventBus.emit("startingNotesCompleted")},2e3)}on(a,n){this.eventBus.on(a,n)}off(a,n){this.eventBus.off(a,n)}startPlaybackTimer(){const a=()=>{if(!this.isPlaying)return;const n=performance.now(),r=(n-this.lastTimestamp)/1e3;if(this.lastTimestamp=n,this.currentTime+=r*this.playbackSpeed,this.songDuration>0&&this.currentTime>=this.songDuration){this.stop(),this.eventBus.emit("songEnded",{finalTime:this.currentTime});return}this.eventBus.emit("timeChanged",{currentTime:this.currentTime});const s=this.getBarFromTime(this.currentTime);if(s&&(this.eventBus.emit("barChanged",s),this.maxBar>0&&s.bar>this.maxBar)){this.stop(),this.eventBus.emit("songEnded",{finalTime:this.currentTime});return}this.playbackTimer=requestAnimationFrame(a)};this.playbackTimer=requestAnimationFrame(a)}stopPlaybackTimer(){this.playbackTimer&&(cancelAnimationFrame(this.playbackTimer),this.playbackTimer=null)}getBarFromTime(a){if(!this.beats||this.beats.length===0)return null;let n=null;for(let r=this.beats.length-1;r>=0;r--)if(this.beats[r].time<=a){n=this.beats[r];break}return n?{bar:n.bar,beat:n.beat,repeat:n.repeat,time:n.time}:null}getTimeFromBar(a,n=0){if(!this.beats||this.beats.length===0)return null;let r=this.beats.find(s=>s.bar===a&&s.beat===1&&s.repeat===n);return!r&&n===0&&(r=this.beats.find(s=>s.bar===a&&s.beat===1)),r?r.time:null}destroy(){this.stop(),this.eventBus.all.clear(),this.parts.clear()}}const d=new me;function I(){const e=N(),a=D(),n=de(),r=({currentTime:l})=>{e.setCurrentTime(l)},s=({isPlaying:l})=>{e.setPlaybackState(l),n.setTransportState(l?"playing":"stopped")},i=l=>{l&&(e.setCurrentBar(l.bar,l.beat,l.repeat),n.updateLastBarPosition(l.bar))},c=({speed:l})=>{e.setPlaybackSpeed(l)},h=({volume:l})=>{e.setMasterVolume(l)},u=({partName:l,volume:k})=>{e.setPartVolume(l,k)},o=({partName:l,muted:k})=>{e.setPartMuted(l,k)},m=({bars:l})=>{e.setLeadInActive(!0,l)},p=()=>{e.setLeadInActive(!1)},v=()=>{e.setStartingNotesActive(!0)},g=()=>{e.setStartingNotesActive(!1)},M=({mark:l})=>{n.updateLastPracticeMarkUsed(l)},E=({parts:l})=>{e.initializeParts(l)},L=({finalTime:l})=>{e.setPlaybackState(!1),n.setTransportState("stopped"),console.log(`Song ended at time: ${l}`)},S=()=>{d.on("timeChanged",r),d.on("playbackStateChanged",s),d.on("barChanged",i),d.on("speedChanged",c),d.on("masterVolumeChanged",h),d.on("partVolumeChanged",u),d.on("partMutedChanged",o),d.on("leadInStarted",m),d.on("leadInCompleted",p),d.on("startingNotesStarted",v),d.on("startingNotesCompleted",g),d.on("practiceMarkChanged",M),d.on("initialized",E),d.on("songEnded",L)},R=()=>{d.off("timeChanged",r),d.off("playbackStateChanged",s),d.off("barChanged",i),d.off("speedChanged",c),d.off("masterVolumeChanged",h),d.off("partVolumeChanged",u),d.off("partMutedChanged",o),d.off("leadInStarted",m),d.off("leadInCompleted",p),d.off("startingNotesStarted",v),d.off("startingNotesCompleted",g),d.off("practiceMarkChanged",M),d.off("initialized",E),d.off("songEnded",L)},x=()=>{t.watchEffect(()=>{const l=e.masterVolume;d.getMasterVolume()!==l&&d.setMasterVolume(l)}),t.watchEffect(()=>{const l=e.playbackSpeed;d.getPlaybackSpeed()!==l&&d.setPlaybackSpeed(l)})},W=l=>{a.loadMusicData(l),d.initialize({beats:l.beats,practiceMarks:l.marks||l.practiceMarks,parts:l.parts}),S(),x()},O=()=>{d.play()},$=()=>{d.stop()},y=()=>{d.pause()},_=l=>{d.setTime(l)},B=(l,k=0)=>{d.setBar(l,k)},T=l=>{d.goToPracticeMark(l)},f=l=>{d.setPlaybackSpeed(l)},V=l=>{d.setMasterVolume(l)},z=(l,k)=>{d.setPartVolume(l,k)},ne=(l,k)=>{d.setPartMuted(l,k)},F=(l=1)=>{d.playLeadIn(l)},Q=()=>{d.playStartingNotes()},U=(l,k=!0,j=0)=>{k&&n.leadInEnabled?(B(l,j),F(n.leadInBars)):(B(l,j),O())},H=(l,k=!0)=>{const j=a.getBarForMark(l);j&&U(j,k)};return t.onUnmounted(()=>{R()}),{initialize:W,play:O,stop:$,pause:y,setTime:_,setBar:B,goToPracticeMark:T,setPlaybackSpeed:f,setMasterVolume:V,setPartVolume:z,setPartMuted:ne,playLeadIn:F,playStartingNotes:Q,playFromBar:U,playFromMark:H,audioState:e,musicData:a,playbackState:n,audioEngine:d}}const he=C({__name:"PartControl",props:t.mergeModels({name:{type:String,required:!0},level:{type:Number,default:0,validator:e=>e>=0&&e<=1}},{volume:{default:.75},volumeModifiers:{},mute:{default:!1},muteModifiers:{},solo:{default:!1},soloModifiers:{}}),emits:["update:volume","update:mute","update:solo"],setup(e){t.useCssVars(g=>({"34cdae44":o.value}));const a=e;N();const n=I(),r=t.useModel(e,"volume"),s=t.useModel(e,"mute"),i=t.useModel(e,"solo");t.watch(r,g=>{n.setPartVolume(a.name,g)}),t.watch(s,g=>{n.setPartMuted(a.name,g)});const c=t.useTemplateRef("el"),{width:h,height:u}=w(c),o=t.computed(()=>Math.min(h.value,u.value)+"px"),m=t.computed(()=>h.value>u.value?"mobile":h.value<60?"tablet":"desktop");let p=null;const v=t.ref(0);return t.onMounted(()=>{te("randomLevelIndicators")&&(p=setInterval(()=>{v.value=s.value?0:Math.random()*r.value},100))}),t.onUnmounted(()=>{p&&(clearInterval(p),p=null)}),(g,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:c,class:t.normalizeClass([m.value,"part"])},[t.createVNode(ue,{class:"tri",mute:s.value,"onUpdate:mute":M[0]||(M[0]=E=>s.value=E),solo:i.value,"onUpdate:solo":M[1]||(M[1]=E=>i.value=E)},null,8,["mute","solo"]),t.createVNode(ee,{align:"left",class:"name"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.name),1)]),_:1}),t.createVNode(q,{level:v.value,"show-level":!0,class:"vol",value:r.value,"onUpdate:value":M[2]||(M[2]=E=>r.value=E)},null,8,["level","value"])],2))}},[["__scopeId","data-v-510493b1"]]),He={class:"mark"},je={key:0,class:"mark-dropdown"},Ge=["onClick"],Ze={class:"rpt"},Ke={class:"beat-ind"},Ye={class:"beat"},pe=C({__name:"BarInput",setup(e){t.useCssVars(y=>({"8ea05ab6":M.value,"1a3336d8":E.value}));const a=t.useTemplateRef("el"),{width:n,height:r}=w(a),s=D(),i=N(),c=I(),h=t.ref(!0);t.watch(()=>i.currentBeat,()=>{h.value=!0,setTimeout(()=>{h.value=!1},50)});let u=null;t.onMounted(()=>{te("beatAnimation")&&(u=setInterval(()=>{const y=i.currentBeat%s.timeSignature+1;i.setCurrentBar(i.currentBar,y,i.currentRepeat)},800))}),t.onUnmounted(()=>{u&&(clearInterval(u),u=null)});const o=t.ref(i.currentBar.toString()),m=t.ref("A");t.ref(i.currentRepeat);const p=t.ref(!1),v=t.ref(!1);t.watch(o,()=>{o.value=o.value.replace(/\D/g,""),o.value.length>3&&(o.value=o.value.slice(0,3))}),t.watch(()=>i.currentBar,y=>{o.value=y.toString()});function g(){const y=parseInt(o.value);y&&y>0&&O(y)}const M=t.computed(()=>Math.min(r.value/2.25,n.value/4.5)+"px"),E=t.computed(()=>Math.min(n.value/15,r.value/6.4)+"px");function L(){p.value=!p.value}function S(){p.value=!1}function R(){v.value=!v.value}function x(){v.value=!1}const W=t.computed(()=>Object.keys(s.practiceMarks).sort());function O(y){c.setBar(y,i.currentRepeat)}function $(y){m.value=y,p.value=!1,c.goToPracticeMark(y)}return(y,_)=>{const B=t.resolveDirective("click-outside");return t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:a,class:t.normalizeClass(["outer",{pulse:h.value}])},[_[1]||(_[1]=t.createElementVNode("div",{class:"frame"},null,-1)),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["mark-input",{empty:!m.value,edit:p.value}]),onClick:L},[t.createElementVNode("div",He,t.toDisplayString(m.value),1)],2)),[[B,S]]),p.value?(t.openBlock(),t.createElementBlock("div",je,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W.value,T=>(t.openBlock(),t.createElementBlock("div",{key:T,class:"mark-option",onClick:f=>$(T)},t.toDisplayString(T),9,Ge))),128))])):t.createCommentVNode("",!0),_[2]||(_[2]=t.createElementVNode("div",{class:"mark-title"},"Mark",-1)),t.withDirectives(t.createElementVNode("input",{type:"text",class:"bar-input","onUpdate:modelValue":_[0]||(_[0]=T=>o.value=T),inputmode:"decimal",pattern:"\\d*",onChange:g,onKeyup:t.withKeys(g,["enter"])},null,544),[[t.vModelText,o.value]]),_[3]||(_[3]=t.createElementVNode("div",{class:"bar-title"},"Bar",-1)),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["rpt-input",{edit:v.value}]),onClick:R},[t.createElementVNode("div",Ze,t.toDisplayString(t.unref(i).currentRepeat||"-"),1)],2)),[[B,x]]),_[4]||(_[4]=t.createElementVNode("div",{class:"rpt-title"},"Rpt",-1)),t.createElementVNode("div",Ke,[t.createElementVNode("div",Ye,t.toDisplayString(t.unref(i).currentBeat),1)]),_[5]||(_[5]=t.createElementVNode("div",{class:"beat-title"},"Beat",-1))],2)}}},[["__scopeId","data-v-3043e562"]]),Qe={class:"title"},ae=C({__name:"BaseNumericInput",props:t.mergeModels({title:{type:String,required:!0},color:{type:String,default:"#336"},focusColor:{type:String,default:"#558"},textColor:{type:String,default:"#aad"},backgroundColor:{type:String,default:"#111117"},sliderMax:{type:Number,default:1},sliderMin:{type:Number,default:0},thumbLength:{type:Number,default:2},formatValue:{type:Function,default:e=>e.toString()},parseValue:{type:Function,default:e=>parseFloat(e)},validateInput:{type:Function,default:e=>e.replace(/[^0-9.]/g,"")},transformSliderToDisplay:{type:Function,default:e=>e},transformDisplayToSlider:{type:Function,default:e=>e},maxChars:{type:Number,default:null}},{value:{default:.5},valueModifiers:{}}),emits:["update:value"],setup(e){t.useCssVars(m=>({"0d0963e0":e.textColor,"4ad34b2f":e.backgroundColor,"02156786":e.color,"715a9528":u.value,"30d64f7d":h.value,b8fbe65e:e.focusColor}));const a=e,n=t.useTemplateRef("el"),{width:r,height:s}=w(n),i=t.useModel(e,"value"),c=t.ref(a.formatValue(a.transformSliderToDisplay(i.value)));t.watch(i,()=>{const m=a.transformSliderToDisplay(i.value);c.value=a.formatValue(m)}),t.watch(c,()=>{c.value=a.validateInput(c.value),a.maxChars&&c.value.length>a.maxChars&&(c.value=c.value.slice(0,a.maxChars))});const h=t.computed(()=>Math.min(s.value/2.25,r.value/2.2)+"px"),u=t.computed(()=>Math.min(r.value/3,s.value/6.4)+"px");function o(){const m=a.parseValue(c.value),p=a.transformDisplayToSlider(m);i.value=Math.min(Math.max(p,a.sliderMin),a.sliderMax)}return(m,p)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"el",ref:n},[p[2]||(p[2]=t.createElementVNode("div",{class:"frame"},null,-1)),t.withDirectives(t.createElementVNode("input",{type:"text",class:"input","onUpdate:modelValue":p[0]||(p[0]=v=>c.value=v),inputmode:"decimal",pattern:"\\d*",onChange:o},null,544),[[t.vModelText,c.value]]),t.createElementVNode("div",Qe,t.toDisplayString(e.title),1),t.createVNode(q,{class:"slider",value:i.value,"onUpdate:value":p[1]||(p[1]=v=>i.value=v),"thumb-length":e.thumbLength,max:e.sliderMax,min:e.sliderMin},null,8,["value","thumb-length","max","min"])],512))}},[["__scopeId","data-v-79c7a539"]]),fe={__name:"SpeedInput",setup(e){const a=N(),n=I(),r=t.computed({get:()=>Math.log2(a.playbackSpeed)*.5+.5,set:o=>{const m=Math.pow(2,o*2-1);n.setPlaybackSpeed(m)}}),s=o=>Math.floor(Math.pow(2,o*2-1)*100+.5)+"",i=o=>parseFloat(o),c=o=>o.replace(/\D/g,""),h=o=>o,u=o=>{const m=Math.log2(o/100)*.5+.5;return Math.min(Math.max(m,0),1)};return(o,m)=>(t.openBlock(),t.createBlock(ae,{value:r.value,"onUpdate:value":m[0]||(m[0]=p=>r.value=p),title:"Speed",color:"#336","text-color":"#aad","format-value":s,"parse-value":i,"validate-input":c,"transform-slider-to-display":h,"transform-display-to-slider":u,"thumb-length":2,"max-chars":3},null,8,["value"]))}},ge={__name:"TimeInput",setup(e){const a=N(),n=D(),r=I(),s=o=>o.toFixed(1),i=o=>parseFloat(o),c=o=>o.replace(/[^0-9.]/g,""),h=o=>o,u=o=>o;return(o,m)=>(t.openBlock(),t.createBlock(ae,{value:t.unref(a).currentTime,"onUpdate:value":[m[0]||(m[0]=p=>t.unref(a).currentTime=p),t.unref(r).setTime],title:"Time",color:"#344","focus-color":"#556868","text-color":"#acc","background-color":"#111117","slider-max":t.unref(n).totalDuration,"slider-min":0,"format-value":s,"parse-value":i,"validate-input":c,"transform-slider-to-display":h,"transform-display-to-slider":u,"thumb-length":2},null,8,["value","onUpdate:value","slider-max"]))}},Xe={class:"inner"},P=C({__name:"AudioButton",setup(e){const a=t.ref(!1),n=()=>a.value=!0,r=()=>a.value=!1;return(s,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["button-outer",{down:a.value}]),onPointerdown:n,onPointerup:r,onPointerleave:r},[t.createElementVNode("div",Xe,[t.renderSlot(s.$slots,"default",{},void 0,!0)])],34))}},[["__scopeId","data-v-0d7af06e"]]),Je={class:"outer"},et={class:"buttons"},tt={class:"icon",viewBox:"0 0 48 48"},at=["d"],be=C({__name:"MixerControls",setup(e){const a=D(),n=N(),r=I();function s(){n.isPlaying?r.stop():r.play()}function i(){const v=Math.max(1,n.currentBar-1);r.setBar(v)}function c(){const v=n.currentBar+1;r.setBar(v)}function h(){r.playStartingNotes()}const u=t.ref(!1),o=t.ref(!0);function m(){u.value=!u.value}function p(){o.value=!o.value}return(v,g)=>(t.openBlock(),t.createElementBlock("div",Je,[t.createVNode(ee,{class:"title",align:"centre"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a).title),1)]),_:1}),t.createVNode(q,{class:"main",colour:"red",modelValue:t.unref(n).masterVolume,"onUpdate:modelValue":g[0]||(g[0]=M=>t.unref(n).masterVolume=M)},null,8,["modelValue"]),t.createVNode(q,{class:"tick",colour:"blue"}),g[6]||(g[6]=t.createElementVNode("div",{class:"main-t"},"Main",-1)),g[7]||(g[7]=t.createElementVNode("div",{class:"tick-t"},"Tick",-1)),t.createVNode(pe,{class:"bar"}),t.createVNode(ge,{class:"time"}),t.createVNode(fe,{class:"speed"}),t.createElementVNode("div",et,[t.createVNode(P,{class:"button",onClick:i},{default:t.withCtx(()=>g[1]||(g[1]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 0 48 48"},[t.createElementVNode("path",{d:"M11 36V12h3v24Zm26 0L19.7 24 37 12Z"})],-1)])),_:1,__:[1]}),t.createVNode(P,{class:"button",onClick:s},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",tt,[t.createElementVNode("path",{d:t.unref(n).isPlaying?"M27.4 35.4V12.6h8v22.8Zm-14.8 0V12.6h8.05v22.8Z":"M16 37.85v-28l22 14Z"},null,8,at)]))]),_:1}),t.createVNode(P,{class:"button",onClick:c},{default:t.withCtx(()=>g[2]||(g[2]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 0 48 48"},[t.createElementVNode("path",{d:"M34 36V12h3v24Zm-23 0V12l17.3 12Z"})],-1)])),_:1,__:[2]}),t.createVNode(P,{class:"button",onClick:m},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["icon",u.value?"on":"off"]),viewBox:"-128 -128 768 768"},g[3]||(g[3]=[t.createElementVNode("path",{d:"m 463.84136,154.89339 c -6.42,-6.42 -16.83,-6.42 -23.251,0 -71.31197,70.35135 -136.61146,132.25426 -208.741,199.7 h -105.82 c 23.35495,-140.1063 67.13099,-217.59716 120.727,-318.357996 0.86,-0.803 2.209,-0.801 3.067,-10e-4 20.50653,37.383983 48.51152,88.812606 72.26194,147.190756 1.186,9.002 12.2214,17.4338 23.3242,11.71391 9.002,-1.186 11.1594,-12.2324 9.9724,-21.2344 -21.69905,-53.89113 -30.43965,-85.078342 -83.11454,-161.702266 -13.446,-12.55299965 -34.508,-12.55699965 -47.954,10e-4 C 126.80877,149.30021 96.099465,324.74626 77.091365,474.25139 c -2.829,21.473 13.907,40.535 35.543995,40.535 h 271.311 c 21.661,0 38.373,-19.087 35.544,-40.535 -8.26237,-52.34207 -14.88466,-100.7074 -24.7871,-157.02622 -6.40949,-11.78839 -8.3911,-14.9907 -17.4031,-13.8037 -9.002,1.186 -13.59751,8.0528 -12.41051,17.0548 l 5.66371,34.11712 h -83.159 c 64.35441,-63.86663 129.29308,-130.29894 176.448,-176.449 6.42,-6.42 6.42,-16.83 -10e-4,-23.251 z m -88.956,232.582 12.004,91.074 c 0.112,0.846 -0.148,1.701 -0.708,2.341 -0.566,0.645 -1.38,1.014 -2.235,1.014 h -271.311 c -0.855,0 -1.668,-0.369 -2.231,-1.011 -0.564,-0.643 -0.824,-1.499 -0.712,-2.347 l 12.003,-91.072 h 253.19 z"},null,-1)]),2))]),_:1}),t.createVNode(P,{class:"button",onClick:p},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["icon",o.value?"on":"off"]),viewBox:"-2 -2 28 28"},g[4]||(g[4]=[t.createElementVNode("path",{d:"m 8.9838564,1.5166215 v 2 h 5.9999996 v -2 z m 2.9999996,3 c -4.9699996,0 -8.9999996,4.0299999 -8.9999996,8.9999995 0,4.97 4.02,9 8.9999996,9 4.98,0 9,-4.03 9,-9 0,-2.12 -0.740703,-4.0693745 -1.970703,-5.6093745 l 1.419922,-1.421875 c -0.43,-0.51 -0.900156,-0.9882031 -1.410156,-1.4082031 l -1.419922,1.4199219 c -1.55,-1.24 -3.499141,-1.9804688 -5.619141,-1.9804688 z m -1.789062,4.7480469 6,4.4999996 -6,4.5 z"},null,-1)]),2))]),_:1}),t.createVNode(P,{class:"button",onClick:h},{default:t.withCtx(()=>g[5]||(g[5]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 -960 960 960"},[t.createElementVNode("path",{d:"m 306.66667,-360 q -44,0 -75.33334,-31.33333 Q 200,-422.66667 200,-466.66667 q 0,-44 31.33333,-75.33333 31.33334,-31.33333 75.33334,-31.33333 15.33333,0 28.33333,3.66666 13,3.66667 25,11 V -840 h 160 v 106.66667 H 413.33333 v 266.66666 q 0,44 -31.33333,75.33334 Q 350.66667,-360 306.66667,-360 Z"}),t.createElementVNode("path",{d:"m 546.66667,-120 q -44,0 -75.33334,-31.33333 Q 440,-182.66667 440,-226.66667 q 0,-44 31.33333,-75.33333 31.33334,-31.33333 75.33334,-31.33333 15.33333,0 28.33333,3.66666 13,3.66667 25,11 V -600 h 160 v 106.66667 H 653.33333 v 266.66666 q 0,44 -31.33333,75.33334 Q 590.66667,-120 546.66667,-120 Z"})],-1)])),_:1,__:[5]})])]))}},[["__scopeId","data-v-fc2b877e"]]),nt={class:"container"},rt={class:"panel"},ve=40,ye=40,_e=100,st=50,Me=400,Se=570,ke=570,ot=350,it=330,lt=360,ct=360,ut=C({__name:"MixerLayout",setup(e){t.useCssVars(u=>({"2540622b":i.value,"25398f45":c.value,fc452918:h.value}));const a=D(),n=t.useTemplateRef("container"),{width:r}=w(n),s=t.computed(()=>{const u=r.value,o=a.parts.length;return u<640||u<ve*o+Me?0:u<ye*o+Se?1:u<_e*o+ke?2:3}),i=t.computed(()=>{switch(s.value){case 0:return`${ot}px `+`${st}px `.repeat(a.parts.length);case 1:return`${it}px`;case 2:return`${lt}px`;default:return`${ct}px`}}),c=t.computed(()=>{switch(s.value){case 0:return"100vw";case 1:return`${ve}px `.repeat(a.parts.length)+`${Me}px`;case 2:return`${ye}px `.repeat(a.parts.length)+`${Se}px`;default:return`${_e}px `.repeat(a.parts.length)+`${ke}px`}}),h=t.computed(()=>{const u=[...a.parts.keys()];return s.value>0?'"'+u.map(o=>"part"+o).join(" ")+' controls"':'"controls" '+u.map(o=>'"part'+o+'"').join(" ")});return(u,o)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"container",ref:n},[t.createElementVNode("div",nt,[t.createElementVNode("div",rt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).parts,(m,p)=>(t.openBlock(),t.createBlock(he,{key:m.name,class:t.normalizeClass("part"+p),name:m.name,volume:m.volume,"onUpdate:volume":v=>m.volume=v,solo:m.solo,"onUpdate:solo":v=>m.solo=v,mute:m.mute,"onUpdate:mute":v=>m.mute=v,ref_for:!0,ref:"parts"},null,8,["class","name","volume","onUpdate:volume","solo","onUpdate:solo","mute","onUpdate:mute"]))),128)),t.createVNode(be,{title:t.unref(a).title,class:"controls"},null,8,["title"])])])],512))}},[["__scopeId","data-v-03258471"]]),dt={class:"outer"},mt={class:"mid"},ht={class:"inner"},pt={key:0,class:"content"},ft=C({__name:"Placeholder",props:{colour:{type:String,default:"red"},text:{type:String,default:""}},setup(e){return t.useCssVars(a=>({"66bea586":e.colour})),(a,n)=>(t.openBlock(),t.createElementBlock("div",dt,[t.createElementVNode("div",mt,[t.createElementVNode("div",ht,[e.text||a.$slots.default?(t.openBlock(),t.createElementBlock("div",pt,[t.createTextVNode(t.toDisplayString(e.text)+" ",1),t.renderSlot(a.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)])])]))}},[["__scopeId","data-v-dff76c48"]]);b.AudioButton=P,b.AudioSlider=q,b.BarInput=pe,b.BaseNumericInput=ae,b.DEV_MODE=Y,b.DummyAudioEngine=me,b.MixerControls=be,b.MixerLayout=ut,b.PartControl=he,b.Placeholder=ft,b.SpeedInput=fe,b.TimeInput=ge,b.TitleText=ee,b.TriState=ue,b.isDevFeature=te,b.isDevMode=qe,b.useAudioStateStore=N,b.useElementSize=w,b.useMasterAudioControl=I,b.useMusicDataStore=D,b.usePlaybackStateStore=de,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(b,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],t):(b=typeof globalThis<"u"?globalThis:b||self,t(b.AudioMixerUI={},b.Vue,b.Pinia))})(this,function(b,t,X){"use strict";var re=function(){if(typeof Map<"u")return Map;function e(a,n){var r=-1;return a.some(function(s,i){return s[0]===n?(r=i,!0):!1}),r}return function(){function a(){this.__entries__=[]}return Object.defineProperty(a.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),a.prototype.get=function(n){var r=e(this.__entries__,n),s=this.__entries__[r];return s&&s[1]},a.prototype.set=function(n,r){var s=e(this.__entries__,n);~s?this.__entries__[s][1]=r:this.__entries__.push([n,r])},a.prototype.delete=function(n){var r=this.__entries__,s=e(r,n);~s&&r.splice(s,1)},a.prototype.has=function(n){return!!~e(this.__entries__,n)},a.prototype.clear=function(){this.__entries__.splice(0)},a.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var s=0,i=this.__entries__;s<i.length;s++){var c=i[s];n.call(r,c[1],c[0])}},a}()}(),J=typeof window<"u"&&typeof document<"u"&&window.document===document,G=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Ee=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(G):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Be=2;function Ce(e,a){var n=!1,r=!1,s=0;function i(){n&&(n=!1,e()),r&&h()}function c(){Ee(i)}function h(){var u=Date.now();if(n){if(u-s<Be)return;r=!0}else n=!0,r=!1,setTimeout(c,a);s=u}return h}var Ve=20,Te=["top","right","bottom","left","width","height","size","weight"],we=typeof MutationObserver<"u",xe=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ce(this.refresh.bind(this),Ve)}return e.prototype.addObserver=function(a){~this.observers_.indexOf(a)||this.observers_.push(a),this.connected_||this.connect_()},e.prototype.removeObserver=function(a){var n=this.observers_,r=n.indexOf(a);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var a=this.updateObservers_();a&&this.refresh()},e.prototype.updateObservers_=function(){var a=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return a.forEach(function(n){return n.broadcastActive()}),a.length>0},e.prototype.connect_=function(){!J||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),we?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!J||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(a){var n=a.propertyName,r=n===void 0?"":n,s=Te.some(function(i){return!!~r.indexOf(i)});s&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),se=function(e,a){for(var n=0,r=Object.keys(a);n<r.length;n++){var s=r[n];Object.defineProperty(e,s,{value:a[s],enumerable:!1,writable:!1,configurable:!0})}return e},A=function(e){var a=e&&e.ownerDocument&&e.ownerDocument.defaultView;return a||G},oe=K(0,0,0,0);function Z(e){return parseFloat(e)||0}function ie(e){for(var a=[],n=1;n<arguments.length;n++)a[n-1]=arguments[n];return a.reduce(function(r,s){var i=e["border-"+s+"-width"];return r+Z(i)},0)}function Ne(e){for(var a=["top","right","bottom","left"],n={},r=0,s=a;r<s.length;r++){var i=s[r],c=e["padding-"+i];n[i]=Z(c)}return n}function Pe(e){var a=e.getBBox();return K(0,0,a.width,a.height)}function Oe(e){var a=e.clientWidth,n=e.clientHeight;if(!a&&!n)return oe;var r=A(e).getComputedStyle(e),s=Ne(r),i=s.left+s.right,c=s.top+s.bottom,h=Z(r.width),u=Z(r.height);if(r.boxSizing==="border-box"&&(Math.round(h+i)!==a&&(h-=ie(r,"left","right")+i),Math.round(u+c)!==n&&(u-=ie(r,"top","bottom")+c)),!De(e)){var o=Math.round(h+i)-a,m=Math.round(u+c)-n;Math.abs(o)!==1&&(h-=o),Math.abs(m)!==1&&(u-=m)}return K(s.left,s.top,h,u)}var Ae=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof A(e).SVGGraphicsElement}:function(e){return e instanceof A(e).SVGElement&&typeof e.getBBox=="function"}}();function De(e){return e===A(e).document.documentElement}function Ie(e){return J?Ae(e)?Pe(e):Oe(e):oe}function Le(e){var a=e.x,n=e.y,r=e.width,s=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(i.prototype);return se(c,{x:a,y:n,width:r,height:s,top:n,right:a+r,bottom:s+n,left:a}),c}function K(e,a,n,r){return{x:e,y:a,width:n,height:r}}var Re=function(){function e(a){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=K(0,0,0,0),this.target=a}return e.prototype.isActive=function(){var a=Ie(this.target);return this.contentRect_=a,a.width!==this.broadcastWidth||a.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var a=this.contentRect_;return this.broadcastWidth=a.width,this.broadcastHeight=a.height,a},e}(),$e=function(){function e(a,n){var r=Le(n);se(this,{target:a,contentRect:r})}return e}(),ze=function(){function e(a,n,r){if(this.activeObservations_=[],this.observations_=new re,typeof a!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=a,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(a){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(a instanceof A(a).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(a)||(n.set(a,new Re(a)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(a){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(a instanceof A(a).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(a)&&(n.delete(a),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var a=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&a.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var a=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new $e(r.target,r.broadcastRect())});this.callback_.call(a,n,a),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),le=typeof WeakMap<"u"?new WeakMap:new re,ce=function(){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=xe.getInstance(),r=new ze(a,n,this);le.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ce.prototype[e]=function(){var a;return(a=le.get(this))[e].apply(a,arguments)}});var Fe=function(){return typeof G.ResizeObserver<"u"?G.ResizeObserver:ce}();function w(e){const a=t.ref(0),n=t.ref(0);let r=null;const s=()=>{r&&(r.disconnect(),r=null)},i=()=>{s();const c=t.unref(e);if(!c)return;r=new Fe(u=>{const o=u[0];o&&(a.value=o.contentRect.width,n.value=o.contentRect.height)}),r.observe(c);const h=c.getBoundingClientRect();a.value=h.width,n.value=h.height};return t.watch(()=>t.unref(e),i,{immediate:!0}),t.onScopeDispose(s),{width:t.readonly(a),height:t.readonly(n)}}const C=(e,a)=>{const n=e.__vccOpts||e;for(const[r,s]of a)n[r]=s;return n},Ue={key:0,class:"level"},q=C({__name:"AudioSlider",props:t.mergeModels({min:{type:Number,default:0},max:{type:Number,default:1},step:{type:Number,default:.01},colour:{type:String,default:"grey"},style:{type:String,default:"volume"},thumbLength:{type:Number,default:1},showLevel:{type:Boolean,default:!1},level:{type:Number,default:.5}},{value:{default:.75},valueModifiers:{}}),emits:["update:value"],setup(e){t.useCssVars(f=>({"3d436468":g.value,"345b6e65":v.value,"3327b972":L.value,"5ae48cf2":M.value,"01a7bd27":E.value}));const a=e,n=t.useTemplateRef("root"),{width:r,height:s}=w(n),i=t.computed(()=>Math.min(r.value,s.value)),c=t.computed(()=>Math.max(r.value,s.value)),h=t.computed(()=>r.value>s.value),u=t.computed(()=>h.value?"h-slide":"v-slide"),o=t.useModel(e,"value"),m=t.computed(()=>i.value*.8),p=t.computed(()=>i.value*a.thumbLength*.8),v=t.computed(()=>(h.value?p:m).value+"px"),g=t.computed(()=>(h.value?m:p).value+"px"),M=t.computed(()=>i.value*.1+"px"),E=t.computed(()=>(c.value-p.value)*(o.value-a.min)/(a.max-a.min)+"px"),L=t.computed(()=>h.value?"90deg":"0deg"),S=t.ref(!1),R=t.ref(0),x=f=>{if(!n.value)return o.value;const V=n.value.getBoundingClientRect(),z=f.touches?f.touches[0].clientX:f.clientX,ne=f.touches?f.touches[0].clientY:f.clientY;let F;if(h.value){const U=z-V.left-m.value/2,H=V.width-m.value;F=Math.max(0,Math.min(1,U/H))}else{const U=V.bottom-ne-m.value/2,H=V.height-m.value;F=Math.max(0,Math.min(1,U/H))}const Q=a.min+F*(a.max-a.min);return a.step>0?Math.round(Q/a.step)*a.step:Q},W=f=>{f.preventDefault(),S.value=!0,R.value=o.value,o.value=x(f),n.value&&n.value.setPointerCapture&&n.value.setPointerCapture(f.pointerId),document.addEventListener("mousemove",O),document.addEventListener("mouseup",$)},O=f=>{S.value&&(f.preventDefault(),o.value=x(f))},$=f=>{if(S.value){if(f.preventDefault(),S.value=!1,n.value&&n.value.releasePointerCapture)try{n.value.releasePointerCapture(f.pointerId)}catch{}document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",$)}},y=f=>{f.preventDefault(),f.touches.length===1&&(S.value=!0,R.value=o.value,o.value=x(f),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",B),document.addEventListener("touchcancel",B))},_=f=>{S.value&&(f.preventDefault(),f.touches.length===1&&(o.value=x(f)))},B=f=>{S.value&&(f.preventDefault(),S.value=!1,document.removeEventListener("touchmove",_),document.removeEventListener("touchend",B),document.removeEventListener("touchcancel",B))},T=f=>Math.min(1,Math.max(0,a.level*10-f+1));return(f,V)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(u.value),ref_key:"root",ref:n,onMousedown:W,onTouchstart:y,style:{userSelect:"none",touchAction:"none"}},[V[0]||(V[0]=t.createElementVNode("div",{class:"track"},null,-1)),e.showLevel?(t.openBlock(),t.createElementBlock("div",Ue,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(10,z=>t.createElementVNode("div",{class:t.normalizeClass(["led","led"+z])},[t.createElementVNode("div",{class:"on",style:t.normalizeStyle({opacity:T(z)})},null,4)],2)),64))])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["thumb",{dragging:S.value,[e.colour]:!0,[e.style]:!0}])},null,2)],34))}},[["__scopeId","data-v-1580ed15"]]),ee=C({__name:"TitleText",props:{align:{type:String,default:"left"}},setup(e){t.useCssVars(h=>({"5fddb56d":c.value}));const a=t.useTemplateRef("el"),{width:n,height:r}=w(a),s=t.computed(()=>Math.min(n.value,r.value)),i=t.computed(()=>n.value>r.value?"h-text":"v-text"),c=t.computed(()=>s.value*3/4+"px");return(h,u)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:a,class:"outer"},[t.createElementVNode("div",{class:t.normalizeClass({[i.value]:!0,[e.align]:!0})},[t.renderSlot(h.$slots,"default",{},void 0,!0)],2)],512))}},[["__scopeId","data-v-3ce29e77"]]),ue=C({__name:"TriState",props:{mute:{default:!1},muteModifiers:{},solo:{default:!1},soloModifiers:{}},emits:["update:mute","update:solo"],setup(e){const a=t.useModel(e,"mute"),n=t.useModel(e,"solo"),r=t.useTemplateRef("outer"),{width:s,height:i}=w(r),c=t.computed(()=>s.value>i.value*1.9);function h(){a.value=!a.value,n.value=!1}function u(){n.value=!n.value,a.value=!1}return(o,m)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"outer",ref:r},[t.createElementVNode("div",{class:t.normalizeClass(["solo",{on:n.value}]),onClick:u},null,2),t.createElementVNode("div",{class:"s-label",onClick:u},t.toDisplayString(c.value?"SOLO":"S"),1),t.createElementVNode("div",{class:t.normalizeClass(["mute",{on:a.value}]),onClick:h},null,2),t.createElementVNode("div",{class:"m-label",onClick:h},t.toDisplayString(c.value?"MUTE":"M"),1)],512))}},[["__scopeId","data-v-143eade0"]]),Y={enabled:!1,features:{beatAnimation:!0,randomLevelIndicators:!0,debugMode:!1}},qe=()=>Y.enabled,te=e=>Y.enabled&&Y.features[e],N=X.defineStore("audioState",{state:()=>({isPlaying:!1,currentTime:0,playbackSpeed:1,currentBar:1,currentBeat:1,currentRepeat:0,masterVolume:.75,partVolumes:{},partMuted:{},isLeadInActive:!1,isStartingNotesActive:!1,leadInBars:1}),getters:{formattedTime:e=>{const a=Math.floor(e.currentTime/60),n=Math.floor(e.currentTime%60);return`${a}:${n.toString().padStart(2,"0")}`},getPartVolume:e=>a=>e.partVolumes[a]??.75,isPartMuted:e=>a=>e.partMuted[a]??!1,currentPosition:e=>{let a=`${e.currentBar}.${e.currentBeat}`;return e.currentRepeat>0&&(a+=` (R${e.currentRepeat})`),a}},actions:{setPlaybackState(e){this.isPlaying=e},setCurrentTime(e){this.currentTime=e},setPlaybackSpeed(e){this.playbackSpeed=e},setCurrentBar(e,a=1,n=0){this.currentBar=e,this.currentBeat=a,this.currentRepeat=n},setMasterVolume(e){this.masterVolume=Math.max(0,Math.min(1,e))},setPartVolume(e,a){this.partVolumes[e]=Math.max(0,Math.min(1,a))},setPartMuted(e,a){this.partMuted[e]=a},setLeadInActive(e,a=1){this.isLeadInActive=e,this.leadInBars=a},setStartingNotesActive(e){this.isStartingNotesActive=e},initializeParts(e){e.forEach(a=>{a.name in this.partVolumes||(this.partVolumes[a.name]=a.volume||.75),a.name in this.partMuted||(this.partMuted[a.name]=!1)})}}}),D=X.defineStore("musicData",{state:()=>({beats:[],practiceMarks:{},parts:[],title:"",totalDuration:0,maxBar:0,timeSignature:4,baseTempo:80}),getters:{getTimeFromBar:e=>(a,n=0)=>{const r=e.beats.find(s=>s.bar===a&&s.beat===1&&s.repeat===n);return r?r.time:null},getBarFromTime:e=>a=>{if(!e.beats||e.beats.length===0)return null;let n=null;for(let r=e.beats.length-1;r>=0;r--)if(e.beats[r].time<=a){n=e.beats[r];break}return n?{bar:n.bar,beat:n.beat,repeat:n.repeat,tempo:n.tempo,timeSig:n.timeSig}:null},practiceMarkLetters:e=>Object.keys(e.practiceMarks).sort(),getBarForMark:e=>a=>e.practiceMarks[a],allBars:e=>{const a=new Set;return e.beats.forEach(n=>{n.beat===1&&a.add(n.bar)}),Array.from(a).sort((n,r)=>n-r)},hasRepeats:e=>a=>e.beats.some(n=>n.bar===a&&n.repeat>0)},actions:{loadMusicData(e){this.title=e.title||"Untitled",this.beats=e.beats||[],this.practiceMarks=e.practiceMarks||e.marks||{},this.parts=e.parts||[],this.calculateDuration(),this.calculateMaxBar(),this.extractTimeSignature()},calculateDuration(){this.beats.length>0&&(this.totalDuration=Math.max(...this.beats.map(e=>e.time)))},calculateMaxBar(){this.beats.length>0&&(this.maxBar=Math.max(...this.beats.map(e=>e.bar)))},extractTimeSignature(){this.beats.length>0&&this.beats[0].timeSig&&(this.timeSignature=this.beats[0].timeSig),this.beats.length>0&&this.beats[0].tempo&&(this.baseTempo=this.beats[0].tempo)},setPracticeMark(e,a){this.practiceMarks[e]=a},removePracticeMark(e){delete this.practiceMarks[e]},isValidBar(e,a=0){return this.beats.some(n=>n.bar===e&&n.repeat===a)}}}),de=X.defineStore("playbackState",{state:()=>({transportState:"stopped",autoPlay:!1,loopEnabled:!1,loopStart:1,loopEnd:null,leadInEnabled:!0,leadInBars:1,startingNotesEnabled:!0,startingNotesSequential:!0,metronomeEnabled:!1,metronomeVolume:.5,showTransportControls:!0,showPartControls:!0,showNavigationControls:!0,lastBarPosition:1,lastPracticeMarkUsed:null}),getters:{isPlaying:e=>e.transportState==="playing",isPaused:e=>e.transportState==="paused",isStopped:e=>e.transportState==="stopped",isLoopConfigured:e=>e.loopEnabled&&e.loopStart&&e.loopEnd&&e.loopEnd>e.loopStart,loopRange:e=>!e.loopEnabled||!e.loopStart||!e.loopEnd?null:`${e.loopStart}-${e.loopEnd}`},actions:{setTransportState(e){["stopped","playing","paused"].includes(e)&&(this.transportState=e)},play(){this.setTransportState("playing")},pause(){this.setTransportState("paused")},stop(){this.setTransportState("stopped")},setAutoPlay(e){this.autoPlay=e},setLoop(e,a=null,n=null){this.loopEnabled=e,a!==null&&(this.loopStart=a),n!==null&&(this.loopEnd=n)},setLoopStart(e){this.loopStart=e,this.loopEnd&&this.loopEnd<=e&&(this.loopEnd=e+4)},setLoopEnd(e){this.loopEnd=e,this.loopStart&&this.loopStart>=e&&(this.loopStart=Math.max(1,e-4))},setLeadInEnabled(e){this.leadInEnabled=e},setLeadInBars(e){this.leadInBars=Math.max(1,Math.min(4,e))},setStartingNotesEnabled(e){this.startingNotesEnabled=e},setStartingNotesSequential(e){this.startingNotesSequential=e},setMetronomeEnabled(e){this.metronomeEnabled=e},setMetronomeVolume(e){this.metronomeVolume=Math.max(0,Math.min(1,e))},setTransportControlsVisible(e){this.showTransportControls=e},setPartControlsVisible(e){this.showPartControls=e},setNavigationControlsVisible(e){this.showNavigationControls=e},updateLastBarPosition(e){this.lastBarPosition=e},updateLastPracticeMarkUsed(e){this.lastPracticeMarkUsed=e},resetToDefaults(){this.transportState="stopped",this.autoPlay=!1,this.loopEnabled=!1,this.loopStart=1,this.loopEnd=null,this.leadInEnabled=!0,this.leadInBars=1,this.startingNotesEnabled=!0,this.startingNotesSequential=!0,this.metronomeEnabled=!1,this.metronomeVolume=.5}}});function We(e){return{all:e=e||new Map,on:function(a,n){var r=e.get(a);r?r.push(n):e.set(a,[n])},off:function(a,n){var r=e.get(a);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(a,[]))},emit:function(a,n){var r=e.get(a);r&&r.slice().map(function(s){s(n)}),(r=e.get("*"))&&r.slice().map(function(s){s(a,n)})}}}class me{constructor(){this.eventBus=We(),this.currentTime=0,this.isPlaying=!1,this.playbackSpeed=1,this.masterVolume=.75,this.parts=new Map,this.playbackTimer=null,this.lastTimestamp=0}initialize(a){if(this.musicData=a,this.beats=a.beats||[],this.practiceMarks=a.practiceMarks||{},this.beats.length>0){const n=this.beats[this.beats.length-1],r=n.tempo>0?60/n.tempo:.75;this.songDuration=n.time+r,this.maxBar=Math.max(...this.beats.map(s=>s.bar))}else this.songDuration=0,this.maxBar=0;a.parts&&a.parts.forEach(n=>{this.parts.set(n.name,{name:n.name,volume:n.volume||.75,muted:!1})}),this.eventBus.emit("initialized",{parts:Array.from(this.parts.values())})}play(){this.isPlaying||(this.isPlaying=!0,this.lastTimestamp=performance.now(),this.startPlaybackTimer(),this.eventBus.emit("playbackStateChanged",{isPlaying:!0,currentTime:this.currentTime}))}stop(){this.isPlaying&&(this.isPlaying=!1,this.stopPlaybackTimer(),this.eventBus.emit("playbackStateChanged",{isPlaying:!1,currentTime:this.currentTime}))}pause(){this.stop()}setTime(a){this.currentTime=Math.max(0,a),this.eventBus.emit("timeChanged",{currentTime:this.currentTime});const n=this.getBarFromTime(this.currentTime);n&&this.eventBus.emit("barChanged",n)}getCurrentTime(){return this.currentTime}setBar(a,n=0){const r=this.getTimeFromBar(a,n);r!==null&&this.setTime(r)}goToPracticeMark(a){const n=this.practiceMarks[a];n!==void 0&&(this.setBar(n),this.eventBus.emit("practiceMarkChanged",{mark:a,bar:n}))}setPlaybackSpeed(a){this.playbackSpeed=Math.max(.25,Math.min(2,a)),this.eventBus.emit("speedChanged",{speed:this.playbackSpeed})}getPlaybackSpeed(){return this.playbackSpeed}setMasterVolume(a){this.masterVolume=Math.max(0,Math.min(1,a)),this.eventBus.emit("masterVolumeChanged",{volume:this.masterVolume})}getMasterVolume(){return this.masterVolume}setPartVolume(a,n){const r=this.parts.get(a);r&&(r.volume=Math.max(0,Math.min(1,n)),this.eventBus.emit("partVolumeChanged",{partName:a,volume:r.volume}))}setPartMuted(a,n){const r=this.parts.get(a);r&&(r.muted=n,this.eventBus.emit("partMutedChanged",{partName:a,muted:n}))}getParts(){return Array.from(this.parts.values())}playLeadIn(a=1){this.eventBus.emit("leadInStarted",{bars:a}),setTimeout(()=>{this.eventBus.emit("leadInCompleted")},1e3*a)}playStartingNotes(){this.eventBus.emit("startingNotesStarted"),setTimeout(()=>{this.eventBus.emit("startingNotesCompleted")},2e3)}on(a,n){this.eventBus.on(a,n)}off(a,n){this.eventBus.off(a,n)}startPlaybackTimer(){const a=()=>{if(!this.isPlaying)return;const n=performance.now(),r=(n-this.lastTimestamp)/1e3;if(this.lastTimestamp=n,this.currentTime+=r*this.playbackSpeed,this.songDuration>0&&this.currentTime>=this.songDuration){this.stop(),this.eventBus.emit("songEnded",{finalTime:this.currentTime});return}this.eventBus.emit("timeChanged",{currentTime:this.currentTime});const s=this.getBarFromTime(this.currentTime);if(s&&(this.eventBus.emit("barChanged",s),this.maxBar>0&&s.bar>this.maxBar)){this.stop(),this.eventBus.emit("songEnded",{finalTime:this.currentTime});return}this.playbackTimer=requestAnimationFrame(a)};this.playbackTimer=requestAnimationFrame(a)}stopPlaybackTimer(){this.playbackTimer&&(cancelAnimationFrame(this.playbackTimer),this.playbackTimer=null)}getBarFromTime(a){if(!this.beats||this.beats.length===0)return null;let n=null;for(let r=this.beats.length-1;r>=0;r--)if(this.beats[r].time<=a){n=this.beats[r];break}return n?{bar:n.bar,beat:n.beat,repeat:n.repeat,time:n.time}:null}getTimeFromBar(a,n=0){if(!this.beats||this.beats.length===0)return null;let r=this.beats.find(s=>s.bar===a&&s.beat===1&&s.repeat===n);return!r&&n===0&&(r=this.beats.find(s=>s.bar===a&&s.beat===1)),r?r.time:null}destroy(){this.stop(),this.eventBus.all.clear(),this.parts.clear()}}const d=new me;function I(){const e=N(),a=D(),n=de(),r=({currentTime:l})=>{e.setCurrentTime(l)},s=({isPlaying:l})=>{e.setPlaybackState(l),n.setTransportState(l?"playing":"stopped")},i=l=>{l&&(e.setCurrentBar(l.bar,l.beat,l.repeat),n.updateLastBarPosition(l.bar))},c=({speed:l})=>{e.setPlaybackSpeed(l)},h=({volume:l})=>{e.setMasterVolume(l)},u=({partName:l,volume:k})=>{e.setPartVolume(l,k)},o=({partName:l,muted:k})=>{e.setPartMuted(l,k)},m=({bars:l})=>{e.setLeadInActive(!0,l)},p=()=>{e.setLeadInActive(!1)},v=()=>{e.setStartingNotesActive(!0)},g=()=>{e.setStartingNotesActive(!1)},M=({mark:l})=>{n.updateLastPracticeMarkUsed(l)},E=({parts:l})=>{e.initializeParts(l)},L=({finalTime:l})=>{e.setPlaybackState(!1),n.setTransportState("stopped"),console.log(`Song ended at time: ${l}`)},S=()=>{d.on("timeChanged",r),d.on("playbackStateChanged",s),d.on("barChanged",i),d.on("speedChanged",c),d.on("masterVolumeChanged",h),d.on("partVolumeChanged",u),d.on("partMutedChanged",o),d.on("leadInStarted",m),d.on("leadInCompleted",p),d.on("startingNotesStarted",v),d.on("startingNotesCompleted",g),d.on("practiceMarkChanged",M),d.on("initialized",E),d.on("songEnded",L)},R=()=>{d.off("timeChanged",r),d.off("playbackStateChanged",s),d.off("barChanged",i),d.off("speedChanged",c),d.off("masterVolumeChanged",h),d.off("partVolumeChanged",u),d.off("partMutedChanged",o),d.off("leadInStarted",m),d.off("leadInCompleted",p),d.off("startingNotesStarted",v),d.off("startingNotesCompleted",g),d.off("practiceMarkChanged",M),d.off("initialized",E),d.off("songEnded",L)},x=()=>{t.watchEffect(()=>{const l=e.masterVolume;d.getMasterVolume()!==l&&d.setMasterVolume(l)}),t.watchEffect(()=>{const l=e.playbackSpeed;d.getPlaybackSpeed()!==l&&d.setPlaybackSpeed(l)})},W=l=>{a.loadMusicData(l),d.initialize({beats:l.beats,practiceMarks:l.marks||l.practiceMarks,parts:l.parts}),S(),x()},O=()=>{d.play()},$=()=>{d.stop()},y=()=>{d.pause()},_=l=>{d.setTime(l)},B=(l,k=0)=>{d.setBar(l,k)},T=l=>{d.goToPracticeMark(l)},f=l=>{d.setPlaybackSpeed(l)},V=l=>{d.setMasterVolume(l)},z=(l,k)=>{d.setPartVolume(l,k)},ne=(l,k)=>{d.setPartMuted(l,k)},F=(l=1)=>{d.playLeadIn(l)},Q=()=>{d.playStartingNotes()},U=(l,k=!0,j=0)=>{k&&n.leadInEnabled?(B(l,j),F(n.leadInBars)):(B(l,j),O())},H=(l,k=!0)=>{const j=a.getBarForMark(l);j&&U(j,k)};return t.onUnmounted(()=>{R()}),{initialize:W,play:O,stop:$,pause:y,setTime:_,setBar:B,goToPracticeMark:T,setPlaybackSpeed:f,setMasterVolume:V,setPartVolume:z,setPartMuted:ne,playLeadIn:F,playStartingNotes:Q,playFromBar:U,playFromMark:H,audioState:e,musicData:a,playbackState:n,audioEngine:d}}const he=C({__name:"PartControl",props:t.mergeModels({name:{type:String,required:!0},level:{type:Number,default:0,validator:e=>e>=0&&e<=1}},{volume:{default:.75},volumeModifiers:{},mute:{default:!1},muteModifiers:{},solo:{default:!1},soloModifiers:{}}),emits:["update:volume","update:mute","update:solo"],setup(e){t.useCssVars(g=>({"34cdae44":o.value}));const a=e;N();const n=I(),r=t.useModel(e,"volume"),s=t.useModel(e,"mute"),i=t.useModel(e,"solo");t.watch(r,g=>{n.setPartVolume(a.name,g)}),t.watch(s,g=>{n.setPartMuted(a.name,g)});const c=t.useTemplateRef("el"),{width:h,height:u}=w(c),o=t.computed(()=>Math.min(h.value,u.value)+"px"),m=t.computed(()=>h.value>u.value?"mobile":h.value<60?"tablet":"desktop");let p=null;const v=t.ref(0);return t.onMounted(()=>{te("randomLevelIndicators")&&(p=setInterval(()=>{v.value=s.value?0:Math.random()*r.value},100))}),t.onUnmounted(()=>{p&&(clearInterval(p),p=null)}),(g,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:c,class:t.normalizeClass([m.value,"part"])},[t.createVNode(ue,{class:"tri",mute:s.value,"onUpdate:mute":M[0]||(M[0]=E=>s.value=E),solo:i.value,"onUpdate:solo":M[1]||(M[1]=E=>i.value=E)},null,8,["mute","solo"]),t.createVNode(ee,{align:"left",class:"name"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.name),1)]),_:1}),t.createVNode(q,{level:v.value,"show-level":!0,class:"vol",value:r.value,"onUpdate:value":M[2]||(M[2]=E=>r.value=E)},null,8,["level","value"])],2))}},[["__scopeId","data-v-510493b1"]]),He={class:"mark"},je={key:0,class:"mark-dropdown"},Ge=["onClick"],Ze={class:"rpt"},Ke={class:"beat-ind"},Ye={class:"beat"},pe=C({__name:"BarInput",setup(e){t.useCssVars(y=>({"8ea05ab6":M.value,"1a3336d8":E.value}));const a=t.useTemplateRef("el"),{width:n,height:r}=w(a),s=D(),i=N(),c=I(),h=t.ref(!0);t.watch(()=>i.currentBeat,()=>{h.value=!0,setTimeout(()=>{h.value=!1},50)});let u=null;t.onMounted(()=>{te("beatAnimation")&&(u=setInterval(()=>{const y=i.currentBeat%s.timeSignature+1;i.setCurrentBar(i.currentBar,y,i.currentRepeat)},800))}),t.onUnmounted(()=>{u&&(clearInterval(u),u=null)});const o=t.ref(i.currentBar.toString()),m=t.ref("A");t.ref(i.currentRepeat);const p=t.ref(!1),v=t.ref(!1);t.watch(o,()=>{o.value=o.value.replace(/\D/g,""),o.value.length>3&&(o.value=o.value.slice(0,3))}),t.watch(()=>i.currentBar,y=>{o.value=y.toString()});function g(){const y=parseInt(o.value);y&&y>0&&O(y)}const M=t.computed(()=>Math.min(r.value/2.25,n.value/4.5)+"px"),E=t.computed(()=>Math.min(n.value/15,r.value/6.4)+"px");function L(){p.value=!p.value}function S(){p.value=!1}function R(){v.value=!v.value}function x(){v.value=!1}const W=t.computed(()=>Object.keys(s.practiceMarks).sort());function O(y){c.setBar(y,i.currentRepeat)}function $(y){m.value=y,p.value=!1,c.goToPracticeMark(y)}return(y,_)=>{const B=t.resolveDirective("click-outside");return t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:a,class:t.normalizeClass(["outer",{pulse:h.value}])},[_[1]||(_[1]=t.createElementVNode("div",{class:"frame"},null,-1)),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["mark-input",{empty:!m.value,edit:p.value}]),onClick:L},[t.createElementVNode("div",He,t.toDisplayString(m.value),1)],2)),[[B,S]]),p.value?(t.openBlock(),t.createElementBlock("div",je,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W.value,T=>(t.openBlock(),t.createElementBlock("div",{key:T,class:"mark-option",onClick:f=>$(T)},t.toDisplayString(T),9,Ge))),128))])):t.createCommentVNode("",!0),_[2]||(_[2]=t.createElementVNode("div",{class:"mark-title"},"Mark",-1)),t.withDirectives(t.createElementVNode("input",{type:"text",class:"bar-input","onUpdate:modelValue":_[0]||(_[0]=T=>o.value=T),inputmode:"decimal",pattern:"\\d*",onChange:g,onKeyup:t.withKeys(g,["enter"])},null,544),[[t.vModelText,o.value]]),_[3]||(_[3]=t.createElementVNode("div",{class:"bar-title"},"Bar",-1)),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["rpt-input",{edit:v.value}]),onClick:R},[t.createElementVNode("div",Ze,t.toDisplayString(t.unref(i).currentRepeat||"-"),1)],2)),[[B,x]]),_[4]||(_[4]=t.createElementVNode("div",{class:"rpt-title"},"Rpt",-1)),t.createElementVNode("div",Ke,[t.createElementVNode("div",Ye,t.toDisplayString(t.unref(i).currentBeat),1)]),_[5]||(_[5]=t.createElementVNode("div",{class:"beat-title"},"Beat",-1))],2)}}},[["__scopeId","data-v-3043e562"]]),Qe={class:"title"},ae=C({__name:"BaseNumericInput",props:t.mergeModels({title:{type:String,required:!0},color:{type:String,default:"#336"},focusColor:{type:String,default:"#558"},textColor:{type:String,default:"#aad"},backgroundColor:{type:String,default:"#111117"},sliderMax:{type:Number,default:1},sliderMin:{type:Number,default:0},thumbLength:{type:Number,default:2},formatValue:{type:Function,default:e=>e.toString()},parseValue:{type:Function,default:e=>parseFloat(e)},validateInput:{type:Function,default:e=>e.replace(/[^0-9.]/g,"")},transformSliderToDisplay:{type:Function,default:e=>e},transformDisplayToSlider:{type:Function,default:e=>e},maxChars:{type:Number,default:null}},{value:{default:.5},valueModifiers:{}}),emits:["update:value"],setup(e){t.useCssVars(m=>({"0d0963e0":e.textColor,"4ad34b2f":e.backgroundColor,"02156786":e.color,"715a9528":u.value,"30d64f7d":h.value,b8fbe65e:e.focusColor}));const a=e,n=t.useTemplateRef("el"),{width:r,height:s}=w(n),i=t.useModel(e,"value"),c=t.ref(a.formatValue(a.transformSliderToDisplay(i.value)));t.watch(i,()=>{const m=a.transformSliderToDisplay(i.value);c.value=a.formatValue(m)}),t.watch(c,()=>{c.value=a.validateInput(c.value),a.maxChars&&c.value.length>a.maxChars&&(c.value=c.value.slice(0,a.maxChars))});const h=t.computed(()=>Math.min(s.value/2.25,r.value/2.2)+"px"),u=t.computed(()=>Math.min(r.value/3,s.value/6.4)+"px");function o(){const m=a.parseValue(c.value),p=a.transformDisplayToSlider(m);i.value=Math.min(Math.max(p,a.sliderMin),a.sliderMax)}return(m,p)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"el",ref:n},[p[2]||(p[2]=t.createElementVNode("div",{class:"frame"},null,-1)),t.withDirectives(t.createElementVNode("input",{type:"text",class:"input","onUpdate:modelValue":p[0]||(p[0]=v=>c.value=v),inputmode:"decimal",pattern:"\\d*",onChange:o},null,544),[[t.vModelText,c.value]]),t.createElementVNode("div",Qe,t.toDisplayString(e.title),1),t.createVNode(q,{class:"slider",value:i.value,"onUpdate:value":p[1]||(p[1]=v=>i.value=v),"thumb-length":e.thumbLength,max:e.sliderMax,min:e.sliderMin},null,8,["value","thumb-length","max","min"])],512))}},[["__scopeId","data-v-79c7a539"]]),fe={__name:"SpeedInput",setup(e){const a=N(),n=I(),r=t.computed({get:()=>Math.log2(a.playbackSpeed)*.5+.5,set:o=>{const m=Math.pow(2,o*2-1);n.setPlaybackSpeed(m)}}),s=o=>Math.floor(Math.pow(2,o*2-1)*100+.5)+"",i=o=>parseFloat(o),c=o=>o.replace(/\D/g,""),h=o=>o,u=o=>{const m=Math.log2(o/100)*.5+.5;return Math.min(Math.max(m,0),1)};return(o,m)=>(t.openBlock(),t.createBlock(ae,{value:r.value,"onUpdate:value":m[0]||(m[0]=p=>r.value=p),title:"Speed",color:"#336","text-color":"#aad","format-value":s,"parse-value":i,"validate-input":c,"transform-slider-to-display":h,"transform-display-to-slider":u,"thumb-length":2,"max-chars":3},null,8,["value"]))}},ge={__name:"TimeInput",setup(e){const a=N(),n=D(),r=I(),s=o=>o.toFixed(1),i=o=>parseFloat(o),c=o=>o.replace(/[^0-9.]/g,""),h=o=>o,u=o=>o;return(o,m)=>(t.openBlock(),t.createBlock(ae,{value:t.unref(a).currentTime,"onUpdate:value":[m[0]||(m[0]=p=>t.unref(a).currentTime=p),t.unref(r).setTime],title:"Time",color:"#344","focus-color":"#556868","text-color":"#acc","background-color":"#111117","slider-max":t.unref(n).totalDuration,"slider-min":0,"format-value":s,"parse-value":i,"validate-input":c,"transform-slider-to-display":h,"transform-display-to-slider":u,"thumb-length":2},null,8,["value","onUpdate:value","slider-max"]))}},Xe={class:"inner"},P=C({__name:"AudioButton",setup(e){const a=t.ref(!1),n=()=>a.value=!0,r=()=>a.value=!1;return(s,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["button-outer",{down:a.value}]),onPointerdown:n,onPointerup:r,onPointerleave:r},[t.createElementVNode("div",Xe,[t.renderSlot(s.$slots,"default",{},void 0,!0)])],34))}},[["__scopeId","data-v-0d7af06e"]]),Je={class:"outer"},et={class:"buttons"},tt={class:"icon",viewBox:"0 0 48 48"},at=["d"],be=C({__name:"MixerControls",setup(e){const a=D(),n=N(),r=I();function s(){n.isPlaying?r.stop():r.play()}function i(){const v=Math.max(1,n.currentBar-1);r.setBar(v)}function c(){const v=n.currentBar+1;r.setBar(v)}function h(){r.playStartingNotes()}const u=t.ref(!1),o=t.ref(!0);function m(){u.value=!u.value}function p(){o.value=!o.value}return(v,g)=>(t.openBlock(),t.createElementBlock("div",Je,[t.createVNode(ee,{class:"title",align:"centre"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(a).title),1)]),_:1}),t.createVNode(q,{class:"main",colour:"red",modelValue:t.unref(n).masterVolume,"onUpdate:modelValue":g[0]||(g[0]=M=>t.unref(n).masterVolume=M)},null,8,["modelValue"]),t.createVNode(q,{class:"tick",colour:"blue"}),g[6]||(g[6]=t.createElementVNode("div",{class:"main-t"},"Main",-1)),g[7]||(g[7]=t.createElementVNode("div",{class:"tick-t"},"Tick",-1)),t.createVNode(pe,{class:"bar"}),t.createVNode(ge,{class:"time"}),t.createVNode(fe,{class:"speed"}),t.createElementVNode("div",et,[t.createVNode(P,{class:"button",onClick:i},{default:t.withCtx(()=>g[1]||(g[1]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 0 48 48"},[t.createElementVNode("path",{d:"M11 36V12h3v24Zm26 0L19.7 24 37 12Z"})],-1)])),_:1,__:[1]}),t.createVNode(P,{class:"button",onClick:s},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",tt,[t.createElementVNode("path",{d:t.unref(n).isPlaying?"M27.4 35.4V12.6h8v22.8Zm-14.8 0V12.6h8.05v22.8Z":"M16 37.85v-28l22 14Z"},null,8,at)]))]),_:1}),t.createVNode(P,{class:"button",onClick:c},{default:t.withCtx(()=>g[2]||(g[2]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 0 48 48"},[t.createElementVNode("path",{d:"M34 36V12h3v24Zm-23 0V12l17.3 12Z"})],-1)])),_:1,__:[2]}),t.createVNode(P,{class:"button",onClick:m},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["icon",u.value?"on":"off"]),viewBox:"-128 -128 768 768"},g[3]||(g[3]=[t.createElementVNode("path",{d:"m 463.84136,154.89339 c -6.42,-6.42 -16.83,-6.42 -23.251,0 -71.31197,70.35135 -136.61146,132.25426 -208.741,199.7 h -105.82 c 23.35495,-140.1063 67.13099,-217.59716 120.727,-318.357996 0.86,-0.803 2.209,-0.801 3.067,-10e-4 20.50653,37.383983 48.51152,88.812606 72.26194,147.190756 1.186,9.002 12.2214,17.4338 23.3242,11.71391 9.002,-1.186 11.1594,-12.2324 9.9724,-21.2344 -21.69905,-53.89113 -30.43965,-85.078342 -83.11454,-161.702266 -13.446,-12.55299965 -34.508,-12.55699965 -47.954,10e-4 C 126.80877,149.30021 96.099465,324.74626 77.091365,474.25139 c -2.829,21.473 13.907,40.535 35.543995,40.535 h 271.311 c 21.661,0 38.373,-19.087 35.544,-40.535 -8.26237,-52.34207 -14.88466,-100.7074 -24.7871,-157.02622 -6.40949,-11.78839 -8.3911,-14.9907 -17.4031,-13.8037 -9.002,1.186 -13.59751,8.0528 -12.41051,17.0548 l 5.66371,34.11712 h -83.159 c 64.35441,-63.86663 129.29308,-130.29894 176.448,-176.449 6.42,-6.42 6.42,-16.83 -10e-4,-23.251 z m -88.956,232.582 12.004,91.074 c 0.112,0.846 -0.148,1.701 -0.708,2.341 -0.566,0.645 -1.38,1.014 -2.235,1.014 h -271.311 c -0.855,0 -1.668,-0.369 -2.231,-1.011 -0.564,-0.643 -0.824,-1.499 -0.712,-2.347 l 12.003,-91.072 h 253.19 z"},null,-1)]),2))]),_:1}),t.createVNode(P,{class:"button",onClick:p},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["icon",o.value?"on":"off"]),viewBox:"-2 -2 28 28"},g[4]||(g[4]=[t.createElementVNode("path",{d:"m 8.9838564,1.5166215 v 2 h 5.9999996 v -2 z m 2.9999996,3 c -4.9699996,0 -8.9999996,4.0299999 -8.9999996,8.9999995 0,4.97 4.02,9 8.9999996,9 4.98,0 9,-4.03 9,-9 0,-2.12 -0.740703,-4.0693745 -1.970703,-5.6093745 l 1.419922,-1.421875 c -0.43,-0.51 -0.900156,-0.9882031 -1.410156,-1.4082031 l -1.419922,1.4199219 c -1.55,-1.24 -3.499141,-1.9804688 -5.619141,-1.9804688 z m -1.789062,4.7480469 6,4.4999996 -6,4.5 z"},null,-1)]),2))]),_:1}),t.createVNode(P,{class:"button",onClick:h},{default:t.withCtx(()=>g[5]||(g[5]=[t.createElementVNode("svg",{class:"icon",viewBox:"0 -960 960 960"},[t.createElementVNode("path",{d:"m 306.66667,-360 q -44,0 -75.33334,-31.33333 Q 200,-422.66667 200,-466.66667 q 0,-44 31.33333,-75.33333 31.33334,-31.33333 75.33334,-31.33333 15.33333,0 28.33333,3.66666 13,3.66667 25,11 V -840 h 160 v 106.66667 H 413.33333 v 266.66666 q 0,44 -31.33333,75.33334 Q 350.66667,-360 306.66667,-360 Z"}),t.createElementVNode("path",{d:"m 546.66667,-120 q -44,0 -75.33334,-31.33333 Q 440,-182.66667 440,-226.66667 q 0,-44 31.33333,-75.33333 31.33334,-31.33333 75.33334,-31.33333 15.33333,0 28.33333,3.66666 13,3.66667 25,11 V -600 h 160 v 106.66667 H 653.33333 v 266.66666 q 0,44 -31.33333,75.33334 Q 590.66667,-120 546.66667,-120 Z"})],-1)])),_:1,__:[5]})])]))}},[["__scopeId","data-v-fc2b877e"]]),nt={class:"container"},rt={class:"panel"},ve=40,ye=40,_e=100,st=50,Me=400,Se=570,ke=570,ot=350,it=330,lt=360,ct=360,ut=C({__name:"MixerLayout",setup(e){t.useCssVars(u=>({"2540622b":i.value,"25398f45":c.value,fc452918:h.value}));const a=D(),n=t.useTemplateRef("container"),{width:r}=w(n),s=t.computed(()=>{const u=r.value,o=a.parts.length;return u<640||u<ve*o+Me?0:u<ye*o+Se?1:u<_e*o+ke?2:3}),i=t.computed(()=>{switch(s.value){case 0:return`${ot}px `+`${st}px `.repeat(a.parts.length);case 1:return`${it}px`;case 2:return`${lt}px`;default:return`${ct}px`}}),c=t.computed(()=>{switch(s.value){case 0:return"100vw";case 1:return`${ve}px `.repeat(a.parts.length)+`${Me}px`;case 2:return`${ye}px `.repeat(a.parts.length)+`${Se}px`;default:return`${_e}px `.repeat(a.parts.length)+`${ke}px`}}),h=t.computed(()=>{const u=[...a.parts.keys()];return s.value>0?'"'+u.map(o=>"part"+o).join(" ")+' controls"':'"controls" '+u.map(o=>'"part'+o+'"').join(" ")});return(u,o)=>(t.openBlock(),t.createElementBlock("div",{class:"outer",ref_key:"container",ref:n},[t.createElementVNode("div",nt,[t.createElementVNode("div",rt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).parts,(m,p)=>(t.openBlock(),t.createBlock(he,{key:m.name,class:t.normalizeClass("part"+p),name:m.name,volume:m.volume,"onUpdate:volume":v=>m.volume=v,solo:m.solo,"onUpdate:solo":v=>m.solo=v,mute:m.mute,"onUpdate:mute":v=>m.mute=v,ref_for:!0,ref:"parts"},null,8,["class","name","volume","onUpdate:volume","solo","onUpdate:solo","mute","onUpdate:mute"]))),128)),t.createVNode(be,{title:t.unref(a).title,class:"controls"},null,8,["title"])])])],512))}},[["__scopeId","data-v-03258471"]]),dt={class:"outer"},mt={class:"mid"},ht={class:"inner"},pt={key:0,class:"content"},ft=C({__name:"Placeholder",props:{colour:{type:String,default:"red"},text:{type:String,default:""}},setup(e){return t.useCssVars(a=>({"66bea586":e.colour})),(a,n)=>(t.openBlock(),t.createElementBlock("div",dt,[t.createElementVNode("div",mt,[t.createElementVNode("div",ht,[e.text||a.$slots.default?(t.openBlock(),t.createElementBlock("div",pt,[t.createTextVNode(t.toDisplayString(e.text)+" ",1),t.renderSlot(a.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)])])]))}},[["__scopeId","data-v-dff76c48"]]);b.AudioButton=P,b.AudioSlider=q,b.BarInput=pe,b.BaseNumericInput=ae,b.DEV_MODE=Y,b.DummyAudioEngine=me,b.MixerControls=be,b.MixerLayout=ut,b.PartControl=he,b.Placeholder=ft,b.SpeedInput=fe,b.TimeInput=ge,b.TitleText=ee,b.TriState=ue,b.isDevFeature=te,b.isDevMode=qe,b.useAudioStateStore=N,b.useElementSize=w,b.useMasterAudioControl=I,b.useMusicDataStore=D,b.usePlaybackStateStore=de,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
File without changes
|