PageSourceSearch

https://static-cos.mureka.ai/cos-prod/mureka/static/js/index-BtE29C1W.js

js mureka.ai collected 2026-09-24 09:23:36 UTC 338,634 bytes, 1 lines download raw bytes

1var e=Object.defineProperty,t=(t,a,n)=>((t,a,n)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[a]=n)(t,"symbol"!=typeof a?a+"":a,n);import{r as a,i as n,c as l,w as i,x as o,y as r,B as s,G as c,H as d,U as u,K as p,u as v,a2 as m,a6 as g,O as h,I as f,P as y,ar as k,as as b,g as w,au as A,V as C,f as _,J as T,M as x,aL as D,Q as I,at as S,D as M,n as E,R as P,S as L,T as R,z as B,aa as j,a7 as N,aA as O,ai as V,aq as F,v as U,a9 as H,a4 as G,h as W,$ as K,ac as Y,aC as z,q as X}from"./vendor-core-DockhpYX.js";import{_ as Q,a as q,b as Z,c as J,e as $}from"./openInStudioUtils-quOvGHei.js";import{l as ee}from"./lottie-web-DKG18YIy.js";import{b as te,a as ae,i as ne,u as le,d as ie,g as oe,f as re,h as se,j as ce,k as de,c as ue,e as pe,l as ve,r as me,m as ge,n as he,o as fe,C as ye,p as ke,q as be,t as we,v as Ae,w as Ce,x as _e}from"./data-Dlp3D-33.js";import{_ as Te,h as xe,cG as De,cH as Ie,m as Se,j as Me,o as Ee,b as Pe,l as Le,u as Re,v as Be,g as je,M as Ne,k as Oe,R as Ve,r as Fe,G as Ue,a6 as He,cI as Ge,a as We,aj as Ke,C as Ye,s as ze,w as Xe,cJ as Qe,aE as qe,aD as Ze,e as Je,cK as $e,ao as et,ag as tt,aV as at}from"./index-DIXwfVMT.js";import{G as nt,T as lt,S as it,u as ot,a as rt,b as st,c as ct,d as dt,e as ut,f as pt,r as vt,U as mt,C as gt,g as ht,O as ft,h as yt,i as kt,j as bt,k as wt,l as At,E as Ct,m as _t,n as Tt,o as xt,p as Dt,q as It,s as St,L as Mt,t as Et,v as Pt,w as Lt,R as Rt,x as Bt,M as 
1jt,y as Nt,z as Ot,A as Vt,B as Ft,D as Ut,F as Ht,H as Gt,I as Wt,J as Kt,K as Yt,N as zt,P as Xt,Z as Qt,Q as qt,V as Zt,W as Jt,X as $t,Y as ea,_ as ta,$ as aa}from"./index-CHd6Bjqy.js";import{r as na,j as la,a as ia,c as oa,b as ra,k as sa}from"./element-plus-CADUlNlv.js";import{_ as ca}from"./icon-close-BrkMU7jH.js";import{_ as da,A as ua}from"./AudioPlayer-C0e_oCjk.js";import{a as pa,_ as va}from"./PullTo-BIvbThln.js";import{t as ma,M as ga,j as ha,g as fa,k as ya,e as ka}from"./i18n-misc-CJ8HFqLU.js";import ba from"./editSongBasicInfo-BthMad-N.js";import{_ as wa,I as Aa,S as Ca}from"./splitterStemDialog-CX9V5aMD.js";import{c as _a}from"./clipUtil-Cm1WHU6U.js";import{L as Ta}from"./LazyLoadImg-Bzjg4n3F.js";import{d as xa}from"./logo-empty-CnE_7zj2.js";import{_ as Da}from"./delete-red-ico-CJwdAOgx.js";import{_ as Ia}from"./download-more-ico-BsacBcM4.js";import{_ as Sa}from"./LoaderWave-BLdNKbR3.js";import{_ as Ma}from"./index-7J1yMQU2.js";import{C as Ea}from"./createAiFlag-LgHpF5sP.js";import{_ as Pa,a as La}from"./editGender-CeRbgpvt.js";import{u as Ra}from"./styleDataStore-B6bZDdst.js";import"./swiper-DJTO6NsM.js";import{_ as Ba,a as ja}from"./Search-mxSMIlov.js";import{_ as Na}from"./LoaderCircle-CVBYnNOL.js";import{J as Oa}from"./jszip-B1XuZ6Ca.js";import{_ as Va}from"./learnStudio-CDlKD1Fv.js";import"./axios-C-1G2k3o.js";import"./@ffmpeg-CcTuH-sP.js";import"./@paypal-DitgUCQS.js";import"./konva-6lDEajzN.js";import"./tone-t02qUu_Q.js";import"./copy-icon-DMaP_kAM.js";import"./utils-BoALak89.js";import"./uploadClipImage-_rfQuZBk.js";import"./vue-filepond.esm-CVTHONcd.js";import"./img-empty-BTiNkDHg.js";import"./LoaderProgressCircle-CjjKxBhW.js";import"./audioDragUpload-C8aSPnj5.js";import"./validationTools-DPj-hFp5.js";import"./addLinkDialog-CEL1E-f2.js";import"./song-icon-dZqFm9-1.js";import"./AudioWavForm-5hQe80uG.js";import"./colorUtil-Dc0piSax.js";import"./loadingWaveSkeleton-Boo7wKEw.js";import"./AudioPlayerSlider-DS_NgRbv.js";import"./const-DIcblchm.js";import"./inputLyric-DeVXPDiN.js";const Fa="l",Ua="m",Ha="r",Ga="s",Wa="z",Ka=" ",Ya="Enter",za="Backspace",Xa="Delete",Qa="ArrowUp",qa="ArrowDown",Za="tracks",Ja="timeline";function $a(e,t){const a=t.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=void 0!==t.shift?e.shiftKey===t.shift:!e.shiftKey,l=void 0!==t.alt?e.altKey===t.alt:!e.altKey;return a&&n&&l}function en(){var e;return"undefined"!=typeof window&&"undefined"!=typeof navigator&&((null==(e=navigator.platform)?void 0:e.toUpperCase().includes("MAC"))??!1)}const tn=[{key:Xa,description:"删除选中的片段",action:"deleteSelectedClips"},{key:za,description:"删除选中的片段",action:"deleteSelectedClips"},{key:"c",ctrl:!0,description:"复制选中的片段",action:"copySelectedClips"},{key:"v",ctrl:!0,description:"粘贴复制的片段",action:"pasteSelectedClips"},{key:"x",ctrl:!0,description:"剪切",action:"cutSelectedClips"},{key:Ga,ctrl:!0,description:"切割",action:"splitSelectedClips"}];class an{constructor(e){this.context=e}getStore(e="studio"){var t;return null==(t=this.context.stores)?void 0:t[e]}handle(e){const t=e.key;for(const a of tn){if(!(1===t.length?a.key.toLowerCase()===t.toLowerCase():a.key===t))continue;if(!$a(e,a))continue;if(this.executeAction(a.action,e))return!0}return!1}executeAction(e,t){switch(e){case"deleteSelectedClips":return this.deleteSelectedClips(t);case"copySelectedClips":return this.copySelectedClips(t);case"pasteSelectedClips":return this.pasteSelectedClips(t);case"cutSelectedClips":return this.cutSelectedClips(t);case"splitSelectedClips":return this.splitSelectedClips(t);default:return!1}}copySelectedClips(e){const t=nt.MainManagerDispatcher.getCopyDataBySelectionData();return window._mureka_studio_copy_data=t,e.preventDefault(),!0}pasteSelectedClips(e){var t;const a=window._mureka_studio_copy_data||[],n=nt.MainManagerDispatcher.getSelection(),l=nt.MainManagerDispatcher.pasteCopiedSelectionToTracks(a,{startTime:n.startTime,startTrackId:n.focusedTrackId||(null==(t=n.trackIds)?void 0:t[0])});return l&&l.tracks&&lt.batchUpdate({tracks:l.tracks}),e.preventDefault(),!0}deleteSelectedClips(e){var t;if(nt.MainManagerDispatcher.getSelection().type!==it.POINT){const a=nt.MainManagerDispatcher.deleteBySelectionData();return(null==(t=null==a?void 0:a.tracks)?void 0:t.length)&&lt.batchUpdate({tracks:a.tracks}),e.preventDefault(),!0}return!1}cutSelectedClips(e){this.copySelectedClips(e),this.deleteSelectedClips(e)}splitSelectedClips(e){if(nt.MainManagerDispatcher){const{tracks:e}=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData();lt.batchUpdate({tracks:e})}return e.preventDefault(),!0}}const nn=[{key:Ka,description:"播放/暂停",action:"togglePlayPause"},{key:Ha,description:"开始/停止录音",action:"toggleRecord"},{key:Ya,description:"重置播放位置到起始点",action:"resetToStart"},{key:Wa,ctrl:!0,description:"撤销",action:"undo"},{key:Wa,ctrl:!0,shift:!0,description:"重做",action:"redo"},{key:Fa,ctrl:!0,description:"循环播放",action:"toggleLoop"}];class ln{constructor(e){this.context=e,this.debouncedToggleRecord=na(this._toggleRecordImpl.bind(this),300,{leading:!0,trailing:!1})}
1getPlayerStore(){return ot()}getStudioStore(){return rt()}handle(e){const t=e.key;for(const a of nn){if(!(1===t.length&&/[a-zA-Z]/.test(t)?a.key.toLowerCase()===t.toLowerCase():a.key===t))continue;if(!$a(e,a))continue;if(this.executeAction(a.action,e))return!0}return!1}executeAction(e,t){switch(e){case"togglePlayPause":return this.togglePlayPause(t);case"toggleRecord":return this.toggleRecord(t).catch(e=>{}),!0;case"resetToStart":return this.resetToStart(t);case"undo":return this.undo(t);case"redo":return this.redo(t);case"toggleLoop":return this.toggleLoop(t);default:return!1}}togglePlayPause(e){var t,a,n,l;const i=this.getPlayerStore(),o=this.getStudioStore(),r=i.getRecordingState(),s=null==(t=i.getRecordInputObj)?void 0:t.call(i),c="preview"===o.mode,d=null==(a=i.loopState)?void 0:a.loop,u=!(!s||r.isRecording||r.isPaused||c||d);if(r.isRecording||r.isPaused||u){const t=null==(l=null==(n=this.context)?void 0:n.getOperations)?void 0:l.call(n);if(null==t?void 0:t.handleRecord)return t.handleRecord().catch(e=>{}),e.preventDefault(),e.stopPropagation(),!0}return i.isTonePlayerPlaying?i.pauseTonePlayer():i.playTonePlayer(),e.preventDefault(),!0}undo(e){const t=this.getStudioStore();return this.getPlayerStore().getRecordingState().isRecording?(e.preventDefault(),!0):!!t.canUndo&&(t.undo(),e.preventDefault(),!0)}redo(e){const t=this.getStudioStore();return this.getPlayerStore().getRecordingState().isRecording?(e.preventDefault(),!0):!!t.canRedo&&(t.redo(),e.preventDefault(),!0)}toggleLoop(e){return this.getPlayerStore().toogleLoopState(),e.preventDefault(),!0}resetToStart(e){var t,a,n,l,i;const o=this.getPlayerStore(),r=(null==(a=null==(t=o.getTimeRangeInfo)?void 0:t.call(o))?void 0:a.minStartTime)||0;if(o.isTonePlayerPlaying)return!1;return!!o.setCurrentPlaytime(0).success&&(null==(i=null==(l=null==(n=nt)?void 0:n.MainManagerDispatcher)?void 0:l.setCurrentPlaytime)||i.call(l,!1,r,!1,r),e.preventDefault(),!0)}async toggleRecord(e){return e.preventDefault(),e.stopPropagation(),this.debouncedToggleRecord(e)}async _toggleRecordImpl(){var e;const t=null==(e=this.context)?void 0:e.getOperations;if(!t)return!1;const a=t();if(!a||!a.handleRecord)return!1;try{return await a.handleRecord(),!0}catch(n){return!1}}}const on=[{key:Xa,description:"删除选中的轨道",action:"deleteSelectedTrack"},{key:za,description:"删除选中的轨道",action:"deleteSelectedTrack"},{key:Qa,description:"上移选中的轨道",action:"moveSelectedTrackUp"},{key:qa,description:"下移选中的轨道",action:"moveSelectedTrackDown"},{key:Ua,shift:!0,description:"静音开/关",action:"toggleTrackMute"},{key:Ga,shift:!0,description:"独奏开/关",action:"toggleTrackSolo"}];class rn{constructor(e){this.context=e}getStore(e="studio"){var t;return null==(t=this.context.stores)?void 0:t[e]}handle(e){const t=e.key;for(const a of on){if(!(1===t.length?a.key.toLowerCase()===t.toLowerCase():a.key===t))continue;if(!$a(e,a))continue;if(this.executeAction(a.action,e))return!0}return!1}executeAction(e,t){switch(e){case"deleteSelectedTrack":return this.deleteSelectedTrack(t);case"moveSelectedTrackUp":return this.moveSelectedTrackUp(t);case"moveSelectedTrackDown":return this.moveSelectedTrackDown(t);case"toggleTrackMute":return this.toggleTrackMute(t);case"toggleTrackSolo":return this.toggleTrackSolo(t);default:return!1}}findTrackAndLane(e,t){for(let a=0;a<e.length;a++){const n=e[a];if(n.id===t)return{track:n,index:a,laneIndex:-1,isLane:!1};if(n.takeLanes&&n.takeLanes.length>0){const e=n.takeLanes.findIndex(e=>e.id===t);if(-1!==e)return{track:n,index:a,laneIndex:e,isLane:!0,lane:n.takeLanes[e]}}}return null}moveSelectedTrackUp(e){const t=this.getStore(),a=t.state.selection,n=null==a?void 0:a.focusedTrackId;if(!n)return!1;const l=t.state.tracks||[],i=this.findTrackAndLane(l,n);if(!i)return!1;let o=null;if(i.isLane)o=i.laneIndex>0?i.track.takeLanes[i.laneIndex-1].id:i.track.id;else if(i.index>0){const e=l[i.index-1];o=e.takeLanesExpanded&&e.takeLanes&&e.takeLanes.length>0?e.takeLanes[e.takeLanes.length-1].id:e.id}if(!o)return!1;const r=(t.state.selection.trackIds||[]).filter(e=>e!==n).concat(o);return st.set({selection:{...t.state.selection,focusedTrackId:o,trackIds:r}},{skipSave:!0,skipHistory:!0}),e.preventDefault(),!0}moveSelectedTrackDown(e){const t=this.getStore(),a=t.state.selection,n=null==a?void 0:a.focusedTrackId;if(!n)return!1;const l=t.state.tracks||[],i=this.findTrackAndLane(l,n);if(!i)return!1;let o=null;if(i.isLane?i.track.takeLanes&&i.laneIndex<i.track.takeLanes.length-1?o=i.track.takeLanes[i.laneIndex+1].id:i.index<l.length-1&&(o=l[i.index+1].id):i.track.takeLanesExpanded&&i.track.takeLanes&&i.track.takeLanes.length>
10?o=i.track.takeLanes[0].id:i.index<l.length-1&&(o=l[i.index+1].id),!o)return!1;const r=(t.state.selection.trackIds||[]).filter(e=>e!==n).concat(o);return st.set({selection:{...t.state.selection,focusedTrackId:o,trackIds:r}},{skipSave:!0,skipHistory:!0}),e.preventDefault(),!0}deleteSelectedTrack(e){var t,a;const n=this.getStore(),l=n.state.selection,i=null==l?void 0:l.focusedTrackId;if(!i)return!1;const o=n.state.tracks||[],r=this.findTrackAndLane(o,i);if(!r)return!1;if(r.isLane){const{track:t,laneIndex:a,lane:l}=r;let i=null;return i=t.takeLanes.length>1?a<t.takeLanes.length-1?t.takeLanes[a+1].id:t.takeLanes[a-1].id:t.id,ct(()=>{st.set({selection:{...n.state.selection,focusedTrackId:i,trackIds:i?[i]:[]}}),dt.remove({trackId:t.id,takeLaneId:l.id})}),e.preventDefault(),!0}{const l=r.track;let i=null;const s=1===o.length;if(o.length>1){const e=r.index===o.length-1;i=e?(null==(a=o[r.index-1])?void 0:a.id)||null:(null==(t=o[r.index+1])?void 0:t.id)||null}return ct(()=>{s?st.set({selection:{clipId:null,startTime:0,endTime:0,focusedArea:null,focusedTrackId:null,type:"",trackIds:[]}}):st.set({selection:{...n.state.selection,focusedTrackId:i,trackIds:i?[i]:[]}}),lt.remove(l.id)}),e.preventDefault(),!0}}toggleTrackMute(e){const t=this.getStore(),a=t.state.selection,n=null==a?void 0:a.focusedTrackId;if(!n)return!1;const l=(t.state.tracks||[]).find(e=>e.id===n);return!!l&&(lt.toggleMute({trackId:n,mute:!l.mute}),e.preventDefault(),!0)}toggleTrackSolo(e){const t=this.getStore(),a=t.state.selection,n=null==a?void 0:a.focusedTrackId;if(!n)return!1;const l=(t.state.tracks||[]).find(e=>e.id===n);return!!l&&(lt.toggleSolo({trackId:n,solo:!l.solo}),e.preventDefault(),!0)}}class sn{constructor(e={}){this.options={debug:!1,...e},this.handlers={},this.globalHandler=null,this.keydownListener=null,this.context=null,this.initialized=!1}init(e){this.initialized||(this.context=e,this.handlers[Ja]=new an(e),this.handlers[Za]=new rn(e),this.globalHandler=new ln(e),this.keydownListener=this.handleKeydown.bind(this),document.addEventListener("keydown",this.keydownListener),this.initialized=!0)}destroy(){this.keydownListener&&(document.removeEventListener("keydown",this.keydownListener),this.keydownListener=null),this.handlers={},this.globalHandler=null,this.context=null,this.initialized=!1}handleKeydown(e){if(document.querySelector(".learn-studio-dialog"))return;if(function(e){var t;if(!e)return!1;const a=null==(t=e.tagName)?void 0:t.toLowerCase();return"input"===a||"textarea"===a||!!e.isContentEditable}(e.target))return;const t=this.getFocusedArea();if(t&&this.handlers[t]){if(this.handlers[t].handle(e))return}if(this.globalHandler){if(this.globalHandler.handle(e))return}}getFocusedArea(){var e,t,a,n;return(null==(n=null==(a=(null==(t=null==(e=this.context)?void 0:e.stores)?void 0:t.studio).state)?void 0:a.selection)?void 0:n.focusedArea)||null}}let cn=null;function dn(e,t={}){const a=function(e={}){return cn||(cn=new sn(e)),cn}(t);a.init(e)}function un(){cn&&(cn.destroy(),cn=null)}const pn={v:"5.12.2",fr:25,ip:0,op:75,w:600,h:180,nm:"drag",ddd:0,assets:[{id:"comp_0",nm:"合成 1",fr:25,layers:[{ddd:0,ind:1,ty:4,nm:"hand1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[40.375,43.312,0],ix:2,l:2},a:{a:0,k:[-5.75,36.5,0],ix:1,l:2},s:{a:1,k:[{i:{x:[.667,.667,.667],y:[1,1,1]},o:{x:[.333,.333,.333],y:[0,0,0]},t:10,s:[100,100,100]},{t:20,s:[100,80,100]}],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ty:"rc",d:1,s:{a:0,k:[2,10],ix:2},p:{a:0,k:[0,0],ix:3},r:{a:0,k:0,ix:4},nm:"矩形路径 1",mn:"ADBE Vector Shape - Rect",hd:!1},{ty:"fl",c:{a:0,k:[0,0,0,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"填充 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[-6.16,36.152],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"矩形 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:750,st:0,ct:1,bm:0},{ddd:0,ind:2,ty:4,nm:"hand2",parent:1,sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[-10.719,36.227,0],ix:2,l:2},a:{a:0,k:[-5.75,36.25,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}}
1,ao:0,shapes:[{ty:"gr",it:[{ty:"rc",d:1,s:{a:0,k:[2,10],ix:2},p:{a:0,k:[0,0],ix:3},r:{a:0,k:0,ix:4},nm:"矩形路径 1",mn:"ADBE Vector Shape - Rect",hd:!1},{ty:"fl",c:{a:0,k:[0,0,0,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"填充 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[-6.16,36.152],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"矩形 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:750,st:0,ct:1,bm:0},{ddd:0,ind:3,ty:4,nm:"hand3",parent:1,sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[-17.25,36.109,0],ix:2,l:2},a:{a:0,k:[-6.75,36,0],ix:1,l:2},s:{a:0,k:[100,125,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ty:"rc",d:1,s:{a:0,k:[2,8],ix:2},p:{a:0,k:[0,0],ix:3},r:{a:0,k:0,ix:4},nm:"矩形路径 1",mn:"ADBE Vector Shape - Rect",hd:!1},{ty:"fl",c:{a:0,k:[0,0,0,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"填充 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[-6.628,35.995],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"矩形 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:750,st:0,ct:1,bm:0},{ddd:0,ind:4,ty:4,nm:"hand4",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[33,44.125,0],ix:2,l:2},a:{a:0,k:[-3,37,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,ef:[{ty:25,nm:"投影",np:8,mn:"ADBE Drop Shadow",ix:1,en:1,ef:[{ty:2,nm:"阴影颜色",mn:"ADBE Drop Shadow-0001",ix:1,v:{a:0,k:[0,0,0,1],ix:1}},{ty:0,nm:"不透明度",mn:"ADBE Drop Shadow-0002",ix:2,v:{a:0,k:127.5,ix:2}},{ty:0,nm:"方向",mn:"ADBE Drop Shadow-0003",ix:3,v:{a:0,k:135,ix:3}},{ty:0,nm:"距离",mn:"ADBE Drop Shadow-0004",ix:4,v:{a:0,k:5,ix:4}},{ty:0,nm:"柔和度",mn:"ADBE Drop Shadow-0005",ix:5,v:{a:0,k:5,ix:5}},{ty:7,nm:"仅阴影",mn:"ADBE Drop Shadow-0006",ix:6,v:{a:0,k:0,ix:6}}]}],shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:1,k:[{i:{x:.667,y:1},o:{x:.333,y:0},t:10,s:[{i:[[2.937,.156],[.086,-.062],[0,0],[0,0],[3.478,0],[0,-2.312],[0,0],[1.188,1.938],[3.422,-1.32],[0,0],[0,0],[2.875,-.875],[-1.625,-4.5],[-1.312,-1.625],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.128,2.233],[-.533,1.76],[.188,2.25],[2,-3.125],[0,0],[0,0]],o:[[-2.5,-.094],[.023,-.125],[0,0],[0,0],[-2.147,0],[-.125,6.875],[0,0],[-1.188,-1.938],[-2.516,.867],[0,0],[0,0],[-2.875,.875],[4.5,4.75],[1.312,1.531],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[1.443,-2.857],[1.259,-4.157],[-.125,-2.062],[-.75,.75],[0,0],[0,0]],v:[[4.195,11.281],[1.008,13.68],[-.562,24.5],[-1.062,11.625],[-5.092,8.109],[-8.25,12.5],[-8.25,26.25],[-12.285,14.125],[-17.93,11.578],[-19.125,17.375],[-14.25,31.125],[-22.25,24.75],[-25.125,32.25],[-15.062,43.812],[-10,50],[-3.25,49.75],[.625,45.812],[3.375,50.062],[7.562,49.938],[7.25,45],[11.406,38.75],[14.922,29.812],[18.812,17.375],[12.312,16.625],[7.312,24.938],[7.43,14.125]],c:!0}]},{t:20,s:[{i:[[2.867,.125],[.086,-.062],[.281,-.617],[0,0],[3.621,-.192],[.801,-1.334],[0,0],[1.188,1.938],[2.305,-1.578],[-.375,-.875],[0,0],[2.875,-.875],[-1.562,-2.5],[-1.312,-1.625],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-.312,2.625],[0,0],[1.5,.812],[.75,-.75],[0,0],[0,0]],o:[[-2.539,-.156],[.023,-.125],[-.125,-1.117],[.014,-.021],[-2.144,.114],[-.834,1.389],[0,0],[-.09,-.25],[-2.07,1.859],[.375,.875],[0,0],[-2.875,.875],[4.5,4.75],[1.312,1.531],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[.312,-2.625],[0,0],[-.562,-.531],[-.75,.75],[0,0],[0,0]],v:[[3.352,19.219],[-.367,22.117],[-1.625,25.805],[-1.719,21.766],[-5.248,18.75],[-8.438,20.938],[-9.75,26.25],[-11.723,22.25],[-15.93,21.078],[-17.125,26.125],[-14.25,31.125],[-19.75,28.75],[-21.812,35.625],[-15.062,43.812],[-10,50],[-3.25,49.75],[.625,45.812],[3.375,50.062],[7.562,49.937],[7.25,45],[13.438,35.125],[14.062,26.125],[12.688,20.938],[9.625,20.938],[6.438,26.219],[6.492,22.125]],c:!0}]}],ix:2},nm:"路径 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"st",c:{a:0,k:[0,0,0,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:2,ix:5},lc:1,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"填充 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"形状 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:750,st:0,ct:1,bm:0}]}],fonts:{list:[{fName:"PlusJakartaSans-Medium",fFamily:"Plus Jakarta Sans",fStyle:"Medium",ascent:74.6988037135452}]},layers:[{ddd:0,ind:1,ty:5,nm:"Drag",parent:3,sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[34.595,-2.588,0],ix:2,l:2},a:{a:0,k:[33,-6,0],ix:1,l:2},s:{a:0,k:[83.333,83.333,100],ix:6,l:2}}
1,ao:0,t:{d:{k:[{s:{s:28,f:"PlusJakartaSans-Medium",t:"Drag",ca:0,j:0,tr:0,lh:33.6000022888184,ls:0,fc:[0,0,0]},t:0}]},p:{},m:{g:1,a:{a:0,k:[0,0],ix:2}},a:[]},ip:15,op:79,st:0,ct:1,bm:0},{ddd:0,ind:2,ty:4,nm:"background\n",parent:3,sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[271.571,292.922,0],ix:2,l:2},a:{a:0,k:[0,0,0],ix:1,l:2},s:{a:0,k:[83.333,83.333,100],ix:6,l:2}},ao:0,ef:[{ty:25,nm:"投影",np:8,mn:"ADBE Drop Shadow",ix:1,en:1,ef:[{ty:2,nm:"阴影颜色",mn:"ADBE Drop Shadow-0001",ix:1,v:{a:0,k:[0,0,0,1],ix:1}},{ty:0,nm:"不透明度",mn:"ADBE Drop Shadow-0002",ix:2,v:{a:0,k:127.5,ix:2}},{ty:0,nm:"方向",mn:"ADBE Drop Shadow-0003",ix:3,v:{a:0,k:135,ix:3}},{ty:0,nm:"距离",mn:"ADBE Drop Shadow-0004",ix:4,v:{a:0,k:5,ix:4}},{ty:0,nm:"柔和度",mn:"ADBE Drop Shadow-0005",ix:5,v:{a:0,k:5,ix:5}},{ty:7,nm:"仅阴影",mn:"ADBE Drop Shadow-0006",ix:6,v:{a:0,k:0,ix:6}}]}],shapes:[{ty:"gr",it:[{ty:"rc",d:1,s:{a:0,k:[112,48],ix:2},p:{a:0,k:[0,0],ix:3},r:{a:0,k:16,ix:4},nm:"矩形路径 1",mn:"ADBE Vector Shape - Rect",hd:!1},{ty:"st",c:{a:0,k:[0,0,0,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:1,ix:5},lc:1,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"填充 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[-285.367,-357.836],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"矩形 2",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:15,op:76,st:0,ct:1,bm:0},{ddd:0,ind:3,ty:0,nm:"hand",refId:"comp_0",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:1,k:[{i:{x:.833,y:.833},o:{x:.167,y:.167},t:25,s:[67,98,0],to:[125.333,66,0],ti:[-108.333,63,0]},{t:50,s:[543,98,0]}],ix:2,l:2},a:{a:0,k:[36,36,0],ix:1,l:2},s:{a:0,k:[120,120,100],ix:6,l:2}},ao:0,w:72,h:72,ip:0,op:750,st:0,bm:0}],markers:[],props:{},chars:[{ch:"D",size:28,style:"Medium",w:75.4,data:{shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[-5.467,3.067],[-2.834,5.634],[0,7.534],[2.7,5.6],[5.2,3.067],[7.333,0],[0,0],[0,0]],o:[[7.666,0],[5.466,-3.066],[2.833,-5.633],[0,-7.533],[-2.7,-5.6],[-5.2,-3.066],[0,0],[0,0],[0,0]],v:[[33.5,.3],[53.2,-4.3],[65.65,-17.35],[69.9,-37.1],[65.85,-56.8],[54,-69.8],[35.2,-74.4],[7.7,-74.4],[7.7,.3]],c:!0},ix:2},nm:"D",mn:"ADBE Vector Shape - Group",hd:!1},{ind:1,ty:"sh",ix:2,ks:{a:0,k:{i:[[0,0],[0,0],[0,0],[-4.334,-4.833],[0,-8.933],[4.466,-4.833],[8.4,0]],o:[[0,0],[0,0],[8.133,0],[4.333,4.834],[0,8.934],[-4.467,4.834],[0,0]],v:[[17.6,-9.2],[17.6,-65],[34.3,-65],[53,-57.75],[59.5,-37.1],[52.8,-16.45],[33.5,-9.2]],c:!0},ix:2},nm:"D",mn:"ADBE Vector Shape - Group",hd:!1}],nm:"D",np:5,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}]},fFamily:"Plus Jakarta Sans"},{ch:"r",size:28,style:"Medium",w:39.2,data:{shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0],[-1.6,2.3],[-3.067,1.3],[-4.2,0],[0,0],[0,0],[0,0],[3.433,-2.033],[2.133,-3.666],[0,0],[0,0],[0,0],[0,0]],o:[[0,0],[0,-2.8],[1.6,-2.3],[3.066,-1.3],[0,0],[0,0],[0,0],[-4.334,0],[-3.434,2.034],[0,0],[0,0],[0,0],[0,0],[0,0]],v:[[16.6,.3],[16.6,-30],[19,-37.65],[26,-43.05],[36.9,-45],[37.8,-45],[37.8,-55.1],[37.1,-55.1],[25.45,-52.05],[17.1,-43.5],[16.6,-43.5],[16.6,-53.7],[7,-53.7],[7,.3]],c:!0},ix:2},nm:"r",mn:"ADBE Vector Shape - Group",hd:!1}],nm:"r",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}]},fFamily:"Plus Jakarta Sans"},{ch:"a",size:28,style:"Medium",w:54.9,data:{shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[-5.2,0],[-3,1.633],[-1.4,2.667],[0,0],[0,0],[0,0],[0,0],[3.9,3.534],[6.4,0],[4.533,-6.4],[0,0],[-5,0],[-2.2,-2.066],[0,-3.466],[0,0],[0,0],[4.6,-3.333],[0,-5.8],[-3.267,-2.8]],o:[[3.4,0],[3,-1.633],[0,0],[0,0],[0,0],[0,0],[0,-6.2],[-3.9,-3.533],[-8.467,0],[0,0],[3,-4.133],[3.6,0],[2.2,2.067],[0,0],[0,0],[-8.067,0],[-4.6,3.334],[0,4.534],[3.266,2.8]],v:[[22,1.7],[31.6,-.75],[38.2,-7.2],[38.8,-7.2],[38.8,.3],[48.4,.3],[48.4,-35.2],[42.55,-49.8],[27.1,-55.1],[7.6,-45.5],[14.8,-40.4],[26.8,-46.6],[35.5,-43.5],[38.8,-35.2],[38.8,-32.2],[30.3,-32.2],[11.3,-27.2],[4.4,-13.5],[9.3,-2.5]],c:!0},ix:2},nm:"a",mn:"ADBE Vector Shape - Group",hd:!1},{ind:1,ty:"sh",ix:2,ks:{a:0,k:{i:[[2.133,0],[1.833,1.3],[0,2.2],[-3.034,1.634],[-5.934,0],[0,0],[0,0],[1.533,-1.966],[2.3,-.933]],o:[[-2.934,0],[-1.834,-1.3],[0,-3.133],[3.033,-1.633],[0,0],[0,0],[0,2.867],[-1.534,1.967],[-2.3,.934]],v:[[24.1,-6.9],[16.95,-8.85],[14.2,-14.1],[18.75,-21.25],[32.2,-23.7],[38.8,-23.7],[38.8,-19.9],[36.5,-12.65],[30.75,-8.3]],c:!0},ix:2},nm:"a",mn:"ADBE Vector Shape - Group",hd:!1}],nm:"a",np:5,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}]},fFamily:"Plus Jakarta Sans"}
1,{ch:"g",size:28,style:"Medium",w:60.8,data:{shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[-5.334,0],[-4.3,4.466],[0,8.466],[0,0],[0,0],[0,0],[0,0],[2.833,1.567],[3.2,0],[3.5,-2.266],[1.966,-4.1],[0,-5.333],[-2,-4.3],[-3.5,-2.4],[-4.4,0],[-2.734,1.534],[-1.8,2.867],[0,0],[0,0],[2.666,-2.8],[4.6,0],[2.666,1.366],[1.733,2.666],[0,0],[-3.834,-2.034]],o:[[7.733,0],[4.3,-4.467],[0,0],[0,0],[0,0],[0,0],[-1.934,-2.8],[-2.834,-1.566],[-4.4,0],[-3.5,2.267],[-1.967,4.1],[0,5.534],[2,4.3],[3.5,2.4],[3.466,0],[2.733,-1.533],[0,0],[0,0],[0,5.666],[-2.667,2.8],[-3.2,0],[-2.667,-1.367],[0,0],[2.333,3.6],[3.833,2.033]],v:[[29.3,22.8],[47.35,16.1],[53.8,-3.3],[53.8,-53.7],[44.2,-53.7],[44.2,-46.2],[43.6,-46.2],[36.45,-52.75],[27.4,-55.1],[15.55,-51.7],[7.35,-42.15],[4.4,-28],[7.4,-13.25],[15.65,-3.2],[27.5,.4],[36.8,-1.9],[43.6,-8.5],[44.2,-8.5],[44.2,-2.9],[40.2,9.8],[29.3,14],[20.5,11.95],[13.9,5.9],[6.3,11.3],[15.55,19.75]],c:!0},ix:2},nm:"g",mn:"ADBE Vector Shape - Group",hd:!1},{ind:1,ty:"sh",ix:2,ks:{a:0,k:{i:[[4.4,0],[2.933,3.367],[0,5.534],[-1.3,2.767],[-2.334,1.534],[-2.934,0],[-2.8,-3.366],[0,-5.533],[2.7,-3.333]],o:[[-4.6,0],[-2.934,-3.366],[0,-3.666],[1.3,-2.766],[2.333,-1.533],[4.466,0],[2.8,3.367],[0,5.6],[-2.7,3.334]],v:[[29.9,-9],[18.6,-14.05],[14.2,-27.4],[16.15,-37.05],[21.6,-43.5],[29.5,-45.8],[40.4,-40.75],[44.6,-27.4],[40.55,-14]],c:!0},ix:2},nm:"g",mn:"ADBE Vector Shape - Group",hd:!1}],nm:"g",np:5,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}]},fFamily:"Plus Jakarta Sans"}]},vn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M2%202V14M14%208H4.66667M4.66667%208L9.33333%2012.6667M4.66667%208L9.33333%203.33333'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",mn={class:"library-top-left"},gn={key:0,class:"library-top-left-title"},hn={class:"library-top-right"},fn={class:"library-filter-popover"},yn={key:1,class:"library-top-expand-wrapper"},kn={key:1,class:"library-search-input"},bn=Te({__name:"LibraryTop",emits:["expand-library"],setup(e,{emit:t}){const k=t,b=ut(),w=a(!1),A=a(!0),C=a(""),_=a(null),T=a(!1),x=a(["liked","uploaded","published"]),D=n("libraryWidth",a(320)),I=n("COLLAPSED_WIDTH",96);let S=null;const M=[{label:"Liked",value:"liked"},{label:"Uploaded",value:"uploaded"},{label:"Published",value:"published"}],E=l(()=>x.value.length===M.length),P=l(()=>x.value.length>0&&x.value.length<M.length),L=l(()=>E.value?0:x.value.length),R=l(()=>D.value>=160);i(D,e=>{const t=e>I;A.value!==t&&(A.value=t)},{immediate:!0}),i(C,e=>{S&&clearTimeout(S),S=setTimeout(()=>{b.librarySearch(e)},300)});const B=()=>{w.value=!0},j=()=>{S&&(clearTimeout(S),S=null),w.value=!1,C.value="",b.librarySearch("")},N=e=>{A.value=e,k("expand-library",e)},O=()=>{T.value=!0},V=()=>{T.value=!1};i(x,()=>{const e=E.value?["all"]:x.value;b.libraryFilter(e)});const F=()=>{x.value=E.value?[]:M.map(e=>e.value)};return(e,t)=>{const a=la,n=ia;return r(),o(d,null,[s("div",{class:"library-top",style:y({justifyContent:A.value?"space-between":"center"})},[w.value?c("",!0):(r(),o(d,{key:0},[A.value?(r(),o(d,{key:0},[s("div",mn,[s("img",{class:"pointer",src:vn,alt:"align-left",onClick:t[0]||(t[0]=()=>N(!1))}),R.value?(r(),o("div",gn," Library ")):c("",!0)]),s("div",hn,[u(da,{content:"Search",placement:"top"},{default:p(()=>[u(v(xe),{name:"biz-search",onClick:B})]),_:1}),u(a,{ref_key:"filterPopoverRef",ref:_,"popper-class":"library-filter-popover-box",placement:"bottom-end",width:"200","show-arrow":!1,teleported:!1,trigger:"click",onShow:O,onHide:V},{reference:p(()=>[s("div",{class:f(["library-filter-icon",{"library-filter-icon--highlight":T.value||L.value>0}])},[u(da,{content:"Filter",placement:"top"},{default:p(()=>[u(v(xe),{name:"biz-filter"})]),_:1})],2)]),default:p(()=>[s("div",fn,[u(v(De),{"model-value":E.value,indeterminate:P.value,onChange:F},{default:p(()=>[...t[4]||(t[4]=[m(" All ",-1)])]),_:1},8,["model-value","indeterminate"]),u(v(Ie),{modelValue:x.value,"onUpdate:modelValue":t[1]||(t[1]=e=>x.value=e),name:"library-filter",direction:"vertical"},{default:p(()=>[(r(),o(d,null,g(M,e=>
1u(v(De),{key:e.value,value:e.value},{default:p(()=>[m(h(e.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])])]),_:1},512)])],64)):(r(),o("div",yn,[s("img",{class:"pointer",src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M14%202V14M2%208H11.3333M11.3333%208L6.66667%2012.6667M11.3333%208L6.66667%203.33333'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"align-right",onClick:t[2]||(t[2]=()=>N(!0))})]))],64)),w.value?(r(),o("div",kn,[s("img",{class:"pointer library-search-input-icon",src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%2014L11.1%2011.1M12.6667%207.33333C12.6667%2010.2789%2010.2789%2012.6667%207.33333%2012.6667C4.38781%2012.6667%202%2010.2789%202%207.33333C2%204.38781%204.38781%202%207.33333%202C10.2789%202%2012.6667%204.38781%2012.6667%207.33333Z'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"search",onClick:B}),u(n,{modelValue:C.value,"onUpdate:modelValue":t[3]||(t[3]=e=>C.value=e),class:"library-search-input-input",placeholder:"Search"},null,8,["modelValue"]),s("img",{class:"pointer library-search-close-icon",src:ca,alt:"close",onClick:j})])):c("",!0)],4),t[5]||(t[5]=s("div",{class:"line"},null,-1))],64)}}},[["__scopeId","data-v-6b3b1458"]]),wn=k("useTrackStore",()=>{const e=rt(),t=a(new Map),n=a(null),i=l(()=>e.state.tracks.length>=99),o=l(()=>e.state.tracks.some(e=>!0===e.solo)),r=()=>e.state.tracks.every(e=>!e.clips||0===e.clips.length),s=t=>{r()&&null===e.state.timing.baseBpm&&ct(()=>{pt.setBpm(t),pt.setBaseBpm(t)})},c=(e={})=>{const{id:t,name:a,color:n,clips:l=[],clipCreationIntents:i=[],instrument:r={type:"Song"}}=e,s=n||te(),c=l.map(e=>({...e,color:s})),d=i.map(e=>({...e,color:s}));return{...ne,id:t||ae(),name:a||"New Track",color:s,mute:o.value,...c.length>0&&{clips:c},...d.length>0&&{clipCreationIntents:d},instrument:r||{type:"Song"}}},d=(e,a,n)=>{t.value.set(e,{file:a,duration:n,status:"pending",progress:0,error:null,abortCallback:null})},u=(e,a)=>{const n=t.value.get(e);n&&Object.assign(n,a)},p=e=>{t.value.delete(e)},v=e=>{var t;const a=["audio/x-wav","video/quicktime","video/mp4","audio/wav","audio/x-m4a","audio/flac","audio/mpeg"],n=(null==(t=e.type)?void 0:t.toLowerCase())||"";return n.startsWith("audio")?a.includes(n)?"audio":"unknown":n.startsWith("video")&&a.includes(n)?"video":"unknown"},m=async e=>new Promise(async(t,a)=>{if(!e)return void a("no file");const n=v(e);if("unknown"===n)return Se.info({position:"top",content:"Please select an audio file (MP3, WAV, FLAC, M4A, MP4, or MOV)"}),void a("not audio");if(e.size>104857600)return Se.info({position:"top",content:"File size exceeds 100MB limit"}),void a("max file size");let l=0;try{l=await ma.getMediaFileDuration(e)}catch{}t({file:e,fileType:n,duration:l})}),g=async(e,t)=>new Promise(async(a,n)=>{try{if(_a.isMP3ByMimeType(e.type)||_a.isMP3ByExtension(e.name)){const t=await ma.getMediaFileDuration(e);if(t>0)return void a({file:e,duration:t})}try{const l=await Me.transFileToMp3(e);let i=0;l&&(i=await ma.getMediaFileDuration(l.file)),i>0?a({file:l.file,duration:i}):(Se.info({position:"top",content:"video"===t?"Failed to convert video file":"Failed to process audio file"}),n("conversion failed"))}catch(l){Se.info({position:"top",content:"video"===t?"Failed to process video file":"Failed to process audio file"}),n("conversion failed")}}catch(l){Se.info({position:"top",content:"Failed to process file"}),n("processing failed")}}),h=async(e,a,n,l,i,o=!1)=>{d(e,a,n);try{u(e,{status:"processing"});let i=a;if(!o)try{await _a.getDecodeDataByFile(a)}catch{i=(await Me.transFileToMp3(a)).file}u(e,{status:"uploading"});const r=t.value.get(e);if("cancelled"===(null==r?void 0:r.status))throw new Error("上传已取消");const s=await Ee.uploadFileToObjectStorage(i,a=>{(null==a?void 0:a.abort)&&"function"==typeof a.abort&&u(e,{abortCallback:a.abort});const n=t.value.get(e);if("cancelled"===(null==n?void 0:n.status))return void((null==a?void 0:a.abort)&&"function"==typeof a.abort&&a.abort());const l=void 0!==(null==a?void 0:a.progress)?a.progress:(null==a?void 0:a.loaded)&&(null==a?void 0:a.total)?a.loaded/a.total*100:0;u(e,{progress:l})});u(e,{status:"completed",progress:100,pathKey:s.pathKey}),l&&"function"==typeof l&&l({pathKey:s.pathKey,duration:n,file:i}),setTimeout(()=>{p(e)},2e3)}catch(r){const a=t.value.get(e),n="cancelled"===(null==a?void 0:a.status);throw u(e,{status:n?"cancelled":"failed"}),i&&"function"==typeof i&&i({cancelled:n}),p(e),r}},f=async(e,t,a,n,l,i=!1)=>{await h(e,t,a,n,l,i)},y=(e,t)=>{var a,n,l;const i=null==(l=null==(n=(w()||(null==(a=null==window?void 0:window.$getVueCurrentInstance)?void 0:a.call(window))).appContext)?void 0:n.config)?void 0:l.globalProperties;
1null==i||i.logCustomEvent(e,{...t})},k=e=>Math.round(1e3*(e||0)),A=async e=>{const t=b(),{$$t:a}=(null==t?void 0:t.$i18n)??{},n=await le(e);if(200===(null==n?void 0:n.code)&&(null==n?void 0:n.data))return y("studio_track_report_audio_result",{result:1}),n.data;throw 6388==(null==n?void 0:n.code)?(y("studio_track_report_audio_result",{result:2}),Se.error({position:"top",content:a("create.copyright_protected_content")}),new Error(n.msg||"Upload failed")):6307==(null==n?void 0:n.code)?(Se.error({position:"top",content:a("create.audio_illegal_content")}),y("studio_track_report_audio_result",{result:3}),new Error(n.msg||"Upload failed")):(Se.error({position:"top",content:a("create.upload_failed")}),y("studio_track_report_audio_result",{result:3}),new Error(n.msg||"Upload failed"))};return{MAX_TRACKS:99,uploadTasks:t,isMaxTracksReached:i,hasSoloTrack:o,isRecordSelectTrackId:n,createNewTrackData:c,addTrack:(t={},a=!1,n=!1)=>{if(i.value)return null;const l=c(t),o=n?null:e.state.selection;return lt.add({track:l,selection:o},{skipHistory:a}),l},checkMediaType:v,validateFile:m,processFileConversion:g,validateAndProcessFile:async e=>{const t=await m(e);return await g(t.file,t.fileType)},addUploadTask:d,updateUploadTask:u,removeUploadTask:p,getUploadTask:e=>t.value.get(e)||null,processUpload:async(e,t,a,n,l)=>{await h(e,t,a,t=>{n&&n({...t,trackId:e})},t=>{l&&l({...t,trackId:e})})},processUploadByTempKey:f,reportAudioResult:A,setIsRecordSelectTrackId:e=>{n.value=e},secondsToMs:k,processFileAndUpload:async t=>{var a;const{file:n,tempSrcPathKey:l,initialDuration:i=0,trackTimeMs:o,trackId:c,clipCreationIntentId:d,clip:u,addToLibrary:p=!1,onError:v,closeMsg:h}=t,y=ut();try{const t=await m(n),{file:i,fileType:o}=t,d=await g(i,o),{file:w,duration:C}=d;try{null==(a=nt.MainManagerDispatcher)||a.addTemporaryformDataByFile({tempSrcPathKey:l,file:w})}catch(b){}await f(l,w,C,async({pathKey:t})=>{var a,n,o,d,v,m;if(vt(l,t),c&&u)try{const d=await(async e=>{var t,a,n,l,i,o;const{pathKey:r,tempSrcPathKey:s,title:c,duration:d,returnResult:u=!1,addToLibrary:p=!1}=e,v=await A({title:c,duration_milliseconds:k(d),oss_key:r}),{meta:m,feed:g}=v||{};p&&(null==(t=null==g?void 0:g.songs)?void 0:t[0])&&ut().addItemToTop(Object.assign({},g.songs[0],{mode:17}));if(null==(l=nt.MainManagerDispatcher)||l.setWaveformDataAfterUpload({tempSrcPathKey:s,waveformData:null==m?void 0:m.waveforms,clipData:{srcPathKey:r,songId:null==(n=null==(a=null==g?void 0:g.songs)?void 0:a[0])?void 0:n.song_id,bpm:null==m?void 0:m.bpm,firstDownbeat:m.first_downbeat}}),u)return{bpm:(null==m?void 0:m.bpm)||0,songId:null==(o=null==(i=null==g?void 0:g.songs)?void 0:i[0])?void 0:o.song_id,waveform_data:null==m?void 0:m.waveforms,firstDownbeat:m.first_downbeat}})({pathKey:t,tempSrcPathKey:l,title:i.name,duration:C,returnResult:!0,addToLibrary:p}),v=(null==d?void 0:d.bpm)||u.bpm||e.state.timing.baseBpm;s(v),y.updateItemInfo(u.songId,{bpm:v});let m=null;r()?(m=null==(a=nt.MainManagerDispatcher)?void 0:a.updateTrackData(c,{clips:[{...u,startTime:0-(d.firstDownbeat??0),srcPathKey:t,songId:d.songId,bpm:d.bpm||e.state.timing.baseBpm,clipId:u.clipId,firstDownbeat:d.firstDownbeat}]}),m&&m.track&&lt.batchUpdate({tracks:[m.track.getTrackStateData()],index:m.index})):(m=null==(n=nt.MainManagerDispatcher)?void 0:n.updateCreationIntentDataByOpType({updateClipDataType:mt.UPDATE_CREATION_INTENT_DATA_TO_TRACK,data:{tempSrcPathKey:l,clipDatas:[{srcPathKey:t,bpm:d.bpm||e.state.timing.baseBpm,clipId:u.clipId,songId:d.songId}]}}),m&&m.tracks&&lt.batchUpdate({tracks:null==(o=m.tracks)?void 0:o.map(e=>e.getTrackStateData()),index:m.mainTrackIndexs})),null==h||h.clear()}catch(g){null==h||h.clear(),null==(d=nt.MainManagerDispatcher)||d.deleteTemporaryformData(l);const e=null==(v=nt.MainManagerDispatcher)?void 0:v.updateCreationIntentDataByOpType({updateClipDataType:mt.DELETE_UPLOAD_CLIP_INTENT_DATA,data:{trackId:c,clipData:u,tempSrcPathKey:l}});e&&e.tracks&&lt.batchUpdate({tracks:null==(m=e.tracks)?void 0:m.map(e=>e.getTrackStateData())})}},e=>{var t,a,n;null==h||h.clear(),null==(t=nt.MainManagerDispatcher)||t.deleteTemporaryformData({tempSrcPathKey:l});const i=null==(a=nt.MainManagerDispatcher)?void 0:a.updateCreationIntentDataByOpType({updateClipDataType:mt.DELET
1E_UPLOAD_CLIP_INTENT_DATA,data:{trackId:c,clipData:u,tempSrcPathKey:l}});i&&i.tracks&&lt.batchUpdate({tracks:null==(n=i.tracks)?void 0:n.map(e=>e.getTrackStateData())}),v&&v({...e,tempSrcPathKey:l})},!0)}catch(w){throw null==h||h.clear(),gt.removeBySrcPathKey({srcPathKey:l},{skipHistory:!0}),v&&v({cancelled:!1,tempSrcPathKey:l}),w}},isFirstAudioInProject:r,setBaseBpmIfNeeded:s}}),An={__name:"index",props:{visible:{type:Boolean,default:!0}},emits:["update:visible","done"],setup(e,{emit:t}){const n=A(),l=rt(),o=wn(),c=ot(),d=a(null),u=e,v=t,g=C({visible:u.visible}),h=()=>{g.visible=!1},f=()=>{h()},y=()=>{n.push({name:"create"}),h()},k=()=>{var e;o.isMaxTracksReached||null==(e=d.value)||e.click()},b=async e=>{var t;const a=null==(t=e.target.files)?void 0:t[0];if(a){e.target.value="";try{const e=await o.validateFile(a),{file:t,duration:n}=e,i=t.name.replace(/\.[^/.]+$/,"")||`轨道 ${l.state.tracks.length+1}`,r=ae(),s=`uploading_${ae()}`,c=1e3*(n||0),d={...ie,clipId:r,name:t.name,srcPathKey:s,srcDuration:c,startTime:0,srcClipStartTime:0,srcClipEndTime:c},u=o.addTrack({name:i,clipCreationIntents:[d]});if(!u)return;h(),await o.processFileAndUpload({file:t,tempSrcPathKey:s,initialDuration:n,trackTimeMs:0,trackId:u.id,clipCreationIntentId:r,addToLibrary:!0,clip:d})}catch(n){}}};return _(()=>{}),i(()=>u.visible,e=>{g.visible=e},{immediate:!0}),i(()=>g.visible,e=>{c.isNewbieGuideOpen=e,v("update:visible",e)}),(e,t)=>(r(),T(Pe,{width:"720px",height:"394px",visible:g.visible,"is-outer-head":!0,"custom-class":"newbie-guide-dialog","dialog-style":{background:"rgba(0, 0, 0, 0.3)"},"dialog-container-style":{background:"rgba(0, 0, 0, 0.3)"},"dialog-content-style":{backgroundImage:"",backgroundColor:"rgba(255, 255, 255, 0.12)",backdropFilter:"blur(80px)"},"hide-close-btn":!0,onClose:f},{default:p(()=>[s("div",{class:"newbie-guide-dialog-content flex-row"},[t[6]||(t[6]=s("div",{class:"mainTitle"},"Create or upload one to get started",-1)),t[7]||(t[7]=s("div",{class:"subTitle"},"An audio track is required to use Studio",-1)),s("div",{class:"selectBox"},[s("div",{class:"selectBoxItem logo"},[t[1]||(t[1]=s("div",{class:"icon"},null,-1)),t[2]||(t[2]=s("div",{class:"text"},"Create Mureka-generated songs",-1)),s("div",{class:"btn",onClick:y},[...t[0]||(t[0]=[s("div",{class:"ico"},null,-1),m(" Create ",-1)])])]),s("div",{class:"selectBoxItem upload"},[t[4]||(t[4]=s("div",{class:"icon"},null,-1)),t[5]||(t[5]=s("div",{class:"text"},"Upload audio",-1)),s("div",{class:"btn",onClick:k},[...t[3]||(t[3]=[s("div",{class:"ico"},null,-1),m(" Upload ",-1)])])])])]),s("input",{ref_key:"fileInputRef",ref:d,type:"file",accept:"audio/x-wav,video/quicktime,video/mp4,audio/wav,audio/x-m4a,audio/flac,audio/mpeg,.mp3,.wav,.m4a,.mp4,.mov,.MP4,.flac",style:{display:"none"},onChange:b},null,544)]),_:1},8,["visible"]))}},Cn={class:"download-submenu"},_n={class:"submenu-item-main"},Tn={class:"submenu-item-main"},xn={class:"submenu-item-main"},Dn={class:"submenu-item-main"},In={class:"submenu-item-main"},Sn=Te({__name:"studio-download-btns",props:{clipData:{type:Object,required:!0,default:()=>({})}},emits:["downloadVideo","downloadWAVAndStem","downloadWav","downloadCopyright","downloadMp3","subPopoverShow","subPopoverHide"],setup(e,{emit:t}){var n;const i=Le(),d=Re(),u=l(()=>{var e,t,a,n;return!(null==(t=null==(e=d.userInfo)?void 0:e.user)?void 0:t.is_vip)||"basic"==(null==(n=null==(a=d.userInfo)?void 0:a.user)?void 0:n.vip_level_name)}),m=null==(n=w())?void 0:n.appContext.config.globalProperties,{$$t:g}=m.$i18n??{},f=a(null),y=e,k=t,b=l(()=>17!==y.clipData.mode&&!y.clipData.is_generated_from_uploaded_file&&![2,3,5,6,8,9].includes(y.clipData.generation_method)),A=l(()=>17!==y.clipData.mode&&!y.clipData.is_generated_from_uploaded_file),C=async(e,t)=>{await d.checkLoginStatus()&&i.handleSubscribe({membership_source1:"membership_feature",membership_source2:t})},_=()=>{u.value?C(0,"download_video"):(f.value&&f.value.hide(),k("downloadVideo",y.clipData))},D=()=>{u.value?C(0,"split_stem"):(f.value&&f.value.hide(),k("downloadWAVAndStem",y.clipData))},I=()=>{u.value?C(0,"download_wav"):(f.value&&f.value.hide(),k("downloadWav",y.clipData))},S=()=>{var e,t;
1(null==(t=null==(e=d.userInfo)?void 0:e.user)?void 0:t.is_vip)?(f.value&&f.value.hide(),k("downloadCopyright",y.clipData)):C(0,"download_license")},M=()=>{var e,t;(null==(t=null==(e=d.userInfo)?void 0:e.user)?void 0:t.is_vip)?(f.value&&f.value.hide(),k("downloadMp3",y.clipData)):C(0,"download_mp3")},E=()=>{k("subPopoverShow")},P=()=>{k("subPopoverHide")};return(e,t)=>{const a=la;return r(),T(a,{ref_key:"downloadPopoverRef",ref:f,placement:"right-start",trigger:"hover","show-arrow":!1,teleported:!0,width:330,"popper-class":"clip-download-submenu-popover",offset:10,onShow:E,onHide:P},{reference:p(()=>[s("div",{class:"menu-item-download",onClick:t[0]||(t[0]=x(()=>{},["stop"]))},[t[6]||(t[6]=s("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%3e%3cpath%20d='M12.25%208.75V9.45C12.25%2010.4301%2012.25%2010.9201%2012.0593%2011.2945C11.8915%2011.6238%2011.6238%2011.8915%2011.2945%2012.0593C10.9201%2012.25%2010.4301%2012.25%209.45%2012.25H4.55C3.56991%2012.25%203.07986%2012.25%202.70552%2012.0593C2.37623%2011.8915%202.10852%2011.6238%201.94074%2011.2945C1.75%2010.9201%201.75%2010.4301%201.75%209.45V8.75M9.91667%205.83333L7%208.75M7%208.75L4.08333%205.83333M7%208.75V1.75'%20stroke='white'%20stroke-width='1.16667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e"},null,-1)),s("span",null,h(v(g)("create.download")),1)])]),default:p(()=>{var e,a,n,l,i,p,m,f,y,k,w,E,P,L,R,B,j;return[s("div",Cn,[b.value?(r(),o("div",{key:0,class:"submenu-item",onClick:_},[s("div",_n,[t[7]||(t[7]=s("img",{class:"submenu-item-icon",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK9SURBVHgB7ZvtcdswDIahXgfwCNqg6QbeoN2g2qDZwM4ImYDOBL1OoG6QdgJ5A7sToOCRP1RHIAnWkmEVzx1OZ1sQyNckqA8IwDAMwzAMwzAMw1iapnRHRNzQpiP7QPZAthnZ3JyjHeP2O9mPpmmOcGtImJasR504shZuBQX/SnZC3fj2PcLSUNAd3hc7WAoMI+ceufpIaibEaWnzCssk32vjE/jHWZM3hsTH4ef7nuwzhuS9iIg+Toy3JTtkRlEPcxEbwTHgLVeMEbGdQ6Kt8/xxdOAuEbQFRUSRuBU2m4tiX/sotN92JUG/MQEdKATDdBe3F/k0ku4n8ieEW1AIhlw4xWvCx2GafSrgwDi1oBDkc+bA7O8wT58KyM1plUs+htVtitPEvg7LOKUCTgKKKWmzQJx0f8UOCsi1WSrOZX/fwYrBsCp18A+sVqACcV6g4qDZIacNrOOQ8h0ff9VTjOGFLmY7qKFEUW1gxcjJ+YqDgWKwUpyUrzgYKAYrxUn5ioOBYrBSnJSvOBgoplaclO94n7WvYtf9c0sU1QbmcVJfcTBQDJbhJL7iYKAYLMeV+oqDgWJQhivxFQcDxaAcl/MdH/9/vBbrUPAQ4j2sF3874wvzW1c1MUqGnDZSbcb8U9hsf1c9xeJtDfmNMY4SRbVR0mbpSEoFW/Njn1KR/vK9nGJnpi1aS2G4dr3ph2C6HccfSgV6AJ20zPfHqS8LRXoef7gU6BfjpFUgbhn/zTlEkZ6Zn/396gPn6+fpIzcvUWf5C0dX4F9V/rJJBB20iIT5AqoW5gLzNdEOQyncLUrwfLnLDtOlyVetZbIizgxvzqTjwZ/gPnla7PUE5MvbtLKHpcGwqtmrCBmRfHKsuipegB5nXlklr0O1tNmSfYKQwFtY/nUobz8hnNAeKN+cwTAMwzAMwzAMw1gdfwB8LgbW6o710gAAAABJRU5ErkJggg=="},null,-1)),s("span",null,h(v(g)("create.download_video")),1),u.value?(r(),T(Ma,{key:0,type:"pro",text:v(g)("create.pro_plan")},null,8,["text"])):c("",!0)]),u.value?(r(),o("div",{key:0,class:"vip_plan-mask",onClick:t[1]||(t[1]=x(e=>{C(0,"download_video")},["stop"]))})):c("",!0)])):c("",!0),s("div",{class:"submenu-item",onClick:D},[s("div",Tn,[t[8]||(t[8]=s("img",{class:"submenu-item-icon",src:Q},null,-1)),s("span",null,h(v(ga).editor.trackStem?v(g)("editor.get_stems_midi_session"):v(g)("create.download_wav_mp3")),1),u.value?(r(),T(Ma,{key:0,type:"pro",text:v(g)("create.pro_plan")},null,8,["text"])):c("",!0)]),u.value?(r(),o("div",{key:0,class:"vip_plan-mask",onClick:t[2]||(t[2]=x(e=>{C(0,"split_stem")},["stop"]))})):c("",!0)]),s("div",{class:"submenu-item",onClick:I},[s("div",xn,[t[9]||(t[9]=s("img",{class:"submenu-item-icon",src:q},null,-1)),s("span",null,h(v(g)("create.download_wav")),1),u.value?(r(),T(Ma,{key:0,type:"pro",text:v(g)("create.pro_plan")},null,8,["text"])):c("",!0)]),u.value?(r(),o("div",{key:0,class:"vip_plan-mask",onClick:t[3]||(t[3]=x(e=>{C(0,"download_wav")},["stop"]))})):c("",!0)]),A.value?(r(),o("div",{key:1,class:"submenu-item",onClick:S},[s("div",Dn,[t[10]||(t[10]=s("img",{class:"submenu-item-icon",src:Z},null,-1)),s("span",null,h(v(g)("create.download_copyright")),1),!(null==(a=null==(e=v(d).userInfo)?void 0:e.user)?void 0:a.is_vip)&&(null==(n=v(d).userInfo)?void 0:n.web119_ab_only_pro)?(r(),T(Ma,{key:0,t
1ype:"pro",text:v(g)("create.pro_plan")},null,8,["text"])):c("",!0),(null==(i=null==(l=v(d).userInfo)?void 0:l.user)?void 0:i.is_vip)||(null==(p=v(d).userInfo)?void 0:p.web119_ab_only_pro)?c("",!0):(r(),T(Ma,{key:1,type:"basic",text:v(g)("create.basic_plan")},null,8,["text"]))]),(null==(f=null==(m=v(d).userInfo)?void 0:m.user)?void 0:f.is_vip)?c("",!0):(r(),o("div",{key:0,class:"vip_plan-mask",onClick:t[4]||(t[4]=x(e=>{C(0,"download_license")},["stop"]))}))])):c("",!0),s("div",{class:"submenu-item",onClick:M},[s("div",In,[t[11]||(t[11]=s("img",{class:"submenu-item-icon",src:J},null,-1)),s("span",null,h(v(g)("create.download_mp3")),1),!(null==(k=null==(y=v(d).userInfo)?void 0:y.user)?void 0:k.is_vip)&&(null==(w=v(d).userInfo)?void 0:w.web119_ab_only_pro)?(r(),T(Ma,{key:0,type:"pro",text:v(g)("create.pro_plan")},null,8,["text"])):c("",!0),(null==(P=null==(E=v(d).userInfo)?void 0:E.user)?void 0:P.is_vip)||(null==(L=v(d).userInfo)?void 0:L.web119_ab_only_pro)?c("",!0):(r(),T(Ma,{key:1,type:"basic",text:v(g)("create.basic_plan")},null,8,["text"]))]),(null==(j=null==(B=null==(R=v(d))?void 0:R.userInfo)?void 0:B.user)?void 0:j.is_vip)?c("",!0):(r(),o("div",{key:0,class:"vip_plan-mask",onClick:t[5]||(t[5]=x(e=>{C(0,"download_mp3")},["stop"]))}))])])]}),_:1},512)}}},[["__scopeId","data-v-5ced895f"]]),Mn={key:0,class:"clip-item-play-status"},En={class:"audio-item-cover-op-bg flex-center"},Pn={class:"playing"},Ln={class:"clip-item-info"},Rn={class:"clip-item-title"},Bn={key:0,class:"clip-item-tags"},jn={class:"clip-item-meta"},Nn={key:3,class:"clip-item-meta-tag tag-uploaded"},On={key:4,class:"clip-item-meta-tag tag-remix"},Vn={key:5,class:"clip-item-meta-tag tag-stems"},Fn={key:6,class:"clip-item-meta-tag"},Un={class:"clip-item-actions"},Hn={class:"project-clip-action"},Gn=["onClick"],Wn=["src","alt"],Kn=Te({__name:"clip-item",props:{clipData:{type:Object,default:()=>({id:"",title:"Two Weeks Notice",cover:"",genres:["experimental","country","sertanejo"],model:"V75",bpm:"62",key:"E MAJOR",mp3_url:"",duration_milliseconds:0})},isCurrentPlaying:{type:Boolean,default:!1}},emits:["play","changeFavorite","editSongTitle","delete","downloadVideo","downloadWAVAndStem","downloadWav","downloadCopyright","downloadMp3"],setup(e,{emit:t}){var k;D(e=>({"2e16542e":j.value.top+"px","7a879f10":j.value.left+"px"}));const b=null==(k=w())?void 0:k.appContext.config.globalProperties,{$$t:A}=(null==b?void 0:b.$i18n)??{},_=e,I=t,S=a(!1),M=a(null),E=a(null),P=a(null),L=a(!1),R=a(!1),B=a(!1),j=a({top:0,left:0}),N=a(!1),O=n("COLLAPSED_WIDTH",96),V=rt(),F=ut(),U=l(()=>{var e,t;const a=_.clipData.song_id;for(const n of V.state.tracks){if(null==(e=n.clips)?void 0:e.find(e=>e.songId==a))return{inStudio:!0,trackColor:n.color||null};if(n.takeLanes&&Array.isArray(n.takeLanes))for(const e of n.takeLanes){if(null==(t=e.clips)?void 0:t.find(e=>e.songId==a))return{inStudio:!0,trackColor:n.color||null}}}return{inStudio:!1,trackColor:null}}),H=l(()=>Be(_.clipData)),G=()=>{if(!z.value||!M.value)return;N.value=!0;const e=M.value.getBoundingClientRect();j.value={top:e.top,left:e.left}},W=()=>{N.value=!1},K=e=>{var t,a,n,l,i;if(!z.value||!N.value)return;e.preventDefault();let o=(null==(t=M.value)?void 0:t.closest(".mescroll"))||(null==(a=M.value)?void 0:a.closest(".mescroll_feed_list"))||(null==(n=M.value)?void 0:n.closest(".scroll-load-box"))||(null==(l=M.value)?void 0:l.closest(".library-content"))||(null==(i=M.value)?void 0:i.closest(".clip-list"));o&&(o.scrollTop+=e.deltaY)},Y=n("libraryWidth",a(320)),z=a(!1);i(Y,e=>{z.value=e<=O},{immediate:!0});const X=l(()=>{const e=[];return[1,3,4].includes(_.clipData.publish_state)||e.push({label:"Edit song info",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHtSURBVHgB7dnhbYMwEAXgSydIN2CEjJCNkg1CJ4g6QdpJWKEb0A2SDV5t2VL5wZ0xoZUx75OsSARbsrHB8ESIiIiIiIiIZgCwd+XiSudKj1/3eOzsSiNb4zsdB2Cq22YGynX0FGdILl/nLDWLy+lZF6lRnDlLqWsmIdxz5iwrjW+rkVog3GStzrauHAfnH1z5SAxSJzVAmD2a3poJsW5v1N/L2iHsZTTNhPrW8mxlDoSnxZJr/i/cMvrTKm3kLzNX6Yp1OGT06ai00Wt1dkZjd/dT/NrcOTnn+9HIaedFyGQN0LusAAaP9QnnasvxodVRB8jNuFbCIKmVC3HMOPekHP+StYP+BJq0G4a9j1r/KwfCNx9Nj+c2io3UAOlvPzcM7jMIj/UL7L3c5H1U8cCX1TTYrxy56vxwBv2GnaOVmiHMJH5ytSDck1Lfe4Y6bDjdOMcBGM6qPh7zS/L/3ivBHGocmEPpwBxKB+ZQOjCH0oFbexuYQ+nAHMqGEnOokkDf7yyRQ5XCX8CrzAH96i+RQ5Wm1fpg5WJZ+VFuO4V5uG69jv3BXCzBGqDvsYNYJocqzaf2R/YAyTI5VCl85vfmllf+Dh/MoWxgDpUG5lA28GU1Dcyh0sAcKg3ModLAHGoalJZDERERERERUVV+AMOLeKq2YyWLAAAAAElFTkSuQmCC",action:"Edit"}),e.push({label:"Download",icon:Ia,action:"Download"},{label:"Delete",icon:Da,action:"Delete"}),e}),Q=C({mp3_url:je(_.clipData.mp3_url||""),duration_milliseconds:(_.clipData.duration_milliseconds||0)/1e3,isPlaying:!1,isLoading:!1,progress:0}),q=e=>{Q.isPlaying=e,e&&!_.isCurrentPlaying&&(I("play",_.clipData),_.clipData.song_id&&!_.clip
1Data.is_played&&(Oe.doReportPlayedState({song_id:_.clipData.song_id}).catch(e=>{}),F.updateItemInfo(_.clipData.song_id,{is_played:!0})))},Z=e=>{Q.isLoading=e},J=e=>{Q.progress=e},$=()=>{},ee=()=>{var e;null==(e=E.value)||e.changeOp()},te=()=>{const e=1==_.clipData.is_liked;I("changeFavorite",_.clipData,e)},ae=e=>{e.stopPropagation()},ne=e=>{Q.isPlaying&&ee(),S.value=!0;const t={id:_.clipData.id||`clip-${Date.now()}`,..._.clipData};e.dataTransfer.effectAllowed="all";const a=JSON.stringify(t);e.dataTransfer.setData("text/plain",a),e.dataTransfer.setData("application/json",a),e.currentTarget.style.opacity="0.5",window.__dragStudioPresetSongData=a},le=e=>{S.value=!1,e.currentTarget.style.opacity="1",e.dataTransfer.clearData(),window.__dragStudioPresetSongData=null},ie=()=>{L.value=R.value||B.value},oe=()=>{R.value=!0,ie()},re=()=>{R.value=!1,ie()},se=()=>{B.value=!0,ie()},ce=()=>{B.value=!1,ie()};return(t,a)=>{const n=Ta,l=la;return r(),o("div",{ref_key:"wrapperRef",ref:M,class:f(["clip-item-wrapper",{"is-current-playing":e.isCurrentPlaying,"is-menu-open":L.value,"is-collapsed":z.value}]),draggable:"true",onDragstart:ne,onDragend:le,onMouseenter:G,onMouseleave:W,onMousedownCapture:ae},[u(ua,{ref_key:"refPlayer",ref:E,class:"clip-item",url:v(je)(e.clipData.mp3_url),duration:Q.duration_milliseconds,onWheel:K,onSyncPlayState:q,onSyncLoadingState:Z,onSyncProgress:J,onCurPlayEnded:$},{default:p(()=>{var t,i,k,b,w;return[e.clipData.is_played?c("",!0):(r(),o("div",Mn)),s("div",{class:f(["audio-item-cover-op-box fn-inline pointer",{"isplay-true":Q.isPlaying,"isplay-false":!Q.isPlaying}])},[u(n,{src:e.clipData.cover?v(je)(e.clipData.cover):v(xa)},null,8,["src"]),s("div",{class:"audio-item-cover-op flex-center",onClick:x(ee,["stop"])},[s("div",En,[a[5]||(a[5]=s("i",{class:"block play"},null,-1)),s("div",Pn,[u(Sa,{"bar-config":{barWidth:"3px",barHeight:"11px",barSpacing:"2px",barColor:"#fff"},animation:Q.isPlaying},null,8,["animation"])])])])],2),s("div",Ln,[s("div",Rn,h(e.clipData.title||"Untitled"),1),e.clipData.genres?(r(),o("div",Bn,h(e.clipData.description??e.clipData.genres.join(", ")),1)):c("",!0),s("div",jn,[H.value?(r(),o("div",{key:0,class:"clip-item-meta-tag version",style:y({color:null==(t=H.value)?void 0:t.font_color,borderColor:null==(i=H.value)?void 0:i.border_color})},h(e.clipData.is_preview?(null==(k=H.value)?void 0:k.display_name)+v(A)("create.preview"):null==(b=H.value)?void 0:b.display_name),5)):c("",!0),U.value.inStudio?(r(),o("div",{key:1,class:"clip-item-meta-tag-instudio",style:y({backgroundColor:U.value.trackColor})},[...a[6]||(a[6]=[s("div",{class:"clip-item-meta-tag-instudio-icon"},null,-1)])],4)):c("",!0),21==e.clipData.mode?(r(),T(v(Ne),{key:2,preset:"studio"})):c("",!0),17==e.clipData.mode?(r(),o("div",Nn,[...a[7]||(a[7]=[s("span",null,"Uploaded",-1)])])):c("",!0),(null==(w=e.clipData.control_types)?void 0:w.includes(11))?(r(),o("div",On,[...a[8]||(a[8]=[s("span",null,"Remix",-1)])])):c("",!0),e.clipData.stems?(r(),o("div",Vn," Stems ")):c("",!0),e.clipData.bpm?(r(),o("div",Fn,h(e.clipData.bpm)+" BPM ",1)):c("",!0)])]),s("div",Un,[s("div",{class:"clip-item-like",onClick:x(te,["stop"])},[u(v(xe),{name:1==e.clipData.is_liked?"sys-like-active":"sys-like",size:16},null,8,["name"])]),u(l,{ref_key:"exportPopoverRef",ref:P,"show-arrow":!1,teleported:!1,width:204,placement:"bottom-end","popper-class":"project-clip-action-box",trigger:"click",onShow:oe,onHide:re},{reference:p(()=>[...a[9]||(a[9]=[s("div",{class:"clip-item-more"},[s("i",{class:"block"})],-1)])]),default:p(()=>[s("div",Hn,[(r(!0),o(d,null,g(X.value,t=>(r(),o("div",{key:t.action,class:f(["project-clip-action-item",{"project-clip-action-item-Delete":"Delete"===t.action}]),onClick:e=>"Download"!==t.action&&(e=>{switch(e){case"Edit":P.value&&P.value.hide(),I("editSongTitle",_.clipData);break;case"Delete":I("delete",_.clipData)}})(t.action)},["Download"!==t.action?(r(),o(d,{key:0},[s("img",{src:t.icon,alt:t.action},null,8,Wn),m(" "+h(t.label),1)],64)):c("",!0),"Download"===t.action?(r(),T(Sn,{key:1,"clip-data":e.clipData,onDownloadVideo:a[0]||(a[0]=e=>I("downloadVideo",e)),onDownloadWAVAndStem:a[1]||(a[1]=e=>I("downloadWAVAndStem",e)),onDownloadWav:a[2]||(a[2]=e=>I("downloadWav",e)),onDownloadCopyright:a[3]||(a[3]=e=>I("downloadCopyright",e)),onDownloadMp3:a[4]||(a[4]=e=>I("downloadMp3",e)),onSubPopoverShow:se,onSubPopoverHide:ce},null,8,["clip-data"])):c("",!0)],10,Gn))),128))])]),_:1},512)])]}),_:1},8,["url","duration"])],34)}}},[["__scopeId","data-v-b8815b59"]]),Yn={class:"clip-list"},zn=Te({__name:"clip-list",props:{currentClip:{type:Object,default:null}},emits:["play-clip"],setup(e,{expose:t,emit:n}){var l;const s=null==(l=w())?void 0:l.appContext.config.globalProperties,{$$t:d}=(null==s?void 0:s.$i18n)??{},m=ut(),g=Ve(),h=Re(),f=Fe(),y=n,k=a(!1),b=a(!1),A=a(!1),x=a({size:20}),D=a(!1),S=a(null),M=C({editStemHistory:[],trackStemSongDialogVisible:!1,item:null}),E=C({networkerror:(null==d?void 0:d("common.network_error"))||"网络错误",loadfailure:(null==d?void 0:d("common.load_failure"))||"加载失败",contentviolation:(null==d?void 0:d("common.content_violation"))||"内å
1®¹è¿è§„",emptydata:(null==d?void 0:d("common.empty_data"))||"暂无数据"}),P=e=>{M.item=e,new Promise((e,t)=>{var a;let n=Se.info({position:"center",content:d("create.get_song_state_loading")});oe({song_id:null==(a=M.item)?void 0:a.song_id}).then(a=>{null==n||n.clear(),200==a.code?e(a.data):(Se.info({position:"top",content:d("create.get_song_state_failed")}),t(null==a?void 0:a.err))}).catch(e=>{null==n||n.clear(),Se.info({position:"top",content:d("create.get_song_state_failed")}),t(e)})}).then(e=>{M.editStemHistory=(null==e?void 0:e.list)||[],M.trackStemSongDialogVisible=!0}),R("list_getstem_MIDI_click",{})},L=e=>{S.value=e,D.value=!0},R=(e,t)=>{var a,n,l;const i=null==(l=null==(n=(w()||(null==(a=null==window?void 0:window.$getVueCurrentInstance)?void 0:a.call(window))).appContext)?void 0:n.config)?void 0:l.globalProperties;null==i||i.logCustomEvent(e,{...t})},B=async(e,t,a,n,l)=>{const i=n.song_id||(null==t?void 0:t.song_id)||(null==t?void 0:t.id);if(!i)return void Se.error({position:"top",content:d("create.save_failed")});let o=Se.info({position:"center",content:null==d?void 0:d("create.applying")});try{let e=null==t?void 0:t.cover;if(null==a?void 0:a.file){const t=await Ee.uploadFileToObjectStorage(a.file);e=null==t?void 0:t.pathKey}const r=await Oe.savefeedSongInfo({...n,cover:e});null==o||o.clear(),200===r.code?(Se.success({content:d("create.save_success"),position:"top"}),m.updateItemInfo(i,{title:n.title,cover:e}),D.value=!1,null==l||l(),R("studio_library_save_song_info",{result:1})):6388==(null==r?void 0:r.code)?(R("studio_library_save_song_info",{result:2}),Se.error({position:"top",content:d("create.copyright_protected_content")})):6320==r.code?(Se.error({position:"top",content:d("create.song_cover_auditing_failed")}),R("studio_library_save_song_info",{result:3})):6316==r.code?(Se.error({position:"top",content:d("create.song_title_audit_failed")}),R("studio_library_save_song_info",{result:3})):6330==r.code?(Se.error({position:"top",content:d("create.published_song_not_modify")}),R("studio_library_save_song_info",{result:3})):(Se.error({content:d("create.save_failed"),position:"top"}),R("studio_library_save_song_info",{result:3}))}catch(r){null==o||o.clear(),Se.error({content:d("create.save_failed"),position:"top"}),R("studio_library_save_song_info",{result:3})}},j=e=>{const t=e.song_id||e.id;t&&He({width:"480px",titleAlign:"start",showCloseBtn:!0,content:null==d?void 0:d("create.remove_song_card"),confirmLabel:null==d?void 0:d("create.confirm"),cancelLabel:null==d?void 0:d("create.cancel"),confirm:async e=>{e();try{200===(await Oe.feedCardDelete({song_id:t})).code?(g.removePreviewTask(t),Se.success({position:"top",content:null==d?void 0:d("create.song_has_been_deleted")}),m.removeItem(t)):Se.error({position:"top",content:null==d?void 0:d("create.remove_song_card_failed")})}catch(a){Se.error({position:"top",content:d("create.remove_song_card_failed")})}},cancel:e=>{e()}})},N=e=>{const t=e,a=e;f.doDownloadVideo(t,a,!0).then(()=>{}).catch(e=>{})},O=e=>{ga.editor.trackStem?P(e):V(e)},V=e=>{const t=e,a=e;f.doDownloadSongAllData(t,a).then(()=>{}).catch(e=>{})},F=e=>{const t=e,a=e;f.doDownloadWav(t,a).then(()=>{}).catch(e=>{})},U=e=>{const t=e,a=e;f.doDownloadCopyright(t,a).then(()=>{}).catch(e=>{})},H=e=>{const t=e,a=e;f.doDownloadMp3(t,a).then(()=>{}).catch(e=>{})},G=async(e,t)=>{if(!(await h.checkLoginStatus()))return;const a=e.song_id||e.id;if(a)try{const e=await Ge({song_id:a,state:t?2:1});200===e.code?m.updateItemLikeState(a,t?0:1):6332===e.code?Se.error({maskClosable:!0,content:d("create.like_song_has_been_deleted"),position:"top"}):Se.error({position:"top",content:d("create.save_failed")})}catch(n){Se.error({position:"top",content:d("create.save_failed")})}},W=e=>{m.isLoading?null==e||e(m.list,!1):m.refresh(e,x.value)},K=e=>{m.isLoading||m.finished?null==e||e(m.list,!0):m.loadMore(e,x.value)},Y=()=>{m.isLoading||m.doRetry(x.value)};_(()=>{m.doRetry(x.value)});const z=()=>{W()};return _(()=>{Ue.on("studio-library-refresh",z)}),I(()=>{Ue.off("studio-library-refresh",z)}),i(()=>m.isLoading,e=>{var t,a;if(e)return void(b.value=!0);if(!b.value||A.value)return;A.value=!0;const n=((null==(t=m.searchKeyword)?void 0:t.value)||"").trim(),l=((null==(a=m.filterTypes)?void 0:a.value)||[]).length>0,i=!!n||l,o=m.list||[],r=!o||0===o.length;
1m.loadError||i||!r||(k.value=!0)}),t({refresh:W,loadMore:K,retry:Y}),(t,a)=>(r(),o("div",Yn,[v(m).loadError?c("",!0):(r(),T(pa,{key:0,refreshing:v(m).refreshing,"onUpdate:refreshing":a[0]||(a[0]=e=>v(m).refreshing=e),"loading-more":v(m).loadingMore,"onUpdate:loadingMore":a[1]||(a[1]=e=>v(m).loadingMore=e),"is-loading":v(m).isLoading,"onUpdate:isLoading":a[2]||(a[2]=e=>v(m).isLoading=e),finished:v(m).finished,"onUpdate:finished":a[3]||(a[3]=e=>v(m).finished=e),datas:v(m).list,"item-id-field":"id","show-info":E,onRefresh:W,onLoadMore:K},{default:p(t=>{var a;return[u(Kn,{"clip-data":t.item,"is-current-playing":(null==(a=e.currentClip)?void 0:a.id)===t.item.id,onPlay:e=>{return a=t.item,void y("play-clip",a);var a},onChangeFavorite:G,onEditSongTitle:L,onDelete:j,onDownloadVideo:N,onDownloadWAVAndStem:O,onDownloadWav:F,onDownloadCopyright:U,onDownloadMp3:H},null,8,["clip-data","is-current-playing","onPlay"])]}),_:1},8,["refreshing","loading-more","is-loading","finished","datas","show-info"])),v(m).loadError?(r(),T(va,{key:1,onRetry:Y})):c("",!0),D.value?(r(),T(ba,{key:2,visible:D.value,"onUpdate:visible":a[4]||(a[4]=e=>D.value=e),pitem:S.value,item:S.value,onComplete:B},null,8,["visible","pitem","item"])):c("",!0),u(An,{visible:k.value,"onUpdate:visible":a[5]||(a[5]=e=>k.value=e)},null,8,["visible"]),M.trackStemSongDialogVisible?(r(),T(wa,{key:3,visible:M.trackStemSongDialogVisible,"onUpdate:visible":a[6]||(a[6]=e=>M.trackStemSongDialogVisible=e),"edit-stem-history":M.editStemHistory,"media-type":"song",item:M.item,"sourec-type":"studioLibrary"},null,8,["visible","edit-stem-history","item"])):c("",!0)]))}},[["__scopeId","data-v-8e5d6094"]]),Xn={key:0,class:"mini-player"},Qn={class:"mini-player-content"},qn={class:"mini-player-header"},Zn={class:"mini-player-cover-op-bg flex-center"},Jn={class:"playing"},$n={class:"mini-player-info"},el={class:"mini-player-title"},tl={class:"mini-player-tags"},al={key:1,class:"tag"},nl={class:"mini-player-progress-area"},ll={class:"mini-player-time"},il={class:"progress-track"},ol={class:"mini-player-time"},rl=Te({__name:"mini-player",props:{currentClip:{type:Object,default:null}},setup(e,{expose:t}){const n=e,d=ot(),m=a(null),g=a(null),k=`mini-player-${Date.now()}-${Math.random()}`,b=C({url:l(()=>{var e;return je((null==(e=n.currentClip)?void 0:e.mp3_url)||"")}),duration:l(()=>{var e;return((null==(e=n.currentClip)?void 0:e.duration_milliseconds)||0)/1e3}),isPlaying:!1,isLoading:!1,progress:0,currentTime:0}),A=a(!1);i(()=>d.currentPlayingId,e=>{var t,a,n,l,i,o,r,s,c;if(e&&e!==k&&b.isPlaying){const e=null==(a=w()||(null==(t=null==window?void 0:window.$getVueCurrentInstance)?void 0:t.call(window)))?void 0:a.appContext;null==(c=null==(i=null==(l=null==(n=null==e?void 0:e.config)?void 0:n.globalProperties)?void 0:l.$globalMediaUtils)?void 0:i.globalAudioPlayer)||c.pause(null==(s=null==(r=null==(o=null==e?void 0:e.config)?void 0:o.globalProperties)?void 0:r.$globalMediaUtils)?void 0:s.globalAudioPlayer.currentUrl),b.isPlaying=!1}});const _=e=>{b.isPlaying=e,e?(d.currentPlayingId=k,d.isMiniPlayerPlaying=!0):d.currentPlayingId===k&&(d.currentPlayingId=null,d.isMiniPlayerPlaying=!1)},T=e=>{b.isLoading=e},D=e=>{A.value||(b.progress=e,b.currentTime=e/100*b.duration)},I=()=>{},S=()=>{var e;null==(e=m.value)||e.changeOp()},M=e=>{if(!e||isNaN(e))return"00:00";const t=Math.floor(e/60),a=Math.floor(e%60);return`${String(t).padStart(2,"0")}:${String(a).padStart(2,"0")}`},E=e=>{var t;if(!g.value||!m.value)return;const a=g.value.getBoundingClientRect(),n=(e.clientX-a.left)/a.width*100,l=Math.max(0,Math.min(100,n));b.progress=l,b.currentTime=l/100*b.duration,null==(t=m.value)||t.changeProgress(l)},P=e=>{e.preventDefault(),e.stopPropagation(),A.value=!0;const t=e=>{if(!A.value||!g.value)return;const t=g.value.getBoundingClientRect(),a=(e.clientX-t.left)/t.width*100,n=Math.max(0,Math.min(100,a));b.progress=n,b.currentTime=n/100*b.duration},a=()=>{var e;A.value&&(A.value=!1,null==(e=m.value)||e.changeProgress(b.progress)),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",a)},L=e=>{e.preventDefault(),e.stopPropagation(),A.value=!0;const t=e=>{if(!A.value||!g.value)return;const t=e.touches[0],a=g.value.getBoundingClientRect(),n=(t.clientX-a.left)/a.width*100,l=Math.max(0,Math.min(100,n));b.progress=l,b.currentTime=l/100*b.duration},a=()=>{var e,n;A.value&&(A.value=!1,null==(n=null==(e=m.value)?void 0:e.seekTo)||n.call(e,b.progress)),document.removeEventListener("touchmove",t),document.removeEventListener("touchend",a)};document.addEventListener("touchmove",t),document.addEventListener("touchend",a)};return t({play:()=>{var e,t;return null==(t=null==(e=m.value)?void 0:e.play)?void 0:t.call(e)},pause:()=>{var e,t;return null==(t=null==(e=m.value)?void 0:e.pause)?void 0:t.call(e)},toggle:()=>{var e,t;return null==(t=null==(e=m.value)?void 0:e.changeOp)?void 0:t.call(e)}}),(t,a)=>e.currentClip?(r(),o("div",Xn,[u(ua,{ref_key:"refPlayer",ref:m,url:b.url,duration:b.duration,onSyncPlayState:_,onSyncLoadingState:T,onSyncProgress:D,onCurPlayEnded:I},{default:p(()=>{var t,n;return[s("div",Qn,[s("div",qn,[s("div",{class:f(["mini-player-cover-box pointer",{"isplay-true":b.isPlaying,"isplay-false":!b.isPlaying}
1])},[u(Ta,{src:e.currentClip.cover?v(je)(e.currentClip.cover):v(xa)},null,8,["src"]),s("div",{class:"mini-player-cover-op flex-center",onClick:x(S,["stop"])},[s("div",Zn,[a[0]||(a[0]=s("i",{class:"block play"},null,-1)),s("div",Jn,[u(Sa,{barConfig:{barWidth:"2px",barHeight:"8px",barSpacing:"1.5px",barColor:"#fff"},animation:b.isPlaying},null,8,["animation"])])])])],2),s("div",$n,[s("div",el,h(e.currentClip.title||"Untitled"),1),s("div",tl,[e.currentClip.model?(r(),o("span",{key:0,class:f(["tag version",null==(t=e.currentClip.model)?void 0:t.split(" ").pop()])},h(null==(n=e.currentClip.model)?void 0:n.split(" ").pop()),3)):c("",!0),e.currentClip.bpm?(r(),o("span",al,h(e.currentClip.bpm)+" BPM",1)):c("",!0)])])]),s("div",nl,[s("div",ll,h(M(b.currentTime)),1),s("div",{class:"mini-player-progress-bar",ref_key:"progressBarRef",ref:g,onClick:E},[s("div",il,[s("div",{class:"progress-filled",style:y({width:b.progress+"%"})},[s("div",{class:"progress-thumb",onMousedown:P,onTouchstart:L},null,32)],4)])],512),s("div",ol,h(M(b.duration)),1)])])]}),_:1},8,["url","duration"])])):c("",!0)}},[["__scopeId","data-v-b2472241"]]),sl={class:"left-library"},cl={class:"library-top-wrapper"},dl={class:"library-content"},ul={key:0,class:"library-footer"},pl=Te({__name:"index",emits:["expand-library"],setup(e,{emit:t}){const l=t,d=a(null),p=n("libraryWidth",a(320)),v=n("COLLAPSED_WIDTH",96),m=a(!1);i(p,e=>{m.value=e<=v},{immediate:!0});const g=e=>{d.value=e};return(e,t)=>(r(),o("div",sl,[s("div",cl,[u(bn,{onExpandLibrary:t[0]||(t[0]=e=>l("expand-library",e))})]),s("div",dl,[u(zn,{"current-clip":d.value,onPlayClip:g},null,8,["current-clip"])]),d.value&&!m.value?(r(),o("div",ul,[u(rl,{"current-clip":d.value},null,8,["current-clip"])])):c("",!0)]))}},[["__scopeId","data-v-092c6f96"]]),vl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%3e%3cpath%20d='M8.79289%204H3.20711C2.76165%204%202.53857%204.53857%202.85355%204.85355L5.64645%207.64645C5.84171%207.84171%206.15829%207.84171%206.35355%207.64645L9.14645%204.85355C9.46143%204.53857%209.23835%204%208.79289%204Z'%20fill='white'%20fill-opacity='0.6'/%3e%3c/svg%3e",ml={class:"instrument-select-box"},gl={class:"instrument-select-button flex-center"},hl={class:"instrument-name flex-center flex1"},fl=["src"],yl={key:0,class:"flex1"},kl={key:0,class:"arrow flex-center pointer"},bl=["onClick"],wl={class:"instrument-popover-item flex-center"},Al=["src","alt"],Cl={class:"instrument-popover-item-label flex1"},_l=Te({__name:"instrument-select",props:{instrument:{type:Object,default:()=>({type:"Song"})},popperSkid:{type:Number,default:0},showArrow:{type:Boolean,default:!0},showName:{type:Boolean,default:!0},from:{type:String,default:""}},emits:["change"],setup(e,{emit:t}){var n;const m=We(),{headSummonVisible:k}=S(m),b=rt(),w=l(()=>"preview"===b.mode),A=e,C=t,_=a(null),T=a((null==(n=A.instrument)?void 0:n.type)||"Song"),x=l(()=>({modifiers:[{name:"preventOverflow",options:{mainAxis:!0,altAxis:!0,padding:8,boundary:"clippingParents",rootBoundary:"viewport",tether:!0,tetherOffset:0}},{name:"offset",options:{offset:[A.popperSkid,25]}}]})),D=l(()=>{var e,t;const a=(null==(e=A.instrument)?void 0:e.type)||"Song",n=Aa.find(e=>e.type===a);return(null==n?void 0:n.icon)||(null==(t=Aa[0])?void 0:t.icon)});i(()=>A.instrument,e=>{(null==e?void 0:e.type)&&(T.value=e.type)},{deep:!0});return(t,a)=>{const n=la;return r(),o("div",ml,[u(n,{ref_key:"instrumentPopoverRef",ref:_,"show-arrow":!1,teleported:!0,placement:"bottom-start",width:160,"popper-class":"instrument-popover-box",trigger:"click",disabled:w.value,"popper-options":x.value},{reference:p(()=>[s("div",gl,[s("div",hl,[s("img",{src:D.value,alt:"instrument"},null,8,fl),e.showName?(r(),o("span",yl,h(T.value),1)):c("",!0)]),e.showArrow?(r(),o("div",kl,[...a[0]||(a[0]=[s("img",{src:vl,alt:"arrow"},null,-1)])])):c("",!0)])]),default:p(()=>[s("div",{class:f(["instrument-popover flex-column",{[e.from]:!0}]),style:y("--right-panel-top: "+(v(k)?"250px":"180px"))},[(r(!0),o(d,null,g(v(Aa),e=>(r(),o("div",{key:e.type,class:f(["instrument-popover-item-box",{"instrument-popover-item-hasBorder":e.needBorder}]),onClick:t=>(e=>{var t,a;if(e===T.value)return void(null==(t=_.value)||t.hide());T.value=e;const n=Aa.find(t=>t.type===e);C("change",n),null==(a=_.value)||a.hide()})(e.type)},[s("div",wl,[s("img",{class:"instrument-popover-item-icon",src:e.icon,alt:e.type},null,8,Al),s("div",Cl,h(e.type),1)])],10,bl))),128))],6)]),_:1},8,["disabled","popper-options"])])}}},[["__scopeId","data-v-35f8fb2d"]]),Tl=k("generateStore",()=>{const e=Re(),t=a([]),n=a(null),i=a(!1),o=a({oparationTypeAfterSelection:null,doCopyToVersionTrack:null,selectionData:null}),r=a(null),s=a(null),c=l(()=>{const e=rt(),t=e.state.selection.focusedTrackId;if(!t)return null;if(e.state.tracks.some(e=>e.id===t))return"track";return e.state.tracks.some(e=>{var a;return null==(a=e.takeLanes)?void 0:a.some(e=>e.id===t)})?"version":null}),d=l(()=>{var e,t;return(null==(t=null==(e=o.value)?void 0:e.selectionData)?void 0:t.focusedTrack)||null}),u={18:ft.CREATE,19:ft.REPLACE,20:ft.EXTEND};return{renderPresetData:t,changeRecommendPromptPresetDataTime:n,generateLoading:i,bottomPanelData:o,currentTrack:d,focusedTrackType:c,changeRecommendPromptPresetData:e=>{let a=(new Date).getTime();return n.value=a,new Promise((l,i)=>{Oe.changeRecommendPromptPresetData({...e}).then(e=>{var o,r,s,c;n.value==a?200===e.code?((null==(r=null==(o=e.data)?void 0:o.list)?void 0:r.length)&&(t.value=null==(c=null==(s=e.data)?void 0:s.list)?void 0:c.map(e=>({content:e,type:"genres",show:!0}))),l()):9008===e.code?i("get batch prompt too frequently"):i("get batch prompt presetData error"):i("abandon request")}).catch(e=>{i(e)})})},toggleGeneratePanelVisible:e=>{(null==e?void 0:e.bottomPanelData)&&(o.value={...e.bottomPanelData}),(null==e?void 0:e.selectionData)&&(o.value.selectionData=e.selectionData)},startSseGeneration:(t,a,n,l)=>{s.value==n&&(i.value=!0);let o=null;ht.setGenerating(!0,{skipHistory:!0,skipSave:!0});let c={},d=null;r.value=t;const p=u[l];Ke.doSseGetGenerate({params:`conn_id=${t}`,onOpen:e=>{var l,r;if(s.value==n&&(i.value=!0),a){const{startTime:e,endTime:n}=a,i=(n||0)-(e||0);o=null==(l=nt.MainManagerDispatcher)?void 0:l.updateCreationIntentDataByOpType({updateClipDataType:mt.ADD_CREATION_INTENT_DATA,data:{trackId:null==a?void 0:a.focusedTrackId,queuedGenerationId:t,clipData:{startTime:e||0,endTime:n||0,srcDuration:i,srcClipStartTime:0,srcClipEndTime:i,generateMode:p}}}),o&&lt.batchUpdate({tracks:null==(r=o.tracks)?void 0:r.map(e=>e.getTrackStateData())})}},onMessage:a=>{var l,u,v,m,g,h,f,y;let k=!1;try{if(["inf_feed","pgc_feed","pgc_feed_thinking"].indexOf(a.event)>=0){c=JSON.parse(a.data??"{}");if(2==c.state&&(null==(l=null==c?void 0:c.songs)?void 0:l.length)>0&&(null==c?void 0:c.songs)&&c.songs.length>0){const e=c.songs.length;d!==e&&(d=e,k=!0,o=null==(u=nt.MainManagerDispatcher)?void 0:u.updateCreationIntentDataByOpType({updateClipDataType:mt.ADD_CREATION_INTENT_DATA_WHEN_GENERATING,data:{queuedGenerationId:t,notfoundCallback:()=>{i.value=!1,ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})},clipDatas:[{songId:c.songs[0].song_id,generateMode:p},{songId:c.songs[1].song_id,generateMode:p}]}}),o&&lt.batchUpdate({tracks:null==(v=o.tracks)?void 0:v.map(e=>e.getTrackStateData()),index:o.mainTrackIndexs},{skipHistory:k}))}}else["error"].includes(a.event)?(s.value==n&&(i.value=!1),ht.setGenerating(!1,{skipHistory:!0,skipSave:!0}),r.value==t&&(r.value=null)):"done"==a.event&&((null==(m=null==c?void 0:c.songs)?void 0:m.length)>0&&(3==c.state||12==c.state?(k=!1,o=null==(g=nt.MainManagerDispatcher)?void 0:g.updateCreationIntentDataByOpType({updateClipDataType:mt.UPDATE_CREATION_INTENT_ON_SUCCESS,data:{queuedGenerationId:t,generateType:null==c.songs[0].regenerate_from&&null!=c.songs[0].regenerate_to?ft.EXTEND_FORWARD:null,clipDatas:[{generateMode:p,srcPathKey:c.songs[0].mp3_url,songId:c.songs[0].song_id,name:c.songs[0].title,srcClipStartTime:c.songs[0].regenerate_from??0,srcDuration:c.songs[0].duration_milliseconds,srcClipEndTime:c.songs[0].regenerate_to??c.songs[0].duration_milliseconds,waveformData:c.songs[0].waveforms},{generateMode:p,srcPathKey:c.songs[1].mp3_url,songId:c.songs[1].song_id,name:c.songs[1].title,srcClipStartTime:c.songs[1].regenerate_from??0,srcDuration:c.songs[1].duration_milliseconds,srcClipEndTime:c.songs[1].regenerate_to??c.songs[1].duration_milliseconds,waveformData:c.songs[1].waveforms}]}}),Ue.emit("studio-library-refresh"),i.value=!1,ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})):c.state>3&&12!=c.state?(e.refreshUserAccount(),k=!1,o=null==(f=nt.MainManagerDispatcher)?void 0:f.updateCreationIntentDataByOpType({updateClipDataType:mt.UPDATE_CREATION_INTENT_ON_FAILED,data:{queuedGenerationId:t,clipDatas:(null==(h=c.songs)?void 0:h.map(e=>({songId:e.song_id})))??[]}}),i.value=!1,ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})):o=null,o&&lt.batchUpdate({tracks:null==(y=o.tracks)?void 0:y.map(e=>e.getTrackStateData()),index:o.mainTrackIndexs},{skipHistory:k})),s.value==n&&(i.value=!1),ht.setGenerating(!1,{skipHistory:!0,skipSave:!0}),r.value==t&&(r.value=null))}catch(b){s.value==n&&(i.value=!1),ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})}},onError:e=>{s.value==n&&(i.value=!1),ht.setGenerating(!1,{skipHistory:!0,skipSave:!0}),r.value==t&&(r.value=null)},onClose:e=>{r.value==t&&(r.value=null),s.value==n&&(i.value=!1),ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})}})}
1,creationIntentDeleteCallback:()=>{i.value=!1,ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})},_normalizeGenerateStateData:(e={})=>{const{timing:t,tracks:a,loop:n,selection:l,...i}=e,o={...t||{},bpm:(null==t?void 0:t.bpm)??120,baseBpm:(null==t?void 0:t.baseBpm)??(null==t?void 0:t.bpm)??120};let r=(a||[]).reduce((e,t)=>{var a,n;let l=e;const i=null==(a=t.clips)?void 0:a[0];if(i&&(l=Math.min(l,i.startTime??0)),null==(n=t.takeLanes)?void 0:n.length){const e=t.takeLanes.reduce((e,t)=>{var a;const n=null==(a=t.clips)?void 0:a[0];return n?Math.min(e,n.startTime??0):e},l);l=Math.min(l,e)}return l},0);r=Math.min(0,l.startTime,r);const s=isFinite(r)?r:0,c=(a||[]).map(e=>{const{clips:t,takeLanes:a,...n}=e||{};return{...ne,...n,clips:(t||[]).map(e=>({...ie,...e,startTime:e.startTime-s,bpm:(null==e?void 0:e.bpm)??o.baseBpm})),takeLanes:(a||[]).map(e=>{const{clips:t,...a}=e||{};return{...ne,...a,clips:(t||[]).map(e=>({...ie,...e,startTime:e.startTime-s,bpm:(null==e?void 0:e.bpm)??o.baseBpm}))}})}});return{...i,selection:l?{...l,startTime:(l.startTime??0)-s,endTime:(l.endTime??0)-s}:void 0,loop:n?{...n,startTime:(n.startTime??0)-s,endTime:(n.endTime??0)-s}:void 0,timing:o,tracks:c}}}}),xl={class:"edit-style-radom-tag-refer"},Dl=["onClick"],Il={class:"block omlh-2 tc"},Sl={__name:"randomTagRefer",props:{randomTags:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["randomClick","addMusicDiscribe"],setup(e,{emit:t}){var n;const l=We(),{createRenderType:c}=S(l),{$$language:u,$$t:p,$$tm:v,$$tValue:m}=(null==(n=w().appContext)?void 0:n.config.globalProperties.$i18n)??{},y=a(null),k=a(null),b=e,A=t,T=a(null),x=C({randomTags:[],swiperActiveIndex:0,disabledSwichFirst:!1,disabledSwichLast:!1,styleList:new Array(10).fill(" "),randomTagVibility:!0,isHovered:!1});return i(()=>b.randomTags,()=>{x.randomTags=b.randomTags.filter(e=>e.show),E().then(()=>{})}),_(()=>{x.randomTags=b.randomTags.filter(e=>e.show)}),M(()=>{var e;null==(e=T.value)||e.destroy()}),(e,t)=>(r(),o("div",xl,[s("div",{class:"edit-style-radom-tag-refer-tags",ref_key:"refContainer",ref:k},[s("div",{class:"swiper",ref_key:"refStyleSwiper",ref:y},[s("div",{class:f(["swiper-wrapper overflow-x-auto-mini",{"swiper-wrapper-hovered":x.isHovered}]),"data-double-horizontal-scroll":"true",onMouseenter:t[0]||(t[0]=e=>x.isHovered=!0),onMouseleave:t[1]||(t[1]=e=>x.isHovered=!1)},[(r(!0),o(d,null,g(x.randomTags,(e,t)=>(r(),o("div",{class:"swiper-slide",key:t+1},[s("div",{class:"swiper-tag-item pointer",onClick:()=>{((e,t)=>
1{A("addMusicDiscribe",e,t)})(e,t)}},[s("span",Il,h(e.content),1)],8,Dl)]))),128))],34)],512)],512)]))}},Ml={key:0,class:"expand-item lyrics-expand flex-column"},El={class:"expand-header flex-row-center"},Pl={class:"expand-textarea-wrapper"},Ll=["value","maxlength"],Rl=["value","maxlength"],Bl={class:"style-wrapper"},jl={key:0,class:"expand-item style-expand flex-column flex1"},Nl={class:"expand-header flex-row-center"},Ol={class:"expand-textarea-wrapper"},Vl=["value","maxlength"],Fl={class:"esc-preset-box flex"},Ul={class:"esc-preset-items flex flex1"},Hl={key:1,class:"create-advance-mode-item create-advance-mode-item-gender"},Gl=Te({__name:"ExpandContent",props:{operationType:{type:String,default:""},isExpanded:{type:Boolean,default:!1},showLyrics:{type:Boolean,default:!1},showStyle:{type:Boolean,default:!1},showInstrument:{type:Boolean,default:!1},instrument:{type:String,default:""},instrumentMaxCount:{type:Number,default:200},lyrics:{type:String,default:""},style:{type:String,default:""},lyricsMaxCount:{type:Number,default:5e3},styleMaxCount:{type:Number,default:1e3},preSetTags:{type:Array,default:()=>[]},randomBatchLoading:{type:Boolean,default:!1},gender:{type:String,default:""},isBgmMode:{type:Boolean,default:!1},hasRefer:{type:Boolean,default:!1}},emits:["update:instrument","instrument-input","update:lyrics","update:style","update:gender","random-batch-click","preset-click","style-input","generate-lyrics","random-style-click"],setup(e,{emit:t}){const a=e,n=t,l=(e,t,a,l=null)=>{let i=e.target.value;i.length>a&&(i=i.slice(0,a),e.target.value=i),n(`update:${t}`,i),l&&n(l,e)},i=e=>{l(e,"instrument",a.instrumentMaxCount,"instrument-input")},d=e=>{l(e,"lyrics",a.lyricsMaxCount)},m=e=>{l(e,"style",a.styleMaxCount,"style-input")};return(t,a)=>(r(),T(R,{name:"expand"},{default:p(()=>[e.isExpanded?(r(),o("div",{key:0,class:f(["expand-content flex",{"only-style":e.showStyle&&!e.showLyrics&&!e.showInstrument}])},[e.showLyrics||e.showInstrument?(r(),o("div",Ml,[s("div",El,[s("span",null,h(e.showInstrument?"Instrument":"Lyrics"),1),u(v(Ye),{shape:"pill",size:"small","icon-only":!0,"aria-label":"generate",onClick:a[0]||(a[0]=e=>t.$emit("generate-lyrics"))},{default:p(()=>[u(v(xe),{name:"biz-generate-lyrics",size:"18"})]),_:1})]),s("div",Pl,[e.showInstrument?(r(),o("textarea",{key:1,value:e.instrument,placeholder:"",class:"expand-textarea",maxlength:e.instrumentMaxCount,onInput:i},null,40,Rl)):(r(),o("textarea",{key:0,value:e.lyrics,placeholder:"Add your own lyrics here",class:"expand-textarea",maxlength:e.lyricsMaxCount,onInput:d},null,40,Ll)),s("div",{style:y({visibility:e.showInstrument?e.instrumentMaxCount===e.instrument.length?"visible":"hidden":.8*e.lyricsMaxCount<=e.lyrics.length?"visible":"hidden",color:e.showInstrument?e.instrumentMaxCount===e.instrument.length?"#FF0000":"rgba(255, 255, 255, 0.6)":e.lyricsMaxCount===e.lyrics.length?"#FF0000":"rgba(255, 255, 255, 0.6)"}),class:"count-box"},[s("span",null,h(e.showInstrument?e.instrument.length:e.lyrics.length),1),a[6]||(a[6]=s("span",null,"/",-1)),s("span",null,h(e.showInstrument?e.instrumentMaxCount:e.lyricsMaxCount),1)],4)])])):c("",!0),s("div",Bl,[e.showStyle?(r(),o("div",jl,[s("div",Nl,[a[7]||(a[7]=s("span",null,"Styles",-1)),P(u(v(Ye),{shape:"pill",size:"small",type:"ghost","icon-only":!0,"aria-label":"random",onClick:a[1]||(a[1]=e=>t.$emit("update:style",""))},{default:p(()=>[u(v(xe),{name:"sys-delete",opacity:.6})]),_:1},512),[[L,e.style]]),u(v(Ye),{shape:"pill",size:"small",type:"ghost","icon-only":!0,"aria-label":"random",onClick:a[2]||(a[2]=e=>t.$emit("random-style-click"))},{default:p(()=>[u(v(xe),{name:"biz-lyrics-random",opacity:.6})]),_:1})]),s("div",Ol,[s("textarea",{value:e.style,placeholder:"",class:"expand-textarea",maxlength:e.styleMaxCount,onInput:m},null,40,Vl),.8*e.styleMaxCount<=e.style.length?(r(),o("div",{key:0,class:"count-box",style:y({color:e.styleMaxCount===e.style.length?"#FF0000":"rgba(255, 255, 255, 0.6)"})},[s("span",null,h(e.style.length),1),a[8]||(a[8]=s("span",null,"/",-1)),s("span",null,h(e.styleMaxCount),1)],4)):c("",!0),s("div",Fl,[s("div",{class:f(["esc-refresh flex-center pointer",{"esc-refresh-loading":e.randomBatchLoading}]),onClick:a[3]||(a[3]=x(e=>t.$emit("random-batch-click"),["stop"]))},[...a[9]||(a[9]=[s("i",{class:"icon icon-refresh block"},null,-1)])],2),s("div",Ul,[u(Sl,{"random-tags":e.preSetTags,onAddMusicDiscribe:a[4]||(a[4]=e=>t.$emit("preset-click",e))},null,8,["random-tags"])])])])])):c("",!0),e.showLyrics&&[v(ft).CREATE,v(ft).CREATE_DISABLED].includes(e.operationType)?(r(),o("div",Hl,[u(Pa,{"only-gender":!0,gender:e.gender,"is-bgm-mode":e.isBgmMode,"has-refer":e.hasRefer,"onUpdate:gender":a[5]||(a[5]=e=>t.$emit("update:gender",e))},null,8,["gender","is-bgm-mode","has-refer"])])):c("",!0)])],2)):c("",!0)]),_:1}))}},[["__scopeId","data-v-ffe49549"]]),Wl={class:"popover-header flex-row-center"},Kl={class:"popover-content flex1"},Yl=["value","maxlength"],zl={key:0,class:"style-count-box"},Xl={key:0,class:"create-advance-mode-item create-advance-mode-item-gender"},Ql=Te({__name:"InputPopover",props:{show:{type:Boolean,default:!1},title:{type:String,required:!0},modelValue:{type:String,default:""},maxLength:{type:Number,required:!0},popoverStyle:{type:Object,default:()=>({})},popoverClass:{type:String,default:""},textareaClass:{type:String,default:"lyrics-textarea"},transitionName:{type:String,default:"lyrics-popover"},operationType:{type:String,default:""},showLyrics:{type:Boolean,default:!1},gender:{type:String,default:""},isBgmMode:{type:Boolean,default:!1},hasRefer:{type:Boolean,default:!1}},emits:["update:modelValue","input","done","update:gender"],setup(e,{emit:t}){const n=e,d=t,g=l(()=>k.value.length),k=a(n.modelValue);i(()=>n.modelValue,e=>{k.value=e},{immediate:!0}),i(()=>n.show,e=>{e&&(k.value=n.modelValue)});const b=e=>{const t=e.target.value;k.value=t,d("input",e),d("update:modelValue",t)},w=()=>{d("done")};return(t,a)=>(r(),T(R,{name:e.transitionName},{default:p(()=>[e.show?(r(),o("div",{key:0,ref:"popoverRef",class:f(["popover-box flex-column",e.popoverClass]),style:y(e.popoverStyle),onClick:a[1]||(a[1]=x(()=>{},["stop"]))},[s("div",Wl,[B(t.$slots,"header-icon",{},()=>[a[2]||(a[2]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[s("path",{d:"M1.59961 4H7.19961",stroke:"white","stroke-width":"1.336","stroke-linecap":"round"}),s("path",{d:"M1.59961 8H4.79961",stroke:"white","stroke-width":"1.336","stroke-linecap":"round"}),s("path",{d:"M14.4508 1.74032C14.6748 1.78545 14.836 1.9823 14.836 2.21086V3.75545C14.836 4.05794 14.5596 4.28502 14.2629 4.22633L11.4844 3.67685C11.1876 3.61816 10.9113 3.84524 10.9113 4.14773V13.0347C10.9113 13.5437 10.3632 14.2605 9.78143 14.6363C9.19962 15.0127 8.50872 15.1998 7.70875 15.1998C7.10272 15.1998 6.59957 15.0242 6.19959 14.6726C5.79961 14.3218 5.59961 13.8674 5.59961 13.309C5.59961 12.8241 5.79961 12.406 6.19959 12.0544C6.59957 11.7036 7.10273 11.4907 7.70875 11.418H8.76333C9.03004 11.418 9.26633 11.3089 9.47237 11.0908C9.6784 10.8726 9.78143 10.6309 9.78143 10.3635V1.77701C9.78143 1.27173 10.2441 0.892989 10.7394 0.992761L14.4508 1.74032Z",fill:"white"}
1)],-1))],!0),s("span",null,h(e.title),1)]),s("div",Kl,[B(t.$slots,"content",{},()=>[s("textarea",{ref:"textareaRef",value:k.value,placeholder:"",class:f(e.textareaClass),maxlength:e.maxLength,onInput:b},null,42,Yl),"Style"===e.title?(r(),o("div",zl,[s("span",null,h(g.value),1),a[3]||(a[3]=s("span",null,"/",-1)),s("span",null,h(e.maxLength),1)])):c("",!0)],!0)]),"Style"===e.title&&e.showLyrics&&[v(ft).CREATE,v(ft).CREATE_DISABLED].includes(e.operationType)?(r(),o("div",Xl,[u(Pa,{"only-gender":!0,gender:e.gender,"is-bgm-mode":e.isBgmMode,"has-refer":e.hasRefer,"onUpdate:gender":a[0]||(a[0]=e=>d("update:gender",e))},null,8,["gender","is-bgm-mode","has-refer"])])):c("",!0),s("div",{class:"popover-footer flex-space-between",style:y({color:g.value===e.maxLength?"#FF0000":"rgba(255, 255, 255, 0.6)"})},[s("div",{class:"count-box",style:y({visibility:"Style"!==e.title?"visible":"hidden"})},[s("span",null,h(g.value),1),a[4]||(a[4]=s("span",null,"/",-1)),s("span",null,h(e.maxLength),1)],4),u(v(Ye),{appearance:"inverse",onClick:w},{default:p(()=>[...a[5]||(a[5]=[m("Done",-1)])]),_:1})],4)],6)):c("",!0)]),_:3},8,["name"]))}},[["__scopeId","data-v-ba5a07f7"]]),ql=["placeholder","value","maxlength"],Zl=Te({__name:"GenerateInput",props:{modelValue:{type:String,default:""},shouldShow:{type:Boolean,default:!0},maxLength:{type:Number,default:6},maxCount:{type:Number,default:3e3},isSmallScreen:{type:Boolean,default:!1},wrapperRef:{type:Object,default:null},placeholder:{type:String,default:""},title:{type:String,default:""}},emits:["update:modelValue","click"],setup(e,{expose:t,emit:n}){const i=e,d=n,v=a(null),m=a(null),g=a(!1),h=a(0),f=l(()=>i.isSmallScreen?{left:`-${h.value}px`}:{}),y=e=>{let t=e.target.value;t.length>i.maxCount&&(t=t.slice(0,i.maxCount)),d("update:modelValue",t),t.length>i.maxLength?(A(),g.value=!0):g.value=!1},k=()=>{d("click"),i.modelValue.length>i.maxLength&&(A(),g.value=!0)},b=()=>{d("click"),i.isSmallScreen&&(A(),g.value=!0)},w=e=>{let t=e.target.value;t.length>i.maxCount&&(t=t.slice(0,i.maxCount)),d("update:modelValue",t)},A=()=>{if(i.isSmallScreen&&v.value&&i.wrapperRef){const e=v.value.getBoundingClientRect(),t=i.wrapperRef.getBoundingClientRect();h.value=e.left-t.left}},C=()=>{g.value=!1};return t({inputRef:v,popoverRef:m,showPopover:g,hidePopover:C}),(t,a)=>(r(),T(R,{name:"input-fade"},{default:p(()=>[e.shouldShow?(r(),o("div",{key:0,class:"input-content flex-center",ref_key:"containerRef",ref:v,onClick:b},[B(t.$slots,"icon",{},void 0,!0),s("input",{type:"text",placeholder:e.placeholder,value:e.modelValue,maxlength:e.maxCount,onInput:y,onFocus:k,onClick:a[0]||(a[0]=x(()=>{},["stop"]))},null,40,ql),u(Ql,{show:g.value,title:e.title,modelValue:e.modelValue,maxLength:e.maxCount,popoverStyle:f.value,"onUpdate:modelValue":a[1]||(a[1]=e=>t.$emit("update:modelValue",e)),onInput:w,onDone:C,ref_key:"popoverRef",ref:m},j({_:2},[t.$slots["popover-icon"]?{name:"header-icon",fn:p(()=>[B(t.$slots,"popover-icon",{},void 0,!0)]),key:"0"}:void 0]),1032,["show","title","modelValue","maxLength","popoverStyle"])],512)):c("",!0)]),_:3}))}},[["__scopeId","data-v-99b0b996"]]),Jl=["value","maxlength"],$l=Te({__name:"StyleInput",props:{modelValue:{type:String,default:""},shouldShow:{type:Boolean,default:!0},isOnlyStyleContent:{type:Boolean,default:!1},maxLength:{type:Number,default:6},maxCount:{type:Number,default:200},isSmallScreen:{type:Boolean,default:!1},wrapperRef:{type:Object,default:null},operationType:{type:String,default:""},showLyrics:{type:Boolean,default:!1},gender:{type:String,default:""},isBgmMode:{type:Boolean,default:!1},hasRefer:{type:Boolean,default:!1}},emits:["update:modelValue","input","click","update:gender"],setup(e,{expose:t,emit:n}){const i=e,d=n,v=a(null),m=a(null),g=a(!1),h=a(0),y=l(()=>i.isSmallScreen?{left:`-${h.value-10}px`}:{}),k=e=>{let t=e.target.value;t.length>i.maxCount&&(t=t.slice(0,i.maxCount)),d("update:modelValue",t),t.length>i.maxLength?(C(),g.value=!0):g.value=!1},b=()=>{d("click"),i.modelValue.length>i.maxLength&&(C(),g.value=!0)},w=()=>{d("click"),i.isSmallScreen&&(C(),g.value=!0)},A=e=>{let t=e.target.value;t.length>i.maxCount&&(t=t.slice(0,i.maxCount)),d("update:modelValue",t),d("input",e)},C=()=>
1{if(i.isSmallScreen&&v.value&&i.wrapperRef){const e=v.value.getBoundingClientRect(),t=i.wrapperRef.getBoundingClientRect();h.value=e.left-t.left}},_=()=>{g.value=!1};return t({inputRef:v,popoverRef:m,showPopover:g,hidePopover:_}),(t,a)=>(r(),T(R,{name:"input-fade"},{default:p(()=>[e.shouldShow?(r(),o("div",{key:0,ref_key:"inputRef",ref:v,class:f(["input-content style-content flex-center",{"only-style-content":e.isOnlyStyleContent}]),onClick:w},[a[4]||(a[4]=s("i",{class:"iconfont icon-style"},null,-1)),s("input",{type:"text",placeholder:"Styles",value:e.modelValue,maxlength:e.maxCount,onInput:k,onFocus:b,onClick:a[0]||(a[0]=x(()=>{},["stop"]))},null,40,Jl),u(Ql,{ref_key:"popoverRef",ref:m,show:g.value,title:"Style","model-value":e.modelValue,"max-length":e.maxCount,"popover-style":y.value,"operation-type":e.operationType,"show-lyrics":e.showLyrics,gender:e.gender,"is-bgm-mode":e.isBgmMode,"has-refer":e.hasRefer,"textarea-class":"style-textarea","transition-name":"style-popover","onUpdate:modelValue":a[1]||(a[1]=e=>t.$emit("update:modelValue",e)),"onUpdate:gender":a[2]||(a[2]=e=>t.$emit("update:gender",e)),onInput:A,onDone:_},{"header-icon":p(()=>[...a[3]||(a[3]=[s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[s("path",{d:"M13.335 1.01953C13.4924 0.976784 13.6613 1.00685 13.792 1.10059C13.9227 1.19432 14 1.34045 14 1.49609V10.792C14 11.678 13.3822 12.4568 12.4863 12.7002L11.5684 12.9492C10.434 13.2574 9.3049 12.4479 9.30469 11.3262C9.30469 10.5724 9.82965 9.90942 10.5918 9.70215L12.1992 9.26562C12.6471 9.14393 12.956 8.75448 12.9561 8.31152V4.63477L6.69531 6.33594V12.7764C6.69531 13.6624 6.07756 14.4412 5.18164 14.6846L4.26367 14.9336C3.12928 15.2418 2.00014 14.4324 2 13.3105C2 12.5566 2.5257 11.8937 3.28809 11.6865L4.89551 11.25C5.34338 11.1283 5.65233 10.7388 5.65234 10.2959V3.48047C5.65243 3.25914 5.80652 3.06484 6.03027 3.00391L13.335 1.01953Z",fill:"white"})],-1)])]),_:1},8,["show","model-value","max-length","popover-style","operation-type","show-lyrics","gender","is-bgm-mode","has-refer"])],2)):c("",!0)]),_:1}))}},[["__scopeId","data-v-c58136d2"]]),ei={class:"generate-content flex-center"},ti={class:"generate-content-left flex-center"},ai={class:"flex-center instrument-wrapper"},ni={key:0,class:"glow-effect rounded-full glow-shimmer-active"},li=1e3,ii=Te({__name:"generateBox",setup(e){var t,n,d;const m=null==(t=w())?void 0:t.appContext.config.globalProperties,g=Tl(),k=rt(),b=Ra(),A=Re(),C=(null==(d=null==(n=w())?void 0:n.appContext.config.globalProperties)?void 0:d.$i18n)??{},{$$t:x,$$language:D}=C??{},{currentTrack:I,focusedTrackType:E,bottomPanelData:P}=S(g),L=a(null),B=a(!1),j=a(null),N=a(0),O=a(""),V=a(null),F=a(""),U=a(null),H=a({type:"Song"}),G=a(!1),W=a(!1),K=a([]),Y=a(!1),z=a(!1),X=a(""),Q=l(()=>{var e;return!!(null==(e=k.state)?void 0:e.generating)}),q=l(()=>{var e;return null==(e=P.value)?void 0:e.oparationTypeAfterSelection}),Z={Song:1,Instrumental:2,Vocals:3,"Backing Vocals":4,Drums:5,Bass:6,Guitar:7,Keyboard:8,Percussion:9,Strings:10,Synth:11,FX:12,Brass:13,Woodwinds:14,Custom:15};l(()=>{const e=H.value.type;return Z[e]??Z.Song});const J=l(()=>{var e,t,a,n;return(null==(t=null==(e=P.value)?void 0:e.selectionData)?void 0:t.focusedTrackId)||(null==(n=null==(a=k.state)?void 0:a.selection)?void 0:n.focusedTrackId)||null}),$=l(()=>{var e,t;const a=J.value,n=(null==(e=k.state)?void 0:e.tracks)||[];if(!a||!Array.isArray(n))return null;const l=n.find(e=>(null==e?void 0:e.id)===a);if(l)return l;for(const i of n)if(null==(t=null==i?void 0:i.takeLanes)?void 0:t.some(e=>(null==e?void 0:e.id)===a))return i;return null});i(()=>J.value,()=>{var e,t,a;if(!!(null==(e=$.value)?void 0:e.id)||!!(null==(t=I.value)?void 0:t.id))return;const n="Song";H.value.type!==n&&(H.value={type:n});const l=I.value;if(!l)return;(null==l?void 0:l.instrument)?l.instrument={...l.instrument,type:n}:(null==(a=null==l?void 0:l.trackData)?void 0:a.instrument)&&(l.trackData.instrument={...l.trackData.instrument,type:n});const i="New Track";Object.prototype.hasOwnProperty.call(l,"name")?l.name=i:(null==l?void 0:l.trackData)&&Object.prototype.hasOwnProperty.call(l.trackData,"name")&&(l.trackData.name=i)},{immediate:!0});const ee=e=>{if(!e)return null;const t=Aa.find(t=>t.type===e);return(null==t?void 0:t.name)||(null==t?void 0:t.type)||null},te=l(()=>{const e=N.value;return 0===e?"":e<790?"generate-wrapper-small":"generate-wrapper-large"});i(N,e=>{e>0&&e<790&&G.value&&(W.value=!0,G.value=!1)}),i(N,(e,t)=>{t>0&&t<790&&e>=790&&W.value&&(G.value=!0)});const ae=l(()=>N.value>0&&N.value<790),ne=l(()=>{const e=H.value.type;return!["Song","Vocals","Backing Vocals"].includes(e)&&!0}),le=l(()=>{const e=q.value;return e===ft.REPLACE||e===ft.REPLACE_DISABLED?"Replace":e===ft.CREATE||e===ft.CREATE_DISABLED?"Create":e===ft.EXTEND_FORWARD||e===ft.EXTEND_FORWARD_DISABLED||e===ft.EXTEND_BACKWARD||e===ft.EXTEND_BACKWARD_DISABLED?"Extend":"Create"}),ie=new Set([ft.REPLACE,ft.REPLACE_DISABLED,ft.EXTEND_FORWARD,ft.EXTEND_FORWARD_DISABLED,ft.EXTEND_BACKWARD,ft.EXTEND_BACKWARD_DISABLED]),oe=l(()=>{var e;if(!ie.has(q.value))return!0;const t=null==(e=P.value)?void 0:e.selectionData,a=Number(null==t?void 0:t.startTime),n=Number(null==t?void 0:t.endTime);return!(!Number.isFinite(a)||!Number.isFinite(n))&&Math.abs(n-a)<18e4}),se=l(()=>{const e=q.value;return(e===ft.CREATE||e===ft.CREATE_DISABLED||e===ft.REPLACE||e===ft.REPLACE_DISABLED||e===ft.EXTEND_FORWARD||e===ft.EXTEND_BACKWARD||e===ft.EXTEND_FORWARD_DISABLED||e===ft.EXTEND_BACKWARD_DISABLED)&&oe.value}),ce=l(()=>se.value),de=l(()=>q.value===ft.CREATE&&"Backing Vocals"===H.value.type),ue=l(()=>{const e=q.value;return e===ft.COPY_VERSION_TRACK_DISABLED||e===ft.REPLACE_DISABLED||e===ft.CREATE_DISABLED||e===ft.EXTEND_FORWARD_DISABLED||e===ft.EXTEND_BACKWARD_DISABLED||de.value}),pe=l(()=>{if(q.value==ft.REPLACE)return!1;return!!(Ae.value||G.value&&Ce.value)&&(O.value||"").trim().length<1}),ve=l(()=>{var e;if("Vocals"!==H.value.type)return!1;if(q.value!==ft.CREATE)return!1;const t=null==(e=P.value)?void 0:e.selectionTimeAreaEffectiveDuration;return!!isFinite(t)&&t<3e4}),me=l(()=>ue.value||pe.value||ve.value||Q.value),ge=l(()=>{var e,t;return(null==(e=P.value)?void 0:e.oparationTypeAfterSelectionDisabledType)??(null==(t=P.value)?void 0:t.operationTypeAfterSelectionDisabledType)??null}),he=l(()=>{if(!ue.value)return"";const e=ge.value;if(null==e)return"";return{[yt.POINT_SELECTION]:"Select a range of time first",[yt.TOO_SMALL_SELECTION]:"Requires a selection of 3 seconds or more",[yt.MULTIPLE_TRACKS]:"It's limited to one audio track",[yt.EMPTY_SELECTION_TIMEAREA]:"Select a non-silent range of time first"}[e]||""}),fe=l(()=>{var e;const t=null==(e=P.value)?void 0:e.selectionData,a=null==t?void 0:t.startTime,n=null==t?void 0:t.endTime;return isFinite(a)&&isFinite(n)?Math.max(0,(n-a)/1e3):null}),ye=l(()=>{if(me.value)return"";const e=fe.value;return null==e?"":e<=30?"10Gold":"20Gold"}),ke=l(()=>de.value?"Cannot create new backing vocal":ve.value?"Valid audio less than 30 seconds within the time range":he.value?he.value:pe.value?"At least 1 characters are required for the lyrics":ye.value||""),be=l(()=>{const e=q.value;return e===ft.COPY_VERSION_TRACK||e===ft.COPY_VERSION_TRACK_DISABLED}),we=l(()=>q.value===ft.COPY_VERSION_TRACK_DISABLED),Ae=l(()=>["Song","Vocals","Backing Vocals"].includes(H.value.type)&&!G.value),Ce=l(()=>["Song","Vocals","Backing Vocals"].includes(H.value.type)),_e=l(()=>ne.value||["Song","Vocals","Backing Vocals"].includes(H.value.type));let Te=null,De=null;const Ie=(e=null)=>{var t,a;"lyrics"!==e&&(null==(t=V.value)?void 0:t.hidePopover)&&V.value.hidePopover(),"style"!==e&&(null==(a=U.value)?void 0:a.hidePopover)&&U.value.hidePopover()},Se=()=>{Ie("lyrics")},Me=()=>{Ie("style")},Ee=e=>{const t=[V,U];t.some(t=>{var a,n;return null==(n=null==(a=t.value)?void 0:a.inputRef)?void 0:n.contains(e.target)}
1)||t.forEach(e=>{var t;(null==(t=e.value)?void 0:t.showPopover)&&e.value.hidePopover()})},Pe=()=>{const e=P.value.doCopyToVersionTrack;if(!e)return;const t=e();t&&lt.batchUpdate({tracks:t.tracks})},Le=async()=>{var e,t,a,n,l,i,o;const r=null==(e=P.value)?void 0:e.selectionData,s=q.value,c=null==(t=null==r?void 0:r.focusedTrack)?void 0:t._getClipsByTimeArea(r.startTime,r.endTime);try{if(me.value)return;null==(a=null==m?void 0:m.logClickEvent)||a.call(m,"studio_generatetool_generate",{create_create_type:le.value,create_audio_type:H.value.type});let e=18;const t={generation_type:H.value.type,state:JSON.stringify(g._normalizeGenerateStateData(k.state)),prompt:{content:F.value}};Ce.value&&(t.lyrics=O.value);if(Ce.value&&[ft.CREATE,ft.CREATE_DISABLED].includes(s)&&X.value&&(t.prompt.gender=X.value),s===ft.REPLACE)e=19;else if(s===ft.EXTEND_FORWARD||s===ft.EXTEND_BACKWARD){e=20;const t=null==(n=null==c?void 0:c[0])?void 0:n.clipData;if(t){const e=t.startTime,a=t.srcDuration,n=t.srcClipEndTime-t.srcClipStartTime,o=e+a,s=4e5;if(n>s)return void ze.warning({content:"Audio exceeding 400 seconds cannot be extended"});const c=Math.min(e,r.startTime),d=Math.max(o,r.endTime);if(d-c>s){let t=r.startTime,a=r.endTime;return r.startTime<e?t=r.endTime-s:a=r.startTime+s,null==(l=nt.MainManagerDispatcher)||l.setSelectionData({startTime:t,endTime:a,type:it.SELECTION,focusedArea:kt.TIMELINE,focusedTrackId:r.focusedTrackId,trackIds:r.trackIds,syncData:!0}),null==(i=nt.MainManagerDispatcher)||i.triggerRender({renderModule:"partial",renderLayer:["interaction"],trackIndex:r.mainTrackIndexs}),void ze.warning({content:"The total length of the original and extended audio cannot exceed 400 seconds"})}}}const d={...t,mode:e};ht.setGenerating(!0,{skipHistory:!0,skipSave:!0}),g.lastGenerationTime=(new Date).getTime();const u=await re(d);if(200==(null==u?void 0:u.code))A.refreshUserAccount(),(null==(o=null==u?void 0:u.data)?void 0:o.conn_id)?g.startSseGeneration(u.data.conn_id,r,g.lastGenerationTime,e):ht.setGenerating(!1,{skipHistory:!0,skipSave:!0});else switch(ht.setGenerating(!1,{skipHistory:!0,skipSave:!0}),null==u?void 0:u.code){case 6478:ze.error({position:"top",content:x("editor.song_edit_selection_duration_range",{min:3,max:180})});break;case 6101:ze.info({position:"top",content:x("create.has_song_generating")});break;case 6103:case 6316:ze.error({position:"top",content:x("create.generate_title_audit_failed")});break;case 6104:case 6356:case 6357:ze.error({position:"top",content:x("create.generate_lyric_audit_failed")});break;case 6108:case 6354:ze.error({position:"top",content:x("create.generate_prompt_audit_failed")});break;case 6314:ze.info({position:"top",content:x("create.song_state_auditing")});break;case 6315:ze.info({position:"top",content:x("create.song_state_auditing_failed_disabled")});break;case 6317:case 6352:ze.error({position:"top",content:x("create.generate_refer_audit_failed")});break;case 6310:ze.warning({content:"Insufficient Gold, Cannot be  Create."});break;case 6301:case 6302:case 6308:default:ze.error({position:"top",content:x("create.generate_failed")});break;case 6303:ze.warning({content:x("create.credits_not_enough")});break;case 6323:ze.error({position:"top",content:x("create.generate_task_upper_limit")});break;case 6335:ze.error({position:"top",content:x("editor.subscripe_level_not_met")});break;case 6351:ze.error({position:"top",content:x("create.generate_vocal_audit_failed")});break;case 6353:ze.error({position:"top",content:x("create.generate_motif_audit_failed")});break;case 6340:ze.error({position:"top",content:x("create.not_generate_because_not_support_language")});break;case 6385:ze.error({position:"top",content:x("create.generate_remix_audit_failed")});break;case 9008:ze.error({position:"top",content:x("common.tooFrequently")});break;case 10011:ze.error({position:"top",content:x("create.extend_too_long_generate_failed")});break;case 10010:ze.error({position:"top",content:x("create.generate_failed_melody_feed")})}}catch(d){ht.setGenerating(!1,{skipHistory:!0,skipSave:!0})}},Be=()=>{var e,t;null==(t=null==(e=L.value)?void 0:e.triggerGenerateLyrics)||t.call(e,{})},je=()=>{const e="Instrumental"===H.value.type?3:0;Oe.getPromptRandomData({mode:e,last_id:b.lastRandomPromptId}).then(e=>{var t,a,n,l;200==e.code&&(b.lastRandomPromptId=null==(a=null==(t=e.data)?void 0:t.prompt)?void 0:a.id,F.value=((null==(l=null==(n=e.data.prompt)?void 0:n.content)?void 0:l.slice(0,26))??"").trim(),Ue())}).catch(e=>{})},Ne=({lyrics:e}={})=>{O.value=e||""};i(()=>g.renderPresetData,e=>{K.value=e}),i(()=>{var e,t,a,n;return(null==(t=null==(e=$.value)?void 0:e.instrument)?void 0:t.type)||(null==(n=null==(a=I.value)?void 0:a.instrument)?void 0:n.type)},e=>{e&&e!==H.value.type&&(H.value={type:e})},{immediate:!0}),i(se,(e,t)=>{e&&!t&&(z.value=!0,setTimeout(()=>{z.value=!1},1200))}),_(()=>{var e,t;if(j.value){const t=j.value.parentElement;De=t||j.value,N.value=(null==(e=null==De?void 0:De.getBoundingClientRect)?void 0:e.call(De).width)||0,Te=new ResizeObserver(e=>{var t,a;for(const n of e){const e=n.contentRect.width;e!==N.value&&(null==(t=V.value)||t.hidePopover(),null==(a=U.value)||a.hidePopover()),N.value=e}}),De&&Te.observe(De)}(null==(t=g.renderPresetData)?void 0:t.length)?K.value=g.renderPresetData:Ke(),document.addEventListener("click",Ee)}),M(()=>{Te&&De&&(Te.unobserve(De),Te.disconnect()),document.removeEventListener("click",Ee)});const Ve=e=>{var t,a,n,l,i,o,r;const s=null==e?void 0:e.type;if(!s)return;H.value={type:s};const c=I.value,d=$.value,u=(null==d?void 0:d.id)||(null==c?void 0:c.id)||null,p=!!u,v=(null==(t=null==d?void 0:d.instrument)?void 0:t.type)||(null==(a=null==c?void 0:c.instrument)?void 0:a.type)||(null==(l=null==(n=null==c?void 0:c.trackData)?void 0:n.instrument)?void 0:l.type)||null,m=(null==d?void 0:d.name)||(null==c?void 0:c.name)||(null==(i=null==c?void 0:c.trackData)?void 0:i.name)||"",g="string"==typeof m&&((e,t)=>{const a=ee(t);return!(!a||e!==a)||"Song"===t&&"New Track"===e})(m,v)?ee(s):null;if(p)return lt.setInstrument({trackId:u,instrument:{...(null==(o=d||c)?void 0:o.instrument)||{},type:s}}),void(g&&g!==m&&lt.rename({trackId:u,name:g}));c&&((null==c?void 0:c.instrument)?c.instrument={...c.instrument,type:s}:(null==(r=null==c?void 0:c.trackData)?void 0:r.instrument)&&(c.trackData.instrument={...c.trackData.instrument,type:s}),g&&g!==m&&(Object.prototype.hasOwnProperty.call(c,"name")?c.name=g:(null==c?void 0:c.trackData)&&Object.prototype.hasOwnProperty.call(c.trackData,"name")&&(c.trackData.name=g)))},Fe=()=>{G.value=!G.value,N.value>=790&&(W.value=G.value)},Ue=()=>{He()},He=ma.debounceImmediately(()=>{var e;(null==(e=F.value)?void 0:e.replace(/ {0,}\n{0,}/g,""))&&Ke(!1)},3e5),Ge=ma.debounceImmediately((e=!1)=>{Ke(e)},1e3),We=(e=!1)=>{Ge(e)},Ke=(e=!1)=>
1{if(1==Y.value)return;Y.value=!0;let t=(new Date).getTime();const a=t;g.changeRecommendPromptPresetData({mode:0,prompt:F.value}).then(()=>{a==t&&(Y.value=!1)}).catch(()=>{a==t&&(Y.value=!1)})},Xe=e=>{F.value.includes(e.content)||(F.value=F.value?(F.value+", "+e.content).slice(0,li):e.content),He()};return(e,t)=>{var a,n;return r(),o("div",{ref_key:"generateWrapperRef",ref:j,class:f(["generate-wrapper flex-center",te.value])},[s("div",ei,[se.value?(r(),o("div",{key:0,class:f(["generate-content-main flex-center",{"generate-content-main--expanded":G.value}])},[u(Gl,{lyrics:O.value,"onUpdate:lyrics":t[0]||(t[0]=e=>O.value=e),style:y(F.value),"onUpdate:style":t[1]||(t[1]=e=>F.value=e),gender:X.value,"onUpdate:gender":t[2]||(t[2]=e=>X.value=e),"operation-type":null==(a=v(P))?void 0:a.oparationTypeAfterSelection,"is-expanded":G.value,"show-lyrics":Ce.value,"show-style":_e.value,"lyrics-max-count":5e3,"style-max-count":li,"pre-set-tags":K.value,"random-batch-loading":Y.value,onRandomBatchClick:We,onPresetClick:Xe,onStyleInput:Ue,onGenerateLyrics:Be,onRandomStyleClick:je},null,8,["lyrics","style","gender","operation-type","is-expanded","show-lyrics","show-style","pre-set-tags","random-batch-loading"]),s("div",{class:f(["generate-content-row flex-center",{"expanded-row":G.value}])},[s("div",ti,[s("div",{class:"extend flex-center pointer",onClick:Fe},[s("i",{class:f(["icon-full-screen",{"icon-full-screen-active":G.value}])},null,2)]),s("div",ai,[u(_l,{instrument:(null==(n=$.value)?void 0:n.instrument)??H.value,"show-name":!ae.value,"popper-skid":-16,onChange:Ve},null,8,["instrument","show-name"])])]),u(Zl,{ref_key:"lyricsInputRef",ref:V,"model-value":O.value,"should-show":Ae.value,"max-length":26,"max-count":5e3,"is-small-screen":ae.value,"wrapper-ref":j.value,placeholder:"Lyrics",title:"Lyrics","onUpdate:modelValue":t[3]||(t[3]=e=>O.value=e),onClick:Se},{icon:p(()=>[...t[7]||(t[7]=[s("i",{class:"edit-icon"},null,-1)])]),_:1},8,["model-value","should-show","is-small-screen","wrapper-ref"]),u($l,{ref_key:"styleInputRef",ref:U,"model-value":F.value,"should-show":!G.value,"is-only-style-content":ne.value,"max-length":26,"max-count":li,"is-small-screen":ae.value,"wrapper-ref":j.value,"operation-type":q.value,"show-lyrics":Ce.value,gender:X.value,"onUpdate:modelValue":t[4]||(t[4]=e=>F.value=e),"onUpdate:gender":t[5]||(t[5]=e=>X.value=e),onInput:Ue,onClick:Me},null,8,["model-value","should-show","is-only-style-content","is-small-screen","wrapper-ref","operation-type","show-lyrics","gender"]),ce.value?(r(),T(da,{key:0,content:ke.value,position:"top",disabled:!ke.value},{default:p(()=>[u(v(Ye),{disabled:me.value,loading:Q.value,onClick:Le},{prefix:p(()=>[u(v(xe),{color:"#000",name:"biz-music-create",size:"20"})]),default:p(()=>[s("span",null,h(le.value),1)]),_:1},8,["disabled","loading"])]),_:1},8,["content","disabled"])):c("",!0)],2)],2)):c("",!0),se.value?(r(),T(Ea,{key:1,variant:"studio",margin:"0"})):c("",!0),be.value?(r(),o("div",{key:2,class:f(["generate-content-version flex-center pointer",{"generate-content-version-disabled":we.value}])},[t[8]||(t[8]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[s("path",{d:"M4 8L8 4L12 8",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),s("path",{d:"M8 4L8 13",stroke:"white","stroke-width":"1.33","stroke-linecap":"round"})],-1)),s("div",{class:"copy-to-main-track",onClick:Pe}," Copy to Main Track ")],2)):c("",!0),u(R,{name:"glow-fade"},{default:p(()=>[z.value?(r(),o("div",ni)):c("",!0)]),_:1})]),u(La,{ref_key:"refLyricDialog",ref:L,visible:B.value,"onUpdate:visible":t[6]||(t[6]=e=>B.value=e),"only-render-mode":!0,"show-title":!1,onApplyLyrics:Ne},null,8,["visible"])],2)}}},[["__scopeId","data-v-1e37e06f"]]),oi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%3e%3cpath%20d='M8.79289%204H3.20711C2.76165%204%202.53857%204.53857%202.85355%204.85355L5.64645%207.64645C5.84171%207.84171%206.15829%207.84171%206.35355%207.64645L9.14645%204.85355C9.46143%204.53857%209.23835%204%2
108.79289%204Z'%20fill='white'%20fill-opacity='0.6'/%3e%3c/svg%3e",ri="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M2.5%208.5L6%2012L13%205'%20stroke='%2329CC6A'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",si={class:"history-container"},ci={class:"history-title"},di={class:"history-content"},ui={class:"date-picker-text"},pi={class:"time-line-container"},vi={class:"time-line-item time-line-item-hour"},mi={key:0,class:"dots-line-top"},gi={class:"dots"},hi={class:"hour-text"},fi={class:"expand-btn"},yi=["onClick"],ki={key:1,class:"dots-line-bottom"},bi=["onClick"],wi={class:"dots-line-top"},Ai={class:"dots"},Ci={class:"time-text"},_i={key:0,class:"dots-line-bottom"},Ti={key:0,class:"date-picker-container"},xi=["onClick"],Di={class:"date-picker-item-text"},Ii={key:0,src:ri},Si=Te({__name:"History",emits:["close-history","select-time"],setup(e,{emit:t}){const n=rt(),l=t,i=a(!1),v=a(),y=a(null),k=a(),b=a(null),w=()=>{i.value=!i.value},A=(e,t)=>{for(let a=v.value.length-1;a>=0;a--){const n=v.value[a];if(Array.isArray(n.times)&&n.times.length>0)return e===a&&t===n.times.length-1}return!1},C=e=>{y.value=N(e.date),T(e),i.value&&w()},T=async e=>{const t=await de({project_id:n.projectId,version_dt:e.version_dt});if(200===t.code){const{list:e}=t.data;Array.isArray(e)&&(v.value=e.map((e,t)=>({hour:`${e.version_hour}:00`,open:0===t,times:e.list.map(e=>({time:Xe(1e3*e.created_at,"hh:mm:ss"),version_id:e.version_id}))})))}};return _(()=>{(async()=>{const{code:e,data:t}=await se({project_id:n.projectId});if(200===e){const{list:e}=t;Array.isArray(e)&&(k.value=e.map((e,t)=>{const a=Xe(1e3*e.version_dt_unix,"YYYY.MM.DD");return 0===t&&C({date:a,version_dt:e.version_dt}),{date:a,version_dt:e.version_dt}}))}})()}),(e,t)=>(r(),o("div",si,[s("div",ci,[t[1]||(t[1]=m(" History ",-1)),s("img",{class:"pointer",src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M11.5254%203.60352C11.7695%203.44271%2012.1016%203.46881%2012.3164%203.68359C12.5312%203.89838%2012.5573%204.23052%2012.3965%204.47461L12.3164%204.57422L8.89062%208L12.3164%2011.4258L12.3965%2011.5254C12.5573%2011.7695%2012.5312%2012.1016%2012.3164%2012.3164C12.1016%2012.5312%2011.7695%2012.5573%2011.5254%2012.3965L11.4258%2012.3164L8%208.89062L4.57422%2012.3164L4.47461%2012.3965C4.23051%2012.5573%203.8984%2012.5312%203.68359%2012.3164C3.4688%2012.1016%203.44267%2011.7695%203.60352%2011.5254L3.68359%2011.4258L7.10938%208L3.68359%204.57422L3.60352%204.47461C3.44267%204.2305%203.4688%203.89839%203.68359%203.68359C3.89839%203.46882%204.23051%203.44267%204.47461%203.60352L4.57422%203.68359L8%207.10938L11.4258%203.68359L11.5254%203.60352Z'%20fill='white'/%3e%3c/svg%3e",alt:"close-history",onClick:t[0]||(t[0]=e=>l("close-history"))})]),t[5]||(t[5]=s("div",{class:"line"},null,-1)),s("div",di,[s("div",{class:"date-picker pointer",onClick:w},[s("div",ui,h(y.value||"Select Date"),1),s("img",{src:oi,class:f({open:i.value})},null,2)]),s("div",pi,[(r(!0),o(d,null,g(v.value,(e,a)=>(r(),o("div",{key:e.hour,class:"time-line-item-wrapper"},[s("div",vi,[a>0?(r(),o("div",mi,[(r(),o(d,null,g(5,e=>s("div",{key:e,class:"dot small-dot"})),64))])):c("",!0),s("div",gi,[t[2]||(t[2]=s("span",{class:"dot big-dot"},null,-1)),(r(),o(d,null,g(4,e=>s("span",{key:e,class:"dot small-dot"})),64))]),s("div",hi,h(e.hour),1),s("div",fi,[s("img",{class:f(["pointer",{open:e.open}]),src:oi,alt:"history-arrow",onClick:t=>{var a;(a=e).open=!a.open}},null,10,yi)]),a!==v.value.length-1||e.open?(r(),o("div",ki,[(r(),o(d,null,g(5,e=>s("div",{key:e,class:"dot small-dot"})),64))])):c("",!0)]),e.open?(r(!0),o(d,{key:0},g(e.times,(e,l)=>(r(),o("div",{key:e.version_id,class:f(["time-line-item time-line-item-time",{selected:b.value===e.version_id}]),onClick:t=>(async({version_id:e})=>{b.value=e;const t=await ce({project_id:n.projectId,version_id:e});if(200===t.code){const e=JSON.parse(t.data.data);n.startPreviewWithState(e.state,{forceRender:!0})}})(e)},[s("div",wi,[(r(),o(d,null,g(5,e=>s("div",{key:e,class:"dot small-dot"})),64))]),s("div",Ai,[t[3]||(t[3]=s("span",{class:"dot big-dot"},null,-1)),(r(),o(d,null,g(4,e=>s("span",{key:e,class:"dot small-dot"})),64))]),s("div",Ci,h(e.time),1),t[4]||(t[4]=s("img",{class:"pointer select-icon",src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M2.66602%208H13.3327M13.3327%208L9.33268%204M13.3327%208L9.33268%2012'%20stroke='%2348e1eb'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"history-arrow-right"},null,-1)),A(a,l)?c("",!0):(r(),o("div",_i,[(r(),o(d,null,g(5,e=>s("div",{key:e,class:"dot small-dot"})),64))]))],10,bi))),128)):c("",!0)]))),128))]),u(R,{name:"date-picker-fade"},{default:p(()=>[i.value&&k.value.length>0?(r(),o("div",Ti,[(r(!0),o(d,null,g(k.value,e=>(r(),o("div",{key:e.date,class:"date-picker-item pointer",onClick:t=>C(e)},[s("div",Di,h(e.date),1),N(e.date)===y.value?(r(),o("img",Ii)):c("",!0)],8,xi))),128))])):c("",!0)]),_:1})])]))}},[["__scopeId","data-v-b26db48c"]]),Mi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M2%205.99998H11C12.6569%205.99998%2014%207.34313%2014%208.99998C14%2010.6568%2012.6569%2012%2011%2012H7M2%205.99998L4.66667%203.33331M2%205.99998L4.66667%208.66665'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Ei="studio-project-id",Pi=k("useProjectStore",()=>{const e=Qe(),t=rt(),n=wn(),l=a([]),i=a(null),o=a(!1),r=a(!1),s=a(!1),c=a(!1),d=a(!1),u=a(!1),p=a([]),v=a(null),m=a(!1),g=a(!1),h=a(!1),f=a(!1),y=a(!1),k=e=>{if(e){const t={project_id:e};localStorage.setItem(Ei,JSON.stringify(t))}},b=()=>{const e=localStorage.getItem(Ei);if(!e)return null;const t=JSON.parse(e);return(null==t?void 0:t.project_id)||null},w=async(e={})=>{const t=await ue({project_name:e.name||"New Project"});if(200==t.code){t.data&&A(t.data);const e=n.addTrack({},!0);return pt.setFollowTrack(e.id,{skipHistory:!0,skipNotify:!0}),t.data}throw new Error(t.message||"创建项目失败")},A=a=>{var n;const{project_id:l,project_name:i,project_cover_url:o,version_id:r,data:s}=a;if(l&&(k(a.project_id),t.setProjectId(l)),i&&t.setProjectName(i),o&&t.setProjectImageUrl(o),r&&(t.versionId=r),s){const a=JSON.parse(s),l=null==a?void 0:a.state;
1l.generating=!1,l.timing&&"object"==typeof l.timing||(l.timing={...pe.timing}),l.timing.type="manual",l.timing.trackId=null,(null==l?void 0:l.tracks)&&Array.isArray(l.tracks)&&l.tracks.forEach(e=>{e.clips&&Array.isArray(e.clips)&&(e.clips=e.clips.filter(e=>null!=e.clipId&&""!==e.clipId&&"string"==typeof e.srcPathKey&&!e.srcPathKey.startsWith("uploading_"))),e.clipCreationIntents=[],e.takeLanes&&Array.isArray(e.takeLanes)&&e.takeLanes.forEach(e=>{e.clips&&Array.isArray(e.clips)&&(e.clips=e.clips.filter(e=>null!=e.songId&&""!==e.songId)),e.clipCreationIntents=[]})}),t.setState(l),t.setHistory(l),e.emit("renderAll"),null==(n=nt.MainManagerDispatcher)||n.initAllDatas({trackDatas:l.tracks,selectionData:l.selection,playerData:{loop:l.loop.enabled,loopStartTime:l.loop.startTime,loopEndTime:l.loop.endTime},timing:l.timing})}else t.resetStudioStore(),t.setHistory(pe),e.emit("renderAll")},C=async e=>{if(!e)throw new Error("项目ID不能为空");bt.markStart("project_api");try{const t=await ce({project_id:e});return 200==t.code?(A(t.data),null==t?void 0:t.data):(await w({name:"New Project"}),null)}finally{bt.markEnd("project_api")}},_=()=>!!u.value&&(He({width:"480px",titleAlign:"left",showCloseBtn:!0,title:"Duplicate Project",content:"This project was shared by another user , to make any edits you have to duplicate it to your own account.",confirmLabel:"Duplicate",cancelLabel:"Cancel",confirm:e=>{e()},cancel:e=>{e()}}),!0);return{projects:l,projectsLastId:i,projectsRefreshing:o,projectsLoadingMore:r,projectsIsLoading:s,projectsFinished:c,projectsLoaded:d,deletedProjects:p,deletedLastId:v,deletedRefreshing:m,deletedLoadingMore:g,deletedIsLoading:h,deletedFinished:f,deletedProjectsLoaded:y,isSharedProject:u,emitter:e,fetchProjects:async({isRefresh:e=!1,filterValue:t="",done:a,errordone:n}={})=>{var u,p,v;try{e?(o.value=!0,i.value=null):r.value=!0,s.value=!0;const n={page_size:20,t:1};e||null===i.value||(n.last_id=i.value),t&&(n.keyword=t);const m=await ve(n);if(200!=m.code)throw new Error(m.message||"获取项目列表失败");{const t=(null==(u=m.data)?void 0:u.list)||[];e?(l.value=t,d.value=!0):l.value=[...l.value,...t],void 0!==(null==(p=m.data)?void 0:p.last_id)&&(i.value=m.data.last_id);const n=(null==(v=m.data)?void 0:v.list)&&m.data.list.length>0;c.value=!n,null==a||a(l.value,c.value)}}catch(m){null==n||n(m)}finally{o.value=!1,r.value=!1,s.value=!1}},fetchDeletedProjects:async({isRefresh:e=!1,filterValue:t="",done:a,errordone:n}={})=>{var l,i,o;try{e?(m.value=!0,v.value=null):g.value=!0,h.value=!0;const n={page_size:20,t:2};e||null===v.value||(n.last_id=v.value),t&&(n.keyword=t);const r=await ve(n);if(200!=r.code)throw new Error(r.message||"获取已删除项目列表失败");{const t=(null==(l=r.data)?void 0:l.list)||[];e?(p.value=t,y.value=!0):p.value=[...p.value,...t],void 0!==(null==(i=r.data)?void 0:i.last_id)&&(v.value=r.data.last_id);const n=(null==(o=r.data)?void 0:o.list)&&r.data.list.length>0;f.value=!n,null==a||a(p.value,f.value)}}catch(r){null==n||n(r)}finally{m.value=!1,g.value=!1,h.value=!1}},resetLoadedState:()=>{d.value=!1,y.value=!1},createNewProject:w,setProjectInfo:A,loadAndSetProjectInfo:C,checkIsSharedProject:_,checkAndCreateProject:async()=>{var e,t;const a=O();if(u.value=!!(null==(e=null==a?void 0:a.query)?void 0:e.project_version_id),_())return;const l=b();if(l)return void(await C(l));const i=await ve(),o=(null==(t=null==i?void 0:i.data)?void 0:t.list)||[];if(o.length>0){const e=o[0];return void(await C(e.project_id))}await w({name:"New Project"}),n.addTrack({},!0)},renameProjectById:async(e,a)=>{const n=await me({project_id:e,new_project_name:a});if(200==n.code){const i=l.value.findIndex(t=>t.project_id===e);-1!==i&&(l.value[i]={...l.value[i],project_name:a});const o=p.value.findIndex(t=>t.project_id===e);-1!==o&&(p.value[o]={...p.value[o],project_name:a});return(t.projectId||b())==e&&t.setProjectName(a),n.data}throw new Error(n.message||"重命名项目失败")},saveProjectIdToStorage:k,getProjectIdFromStorage:b,deleteProjectById:async e=>{const t=await ge({project_id:e.project_id});if(200==t.code)return l.value=l.value.filter(t=>t.project_id!==e.project_id),p.value=[e,...p.value],t.data},restoreProjectById:async e=>{const t=await he({project_id:e.project_id});return 200==t.code&&(p.value=p.value.filter(t=>t.project_id!==e.project_id),l.value=[e,...l.value]),t.data},copyProjectById:async e=>{var t;const a=await fe({project_id:e.project_id});if(200==a.code)return l.value=[null==(t=a.data)?void 0:t.project,...l.value],a.data}}}),Li="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHHSURBVHgB7ZqLcYMwDIZFrwNkBDpCN2g26AiM0A2SEToCnYBsQDtBswFsQDZQpcP0XMBgZMBuzt+djpeRrPj3WeYCEPnnIOKB7ERWkjW4Po3yncHakNOUrML9qDim3ocEHGCHdEhhX2qy5yRJbnzxAELUkKawPynZG7iidKmT94d3DbCVad6LVYIrOJywKWyESkKn6Z6J5wB70a9Jk07zSRpPPAdCISbgm5iAbwYJoGVtM/KeLfdd20z07Q/d/aTXyHttY0LvNDNYBzDWNtZxRLWNSUJ6gyBqm4l3pucAoqy2odcOdMjIWMOXOS1L4822N2Vo0ZFiiRSk8bYcgV3eM7WPpYRvYgK+uf8EsK1OSzQw0t5EodaMxeBwUb1ZJ0C8kr2AO+wng4Wozp96t6/dySPMI/rVDBhX6bHRnOBj1MGYNJSECnSn1CWEciq938GsxJbUZEcKUXc3bCTkG5Yda/6L7L1fLAaTgPTLXlzIfBMTID618wvszFpbSl5l+ZhvtaW0cRj0pt6ELqFr79kJN/q
1sAhO1jYvjM/ojAyH6HGANf4OHT4sk/ycQ8ishNfmO0NYbe1GrmOvCQ4rb/3XgjMINTiQkfgDbTyh2whXLEwAAAABJRU5ErkJggg==",Ri="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK7SURBVHgB7ZlBdtMwEEBn5LwHu4YTVNwgPQGPPaXpgtIdHAFOQLgBvUHZ8ProxsAFuEF9A3SEdMMKexjbeakt29HYlvrSV/9F26mikUYjzYwUgImJxw3CSOjs9Tv++YX/nEM/DA+/wu8/v8IIFIwFaQX9J5+jN4aPYrwBhEMmvwHXMJLxBij6CIgGesOTJ/oMEw+cRhQaEVVCY9qiVvMMDI8qodFtUatpwKioEppm1GoaMDiqhKY9ajkzMb09/gOUu2+Dip7jVWwgAPRmuQBMb+7+gwnv+aNdfSR5wFiyhlBE/+rbF8mZ6NwGENSVZOlenRGBB/C2JlLICIW6Livj6DDAAyqgAfbiZOmtq8vM9QE+5nUDOsJsJQGu2xKOq/1ON1XGVh7OgH2QKJt3fG4FZQLUrWWyq73QDQEOse0BFR1A++C6Is17t5djWVsIPBjQUJI9g1AgHdbkKDKuLm4DVMONB7BHCMLozNRECpjI7AChfGyh+wTJ/xloqXs0hMLyrqTm2i8PDEBmANYLOjpfavBMi04DAvbHA6mdG2RPLlIDjCVr8M2AUjpHZoCopK6uWNuNztU+DKEHBCX19ira8WDlagfUVgcDAtzVaE7ugerls6Wkxqtfl/zrskuFq31IKV1ORYKwpB6FrVNQSucIDbAOFOIh+EfvHLODYR4IUZHalSj5zANplFjKX4BvCBc1eeYupXNEBuB1nFiJZc5XxE/gCTp7xbqqhRwa/BYnkr6yKFSQXbDiyqRpxY9emi8dF/AXDMaxaM9uey+Xc3gKC8iyE5Y+1BqRfkv1iL8jKwZ8kt1wDNcQFM4VSr2Uvv6Ja6FihSN16uNroR2jrGGmTvs8XfYq5op9qdRRmMdf1jnjlRfu/W0vGAidH7/naHTC0UND+VTSM7nxapexPuGb1w+8LjL1xMRET/4DsWP6c1Ngv7AAAAAASUVORK5CYII=",Bi=["alt"],ji={class:"project-item-content flex1 flex-column"},Ni={key:0,class:"project-item-text"},Oi={class:"project-item-text olh"},Vi={class:"project-item-time"},Fi={class:"project-item-op-popover"},Ui=Te({__name:"ProjectCard",props:{projectData:{type:Object,required:!0,default:()=>({})},type:{type:String,default:"project",validator:e=>["project","deleted","add"].includes(e)}},emits:["rename","duplicate","delete","restore","add","select"],setup(e,{emit:t}){const n=ot(),l=rt(),i=t,m=a({}),g=a(!1),y=()=>{g.value=!0},k=()=>{g.value=!1},b=e=>{if(!e)return"2025.11.23";const t=new Date(e);return`${t.getFullYear()}.${String(t.getMonth()+1).padStart(2,"0")}.${String(t.getDate()).padStart(2,"0")}`};return(t,a)=>{const w=la;return r(),o("div",{class:f(["project-item flex pointer",{"project-item--add":"add"===e.type}]),onClick:a[5]||(a[5]=t=>{return"add"===e.type?(n.pauseTonePlayer(),void i("add")):(a=e.projectData,n.pauseTonePlayer(),void i("select",a));var a})},[s("div",{class:f(["project-item-icon pointer",{"flex-center":"add"===e.type,pointer:"add"===e.type}])},["add"==e.type?(r(),o("img",{key:0,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADCSURBVHgB7dnRCcIwFIXhEydwFDcwI3QTdQLjCG7iCHGDblI3iBdJQDAPUk7hlp4PQkug8PchJaHA1pRSTjamOq7wxqKG8iuCYAeeQ2cugoAZuRhFsiiSRZEsimRRJIsiWVYRGdpN3ftFzHfsPJ9tPDHfGEJ4fCLrLjrBp0uLnOyyh0+vVS2cG/y6fy+cAf1zyr+WWDjZFk4Gi71k6pwWEwj0MWdRJIsiWRTJokgWRbIokoUZmTtzI7ype8r2i+QMkjdrSmWW3xYiHAAAAABJRU5ErkJggg==",alt:e.projectData.name||"Project"},null,8,Bi)):(r(),T(Ta,{key:1,src:v(je)(e.projectData.project_cover_url)},null,8,["src"]))],2),s("div",ji,["add"===e.type?(r(),o("div",Ni,"New Project")):(r(),o(d,{key:1},[s("div",Oi,h(e.projectData.project_name),1),s("div",Vi,h(b(1e3*e.projectData.updated_at)),1)],64))]),"add"!==e.type?(r(),T(w,{key:0,ref:t=>((e,t)=>{t&&(m.value[e]=t)})(e.projectData.project_id,t),"popper-class":"project-item-op-popover-box",placement:"bottom-end",width:"200","show-arrow":!1,teleported:!0,trigger:"click","popper-options":{strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,8]}}]},onShow:y,onHide:k},{reference:p(()=>[s("div",{class:f(["project-item-op",{"project-item-op--highlight":g.value}]),onClick:a[0]||(a[0]=x(()=>{},["stop"]))},[u(v(xe),{name:"sys-more-vertical",opacity:.6})],2)]),default:p(()=>[s("div",Fi,["deleted"===e.type?(r(),o("div",{key:0,class:"project-item-op-popover-item",onClick:a[1]||(a[1]=t=>{return a=e.projectData,null==(n=m.value[a.project_id])||n.hide(),void i("restore",a);var a,n})},[...a[6]||(a[6]=[s("img",{src:Mi,alt:""},null,-1),s("div",{class:"project-item-op-popover-item-text"},"Restore",-1)])])):(r(),o(d,{key:1},[s("div",{class:"project-item-op-popover-item",onClick:a[2]||(a[2]=t=>{return a=e.projectData,null==(n=m.value[a.project_id])||n.hide(),void i("rename",a);var a,n})},[...a[7]||(a[7]=[s("img",{src:$,alt:""},null,-1),s("div",{class:"project-item-op-popover-item-text"},"Rename",-1)])]),s("div",{class:"project-item-op-popover-item",onClick:a[3]||(a[3]=t=>{return a=e.projectData,null==(n=m.value[a.project_id])||n.hide(),void i("duplicate",a);var a,n})},[...a[8]||(a[8]=[s("img",{src:Li,alt:""},null,-1),s("div",{class:"project-item-op-popover-item-text"},"Duplicate",-1)])]),s("div",{class:"project-item-op-popover-item",onClick:a[4]||(a[4]=t=>{return a=e.projectData,null==(n=m.value[a.project_id])||n.hide(),void(a.project_id!=l.projectId?i("delete",a):Se.info({content:"Cannot delete the current project",position:"top"}));var a,n})},[...a[9]||(a[9]=[s("img",{src:Ri,alt:""},null,-1),s("div",{class:"project-item-op-popover-item-text project-item-op-popover-item-text--del"}," Delete ",-1)])])],64))])]),_:1},512)):c("",!0)],2)}}},[["__scopeId","data-v-51cbf66a"]]),Hi={class:"rename-dialog-content"},Gi={class:"rename-input-wrapper"},Wi={class:"char-count"},Ki={class:"rename-dialog-btn flex-center"},Yi=Te({__name:"renameDialog",props:{visible:{type:Boolean,default:!1},projectName:{type:String,default:""},projectId:{type:Number,default:null}},emits:["update:visible"],setup(e,{emit:t}){const n=Pi(),i=e,o=t,c=a(null),d=C({visible:i.visible,newName:i.projectName}),g={newName:[{required:!0,message:"Project name is required",trigger:["blur","change"]}]},f=l(()=>d.newName?d.newName.length:0),y=async()=>
1{if(c.value)try{await c.value.validate(),n.renameProjectById(i.projectId,d.newName),d.visible=!1,o("update:visible",!1)}catch(e){}},k=()=>{d.visible=!1,o("update:visible",!1)};return(e,t)=>{const a=ra,n=oa;return r(),T(Pe,{width:"500px",visible:d.visible,title:"Rename","mobile-render-type":"drawerDialog","title-align":"left","custom-class":"rename-dialog","hide-close-btn":!0,onClose:k},{default:p(()=>[s("div",Hi,[u(n,{ref_key:"formRef",ref:c,model:d,rules:g,"label-position":"top",onSubmit:t[1]||(t[1]=x(()=>{},["prevent"]))},{default:p(()=>[u(a,{label:"Projects name",prop:"newName"},{default:p(()=>[s("div",Gi,[P(s("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>d.newName=e),type:"text",class:"rename-dialog-input",maxlength:"50"},null,512),[[V,d.newName]]),s("span",Wi,h(f.value)+"/50",1)])]),_:1})]),_:1},8,["model"]),s("div",Ki,[u(v(Ye),{class:"rename-dialog-button rename-dialog-button--cancel",type:"secondary",appearance:"inverse",onClick:k},{default:p(()=>[...t[2]||(t[2]=[m(" Cancel ",-1)])]),_:1}),u(v(Ye),{class:"rename-dialog-button rename-dialog-button--save",onClick:y},{default:p(()=>[...t[3]||(t[3]=[m(" Save ",-1)])]),_:1})])])]),_:1},8,["visible"])}}},[["__scopeId","data-v-2306fbfd"]]);function zi(e){var t,a,n;const l=document.createElement("div");document.body.appendChild(l);const i=F(Yi,{...e,visible:!0,remove(){i.unmount(l),document.body.removeChild(l)}});return i.config.globalProperties={...(null==(n=null==(a=null==(t=null==window?void 0:window.$getVueCurrentInstance())?void 0:t.appContext)?void 0:a.config)?void 0:n.globalProperties)??{},...i.config.globalProperties},i.mount(l)}const Xi={class:"my-project-dialog-content height-all flex-column"},Qi={class:"my-project-dialog-toolbar flex-space-between"},qi={class:"search-box"},Zi={class:"my-project-dialog-content-list flex1"},Ji={class:"my-project-dialog-content-list-item-box flex"},$i={key:0,class:"deletedTips"},eo=Te({__name:"myProjectDialog",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(e,{emit:t}){var a;const n=rt(),f=Pi(),y=null==(a=w())?void 0:a.appContext.config.globalProperties,{$$t:k}=null==y?void 0:y.$i18n,b=e,A=C({visible:b.visible,filterValue:"",tabList:["Projects","Deleted"],activeIndex:0}),_=ha("/mureka/icons/biz-empty-search-bg-2884ca35.webp"),x=l(()=>0===A.activeIndex?f.projects||[]:f.deletedProjects||[]),D=l({get:()=>0===A.activeIndex?f.projectsRefreshing:f.deletedRefreshing,set:e=>{0===A.activeIndex?f.projectsRefreshing=e:f.deletedRefreshing=e}}),I=l({get:()=>0===A.activeIndex?f.projectsLoadingMore:f.deletedLoadingMore,set:e=>{0===A.activeIndex?f.projectsLoadingMore=e:f.deletedLoadingMore=e}}),S=l({get:()=>0===A.activeIndex?f.projectsIsLoading:f.deletedIsLoading,set:e=>{0===A.activeIndex?f.projectsIsLoading=e:f.deletedIsLoading=e}}),M=l({get:()=>0===A.activeIndex?f.projectsFinished:f.deletedFinished,set:e=>{0===A.activeIndex?f.projectsFinished=e:f.deletedFinished=e}}),E=t,P=e=>{zi({projectId:e.project_id,projectName:e.project_name||"Project Name"})},L=e=>{f.copyProjectById(e)},R=e=>{He({width:"480px",titleAlign:"start",showCloseBtn:!0,content:"Are you sure you want to delete the current project?",confirmLabel:k("create.delete"),cancelLabel:k("create.cancel"),confirm:t=>{f.deleteProjectById(e),t()},cancel:e=>{e()}})},B=e=>{He({width:"335px",titleAlign:"start",showCloseBtn:!0,content:"Are you sure you want to Restore this project?",confirmLabel:k("common.restore"),cancelLabel:k("create.cancel"),confirm:t=>{f.restoreProjectById(e),t()},cancel:e=>{e()}})},j=async()=>{await f.createNewProject({name:"New Project"}),n.save(void 0,!0),K()},N=async e=>{0===A.activeIndex&&(await f.loadAndSetProjectInfo(e.project_id),K())},O=l({get:()=>A.activeIndex,set:e=>{var t;t=Number(e),A.activeIndex!==t&&(A.activeIndex=t,A.filterValue="",0!==t||f.projectsLoaded?1!==t||f.deletedProjectsLoaded||f.fetchDeletedProjects({isRefresh:!0,filterValue:""}):f.fetchProjects({isRefresh:!0,filterValue:""}))}}),V=()=>{0===A.activeIndex?f.fetchProjects({isRefresh:!0,filterValue:A.filterValue}):f.fetchDeletedProjects({isRefresh:!0,filterValue:A.filterValue})},F=()=>{V()},U=()=>{V()},H=()=>{V()},G=()=>{0===A.activeIndex?f.fetchProjects({isRefresh:!0,filterValue:""}):f.fetchDeletedProjects({isRefresh:!0,filterValue:""})},W=(e,t)=>{0===A.activeIndex?f.fetchProjects({isRefresh:!1,filterValue:A.filterValue,done:e,errordone:t}):f.fetchDeletedProjects({isRefresh:!1,filterValue:A.filterValue,done:e,errordone:t})},K=()=>{A.visible=!1,E("update:visible",!1),f.resetLoadedState()};return i(()=>b.visible,e=>{A.visible=e,e&&(0===A.activeIndex?f.fetchProjects({isRefresh:!0,filterValue:A.filterValue}):f.fetchDeletedProjects({isRefresh:!0,filterValue:A.filterValue}))},{immediate:!0}),(e,t)=>(r(),T(Pe,{width:"720px",height:"440px",visible:A.visible,title:"My Projects","mobile-render-type":"drawerDialog","title-align":"left","custom-class":"my-project-dialog",onClose:K},{default:p(()=>[s("div",Xi,[s("div",Qi,[u(v(qe),{modelValue:O.value,"onUpdate:modelValue":t[0]||(t[0]=e=>O.value=e),class:"tab-container",variant:"segment",appearance:"white"},{default:p(()=>[(r(!0),o(d,null,g(A.tabList,(e,t)=>(r(),T(v(Ze),{key:t,value:t},{default:p(()=>[m(h(v(k)(e)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),s("div",qi,[u(Ba,{modelValue:A.filterValue,"onUpdate:modelValue":t[1]||(t[1]=e=>A.filterValue=e),"render-style":{"--height":"40px","--padding":"0 14px","--borderRadius":"12px","--border":"1px solid rgba(255, 255, 255, 0.08)","--borderHover":"1px solid rgba(255, 255, 255, 0.08)","--focusBorder":"1px solid rgba(255, 255, 255, 0.08)","--background":"rgba(255, 255, 255, 0.04)","--backgroundHover":"rgba(255, 255, 255, 0.04)","--backgroundFocus":"rgba(255, 255, 255, 0.04)","--fontSize":"12px","--fontColor":"#fff","--fontFamily":"var(--font-body)","--fontWeight":"400","--lineHeight":"18px"},clearable:"",placeholder:"Search voice, genre, mood...",onKeyupEnter:U,onInput:F,onBlur:H,onClear:G},null,8,["modelValue"])])]),s("div",Zi,[u(pa,{refreshing:D.value,"onUpdate:refreshing":t[2]||(t[2]=e=>D.value=e),"loading-more":I.value,"onUpdate:loadingMore":t[3]||(t[3]=e=>I.value=e),"is-loading":S.value,"onUpdate:isLoading":t[4]||(t[4]=e=>
1S.value=e),finished:M.value,"onUpdate:finished":t[5]||(t[5]=e=>M.value=e),datas:x.value,"disabled-refresh":!0,onLoadMore:W},{customContent:p(()=>[s("div",Ji,[0===A.activeIndex?(r(),T(Ui,{key:0,class:"project-card-item","project-data":{name:"New Project"},type:"add",onAdd:j})):c("",!0),(r(!0),o(d,null,g(x.value,e=>(r(),T(Ui,{key:e.id||e,class:"project-card-item","project-data":"string"==typeof e?{id:e,name:e}:e,type:0===A.activeIndex?"project":"deleted",onRename:P,onDuplicate:L,onDelete:R,onRestore:B,onSelect:N},null,8,["project-data","type"]))),128))]),0!==x.value.length||D.value||S.value?c("",!0):(r(),T(va,{key:0,type:"emptydata","empty-icon-url":v(_),info:{emptydata:0===A.activeIndex?"No projects":"No deleted projects"},"hide-retry":!0},null,8,["empty-icon-url","info"]))]),_:1},8,["refreshing","loading-more","is-loading","finished","datas"])]),1===A.activeIndex?(r(),o("div",$i,[...t[6]||(t[6]=[s("img",{class:"deletedTipsIcon",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIXSURBVHgB7VY9UkJBDM5zHGmgggZ6sIEGKi9ghQfwAh7NC0DjBbTCBho4gDQ+GmigwXy8b+W5w/4AbwYLvpkYhGzybbLZjcgVF0ZyjPF2u22oqqtAl1Uq/GmtslBJVWZJknzH+owiwMA9Bo/BXGWkRL5ChkkgcElVV6XDrzYqMxU4TjXAknbIBKQl++wAY5VPtVsfTYBOH1WqDAxnE5+z3Fpkq8d/UZaha13icICd9xl8pTIwu40FN/AkWTacJG4c67vnBAe4ZkAfVfqUIAEeOFNzZ3CkWeWF6Q6RQAk79O0nIPvajQI771naR2Lssv1DQBnWJGu1lS4ciR8jS/sAAshC3c7CrWXYpA73b0YwJjhsNxp4Kllp63n/dglq1DMpHnNqbwaq1MFTrzt65kdcNFMJI6Uu57+0M3CHP5FthzsEvf4QYZv3WfERiIY6fOXHOzkDNoH83V4ocj43PgIr6qoUD0MgFQ8B0x4NKR6tGAKmVVp8kIqEmSVmTgIcIEACB6stYezqmWvJg+B7gRLM7WnpUBeY260TcRg/JDs3obni932xf3fNA+htXJvoiuEpz3EuOOYKaAwz77aN6x4A05QL+6e0pRV8IY53I3Yk25GKeCHNNNWmlBj8zZXF0FCKw4j6mQEFTnBIcZKX1lAKomjfJgMDExI/fii1iFxmLD9ABLu8l2y3EPMOIBPohl0bxwS+4t/gBwbg1nQs35YjAAAAAElFTkSuQmCC",alt:"iconInfo"},null,-1),m(" Only keep projects deleted in the past month ",-1)])])):c("",!0)])]),_:1},8,["visible"]))}},[["__scopeId","data-v-0fd96502"]]);const to={class:"share-project-dialog-content flex-column"},ao={class:"share-btn"},no=Te({__name:"shareProjectDialog",props:{visible:{type:Boolean,default:!1},projectName:{type:String,default:""}},emits:["update:visible"],setup(e,{emit:t}){var a;const n=null==(a=w())?void 0:a.appContext.config.globalProperties,l=rt(),i=t,o=C({visible:e.visible}),c=()=>{n.logClickEvent("project_share_copy_link",{}),o.visible=!1,i("update:visible",!1);const e=`${fa.baseOrigin}/studio?project_version_id=${l.versionId}`;ya(e).then(e=>{ze.success({content:"The project link is copied",position:"top"})})},d=()=>{o.visible=!1,i("update:visible",!1)},v=()=>{};return(t,a)=>(r(),T(Pe,{width:"480px",visible:o.visible,title:`Share "${e.projectName}"`,"mobile-render-type":"drawerDialog","title-align":"left","custom-class":"share-project-popup-dialog",onClose:d},{default:p(()=>[s("div",to,[a[1]||(a[1]=s("div",{class:"share-text"}," Anyone with the link can view this project and make their own copy. Your version won’t be changed by others. ",-1)),s("div",ao,[u(Je,{"render-style":{"--width":"100%","--height":"40px","--borderRadius":"100px","--fontColor":"#fff","--fontSize":"16px","--fontWeight":"500","--border":"none","--background":"#48e1eb","--backgroundHover":"#5ce8f1","--fontColorHover":"#fff"},onClick:c},{default:p(()=>[s("div",{class:"share-btn-content flex-center",onClick:v},[...a[0]||(a[0]=[s("img",{src:$e,alt:"share"},null,-1),s("span",null,"Copy Link",-1)])])]),_:1})])])]),_:1}
1,8,["visible","title"]))}},[["__scopeId","data-v-e044286c"]]);const lo={class:"project-top"},io={class:"project-info"},oo={class:"project-name pointer"},ro=["src"],so={class:"project-name-popover"},co=["onClick"],uo=["src","alt"],po={class:"project-operations"},vo={class:"project-name-popover"},mo=["onClick"],go=["src","alt"],ho={key:1,src:et,alt:"loading",class:"loading-icon"},fo=Te({__name:"ProjectTop",emits:["open-history","project-action","collapse-clip-panel"],setup(e,{emit:t}){const{exportSong:i,exportIngMap:y,exportDisabledMap:k}=wt(),b=rt(),w=Pi(),{isSharedProject:A}=S(w),C=n("rightPanelVisible"),_=t,x=[{label:"Rename",icon:$,action:"rename"},{label:"Version History",icon:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cg%20clip-path='url(%23clip0_6870_80934)'%3e%3cpath%20d='M7.99967%203.99967V7.99967L10.6663%209.33301M14.6663%207.99967C14.6663%2011.6816%2011.6816%2014.6663%207.99967%2014.6663C4.31778%2014.6663%201.33301%2011.6816%201.33301%207.99967C1.33301%204.31778%204.31778%201.33301%207.99967%201.33301C11.6816%201.33301%2014.6663%204.31778%2014.6663%207.99967Z'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_6870_80934'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",action:"version"}],D=a(null),I=a(null),M=e=>{var t,a,n,l,o;
1switch(null==(t=D.value)||t.hide(),null==(a=I.value)||a.hide(),e){case"rename":zi({projectId:b.projectId,projectName:b.projectName});break;case"version":_("open-history"),null==(n=D.value)||n.hide();break;case"share":_("project-action",e),function(e){var t,a,n;const l=document.createElement("div");document.body.appendChild(l);const i=F(no,{...e,visible:!0,remove(){i.unmount(l),document.body.removeChild(l)}});i.config.globalProperties={...(null==(n=null==(a=null==(t=null==window?void 0:window.$getVueCurrentInstance())?void 0:t.appContext)?void 0:a.config)?void 0:n.globalProperties)??{},...i.config.globalProperties},i.mount(l)}({visible:!0,projectName:b.projectName}),null==(l=D.value)||l.hide();break;case Ct.FULL_SONG:i(Ct.FULL_SONG,b.state);break;case Ct.SELECTED_RANGE:i(Ct.SELECTED_RANGE,{tracks:null==(o=nt.MainManagerDispatcher.getTrackDataByLoopArea())?void 0:o.tracks});break;case Ct.MULTITRACK:i(Ct.MULTITRACK,b.state)}},E=()=>{!function(e){var t,a,n;const l=document.createElement("div");document.body.appendChild(l);const i=F(eo,{...e,visible:!0,remove(){i.unmount(l),document.body.removeChild(l)}});i.config.globalProperties={...(null==(n=null==(a=null==(t=null==window?void 0:window.$getVueCurrentInstance())?void 0:t.appContext)?void 0:a.config)?void 0:n.globalProperties)??{},...i.config.globalProperties},i.mount(l)}()},P=()=>{_("collapse-clip-panel")},L=l(()=>en()?"⌘Z":"Ctrl+Z"),R=l(()=>en()?"⌘⇧Z":"Ctrl+Shift+Z"),B=l(()=>0===(b.state.tracks||[]).flatMap(e=>e.clips||[]).length);return(e,t)=>{const a=la;return r(),o(d,null,[s("div",lo,[s("div",io,[s("div",{class:"operation-button",onClick:E},"Project"),u(a,{ref_key:"projectPopoverRef",ref:D,"show-arrow":!1,teleported:!1,width:184,"popper-class":"project-name-popover-box",trigger:"click"},{reference:p(()=>[s("div",oo,[s("img",{class:"project-avatar",src:v(je)(v(b).projectImageUrl),alt:""},null,8,ro),s("span",null,h(v(b).projectName),1),u(v(xe),{name:"sys-more-vertical",opacity:.6})])]),default:p(()=>[s("div",so,[(r(),o(d,null,g(x,e=>s("div",{key:e.action,class:"project-name-popover-item",onClick:t=>M(e.action)},[s("img",{src:e.icon,alt:e.action},null,8,uo),m(" "+h(e.label),1)],8,co)),64))])]),_:1},512)]),s("div",po,[u(da,{content:""+(v(b).canUndo?"Undo ("+L.value+")":"Nothing to undo"),position:"bottom"},{default:p(()=>[s("img",{class:f(["pointer",{disabled:"preview"===v(b).mode||!v(b).canUndo}]),src:Mi,alt:"undo",onClick:t[0]||(t[0]=e=>v(b).undo())},null,2)]),_:1},8,["content"]),u(da,{content:""+(v(b).canRedo?"Redo ("+R.value+")":"Nothing to redo"),position:"bottom"},{default:p(()=>[s("img",{class:f(["pointer",{disabled:"preview"===v(b).mode||!v(b).canRedo}]),src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M14%205.99998H5C3.34315%205.99998%202%207.34313%202%208.99998C2%2010.6568%203.34315%2012%205%2012H9M14%205.99998L11.3333%203.33331M14%205.99998L11.3333%208.66665'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"redo",onClick:t[1]||(t[1]=e=>v(b).redo())},null,2)]),_:1},8,["content"]),v(A)?(r(),o("div",{key:0,class:"operation-button",onClick:t[2]||(t[2]=e=>v(w).duplicateProject())}," Duplicate Project ")):(r(),T(a,{key:1,ref_key:"exportPopoverRef",ref:I,"show-arrow":!1,teleported:!1,width:208,placement:"bottom-end","popper-class":"project-name-popover-box",trigger:"click",disabled:B.value},{reference:p(()=>["edit"===v(b).mode?(r(),T(v(Ye),{key:0,disabled:B.value,appearance:"inverse",size:"small"},{suffix:p(()=>[u(v(xe),{color:"#000",name:"sys-caret-down"})]),default:p(()=>[t[5]||(t[5]=m(" Export ",-1))]),_:1},8,["disabled"])):c("",!0)]),default:p(()=>[s("div",vo,[(r(!0),o(d,null,g(v(At),e=>(r(),o("div",{key:e.action,class:f(["project-name-popover-item",{disabled:v(y)[e.action]||v(k)[e.action]}]),onClick:t=>M(e.action)},[!v(y)[e.action]||v(k)[e.action]?(r(),o("img",{key:0,src:e.icon,alt:e.action},null,8,go)):(r(),o("img",ho)),m(" "+h(e.label),1)],10,mo))),128))])]),_:1},8,["disabled"])),"preview"===v(b).mode?(r(),o(d,{key:2},[u(v(Ye),{class:"exit-preview-button",type:"ghost",size:"small",onClick:t[3]||(t[3]=e=>v(b).cancelPreview())},{default:p(()=>
1[...t[6]||(t[6]=[m(" Exit Preview ",-1)])]),_:1}),u(v(Ye),{class:"restore-button",appearance:"inverse",size:"small",onClick:t[4]||(t[4]=e=>v(b).confirmPreview())},{default:p(()=>[...t[7]||(t[7]=[m(" Restore this Version ",-1)])]),_:1})],64)):c("",!0),v(C)?c("",!0):(r(),o("img",{key:3,class:"pointer",src:vn,alt:"align-left",onClick:P}))])]),t[8]||(t[8]=s("div",{class:"line"},null,-1))],64)}}},[["__scopeId","data-v-0177f0dd"]]);var yo=Object.defineProperty,ko=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,wo=Object.prototype.propertyIsEnumerable,Ao=(e,t,a)=>t in e?yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Co=(e,t)=>{for(var a in t||(t={}))bo.call(t,a)&&Ao(e,a,t[a]);if(ko)for(var a of ko(t))wo.call(t,a)&&Ao(e,a,t[a]);return e},_o=(e,t)=>{var a={};for(var n in e)bo.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&ko)for(var n of ko(e))t.indexOf(n)<0&&wo.call(e,n)&&(a[n]=e[n]);return a};function To(e,t,a){return a>=0&&a<e.length&&e.splice(a,0,e.splice(t,1)[0]),e}function xo(e,t){return Array.isArray(e)&&e.splice(t,1),e}function Do(e,t,a){return Array.isArray(e)&&e.splice(t,0,a),e}function Io(e,t,a){const n=e.children[a];e.insertBefore(t,n)}function So(e){e.parentNode&&e.parentNode.removeChild(e)}function Mo(e,t){Object.keys(e).forEach(a=>{t(a,e[a])})}const Eo=Object.assign;function Po(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function Lo(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Po(Object(a),!0).forEach(function(t){Bo(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Po(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function Ro(e){return(Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Bo(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function jo(){return jo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},jo.apply(this,arguments)}function No(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}function Oo(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Vo=Oo(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Fo=Oo(/Edge/i),Uo=Oo(/firefox/i),Ho=Oo(/safari/i)&&!Oo(/chrome/i)&&!Oo(/android/i),Go=Oo(/iP(ad|od|hone)/i),Wo=Oo(/chrome/i)&&Oo(/android/i),Ko={capture:!1,passive:!1};function Yo(e,t,a){e.addEventListener(t,a,!Vo&&Ko)}function zo(e,t,a){e.removeEventListener(t,a,!Vo&&Ko)}function Xo(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(a){return!1}return!1}}function Qo(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function qo(e,t,a,n){if(e){a=a||document;do{if(null!=t&&(">"===t[0]?e.parentNode===a&&Xo(e,t):Xo(e,t))||n&&e===a)return e;if(e===a)break}while(e=Qo(e))}return null}var Zo,Jo=/\s+/g;function $o(e,t,a){if(e&&t)if(e.classList)e.classList[a?"add":"remove"](t);else{var n=(" "+e.className+" ").replace(Jo," ").replace(" "+t+" "," ");e.className=(n+(a?" "+t:"")).replace(Jo," ")}}function er(e,t,a){var n=e&&e.style;if(n){if(void 0===a)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(a=e.currentStyle),void 0===t?a:a[t];!(t in n)&&-1===t.indexOf("webkit")&&(t="-webkit-"+t),n[t]=a+("string"==typeof a?"":"px")}}function tr(e,t){var a="";if("string"==typeof e)a=e;else do{var n=er(e,"transform");n&&"none"!==n&&(a=n+" "+a)}while(!t&&(e=e.parentNode));var l=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return l&&new l(a)}function ar(e,t,a){if(e){var n=e.getElementsByTagName(t),l=0,i=n.length;if(a)for(;l<i;l++)a(n[l],l);return n}return[]}function nr(){return document.scrollingElement||document.documentElement}function lr(e,t,a,n,l){if(e.getBoundingClientRect||e===window){var i,o,r,s,c,d,u;if(e!==window&&e.parentNode&&e!==nr()?(o=(i=e.getBoundingClientRect()).top,r=i.left,s=i.bottom,c=i.right,d=i.height,u=i.width):(o=0,r=0,s=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||a)&&e!==window&&(l=l||e.parentNode,!Vo))do{if(l&&l.getBoundingClientRect&&("none"!==er(l,"transform")||a&&"static"!==er(l,"position"))){var p=l.getBoundingClientRect();o-=p.top+parseInt(er(l,"border-top-width")),r-=p.left+parseInt(er(l,"border-left-width")),s=o+i.height,c=r+i.width;break}}while(l=l.parentNode);
1if(n&&e!==window){var v=tr(l||e),m=v&&v.a,g=v&&v.d;v&&(s=(o/=g)+(d/=g),c=(r/=m)+(u/=m))}return{top:o,left:r,bottom:s,right:c,width:u,height:d}}}function ir(e,t,a){for(var n=dr(e,!0),l=lr(e)[t];n;){if(!(l>=lr(n)[a]))return n;if(n===nr())break;n=dr(n,!1)}return!1}function or(e,t,a,n){for(var l=0,i=0,o=e.children;i<o.length;){if("none"!==o[i].style.display&&o[i]!==ms.ghost&&(n||o[i]!==ms.dragged)&&qo(o[i],a.draggable,e,!1)){if(l===t)return o[i];l++}i++}return null}function rr(e,t){for(var a=e.lastElementChild;a&&(a===ms.ghost||"none"===er(a,"display")||t&&!Xo(a,t));)a=a.previousElementSibling;return a||null}function sr(e,t){var a=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"!==e.nodeName.toUpperCase()&&e!==ms.clone&&(!t||Xo(e,t))&&a++;return a}function cr(e){var t=0,a=0,n=nr();if(e)do{var l=tr(e),i=l.a,o=l.d;t+=e.scrollLeft*i,a+=e.scrollTop*o}while(e!==n&&(e=e.parentNode));return[t,a]}function dr(e,t){if(!e||!e.getBoundingClientRect)return nr();var a=e,n=!1;do{if(a.clientWidth<a.scrollWidth||a.clientHeight<a.scrollHeight){var l=er(a);if(a.clientWidth<a.scrollWidth&&("auto"==l.overflowX||"scroll"==l.overflowX)||a.clientHeight<a.scrollHeight&&("auto"==l.overflowY||"scroll"==l.overflowY)){if(!a.getBoundingClientRect||a===document.body)return nr();if(n||t)return a;n=!0}}}while(a=a.parentNode);return nr()}function ur(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function pr(e,t){return function(){if(!Zo){var a=arguments;1===a.length?e.call(this,a[0]):e.apply(this,a),Zo=setTimeout(function(){Zo=void 0},t)}}}function vr(e,t,a){e.scrollLeft+=t,e.scrollTop+=a}function mr(e){var t=window.Polymer,a=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):a?a(e).clone(!0)[0]:e.cloneNode(!0)}function gr(e,t,a){var n={};return Array.from(e.children).forEach(function(l){var i,o,r,s;if(qo(l,t.draggable,e,!1)&&!l.animated&&l!==a){var c=lr(l);n.left=Math.min(null!==(i=n.left)&&void 0!==i?i:1/0,c.left),n.top=Math.min(null!==(o=n.top)&&void 0!==o?o:1/0,c.top),n.right=Math.max(null!==(r=n.right)&&void 0!==r?r:-1/0,c.right),n.bottom=Math.max(null!==(s=n.bottom)&&void 0!==s?s:-1/0,c.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var hr="Sortable"+(new Date).getTime();function fr(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach(function(e){if("none"!==er(e,"display")&&e!==ms.ghost){t.push({target:e,rect:lr(e)});var a=Lo({},t[t.length-1].rect);if(e.thisAnimationDuration){var n=tr(e,!0);n&&(a.top-=n.f,a.left-=n.e)}e.fromRect=a}})},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var a in e)if(e.hasOwnProperty(a))for(var n in t)if(t.hasOwnProperty(n)&&t[n]===e[a][n])return Number(a);return-1}(t,{target:e}),1)},animateAll:function(a){var n=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof a&&a());var l=!1,i=0;t.forEach(function(e){var t=0,a=e.target,o=a.fromRect,r=lr(a),s=a.prevFromRect,c=a.prevToRect,d=e.rect,u=tr(a,!0);u&&(r.top-=u.f,r.left-=u.e),a.toRect=r,a.thisAnimationDuration&&ur(s,r)&&!ur(o,r)&&(d.top-r.top)/(d.left-r.left)===(o.top-r.top)/(o.left-r.left)&&(t=function(e,t,a,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-a.top,2)+Math.pow(t.left-a.left,2))*n.animation}(d,s,c,n.options)),ur(r,o)||(a.prevFromRect=o,a.prevToRect=r,t||(t=n.options.animation),n.animate(a,d,r,t)),t&&(l=!0,i=Math.max(i,t),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout(function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null},t),a.thisAnimationDuration=t)}),clearTimeout(e),l?e=setTimeout(function(){"function"==typeof a&&a()},i):"function"==typeof a&&a(),t=[]},animate:function(e,t,a,n){if(n){er(e,"transition",""),er(e,"transform","");var l=tr(this.el),i=l&&l.a,o=l&&l.d,r=(t.left-a.left)/(i||1),s=(t.top-a.top)/(o||1);e.animatingX=!!r,e.animatingY=!!s,er(e,"transform","translate3d("+r+"px,"+s+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),er(e,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),er(e,"transform","translate3d(0,
10,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout(function(){er(e,"transition",""),er(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1},n)}}}}var yr=[],kr={initializeByDefault:!0},br={mount:function(e){for(var t in kr)kr.hasOwnProperty(t)&&!(t in e)&&(e[t]=kr[t]);yr.forEach(function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),yr.push(e)},pluginEvent:function(e,t,a){var n=this;this.eventCanceled=!1,a.cancel=function(){n.eventCanceled=!0};var l=e+"Global";yr.forEach(function(n){t[n.pluginName]&&(t[n.pluginName][l]&&t[n.pluginName][l](Lo({sortable:t},a)),t.options[n.pluginName]&&t[n.pluginName][e]&&t[n.pluginName][e](Lo({sortable:t},a)))})},initializePlugins:function(e,t,a,n){for(var l in yr.forEach(function(n){var l=n.pluginName;if(e.options[l]||n.initializeByDefault){var i=new n(e,t,e.options);i.sortable=e,i.options=e.options,e[l]=i,jo(a,i.defaults)}}),e.options)if(e.options.hasOwnProperty(l)){var i=this.modifyOption(e,l,e.options[l]);void 0!==i&&(e.options[l]=i)}},getEventProperties:function(e,t){var a={};return yr.forEach(function(n){"function"==typeof n.eventProperties&&jo(a,n.eventProperties.call(t[n.pluginName],e))}),a},modifyOption:function(e,t,a){var n;return yr.forEach(function(l){e[l.pluginName]&&l.optionListeners&&"function"==typeof l.optionListeners[t]&&(n=l.optionListeners[t].call(e[l.pluginName],a))}),n}};var wr=["evt"],Ar=function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=a.evt,l=No(a,wr);br.pluginEvent.bind(ms)(e,t,Lo({dragEl:_r,parentEl:Tr,ghostEl:xr,rootEl:Dr,nextEl:Ir,lastDownEl:Sr,cloneEl:Mr,cloneHidden:Er,dragStarted:Wr,putSortable:Nr,activeSortable:ms.active,originalEvent:n,oldIndex:Pr,oldDraggableIndex:Rr,newIndex:Lr,newDraggableIndex:Br,hideGhostForTarget:ds,unhideGhostForTarget:us,cloneNowHidden:function(){Er=!0},cloneNowShown:function(){Er=!1},dispatchSortableEvent:function(e){Cr({sortable:t,name:e,originalEvent:n})}},l))};function Cr(e){!function(e){var t=e.sortable,a=e.rootEl,n=e.name,l=e.targetEl,i=e.cloneEl,o=e.toEl,r=e.fromEl,s=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,p=e.originalEvent,v=e.putSortable,m=e.extraEventProperties;if(t=t||a&&a[hr]){var g,h=t.options,f="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||Vo||Fo?(g=document.createEvent("Event")).initEvent(n,!0,!0):g=new CustomEvent(n,{bubbles:!0,cancelable:!0}),g.to=o||a,g.from=r||a,g.item=l||a,g.clone=i,g.oldIndex=s,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=p,g.pullMode=v?v.lastPutMode:void 0;var y=Lo(Lo({},m),br.getEventProperties(n,t));for(var k in y)g[k]=y[k];a&&a.dispatchEvent(g),h[f]&&h[f].call(t,g)}}(Lo({putSortable:Nr,cloneEl:Mr,targetEl:_r,rootEl:Dr,oldIndex:Pr,oldDraggableIndex:Rr,newIndex:Lr,newDraggableIndex:Br},e))}var _r,Tr,xr,Dr,Ir,Sr,Mr,Er,Pr,Lr,Rr,Br,jr,Nr,Or,Vr,Fr,Ur,Hr,Gr,Wr,Kr,Yr,zr,Xr,Qr=!1,qr=!1,Zr=[],Jr=!1,$r=!1,es=[],ts=!1,as=[],ns="undefined"!=typeof document,ls=Go,is=Fo||Vo?"cssFloat":"float",os=ns&&!Wo&&!Go&&"draggable"in document.createElement("div"),rs=function(){if(ns){if(Vo)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),ss=function(e,t){var a=er(e),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),l=or(e,0,t),i=or(e,1,t),o=l&&er(l),r=i&&er(i),s=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+lr(l).width,c=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+lr(i).width;if("flex"===a.display)return"column"===a.flexDirection||"column-reverse"===a.flexDirection?"vertical":"horizontal";if("grid"===a.display)return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(l&&o.float&&"none"!==o.float){var d="left"===o.float?"left":"right";return!i||"both"!==r.clear&&r.clear!==d?"horizontal":"vertical"}return l&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||s>=n&&"none"===a[is]||i&&"none"===a[is]&&s+c>n)?"vertical":"horizontal"},cs=function(e){function t(e,a){return function(n,l,i,o){var r=n.options.group.name&&l.options.group.name&&n.options.group.name===l.options.group.name;if(null==e&&(a||r))return!0;
vendor: 23,803 bytes, line 1
1if(null==e||!1===e)return!1;if(a&&"clone"===e)return e;if("function"==typeof e)return t(e(n,l,i,o),a)(n,l,i,o);var s=(a?n:l).options.group.name;return!0===e||"string"==typeof e&&e===s||e.join&&e.indexOf(s)>-1}}var a={},n=e.group;(!n||"object"!=Ro(n))&&(n={name:n}),a.name=n.name,a.checkPull=t(n.pull,!0),a.checkPut=t(n.put),a.revertClone=n.revertClone,e.group=a},ds=function(){!rs&&xr&&er(xr,"display","none")},us=function(){!rs&&xr&&er(xr,"display","")};ns&&!Wo&&document.addEventListener("click",function(e){if(qr)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),qr=!1,!1},!0);var ps=function(e){if(_r){var t=function(e,t){var a;return Zr.some(function(n){var l=n[hr].options.emptyInsertThreshold;if(l&&!rr(n)){var i=lr(n),o=e>=i.left-l&&e<=i.right+l,r=t>=i.top-l&&t<=i.bottom+l;if(o&&r)return a=n}}),a}((e=e.touches?e.touches[0]:e).clientX,e.clientY);if(t){var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=e[n]);a.target=a.rootEl=t,a.preventDefault=void 0,a.stopPropagation=void 0,t[hr]._onDragOver(a)}}},vs=function(e){_r&&_r.parentNode[hr]._isOutsideThisEl(e.target)};function ms(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=jo({},t),e[hr]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ss(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==ms.supportPointer&&"PointerEvent"in window&&!Ho,emptyInsertThreshold:5};for(var n in br.initializePlugins(this,e,a),a)!(n in t)&&(t[n]=a[n]);for(var l in cs(t),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!t.forceFallback&&os,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Yo(e,"pointerdown",this._onTapStart):(Yo(e,"mousedown",this._onTapStart),Yo(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Yo(e,"dragover",this),Yo(e,"dragenter",this)),Zr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),jo(this,fr())}function gs(e,t,a,n,l,i,o,r){var s,c,d=e[hr],u=d.options.onMove;return!window.CustomEvent||Vo||Fo?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=t,s.from=e,s.dragged=a,s.draggedRect=n,s.related=l||t,s.relatedRect=i||lr(t),s.willInsertAfter=r,s.originalEvent=o,e.dispatchEvent(s),u&&(c=u.call(d,s,o)),c}function hs(e){e.draggable=!1}function fs(){ts=!1}function ys(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,a=t.length,n=0;a--;)n+=t.charCodeAt(a);return n.toString(36)}function ks(e){return setTimeout(e,0)}function bs(e){return clearTimeout(e)}ms.prototype={constructor:ms,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Kr=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,_r):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,a=this.el,n=this.options,l=n.preventOnFilter,i=e.type,o=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,r=(o||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||r,c=n.filter;if(function(e){as.length=0;for(var t=e.getElementsByTagName("input"),a=t.length;a--;){var n=t[a];n.checked&&as.push(n)}}(a),!_r&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||n.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!Ho||!r||"SELECT"!==r.tagName.toUpperCase())&&!((r=qo(r,n.draggable,a,!1))&&r.animated||Sr===r)){if(Pr=sr(r),Rr=sr(r,n.draggable),"function"==typeof c){if(c.call(this,e,r,this))return Cr({sortable:t,rootEl:s,name:"filter",targetEl:r,toEl:a,fromEl:a}),Ar("filter",t,{evt:e}),void(l&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(n){if(n=qo(s,n.trim(),a,!1))return Cr({sortable:t,rootEl:n,name:"filter",targetEl:r,fromEl:a,toEl:a}),Ar("filter",t,{evt:e}),!0})))return void(l&&e.cancelable&&e.preventDefault());n.handle&&!qo(s,n.handle,a,!1)||this._prepareDragStart(e,o,r)}}},_prepareDragStart:function(e,t,a){var n,l=this,i=l.el,o=l.options,r=i.ownerDocument;if(a&&!_r&&a.parentNode===i){var s=lr(a);if(Dr=i,Tr=(_r=a).parentNode,Ir=_r.nextSibling,Sr=a,jr=o.group,ms.dragged=_r,Or={target:_r,clientX:(t||e).clientX,clientY:(t||e).clientY},Hr=Or.clientX-s.left,Gr=Or.clientY-s.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,_r.style["will-change"]="all",n=function(){Ar("delayEnded",l,{evt:e}),ms.eventCanceled?l._onDrop():(l._disableDelayedDragEvents(),!Uo&&l.nativeDraggable&&(_r.draggable=!0),l._triggerDragStart(e,t),Cr({sortable:l,name:"choose",originalEvent:e}),$o(_r,o.chosenClass,!0))},o.ignore.split(",").forEach(function(e){ar(_r,e.trim(),hs)}),Yo(r,"dragover",ps),Yo(r,"mousemove",ps),Yo(r,"touchmove",ps),Yo(r,"mouseup",l._onDrop),Yo(r,"touchend",l._onDrop),Yo(r,"touchcancel",l._onDrop),Uo&&this.nativeDraggable&&(this.options.touchStartThreshold=4,_r.draggable=!0),Ar("delayStart",this,{evt:e}),!o.delay||o.delayOnTouchOnly&&!t||this.nativeDraggable&&(Fo||Vo))n();else{if(ms.eventCanceled)return void this._onDrop();Yo(r,"mouseup",l._disableDelayedDrag),Yo(r,"touchend",l._disableDelayedDrag),Yo(r,"touchcancel",l._disableDelayedDrag),Yo(r,"mousemove",l._delayedDragTouchMoveHandler),Yo(r,"touchmove",l._delayedDragTouchMoveHandler),o.supportPointer&&Yo(r,"pointermove",l._delayedDragTouchMoveHandler),l._dragStartTimer=setTimeout(n,o.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){_r&&hs(_r),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;zo(e,"mouseup",this._disableDelayedDrag),zo(e,"touchend",this._disableDelayedDrag),zo(e,"touchcancel",this._disableDelayedDrag),zo(e,"mousemove",this._delayedDragTouchMoveHandler),zo(e,"touchmove",this._delayedDragTouchMoveHandler),zo(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Yo(document,"pointermove",this._onTouchMove):Yo(document,t?"touchmove":"mousemove",this._onTouchMove):(Yo(_r,"dragend",this),Yo(Dr,"dragstart",this._onDragStart));try{document.selection?ks(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(e,t){if(Qr=!1,Dr&&_r){Ar("dragStarted",this,{evt:t}),this.nativeDraggable&&Yo(document,"dragover",vs);var a=this.options;!e&&$o(_r,a.dragClass,!1),$o(_r,a.ghostClass,!0),ms.active=this,e&&this._appendGhost(),Cr({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Vr){this._lastX=Vr.clientX,this._lastY=Vr.clientY,ds();for(var e=document.elementFromPoint(Vr.clientX,Vr.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Vr.clientX,Vr.clientY))!==t;)t=e;if(_r.parentNode[hr]._isOutsideThisEl(e),t)do{if(t[hr]){if(t[hr]._onDragOver({clientX:Vr.clientX,clientY:Vr.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);us()}},_onTouchMove:function(e){if(Or){var t=this.options,a=t.fallbackTolerance,n=t.fallbackOffset,l=e.touches?e.touches[0]:e,i=xr&&tr(xr,!0),o=xr&&i&&i.a,r=xr&&i&&i.d,s=ls&&Xr&&cr(Xr),c=(l.clientX-Or.clientX+n.x)/(o||1)+(s?s[0]-es[0]:0)/(o||1),d=(l.clientY-Or.clientY+n.y)/(r||1)+(s?s[1]-es[1]:0)/(r||1);if(!ms.active&&!Qr){if(a&&Math.max(Math.abs(l.clientX-this._lastX),Math.abs(l.clientY-this._lastY))<a)return;this._onDragStart(e,!0)}if(xr){i?(i.e+=c-(Fr||0),i.f+=d-(Ur||0)):i={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");er(xr,"webkitTransform",u),er(xr,"mozTransform",u),er(xr,"msTransform",u),er(xr,"transform",u),Fr=c,Ur=d,Vr=l}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!xr){var e=this.options.fallbackOnBody?document.body:Dr,t=lr(_r,!0,ls,!0,e),a=this.options;if(ls){for(Xr=e;"static"===er(Xr,"position")&&"none"===er(Xr,"transform")&&Xr!==document;)Xr=Xr.parentNode;Xr!==document.body&&Xr!==document.documentElement?(Xr===document&&(Xr=nr()),t.top+=Xr.scrollTop,t.left+=Xr.scrollLeft):Xr=nr(),es=cr(Xr)}$o(xr=_r.cloneNode(!0),a.ghostClass,!1),$o(xr,a.fallbackClass,!0),$o(xr,a.dragClass,!0),er(xr,"transition",""),er(xr,"transform",""),er(xr,"box-sizing","border-box"),er(xr,"margin",0),er(xr,"top",t.top),er(xr,"left",t.left),er(xr,"width",t.width),er(xr,"height",t.height),er(xr,"opacity","0.8"),er(xr,"position",ls?"absolute":"fixed"),er(xr,"zIndex","100000"),er(xr,"pointerEvents","none"),ms.ghost=xr,e.appendChild(xr),er(xr,"transform-origin",Hr/parseInt(xr.style.width)*100+"% "+Gr/parseInt(xr.style.height)*100+"%")}},_onDragStart:function(e,t){var a=this,n=e.dataTransfer,l=a.options;Ar("dragStart",this,{evt:e}),ms.eventCanceled?this._onDrop():(Ar("setupClone",this),ms.eventCanceled||((Mr=mr(_r)).removeAttribute("id"),Mr.draggable=!1,Mr.style["will-change"]="",this._hideClone(),$o(Mr,this.options.chosenClass,!1),ms.clone=Mr),a.cloneId=ks(function(){Ar("clone",a),!ms.eventCanceled&&(a.options.removeCloneOnHide||Dr.insertBefore(Mr,_r),a._hideClone(),Cr({sortable:a,name:"clone"}))}),!t&&$o(_r,l.dragClass,!0),t?(qr=!0,a._loopId=setInterval(a._emulateDragOver,50)):(zo(document,"mouseup",a._onDrop),zo(document,"touchend",a._onDrop),zo(document,"touchcancel",a._onDrop),n&&(n.effectAllowed="move",l.setData&&l.setData.call(a,n,_r)),Yo(document,"drop",a),er(_r,"transform","translateZ(0)")),Qr=!0,a._dragStartId=ks(a._dragStarted.bind(a,t,e)),Yo(document,"selectstart",a),Wr=!0,Ho&&er(document.body,"user-select","none"))},_onDragOver:function(e){var t,a,n,l,i=this.el,o=e.target,r=this.options,s=r.group,c=ms.active,d=jr===s,u=r.sort,p=Nr||c,v=this,m=!1;if(!ts){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),o=qo(o,r.draggable,i,!0),S("dragOver"),ms.eventCanceled)return m;if(_r.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||v._ignoreWhileAnimating===o)return E(!1);if(qr=!1,c&&!r.disabled&&(d?u||(n=Tr!==Dr):Nr===this||(this.lastPutMode=jr.checkPull(this,c,_r,e))&&s.checkPut(this,c,_r,e))){if(l="vertical"===this._getDirection(e,o),t=lr(_r),S("dragOverValid"),ms.eventCanceled)return m;if(n)return Tr=Dr,M(),this._hideClone(),S("revert"),ms.eventCanceled||(Ir?Dr.insertBefore(_r,Ir):Dr.appendChild(_r)),E(!0);var g=rr(i,r.draggable);if(!g||function(e,t,a){var n=lr(rr(a.el,a.options.draggable)),l=gr(a.el,a.options,xr),i=10;return t?e.clientX>l.right+i||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>l.bottom+i||e.clientX>n.right&&e.clientY>n.top}(e,l,this)&&!g.animated){if(g===_r)return E(!1);if(g&&i===e.target&&(o=g),o&&(a=lr(o)),!1!==gs(Dr,i,_r,t,o,a,e,!!o))return M(),g&&g.nextSibling?i.insertBefore(_r,g.nextSibling):i.appendChild(_r),Tr=i,P(),E(!0)}else if(g&&function(e,t,a){var n=lr(or(a.el,0,a.options,!0)),l=gr(a.el,a.options,xr),i=10;return t?e.clientX<l.left-i||e.clientY<n.top&&e.clientX<n.right:e.clientY<l.top-i||e.clientY<n.bottom&&e.clientX<n.left}(e,l,this)){var h=or(i,0,r,!0);if(h===_r)return E(!1);if(a=lr(o=h),!1!==gs(Dr,i,_r,t,o,a,e,!1))return M(),i.insertBefore(_r,h),Tr=i,P(),E(!0)}else if(o.parentNode===i){a=lr(o);var f,y,k,b=_r.parentNode!==i,w=!function(e,t,a){var n=a?e.left:e.top,l=a?e.right:e.bottom,i=a?e.width:e.height,o=a?t.left:t.top,r=a?t.right:t.bottom,s=a?t.width:t.height;return n===o||l===r||n+i/2===o+s/2}(_r.animated&&_r.toRect||t,o.animated&&o.toRect||a,l),A=l?"top":"left",C=ir(o,"top","top")||ir(_r,"top","top"),_=C?C.scrollTop:void 0;if(Kr!==o&&(y=a[A],Jr=!1,$r=!w&&r.invertSwap||b),f=function(e,t,a,n,l,i,o,r){var s=n?e.clientY:e.clientX,c=n?a.height:a.width,d=n?a.top:a.left,u=n?a.bottom:a.right,p=!1;if(!o)if(r&&zr<c*l){if(!Jr&&(1===Yr?s>d+c*i/2:s<u-c*i/2)&&(Jr=!0),Jr)p=!0;else if(1===Yr?s<d+zr:s>u-zr)return-Yr}else if(s>d+c*(1-l)/2&&s<u-c*(1-l)/2)return function(e){return sr(_r)<sr(e)?1:-1}(t);return p=p||o,p&&(s<d+c*i/2||s>u-c*i/2)?s>d+c/2?1:-1:0}(e,o,a,l,w?1:r.swapThreshold,null==r.invertedSwapThreshold?r.swapThreshold:r.invertedSwapThreshold,$r,Kr===o),0!==f){var T=sr(_r);do{T-=f,k=Tr.children[T]}while(k&&("none"===er(k,"display")||k===xr))}if(0===f||k===o)return E(!1);Kr=o,Yr=f;var x=o.nextElementSibling,D=!1,I=gs(Dr,i,_r,t,o,a,e,D=1===f);if(!1!==I)return(1===I||-1===I)&&(D=1===I),ts=!0,setTimeout(fs,30),M(),D&&!x?i.appendChild(_r):o.parentNode.insertBefore(_r,D?x:o),C&&vr(C,0,_-C.scrollTop),Tr=_r.parentNode,void 0!==y&&!$r&&(zr=Math.abs(y-lr(o)[A])),P(),E(!0)}if(i.contains(_r))return E(!1)}return!1}function S(r,s){Ar(r,v,Lo({evt:e,isOwner:d,axis:l?"vertical":"horizontal",revert:n,dragRect:t,targetRect:a,canSort:u,fromSortable:p,target:o,completed:E,onMove:function(a,n){return gs(Dr,i,_r,t,a,lr(a),e,n)},changed:P},s))}function M(){S("dragOverAnimationCapture"),v.captureAnimationState(),v!==p&&p.captureAnimationState()}function E(t){return S("dragOverCompleted",{insertion:t}),t&&(d?c._hideClone():c._showClone(v),v!==p&&($o(_r,Nr?Nr.options.ghostClass:c.options.ghostClass,!1),$o(_r,r.ghostClass,!0)),Nr!==v&&v!==ms.active?Nr=v:v===ms.active&&Nr&&(Nr=null),p===v&&(v._ignoreWhileAnimating=o),v.animateAll(function(){S("dragOverAnimationComplete"),v._ignoreWhileAnimating=null}),v!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(o===_r&&!_r.animated||o===i&&!o.animated)&&(Kr=null),!r.dragoverBubble&&!e.rootEl&&o!==document&&(_r.parentNode[hr]._isOutsideThisEl(e.target),!t&&ps(e)),!r.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=!0}function P(){Lr=sr(_r),Br=sr(_r,r.draggable),Cr({sortable:v,name:"change",toEl:i,newIndex:Lr,newDraggableIndex:Br,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){zo(document,"mousemove",this._onTouchMove),zo(document,"touchmove",this._onTouchMove),zo(document,"pointermove",this._onTouchMove),zo(document,"dragover",ps),zo(document,"mousemove",ps),zo(document,"touchmove",ps)},_offUpEvents:function(){var e=this.el.ownerDocument;zo(e,"mouseup",this._onDrop),zo(e,"touchend",this._onDrop),zo(e,"pointerup",this._onDrop),zo(e,"touchcancel",this._onDrop),zo(document,"selectstart",this)},_onDrop:function(e){var t=this.el,a=this.options;Lr=sr(_r),Br=sr(_r,a.draggable),Ar("drop",this,{evt:e}),Tr=_r&&_r.parentNode,Lr=sr(_r),Br=sr(_r,a.draggable),ms.eventCanceled||(Qr=!1,$r=!1,Jr=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),bs(this.cloneId),bs(this._dragStartId),this.nativeDraggable&&(zo(document,"drop",this),zo(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ho&&er(document.body,"user-select",""),er(_r,"transform",""),e&&(Wr&&(e.cancelable&&e.preventDefault(),!a.dropBubble&&e.stopPropagation()),xr&&xr.parentNode&&xr.parentNode.removeChild(xr),(Dr===Tr||Nr&&"clone"!==Nr.lastPutMode)&&Mr&&Mr.parentNode&&Mr.parentNode.removeChild(Mr),_r&&(this.nativeDraggable&&zo(_r,"dragend",this),hs(_r),_r.style["will-change"]="",Wr&&!Qr&&$o(_r,Nr?Nr.options.ghostClass:this.options.ghostClass,!1),$o(_r,this.options.chosenClass,!1),Cr({sortable:this,name:"unchoose",toEl:Tr,newIndex:null,newDraggableIndex:null,originalEvent:e}),Dr!==Tr?(Lr>=0&&(Cr({rootEl:Tr,name:"add",toEl:Tr,fromEl:Dr,originalEvent:e}),Cr({sortable:this,name:"remove",toEl:Tr,originalEvent:e}),Cr({rootEl:Tr,name:"sort",toEl:Tr,fromEl:Dr,originalEvent:e}),Cr({sortable:this,name:"sort",toEl:Tr,originalEvent:e})),Nr&&Nr.save()):Lr!==Pr&&Lr>=0&&(Cr({sortable:this,name:"update",toEl:Tr,originalEvent:e}),Cr({sortable:this,name:"sort",toEl:Tr,originalEvent:e})),ms.active&&((null==Lr||-1===Lr)&&(Lr=Pr,Br=Rr),Cr({sortable:this,name:"end",toEl:Tr,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Ar("nulling",this),Dr=_r=Tr=xr=Ir=Mr=Sr=Er=Or=Vr=Wr=Lr=Br=Pr=Rr=Kr=Yr=Nr=jr=ms.dragged=ms.ghost=ms.clone=ms.active=null,as.forEach(function(e){e.checked=!0}),as.length=Fr=Ur=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":_r&&(this._onDragOver(e),(t=e).dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault());break;case"selectstart":e.preventDefault()}var t},toArray:function(){for(var e,t=[],a=this.el.children,n=0,l=a.length,i=this.options;n<l;n++)qo(e=a[n],i.draggable,this.el,!1)&&t.push(e.getAttribute(i.dataIdAttr)||ys(e));return t},sort:function(e,t){var a={},n=this.el;this.toArray().forEach(function(e,t){var l=n.children[t];qo(l,this.options.draggable,n,!1)&&(a[e]=l)},this),t&&this.captureAnimationState(),e.forEach(function(e){a[e]&&(n.removeChild(a[e]),n.appendChild(a[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return qo(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var a=this.options;if(void 0===t)return a[e];var n=br.modifyOption(this,e,t);a[e]=void 0!==n?n:t,"group"===e&&cs(a)},destroy:function(){Ar("destroy",this);var e=this.el;e[hr]=null,zo(e,"mousedown",this._onTapStart),zo(e,"touchstart",this._onTapStart),zo(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(zo(e,"dragover",this),zo(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Zr.splice(Zr.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Er){if(Ar("hideClone",this),ms.eventCanceled)return;er(Mr,"display","none"),this.options.removeCloneOnHide&&Mr.parentNode&&Mr.parentNode.removeChild(Mr),Er=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Er){if(Ar("showClone",this),ms.eventCanceled)return;_r.parentNode!=Dr||this.options.group.revertClone?Ir?Dr.insertBefore(Mr,Ir):Dr.appendChild(Mr):Dr.insertBefore(Mr,_r),this.options.group.revertClone&&this.animate(_r,Mr),er(Mr,"display",""),Er=!1}}else this._hideClone()}},ns&&Yo(document,"touchmove",function(e){(ms.active||Qr)&&e.cancelable&&e.preventDefault()}),ms.utils={on:Yo,off:zo,css:er,find:ar,is:function(e,t){return!!qo(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);return e},throttle:pr,closest:qo,toggleClass:$o,clone:mr,index:sr,nextTick:ks,cancelNextTick:bs,detectDirection:ss,getChild:or},ms.get=function(e){return e[hr]},ms.mount=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];t[0].constructor===Array&&(t=t[0]),t.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(ms.utils=Lo(Lo({},ms.utils),e.utils)),br.mount(e)})},ms.create=function(e,t){return new ms(e,t)},ms.version="1.15.2";var ws,As,Cs,_s,Ts,xs,Ds=[],Is=!1;function Ss(){Ds.forEach(function(e){clearInterval(e.pid)}),Ds=[]}function Ms(){clearInterval(xs)}var Es=pr(function(e,t,a,n){if(t.scroll){var l,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,r=t.scrollSensitivity,s=t.scrollSpeed,c=nr(),d=!1;As!==a&&(As=a,Ss(),ws=t.scroll,l=t.scrollFn,!0===ws&&(ws=dr(a,!0)));var u=0,p=ws;do{var v=p,m=lr(v),g=m.top,h=m.bottom,f=m.left,y=m.right,k=m.width,b=m.height,w=void 0,A=void 0,C=v.scrollWidth,_=v.scrollHeight,T=er(v),x=v.scrollLeft,D=v.scrollTop;v===c?(w=k<C&&("auto"===T.overflowX||"scroll"===T.overflowX||"visible"===T.overflowX),A=b<_&&("auto"===T.overflowY||"scroll"===T.overflowY||"visible"===T.overflowY)):(w=k<C&&("auto"===T.overflowX||"scroll"===T.overflowX),A=b<_&&("auto"===T.overflowY||"scroll"===T.overflowY));var I=w&&(Math.abs(y-i)<=r&&x+k<C)-(Math.abs(f-i)<=r&&!!x),S=A&&(Math.abs(h-o)<=r&&D+b<_)-(Math.abs(g-o)<=r&&!!D);if(!Ds[u])for(var M=0;M<=u;M++)Ds[M]||(Ds[M]={});(Ds[u].vx!=I||Ds[u].vy!=S||Ds[u].el!==v)&&(Ds[u].el=v,Ds[u].vx=I,Ds[u].vy=S,clearInterval(Ds[u].pid),(0!=I||0!=S)&&(d=!0,Ds[u].pid=setInterval(function(){n&&0===this.layer&&ms.active._onTouchMove(Ts);var t=Ds[this.layer].vy?Ds[this.layer].vy*s:0,a=Ds[this.layer].vx?Ds[this.layer].vx*s:0;"function"==typeof l&&"continue"!==l.call(ms.dragged.parentNode[hr],a,t,e,Ts,Ds[this.layer].el)||vr(Ds[this.layer].el,a,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&p!==c&&(p=dr(p,!1)));Is=d}},30),Ps=function(e){var t=e.originalEvent,a=e.putSortable,n=e.dragEl,l=e.activeSortable,i=e.dispatchSortableEvent,o=e.hideGhostForTarget,r=e.unhideGhostForTarget;if(t){var s=a||l;o();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(c.clientX,c.clientY);r(),s&&!s.el.contains(d)&&(i("spill"),this.onSpill({dragEl:n,putSortable:a}))}};function Ls(){}function Rs(){}function Bs(e){return null==e?e:JSON.parse(JSON.stringify(e))}Ls.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,a=e.putSortable;this.sortable.captureAnimationState(),a&&a.captureAnimationState();var n=or(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(t,n):this.sortable.el.appendChild(t),this.sortable.animateAll(),a&&a.animateAll()},drop:Ps},jo(Ls,{pluginName:"revertOnSpill"}),Rs.prototype={onSpill:function(e){var t=e.dragEl,a=e.putSortable||this.sortable;a.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),a.animateAll()},drop:Ps},jo(Rs,{pluginName:"removeOnSpill"}),ms.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Yo(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Yo(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Yo(document,"touchmove",this._handleFallbackAutoScroll):Yo(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;!this.options.dragOverBubble&&!t.rootEl&&this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?zo(document,"dragover",this._handleAutoScroll):(zo(document,"pointermove",this._handleFallbackAutoScroll),zo(document,"touchmove",this._handleFallbackAutoScroll),zo(document,"mousemove",this._handleFallbackAutoScroll)),Ms(),Ss(),clearTimeout(Zo),Zo=void 0},nulling:function(){Ts=As=ws=Is=xs=Cs=_s=null,Ds.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var a=this,n=(e.touches?e.touches[0]:e).clientX,l=(e.touches?e.touches[0]:e).clientY,i=document.elementFromPoint(n,l);if(Ts=e,t||this.options.forceAutoScrollFallback||Fo||Vo||Ho){Es(e,this.options,i,t);var o=dr(i,!0);Is&&(!xs||n!==Cs||l!==_s)&&(xs&&Ms(),xs=setInterval(function(){var i=dr(document.elementFromPoint(n,l),!0);i!==o&&(o=i,Ss()),Es(e,a.options,i,t)},10),Cs=n,_s=l)}else{if(!this.options.bubbleScroll||dr(i,!0)===nr())return void Ss();Es(e,this.options,dr(i,!1),!1)}}},jo(e,{pluginName:"scroll",initializeByDefault:!0})}),ms.mount(Rs,Ls);let js=null,Ns=null;
1function Os(e=null,t=null){js=e,Ns=t}const Vs=Symbol("cloneElement");function Fs(...e){var t,a;const n=null==(t=w())?void 0:t.proxy;let l=null;const o=e[0];let[,r,s]=e;Array.isArray(v(r))||(s=r,r=null);let c=null;const{immediate:d=!0,clone:u=Bs,customUpdate:p}=null!=(a=v(s))?a:{};const m={onUpdate:function(e){if(p)return void p(e);const{from:t,item:a,oldIndex:n,oldDraggableIndex:l,newDraggableIndex:i}=e;if(So(a),Io(t,a,n),W(r)){const e=[...v(r)];return void(r.value=To(e,l,i))}To(v(r),l,i)},onStart:function(e){var t;const{from:a,oldIndex:n,item:i}=e;l=Array.from(a.childNodes);const o=v(null==(t=v(r))?void 0:t[n]),s=u(o);Os(o,s),i[Vs]=s},onAdd:function(e){const t=e.item[Vs];if(!function(e){return void 0===e}(t)){if(So(e.item),W(r)){const a=[...v(r)];return void(r.value=Do(a,e.newDraggableIndex,t))}Do(v(r),e.newDraggableIndex,t)}},onRemove:function(e){const{from:t,item:a,oldIndex:n,oldDraggableIndex:l,pullMode:i,clone:o}=e;if(Io(t,a,n),"clone"!==i){if(W(r)){const e=[...v(r)];return void(r.value=xo(e,l))}xo(v(r),l)}else So(o)},onEnd:function(e){const{newIndex:t,oldIndex:a,from:n,to:i}=e;let o=null;const r=t===a&&n===i;try{if(r){let e=null;null==l||l.some((t,a)=>{if(e&&(null==l?void 0:l.length)!==i.childNodes.length)return n.insertBefore(e,t.nextSibling),!0;const o=i.childNodes[a];e=null==i?void 0:i.replaceChild(t,o)})}}catch(s){o=s}finally{l=null}E(()=>
1{if(Os(),o)throw o})}};function g(e){const t=v(o);return e||(e=function(e){return"string"==typeof e}(t)?function(e,t=document){var a;let n=null;return n="function"==typeof(null==t?void 0:t.querySelector)?null==(a=null==t?void 0:t.querySelector)?void 0:a.call(t,e):document.querySelector(e),n}(t,null==n?void 0:n.$el):t),e&&!function(e){return e instanceof HTMLElement}(e)&&(e=e.$el),e}function h(){var e;const t=null!=(e=v(s))?e:{},{immediate:a,clone:n}=t,l=_o(t,["immediate","clone"]);return Mo(l,(e,t)=>{(function(e){return 111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97)})(e)&&(l[e]=(e,...a)=>(Eo(e,{data:js,clonedData:Ns}),t(e,...a)))}),function(e,t){const a=Co({},e);return Object.keys(t).forEach(n=>{a[n]?a[n]=function(e,t,a=null){return function(...n){return e.apply(a,n),t.apply(a,n)}}(e[n],t[n]):a[n]=t[n]}),a}(null===r?{}:m,l)}const f=e=>{e=g(e),c&&y.destroy(),c=new ms(e,h())};i(()=>s,()=>{c&&Mo(h(),(e,t)=>{null==c||c.option(e,t)})},{deep:!0});const y={option:(e,t)=>null==c?void 0:c.option(e,t),destroy:()=>{null==c||c.destroy(),c=null},save:()=>null==c?void 0:c.save(),toArray:()=>null==c?void 0:c.toArray(),closest:(...e)=>null==c?void 0:c.closest(...e)};return function(e){w()?_(e):E(e)}(()=>{d&&f()}),function(e){w()&&M(e)}(y.destroy),Co({start:f,pause:()=>null==y?void 0:y.option("disabled",!0),resume:()=>null==y?void 0:y.option("disabled",!1)},y)}const Us=["update","start","add","remove","choose","unchoose","end","sort","filter","clone","move","change"],Hs=U({name:"VueDraggable",model:{prop:"modelValue",event:"update:modelValue"},props:["clone","animation","ghostClass","group","sort","disabled","store","handle","draggable","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","chosenClass","dragClass","ignore","filter","preventOnFilter","easing","setData","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","emptyInsertThreshold","scroll","forceAutoScrollFallback","scrollSensitivity","scrollSpeed","bubbleScroll","modelValue","tag","target","customUpdate",...Us.map(e=>`on${e.replace(/^\S/,e=>e.toUpperCase())}`)],emits:["update:modelValue",...Us],setup(e,{slots:t,emit:n,expose:i,attrs:o}){const r=Us.reduce((e,t)=>(e[`on${t.replace(/^\S/,e=>e.toUpperCase())}`]=(...e)=>n(t,...e),e),{}),s=l(()=>{const t=H(e),{modelValue:a}=t,n=_o(t,["modelValue"]),l=Object.entries(n).reduce((e,[t,a])=>{const n=v(a);return void 0!==n&&(e[t]=n),e},{});return Co(Co({},r),function(e){return Object.keys(e).reduce((t,a)=>(void 0!==e[a]&&(t[function(e){return e.replace(/-(\w)/g,(e,t)=>t?t.toUpperCase():"")}(a)]=e[a]),t),{})}(Co(Co({},o),l)))}),c=l({get:()=>e.modelValue,set:e=>n("update:modelValue",e)}),d=a(),u=C(Fs(e.target||d,c,s));return i(u),()=>{var a;return G(e.tag||"div",{ref:d},null==(a=null==t?void 0:t.default)?void 0:a.call(t,u))}}}),Gs=Te({__name:"trackDivider",props:{elementId:{type:String,required:!0}},emits:["resize"],setup(e,{emit:t}){const n=e,l=t,i=a(null),c=a(!1);let d=null;return _(()=>{i.value&&(d=ma.registTouchSwipe(i.value,{direction:"vertical",stopPropagation:!1,startCb:(e,t)=>{c.value=!0,t.startY,l("resize",{elementId:n.elementId,deltaY:0,type:"start"})},moveCb:(e,t)=>{const{startY:a,endY:i}=t,o=i-a;l("resize",{elementId:n.elementId,deltaY:o,type:"move"})},endCb:()=>{c.value=!1,l("resize",{elementId:n.elementId,deltaY:0,type:"end"})}}))}),I(()=>{null==d||d()}),(e,t)=>(r(),o("div",{class:f(["track-divider",{"is-dragging":c.value}]),ref_key:"dividerRef",ref:i},[...t[0]||(t[0]=[s("div",{class:"track-divider-handle"},null,-1)])],2))}},[["__scopeId","data-v-b0024ae7"]]),Ws={class:"pan-knob-wrapper"},Ks=Te({__name:"editorMappable",props:{modelValue:{type:Number,default:0},min:{type:Number,default:-63},max:{type:Number,default:63},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","changeend"],setup(e,{emit:t}){const n=e,d=t,u=l(()=>n.min),p=l(()=>n.max),v=a(n.modelValue),m=a(!1),g=a(0),k=a(0),b=a(!1),w=a(null),A=a({top:0,left:0});i(()=>n.modelValue,e=>{m.value||(v.value=e)},{immediate:!0});const C=l(()=>v.value),x=l(()=>C.value/p.value*150),D=l(()=>{const e=C.value;return e<0?`${e}L`:e>0?`${e}R`:"0"}),I=()=>
1{if(!w.value)return;const e=w.value.getBoundingClientRect();A.value={top:e.top-40,left:e.left+e.width/2}},S=l(()=>({position:"fixed",top:`${A.value.top}px`,left:`${A.value.left}px`,transform:"translateX(-50%)"})),P=()=>{b.value=!0,I()},L=()=>{(b.value||m.value)&&I()};_(()=>{window.addEventListener("scroll",L,!0),window.addEventListener("resize",L)}),M(()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)});const R=e=>{if(n.disabled)return;if(e.shiftKey)return v.value=0,d("update:modelValue",0),void d("change",0);m.value=!0,b.value=!0,g.value=e.clientY,k.value=v.value,I(),document.body.style.userSelect="none";const t=document.createElement("style");t.id="cursor-style-override",t.innerHTML="* { cursor: ns-resize !important; }",document.head.appendChild(t),document.addEventListener("mousemove",B),document.addEventListener("mouseup",j)},B=e=>{if(!m.value)return;const t=g.value-e.clientY,a=Math.round(t/3);let n=k.value+a;n=Math.max(u.value,Math.min(p.value,n)),v.value=n,d("update:modelValue",n),d("change",n),I()},j=e=>{m.value=!1,document.body.style.userSelect="";const t=document.getElementById("cursor-style-override");t&&t.remove(),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",j);const a=v.value;d("change-end",a),E(()=>{if(!m.value&&w.value&&e){const t=w.value.getBoundingClientRect();e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom||(b.value=!1)}})},N=()=>{m.value||(b.value=!1)};return(t,a)=>(r(),o("div",Ws,[a[0]||(a[0]=s("svg",{class:"pan-knob-background",width:"30",height:"30",viewBox:"0 0 38 38",fill:"none"},[s("path",{d:"M33.79 27.03h.68L36.61 30h1.05l-2.2-3.01c1.02-.18 1.74-.89 1.74-1.97 0-1.29-.93-2.02-2.25-2.02H32.9v7h.89v-2.97Zm0-3.21h1.15c.8 0 1.36.42 1.36 1.2 0 .77-.56 1.22-1.36 1.22h-1.15v-2.42ZM2.21 23v7h3.6v-.83H3.1V23h-.9.01ZM35 18.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM33 10.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM28 5.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM20 3.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM12 5.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM6 10.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0ZM4 18.5a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0Z",fill:"currentColor"})],-1)),s("div",{ref_key:"panKnobRef",ref:w,class:f(["pan-knob",{"is-dragging":m.value,"is-disabled":e.disabled}]),onMousedown:R,onMouseenter:P,onMouseleave:N},[s("div",{class:"dial-indicator",style:y({transform:`rotate(${x.value}deg)`})},null,4)],34),(r(),T(K,{to:"body"},[b.value||m.value?(r(),o("div",{key:0,class:"bubble-tooltip",style:y(S.value)},[s("span",null,h(D.value),1)],4)):c("",!0)]))]))}},[["__scopeId","data-v-54ea531f"]]);const Ys={class:"equipment-name"},zs={class:"equipment-popover"},Xs={key:0,class:"equipment-popover-loading flex-center"},Qs={key:1,class:"equipment-popover-error"},qs=["onClick"],Zs={class:"equipment-popover-item-label flex1 olh"},Js={key:0,class:"equipment-popover-item-select"},$s={key:3,class:"equipment-popover-empty"},ec=Te({__name:"InputSelector",props:{track:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},setup(e){const t=e,n=a([]),l=a(!1),i=a(!1),v=a(null),m=async()=>{if(!(n.value.length>0||i.value)){i.value=!0,v.value=null;try{const e=await async function(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return{hasPermission:!1,devices:[],error:"浏览器不支持麦克风访问"};try{const e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=(await navigator.mediaDevices.enumerateDevices()).filter(e=>"audioinput"===e.kind).map(e=>({deviceId:e.deviceId,label:e.label||`麦克风 ${e.deviceId.substring(0,8)}`,kind:e.kind,groupId:e.groupId}));return e.getTracks().forEach(e=>e.stop()),{hasPermission:!0,devices:t,error:null}}catch(e){let t="获取麦克风权限失败";return"NotAllowedError"===e.name||"PermissionDeniedError"===e.name?t="用户拒绝了麦克风权限":"NotFoundError"===e.name||"DevicesNotFoundError"===e.name?t="未找到麦克风设备":"NotReadableError"===e.name||"TrackStartError"===e.name?t="麦克风被其他应用占用":"OverconstrainedError"===e.name?t="麦克风配置不支持":"SecurityError"===e.name?t="安全错误:需要在 HTTPS 或 localhost 环境下使用":e.message&&(t=e.message),{hasPermission:!1,devices:[],error:t}}}();l.value=e.hasPermission,n.value=e.devices||[],e.error&&(v.value=e.error)}catch(e){v.value=e.message||"获取设备失败",l.value=!1,n.value=[]}finally{i.value=!1}}};return(a,l)=>{const y=la;return r(),T(y,{"show-arrow":!1,teleported:!0,placement:"bottom-end","popper-class":"studio-popover-box",trigger:"click",disabled:e.disabled,onShow:m},{reference:p(()=>{var t,a,n,i,o;return[s("div",{class:f(["equipment-select flex1",{"is-disabled":e.disabled}])},[s("div",Ys,[s("span",null,h((null==(t=e.track)?void 0:t.input)&&(null==(n=null==(a=e.track)?void 0:a.input)?void 0:n.label)?null==(o=null==(i=e.track)?void 0:i.input)?void 0:o.label:"No Input"),1)]),l[0]||(l[0]=s("div",{class:"arrow flex-center pointer"},[s("img",{src:vl,alt:"arrow"})],-1))],2)]}),default:p(()=>[s("div",zs,[i.value?(r(),o("div",Xs,[u(Na,{loading:!0,size:14,"stroke-width":1.4,color:"#fff"}),l[1]||(l[1]=s("span",null,"Finding inputs...",-1))])):v.value?(r(),o("div",Qs,h(v.value),1)):n.value.length>0?(r(!0),o(d,{key:2},g(n.value,a=>{var n,i;return r(),o("div",{key:a.deviceId,class:"equipment-popover-item flex",onClick:e=>(e=>{var a,n;if(t.disabled)return;const{deviceId:l,label:i}=e;l!=(null==(n=null==(a=t.track)?void 0:a.input)?void 0:n.deviceId)&&lt.toggleInput({trackId:t.track.id,input
1:{deviceId:l,label:i}})})(a)},[l[2]||(l[2]=s("div",{class:"equipment-popover-item-icon"},null,-1)),s("div",Zs,h(a.label),1),a.deviceId===(null==(i=null==(n=e.track)?void 0:n.input)?void 0:i.deviceId)?(r(),o("div",Js)):c("",!0)],8,qs)}),128)):(r(),o("div",$s,"No available devices"))])]),_:1},8,["disabled"])}}},[["__scopeId","data-v-ea6bef0e"]]),tc={class:"flex op-bottom no-drag"},ac=Te({__name:"trackHeaderBottom",props:{track:{type:Object,required:!0}},setup(e){const t=e,a=ot(),n=wn(),i=rt(),{isRecordSelectTrackId:c}=S(n),{isRecording:d}=S(a),p=l(()=>"preview"===i.mode),m=async()=>{var e,l;if(p.value)return;if(d.value||!(null==(l=null==(e=t.track)?void 0:e.input)?void 0:l.deviceId))return;const i=t.track.id!==c.value;if(n.setIsRecordSelectTrackId(i?t.track.id:null),a.setRecordInputObj(i?{...t.track.input,trackId:t.track.id}:null),i)try{(await a.preconnectMicrophone({deviceId:t.track.input.deviceId,label:t.track.input.label||"麦克风"})).success}catch(o){}else try{await a.disconnectPreconnectedMicrophone()}catch(o){}},g=e=>{p.value||t.track.id&&a.setTrackPan(t.track.id,e)},h=e=>{var a;p.value||t.track.id&&(null==(a=nt.MainManagerDispatcher)||a.updateTrackData(t.track.id,{balance:e}),lt.setBalance({trackId:t.track.id,balance:e}))};return(t,a)=>{var n,l,i,k,b,w;return r(),o("div",tc,[s("div",{class:f({"record-btn":!0,"flex-center":!0,"record-btn-select":null==(l=null==(n=e.track)?void 0:n.input)?void 0:l.deviceId,"record-btn-opend":v(c)===e.track.id,"record-btn-disabled":!(null==(k=null==(i=e.track)?void 0:i.input)?void 0:k.deviceId)||v(d)||p.value}),style:y({cursor:!(null==(w=null==(b=e.track)?void 0:b.input)?void 0:w.deviceId)||v(d)||p.value?"not-allowed":"pointer"}),onClick:x(m,["stop"])},[...a[0]||(a[0]=[s("div",{class:"record-btn-icon"},null,-1)])],6),u(ec,{track:e.track,disabled:p.value},null,8,["track","disabled"]),u(Ks,{class:"no-drag","model-value":e.track.balance||0,disabled:p.value,onChange:g,onChangeEnd:h},null,8,["model-value","disabled"])])}}},[["__scopeId","data-v-d73829c8"]]),nc={class:"volume-slider-wrapper",style:{opacity:"1"}},lc={class:"volume-slider-progress-wrapper"},ic={class:"volume-slider-progress-item"},oc={class:"volume-slider-progress-item"},rc=Te({__name:"VolumeSlider",props:{audioData:{type:Object,default:null},decibelValue:{type:[Number,Object],default:null,validator:e=>null===e||("number"==typeof e||"object"==typeof e&&!(void 0!==e.left&&"number"!=typeof e.left||void 0!==e.right&&"number"!=typeof e.right))},currentDecibelBackground:{type:String,default:"linear-gradient(90deg, rgba(255, 255, 255, 0.50) 0%, rgba(255, 255, 255, 0.00) 100%), #48e1eb"},minDecibel:{type:Number,default:-72},maxDecibel:{type:Number,default:12},mode:{type:String,default:"single",validator:e=>["single","master","clip"].includes(e)},initialDecibel:{type:Number,default:null},mute:{type:Boolean,default:!1},passiveMute:{type:Boolean,default:!1},isPlaying:{type:Boolean,default:!0},hasOverLimitTrack:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["decibel-changing","decibel-change-end"],setup(e,{emit:t}){const n=t,d=e,v=e=>{const t=e.toFixed(1);return e>=0?`+${t}dB`:`${t}dB`},m=a(null),g=()=>{const{minDecibel:e,maxDecibel:t,initialDecibel:a}=d,n=t-e;if(n<=0)return 0;const l=((null!=a?a:0)-e)/n;return Math.max(0,Math.min(100,100*l))},k=a(g()),b=a(!1);let w=null;const A=a(0),C=a(0),T=a(0),D=a(0),I=a({width:0}),S=a({width:0});let E=null;const P=l(()=>d.isPlaying&&!d.mute&&!d.passiveMute),L=e=>{const{minDecibel:t,maxDecibel:a}=d,n=a-t;if(n<=0)return 0;return t+e/100*n},R=l(()=>L(k.value)),B=l(()=>{const e="40px";return{left:`clamp(${e}, ${k.value}%, calc(100% - ${e}))`}}),j=l(()=>{if("single"===d.mode)return d.currentDecibelBackground;if("master"===d.mode){if(d.hasOverLimitTrack)return"linear-gradient(90deg, #F99 0%, #E52E2E 100%)";if(R.value>6)return"linear-gradient(90deg, #F99 0%, #E52E2E 100%)"}return d.mute||d.passiveMute?"#474552":d.currentDecibelBackground}),N=new Map,O=l(()=>{if("clip"!==d.mode)return!1;if(R.value>6)return!0;if(null===d.decibelValue||void 0===d.decibelValue)return!1;let e,t;if("number"==typeof d.decibelValue)e=t=d.decibelValue;else{if("object"!=typeof d.decibelValue)return!1;e=d.decibelValue.left??d.decibelValue.right??-1/0,t=d.decibelValue.right??d.decibelValue.left??-1/0}return e>6||t>6}),V=l(()=>"clip"===d.mode&&O.value?"linear-gradient(90deg, #F99 0%, #E52E2E 100%)":j.value),F=l(()=>{const e=(e=>{if(!e)return"rgb(72, 225, 235)";if(N.has(e))return N.get(e);let t=e;if(e.startsWith("#"))t=e;else if(e.startsWith("rgb"))t=e;else if(e.match(/linear-gradient[^)]+\)/)){const a=e.match(/#[0-9A-Fa-f]{3,6}/g);if(a&&a.length>0)t=a[a.length-1];else{const a=e.match(/rgba?\([^)]+\)/g);a&&a.length>0&&(t=a[a.length-1])}}return N.set(e,t),t})(j.value);if(e.startsWith("#")){const t=e.slice(1);return`rgba(${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}, 0.5)`}if(e.startsWith("rgb(")){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){const[,e,a,n]=t;return`rgba(${e}, ${a}, ${n}, 0.5)`}}if(e.startsWith("rgba(")){const t=e.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*[\d.]+\)/);if(t){const[,e,a,n]=t;return`rgba(${e}, ${a}, ${n}, 0.5)`}}return"rgba(72, 225, 235, 0.5)"}),U=a(!1),H=l(()=>{if(!P.value)return{width:"0%",background:V.value};if(U.value)return{width:"0%",background:V.value};const e=A.value;return{width:`${e<.01?0:e}%`,background:V.value}}),G=l(()=>{if(!P.value)return{width:"0%",background:V.value};if(U.value)return{width:"0%",background:V.value};const e=C.value;return{width:`${e<.01?0:e}%`,background:V.value}}),W=l(()=>0),K=l(()=>{if(!P.value)return{width:"0%"};const e=T.value+W.value,t=e<.01?0:e;return{width:`${Math.max(0,Math.min(100,t))}%`}}),Y=l(()=>{if(!P.value)return{width:"0%"};const e=D.value+W.value,t=e<.01?0:e;return{width:`${Math.max(0,Math.min(100,t))}%`}}),z=l(()=>{const{minDecibel:e,maxDecibel:t}=d,a=t-e;if(a<=0)return 0;const n=(0-e)/a;return Math.max(0,Math.min(100,100*n))});let X=null,Q=0;const q=()=>{X&&(X.remove(),X=null)},Z=e=>{if(d.disabled||d.mute||d.passiveMute)return;b.value=!0,e.preventDefault(),e.stopPropagation(),w=e.pointerId;const t=e.currentTarget;if(null==t?void 0:t.setPointerCapture)try{t.setPointerCapture(w)}catch{}(e=>{const t=e.currentTarget.getBoundingClientRect();if(Q=t.top,X=document.createElement("div"),X.className="volume-decibel-controller-clone",X.style.cssText=`\n    position: fixed;\n    width: 4px;\n    height: 12px;\n    border-radius: 100px;\n    background: #fff;\n    cursor: ew-resize;\n    z-index: 9999;\n    pointer-events: none;\n    box-shadow: 0 0 0 2px ${F.value};\n  `,m.value){const t=m.value.getBoundingClientRect();let a=e.clientX-2;const n=t.left-2,l=t.right-2;a=Math.max(n,Math.min(l,a)),X.style.left=`${a}px`}else X.style.left=e.clientX-2+"px";X.style.top=`${Q}px`,document.body.appendChild(X)})(e),document.addEventListener("pointermove",J),document.addEventListener("pointerup",$),document.addEventListener("pointercancel",$),ee(e)},J=e=>{b.value&&(null!==w&&e.pointerId!==w||(e.preventDefault(),e.stopPropagation(),(e=>{if(!X||!m.value)return;const t=m.value.getBoundingClientRect();let a=e.clientX-2;const n=t.left-2,l=t.right-2;a=Math.max(n,Math.min(l,a)),X.style.left=`${a}px`})(e),ee(e)))},$=e=>{if(!b.value)return;null==e||e.stopPropagation(),q(),document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",$),document.removeEventListener("pointercancel",$),b.value=!1;const t=L(k.value);if(n("decibel-change-end",t),null!==w){const t=document.elementsFromPoint((null==e?void 0:e.clientX)||0,(null==e?void 0:e.clientY)||0).find(e=>{var t;return null==(t=e.classList)?void 0:t.contains("volume-decibel-controller")});if(null==t?void 0:t.releasePointerCapture)try{t.releasePointerCapture(w)}catch{}}w=null},ee=e=>{if(!m.value)return;const t=m.value.getBoundingClientRect(),a=(e.clientX-t.left)/t.width*100,l=Math.max(0,Math.min(100,a)),i=L(l);let o=Math.round(10*i)/10;Math.abs(o)<=.3&&(o=0);const r=ae(o);k.value=r,n("decibel-changing",o)},te=e=>{if(e<=0)return 0;const t=20*Math.log10(e);return Math.max(0,Math.min(100,(t- -60)/60*100))},ae=e=>{const{minDecibel:t,maxDecibel:a}=d,n=a-t;if(n<=0)return 0;const l=(e-t)/n*100;return Math.max(0,Math.min(100,l))};let ne=0,le=0,ie=0,oe=0,re=0,se=0,ce=0,de=0,ue=0,pe=0,ve=0,me=0;const ge={width:0},he={width:0},fe=(e,t,a=.4)=>t+(e-t)*a,ye=(e,t,a,n,l)=>{if(e>a)return{value:e,hold:a=e,holdTime:n=l};if(l-n<200){return{value:t+.2*(a-t),hold:a,holdTime:n}}const i=.95*a;return{value:t+.2*(i-t),hold:i,holdTime:n}},ke=()=>{if(!P.value&&!d.decibelValue)return void(E=requestAnimationFrame(ke));if(me++,me%2!=0)return void(E=requestAnimationFrame(ke));let e=null;if(null!==d.decibelValue&&void 0!==d.decibelValue){let t,a;if("number"==typeof d.decibelValue)t=a=d.decibelValue;else{if("object"!=typeof d.decibelValue)return void(E=requestAnimationFrame(ke));t=d.decibelValue.left??d.decibelValue.right??0,a=d.decibelValue.right??d.decibelValue.left??0}const n=ae(t),l=ae(a);e={left:n,right:l,leftMax:n,rightMax:l}}else{if(!d.audioData)return A.value=0,C.value=0,T.value=0,D.value=0,ge.width=0,he.width=0,I.value=ge,S.value=he,void(E=requestAnimationFrame(ke));{const t=d.audioData.timeDomainData||null,a=d.audioData.frequencyData||null;if(!t&&!a)return A.value=0,C.value=0,T.value=0,D.value=0,ge.width=0,he.width=0,I.value=ge,S.value=he,void(E=requestAnimationFrame(ke));e=((e,t)=>{if(e&&e.length>0){const t=Math.floor(e.length/2),a=Math.max(1,Math.floor(t/256));let n=0,l=0,i=0,o=0,r=0;for(let d=0;d<t;d+=a){const a=(e[d]-128)/128;
1n+=a*a,i=Math.max(i,Math.abs(a));const s=(e[d+t]-128)/128;l+=s*s,o=Math.max(o,Math.abs(s)),r++}const s=Math.sqrt(n/r),c=Math.sqrt(l/r);return{left:te(s),right:te(c),leftMax:te(i),rightMax:te(o)}}if(t&&t.length>0){const e=Math.floor(t.length/2),a=Math.max(1,Math.floor(e/256));let n=0,l=0,i=0,o=0,r=0;for(let s=0;s<e;s+=a)n+=t[s],i=Math.max(i,t[s]),r++;for(let s=e;s<t.length;s+=a)l+=t[s],o=Math.max(o,t[s]);return{left:n/r/255*100,right:l/r/255*100,leftMax:i/255*100,rightMax:o/255*100}}return{left:0,right:0,leftMax:0,rightMax:0}})(t,a)}}if(e){const t=Date.now();ve++;const a=fe(e.left,re,.6),n=fe(e.right,se,.6);if(ve>=1){ve=0;const l=fe(e.left,ne),i=fe(e.right,le),o=ye(a,ie,ce,ue,t),r=ye(n,oe,de,pe,t),s=Math.max(o.value,a),c=Math.max(r.value,n);ce=o.hold,ue=o.holdTime,de=r.hold,pe=r.holdTime;const d=k.value,u=Math.min(d,z.value),p=Math.max(0,Math.min(100,l))/100,v=Math.max(0,Math.min(100,i))/100,m=Math.max(0,Math.min(100,s))/100,g=Math.max(0,Math.min(100,c))/100;A.value=d*p,C.value=d*v,T.value=Math.min(d*m,u),D.value=Math.min(d*g,u),ne=l,le=i,ie=s,oe=c}const l=k.value,i=Math.min(a,l),o=Math.min(n,l),r=Math.min(i,l),s=Math.min(o,l),c=Math.min(l,z.value),d=1.15,u=r*d,p=s*d;T.value<u&&(T.value=Math.min(u,c)),D.value<p&&(D.value=Math.min(p,c)),ge.width=r<.01?0:Math.max(0,r),he.width=s<.01?0:Math.max(0,s),I.value=ge,S.value=he,re=a,se=n}E=requestAnimationFrame(ke)};return i(()=>d.initialDecibel,()=>{if(b.value)return;const e=g();k.value=e}),i(P,(e,t)=>{e?!1===t&&(U.value=!0,requestAnimationFrame(()=>{U.value=!1})):(A.value=0,C.value=0,T.value=0,D.value=0,ge.width=0,he.width=0,I.value=ge,S.value=he,ne=0,le=0,ie=0,oe=0,re=0,se=0,ce=!1,ue=0,de=!1,pe=0,ve=0)}),_(()=>{ke()}),M(()=>{E&&(cancelAnimationFrame(E),E=null),q(),document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",$),document.removeEventListener("pointercancel",$),w=null,b.value=!1}),(t,a)=>{const n=sa;return r(),o("div",{class:f(["volume-slider-container",{"is-disabled":e.disabled}])},[s("div",nc,[s("div",{ref_key:"trackRef",ref:m,class:"volume-slider-track"},[u(n,{effect:"dark",content:v(R.value),placement:"bottom","popper-class":"volume-slider-tooltip",disabled:b.value},{default:p(()=>[s("div",{class:f(["volume-decibel-controller",{"is-dragging":b.value,"is-muted":e.mute||e.passiveMute,"is-disabled":e.disabled}]),style:y({left:k.value+"%","--hover-color":F.value}),draggable:"false",onDragstart:a[0]||(a[0]=x(()=>{},["prevent"])),onPointerdown:Z},null,38)]),_:1},8,["content","disabled"]),b.value?(r(),o("div",{key:0,class:"volume-drag-label",style:y(B.value)},h(v(R.value)),5)):c("",!0),s("div",{class:"volume-base-line",style:y({left:z.value+"%"})},null,4),s("div",lc,[s("div",ic,[s("div",{class:"volume-current-decibel",style:y(H.value)},null,4),s("div",{class:"volume-realtime-decibel",style:y({width:P.value?I.value.width+"%":"0%"})},null,4),s("div",{class:f(["volume-max-decibel-point",{hidden:!P.value}]),style:y(K.value)},null,6)]),s("div",oc,[s("div",{class:"volume-current-decibel",style:y(G.value)},null,4),s("div",{class:"volume-realtime-decibel",style:y({width:P.value?S.value.width+"%":"0%"})},null,4),s("div",{class:f(["volume-max-decibel-point",{hidden:!P.value}]),style:y(Y.value)},null,6)])])],512)])],2)}}},[["__scopeId","data-v-ddf59750"]]),sc={class:"flex op-middle no-drag"},cc={class:"flex1"},dc={class:"flex-center op-middle-right"},uc=Te({__name:"trackHeaderMiddle",props:{track:{type:Object,required:!0}},emits:["volume-change","volume-change-end"],setup(e,{emit:t}){const n=e,c=t,d=ot(),m=rt(),g=a(null),h=l(()=>"preview"===m.mode),y=l(()=>{if(n.track.solo)return!1;return m.state.tracks.some(e=>e.solo)});let k=null;const b=e=>{n.track.id&&d.setTrackVolume(n.track.id,e),c("volume-change",e)},w=e=>{n.track.id&&lt.setVolume({trackId:n.track.id,volume:e}),c("volume-change-end",e)},A=()=>{h.value||lt.toggleMute({trackId:n.track.id,mute:!n.track.mute})},C=()=>{h.value||lt.toggleSolo({trackId:n.track.id,solo:!n.track.solo})},T=()=>{g.value=null},x=()=>{if(d.isPlaying()){if(n.track.id)try{const e=d.getTrackChannelVolumes(n.track.id);e?g.value={left:e.leftDb,right:e.rightDb}:T()}catch(e){}}else T()},D=()=>{k||(x(),k=setInterval(x,50))},S=()=>{k&&(clearInterval(k),k=null),T()};return i(()=>d.isTonePlayerPlaying,e=>{e?D():S()}),_(()=>{d.isPlaying()&&D()}),I(()=>{S()}),(t,a)=>(r(),o("div",sc,[s("div",cc,[u(rc,{"decibel-value":g.value,mute:e.track.mute,"passive-mute":y.value,"is-playing":v(d).isPlaying(),"initial-decibel":e.track.volume,"current-decibel-background":e.track.color,disabled:h.value,onDecibelChangeEnd:w,onDecibelChanging:b}
1,null,8,["decibel-value","mute","passive-mute","is-playing","initial-decibel","current-decibel-background","disabled"])]),s("div",dc,[u(da,{content:"Mute(Shift+M)",position:"top","show-after":1e3},{default:p(()=>[s("div",{class:f(["item flex-center",{muted:e.track.mute,"is-disabled":h.value}]),onClick:A}," M ",2)]),_:1}),u(da,{content:"Solo(Shift+S)",position:"top","show-after":1e3},{default:p(()=>[s("div",{class:f(["item flex-center",{solo:e.track.solo,"is-disabled":h.value}]),onClick:C}," S ",2)]),_:1})])]))}},[["__scopeId","data-v-3f13c6b6"]]),pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADGSURBVHgB7djhCcMgFATgG60jZKO6QbNB3DAjXJW0FFpsjIo+4T54f+MdvEgIICIiIiKmkLyH2V/zwExC4I2/HGaQCB/tsO5PePsFTsJHK6zKCO9hlcKPovCZB93CuDALGukZ/vugDZV6hl8SBxSXYM+d57E2bFWCvV9YHrvPFiU46raJD64twdFXZU2J4eFrSpgJX1LCXPgrJWj98yCjhN3wb4UlPCy5WMLDoswSHpadlPCYQaKEx0xC4JWfv2gOIiIiku8JtDXNh2PYLpwAAAAASUVORK5CYII=",vc={class:"flex op-top flex-center"},mc={class:"instrument-wrapper"},gc={key:1,class:"track-name flex1"},hc={class:"more-popover"},fc={class:"more-popover-item-color-picker"},yc=["onClick"],kc={key:0,class:"more-popover-item-color-picker-item-check"},bc=Te({__name:"trackHeaderTop",props:{track:{type:Object,required:!0},isMinHeight:{type:Boolean,default:!1},isIncluded:{type:Boolean,default:!1},isSelected:{type:Boolean,default:!1},disableBubble:{type:Boolean,default:!1}},emits:["instrument-select","rename","add-take-lane","color-change","duplicate-track","delete-track","toggleTakeLanes","select-change"],setup(e,{emit:t}){const n=rt(),i=l(()=>"preview"===n.mode),{exportSong:m}=wt(),k=e,b=t,w=a(null),A=a(null),C=a(!1),_=a(""),D=a(null),I=e=>{b("select-change",e)},S=e=>{var t;e!==k.track.instrument.type&&(b("instrument-select",e),null==(t=w.value)||t.hide())},M=()=>{i.value||(C.value=!0,_.value=k.track.name||"",E(()=>{D.value&&(D.value.focus(),D.value.select())}))},L=e=>{"Enter"===e.key?R():"Escape"===e.key&&B()},R=()=>{const e=_.value.trim();e||(_.value=k.track.name||""),e&&e!==k.track.name&&k.track.id&&b("rename",e),C.value=!1},B=()=>{C.value=!1,_.value=""},j=()=>{var e;null==(e=A.value)||e.hide(),M(),I(k.track.id)},N=()=>{var e;null==(e=A.value)||e.hide(),m(Ct.TRACK,{selectedTracks:[k.track],fileName:k.track.name})},O=()=>{var e;b("add-take-lane"),null==(e=A.value)||e.hide()},F=()=>{var e;b("duplicate-track"),null==(e=A.value)||e.hide(),I(k.track.id)},U=()=>{var e;b("delete-track"),null==(e=A.value)||e.hide()},H=()=>{if(k.track.id){const e=k.isMinHeight?88:32;lt.setHeight({trackId:k.track.id,height:e})}};return(t,a)=>{var n,l;const m=la;return r(),o("div",vc,[s("div",mc,[u(_l,{class:"no-drag","show-arrow":!1,"show-name":!1,instrument:e.track.instrument,onChange:S},null,8,["instrument"])]),C.value?(r(),o("div",gc,[P(s("input",{ref_key:"nameInputRef",ref:D,"onUpdate:modelValue":a[0]||(a[0]=e=>_.value=e),class:"track-name-input",maxlength:"100",onKeydown:L,onBlur:R},null,544),[[V,_.value]])])):(r(),T(da,{key:0,content:"Double-click to rename",position:"top","show-after":1e3,disabled:k.disableBubble},{default:p(()=>[s("div",{class:"track-name flex1 pointer",onDblclick:M,onClick:I},[s("span",null,h(e.track.name),1)],32)]),_:1},8,["disabled"])),s("div",{class:f(["more flex-center no-drag",{"is-included":e.isIncluded||e.isSelected}])},[(null==(l=null==(n=e.track)?void 0:n.takeLanes)?void 0:l.length)>0?(r(),T(da,{key:0,content:e.track.takeLanesExpanded?"Hide Take Lanes":"Show Take Lanes","show-after":1e3,position:"top",disabled:k.disableBubble},{default:p(()=>[s("div",{class:"item flex-center",onClick:a[1]||(a[1]=e=>t.$emit("toggleTakeLanes"))},[...a[4]||(a[4]=[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEFSURBVHgB7ZbNDYJAEIXfEjvAGuxBa7AIe+BmAd7sQWuwB+zBHrh6xZm4JjAZfl1YEuZLyP6GfcwMLwsYhrEyXHVQlmVKzYGe3DlXyM20vqdmi7DUzpKCLtSwqII2nRUxJ4SndlYiFlPRzs6m70b6iidFibvBU4YxghgWhYlJsDBMUBeNgrwnzU5bUWckSiti9o1cTlZMdSg1Y2wTxAcctQX+/RVRGcb5FxtuozFGpy1CN+gmqKaMuGJkytBH0FAT9HXwwJ+YD3WxeEHvXyeWMcoLGnvJzg+5SGc3RimIxWTd78BdiqrcNofSfGOkhRe+/lMgEk6b9OHnaPU2xlApMwxjdXwAkKdZ9JmoUQYAAAAASUVORK5CYII=",alt:""},null,-1)])])]),_:1},8,["content","disabled"])):c("",!0),c("",!0),u(m,{ref_key:"morePopoverRef",ref:A,"show-arrow":!1,teleported:!0,placement:"bottom-end","popper-class":"studio-popover-box",trigger:"click",disabled:i.value,"popper-options":{modifiers:[{name:"preventOverflow",options:{mainAxis:!0,altAxis:!0,padding:8,boundary:"clippingParents",rootBoundary:"viewport",tether:!0,tetherOffset:0}}]}},{reference:p(()=>[s("div",{class:"item flex-center",onClick:a[3]||(a[3]=x(()=>{},["stop"]))},[...a[6]||(a[6]=[s("img",{src:"data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%202.75C6.27614%202.75%206.5%202.52614%206.5%202.25C6.5%201.97386%206.27614%201.75%206%201.75C5.72386%201.75%205.5%201.97386%205.5%202.25C5.5%202.52614%205.72386%202.75%206%202.75Z'%20stroke='white'%20stroke-opacity='0.6'%20stroke-width='1.16667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6%206.5C6.27614%206.5%206.5%206.27614%206.5%206C6.5%205.72386%206.27614%205.5%206%205.5C5.72386%205.5%205.5%205.72386%205.5%206C5.5%206.27614%205.72386%206.5%206%206.5Z'%20stroke='white'%20stroke-opacity='0.6'%20stroke-width='1.16667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6%2010.25C6.27614%2010.25%206.5%2010.0261%206.5%209.75C6.5%209.47386%206.27614%209.25%206%209.25C5.72386%209.25%205.5%209.47386%205.5%209.75C5.5%2010.0261%205.72386%2010.25%206%2010.25Z'%20stroke='white'%20stroke-opacity='0.6'%20stroke-width='1.16667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:""},null,-1)])])]),default:p(()=>[s("div",hc,[s("div",{class:"more-popover-item",onClick:O},[...a[7]||(a[7]=[s("div",{class:"more-popover-item-icon"},[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGfSURBVHgB7ZmLcYMwDIZFrwPQDRihI8Am2aAj0A1KJ6Cb0E5ANnA3aDdQxeHegWPHNvGrPX13ulyCBb/AlhUBwDDMVRCxJXshE5iOmWwka+Ao5FxL4blZNNQmnZVJPH1MZI9QBmeyrqqqb/XAncGhh3LELyxaeqeRdPcbzWMUuK6FGhIgryU0OloX51EjPolwRUetCWJwcZy9o46EfBK7m6mOqTROuBtAQCbkk//a/qbqiR6Aej4TpuvY9Jiy0J+BA8jNPSQmdFLgKZQbDiA3HEBuOIBfZPnbk02b6nGG1Cjlq1MhhuufIIEOgCc2/yDVqKzTG3DAdyeOXo3S+U/gKD4GIdbAE2Tk5inkO6+Lm0K5CRHAu8fYMwQmRAAfHmNfITa+eRv1/RsdAg7gqyfWRrYca+AASQLY+J5w3xibyJ7xhs6eTY81jRIPuq5wKlQ9Lmn0U/merUuNl21NexYjp0Ezf0tp7o4uji3qF2ELCZDCTe31xvUkA5aHtrX+P18xyYEdpNg57SwausOZENdN6g0vX3zEROA6jVtgGOYqPz9OiA2mgKXkAAAAAElFTkSuQmCC",alt:""})],-1),s("div",{class:"more-popover-item-label"},"Add Take Lane",-1)])]),s("div",{class:"more-popover-item",onClick:j},[...a[8]||(a[8]=[s("div",{class:"more-popover-item-icon"},[s("img",{src:$,alt:""})],-1),s("div",{class:"more-popover-item-label"},"Rename",-1)])]),s("div",{class:"more-popover-item",onClick:N},[...a[9]||(a[9]=[s("div",{class:"more-popover-item-icon"},[s("img",{src:Ia,alt:""})],-1),s("div",{class:"more-popover-item-label"},"Download track",-1)])]),a[13]||(a[13]=s("div",{class:"more-popover-item-divider"},null,-1)),a[14]||(a[14]=s("div",{class:"more-popover-item more-popover-item--color"},[s("div",{class:"more-popover-item-icon"},[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMcSURBVHgB7VqNlZswDBaZgBG8QdMJyk1w6QRNJ7jcBEc3SCdIOkHuJiCdIN2AdAKygSo9fD1HyGADgb6++97TIwFZlmz9xQTgHfMigRGAiCldlkT3RMZ+Ti294mzpF9FPviZJcoY5QYpnRAVRhf1QEK2JDEwJR/Exsbu5ITzBDRR3URJtYnQKjgES/IUuW7j2axdnoheoffxIdCEfv9ixPMbAW3x8IsrAD5bxebQYIQWeWlbtQJRBJOxuru2q+3ZjCUPRonyBI/lsiyHVICM8ylexfho4l7G7OY4RdlVG2VYak7LRlkwHb+6Z18RMaLCZ2+OEXMsqhZy0hxEFhMKzlUuFr3Nl7TOJThf0GNHtuqi7zkbhC1rZvgbYsYUYV2HH7gE2s8HBwxekGNa7VApDDYQZoLly7vIsxIAM6mLj4hEGwBazOyuH6WNogbJ838Xte+8ArPsRF7sW3t4rGwM7j0TWn/F6jMG3IE7hRsBmLGw0ppVgKmEiYEc2w2a8PWtCthjoPmMCA7IZfV/6FtcN4g9C9gtMgxVcJw7+vBY8Z/H9r4EL7aZn0Gx4bcsdNOMNm/lWK0rBPU0oMCCboZJgNEGtDNijp4kwojWbYf0T1sVJE9JlQO+WYCiwJQu5MXARg26W13vgQXxX02gprDTi+SSVV9HrQdl5ozHKFnqt8ExSecV8MrnsfMyykG1hRmBdvEqhU+XddWxG+mSthNCDXfUJdTSSRuIOpAsr7brGHRWRI4yoHNSVVnM/vs/dwNrz/BvpkkPHBIWw+AAjAIef6OWhE2XKYAMDgM0CGAP2+VXshIUQEn4aoMsrMR6seI4BmS5RJszoIpV+JP+LzkoeWWfQG0UupL+JngfHHeqnAX0OtLp/iAzEwnP/K1y3FryVXOgMDEMFUwFHOFpEPSlkMBVQPx1jhB5Myf6JcYIp0WJEkEt5dmH4uX8MWoxg7LD7+OWEc7mRowTHRNvbyNIaw8cz3IildpxWyDKYA+h/CRGDWZpEaY
1jvlVAIcvhXgHWA7iOU38PIGPOvBpklboll23wk+kEtwh7e8Z/hDwjvEoi7Fbo1AAAAAElFTkSuQmCC",alt:""})]),s("div",{class:"more-popover-item-label"},"Change Track Color")],-1)),s("div",fc,[(r(!0),o(d,null,g(v(ye),t=>(r(),o("div",{key:t,class:f({"more-popover-item-color-picker-item":!0,pointer:!0,"flex-center":!0,"more-popover-item-color-picker-item-active":e.track.color===t}),onClick:e=>(e=>{var t;e!==k.track.color&&(b("color-change",e),null==(t=A.value)||t.hide())})(t)},[t===e.track.color?(r(),o("div",kc,[...a[10]||(a[10]=[s("img",{src:pc,alt:""},null,-1)])])):c("",!0),s("span",{style:y({backgroundColor:t})},null,4)],10,yc))),128))]),a[15]||(a[15]=s("div",{class:"more-popover-item-divider mb-4"},null,-1)),s("div",{class:"more-popover-item",onClick:F},[...a[11]||(a[11]=[s("div",{class:"more-popover-item-icon"},[s("img",{src:Li,alt:""})],-1),s("div",{class:"more-popover-item-label"},"Duplicate Track",-1)])]),s("div",{class:"more-popover-item",onClick:U},[...a[12]||(a[12]=[s("div",{class:"more-popover-item-icon"},[s("img",{src:Ri,alt:""})],-1),s("div",{class:"more-popover-item-label more-popover-item-label--delete"}," Delete Track ",-1)])])])]),_:1},8,["disabled"]),s("div",{class:"item flex-center",onClick:H},[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACYSURBVHgB7dHBDYAgDIXh4gpu41rM4Vps4wzIoVxIKLTvpHl/QtSo5TOKMMYYY98uWTdrrWc7ZL28U0qPBPLMOcTuauvUlXVwFNPnXNbzK1Bpq3+NGzVgRGcV6x3zlxlDl78v+t4SFBkexWyDPJsgGBdoZzMU4wZZm+o5hAmBDJSgmDBoghIUA4EmKAgDgwaUoBjGGGPsD72dzGxndCxnhgAAAABJRU5ErkJggg==",alt:"",style:y({transform:e.isMinHeight?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s"})},null,4)])],2)])}}},[["__scopeId","data-v-7fd371c3"]]),wc={class:"version-content flex-center"},Ac={key:0,class:"version-content-play flex-center"},Cc=Te({__name:"versionItem",props:{version:{type:Object,required:!0},trackColor:{type:String,required:!0},height:{type:Number,required:!0},isSelected:{type:Boolean,default:!1},isIncluded:{type:Boolean,default:!1},isSolo:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:t}){const a=ot(),{isTonePlayerPlaying:n}=S(a),l=e,i=t,d=()=>{i("select",l.version.id)};return(t,a)=>(r(),o("div",{class:"version-item pointer",style:y({height:e.height+"px",borderColor:e.isSelected?e.trackColor:"transparent",backgroundColor:e.isIncluded?"rgba(255, 255, 255, 0.04)":"transparent"}),onClick:d},[s("div",wc,[s("div",{class:"not-read",style:y({backgroundColor:e.trackColor})},null,4),s("div",{class:f(["flex1 olh version-content-name",{"version-content-name-selected":e.isSelected||e.isIncluded||v(n)&&e.isSolo}])},h(e.version.name),3),e.isSolo?(r(),o("div",Ac,[...a[0]||(a[0]=[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANzSURBVHgB7ZhdTttAEIBnnAScuJUsNan6CCdoOEHhBKQngBs0PQHtCYAThJ4AOEG4QdoTQN+qEql+IGDy4+mMI6f2eh0nxHFUyZ+E5KzH7Mzu7OzMABQUFBQUFKyB17W3Lata79XMOlnVRs8yG8fz5C3zzVFtu/6nZjZuq9V6GzYJK34qiqt/8xQTxcOybHDHtnfstLkQMkQmHLkPlwSwr5fAu0f3flf3RlaftbFV+S0oHTjurztIwICMsCqN5tAd9JKVF2gn6Q0ifhaFVfkhTLq2+S7xu0wMEP8lg7rzFExj4N5feLzaiPA9+oZ2Rji5THKnlQ0QfyfAi/j2L4/LrjJ46u/xTnwLjxNRc/Q0ONF98+IzkO7veh7d/kJz8qG+YNWPwmO82gcPbv9GGVsOUfyVWd9P9/fV2DJHbfVMeIAdVS51NURZQjwkgtYqPh6w6A4Ec3sA3cigZ3x8HP6+Cn4m7oCsNG9jR/4B+2A7C+WXZeou0fOAhvcp8lv3oe/fzwNRvAkZo9sBy2o0K5OSo4v3JodQA8a34bEtGO86ruPLaneA/ft0HcrrkBSDJtQb4rini/cSmdjim/DYM5ZbwXPMAPE7dpdjyAukqUsQ2BzvtamGR3Ad/m0QvZ89x4QBjyBHODjMdpo8+KCTKSmXG4GxHzzHDEDMx3W0GPpAUTbH0dsZaXZpxgwIr0jukP42d5gkucySuU2hMUDNCHMEwdEN20ySnOYMeNewIZDUTHTK2C1H3dr7t8hxAwivIFdCO474QycxUc+lQT9nj6qw7vpeJxz1zv0HAqdCpTOdjIFwGPkmtMgJqYTNqUS5u46IpEslJF0wTZNjzZ2jexdPJcq7QdqhjUIStirb44O8dkLSBZ3yggGTSCEjaUU4Z0oMo2IEF+DHUkSIIfFSb/2Yfm6kpjVKdgpLMq3EBi0uZk5ekmIvWg/IPFI0ReeIdzWWvshkq2cFuJIlZsnw6aGjLhDP91WVe/FN7Bfgbp/dK/5PVyEopFjbVnic2y7nsnCqfCaNLe5MtDmTPFmkMzHPhcTnS9xCidci3OAyrT3dQc+sMzcNd5PU3lCSAX5vifBs2e5cZsmcuFTquSBMjGSc43/ZaGtRSDsXHIrPEz8miipPcOW7zRzl14rUukF7fZGWucj7HWpu8m68vV5QUFBQ8N/wFz64iwgPr09jAAAAAElFTkSuQmCC",alt:""},null,-1)])])):c("",!0)])],4))}},[["__scopeId","data-v-00980bbd"]]),_c={class:"track-header-wrapper"},Tc={class:"track-header-op flex-column"},xc=Te({__name:"trackHeader",props:{track:{type:Object,default:()=>{}},trackIndex:{type:Number,default:0},disableBubble:{type:Boolean,default:!1}},setup(e){const t=1/0,n=1/0,p=e,v=ot(),m=rt(),h=l(()=>"preview"===m.mode),k=l(()=>p.track.takeLanes||[]),b=a(p.track.height);let w={};const A=a({}),C=a(new Set),_=l(()=>m.state.selection),T=e=>_.value.trackIds.includes(e),x=e=>T(e)&&"tracks"===_.value.focusedArea,D=l(()=>T(p.track.id)),I=l(()=>x(p.track.id)),S=e=>T(e),M=e=>{if(!A.value[e]){const t=k.value.find(t=>
1t.id===e);A.value[e]=(null==t?void 0:t.height)||32}return A.value[e]},P=l(()=>p.track.height<=32),L=(e,t,a)=>Math.max(t,Math.min(a,e));i(()=>p.track.height,e=>{b.value=L(e,32,t)},{immediate:!0}),i(()=>p.track.takeLanes,e=>{if(!e)return;const t=new Set(e.map(e=>e.id));Object.keys(A.value).forEach(e=>{const a=Number(e)||e;t.has(a)||delete A.value[e]}),e.forEach(e=>{if(C.value.has(e.id))return;const t=L(e.height||32,32,n);A.value[e.id]=t})},{immediate:!0,deep:!0});const R=e=>{var a,n;if("start"!==e.type){if("move"===e.type&&void 0!==w["track-header"]){const l=L(w["track-header"]+e.deltaY,32,t);return b.value=l,null==(a=nt.MainManagerDispatcher)||a.updateTrackData(p.track.id,{height:b.value}),void(null==(n=nt.MainManagerDispatcher)||n.triggerRender({renderModule:"partial",renderLayer:["ruler","grid","waveform","interaction"],trackIndex:p.trackIndex}))}"end"===e.type&&(p.track.id&&b.value!==p.track.height&&lt.setHeight({trackId:p.track.id,height:b.value}),delete w["track-header"])}else w["track-header"]=b.value},B=e=>{j(e)},j=e=>{var t,a;const n=null==(t=nt.MainManagerDispatcher)?void 0:t.setSelectionDataByTrackId({trackId:e,syncData:!0,focusedArea:"tracks"});(null==n?void 0:n.mainTrackIndexs)&&(null==(a=nt.MainManagerDispatcher)||a.triggerRender({renderModule:"partial",renderLayer:["grid","interaction"],trackIndex:n.mainTrackIndexs,datasyncStateData:!1}))},N=()=>{h.value||B(p.track.id)},O=()=>{var e,t,a;const n=null==(e=nt.MainManagerDispatcher)?void 0:e.getTrackDataManagerByTrackId(p.track.id),l=null==(t=null==n?void 0:n.VersionTracksManage)?void 0:t.addTrackData();if(!(null==l?void 0:l.track))return;const i=[n.getTrackStateData()];j(l.track.trackData.id),lt.batchUpdate({tracks:i},{skipNotify:!0}),null==(a=nt.MainManagerDispatcher)||a.triggerRender({renderModule:"partial",renderLayer:["ruler","grid","waveform","interaction"],trackIndex:n.extendData.index})},V=e=>{p.track.id&&lt.rename({trackId:p.track.id,name:e})},F=e=>{e!==p.track.color&&lt.setColor({trackId:p.track.id,color:e})},U=async()=>{var e,t;const a=ae(),n=(null==(e=p.track.clips)?void 0:e.map(e=>({...e,id:ae()})))||[],l=(null==(t=p.track.takeLanes)?void 0:t.map(e=>({...e,id:ae()})))||[];lt.duplicate({trackId:p.track.id,track:{...p.track,id:a,clips:n,takeLanes:l}}),await E(),B(a)},H=()=>{var e,t;const a=m.state.tracks||[],n=a.findIndex(e=>e.id===p.track.id),l=1===a.length;let i=null;if(a.length>1){const l=n===a.length-1;i=l?(null==(t=a[n-1])?void 0:t.id)||null:(null==(e=a[n+1])?void 0:e.id)||null}ct(()=>{l?st.set({selection:{clipId:null,startTime:0,endTime:0,focusedArea:null,focusedTrackId:null,type:"",trackIds:[]}}):st.set({selection:{...m.state.selection,focusedTrackId:i,trackIds:i?[i]:[]}}),lt.remove(p.track.id)})},G=e=>{if(!e)return null;const t=Aa.find(t=>t.type===e);return(null==t?void 0:t.name)||(null==t?void 0:t.type)||null},W=e=>{var t,a,n;if(e.type===p.track.instrument.type)return;const l=p.track.id,i=(null==(a=null==(t=p.track)?void 0:t.instrument)?void 0:a.type)||null,o=(null==(n=p.track)?void 0:n.name)||"",r="string"==typeof o&&((e,t)=>{const a=G(t);return!(!a||e!==a)||"Song"===t&&"New Track"===e})(o,i);if(lt.setInstrument({trackId:l,instrument:e}),r){const t=G(e.type);t&&t!==o&&lt.rename({trackId:l,name:t})}},K=()=>{p.track.id&&dt.toggleExpanded({trackId:p.track.id,takeLanesExpanded:!p.track.takeLanesExpanded})},Y=e=>{const t=e===p.track.soloTakeLaneId?null:e;lt.update({...p.track,soloTakeLaneId:t}),v.switchTakeLane(p.track.id,t),B(e)};return(t,a)=>(r(),o("div",_c,[s("div",{class:"track-header pointer drag-handle",style:y({height:b.value+"px",borderLeftColor:e.track.color}),onClick:N},[s("div",{class:f(["height-all",{"is-included":D.value}]),style:y({borderColor:I.value?e.track.color:"transparent"})},[s("div",Tc,[u(bc,{track:e.track,"is-min-height":P.value,"is-included":D.value,"is-selected":I.value,"disable-bubble":p.disableBubble,onInstrumentSelect:W,onRename:V,onAddTakeLane:O,onColorChange:F,onDuplicateTrack:U,onDeleteTrack:H,onToggleTakeLanes:K,onSelectChange:B},null,8,["track","is-min-height","is-included","is-selected","disable-bubble"]),u(uc,{track:e.track},null,8,["track"]),u(ac,{track:e.track},null,8,["track"])])],6)],4),u(Gs,{"element-id":"track-header",onResize:R}),e.track.takeLanesExpanded?(r(!0),o(d,{key:0},g(e.track.takeLanes,t=>{return r(),o("div",{key:t.id,class:"version-wrapper",style:y({borderLeftColor:e.track.color})},[u(Cc,{version:t,"track-color":e.track.color,height:M(t.id),"is-selected":(a=t.id,x(a)),"is-included":S(t.id),"is-solo":e.track.soloTakeLaneId===t.id,onSelect:Y},null,8,["version","track-color","height","is-selected","is-included","is-solo"]),u(Gs,{"element-id":`version-${t.id}`,onResize:e=>((e,t)=>{var a,l,i;const o=t.id;if("start"===e.type){const t=M(o);return w[e.elementId]=t,void C.value.add(o)}if("move"===e.type&&void 0!==w[e.elementId]){const t=L(w[e.elementId]+e.deltaY,32,n);return A.value[o]=t,null==(l=null==(a=nt.MainManagerDispatcher)?void 0:a.getTrackDataManagerByTrackId(p.track.id))||l.VersionTracksManage.updateTrackData(o,{height:t}
1),void(null==(i=nt.MainManagerDispatcher)||i.triggerRender({renderModule:"partial",renderLayer:["ruler","grid","waveform","interaction"],trackIndex:p.trackIndex}))}if("end"===e.type){const a=A.value[o];p.track.id&&void 0!==a&&a!==t.height&&dt.setHeight({trackId:p.track.id,takeLaneId:o,height:a}),delete w[e.elementId],C.value.delete(o)}})(e,t)},null,8,["element-id","onResize"])],4);var a}),128)):c("",!0)]))}},[["__scopeId","data-v-8290aed2"]]),Dc={class:"track-area flex-column height-all"},Ic={class:"track-op flex"},Sc={class:"track-op-left flex"},Mc={class:"track-op-left-item-icon flex-center"},Ec={class:"track-op-left-item-icon flex-center"},Pc={class:"track-op-right"},Lc={class:"track-op-right-item-icon flex-center"},Rc={class:"track-footer flex-center"},Bc=Te({__name:"trackArea",emits:["scroll-track-content"],setup(e,{expose:t,emit:n}){var i;const h=null==(i=w())?void 0:i.appContext.config.globalProperties,k=n,b=rt(),A=wn(),C=l(()=>"preview"===b.mode),D=a(null),I=a(null),S=a(null),E=a(!1),P=a({x:0,y:0});let L=!1;const R=a(0),B=a(!1);let j=0,N=null;const O=l(()=>({position:"fixed",left:`${P.value.x}px`,top:`${P.value.y}px`})),V=l(()=>!(!b.state.tracks||0===b.state.tracks.length)&&b.state.tracks.every(e=>32===e.height)),F=()=>{C.value||A.addTrack()},U=()=>{var e;C.value||A.isMaxTracksReached||null==(e=D.value)||e.click()},H=()=>{C.value||lt.setAllHeights({height:V.value?88:32})},G=async e=>{var t;const a=null==(t=e.target.files)?void 0:t[0];if(!a)return;let n=null;e.target.value="";try{const e=await A.validateFile(a),{file:t,duration:l}=e,i=t.name.replace(/\.[^/.]+$/,"")||`轨道 ${b.state.tracks.length+1}`,o=ae(),r=`uploading_${ae()}`,s=1e3*(l||0),c={...ie,clipId:o,name:t.name,srcPathKey:r,srcDuration:s,startTime:0,srcClipStartTime:0,srcClipEndTime:s};let d=null;if(A.isFirstAudioInProject()?(n=ze.info({content:"Analyzing...",position:"center"}),d=A.addTrack({name:i})):d=A.addTrack({name:i,clipCreationIntents:[c]}),!d)return void(null==n||n.clear());await A.processFileAndUpload({file:t,tempSrcPathKey:r,initialDuration:l,trackTimeMs:0,trackId:d.id,clipCreationIntentId:o,addToLibrary:!0,clip:c,closeMsg:n})}catch(l){null==n||n.clear()}},W=e=>{const t=e.target;if(null!==t.closest(".track-draggable-item"))return;(t===I.value||t===S.value||t.classList&&(t.classList.contains("track-content")||t.classList.contains("track-content-inner")||t.classList.contains("empty-track-item")||t.classList.contains("empty-track-header")||t.classList.contains("empty-track-divider")))&&(e.preventDefault(),P.value={x:e.clientX,y:e.clientY},E.value=!0)},Y=()=>{E.value=!1,F()},z=()=>{E.value=!1,U()},X=e=>{B.value=!1;const{oldIndex:t,newIndex:a}=e;void 0!==t&&void 0!==a&&t!==a&&lt.order({oldIndex:t,newIndex:a})},Q=()=>{B.value=!0},q=e=>{var t,a,n;if("move"===e.type&&"track-header"===e.elementId){const{height:l,trackIndex:i}=e,o=null==(t=e.track)?void 0:t.id;o&&void 0!==l&&(null==(a=nt.MainManagerDispatcher)||a.updateTrackData(o,{height:l}),null==(n=nt.MainManagerDispatcher)||n.triggerRender({renderModule:"partial",renderLayer:["ruler","grid","waveform","interaction"],trackIndex:i}))}},Z=()=>{E.value&&(E.value=!1)},J=()=>{if(Math.abs(j)<.1)return j=0,void(N=null);if(!I.value||!S.value)return void(N=null);const e=I.value.clientHeight,t=S.value.offsetHeight,a=Math.max(0,t-e),n=Math.max(0,Math.min(R.value+j,a));R.value=n,k("scroll-track-content",n),j*=.88,N=requestAnimationFrame(J)},$=e=>{if(L)return;if(!I.value||!S.value)return;e.preventDefault();const t=e.deltaY,a=I.value.clientHeight,n=S.value.offsetHeight,l=Math.max(0,n-a),i=Math.max(0,Math.min(R.value+t,l));R.value=i,k("scroll-track-content",i);j+=.4*t;j=Math.max(-25,Math.min(25,j)),N||(N=requestAnimationFrame(J))};return _(()=>{null==h||h.logViewEvent("studio_tracktool",{}),document.addEventListener("click",Z)}),M(()=>{document.removeEventListener("click",Z),N&&(cancelAnimationFrame(N),N=null)}),t({setScrollTop:e=>{I.value&&S.value&&(N&&(cancelAnimationFrame(N),N=null,j=0),L=!0,R.value=e,Promise.resolve().then(()=>{L=!1}))}}),(e,t)=>(r(),o("div",Dc,[s("div",Ic,[s("div",Sc,[u(da,{content:"Add Track",position:"bottom","show-after":1e3},{default:p(()=>[s("div",{class:f(["track-op-left-item pointer",{"track-op-left-item-disabled":v(A).isMaxTracksReached||C.value}]),onClick:x(F,["stop"])},[s("div",Mc,[u(v(xe),{name:"sys-add",opacity:.6})])],2)]),_:1}),u(da,{content:"Upload",position:"bottom","show-after":1e3},{default:p(()=>[s("div",{class:f(["track-op-left-item pointer",{"track-op-left-item-disabled":v(A).isMaxTracksReached||C.value}]),onClick:x(U,["stop"])},[s("div",Ec,[u(v(xe),{name:"sys-upload",opacity:.6})])],2)]),_:1})]),s("div",Pc,[u(da,{content:V.value?"Expand tracks":"Collapse tracks",position:"bottom","show-after":300},{default:p(()=>[s("div",{class:f(["track-op-right-item pointer",{"track-op-right-item-disabled":C.value}]),onClick:H},[s("div",Lc,[V.value?(r(),T(v(xe),{key:1,name:"biz-studio-tracks-expand",opacity:.6})):(r(),T(v(xe),{key:0,name:"biz-studio-tracks-collapse",opacity:.6}))])],2)]),_:1},8,["content"])])]),s("div",{ref_key:"trackContentRef",ref:I,class:f(["track-content flex1 height-0",{"track-content-preview-not-allowed":C.value}]),onContextmenu:x(W,["prevent"]),onWheel:$},[C.value?(r(),o("div",{key:0,class:"track-preview-blocker",onClick:t[0]||(t[0]=x(()=>{},["stop","prevent"])),onDblclick:t[1]||(t[1]=x(()=>{},["stop","prevent"])),onMousedown:t[2]||(t[2]=x(()=>{},["stop","prevent"])),onMouseup:t[3]||(t[3]=x(()=>{},["stop","prevent"])),onMousemove:t[4]||(t[4]=x(()=>{},["stop","prevent"])),onContextmenu:t[5]||(t[5]=x(()=>{},["stop","prevent"])),onWheel:t[6]||(t[6]=x(()=>{},["stop","prevent"])),onTouchstart:t[7]||(t[7]=x(()=>{},["stop","prevent"])),onTouchmove:t[8]||(t[8]=x(()=>{},["stop","prevent"])),onTouchend:t[9]||(t[9]=x(()=>{},["stop","prevent"]))},null,32)):c("",!0),s("div",{ref_key:"trackContentInnerRef",ref:S,
1class:"track-content-inner",style:y({transform:`translateY(${-R.value}px)`})},[u(v(Hs),{"model-value":v(b).state.tracks,animation:200,"item-key":"id",handle:".drag-handle",filter:".no-drag","prevent-on-filter":!1,direction:"vertical",class:"track-draggable-container",onStart:Q,onEnd:X},{default:p(()=>[(r(!0),o(d,null,g(v(b).state.tracks,(e,t)=>(r(),T(xc,{key:e.id,"track-index":t,track:e,"disable-bubble":B.value,class:"track-draggable-item",onResize:q},null,8,["track-index","track","disable-bubble"]))),128))]),_:1},8,["model-value"])],4),(r(),T(K,{to:"body"},[E.value?(r(),o("div",{key:0,class:"context-menu",style:y(O.value),onClick:t[10]||(t[10]=x(()=>{},["stop"]))},[s("div",{class:f(["context-menu-item",{"context-menu-item-disabled":v(A).isMaxTracksReached}]),onClick:Y},[...t[11]||(t[11]=[s("div",{class:"context-menu-item-icon"},[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACuSURBVHgB7dfBCcJAEIXhpxVoB3ZmWrAEK006SDqIsxAhgribw/hY+D9YksOwmQc5zEgAACRY1/UeZ44zlnf1Zmv8bVaSk5KUrj8+FJTgrM4RwI0AbgRwI4AbAdyqAXZT5SFf7jlqbJliqwNWuSgeN3ksMQNefxW0/EIX+Sy1gpYAjziT/q80/6wVsQ+4EcCNAG4EcCOAGwHcMgPsJ8lJvYlZbtiWkrIMDQIAIMELObetrMqnj2kAAAAASUVORK5CYII=",alt:""})],-1),s("div",{class:"context-menu-item-label"},"Add Track",-1)])],2),s("div",{class:f(["context-menu-item",{"context-menu-item-disabled":v(A).isMaxTracksReached}]),onClick:z},[...t[12]||(t[12]=[s("div",{class:"context-menu-item-icon"},[s("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGVSURBVGiB7ZjtbcIwFEWfqw7ACOkGXYENGIER2g3YgBXYgG7QbtB2gmSDsMHtD14k50HiIDtf7j0SUmzMyz1yEmKLEEIIIYTkCoAdgBpACWA3d55RAbDHLfu5c41Ch2ye0gHZvKQHyuYh/aDsuqU7ZEtcn9ANzdN63dI9soURvNe3Luk+Wf2+Jax965QOyeqYG2HtX5e0Bq5N2Jasjrsr7NWw0jWATaqcT6kKichGPw2ViGydc9XQAjp2q7/1675GpxsDAMeumfXGdM6wN8af6fOooWMJXX5DhL2xRdJwkvaSFhER59wlYa0qVa2G5MJLh8K5Q+HcoXDuUNgC4ADgEwveUsV16/cM4C22kF3uRa9aHnm1HFivMBl7JyY0w4VpL3HVUph2b0bew7kzh3DlHSdbWQ1lDuF3uUpf9HhSnqc+oXPuR0Repj5vA+/h3KFw7lA4d/6dcOh/uDbtI4DJ344C2BWczdwiJPxr2ktcLVls5ha9l7Rz7ktEPlKmGZmTZo5Ddz2+sVxKAIdoUUIIIYSQlPwBAo5npH8cTvUAAAAASUVORK5CYII=",alt:""})],-1),s("div",{class:"context-menu-item-label"},"Upload",-1)])],2)],4)):c("",!0)]))],34),s("div",Rc,[u(v(Ye),{type:"secondary",appearance:"inverse",size:"small",disabled:v(A).isMaxTracksReached||C.value,onClick:F},{prefix:p(()=>[u(v(xe),{name:"sys-add",opacity:.6})]),default:p(()=>[t[13]||(t[13]=m(" Add Track ",-1))]),_:1},8,["disabled"]),u(v(Ye),{type:"secondary",appearance:"inverse",size:"small",disabled:v(A).isMaxTracksReached||C.value,onClick:U},{prefix:p(()=>[u(v(xe),{name:"sys-upload",opacity:.6})]),default:p(()=>[t[14]||(t[14]=m(" Upload ",-1))]),_:1},8,["disabled"]),s("input",{ref_key:"fileInputRef",ref:D,type:"file",accept:"audio/x-wav,video/quicktime,video/mp4,audio/wav,audio/x-m4a,audio/flac,audio/mpeg,.mp3,.wav,.m4a,.mp4,.mov,.MP4,.flac",style:{display:"none"},onChange:G},null,544)])]))}},[["__scopeId","data-v-b15ffe69"]]),jc=!0,Nc=new Map,Oc=k("useRightPanelStore",()=>{let e=0;const t=a(jc),n=a(_t.NONE),i=a(!1),o=a(null),r=a(!1),s=a([]),c=a(new Set),d=a(!1),u=a(null),p=a(0),v=a(!0),m=a({trackId:null,clipId:null,versionTrackId:null,trackType:Tt.MAIN_TRACK}),g=a(null),h=a(null),f=a([]),y=a(!1),k=l(()=>{const e=h.value;return(null==e?void 0:e.song_id)??(null==e?void 0:e.songId)??null}),b=l(()=>{const e=k.value;return null!=e&&""!==e}),w=(e,t)=>{const a=(e=>e)(e.lyrics,t.srcClipStartTime,t.srcClipEndTime);return{...e,lyrics:a}},A=async()=>{var e,t,a,n,l;try{const i=k.value;if(null==i||""===i)return;if(Nc.has(i))return void(u.value=w(Nc.get(i),h.value));u.value=null;const o=await ke({song_id:i});if(200!==o.code||!o.data.song)throw new Error(`${o.msg}(${o.code})`);{const r={...null==(e=o.data)?void 0:e.song,_prompt:null==(t=o.data)?void 0:t.prompt,_vocal:null==(a=o.data)?void 0:a.vocal,_refer:null==(n=o.data)?void 0:n.refer,_motif:null==(l=o.data)?void 0:l.motif};Nc.set(i,r),k.value===i&&(u.value=w(r,h.value))}}catch(i){}},C=(e,t)=>((null==e?void 0:e[t])??[]).map(t=>({...t,color:t.color||te(),bpm:null==e?void 0:e.bpm,firstDownbeat:null==e?void 0:e.firstDownbeat})),_=async(t,a,n)=>{let l=0;const o=async()=>{var r;try{if(n!==e)return!1;if(k.value!==a)return i.value=!1,!1;l++;const s=await Ae({stems_id:t});if(200!==s.code)return i.value=!1,!1;const c=null==(r=s.data)?void 0:r.generate_state;return 1===c?(await T(),i.value=!1,!0):2===c?(i.value=!1,!1):3===c?l>=18?(i.value=!1,!1):(await new Promise(e=>setTimeout(e,5e3)),await o()):(i.value=!1,!1)}catch(s){return i.value=!1,!1}};return await o()},T=async()=>{var t,a;const n=k.value;if(null==n||""===n)return;d.value=!0;const l=await we({song_id:n}).catch(e=>({code:-1,data:{history:[]}})),o=(null==(t=l.data)?void 0:t.history)||(null==(a=l.data)?void 0:a.list)||[];if(200===l.code){if(n===k.value){const t=o.map(e=>(e.stems=C(e,"stems"),e.stems_mp3s=C(e,"stems_mp3s"),e));s.value=t,r.value=0===s.value.length,d.value=!1;const a=o.filter(e=>3===e.generate_state&&(e.id||e.stems_id));if(a.length>0){const t=a[0],l=t.id||t.stems_id;i.value=!0;const o=++e;_(l,n,o)}}}else n===k.value&&(d.value=!1)};return{currentVersionIndex:p,hasSongId:b,stemsPanelHide:v,rightPanelVisible:t,songDetailSimple:u,stemsGenerateLoading:i,stemsGenerateType:o,stemsDownloadLoadingSet:c,stemsEmpty:r,panelType:n,currentClip:h,panelClips:f,isShowFullSongInfo:y,currentSongId:k,stemsList:s,stemsListLo
1ading:d,currentTrack:g,toggleRightPanelVisible:async({track:a=null,clips:l,isVersionTrack:o=!1,trackType:c=Tt.MAIN_TRACK,rightPanelType:u=_t.NONE,showFullSongInfo:v}={})=>{if(t.value=!0,s.value=[],p.value=0,e++,i.value=!1,d.value=!1,y.value=v,m.value={track:a,clips:l,isVersionTrack:o,trackType:c,rightPanelType:u,showFullSongInfo:v},u==_t.CLIP){if(f.value=l??[],h.value=l[0]??null,n.value=_t.CLIP,A(),l.length>1)return r.value=!1,void(d.value=!1);T()}else o?(f.value=[],n.value=_t.NONE,g.value=null,h.value=null):(f.value=[],h.value=null,n.value=_t.TRACK,g.value=a)},generateStems:async t=>{var a,n;if(i.value)return;if(null==k.value||""===k.value)return;i.value=!0,o.value=t;const l=k.value,c=++e;let d=!1;try{const e=await be({song_id:l,all_stems:"all"===t});if(200!==e.code&&0!==e.code)return;const i=null==(a=e.data)?void 0:a.id;i?(d=!0,await _(i,l,c)):(null==(n=e.data)?void 0:n.stems)&&k.value===l&&t===o.value&&e.data.stems.length>0&&(r.value=!1,s.value.push({stems:C(e.data,"stems"),stems_mp3s:C(e.data,"stems_mp3s"),all_stems:"all"===t}),p.value=s.value.length-1)}catch(u){}finally{d||k.value!==l||t!==o.value||(i.value=!1)}},destroy:()=>{t.value=jc,n.value=_t.NONE,u.value=null,r.value=!1,s.value=[],i.value=!1,o.value=null}}});function Vc(e,t={}){const{renderModule:a="partial",renderLayer:n=["ruler","grid","waveform","interaction"],trackIndex:l,syncStateData:i=!0}=t;e&&e.triggerRender({renderModule:a,renderLayer:n,...void 0!==l&&{trackIndex:l},syncStateData:i})}function Fc(e=[]){return xt(Dt(e))}function Uc(e,{oldTracks:t=[],newTracks:a=[],...n}={}){return function(e=[],t=[]){const a=Fc(e),n=Fc(t);return a.minStartTime!==n.minStartTime||a.maxDuration!==n.maxDuration}(t,a)?(Vc(e,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"],syncStateData:!0}),!0):(Vc(e,n),!1)}function Hc(e,t){for(let a=0;a<e.length;a++){const n=e[a];if(n.id===t)return a;
1if(n.takeLanes&&n.takeLanes.length>0){if(n.takeLanes.find(e=>e.id===t))return a}}return-1}function Gc(e,t){return e.clips.find(e=>e.clipId===t)}function Wc(e,t,a){return[{actionType:It.ADD_CLIP,description:"添加片段",handler:(n,l,i)=>{var o,r;const{trackId:s}=n,c=Hc(e.state.tracks,s);if(-1!==c){Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=e.state.tracks[c];a.syncTracksIncremental({update:[n]})}}},{actionType:It.REMOVE_CLIP,description:"删除片段",handler:(n,l,i)=>{var o,r;const{trackId:s}=n,c=Hc(e.state.tracks,s);if(-1!==c){Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=e.state.tracks[c];a.syncTracksIncremental({update:[n]})}}},{actionType:It.MOVE_CLIP,description:"移动片段",handler:(n,l,i)=>{var o,r;const{targetTrackId:s,originalTrackId:c}=n,d=Hc(e.state.tracks,s),u=Hc(e.state.tracks,c),p=[];if(-1!==d&&p.push(d),-1!==u&&u!==d&&p.push(u),p.length>0){Uc(t,{trackIndex:p,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=p.map(t=>e.state.tracks[t]);a.syncTracksIncremental({update:n})}}},{actionType:It.RESIZE_CLIP,description:"调整片段大小",handler:(n,l,i)=>{var o,r;const{trackId:s}=n,c=Hc(e.state.tracks,s);if(-1!==c){Uc(t,{trackIndex:[c],oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=e.state.tracks[c];a.syncTracksIncremental({update:[n]})}}},{actionType:It.TOGGLE_FADE_IN_CLIP,description:"切换片段淡入",handler:t=>{const{trackId:n,clipId:l,fadeInTime:i}=t,o=Hc(e.state.tracks,n);if(-1!==o){const t=Gc(e.state.tracks[o],l);a.fadeInClip(n,l,(i||0)/1e3,(null==t?void 0:t.volume)||0)}}},{actionType:It.TOGGLE_FADE_OUT_CLIP,description:"切换片段淡出",handler:t=>{const{trackId:n,clipId:l,fadeOutTime:i}=t,o=Hc(e.state.tracks,n);if(-1!==o){const t=Gc(e.state.tracks[o],l);a.fadeOutClip(n,l,(i||0)/1e3,(null==t?void 0:t.volume)||0)}}},{actionType:It.SET_CLIP_SPEED,description:"设置片段速度",handler:(n,l)=>{const{trackId:i,clipId:o,speed:r}=n,s=Hc(e.state.tracks,i);if(-1!==s)if(Vc(t,{trackIndex:[s]}),"dispatch"===l)a.setClipSpeed(i,o,r);else if("undo"===l||"redo"===l){const t=Gc(e.state.tracks[s],o);t&&void 0!==t.speed&&a.setClipSpeed(i,o,t.speed)}}},{actionType:It.UPDATE_CLIP,description:"更新片段",handler:(n,l,i)=>{var o,r;const{trackId:s}=n,c=Hc(e.state.tracks,s);if(-1!==c){Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=e.state.tracks[c];a.syncTracksIncremental({update:[n]})}}},{actionType:It.SET_CLIP_VOLUME,description:"设置片段音量",handler:(n,l)=>{const{trackId:i,clipId:o,volume:r}=n,s=Hc(e.state.tracks,i);if(-1!==s)if(Vc(t,{trackIndex:[s]}),"dispatch"===l)a.setClipVolume(i,o,r);else if("undo"===l||"redo"===l){const t=Gc(e.state.tracks[s],o);t&&void 0!==t.volume&&a.setClipVolume(i,o,t.volume)}}},{actionType:It.SET_CLIP_WRAP_ENABLED,description:"设置片段跟随节拍",handler:(n,l)=>{var i;const{trackId:o,clipId:r,enabled:s}=n,c=Hc(e.state.tracks,o);if(-1!==c)if(Vc(t,{trackIndex:[c]}),"dispatch"===l)a.setClipWrapEnabled(o,r,s);else if("undo"===l||"redo"===l){const t=Gc(e.state.tracks[c],r);t&&void 0!==(null==(i=t.wrap)?void 0:i.enabled)&&a.setClipWrapEnabled(o,r,t.wrap.enabled)}}},{actionType:It.ADD_CLIP_CREATION_INTENT,description:"添加片段创建意图",handler:a=>{const{trackId:n}=a,l=Hc(e.state.tracks,n);-1!==l&&Vc(t,{renderLayer:["interaction"],trackIndex:l,syncStateData:!0})}},{actionType:It.MOVE_CLIP_CREATION_INTENT_TO_CLIPS,description:"将片段创建意图移动到片段",handler:(n,l,i)=>{var o,r,s,c,d;const{trackId:u,clipCreationIntentId:p}=n,v=Hc(e.state.tracks,u);if(-1!==v){Uc(t,{trackIndex:v,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks});const n=e.state.tracks[v];a.syncTracksIncremental({update:[n]});const l=(null==(s=n.clips)?void 0:s.find(e=>e.clipId===p))||(null==(c=n.takeLanes)?void 0:c.flatMap(e=>e.clips||[]).find(e=>e.clipId===p));if(l){const e=l.startTime??0,a=St(l);null==(d=null==t?void 0:t.setSelectionData)||d.call(t,{startTime:e,endTime:a,type:it.SELECTION,focusedArea:kt.TIMELINE,focusedTrackId:u,trackIds:[u],syncData:!0})}}}},{actionType:It.REMOVE_CLIP_CREATION_INTENT,description:"删除片段创建意图",handler:a=>{const{trackId:n}=a,l=Hc(e.state.tracks,n);-1!==l&&Vc(t,{trackIndex:l,syncStateData:!0})}}]}function Kc(e,t,a){return[{actionType:Mt.TOGGLE_LOOP,description:"切换循环",handler:(e,n,l)=>{("redo"===n||"undo"===n)&&a.setLoopState({loop:l.newState.loop.enabled,loopStartTime:l.newState.loop.startTime,loopEndTime:l.newState.loop.endTime}),Vc(t,{renderModule:"all",renderLayer:["interaction"]})}}]}function Yc(e,t,a){return[{actionType:Et.SET_SELECTION,description:"设置选中区域",handler:a=>{const{selection:{focusedArea:n,focusedTrackId:l}}=a,i=Hc(e.state.tracks,l);-1!==i&&n===kt.TRACKS&&Vc(t,{trackIndex:i})}}]}function zc(e,t,a){return[{actionType:Pt.ADD_TAKE_LANE,description:"添加 takeLane",handler:n=>{const{trackId:l}=n,i=Hc(e.state.tracks,l);-1!==i&&(Vc(t,{trackIndex:i}),a.syncTracks(e.state.tracks))}},{actionType:Pt.REMOVE_TAKE_LANE,description:"删除 takeLane",handler:n=>{const{trackId:l}=n,i=Hc(e.state.tracks,l);-1!==i&&(Vc(t,{trackIndex:i}),a.syncTracks(e.state.tracks))}}]}function Xc(e,t,a){const n=(e=[])=>{var n,l,i;const o=Dt(e||[]);null==(n=a.setTimeRangeInfo)||n.call(a,o,{preservePlaybackDisplayShift:!!a.isTonePlayerPlaying}),null==(l=null==t?void 0:t.setMaxTimeInfo)||l.call(t,o.maxDuration,o.minStartTime),a.isTonePlayerPlaying&&(null==(i=null==t?void 0:t.setCurrentPlayState)||i.call(t,{currentTime:a.currentTime}))};return[{actionType:Lt.ADD_TRACK,description:"添加轨道",handler:(n,l,i)=>{var o,r;const{track:s}=n;let c=-1;"dispatch"===l||"redo"===l?c=Hc(e.state.tracks,s.id):"undo"===l&&(c=Hc(i.oldState.tracks,s.id)),-1!==c&&Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks}),"dispatch"===l||"redo"===l?a.syncTracksIncremental({add:[s]}):"undo"===l&&a.syncTracksIncremental({delete:[s.id]})}},{actionType:Lt.REMOVE_TRACK,description:"删除轨道",handler:(n,l,i)=>{var o,r;const{trackId:s}=n;let c=-1;if("dispatch"===l||"redo"===l?c=Hc(i.oldState.tracks,s):"undo"===l&&(c=Hc(e.state.tracks,s)),-1!==c&&Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks}),"dispatch"===l||"redo"===l)a.syncTracksIncremental({delete:[s]});else if("undo"===l){const t=e.state.tracks.find(e=>e.id===s);t&&a.syncTracksIncremental({add:[t]})}}},{actionType:Lt.DUPLICATE_TRACK,description:"复制轨道",handler:(n,l,i)=>{var o,r;const{track:s}=n;let c=-1;"dispatch"===l||"redo"===l?c=Hc(i.newState.tracks,s.id):"undo"===l&&(c=Hc(i.oldState.tracks,s.id)),-1!==c&&Uc(t,{trackIndex:c,oldTracks:(null==(o=null==i?void 0:i.oldState)?void 0:o.tracks)||[],newTracks:(null==(r=null==i?void 0:i.newState)?void 0:r.tracks)||e.state.tracks}),"dispatch"===l||"redo"===l?a.syncTracksIncremental({add:[s]}):"undo"===l&&a.syncTracksIncremental({delete:[s.id]})}},{actionType:Lt.SET_TRACK_INSTRUMENT,description:"设置轨道图标",handler:a=>{const{trackId:n}=a,l=Hc(e.state.tracks,n);-1!==l&&Vc(t,{trackIndex:[l]})}},{actionType:Lt.SET_TRACK_COLOR,description:"设置轨道颜色",handler:(a,n,l)=>{var i,o;const{trackId:r}=a,s=Hc(e.state.tracks,r);-1!==s&&Uc(t,{trackIndex:s,oldTracks:(null==(i=null==l?void 0:l.oldState)?void 0:i.tracks)||[],newTracks:(null==(o=null==l?void 0:l.newState)?void 0:o.tracks)||e.state.tracks})}},{actionType:Lt.SET_TRACK_VOLUME,description:"设置轨道音量",handler:(n,l)=>{const{trackId:i}=n,o=Hc(e.state.tracks,i);if(-1!==o&&(Vc(t,{trackIndex:o,renderLayer:["interaction"]}),"undo"===l||"redo"===l)){const t=e.state.tracks[o];t&&void 0!==t.volume&&a.setTrackVolume(i,t.volume)}}},{actionType:Lt.REORDER_TRACKS,description:"重新排序轨道",handler:e=>{const{oldIndex:a,newIndex:n}=e,l=Math.min(a,n),i=Math.max(a,n),o=[...Array(i-l+1).keys()].map(e=>l+e);Vc(t,{trackIndex:o})}},{actionType:Lt.TOGGLE_TRACK_MUTE,description:"轨道静音",handler:(n,l)=>{const{trackId:i,mute:o}=n,r=Hc(e.state.tracks,i);if(-1!==r)if(Vc(t,{trackIndex:r}),"dispatch"===l)a.setTrackMute(i,o);else if("undo"===l||"redo"===l){const t=e.state.tracks[r];t&&a.setTrackMute(i,t.mute)}}},{actionType:Lt.TOGGLE_TRACK_SOLO,description:"轨道solo",handler:(n,l)=>{const{trackId:i,solo:o}=n;-1!==Hc(e.state.tracks,i)&&(Vc(t,{trackIndex:0,renderLayer:["grid","waveform","interaction"]}),"dispatch"===l?a.setTrackSolo(i,o):"undo"!==l&&"redo"!==l||a.recalculateMuteSoloState())}},{actionType:Lt.UPDATE_TRACK,description:"更新轨道",handler:(l,i,o)=>{var r,s;const{track:c,skipPlayerSync:d}=l,u=Hc(e.state.tracks,c.id);if(-1!==u){const l=(null==(r=null==o?void 0:o.newState)?void 0:r.tracks)||e.state.tracks;
1if(Uc(t,{trackIndex:u,oldTracks:(null==(s=null==o?void 0:o.oldState)?void 0:s.tracks)||[],newTracks:l})&&n(l),d)return;const i=e.state.tracks[u];i&&a.syncTracksIncremental({update:[i]})}}},{actionType:Lt.SET_ALL_TRACK_HEIGHTS,description:"设置所有轨道高度",handler:()=>{Vc(t,{renderModule:"all"})}},{actionType:Lt.TOGGLE_TAKE_LANES,description:"切换 take lanes 展开/收起",handler:a=>{const{trackId:n}=a,l=Hc(e.state.tracks,n);-1!==l&&Vc(t,{trackIndex:l})}},{actionType:Lt.BATCH_ADD_TRACK,description:"批量添加轨道",handler:(l,i,o)=>{var r,s;const{tracks:c,skipPlayerSync:d}=l,u=(null==(r=null==o?void 0:o.oldState)?void 0:r.tracks)||[],p=(null==(s=null==o?void 0:o.newState)?void 0:s.tracks)||e.state.tracks,v=new Set(u.map(e=>e.id)),m=new Set(p.map(e=>e.id)),g=new Set(c.map(e=>e.id)),h=[...g].filter(e=>!v.has(e)&&m.has(e)),f=[...g].filter(e=>v.has(e)&&!m.has(e)),y=h.length>0?p:u,k=(h.length>0?h:f).map(e=>Hc(y,e)).filter(e=>-1!==e);if(k.length>0){Uc(t,{trackIndex:k[0],oldTracks:u,newTracks:p})&&n(p)}if(!d)if(h.length>0){const e=c.filter(e=>h.includes(e.id));a.syncTracksIncremental({add:e})}else f.length>0&&a.syncTracksIncremental({delete:f})}},{actionType:Lt.BATCH_UPDATE_TRACKS,description:"批量更新轨道",handler:(l,i,o)=>{var r,s,c,d;const{tracks:u,skipPlayerSync:p,index:v}=l,m=!!(null==(r=null==o?void 0:o.oldState)?void 0:r.tracks)&&!!(null==(s=null==o?void 0:o.newState)?void 0:s.tracks),g=new Set(u.map(e=>e.id)),h=(null==(c=null==o?void 0:o.newState)?void 0:c.tracks)||e.state.tracks;if(!m){const e=[...g].map(e=>Hc(h,e)).filter(e=>-1!==e);if(e.length>0&&Vc(t,{renderModule:"undo"===i?"all":"partial",trackIndex:null!==v?v:e,renderLayer:"undo"===i?Rt.ALL:["ruler","grid","waveform","interaction"],syncStateData:!0}),!p){const e=[...g].map(e=>h.find(t=>t.id===e)).filter(e=>void 0!==e);a.syncTracksIncremental({update:e})}return}const f=(null==(d=null==o?void 0:o.oldState)?void 0:d.tracks)||[],y=new Set(f.map(e=>e.id)),k=new Set(h.map(e=>e.id)),b=[...g].filter(e=>!y.has(e)&&k.has(e)),w=[...g].filter(e=>y.has(e)&&!k.has(e)),A=[...g].filter(e=>y.has(e)&&k.has(e));let C=null,_=!1;if(w.length>0){const e=w.map(e=>Hc(f,e)).filter(e=>-1!==e);if(e.length>0){_=!0;C=Math.min(...e)}}if(!_){let e=[];
1if(b.length>0){const t=b.map(e=>Hc(h,e)).filter(e=>-1!==e);e.push(...t)}if(A.length>0){const t=A.map(e=>Hc(h,e)).filter(e=>-1!==e);e.push(...t)}e=[...new Set(e)],e.length>0&&(C=e)}if(null!==C){Uc(t,{renderModule:"undo"===i?"all":"partial",trackIndex:null!==v?v:C,renderLayer:"undo"===i?Rt.ALL:["ruler","grid","waveform","interaction"],syncStateData:!0,oldTracks:f,newTracks:h})&&n(h)}if(p)return;const T=b.length>0?u.filter(e=>b.includes(e.id)):[],x=A.length>0?A.map(e=>h.find(t=>t.id===e)).filter(e=>void 0!==e):[];(T.length>0||w.length>0||x.length>0)&&a.syncTracksIncremental({add:T,delete:w,update:x})}},{actionType:Lt.SET_TRACK_BALANCE,description:"设置轨道平衡",handler:(t,n)=>{const{trackId:l}=t;if("undo"===n||"redo"===n){const t=e.state.tracks.find(e=>e.id===l);t&&a.setTrackPan(l,t.balance)}}},{actionType:Lt.TOGGLE_TRACK_INPUT,description:"切换录音设备输入",handler:a=>{const{trackId:n}=a,l=Hc(e.state.tracks,n);Vc(t,{trackIndex:l,renderLayer:[],syncStateData:!0})}}]}function Qc(e,t,a){return[{actionType:Bt.SET_BPM,description:"同步BPM到播放器",handler:()=>{var n,l,i,o;if("object"==typeof a.isTempoChanging?a.isTempoChanging.value:a.isTempoChanging)return;const r=(null==(l=null==(n=e.state)?void 0:n.timing)?void 0:l.bpm)||120,s=null==(i=a.getPlayerInstance)?void 0:i.call(a);null==(o=null==s?void 0:s.updateBPM)||o.call(s,r),a.syncTracksIncremental({update:e.state.tracks}),Vc(t,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]})}},{actionType:Bt.SET_BASE_BPM,description:"同步基础BPM到播放器",handler:()=>{a.syncTracksIncremental({update:e.state.tracks}),Vc(t,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]})}},{actionType:Bt.SET_TIMING_TYPE,description:"切换 timing 模式时更新播放器",handler:()=>{var n;const l=a.getPlayerInstance();if(!l)return;const i=e.state.timing.bpm||120;null==(n=l.updateBPM)||n.call(l,i),Vc(t,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]})}},{actionType:Bt.SET_FOLLOW_TRACK,description:"切换主控轨道时更新播放器",handler:()=>{var n;const l=a.getPlayerInstance();if(!l)return;const i=e.state.timing.bpm||120;null==(n=l.updateBPM)||n.call(l,i),Vc(t,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]})}}]}const qc=Te({__name:"dawMainPaint",emits:["scroll-vertical"],setup(e,{expose:t,emit:n}){const l=ot(),i=Oc(),c=Pi(),d=Tl(),u=c.emitter,p=n,v=rt(),m=a(null),g=a(null),h=a(null),f=a(null),y=a(null);let k=null;_(()=>{nt.MainManagerDispatcher||(nt.MainManagerDispatcher=new jt({config:{width:m.value.clientWidth,height:m.value.clientHeight,pps:1},MainOpPaintEls:{parentBox:m.value,canvasRuler:g.value,canvasGrid:h.value,canvasWaveform:f.value,canvasInteraction:y.value}},{LoadingMediaBufferData:{getAudioWaveFormDataByApi:Ce,baseObjectStorageUrl:fa.baseObjectStorageUrl,checkWaveformBufferLoadState:Ht,syncGetWaveformBuffer:Ut,asyncGetWaveformBuffer:Ft,addWaveformBuffer:Vt,deleteWaveformBuffer:Ot,replaceWaveformBufferKey:vt,enableCoarseWaveformWithoutAudio:!1},player:{addPlayTimeUpdateListener:e=>l.addPlayTimeUpdateListener(e),removePlayTimeUpdateListener:e=>l.removePlayTimeUpdateListener(e),setMaxTimeInfo:(e,t)=>{var a;null==(a=l.setTimeRangeInfo)||a.call(l,{maxDuration:e,minStartTime:t})}
1,setMaxDuration:e=>{var t,a;const n=(null==(t=l.getTimeRangeInfo)?void 0:t.call(l))||{};null==(a=l.setTimeRangeInfo)||a.call(l,{...n,maxDuration:e})},setCurrentPlaytime:e=>{l.setCurrentPlaytime(e)},setDisplayCurrentTime:e=>{var t;null==(t=l.setDisplayCurrentTimeFromCanvas)||t.call(l,e)},setLoop:e=>{l.setLoop(e)},getPlayerStateData:()=>{const{enabled:e,startTime:t,endTime:a}=v.state.loop;return{...l.getPlayerStateData(),loop:e,loopStartTime:t,loopEndTime:a}},fadeInClip:(e,t,a=1,n=0)=>{l.fadeInClip(e,t,a,n)},fadeOutClip:(e,t,a=1,n=0)=>{l.fadeOutClip(e,t,a,n)}},analyticsDataUtils:{dawMetrics:bt},onScrollVertical:e=>{p("scroll-vertical",e)},getTimelineStateData:()=>v.state.timing,getControlStateData:()=>({editMode:v.mode}),onZoomChange:()=>{},dispatchActions:Nt,getTrackDatas:e=>{const t=[];if(Array.isArray(e)){for(const a of e)v.state.tracks[a]&&t.push(v.state.tracks[a]);return t}return v.state.tracks.slice(e)},getTracksLength:()=>{var e;return(null==(e=v.state.tracks)?void 0:e.length)??0},getSelectionStateData:()=>v.state.selection,onSelectionDataChange:e=>{i.toggleRightPanelVisible({...e.rightPanelData||{}}),d.toggleGeneratePanelVisible(e)},creationIntentDeleteCallback:e=>{d.creationIntentDeleteCallback(e)},getLoadingStudioEntryVideo:()=>v.loadingStudioEntryVideo}),k=function(e,t){const a=ot(),n=[...Xc(e,t,a),...zc(e,t,a),...Wc(e,t,a),...Kc(0,t,a),...Yc(e,t),...Qc(e,t,a)];return{registerAllCallbacks:function(){n.forEach(({actionType:t,handler:a})=>{e.registerRenderCallback(t,a)})},unregisterAllCallbacks:function(){n.forEach(({actionType:t})=>{e.unregisterRenderCallback(t)})},triggerFullRender:function(){Vc(t,{renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]})},initNotifyPlayer:function(){const t=e.state.tracks;a.syncTracks(t),a.setLoopState({loop:e.state.loop.enabled,loopStartTime:e.state.loop.startTime,loopEndTime:e.state.loop.endTime})},triggerRender:e=>Vc(t,e)}}(v,nt.MainManagerDispatcher),u.on("renderAll",()=>{k.registerAllCallbacks(),k.initNotifyPlayer(),bt.mark("tti_ui")}))}),M(()=>{var e,t;bt.reset(),null==k||k.unregisterAllCallbacks(),null==(t=null==(e=nt.MainManagerDispatcher)?void 0:e.destroy)||t.call(e),nt.MainManagerDispatcher=null});return t({setScrollTop:e=>{var t,a;nt.MainManagerDispatcher&&(null==(t=nt.MainManagerDispatcher)||t.setScrollTop(e),null==(a=nt.MainManagerDispatcher)||a.triggerRender({renderModule:"all",renderLayer:["ruler","grid","waveform","interaction"]}))}}),(e,t)=>(r(),o("div",{ref_key:"refMainPaintBox",ref:m,class:"daw-main-paint"},[s("canvas",{ref_key:"refCanvasRuler",ref:g,class:"daw-main-paint-canvas daw-main-paint-ruler"},null,512),s("canvas",{ref_key:"refCanvasGrid",ref:h,class:"daw-main-paint-canvas daw-main-paint-grid"},null,512),s("canvas",{ref_key:"refCanvasWaveform",ref:f,class:"daw-main-paint-canvas daw-main-paint-waveform"},null,512),s("div",{id:"refCanvasInteraction",ref_key:"refCanvasInteraction",ref:y,class:"daw-main-paint-canvas daw-main-paint-interaction"},null,512)],512))}},[["__scopeId","data-v-0326df01"]]),Zc={class:"main-area"},Jc={key:0,class:"saving-indicator"},$c={class:"saving-indicator-text"},ed=Te({__name:"MainArea",emits:["clip-dropped","file-dropped","collapse-clip-panel"],setup(e,{emit:t}){const n=a(null),m=a(null),g=rt(),{mode:k}=S(g),{saving:b}=S(g),w=a(null),A=a(!1);let C=null;i(b,e=>{e?(A.value=!0,C&&(clearTimeout(C),C=null)):(C&&clearTimeout(C),C=setTimeout(()=>{A.value=!1,C=null},1500))}),i(()=>g.mode,(e,t)=>{"preview"===t&&"edit"===e&&(x.value=!1)});const T=t,x=a(!1),D=a(160),I=a(200),E=a(!1),P=a(!1),L=(e,t)=>{e.preventDefault();const a="history"===t?{widthRef:D,min:160,max:462}:{widthRef:I,min:200,max:600},n=e.clientX,l=a.widthRef.value;let i=null,o=l;E.value=!0;const r=e=>{e.preventDefault();const t=e.clientX-n,r=Math.max(a.min,Math.min(a.max,l+t));o=r,null===i&&(i=requestAnimationFrame(()=>{a.widthRef.value=o,i=null}))},s=()=>{E.value=!1,null!==i&&(cancelAnimationFrame(i),i=null),a.widthRef.value=o,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s)},B=l(()=>x.value?`${D.value}px 2px ${I.value}px 2px 1fr`:`${I.value}px 2px 1fr`),j=l(()=>{const e={gridTemplateColumns:B.value,"--track-header-width":`${I.value}px`};return x.value&&(e["--history-width"]=`${D.value}px`),e});let N=null,O=null;const V=e=>{var t;O!==e?(N=e,null==(t=m.value)||t.setScrollTop(e)):O=null}
1,F=e=>{var t;N!==e?(O=e,null==(t=n.value)||t.setScrollTop(e)):N=null},U=a(!1);let H=null,G=null,W=null;const K=e=>e.dataTransfer&&e.dataTransfer.types.includes("Files"),Y=e=>e.dataTransfer&&(e.dataTransfer.types.includes("application/json")||e.dataTransfer.types.includes("text/plain")),z=e=>{if(!K(e)&&!Y(e))return;e.preventDefault(),e.dataTransfer.dropEffect="copy",P.value=!0;const t=w.value;if(!t)return;const a=t.getBoundingClientRect(),n=e.clientX-a.left,l=e.clientY-a.top;let i=0,o=null;if(Y(e))try{let t=null;if(W)t=W;else{const a=e.dataTransfer.getData("text/plain")||e.dataTransfer.getData("application/json")||window.__dragStudioPresetSongData;a&&(t=JSON.parse(a),W=t)}t?(i=t.srcDuration||t.duration||t.duration_milliseconds||3e3,o=t.bpm):i=3e3}catch(r){i=3e3}else K(e)&&(i=0);G={x:n,y:l,srcDuration:i},null===H&&(H=requestAnimationFrame(()=>{var e,t;H=null,G&&(null==(e=nt.MainManagerDispatcher)||e.setDragInFileOrAudioData({opProcessState:Gt.MOVE,bpm:o,srcDuration:G.srcDuration,point:{x:G.x,y:G.y}}),null==(t=nt.MainManagerDispatcher)||t.triggerRender({renderModule:"all",renderLayer:["waveform"]}),G=null)}))},X=e=>{e.target===w.value&&(P.value=!1,null!==H&&(cancelAnimationFrame(H),H=null),G=null)},Q=e=>{var t,a;e.preventDefault(),P.value=!1,U.value=!1,null!==H&&(cancelAnimationFrame(H),H=null),G=null;const n=w.value;if(!n)return;const l=n.getBoundingClientRect(),i=e.clientX-l.left,o=e.clientY-l.top,r={x:i,y:o},s={x:i/l.width*100,y:o/l.height*100};null==(t=nt.MainManagerDispatcher)||t.setDragInFileOrAudioData({opProcessState:Gt.END}),null==(a=nt.MainManagerDispatcher)||a.triggerRender({renderModule:"all",renderLayer:["waveform"]});try{if(K(e)){const t=e.dataTransfer.files;if(t&&t.length>0){const e=t[0];(e=>{T("file-dropped",e)})({file:e,position:r,positionPercent:s})}return}if(Y(e)){let t=W;if(!t){const a=e.dataTransfer.getData("text/plain")||e.dataTransfer.getData("application/json")||window.__dragStudioPresetSongData;if(!a)return;t=JSON.parse(a)}(e=>{T("clip-dropped",e)})({clipId:t.id,clipData:t,position:r,positionPercent:s}),W=null}}catch(c){}},q=e=>{if(e.dataTransfer&&(e.dataTransfer.types.includes("text/plain")||e.dataTransfer.types.includes("application/json")||e.dataTransfer.types.includes("Files"))&&(U.value=!0,e.dataTransfer.types.includes("text/plain")||e.dataTransfer.types.includes("application/json")))try{const t=e.dataTransfer.getData("text/plain")||e.dataTransfer.getData("application/json");t&&(W=JSON.parse(t))}catch(t){}},Z=e=>{e.dataTransfer&&e.dataTransfer.types.includes("Files")&&(U.value=!0)},J=()=>{U.value=!1,P.value=!1,null!==H&&(cancelAnimationFrame(H),H=null),G=null,W=null},$=()=>{var e,t;U.value=!1,P.value=!1,null!==H&&(cancelAnimationFrame(H),H=null),G=null,W=null,null==(e=nt.MainManagerDispatcher)||e.setDragInFileOrAudioData({opProcessState:Gt.NONE}),null==(t=nt.MainManagerDispatcher)||t.triggerRender({renderModule:"all",renderLayer:["waveform"]})},ee=e=>{e.relatedTarget&&"HTML"!==e.relatedTarget.nodeName||$()};return _(()=>{document.addEventListener("dragstart",q),document.addEventListener("dragenter",Z),document.addEventListener("dragend",J),document.addEventListener("drop",$),document.addEventListener("dragleave",ee)}),M(()=>{document.removeEventListener("dragstart",q),document.removeEventListener("dragenter",Z),document.removeEventListener("dragend",J),document.removeEventListener("drop",$),document.removeEventListener("dragleave",ee)}),(e,t)=>(r(),o("div",Zc,[u(fo,{onOpenHistory:t[0]||(t[0]=e=>x.value=!0),onCollapseClipPanel:t[1]||(t[1]=e=>T("collapse-clip-panel"))}),s("div",{class:f(["main-area-content",{"is-dragging":E.value}]),style:y(j.value)},[x.value?(r(),o(d,{key:0},[u(Si,{onCloseHistory:t[2]||(t[2]=e=>x.value=!1)}),s("div",{class:"drag-line",onMousedown:t[3]||(t[3]=e=>L(e,"history"))},null,32)],64)):c("",!0),u(Bc,{ref_key:"trackAreaRef",ref:n,onScrollTrackContent:V},null,512),s("div",{class:"drag-line",onMousedown:t[4]||(t[4]=e=>L(e,"track"))},null,32),s("div",{ref_key:"canvasBoxRef",ref:w,class:"canvas-container",onDragover:z,onDrop:Q,onDragleave:X},[u(qc,{ref_key:"dawMainPaintRef",ref:m,onScrollVertical:F},null,512),u(ii)],544),u(R,{name:"saving-fade"},{default:p(()=>[A.value?(r(),o("div",Jc,[(r(),o("svg",{class:f([{"is-saving":v(b),"is-success":!v(b)}
1,"saving-icon-svg"]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...t[5]||(t[5]=[s("path",{class:"loading-path",d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3",stroke:"currentColor","stroke-width":"2.1","stroke-linecap":"round"},null,-1),s("path",{class:"success-path",d:"M4 12L9 17L20 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])],2)),s("span",$c,h(v(b)?"Saving":"Saved"),1)])):c("",!0)]),_:1})],6)]))}},[["__scopeId","data-v-2d900d5a"]]),td="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M5.33398%205.33331V3.46665C5.33398%202.71991%205.33398%202.34654%205.47931%202.06133C5.60714%201.81044%205.81111%201.60647%206.062%201.47864C6.34721%201.33331%206.72058%201.33331%207.46732%201.33331H12.534C13.2807%201.33331%2013.6541%201.33331%2013.9393%201.47864C14.1902%201.60647%2014.3942%201.81044%2014.522%202.06133C14.6673%202.34654%2014.6673%202.71991%2014.6673%203.46665V8.53331C14.6673%209.28005%2014.6673%209.65342%2014.522%209.93863C14.3942%2010.1895%2014.1902%2010.3935%2013.9393%2010.5213C13.6541%2010.6666%2013.2807%2010.6666%2012.534%2010.6666H10.6673M3.46732%2014.6666H8.53398C9.28072%2014.6666%209.65409%2014.6666%209.93931%2014.5213C10.1902%2014.3935%2010.3942%2014.1895%2010.522%2013.9386C10.6673%2013.6534%2010.6673%2013.28%2010.6673%2012.5333V7.46665C10.6673%206.71991%2010.6673%206.34654%2010.522%206.06133C10.3942%205.81044%2010.1902%205.60647%209.93931%205.47864C9.65409%205.33331%209.28
1072%205.33331%208.53398%205.33331H3.46732C2.72058%205.33331%202.34721%205.33331%202.062%205.47864C1.81111%205.60647%201.60714%205.81044%201.47931%206.06133C1.33398%206.34654%201.33398%206.71991%201.33398%207.46665V12.5333C1.33398%2013.28%201.33398%2013.6534%201.47931%2013.9386C1.60714%2014.1895%201.81111%2014.3935%202.062%2014.5213C2.34721%2014.6666%202.72058%2014.6666%203.46732%2014.6666Z'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ad={NAME_MAX_LENGTH:30,MAX_CONCURRENT_DOWNLOADS:6,DEFAULT_ZIP_NAME:"download.zip",MESSAGES:{DOWNLOADING:"Downloading… Please wait",FAILED_TO_LOAD:"Failed to load video"}},nd=()=>{};class ld{constructor(e=[],{downloadName:a,onProgress:n,onCompleted:l,onError:i}){t(this,"fileNameMap",new Map),t(this,"progressQueue",[]),t(this,"downloadIng",!1),t(this,"downloadCount",0),t(this,"completedCount",0),this.zip=new Oa,this.params=e,this.downloadName=a,this.onProgress=n||nd,this.onCompleted=l||nd,this.onError=i||nd,this.start()}start(){this.downloadIng=!0,1===this.params.length?this.progressQueue=[0]:this.progressQueue=new Array(this.params.length+1).fill(0);const e=Math.min(this.params.length,ad.MAX_CONCURRENT_DOWNLOADS);for(let t=0;t<e;t++)this.downloadFileFromIndex(t)}async downloadFileFromIndex(e){if(!this.downloadIng)return;const t=this.params[e],a=t.url,n=a.split("?")[0].split(".").pop();let l=t.name.substring(t.name.lastIndexOf("."))===n?t.name:`${t.name}.${n}`;l=this.truncateFileName(l),this.downloadCount++;const i=await Wt(a,t=>{this.updateProgress(e,t)},l).catch(e=>{this.downloadIng=!1,this.onError(e)});i&&this.downloadIng&&(this.updateProgress(e,100),1===this.params.length?(await ka(()=>import("./FileSaver.min-Bex5QA7C.js").then(e=>e.F),[]).then(e=>e.default(i,l)),this.onCompleted()):(this.zip.file(l,i),this.completed()))}completed(){this.completedCount++,this.downloadCount<this.params.length?this.downloadFileFromIndex(this.downloadCount):this.completedCount===this.params.length&&this.saveZipFile()}async saveZipFile(){try{const e=await this.zip.generateAsync({type:"blob"},e=>{this.updateProgress(this.params.length,Math.round(e.percent))});await ka(()=>import("./FileSaver.min-Bex5QA7C.js").then(e=>e.F),[]).then(t=>t.default(e,this.downloadName||ad.DEFAULT_ZIP_NAME)),this.updateProgress(this.params.length,100),this.onCompleted()}catch(e){this.onError(e)}finally{this.downloadIng=!1}}updateProgress(e,t){this.progressQueue[e]=t;const a=100/this.progressQueue.length,n=Math.floor(this.progressQueue.reduce((e,t)=>e+t/100*a,0));this.onProgress(n)}truncateFileName(e){const{NAME_MAX_LENGTH:t}=ad;e=e.length>t?e.substring(e.length-t):e;const a=this.fileNameMap.get(e)||0;if(a){const t=`${e.substring(0,e.lastIndexOf("."))}(${a})${e.substring(e.lastIndexOf("."))}`;return this.fileNameMap.set(e,(this.fileNameMap.get(e)||0)+1),this.truncateFileName(t)}return this.fileNameMap.set(e,1),e}}const id=(e,t)=>{var a,n,l,i,o,r,s;const c=(null==(a=Ca[t.stem_name])?void 0:a.type)||t.stem_name;return{...ie,wrap:null==(n=e.value)?void 0:n.wrap,clipId:ae(),startTime:(null==(l=e.value)?void 0:l.startTime)||0,srcDuration:(null==(i=e.value)?void 0:i.srcDuration)||0,srcClipStartTime:(null==(o=e.value)?void 0:o.srcClipStartTime)||0,srcClipEndTime:(null==(r=e.value)?void 0:r.srcClipEndTime)||0,srcPathKey:t.oss_key,color:t.color,name:c,bpm:(null==(s=e.value)?void 0:s.bpm)||0}},od="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cg%20opacity='1'%3e%3cpath%20d='M8%2012L4%208L8%204'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4%208H13'%20stroke='white'%20stroke-width='1.33'%20stroke-linecap='round'/%3e%3c/g%3e%3c/svg%3e",rd={class:"stems-bottom-button"},sd={key:0,class:"stems-bottom-button-item-icon",src:"data:image/svg+xml,%3csvg%20width='16'%20height='17'%20viewBox='0%200%2016%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%2010.835V11.635C14%2012.7551%2014%2013.3151%2013.782%2013.7429C13.5903%2014.1193%2013.2843%2014.4252%2012.908%2014.617C12.4802%2014.835%2011.9201%2014.835%2010.8%2014.835H5.2C4.07989%2014.835%203.51984%2014.835%203.09202%2014.617C2.71569%2014.4252%202.40973%2014.1193%202.21799%2013.7429C2%2013.3151%202%2012.7551%202%2011.635V10.835M11.3333
1%207.50163L8%2010.835M8%2010.835L4.66667%207.50163M8%2010.835V2.83496'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e"},cd={key:1,src:et,alt:"Loading",class:"stems-bottom-button-item-icon loading-icon"},dd=Te({__name:"stems-bottom-button",emits:["insert-all","download"],setup(e,{emit:t}){const a=Oc(),{stemsDownloadLoadingSet:n,stemsList:i,currentVersionIndex:c,currentClip:d}=S(a),u=t,p=l(()=>{var e;return`${null==(e=d.value)?void 0:e.clipId}-${c.value}`}),m=()=>{var e,t,a,n;if(0===(null==(t=null==(e=i.value[c.value])?void 0:e.stems)?void 0:t.length))return;const l=i.value[c.value],o=(null==l?void 0:l.all_stems)?"all_detected_stems":"vocal_instrumental";null==(n=null==(a=tt)?void 0:a.logCustomEvent)||n.call(a,"studio_cliptool_insert_allstems_click",{type:o}),u("insert-all")},g=()=>{var e,t,a,n;if(0===(null==(t=null==(e=i.value[c.value])?void 0:e.stems)?void 0:t.length))return;const l=i.value[c.value],o=(null==l?void 0:l.all_stems)?"all_detected_stems":"vocal_instrumental";
1null==(n=null==(a=tt)?void 0:a.logCustomEvent)||n.call(a,"studio_cliptool_download_stem_click",{type:o}),u("download")};return(e,t)=>{var a,l,d,u;return r(),o("div",rd,[s("div",{class:f(["stems-bottom-button-item",{disabled:0===(null==(l=null==(a=v(i)[v(c)])?void 0:a.stems)?void 0:l.length)}]),onClick:m},[...t[0]||(t[0]=[s("img",{class:"stems-bottom-button-item-icon",src:od},null,-1),s("div",{class:"stems-bottom-button-item-title"},"Insert All",-1)])],2),s("div",{class:f(["stems-bottom-button-item",{disabled:0===(null==(u=null==(d=v(i)[v(c)])?void 0:d.stems)?void 0:u.length)||v(n).has(p.value)}]),onClick:g},[v(n).has(p.value)?(r(),o("img",cd)):(r(),o("img",sd)),t[1]||(t[1]=s("div",{class:"stems-bottom-button-item-title"},"Download",-1))],2)])}}},[["__scopeId","data-v-dedbf34c"]]),ud={class:"stems-data-list"},pd=["onDragstart","onDragend"],vd=["onClick"],md={class:"playing"},gd=["src"],hd={class:"stems-data-item-name"},fd=["onClick"],yd={key:1,class:"stems-data-list-loading"},kd=Te({__name:"stems-data-list",props:{list:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},setup(e){const t=wn(),n=Oc(),{currentClip:l}=S(n),{handleDragStart:m,handleDragEnd:k}=(e=>{const t=a("");return{handleDragStart:(a,n)=>{var l,i;const o={title:(null==(l=Ca[n.stem_name])?void 0:l.type)||n.stem_name||"New Clip",mp3_url:n.oss_key,duration_milliseconds:e.value.srcDuration,srcClipStartTime:e.value.srcClipStartTime,srcClipEndTime:e.value.srcClipEndTime,bpm:n.bpm??(null==(i=e.value)?void 0:i.bpm)};a.dataTransfer.effectAllowed="all";const r=JSON.stringify(o);a.dataTransfer.setData("text/plain",r),a.dataTransfer.setData("application/json",r),window.__dragStudioPresetSongData=r,a.currentTarget.style.opacity="0.5",t.value=n.id},handleDragEnd:e=>{t.value="",e.currentTarget.style.opacity="1",e.dataTransfer.clearData(),window.__dragStudioPresetSongData=null}}})(l),b=e,w=a({}),A=C({}),_=a(b.list);i(()=>b.list,e=>{var t;_.value&&_.value!==e?(Object.values(A).some(e=>null==e?void 0:e.isPlaying)&&(Object.entries(w.value).forEach(([e,t])=>{var a;(null==(a=A[e])?void 0:a.isPlaying)&&(null==t?void 0:t.changeOp)&&t.changeOp(!1)}),Object.keys(A).forEach(e=>{A[e]&&(A[e].isPlaying=!1,A[e].isLoading=!1)})),w.value={},t=e,Object.keys(A).forEach(e=>{delete A[e]}),t.forEach((e,t)=>{A[t]={isPlaying:!1,isLoading:!1}})):e.forEach((e,t)=>{A[t]||(A[t]={isPlaying:!1,isLoading:!1})}),_.value=e},{immediate:!0,deep:!0});const D=e=>{var t,a,n;if(!e)return null==(t=Aa[0])?void 0:t.icon;const l=null==(a=Ca[e])?void 0:a.icon;if(l)return l;const i=Aa.find(t=>t.type===e);return(null==i?void 0:i.icon)||(null==(n=Aa[0])?void 0:n.icon)},I=e=>{var t;return e?(null==(t=Ca[e])?void 0:t.type)||e:""};return(a,n)=>(r(),o("div",ud,[e.loading?(r(),o("div",yd,[...n[1]||(n[1]=[s("img",{src:et,alt:"Loading",class:"loading-icon"},null,-1)])])):(r(!0),o(d,{key:0},g(e.list,(e,a)=>(r(),T(ua,{key:e.oss_key||a,ref_for:!0,ref:e=>((e,t)=>{e&&(w.value[t]=e)})(e,a),url:v(je)(e.oss_key||""),duration:0,onSyncPlayState:e=>((e,t)=>{A[t]&&(A[t].isPlaying=e)})(e,a),onSyncLoadingState:e=>((e,t)=>{A[t]&&(A[t].isLoading=e)})(e,a),onCurPlayEnded:()=>(e=>{A[e]&&(A[e].isPlaying=!1)})(a)},{default:p(()=>{var i,o,d;return[s("div",{class:"stems-data-list-item",draggable:"true",onDragstart:t=>v(m)(t,e),onDragend:t=>v(k)(t,e)},[s("div",{class:f(["stems-data-item-cover",{"isplay-true":null==(i=A[a])?void 0:i.isPlaying,"isplay-false":!(null==(o=A[a])?void 0:o.isPlaying)}]),style:y(`background-color: ${e.color};`)},[e.cover?(r(),T(Ta,{key:0,src:v(je)(e.cover),class:"stems-cover-img"},null,8,["src"])):c("",!0),s("div",{class:"stems-data-item-play",onClick:x(e=>(e=>{const t=w.value[e];t&&t.changeOp()})(a),["stop"])},[n[0]||(n[0]=s("i",{class:"block play-icon"},null,-1)),s("div",md,[u(Sa,{"bar-config":{barWidth:"2px",barHeight:"8px",barSpacing:"1px",barColor:"#fff"},animation:null==(d=A[a])?void 0:d.isPlaying},null,8,["animation"])])],8,vd)],6),s("img",{class:"stems-data-item-icon",src:D(e.stem_name||"")},null,8,gd),s("div",hd,h(I(e.stem_name)),1),s("img",{draggable:"false",class:"stems-data-item-left-actions",src:od,onClick:x(()=>(e=>{var a,n,i;const o=I(null==e?void 0:e.stem_name),r=(null==(a=Ca[null==e?void 0:e.stem_name])?void 0:a.type)||"Song";null==(i=null==(n=tt)?void 0:n.logCustomEvent)||i.call(n,"studio_cliptool_insert_insertstems_click",{type:r});
1const s=t.createNewTrackData({name:o,color:e.color,instrument:{type:r},clips:[id(l,e)]});lt.batchAdd({tracks:[s]})})(e),["stop"])},null,8,fd)],40,pd)]}),_:2},1032,["url","onSyncPlayState","onSyncLoadingState","onCurPlayEnded"]))),128))]))}},[["__scopeId","data-v-c14f7490"]]),bd="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%3e%3cpath%20d='M0.666992%205.33317L0.666992%207.99984M3.66699%205.99984V7.33317M6.66699%202.6665V10.6665M9.66699%200.666504V12.6665M12.667%205.33317V7.99984'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",wd={class:"stems-button-list"},Ad=Te({__name:"stems-button-list",emits:["select"],setup(e,{emit:t}){const a=t,n=e=>{var t,n;const l={all:"all_detected_stems",vocals:"vocal_instrumental"}[e]||e;null==(n=null==(t=tt)?void 0:t.logCustomEvent)||n.call(t,"studio_cliptool_extractstems_click",{mode:l}),a("select",e)};return(e,t)=>(r(),o("div",wd,[s("div",{class:"stems-button-list-item",onClick:t[0]||(t[0]=e=>n("all"))},[...t[2]||(t[2]=[s("img",{src:bd,alt:"All Detected Stems"},null,-1),s("div",{class:"stems-button-list-item-title"},"All Detected Stems",-1),s("p",null,"100 Gold",-1)])]),s("div",{class:"stems-button-list-item",onClick:t[1]||(t[1]=e=>n("vocals"))},[...t[3]||(t[3]=[s("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cg%20clip-path='url(%23clip0_8119_42005)'%3e%3cpath%20d='M13.0039%207.48145C13.826%207.09009%2014.8082%207.47403%2015.1465%208.31934C15.4475%209.07197%2015.1283%209.93068%2014.4092%2010.3047L11.3496%2011.8955C10.9494%2012.1035%2010.4816%2012.1407%2010.0537%2011.998L9.05566%2011.665L9.65234%2014.5303C9.72734%2014.8907%209.49612%2015.2433%209.13574%2015.3184C8.77535%2015.3934%208.42274%2015.1622%208.34766%2014.8018L7.51367%2010.8018C7.4652%2010.5683%207.5455%2010.3265%207.72363%2010.168C7.90185%2010.0095%208.15166%209.9578%208.37793%2010.0332L10.4756%2010.7334C10.5612%2010.7619%2010.6553%2010.7545%2010.7354%2010.7129L13.7939%209.12109C13.9051%209.06327%2013.9547%208.93077%2013.9082%208.81445C13.8558%208.68405%2013.7041%208.62514%2013.5771%208.68555L11.3691%209.73633C10.9297%209.9456%2010.4204%209.95253%209.97559%209.75488L7.52539%208.66602H6.99023L6.30273%2010.8652C6.21889%2011.1329%205.97655%2011.3196%205.69629%2011.332C5.41582%2011.3444%205.15786%2011.1794%205.05078%2010.9199L4.13281%208.69727C3.01894%208.87353%202.16723%209.83564%202.16699%2010.999V14.666C2.16699%2015.0342%201.86819%2015.333%201.5%2015.333C1.13181%2015.333%200.833008%2015.0342%200.833008%2014.666V10.999C0.833267%208.9742%202.47512%207.33301%204.5%207.33301H4.56641C4.83633%207.33301%205.07961%207.49562%205.18262%207.74512L5.5791%208.70703L5.86328%207.80078L5.9043%207.7002C6.01598%207.47784%206.24512%207.33304%206.5%207.33301H7.66699L7.80469%207.34766C7.85013%207.35728%207.89481%207.37166%207.9375%207.39062L10.5166%208.53613C10.6056%208.57568%2010.708%208.57506%2010.7959%208.5332L13.0039%207.48145ZM3.5%2010.666C3.86814%2010.666%204.16691%2010.9649%204.16699%2011.333V14.666C4.16699%2015.0342%203.86819%2015.333%203.5%2015.333C3.13181%2015.333%202.83301%2015.0342%202.83301%2014.666V11.333C2.83309%2010.9649%203.13186%2010.666%203.5%2010.666ZM5.50098%200.999023C7.06558%200.999199%208.3339%202.26838%208.33398%203.83301C8.33381%205.39756%207.06553%206.66584%205.50098%206.66602C3.93628%206.66602%202.66717%205.39767%202.66699%203.83301C2.66708%202.26827%203.93622%200.999023%205.50098%200.999023ZM13.4326%200.84375L13.4941%200.859375L15.6475%201.52148L15.5%202L15.3525%202.47754L13.834%202.00879V4.90137C13.8912%205.47896%2013.2983%206.01888%2012.502%206.11035C11.7%206.20241%2010.9956%205.8048%2010.9287%205.22266C10.8619%204.64048%2011.4578%204.09402%2012.2598%204.00195C12.46%203.97897%2012.6543%203.98527%2012.834%204.01855V1.34668L12.8379%201.2832C12.8732%200.994726%2013.1465%200.792483%2013.4326%200.84375ZM5.50098%202.33301C4.6726%202.33301%204.00106%203.00465%204.00098%203.83301C4.00115%204.66129%204.67266%205.33301%205.50098%205.33301C6.32915%205.33283%207.0008%204.66118%207.00098%203.83301C7.00089%203.00476%206.3292%202.33318%205.50098%202.33301Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_8119_42005'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",alt:"
1Vocals + Instrumental"},null,-1),s("div",{class:"stems-button-list-item-title"},"Vocals + Instrumental",-1),s("p",null,"20 Gold",-1)])])]))}},[["__scopeId","data-v-246bb63e"]]),Cd={key:0,src:bd,alt:"Extract Stems"},_d={key:1,src:et,alt:"Loading",class:"loading-icon"},Td=Te({__name:"stems-button-wrap",setup(e){const t=Oc(),{stemsGenerateLoading:a}=S(t);return(e,n)=>{const l=la;return r(),T(l,{ref:"stemsPopoverRef",trigger:"click",placement:"bottom","show-arrow":!1,teleported:!0,width:264,disabled:v(a),"popper-class":"stems-popover-box"},{reference:p(()=>[s("div",{class:f(["stems-button-wrap",{disabled:v(a)}])},[v(a)?(r(),o("img",_d)):(r(),o("img",Cd)),n[0]||(n[0]=m(" Extract ",-1))],2)]),default:p(()=>[u(Ad,{onSelect:v(t).generateStems},null,8,["onSelect"])]),_:1},8,["disabled"])}}},[["__scopeId","data-v-ce3c2157"]]),xd={class:"stems-header"},Dd=Te({__name:"stems-header",props:{expanded:{type:Boolean,default:!1}},emits:["update:expanded"],setup(e,{emit:t}){const a=t;return(t,n)=>(r(),o("div",xd,[n[1]||(n[1]=s("div",{class:"stems-header-title"},"Stems",-1)),u(Td),s("div",{class:"right-panel-icon-radius-wrap",onClick:n[0]||(n[0]=t=>a("update:expanded",!e.expanded))},[s("div",{class:f(["img collapse-icon",{expanded:!e.expanded}])},null,2)])]))}},[["__scopeId","data-v-9b5f7875"]]),Id={class:"stems-version-list"},Sd={class:"stems-version-list-item-title"},Md=Te({__name:"stems-version-list",props:{totalPage:{type:Number,default:0},nowPage:{type:Number,default:0}},emits:["load-page"],setup(e,{emit:t}){const a=e,n=t,l=()=>{a.nowPage>0&&n("load-page",a.nowPage-1)},i=()=>{a.nowPage<a.totalPage-1&&n("load-page",a.nowPage+1)};return(t,a)=>(r(),o("div",Id,[s("div",{class:f(["right-panel-icon-radius-wrap",{disabled:e.nowPage<=0}]),onClick:l},[...a[0]||(a[0]=[s("div",{class:"img left-icon"},null,-1)])],2),s("div",Sd,"Version "+h(e.nowPage+1),1),s("div",{class:f(["right-panel-icon-radius-wrap",{disabled:e.nowPage>=e.totalPage-1}]),onClick:i},[...a[1]||(a[1]=[s("div",{class:"img right-icon"},null,-1)])],2)]))}},[["__scopeId","data-v-082b43fd"]]),Ed={key:0,class:"clip-stems-content"},Pd=Te({__name:"clip-stems",setup(e){const t=wn(),n=Oc(),{currentClip:d,hasSongId:p,stemsEmpty:m,stemsDownloadLoadingSet:g,currentVersionIndex:h,stemsList:y,stemsListLoading:k,stemsPanelHide:b}=S(n),w=a(!1),A=a(!1),C=a(!1),_=e=>{b.value!==e&&(w.value=!0,b.value=e)};i(b,e=>{w.value?w.value=!1:e&&(A.value=!0)}),i(()=>{var e;return null==(e=d.value)?void 0:e.clipId},()=>{A.value=!1,C.value=!1});const T=l(()=>{var e;return((null==(e=y.value[h.value])?void 0:e.stems)||[]).length>0});i(T,e=>{e?A.value||C.value||(_(!1),C.value=!0):_(!0)},{immediate:!0});const x=()=>{var e;const a=((null==(e=y.value[h.value])?void 0:e.stems_mp3s)||[]).map(e=>{var a,n;const l=(null==(a=Ca[e.stem_name])?void 0:a.type)||e.stem_name,i=id(d,e);return t.createNewTrackData({name:l,color:e.color,clips:[i],instrument:{type:(null==(n=Ca[e.stem_name])?void 0:n.type)||e.stem_name}})});lt.batchAdd({tracks:a})},D=()=>{var e,t,a;const n=`${null==(e=d.value)?void 0:e.clipId}-${h.value}`,l=((null==(t=y.value[h.value])?void 0:t.stems)||[]).map(e=>{var t;const a=(null==(t=Ca[e.stem_name])?void 0:t.type)||e.stem_name;return{url:je(e.oss_key),name:a}});g.value.has(n)||0===l.length||(g.value.add(n),((e,{downloadName:t,onProgress:a,onCompleted:n,onError:l})=>{const i=new ld(e,{downloadName:t,onProgress:a,onCompleted:n,onError:l})})(l,{downloadName:`${(null==(a=d.value)?void 0:a.name)||"stems"}.zip`,onProgress:e=>{},onCompleted:()=>{g.value.delete(n)},onError:e=>{g.value.delete(n)}}))};return(e,t)=>{var a;return v(p)?(r(),o("div",Ed,[u(Dd,{expanded:v(b),"onUpdate:expanded":t[0]||(t[0]=e=>W(b)?b.value=e:null)},null,8,["expanded"]),v(m)?c("",!0):(r(),o("div",{key:0,class:f(["clip-stems-content-inner",{expanded:v(b)}])},[t[2]||(t[2]=s("div",{class:"clip-stems-line"},null,-1)),u(Md,{"total-page":v(y).length,"now-page":v(h),onLoadPage:t[1]||(t[1]=e=>v(n).currentVersionIndex=e)},null,8,["total-page","now-page"]),u(kd,{list:(null==(a=v(y)[v(h)])?void 0:a.stems_mp3s)||[],loading:v(k)},null,8,["list","loading"]),t[3]||(t[3]=s("div",{class:"clip-stems-line"},null,-1)),u(dd,{onInsertAll:x,onDownload:D})],2))])):c("",!0)}}},[["__scopeId","data-v-0c3c5e50"]]),Ld={class:"color-select"},Rd={class:"more-popover-item-color-picker"},Bd=["onClick"],jd={key:0,class:"more-popover-item-color-picker-item-check"},Nd=Te({__name:"color-select",props:{currentColor:{type:String,default:""}},emits:["change"],setup(e,{emit:t}){const n=e,l=t,i=a(null);return(t,a)=>{const u=la;return r(),T(u,{ref_key:"colorPopoverRef",ref:i,"show-arrow":!1,teleported:!0,placement:"bottom-start","popper-class":"studio-popover-box",trigger:"click"},{reference:p(()=>[s("div",{style:y({backgroundColor:e.currentColor}),class:"color-icon"},null,4)]),default:p(()=>[s("div",Ld,[s("div",Rd,[(r(!0),o(d,null,g(v(ye),t=>(r(),o("div",{class:f({"more-popover-item-color-picker-item":!0,pointer:!0,"flex-center":!0,"more-popover-item-color-picker-item-active":e.currentColor===t}),key:t,onClick:e=>(e=>{var t;e!==n.currentColor&&l("change",e),null==(t=i.value)||t.hide()})(t)},[t===e.currentColor?(r(),o("div",jd,[...a[0]||(a[0]=[s("img",{src:pc,alt:""},null,-1)])])):c("",!0),s("span",{style:y({backgroundColor:t})},null,4)],10,Bd))),128))])])]),_:1},512)}}},[["__scopeId","data-v-3003db67"]]),Od={class:"edit-name"},Vd={class:"edit-name-container"},Fd={class:"edit-name-text"},Ud={key:0},Hd=["readonly"],Gd=Te({__name:"edit-name",props:{name:{type:String,required:!0},readonly:{type:Boolean,required:!1}},emits:["save"],setup(e,{emit:t}){const n=t,l=e,i=a(!1),d=a(""),p=a(null),m=()=>{l.name&&!i.value&&(i.value=!0,d.value=l.name||"",E(()=>{p.value&&(p.value.focus(),p.value.select())}))},g=()=>{i.value=!1,d.value=""},f=()=>{if(!i.value)return;const e=d.value.trim();e&&e!==l.name&&n("save",e),g()};return(t,a)=>
1(r(),o("div",Od,[s("div",Vd,[s("div",Fd,[i.value?P((r(),o("input",{key:1,ref_key:"nameInputRef",ref:p,"onUpdate:modelValue":a[0]||(a[0]=e=>d.value=e),readonly:l.readonly,class:"edit-name-input",type:"text",onBlur:f,onKeyup:[Y(f,["enter"]),Y(g,["esc"])]},null,40,Hd)),[[V,d.value]]):(r(),o("span",Ud,h(e.name),1))]),i.value||l.readonly?c("",!0):(r(),o("div",{key:0,onClick:m},[u(v(xe),{name:"sys-edit",opacity:.4,size:12})]))])]))}},[["__scopeId","data-v-989d23d6"]]),Wd={class:"control-value-container"},Kd=Te({__name:"num-control",props:{modelValue:{type:Number,default:0},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},prefix:{type:String,default:""},canEdit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},format:{type:Function,default:e=>e}},emits:["decrease","increase","update:modelValue"],setup(e,{emit:t}){const n=e,l=t,c=a(!1),d=a(n.modelValue),u=a(null),p=()=>{n.disabled||n.modelValue<=n.min||l("decrease")},v=()=>{n.disabled||n.modelValue>=n.max||l("increase")},m=()=>{n.canEdit&&(n.disabled||(c.value=!0,d.value=`${n.modelValue}`,E(()=>{u.value&&(u.value.focus(),u.value.select())})))},g=()=>{if(!c.value)return;const e=d.value.trim();e&&e!==n.modelValue&&l("update:modelValue",e),y()},y=()=>{c.value=!1,d.value=""};return i(()=>n.modelValue,()=>{d.value=`${n.modelValue}`}),(t,a)=>(r(),o("div",{class:f(["num-control",{"is-disabled":e.disabled}])},[s("div",{class:f(["control-btn",{disabled:e.disabled||e.modelValue<=e.min}]),onClick:p},[...a[1]||(a[1]=[s("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.33398%208H12.6673'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"-"},null,-1)])],2),s("div",Wd,[c.value&&e.canEdit?P((r(),o("input",{key:1,ref_key:"numInputRef",ref:u,"onUpdate:modelValue":a[0]||(a[0]=e=>d.value=e),class:"edit-num-input",type:"text",onBlur:g,onKeyup:[Y(g,["enter"]),Y(y,["esc"])]},null,544)),[[V,d.value]]):(r(),o("div",{key:0,class:f(["control-value",{"can-edit":e.canEdit&&!e.disabled}]),onDblclick:m},h(e.prefix)+h(e.format(e.modelValue)),35))]),s("div",{class:f(["control-btn",{disabled:e.disabled||e.modelValue>=e.max}]),onClick:v},[...a[2]||(a[2]=[s("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.00065%203.33325V12.6666M3.33398%207.99992H12.6673'%20stroke='white'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"+"},null,-1)])],2)],2))}},[["__scopeId","data-v-5c132f70"]]),Yd={class:"clip-panel"},zd={class:"clip-panel-header"},Xd={class:"clip-panel-content"},Qd={class:"clip-panel-controls"},qd={class:"clip-setting-row clip-tempo"},Zd={class:"clip-setting-control clip-tempo-select"},Jd={class:"clip-setting-row clip-transpose"},$d={class:"clip-setting-control clip-transpose-control"},eu={class:"clip-setting-row clip-speed"},tu={class:"clip-setting-control clip-speed-control"},au={class:"clip-setting-row clip-volume"},nu={class:"clip-setting-control clip-volume-control"},lu={key:0,class:"clip-info-card"},iu={key:0,src:td,alt:"copy"},ou={key:1,src:ri,alt:"success"},ru={key:1,class:"clip-info-card-empty"},su={key:1,class:"clip-info-card"},cu={key:0,src:td,alt:"copy"},du={key:1,src:ri,alt:"success"},uu={key:1,class:"clip-info-card-empty"},pu={key:0,class:"lyrics-preview"},vu={key:0,class:"lyrics-tag"},mu={key:1,class:"lyrics-lines"},gu=Te({__name:"clip-panel",setup(e){var t;const n=Oc(),p=ot(),{currentClip:m,currentTrack:y,rightPanelVisible:k,songDetailSimple:b,panelClips:w,isShowFullSongInfo:A}=S(n),C=a(!0),D=a(!0),M={height:"40px"},E=e=>{const t=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_NAME,clipData:{name:e}});lt.batchUpdate({tracks:t.tracks})},P=e=>{const t=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_COLOR,clipData:{color:e}});lt.batchUpdate({tracks:t.tracks})},L=[{value:!0,label:"On beat"},{value:!1,label:"Original"}],R=async e=>{var t,a,n,l,i,o;try{if(!(null==(a=null==(t=nt)?void 0:t.MainManagerDispatcher)?void 0:a.updateClipDataByTrackIdAndClipIdAndOperationType))return;const r=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:e?Kt.CHANGE_CLIP_TEMPO_STATE_ON_BEAT:Kt.CHANGE_CLIP_TEMPO_STATE_ORIGIN}),s=!0===(null==(n=p.isPlaying)?void 0:n.call(p));if(lt.batchUpdate({tracks:r.tracks}),!s)return;const c=await(null==(l=p.waitForSyncQueueIdle)?void 0:l.call(p,{timeout:1500}));if(!(null==c?void 0:c.success))return;const d="number"==typeof p.currentTime&&isFinite(p.currentTime)?p.currentTime:null==(o=null==(i=p.getPlayerStateData)?void 0:i.call(p))?void 0:o.currentTime;if(!("number"==typeof d&&isFinite(d)))return;
1const u=p.setCurrentPlaytime(d);null==u||u.success}catch(r){}},B=l(()=>{const e=m.value.transposition;return isNaN(e)?"":e>0?"+":""}),j=()=>{var e,t;null==(t=null==(e=tt)?void 0:e.logCustomEvent)||t.call(e,"studio_cliptool_transpose_click");const a=m.value.transposition+1,n=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_TRANSPOSITION,clipData:{transposition:a}});lt.batchUpdate({tracks:n.tracks})},N=()=>{var e,t;null==(t=null==(e=tt)?void 0:e.logCustomEvent)||t.call(e,"studio_cliptool_transpose_click");const a=m.value.transposition-1,n=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_TRANSPOSITION,clipData:{transposition:a}});lt.batchUpdate({tracks:n.tracks})},O=e=>{var t,a;null==(a=null==(t=tt)?void 0:t.logCustomEvent)||a.call(t,"studio_cliptool_transpose_click");let n=parseInt(e);if(!isNaN(n)){n>36?n=36:n<-36&&(n=-36);const e=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_TRANSPOSITION,clipData:{transposition:n}});lt.batchUpdate({tracks:e.tracks})}},V=()=>{var e,t;null==(t=null==(e=tt)?void 0:e.logCustomEvent)||t.call(e,"studio_cliptool_speed_click");let a=m.value.wrap.speed;if(!isNaN(a)){if(a*=2,U(a)>128)return;const e=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_SPEED_UP});lt.batchUpdate({tracks:e.tracks})}},F=()=>{var e,t;null==(t=null==(e=tt)?void 0:e.logCustomEvent)||t.call(e,"studio_cliptool_speed_click");let a=m.value.wrap.speed;if(!isNaN(a)){if(a/=2,U(a)<.008)return;const e=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_SPEED_DOWN});lt.batchUpdate({tracks:e.tracks})}},U=e=>Math.round(1e3*Number(e))/1e3,H=a((null==(t=m.value)?void 0:t.volume)||0);i(()=>{var e;return null==(e=m.value)?void 0:e.volume},e=>{H.value=e||0});const G=e=>{if(H.value=e,e!==m.value.volume){const t=nt.MainManagerDispatcher.splitAndUpdateClipOfSelectionData({operationType:Kt.CHANGE_CLIP_VOLUME,clipData:{volume:e}});lt.batchUpdate({tracks:t.tracks})}},W=e=>{p.setClipVolume(y.value.id,m.value.clipId,e),gt.setVolume({trackId:y.value.id,clipId:m.value.clipId,volume:e})},K=a(null);let Y=null;const z=()=>{var e;if(!(()=>{var e,t,a,n,l,i;if(!p.isPlaying())return!1;const o=m.value;if(!o)return!1;const r=(null==(t=null==(e=nt)?void 0:e.MainManagerDispatcher)?void 0:t.timing)||{},s=null==(n=null==(a=nt)?void 0:a.MainManagerDispatcher)?void 0:n.FollowTrackTempoManager,c=(null==(i=null==(l=p.getTimeRangeInfo)?void 0:l.call(p))?void 0:i.minStartTime)||0,d=Yt(p.currentTime||0,r,c,s),u=o.startTime??0,v=St(o);return!Number.isFinite(v)||v<=u?d>=u:d>=u&&d<v})())return void(K.value=null);const t=null==(e=y.value)?void 0:e.id;if(t)try{const e=p.getTrackChannelVolumes(t);K.value=e?{left:e.leftDb,right:e.rightDb}:null}catch{K.value=null}};_(()=>{Y||(z(),Y=setInterval(z,50))}),I(()=>{Y&&(clearInterval(Y),Y=null),K.value=null}),i(()=>{var e;return null==(e=m.value)?void 0:e.clipId},()=>{K.value=null});const X=a(!1),Q=a(!1),q=()=>{C.value=!C.value},Z=()=>{const e=J.value.join(";\n");ya(e).then(()=>{X.value=!0,setTimeout(()=>{X.value=!1},1e3)})},J=l(()=>{var e;const t=null==(e=b.value)?void 0:e.description;return"string"==typeof t?t.split(",").filter(Boolean):[]}),$=()=>{D.value=!D.value},ee=()=>{ya(ae.value).then(()=>{Q.value=!0,setTimeout(()=>{Q.value=!1},1e3)})},te=l(()=>{var e;return((null==(e=b.value)?void 0:e.lyrics)||[]).map(e=>`${e.user_input_tag||""} ${e.rows&&e.rows.length>0?e.rows.map(e=>e.text).join(" "):""}`).join(" ")}),ae=l(()=>{var e;return((null==(e=b.value)?void 0:e.lyrics)||[]).map(e=>{const t=[];return e.user_input_tag&&t.push(e.user_input_tag),e.rows&&e.rows.length>0&&t.push(...e.rows.map(e=>e.text).filter(Boolean)),t.join("\n")}).filter(Boolean).join("\n\n")});return(e,t)=>{var a,n,l,i,p,_,I,S,Y,z,ae,ne,le,ie,oe,re,se,ce,de,ue;return r(),o("div",Yd,[s("div",zd,[u(Nd,{"current-color":null==(a=v(m))?void 0:a.color,onChange:P},null,8,["current-color"]),u(Gd,{readonly:(null==(n=v(w))?void 0:n.length)>1,name:(null==(l=v(w))?void 0:l.length)>1?`Selection (${v(w).length} clips)`:null==(i=v(m))?void 0:i.name,onSave:E},null,8,["readonly","name"]),s("button",{type:"button",class:"clip-panel-header-right","aria-label":"Collapse right panel",onClick:t[0]||(t[0]=e=>k.value=!1)},[...t[1]||(t[1]=[s("span",{class:"clip-panel-collapse-icon"},null,-1)])])]),s("div",Xd,[s("div",Qd,[s("div",qd,[t[2]||(t[2]=s("div",{class:"clip-setting-title"},"Tempo",-1)),s("div",Zd,[u(ja,{"model-value":!!(null==(_=null==(p=v(m))?void 0:p.wrap)?void 0:_.enabled),"value-type":"boolean",placeholder:"",options:L,"render-style":M,onChange:R},null,8,["model-value"])])]),s("div",Jd,[t[3]||(t[3]=s("div",{class:"clip-setting-title"},"Transpose",-1)),s("div",$d,[u(Kd,{"model-value":null==(I=v(m))?void 0:I.transposition,prefix:B.value,max:36,min:-36,onDecrease:N,onIncrease:j,"onUpdate:modelValue":O},null,8,["model-value","prefix"])])]),s("div",eu,[t[4]||(t[4]=s("div",{class:"clip-setting-title"},"Speed",-1)),s("div",tu,[u(Kd,{"model-value":null==(Y=null==(S=v(m))?void 0:S.wrap)?void 0:Y.speed,prefix:"x","can-edit":!1,max:128,min:.008,format:U,disabled:!(null==(ae=null==(z=v(m))?void 0:z.wrap)?void 0:ae.enabled),onDecrease:F,onIncrease:V},null,8,["model-value","disabled"])])]),s("div",au,[t[6]||(t[6]=s("div",{class:"clip-setting-title"},"Clip Volume",-1)),s("div",nu,[t[5]||(t[5]=s("img",{class:"clip-volume-icon",src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.3531%202.76797C12.0409%202.57279%2011.6296%202.66766%2011.4344%202.97985C11.2392%203.29205%2011.3341%203.70337%2011.6463%203.89855C13.0778%204.79351%2013.9997%206.3056%2013.9997%207.99993C13.9997%209.69425%2013.0778%2011.2063%2011.6463%2012.1013C11.3341%2012.2965%2011.2392%2012.7078%2011.4344%2013.02C11.6296%2013.3322%2012.0409%2013.4271%2012.3531%2013.2319C14.1349%2012.1179%2015.333%2010.1986%2015.333%207.99993C15.333%205.80121%2014.1349%203.88192%2012.3531%202.76797Z'%20fill='white'%20fill-opacity='0.4'%20/%3e%3cpath%20d='M8.1728%202.66659C7.90935%202.66659%207.65374%202.75625%207.44802%202.92083L4.79063%205.04675C4.55879%205.23222%204.27074%205.33326%203.97384%205.33326C2.51535%205.33326%201.33301%206.5156%201.33301%207.97409V8.02576C1.33301%209.48425%202.51535%2010.6666%203.97384%2010.6666C4.27074%2010.6666%204.55879%2010.7676%204.79063%2010.9531L7.44802%2013.079C7.65374%2013.2436%207.90935%2013.3333%208.1728%2013.3333C8.81357%2013.3333%209.33301%2012.8
1138%209.33301%2012.1731V3.8268C9.33301%203.18604%208.81357%202.66659%208.1728%202.66659Z'%20fill='white'%20fill-opacity='0.4'%20/%3e%3cpath%20d='M11.8105%209.28815C11.5255%2010.1525%2010.6663%209.72677%2010.6663%208.81669V7.18316C10.6663%206.27308%2011.5255%205.84737%2011.8105%206.7117C11.926%207.06222%2011.9997%207.48809%2011.9997%207.99993C11.9997%208.51176%2011.926%208.93763%2011.8105%209.28815Z'%20fill='white'%20fill-opacity='0.4'%20/%3e%3c/svg%3e",alt:""},null,-1)),u(rc,{mute:null==(ne=v(y))?void 0:ne.mute,"max-decibel":12,"min-decibel":-72,"initial-decibel":H.value,"decibel-value":K.value,"current-decibel-background":null==(le=v(m))?void 0:le.color,"is-playing":!!K.value,mode:"clip",onDecibelChanging:G,onDecibelChangeEnd:W},null,8,["mute","initial-decibel","decibel-value","current-decibel-background","is-playing"])])])]),v(A)?(r(),o("div",lu,[J.value.length>0?(r(),o("div",{key:0,class:"clip-info-card-header cursor-pointer",onClick:q},[t[7]||(t[7]=s("div",{class:"clip-info-card-title"},"Musical style",-1)),s("button",{type:"button",class:"clip-info-card-button clip-info-card-copy","aria-label":"Copy musical style",onClick:x(Z,["stop"])},[X.value?(r(),o("img",ou)):(r(),o("img",iu))]),J.value.length>0?(r(),o("button",{key:0,type:"button",class:"clip-info-card-button clip-info-card-toggle","aria-label":"Toggle musical style",onClick:x(q,["stop"])},[s("div",{class:f(["img collapse-icon",{expanded:C.value}])},null,2)])):c("",!0)])):(r(),o("div",ru,"[no styles]")),J.value.length>0?(r(),o("div",{key:2,class:f(["clip-info-card-content music-style-content",{collapsed:!C.value}])},[s("p",null,h(null==(ie=v(b))?void 0:ie.description),1)],2)):c("",!0)])):c("",!0),v(A)?(r(),o("div",su,[(null==(re=null==(oe=v(b))?void 0:oe.lyrics)?void 0:re.length)>0?(r(),o("div",{key:0,class:"clip-info-card-header cursor-pointer",onClick:$},[t[8]||(t[8]=s("span",{class:"clip-info-card-title"},"Lyrics",-1)),s("button",{type:"button",class:"clip-info-card-button clip-info-card-copy","aria-label":"Copy lyrics",onClick:x(ee,["stop"])},[Q.value?(r(),o("img",du)):(r(),o("img",cu))]),s("button",{type:"button",class:"clip-info-card-button clip-info-card-toggle","aria-label":"Toggle lyrics",onClick:x($,["stop"])},[s("div",{class:f(["img collapse-icon",{expanded:D.value}])},null,2)])])):(r(),o("div",uu,"[no lyrics]")),(null==(ce=null==(se=v(b))?void 0:se.lyrics)?void 0:ce.length)>0?(r(),o("div",{key:2,class:f(["clip-info-card-content lyrics-content",{collapsed:!D.value}])},[D.value?(r(!0),o(d,{key:1},g((null==(de=v(b))?void 0:de.lyrics)||[],(e,t)=>(r(),o("div",{key:t,class:"lyrics-section"},[e.user_input_tag?(r(),o("div",vu,h(e.user_input_tag||""),1)):c("",!0),e.rows&&e.rows.length>0?(r(),o("div",mu,[(r(!0),o(d,null,g(e.rows,(e,t)=>(r(),o("p",{key:t},h(e.text),1))),128))])):c("",!0)]))),128)):(r(),o("p",pu,h(te.value),1))],2)):c("",!0)])):c("",!0),v(A)?(r(),T(Pd,{key:null==(ue=v(m))?void 0:ue.clipId})):c("",!0)])])}}},[["__scopeId","data-v-c7fc020a"]]),hu={class:"track-panel"},fu={class:"track-panel-header"},yu={class:"track-panel-content"},ku={class:"track-panel-instrument flex-center"},bu={key:0},wu={key:1},Au=Te({__name:"track-panel",setup(e){const t=rt(),a=Oc(),{currentTrack:n,panelType:i,rightPanelVisible:c}=S(a),d=l(()=>{var e;
1return"follow-track"===t.state.timing.type&&t.state.timing.trackId===(null==(e=n.value)?void 0:e.id)}),g=e=>{if(!e)return null;const t=Aa.find(t=>t.type===e);return(null==t?void 0:t.name)||(null==t?void 0:t.type)||null},h=e=>{var t,a,l;if(!n.value)return;const i=n.value.id,o=(null==(a=null==(t=n.value)?void 0:t.instrument)?void 0:a.type)||null,r=(null==(l=n.value)?void 0:l.name)||"",s="string"==typeof r&&((e,t)=>{const a=g(t);return!(!a||e!==a)||"Song"===t&&"New Track"===e})(r,o);if(lt.setInstrument({trackId:n.value.id,instrument:{...n.value.instrument,type:e.type}}),s){const t=g(e.type);t&&t!==r&&lt.rename({trackId:i,name:t})}},y=e=>{lt.rename({trackId:n.value.id,name:e})},k=()=>{var e;const a=null==(e=n.value)?void 0:e.id;if(!a)return;const l=t.state.tracks.find(e=>e.id===a);if(!l)return;const i=e=>({...e,id:ae(),clipId:ae()}),o={...l,id:ae(),clips:(l.clips||[]).map(i),takeLanes:(l.takeLanes||[]).map(e=>({...e,id:ae(),clips:(e.clips||[]).map(i)}))};lt.duplicate({trackId:a,track:o}),t.setSelection({...t.state.selection,focusedArea:"tracks",focusedTrackId:o.id,trackIds:[o.id]})},b=()=>{if(!n.value)return;if(d.value)return void ct(()=>{pt.setTimingType("manual"),pt.setFollowTrack(null)});const{clip:e,bpm:t}=zt(n.value);ct(()=>{pt.setTimingType("follow-track"),pt.setFollowTrack(n.value.id),pt.setBpm(e&&t?t:120)})},w=()=>{n.value&&(lt.remove(n.value.id),t.setSelection({...t.state.selection,trackIds:[]}),i.value=_t.NONE)},A=()=>{c.value=!1},C=e=>{e!==n.value.color&&lt.setColor({trackId:n.value.id,color:e})};return(e,t)=>{var a,l,i;return r(),o("div",hu,[s("div",fu,[u(Nd,{"current-color":null==(a=v(n))?void 0:a.color,onChange:C},null,8,["current-color"]),u(Gd,{name:null==(l=v(n))?void 0:l.name,onSave:y},null,8,["name"]),s("button",{type:"button",class:"track-panel-header-right","aria-label":"Collapse right panel",onClick:A},[...t[0]||(t[0]=[s("span",{class:"track-panel-collapse-icon"},null,-1)])])]),s("div",yu,[s("div",ku,[u(_l,{instrument:null==(i=v(n))?void 0:i.instrument,from:"right-track-panel",onChange:h},null,8,["instrument"])]),u(v(Ye),{class:"track-panel-action track-panel-duplicate",type:"ghost",onClick:k},{prefix:p(()=>[u(v(xe),{name:"sys-copy",size:16})]),default:p(()=>[t[1]||(t[1]=m(" Duplicate ",-1))]),_:1}),u(v(Ye),{class:f(["track-panel-action track-panel-following",{"track-panel-action-active":d.value}]),type:"ghost",onClick:b},{prefix:p(()=>[u(v(xe),{name:"sys-music-filled",color:"#fff",size:16})]),default:p(()=>[d.value?(r(),o("span",bu," Stop Following Tempo ")):(r(),o("span",wu,"Follow Track Tempo"))]),_:1},8,["class"]),u(v(Ye),{class:"track-panel-action track-panel-delete",type:"ghost",onClick:w},{prefix:p(()=>[u(v(xe),{color:"#ff4560",name:"sys-delete",size:16})]),default:p(()=>[t[2]||(t[2]=m(" Delete ",-1))]),_:1})])])}}},[["__scopeId","data-v-d15f3860"]]),Cu={class:"right-panel"},_u={key:2,class:"height-all"},Tu={class:"right-panel-empty"},xu={class:"clip-panel-header"},Du=Te({__name:"right-panel",setup(e){const t=Oc(),{rightPanelVisible:a,panelType:n,currentTrack:l,currentClip:i}=S(t);return M(()=>{t.destroy()}),(e,t)=>(r(),o("div",Cu,["track"===v(n)&&v(l)?(r(),T(Au,{key:0})):"clip"===v(n)&&v(i)?(r(),T(gu,{key:1,onCollapseClipPanel:t[0]||(t[0]=e=>a.value=!1)})):(r(),o("div",_u,[s("div",Tu,[s("div",xu,[s("div",{class:"clip-panel-header-right",onClick:t[1]||(t[1]=e=>a.value=!1)})]),t[2]||(t[2]=s("div",{class:"right-panel-empty-text"}," Select a full clip or a track to view its details. ",-1))])]))]))}},[["__scopeId","data-v-b9dca313"]]),Iu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Su={render:function(e,t){return r(),o("svg",Iu,[...t[0]||(t[0]=[s("path",{stroke:"#fff","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":".4","stroke-width":"1.333",d:"M2 8a6 6 0 1 0 6-6 6.5 6.5 0 0 0-4.493 1.827L2 5.333m0 0V2m0 3.333h3.333M8 4.667V8l2.667 1.333"},null,-1)])])}},Mu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Eu={render:function(e,t){return r(),o("svg",Mu,[...t[0]||(t[0]=[s("g",{"clip-path":"url(#a)"},[s("path",{stroke:"#fff","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":".4","stroke-width":"1.333",d:"M13.49 5.214H9.717m-2.828 0H3.118m6.6-2.829h3.771l.01 6.374a5.193 5.193 0 0 1-10.371 0l-.01-6.374H6.89l-.015 6.01a1.427 1.427 0 0 0 2.829 0z"})],-1),s("defs",null,[s("clipPath",{id:"a"},[s("path",{fill:"#fff",d:"M0 0h16v16H0z"})])],-1)])])}},Pu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Lu={render:function(e,t){return r(),o("svg",Pu,[...t[0]||(t[0]=[s("path",{stroke:"#fff","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":".4","stroke-width":"1.333",d:"m14 14-2.9-2.9M7.333 5.333v4m-2-2h4m3.334 0A5.333 5.333 0 1 1 2 7.333a5.333 5.333 0 0 1 10.667 0"},null,-1)])])}},Ru={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Bu={render:function(e,t){return r(),o("svg",Ru,[...t[0]||(t[0]=[s("g",{"clip-path":"url(#a)"},[s("path",{stroke:"#fff","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":".4","stroke-width":"1.333",d:"m14 14-2.9-2.9M5.333 7.333h4m3.334 0A5.333 5.333 0 1 1 2 7.333a5.333 5.333 0 0 1 10.667 0"})],-1),s("defs",null,[s("clipPath",{id:"a"},[s("path",{fill:"#fff",d:"M0 0h16v16H0z"})])],-1)])])}},ju={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Nu={render:function(e,t){return r(),o("svg",ju,[...t[0]||(t[0]=[s("path",{fill:"#fff",d:"M14.177 4.095a.8.8 0 0 0-.821.04l-4.8 3.2a.8.8 0 0 0 0 1.33l4.8 3.2A.8.8 0 0 0 14.6 11.2V4.8a.8.8 0 0 0-.423-.705m-7.2 0a.8.8 0 0 0-.821.04l-4.8 3.2a.8.8 0 0 0 0 1.33l4.8 3.2A.8.8 0 0 0 7.4 11.2V4.8a.8.8 0 0 0-.423-.705"},null,-1)])])}},Ou={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Vu={render:function(e,t){return r(),o("svg",Ou,[...t[0]||(t[0]=[s("path",{fill:"#fff",d:"M1.823 4.095a.8.8 0 0 1 .821.04l4.8 3.2a.8.8 0 0 1 0 1.33l-4.8 3.2A.8.8 0 0 1 1.4 11.2V4.8a.8.8 0 0 1 .423-.705m7.2 0a.8.8 0 0 1 .821.04l4.8 3.2a.8.8 0 0 1 0 1.33l-4.8 3.2A.8.8 0 0 1 8.6 11.2V4.8a.8.8 0 0 1 .423-.705"},null,-1)])])}},Fu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Uu={render:function(e,t){return r(),o("svg",Fu,[...t[0]||(t[0]=[s("path",{fill:"#000",d:"M5 2a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm7 0a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"},null,-1)])])}},Hu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Gu={render:function(e,t){return r(),o("svg",Hu,[...t[0]||(t[0]=[s("path",{fill:"#000",stroke:"#000","stroke-linecap":"round","stroke-linejoin":"round",d:"M4.332 3.327c0-.648 0-.971.135-1.15a.67.67 0 0 1 .492-.263c.223-.014.493.166 1.031.525L13 7.113c.446.296.668.445.746.632a.67.67 0 0 1 0 .51c-.078.188-.3.336-.745.633L5.99 13.56c-.54.36-.809.54-1.032.526a.67.67 0 0 1-.492-.264c-.135-.178-.135-.502-.135-1.15z"},null,-1)])])}},Wu={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};const Ku={render:function(e,t){return r(),o("svg",Wu,[...t[0]||(t[0]=[s("path",{fill:"#fff","fill-opacity":".4",d:"M12.353 2.768a.667.667 0 0 0-.707 1.13C13.078 4.795 14 6.307 14 8s-.922 3.206-2.354 4.101a.667.667 0 1 0 .707 1.13c1.782-1.113 2.98-3.032 2.98-5.231s-1.198-4.118-2.98-5.232m-4.18-.101c-.264 0-.52.09-.725.254L4.791 5.047a1.3 1.3 0 0 1-.817.286 2.64 2.64 0 0 0-2.641 2.641v.052a2.64 2.64 0 0 0 2.64 2.64c.298 0 .586.102.8
118.287l2.657 2.126a1.16 1.16 0 0 0 1.885-.906V3.827c0-.641-.52-1.16-1.16-1.16"},null,-1),s("path",{fill:"#fff","fill-opacity":".4",d:"M11.81 9.288c-.285.864-1.144.439-1.144-.471V7.183c0-.91.86-1.336 1.144-.471.116.35.19.776.19 1.288s-.074.938-.19 1.288"},null,-1)])])}};function Yu(e,t){let a=null,n=0,l=!1;const i=rt(),o=()=>{var t,a;const n=(null==(t=i.state)?void 0:t.timing)||{},l=Xt(n);if(nt.MainManagerDispatcher){const{maxDuration:e,minStartTime:t=0}=nt.MainManagerDispatcher.getMaxTimeInfo();if(e&&e>0&&e!==1/0)return Math.max(0,e-t)}const o=null==(a=e.getTimeRangeInfo)?void 0:a.call(e);if((null==o?void 0:o.effectiveDuration)>0)return l>0?o.effectiveDuration/l:o.effectiveDuration;const r=e.getPlayerInstance();if(!r)return 0;if(r.getTimeRangeInfo){const e=r.getTimeRangeInfo();if((null==e?void 0:e.effectiveDuration)>0){const t=1e3*e.effectiveDuration;return l>0?t/l:t}}return r.getTotalDuration?1e3*r.getTotalDuration():0},r=e=>{const a=e;if(Math.abs(a-n)<10)return;n=a;const l=o();0!==l&&a>=l-100&&(t&&"function"==typeof t&&t(),s())},s=()=>{l&&(null!==a&&(e.removePlayTimeUpdateListener(a),a=null),l=!1,n=0)};return{start:()=>{l||(a=e.addPlayTimeUpdateListener(r),l=!0)},stop:s,destroy:()=>{s()},isActive:()=>l,getProjectDuration:o}}const zu={class:"studio-operations"},Xu={class:"bpm-popover-content"},Qu={class:"bpm-popover-controls"},qu={class:"bpm-value-display"},Zu={class:"studio-operations-controls"},Ju={class:"studio-operations-beats"},$u={class:"studio-operations-volume-control"},ep={class:"rightFunctionBox"},tp={class:"left-items"},ap={class:"item",title:"Snap to Grid"},np={class:"item",title:"Zoom In"},lp={class:"item",title:"Zoom Out"},ip={class:"item",title:"Reset"},op="tone-player",rp=Te({__name:"Operations",setup(e,{expose:t}){var n;const m=rt(),g=ot(),y=wn(),k=null==(n=w())?void 0:n.appContext,b=l(()=>"preview"===m.mode),A=a(null),x=a(null),D=()=>{var e,t;return(null==(t=null==(e=g.getTimeRangeInfo)?void 0:e.call(g))?void 0:t.minStartTime)||0},I=a(!0),S=C({learnStudioBtnHighlight:!1,learnStudioDialogVisible:!1}),E=()=>{S.learnStudioDialogVisible=!0,S.learnStudioBtnHighlight=!1,localStorage.setItem(`mureka_${fa.appname}_studio_learn_opend_state`,1),((e,t)=>{var a,n,l;const i=null==(l=null==(n=(w()||(null==(a=null==window?void 0:window.$getVueCurrentInstance)?void 0:a.call(window))).appContext)?void 0:n.config)?void 0:l.globalProperties;null==i||i.logCustomEvent(e,{...t})})("studio_learn_click",{source:"studio"})};i(()=>{var e;return null==(e=m.state.timing)?void 0:e.snapEnabled},e=>{I.value=e});const L=e=>{var t,a;const n=null==(t=nt.MainManagerDispatcher)?void 0:t.zoom(e);(null==n?void 0:n.needUpdate)&&(null==(a=nt.MainManagerDispatcher)||a.triggerRender({renderModule:$t.ALL,renderLayer:Rt.ALL}))},R=()=>{var e;I.value=!I.value,null==(e=nt.MainManagerDispatcher)||e.toggleSnapEnabled(I.value)},B=e=>{var t,a,n;const l=(null==(t=m.state)?void 0:t.timing)||{},i=null==(n=null==(a=nt)?void 0:a.MainManagerDispatcher)?void 0:n.FollowTrackTempoManager;return Yt(e,l,D(),i)},j=l(()=>{var e;if(!y.isRecordSelectTrackId)return!1;const t=m.state.tracks.find(e=>e.id===y.isRecordSelectTrackId);return!!t&&!!(null==(e=null==t?void 0:t.input)?void 0:e.deviceId)}),N=l(()=>j.value?g.loopState.loop?"Recording is disabled while Loop is enabled.":"Record":"No input. Select an input and arm a track to record."),O=C({bpm:m.state.timing.bpm||120,isPlaying:!1,currentTime:"00:00:000",currentBeats:"001.1.1",leftVolume:0,rightVolume:0,followTrack:!1,isMetronomeEnabled:!1,metronomeVolume:-10,isMuted:!1,savedVolume:0,masterVolume:0,get timing(){return m.state.timing}}),F=a(O.bpm),U=a(null);let H=null,G=null,W=null;const K=()=>{var e,t;if(!G)return;const a=(null==(e=m.state)?void 0:e.timing)||{},n=a.bpm||a.baseBpm||120;G.bpm=n,null==(t=G.syncMetronomeWithTransport)||t.call(G)},z=e=>{b.value||(O.masterVolume=e,G.updateMasterVolume(e))},X=e=>{b.value||pt.setGlobalVolume(e)},Q=()=>{var e,t,a;const n=g.handleFollowMode(!g.isFollowMode);null==(a=null==(t=null==(e=nt)?void 0:e.MainManagerDispatcher)?void 0:t.setFollowState)||a.call(t,n)},q=()=>{at.error({key:"studio-playback-failed",title:"Playback failed",description:"Please try again. If the problem persists, refresh the page.",duration:5e3,closable:!0})};let Z=!1;const J=async()=>{var e,t,a,n,l,i,o,r,s,c;if(Z)return;if(!O.isPlaying&&"undefined"==typeof SharedArrayBuffer)return void at.warning({key:"studio-audio-unavailable",title:"Audio playback is unavailable",description:"Refresh the page or try another browser to play audio in Studio.",duration:5e3,closable:!0});if(!G)return void q();const d=!O.isPlaying;Z=!0;try{if((()=>{var e,t,a,n;const l=null==(a=null==(t=null==(e=null==k?void 0:k.config)?void 0:e.globalProperties)?void 0:t.$globalMediaUtils)?void 0:a.globalAudioPlayer,i=null==l?void 0:l.currentUrl;i&&(null==(n=null==l?void 0:l.currentPlayer)?void 0:n.isPlaying)&&l.pause(i)})(),!G.isInitialized){const t=(null==(e=O.timing)?void 0:e.baseBpm)||120,a=await G.initPlayer(t);if(!(null==a?void 0:a.success))throw new Error((null==a?void 0:a.message)||"Player initialization failed");K(),void 0!==O.metronomeVolume&&G.setMetronomeVolume(O.metronomeVolume)}if(O.isPlaying){const e=await G.pause();if(!(null==e?void 0:e.success))throw new Error((null==e?void 0:e.message)||"Player pause failed");O.isPlaying=!1,g.isTonePlayerPlaying=!1,g.currentPlayingId===op&&(g.currentPlayingId=null);const l=g.getRecordingState();if(l.isRecording&&!l.isPaused){g.pauseRecording().success}null==(n=null==(a=null==(t=nt)?void 0:t.MainManagerDispatcher)?void 0:a.setCurrentPlayState)||n.call(a,{isPlay:O.isPlaying,currentTime:g.currentTime}),de(),W&&W.stop()}else{if(g.loopState.loop){const e=B(1e3*G.getCurrentTime()),t=g.loopState.loopStartTime,a=g.loopState.loopEndTime;e>=a&&g.setCurrentPlaytime(t),g.setLoop({loop:!0,loopStartTime:t,loopEndTime:a})}bt.mark("playback_start");const e=await G.play();if(!(null==e?void 0:e.success))throw new Error((null==e?void 0:e.message)||"Player playback failed");bt.mark("playback_end"),O.isPlaying=!0,g.isTonePlayerPlaying=!0,g.currentPlayingId=op,G.getCurrentTime&&g.syncCurrentTimeFromTransport(1e3*G.getCurrentTime());const t=g.getRecordingState();if(t.isRecording&&t.isPaused){g.resumeRecording().success}null==(o=null==(i=null==(l=nt)?void 0:l.MainManagerDispatcher)?void 0:i.setCurrentPlayState)||o.call(i,{isPlay:O.isPlaying,currentTime:g.currentTime}),g.loopState.loop||t.isRecording||(W||(W=Yu(g,()=>{O.isPlaying&&J()})),W.start()),ce()}}catch(u){if(q(),d){O.isPlaying=!1,g.isTonePlayerPlaying=!1,g.currentPlayingId===op&&(g.currentPlayingId=null);try{await G.pause()}catch(p){}de(),null==W||W.stop(),null==(c=null==(s=null==(r=nt)?void 0:r.MainManagerDispatcher)?void 0:s.setCurrentPlayState)||c.call(s,{isPlay:!1,currentTime:g.currentTime})}}finally{Z=!1}},$=()=>{var e,t,a;
1if(!G)return;const n=null==(t=null==(e=nt)?void 0:e.MainManagerDispatcher)?void 0:t.getFastForwardOrRewindTime({direction:Jt.FORWARD,stepType:Zt.SUBSIDIARY_RULAR_INSTANCE_TIME}),l=(null==n?void 0:n.stepTime)??4,i=(null==(a=m.state)?void 0:a.timing)||{},o=i.baseBpm||120,r=i.bpm||o,s="manual"===i.type?r/o:1,c=s>0?l/s:l,d=G.fastForward(c);if(!O.isPlaying&&d.success){const e=1e3*d.currentTime;g.syncCurrentTimeFromTransport(e,{preserveDisplayReferenceShift:!1}),se(e)}},ee=()=>{var e,t,a;if(!G)return;const n=null==(t=null==(e=nt)?void 0:e.MainManagerDispatcher)?void 0:t.getFastForwardOrRewindTime({direction:Jt.BACKWARD,stepType:Zt.SUBSIDIARY_RULAR_INSTANCE_TIME}),l=(null==n?void 0:n.stepTime)??4,i=(null==(a=m.state)?void 0:a.timing)||{},o=i.baseBpm||120,r=i.bpm||o,s="manual"===i.type?r/o:1,c=s>0?l/s:l,d=G.fastRewind(c);if(!O.isPlaying&&d.success){const e=1e3*d.currentTime;g.syncCurrentTimeFromTransport(e,{preserveDisplayReferenceShift:!1}),se(e)}},te=()=>{b.value||!g.loopState.loop&&g.isRecording||(g.toogleLoopState(),O.isPlaying&&(g.loopState.loop?W&&W.stop():(W||(W=Yu(g,()=>{O.isPlaying&&J()})),W.start())))},ae=()=>{var e,t;if(G&&!b.value)if(O.isMuted){G.updateMasterVolume(O.savedVolume).success&&(O.isMuted=!1)}else{try{O.savedVolume=(null==(t=null==(e=G.masterVolume)?void 0:e.volume)?void 0:t.value)??0}catch(a){O.savedVolume=0}G.updateMasterVolume(-1/0).success&&(O.isMuted=!0)}},ne=()=>{"preview"!==m.mode&&qt.toggle(!O.isMetronomeEnabled)},le=async()=>{var e,t,a,n,l,i,o,r,s,c,d,u;if(b.value)return;let p=null,v=null,h=null,f=g.getRecordInputObj();if(!f)return;const k=g.getRecordingState();if(k.isRecording||k.isPaused){O.isPlaying&&await J();const d=await g.stopRecording();if(!d.success)return;if(!d.blob)return;if(0===d.blob.size)return;if(!d.duration||d.duration<=0)return;const u=null==(e=nt)?void 0:e.MainManagerDispatcher;if((null==u?void 0:u.stopRecord)&&(v=A.value??0,p=u.stopRecord({recordingStartupDelayMs:d.transportStartTime?1e3*d.transportStartTime-v:0,actualDuration:d.duration}),void 0!==(null==p?void 0:p.startTime))){const e=(e=>{var t,a,n;const l=(null==(t=m.state)?void 0:t.timing)||{},i=null==(n=null==(a=nt)?void 0:a.MainManagerDispatcher)?void 0:n.FollowTrackTempoManager;return ea(e,l,D(),i)})(p.startTime),l=g.setCurrentPlaytime(e);(null==l?void 0:l.success)&&(null==(n=null==(a=null==(t=nt)?void 0:t.MainManagerDispatcher)?void 0:a.setCurrentPlayState)||n.call(a,{isPlay:!1,currentTime:e}))}if(A.value=null,x.value=null,!(null==p?void 0:p.srcPathKey))return;try{const e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),r=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0"),u=`New_Recording_${`${t}${a}${n}_${r}${s}${c}`}.wav`;let v;try{const e=new File([d.blob],"temp_recording.webm",{type:d.blob.type||"audio/webm"}),t=await Me.transFileToWav(e,u);v=new File([t.file],u,{type:"audio/wav"})}catch(w){return void((null==p?void 0:p.srcPathKey)&&(null==(o=null==(i=null==(l=nt)?void 0:l.MainManagerDispatcher)?void 0:i.deleteTemporaryformData)||o.call(i,{tempSrcPathKey:p.srcPathKey})))}try{const e=new(window.AudioContext||window.webkitAudioContext),t=await v.arrayBuffer(),a=await e.decodeAudioData(t);let n=!1;for(let l=0;l<a.numberOfChannels;l++){const e=a.getChannelData(l);for(let t=0;t<Math.min(1e3,e.length);t++)if(Math.abs(e[t])>.001){n=!0;break}if(n)break}Vt(p.srcPathKey,a),await e.close()}catch(C){}await y.processUploadByTempKey(p.srcPathKey,v,d.duration/1e3,async({pathKey:e})=>{var t,a,n,l,i,o,r,s,c,u,g,h,f,k;vt(p.srcPathKey,e);const b=await y.reportAudioResult({title:v.name,duration_milliseconds:d.duration,oss_key:e}),w=nt.MainManagerDispatcher.updateCreationIntentDataByOpType({updateClipDataType:mt.UPDATE_CREATION_INTENT_DATA_TO_TRACK,data:{clipDatas:[{clipId:p.clipId,srcPathKey:e,bpm:(null==(t=null==b?void 0:b.meta)?void 0:t.bpm)>0?b.meta.bpm:null,song_id:null==(l=null==(n=null==(a=null==b?void 0:b.feed)?void 0:a.songs)?void 0:n[0])?void 0:l.song_id,firstDownbeat:null==(i=null==b?void 0:b.meta)?void 0:i.firstDownbeat}]}});(null==(o=null==b?void 0:b.meta)?void 0:o.waveforms)&&nt.MainManagerDispatcher.setWaveformDataAfterUpload({tempSrcPathKey:p.srcPathKey,waveformData:null==(r=null==b?void 0:b.meta)?void 0:r.waveforms,clipData:{srcPathKey:e,songId:null==(u=null==(c=null==(s=null==b?void 0:b.feed)?void 0:s.songs)?void 0:c[0])?void 0:u.song_id,bpm:(null==(g=null==b?void 0:b.meta)?void 0:g.bpm)>0?b.meta.bpm:null,firstDownbeat:null==(h=null==b?void 0:b.meta)?void 0:h.firstDownbeat}}),w&&w.tracks&&lt.batchUpdate({tracks:null==(f=w.tracks)?void 0:f.map(e=>e.getTrackStateData())});const A=m.state.tracks.find(e=>e.id===p.trackId);if(A){const e=null==(k=A.clips)?void 0:k.find(e=>e.clipId===p.clipId);if(e){const t=e.startTime,a=e.srcClipEndTime-e.srcClipStartTime+e.startTime;nt.MainManagerDispatcher.setSelectionData({startTime:t,endTime:a,type:it.SELECTION,syncData:!0,focusedArea:kt.TIMELINE,focusedTrackId:p.trackId,trackIds:[p.trackId]})}}},({cancelled:e})=>{gt.removeClipCreationIntent({trackId:p.trackId,clipCreationIntentId:p.clipId})},!1)}catch(_){(null==p?void 0:p.srcPathKey)&&(null==(c=null==(s=null==(r=nt)?void 0:r.MainManagerDispatcher)?void 0:s.deleteTemporaryformData)||c.c
1all(s,{tempSrcPathKey:p.srcPathKey}))}}else{if(g.loopState.loop)return;if(!O.isPlaying&&(await J(),!O.isPlaying))return;W&&W.isActive()&&W.stop(),v=g.currentTime,h=B(v),A.value=v,x.value=h;const e=null==(d=nt)?void 0:d.MainManagerDispatcher;(null==e?void 0:e.startRecord)&&e.startRecord({trackId:f.trackId,startTime:h});if(!(await g.startRecording({...f,onTick:e=>{var t;const a=null==(t=nt)?void 0:t.MainManagerDispatcher;if(null==a?void 0:a.changeRecordingData){const t=B(g.currentTime),n=Math.max(0,t-(x.value??0));a.changeRecordingData({isRecording:!0,duration:n,trackId:f.trackId,livePeaks:e.livePeaks||[]})}}})).success){O.isPlaying&&await J();const e=null==(u=nt)?void 0:u.MainManagerDispatcher;(null==e?void 0:e.stopRecord)&&e.stopRecord()}}};i(()=>m.state.metronome.enabled,e=>{(e=>{if(!G)return;if(G.toggleMetronome(e).success){const e=G.getMetronomeState();O.isMetronomeEnabled=e.isEnabled}})(e)}),i(()=>m.state.globalVolume,e=>{O.masterVolume=e,G.updateMasterVolume(e)}),i(()=>m.state.timing.bpm,e=>{fe(e,!1),O.bpm=F.value,K()}),i(()=>m.state.timing.type,e=>{O.followTrack="follow-track"===e},{immediate:!0});const ie=e=>{O.currentTime=(e=>{if(null==e)return"00:00:000";const t=e<0?"-":"",a=Math.abs(e),n=Math.floor(a/1e3),l=Math.floor(n/60),i=n%60,o=Math.floor(a%1e3);return`${t}
1${String(l).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(o).padStart(3,"0")}`})(e)},oe=e=>{var t,a;const n=null==(a=null==(t=nt)?void 0:t.MainManagerDispatcher)?void 0:a.getDisplayBeatInfoByRelativeTime(e);O.currentBeats=(null==n?void 0:n.beatStr)||"001.1.1"};i(()=>g.displayTime,e=>{ie(e)},{immediate:!0}),i(()=>g.displayCanvasTime,e=>{oe(e)},{immediate:!0}),i(()=>g.currentPlayingId,async e=>{e&&e!==op&&O.isPlaying&&G&&(await G.pause(),O.isPlaying=!1,de())}),i(()=>g.tonePlayerControl,async e=>{if(e&&G)switch(e.command){case"play":O.isPlaying||await J();break;case"pause":O.isPlaying&&await J();break;case"toggle":await J();break;case"stop":await re()}});const re=async()=>{var e,t,a;if(!G)return;const n=D();await G.stop(),O.isPlaying=!1,g.isTonePlayerPlaying=!1,g.currentPlayingId===op&&(g.currentPlayingId=null),de();g.setCurrentPlaytime(0).success&&(null==(a=null==(t=null==(e=nt)?void 0:e.MainManagerDispatcher)?void 0:t.setCurrentPlaytime)||a.call(t,O.isPlaying,n,!1,n))},se=e=>{var t,a;if(null!==e)try{null==(a=null==(t=nt.MainManagerDispatcher)?void 0:t.setCurrentPlayState)||a.call(t,{isPlay:O.isPlaying,currentTime:e})}catch(n){}},ce=()=>{if(H)return;const e=()=>{H=requestAnimationFrame(e),(()=>{if(G&&G.getChannelVolumesNormalized){const e=G.getChannelVolumesNormalized();O.leftVolume=Math.round(e.leftDb),O.rightVolume=Math.round(e.rightDb)}})()};H=requestAnimationFrame(e)},de=()=>{H&&(cancelAnimationFrame(H),H=null),O.leftVolume=0,O.rightVolume=0},ue=()=>{F.value=O.bpm},pe=()=>{U.value&&U.value.hide()},ve=()=>{"manual"!==O.timing.type&&pt.setTimingType("manual"),fe(F.value,!0,!1)},me=()=>{"manual"!==O.timing.type&&pt.setTimingType("manual",{skipHistory:!0});const e=O.bpm;O.bpm=F.value,O.bpm!==e&&(O.followTrack=!1),g.setGlobalBpm(O.bpm,{syncBaseBpm:!1})},ge=na(()=>{me()},200),he=me,fe=(e,t=!0,a=!1)=>{let n=Number(e);return isNaN(n)&&(n=O.bpm),n=Math.max(10,Math.min(800,n)),n=Math.round(100*n)/100,F.value=n,t&&(a?ge():me()),n},ye=e=>{var t;if(e.defaultPrevented)return;const a=document.activeElement;if(a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||a.isContentEditable))return;const n=g.getRecordingState();if("Space"===e.code||" "===e.key){if(n.isRecording)return e.preventDefault(),e.stopPropagation(),void le();!(!(null==(t=g.getRecordInputObj)?void 0:t.call(g))||n.isPaused||g.loopState.loop||b.value)&&(e.preventDefault(),e.stopPropagation(),le())}};return _(async()=>{if("undefined"!=typeof window){S.learnStudioBtnHighlight=1!=localStorage.getItem(`mureka_${fa.appname}_studio_learn_opend_state`);try{G=await g.initializePlayer(),K(),ie(g.displayTime),oe(g.displayCanvasTime)}catch(e){}window.addEventListener("keydown",ye)}}),M(()=>{de(),window.removeEventListener("keydown",ye),ge.cancel(),W&&(W.destroy(),W=null);g.getRecordingState().isRecording&&g.forceCleanupRecording()}),t({setTempBPM:fe,getCurrentBPM:()=>O.bpm,isPlaying:()=>O.isPlaying,handleRecord:le}),(e,t)=>{const a=la;return r(),o(d,null,[s("div",zu,[u(a,{ref_key:"bpmPopoverRef",ref:U,placement:"bottom",width:270,trigger:"click","popper-class":"studio-bpm-popover",disabled:"preview"===v(m).mode,onShow:ue},{reference:p(()=>[s("div",{class:f(["studio-operations-bpm",{"is-disabled":"preview"===v(m).mode}])},[s("span",null,h(O.bpm),1),t[8]||(t[8]=s("span",null,"BPM",-1))],2)]),default:p(()=>[s("div",Xu,[s("div",{class:"bpm-popover-header"},[t[10]||(t[10]=s("span",{class:"bpm-popover-title"},"Tempo",-1)),s("div",{class:"bpm-popover-close",onClick:pe},[...t[9]||(t[9]=[s("img",{src:ca,alt:"close"},null,-1)])])]),s("div",Qu,[s("div",{class:"bpm-control-btn",onClick:t[0]||(t[0]=e=>("manual"!==O.timing.type&&pt.setTimingType("manual",{skipHistory:!0}),void fe(F.value-1,!0,!0)))},[...t[11]||(t[11]=[s("img",{src:"data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.16602%2010H15.8327'%20stroke='white'%20stroke-width='1.66667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"add"},null,-1)])]),s("div",qu,[P(s("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>F.value=e),type:"number",class:"bpm-input",min:"20",max:"300",step:"0.01",onBlur:ve,onKeyup:t[2]||(t[2]=Y((...e)=>v(he)&&v(he)(...e),["enter"]))},null,544),[[V,F.value,void 0,{number:!0}]])]),s("div",{class:"bpm-control-btn",onClick:t[3]||(t[3]=e=>("manual"!==O.timing.type&&pt.setTimingType("manual",{skipHistory:!0}),void fe(F.value+1,!0,!0)))},[...t[12]||(t[12]=[s("img",{src:"data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.99935%204.16663V15.8333M4.16602%209.99996H15.8327'%20stroke='white'%20stroke-width='1.66667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",alt:"add"},null,-1)])])])])]),_:1},8,["disabled"]),u(da,{content:O.isMetronomeEnabled?"Disable Metronome":"Enable Metronome",position:"bottom"},{default:p(()=>[s("div",{class:f(["studio-operations-metronome",{"is-disabled":b.value}]),onClick:ne}
1,[u(v(xe),{name:"biz-metronom",color:O.isMetronomeEnabled?"#48e1eb":void 0,opacity:O.isMetronomeEnabled?1:.4},null,8,["color","opacity"])],2)]),_:1},8,["content"]),s("div",Zu,[u(da,{content:N.value,position:"bottom"},{default:p(()=>[s("div",{class:f(["studio-operations-controls-tape",{active:v(g).isRecording,armed:j.value,"is-disabled":b.value,"armed-loop-disabled":j.value&&v(g).loopState.loop}]),onClick:le},[...t[13]||(t[13]=[s("div",{class:"tape-circle"},null,-1)])],2)]),_:1},8,["content"]),u(da,{content:"Fast Reverse",position:"bottom"},{default:p(()=>[s("div",{class:"studio-operations-controls-fast-rewind",onClick:ee},[u(v(Nu),{class:"fast-forward-icon"})])]),_:1}),u(da,{content:"Play/Pause (Space)",position:"bottom"},{default:p(()=>[s("div",{class:"studio-operations-controls-play-pause",onClick:J},[O.isPlaying?c("",!0):(r(),T(v(Gu),{key:0,class:"play-icon"})),O.isPlaying?(r(),T(v(Uu),{key:1,class:"pause-icon"})):c("",!0)])]),_:1}),u(da,{content:"Fast Forward",position:"bottom"},{default:p(()=>[s("div",{class:"studio-operations-controls-fast-forward",onClick:$},[u(v(Vu),{class:"fast-rewind-icon"})])]),_:1}),u(da,{content:"Loop",position:"bottom"},{default:p(()=>[s("div",{class:f(["studio-operations-controls-loop",{active:v(g).loopState.loop,"is-disabled":b.value,"loop-recording-disabled":v(g).isRecording}]),onClick:te},[u(v(xe),{name:"biz-music-loop",color:v(g).loopState.loop?"#AA80FF":"",opacity:v(g).loopState.loop?1:.4},null,8,["color","opacity"])],2)]),_:1}),u(da,{content:"Follow PlayHead",position:"bottom"},{default:p(()=>[s("div",{class:f(["studio-operations-controls-follow",{active:v(g).isFollowMode}]),onClick:Q},[u(v(xe),{name:"biz-layout-sidebar-right",color:v(g).isFollowMode?"#48e1eb":"",opacity:v(g).isFollowMode?1:.4},null,8,["color","opacity"])],2)]),_:1})]),s("div",{class:f(["studio-operations-time",{recording:v(g).isRecording}])},[s("span",null,h(O.currentTime),1)],2),s("div",Ju,[s("span",null,h(O.currentBeats),1)]),s("div",$u,[s("div",{class:f(["studio-operations-volume",{muted:O.isMuted,"is-disabled":b.value}]),onClick:ae},[u(v(Ku),{class:"volume-icon"})],2),s("div",{class:f(["studio-operations-volume-slider",{"is-disabled":b.value}])},[u(rc,{"decibel-value":{left:O.leftVolume,right:O.rightVolume},"initial-decibel":O.masterVolume,"is-playing":v(g).isPlaying(),"has-over-limit-track":v(m).hasTracksOverLimit,disabled:b.value,"current-decibel-background":"linear-gradient(90deg, rgba(255, 255, 255, 0.50) 0%, rgba(255, 255, 255, 0.00) 100%), #48e1eb",mode:"master",onDecibelChanging:z,onDecibelChangeEnd:X},null,8,["decibel-value","initial-decibel","is-playing","has-over-limit-track","disabled"])],2)]),s("div",ep,[s("div",tp,[s("div",ap,[u(v(Eu),{class:f(["icon magnet",{active:I.value}]),onClick:R},null,8,["class"])]),s("div",np,[u(v(Lu),{class:"icon",onClick:t[4]||(t[4]=e=>L(v(Qt).ZOOM_IN))})]),s("div",lp,[u(v(Bu),{class:"icon",onClick:t[5]||(t[5]=e=>L(v(Qt).ZOOM_OUT))})]),s("div",ip,[u(v(Su),{class:"icon",onClick:t[6]||(t[6]=e=>L(v(Qt).ZOOM_TO_FIT))})])])]),u(v(Ye),{class:f(["studio-learn",{"studio-learn-highlight":S.learnStudioBtnHighlight}]),type:"ghost",size:"small",onClick:E},{prefix:p(()=>[u(v(xe),{name:"biz-learn-fill",size:"16"})]),default:p(()=>[t[14]||(t[14]=s("span",null,"Learn",-1))]),_:1},8,["class"])]),S.learnStudioDialogVisible?(r(),T(Va,{key:0,visible:S.learnStudioDialogVisible,"onUpdate:visible":t[7]||(t[7]=e=>S.learnStudioDialogVisible=e)},null,8,["visible"])):c("",!0)],64)}}},[["__scopeId","data-v-03ff1491"]]),sp={class:"top-bar"},cp={class:"studio-logo flex-row-center"},dp=Te({__name:"TopBar",setup(e,{expose:t}){var n;const{$$t:l}=(null==(n=w().appContext)?void 0:n.config.globalProperties.$i18n)??{},i=a(null);return t({operationsRef:i}),(e,t)=>(r(),o("div",sp,[s("div",cp,[t[0]||(t[0]=s("span",null,"Mureka Studio",-1)),u(v(Ne),{preset:"beta"})]),u(rp,{ref_key:"operationsRef",ref:i},null,512)]))}},[["__scopeId","data-v-27c448e1"]]),up={class:"stems-dialog-content"},pp=["onClick"],vp={class:"stems-dialog-card-icon"},mp=["src"],gp={class:"stems-dialog-card-title"},hp=Te({__name:"stems-dialog",props:{visible:{type:Boolean,default:!1}},emits:["close","import"],setup(e,{emit:t}){const n=We(),{createRenderType:l}=S(n),c=e,u=a(!1);i(()=>c.visible,e=>{u.value=e},{immediate:!0});const m=t,f=()=>{u.value=!1,m("close")},y=a([{id:1,icon:"data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.6699%202.03809C26.9847%201.95269%2027.3237%202.01277%2027.585%202.2002C27.8462%202.38767%2027.9999%202.68098%2028%202.99219V21.584C28%2023.356%2026.7645%2024.9135%2024.9727%2025.4004L23.1357%2025.8994C20.8669%2026.51
156%2018.6084%2024.8951%2018.6084%2022.6514C18.6086%2021.1436%2019.6599%2019.8185%2021.1846%2019.4043L24.3994%2018.5312C25.2952%2018.2878%2025.913%2017.5089%2025.9131%2016.623V9.26855L13.3916%2012.6709V25.5527C13.3916%2027.3247%2012.156%2028.8822%2010.3643%2029.3691L8.52734%2029.8682C6.25862%2030.4844%204.00029%2028.8647%204%2026.6211C4%2025.1132%205.0514%2023.7873%206.57617%2023.373L9.79102%2022.5C10.6868%2022.2565%2011.3047%2021.4777%2011.3047%2020.5918V6.96094C11.3049%206.51807%2011.6137%206.12851%2012.0615%206.00684L26.6699%202.03809Z'%20fill='url(%23paint0_linear_8216_1513421)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_8216_1513421'%20x1='16'%20y1='10.5'%20x2='16'%20y2='28.9999'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='%2348e1eb'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",title:"Full Song",type:"full"},{id:2,icon:"data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2013.3333L4%2018.6667M10%2014.6667V17.3333M16%208V24M22%204V28M28%2013.3333V18.6667'%20stroke='url(%23paint0_linear_8216_1513397)'%20stroke-width='2.66667'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_8216_1513397'%20x1='7.13627'%20y1='26.0732'%20x2='28'%20y2='4'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='%2348e1eb'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",title:"Full Song + Stems",type:"stems"}]);return(e,t)=>(r(),T(Pe,{customClass:`${v(l)}-stems-dialog`,mobileRenderType:"mobile"==v(l)?"drawerDialog":"",width:"732px",title:"Choose what to import",visible:u.value,titleAlign:"left",onClose:f},{default:p(()=>[s("div",up,[(r(!0),o(d,null,g(y.value,e=>(r(),o("div",{class:"stems-dialog-card",key:e.id,onClick:t=>(e=>{m("import",e),f()})(e)},[s("div",vp,[s("img",{src:e.icon},null,8,mp)]),s("div",gp,h(e.title),1),t[0]||(t[0]=s("button",{class:"stems-dialog-card-button"},"Import",-1))],8,pp))),128))])]),_:1},8,["customClass","mobileRenderType","visible"]))}},[["__scopeId","data-v-eab6e29b"]]),fp={class:"height-all",style:{"overflow-y":"hidden"}},yp=320,kp="studio-library-width",bp="studio-library-expanded-width",wp="studio-lottie-shown",Ap=Te({__name:"index",setup(e){var t;const n=rt(),c=Pi(),d=wn(),p=Oc(),m=ot(),g=ut(),h=Re(),k=A(),b=null==(t=w())?void 0:t.appContext.config.globalProperties,{$$tm:C}=(null==b?void 0:b.$i18n)??{};z({title:C("seo.studio_title"),meta:[{name:"description",content:C("seo.studio_desc")}]});const T=l(()=>{var e,t,a,n;return(null==(t=null==(e=h.userInfo)?void 0:e.user)?void 0:t.is_vip)&&"basic"!==(null==(n=null==(a=h.userInfo)?void 0:a.user)?void 0:n.vip_level_name)});i(T,e=>{e||ta()});const x=a(yp),D=a(!1),{rightPanelVisible:M}=S(p),R=a(null),B=a(!1),j=a(null);X("libraryWidth",x),X("libraryMinWidth",yp),X("COLLAPSED_WIDTH",96),X("rightPanelVisible",M),X("MIN_DRAG_WIDTH",240);let N=null,O=yp,V=yp;const F=e=>{D.value=!0;const t=e.clientX,a=x.value,n=e=>{const n=e.clientX-t,l=Math.max(240,Math.min(800,a+n));O=l,null===N&&(N=requestAnimationFrame(()=>{x.value=O,N=null}))},l=()=>{D.value=!1,null!==N&&(cancelAnimationFrame(N),N=null),x.value=O,localStorage.setItem(kp,O.toString()),O>=yp&&(V=O,localStorage.setItem(bp,O.toString())),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",l)},U=e=>{e?(x.value=V,localStorage.setItem(kp,V.toString())):(x.value>=yp&&(V=x.value,localStorage.setItem(bp,x.value.toString())),x.value=96,localStorage.setItem(kp,96..toString()))},H=()=>{M.value=!0},G=(e,t)=>{var a,n,l,i,o;const r=null==(a=nt.MainManagerDispatcher)?void 0:a.updateCreationIntentDataByOpType({updateClipDataType:mt.ADD_UPLOAD_CLIP_INTENT_DATA,data:{trackId:t,clipData:e}});return r&&lt.batchUpdate({tracks:null==(n=r.tracks)?void 0:n.map(e=>e.getTrackStateData())}),null==(o=null==(i=null==(l=null==r?void 0:r.tracks)?void 0:l[0])?void 0:i.trackData)?void 0:o.id},W=async e=>{var t;const a=null==(t=nt.MainManagerDispatcher)?void 0:t.getPointerInfo({x:e.position.x,y:e.position.y},{autoSnapEnabled:!0});let n=a.time;if(d.isFirstAudioInProject()){if(!e.clipData.bpm){const t=ze.info({content:"Analyzing...",position:"center"}),a=await _e({song_id:e.clipData.songId});
1a&&200===a.code&&(e.clipData.bpm=a.data.meta.bpm,e.clipData.first_downbeat=a.data.meta.first_downbeat),t.clear()}e.clipData.bpm&&(d.setBaseBpmIfNeeded(e.clipData.bpm),n=0-(e.clipData.first_downbeat??0))}const l=ae(),i={...ie,bpm:e.clipData.bpm,firstDownbeat:e.clipData.first_downbeat,clipId:l,name:e.clipData.title||"New Clip",srcPathKey:e.clipData.mp3_url,startTime:n,srcDuration:e.clipData.duration_milliseconds,srcClipStartTime:e.clipData.srcClipStartTime||0,srcClipEndTime:e.clipData.srcClipEndTime||e.clipData.duration_milliseconds,songId:e.clipData.song_id,...e.clipData.color&&{color:e.clipData.color}};if(i.wrap={awaitingAnalysis:!0,enabled:!0,speed:1},e.clipData.stems&&e.clipData.stems.length>0)return j.value={dropData:e,trackInfo:a,clip:i,clipId:l},void(B.value=!0);await Q(i,l,a)},K=()=>{B.value=!1,j.value=null},Y=async e=>{var t,a,n;if(!j.value)return;const{dropData:l,trackInfo:i,clip:o,clipId:r}=j.value;if(B.value=!1,"full"===e.type)await Q(o,r,i);else if("stems"===e.type){const e=[];e.push({...o,clipId:r}),l.clipData.stems&&Array.isArray(l.clipData.stems)&&l.clipData.stems.forEach(t=>{const a=ae(),n={...o,clipId:a,name:Ca[t.stem_name].type,srcPathKey:t.oss_key,color:null};e.push(n)});const s=null==(n=nt.MainManagerDispatcher)?void 0:n.pasteCopiedSelectionToTracks({tracks:e.map(e=>({clips:[e]})),startTime:i.time},{startTime:i.time,startTrackId:i.trackId,trackType:null==(a=null==(t=i.track)?void 0:t.extendData)?void 0:a.trackType},!0);s&&s.tracks&&(lt.batchUpdate({tracks:s.tracks}),o.songId&&(Oe.doReportPlayedState({song_id:o.songId}).catch(e=>{}),g.updateItemInfo(o.songId,{is_played:!0})))}j.value=null},Q=async(e,t,a)=>{var l,i,o,r,s,c,u;if(e.bpm)g.updateItemInfo(e.songId,{bpm:e.bpm}),((e,t)=>{var a,l,i,o,r,s;const{trackId:c}=t;let u=null,p=c||(null==(l=null==(a=t.track)?void 0:a.trackData)?void 0:l.id);if(c)for(const d of n.state.tracks){if(d.id===c){u=d;break}if(d.takeLanes&&d.takeLanes.length>0){const e=d.takeLanes.find(e=>e.id===c);if(e){u=e;break}}}if(u){Object.assign(e,{color:u.color});const a={endTime:e.startTime+e.srcDuration*((e.bpm||n.state.timing.baseBpm)/n.state.timing.baseBpm),startTime:e.startTime,tracks:[{...u,clips:[e]}]},l=null==(r=nt.MainManagerDispatcher)?void 0:r.pasteCopiedSelectionToTracks(a,{startTime:e.startTime,startTrackId:c,trackType:null==(o=null==(i=t.track)?void 0:i.extendData)?void 0:o.trackType},!1);lt.batchUpdate({tracks:l.tracks})}else{const t=d.addTrack({name:e.name,clips:[e]},!1,!0);if(p=null==t?void 0:t.id,p&&e){const t=e.startTime||0,a=(e.srcClipEndTime||e.srcDuration||0)-(e.srcClipStartTime||0);let l=a;const i=n.state.timing.baseBpm||120;l=a*((e.bpm||i)/i);const o=t+l;null==(s=nt.MainManagerDispatcher)||s.setSelectionData({startTime:t,endTime:o,type:it.SELECTION,focusedArea:kt.TIMELINE,focusedTrackId:p,trackIds:[p],syncData:!0})}}})(e,a),e.songId&&(Oe.doReportPlayedState({song_id:e.songId}).catch(e=>{}),g.updateItemInfo(e.songId,{is_played:!0}));else{e.bpm=null;const v=G(e,a.trackId);try{const a=await _e({song_id:e.songId});if(a&&200===a.code){const r=a.data.bpm||n.state.timing.baseBpm;d.setBaseBpmIfNeeded(r),g.updateItemInfo(e.songId,{bpm:r,firstDownbeat:null==(l=a.data)?void 0:l.first_downbeat});const s=null==(i=nt.MainManagerDispatcher)?void 0:i.updateCreationIntentDataByOpType({updateClipDataType:mt.UPDATE_CREATION_INTENT_DATA_TO_TRACK,data:{clipDatas:[{srcPathKey:e.srcPathKey,bpm:r,clipId:t,songId:e.songId}]}});s&&s.tracks&&(lt.batchUpdate({tracks:null==(o=s.tracks)?void 0:o.map(e=>e.getTrackStateData())}),e.songId&&(Oe.doReportPlayedState({song_id:e.songId}).catch(e=>{}),g.updateItemInfo(e.songId,{is_played:!0})))}else{const t=null==(r=nt.MainManagerDispatcher)?void 0:r.updateCreationIntentDataByOpType({updateClipDataType:mt.DELETE_UPLOAD_CLIP_INTENT_DATA,data:{trackId:v,clipData:e}});t&&t.tracks&&lt.batchUpdate({tracks:null==(s=t.tracks)?void 0:s.map(e=>e.getTrackStateData())})}}catch(p){const t=null==(c=nt.MainManagerDispatcher)?void 0:c.updateCreationIntentDataByOpType({updateClipDataType:mt.DELETE_UPLOAD_CLIP_INTENT_DATA,data:{trackId:v,clipData:e}});t&&t.tracks&&lt.batchUpdate({tracks:null==(u=t.tracks)?void 0:u.map(e=>e.getTrackStateData())})}}},q=async e=>{var t;let a=null;try{const l=await d.validateFile(e.file),{file:i,duration:o}=l,r=null==(t=nt.MainManagerDispatcher)?void 0:t.getPointerInfo({x:e.position.x,y:e.position.y},{autoSnapEnabled:!0}),s=ae(),c=`uploading_${ae()}
1`,u=d.secondsToMs(o),p=r.time,v={...ie,clipId:s,name:i.name,srcPathKey:c,srcDuration:u,startTime:p,srcClipStartTime:0,srcClipEndTime:u};let m=r.trackId;if(d.isFirstAudioInProject()?a=ze.info({content:"Analyzing...",position:"center"}):m=G(v,r.trackId),!m)return void(null==a||a.clear());try{await d.processFileAndUpload({file:i,tempSrcPathKey:c,initialDuration:o,trackTimeMs:p,trackId:m,clipCreationIntentId:s,clip:v,addToLibrary:!0,closeMsg:a})}catch(n){null==a||a.clear()}}catch(n){null==a||a.clear()}},Z=e=>{e.preventDefault()},J=e=>{e.preventDefault()},$=e=>{e.preventDefault()},te=a(null),ne=a(!0);let le=null;const oe=()=>{var e;le&&(le.destroy(),le=null);const t=null==(e=te.value)?void 0:e.querySelector(".lottie-container");t&&t.remove(),ne.value=!1};i([()=>m.isAnimationFinished,()=>m.isNewbieGuideOpen],([e,t])=>{t?oe():e&&E(()=>{(()=>{if(localStorage.getItem(wp))return void(ne.value=!1);if(m.isNewbieGuideOpen)return;if(!te.value)return;if(1===n.state.tracks.length&&n.state.tracks[0].clips.length||n.state.tracks.length>1)return;oe(),ne.value=!0;const e=document.createElement("div");e.className="lottie-container",te.value.appendChild(e),le=ee.loadAnimation({container:e,renderer:"svg",loop:!1,autoplay:!0,animationData:pn});let t=0;le.addEventListener("complete",()=>{t++,t<2?le.goToAndPlay(0):(localStorage.setItem(wp,"true"),oe())})})()})},{immediate:!0});return _(async()=>{if(!h.isLogin||!T.value)return ta(),void k.replace({name:"dawlandingpage"});aa(),((e,t)=>{var a,n,l;const i=null==(l=null==(n=(w()||(null==(a=null==window?void 0:window.$getVueCurrentInstance)?void 0:a.call(window))).appContext)?void 0:n.config)?void 0:l.globalProperties;null==i||i.logCustomEvent(e,{...t})})("studio_page_show"),m.resetFirstSync(),bt.start({scene:null}),c.checkAndCreateProject();const e=localStorage.getItem(bp);if(e){const t=parseInt(e,10);t>=yp&&t<=800&&(V=t)}const t=localStorage.getItem(kp);if(t){const e=parseInt(t,10);e>=96&&e<=800&&(x.value=e,O=e,e>=yp&&(V=e))}else O=x.value;dn({stores:{studio:n,player:m},getOperations:()=>{var e;return null==(e=R.value)?void 0:e.operationsRef}},{debug:!1}),window.addEventListener("dragenter",Z,!0),window.addEventListener("dragover",J,!0),window.addEventListener("drop",$,!0)}),I(()=>{var e;ta(),un(),window.removeEventListener("dragenter",Z,!0),window.removeEventListener("dragover",J,!0),window.removeEventListener("drop",$,!0);try{const t=m.getPlayerInstance();t&&(m.clearAllTracks(),null==(e=t.cleanup)||e.call(t)),m.clearAllAudioCache(),m.cleanupRescheduleTimer()}catch(t){}}),(e,t)=>(r(),o("div",fp,[u(dp,{ref_key:"topBarRef",ref:R},null,512),s("div",{ref_key:"studioBodyRef",ref:te,class:f(["studio-body",{"is-dragging":D.value,"right-panel-hidden":!v(M)}]),style:y({"--library-width":`${x.value}px`})},[u(pl,{onExpandLibrary:U}),s("div",{class:"drag-line",onMousedown:F},null,32),u(ed,{onClipDropped:W,onFileDropped:q,onCollapseClipPanel:H}),P(u(Du,null,null,512),[[L,v(M)]]),u(hp,{visible:B.value,onClose:K,onImport:Y},null,8,["visible"])],6)]))}},[["__scopeId","data-v-042dbfa7"]]);export{Ap as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.