import{d as f,F as y,V as h,bt as n,M as w,U as r,ao as v,j as i,aJ as b,A as T,aq as _}from"./index-2725ae47.js";import{s as L}from"./instrument-60f12b66.js";import"./vue3-lottie.es-890c3e19.js";import"./index-a20d6e07.js";import"./index-3f47bef0.js";import"./index-4ec119ad.js";const x="_skeleton_vtlsh_1",S="_detail_vtlsh_12",A="_container_vtlsh_20",c={skeleton:x,detail:S,container:A},V=f({name:"music-list",setup(){const d=y(),e=h({isLoading:!0,isProductLoading:!1,step:0,product:[{state:!1,name:"五线谱",type:n.staff,base64:""},{state:!1,name:"首调",type:n.firstTone,base64:""},{state:!1,name:"固定调",type:n.fixedTone,base64:""}]});w(()=>{window.appName="colexiu",r.xmlUrl=d.xmlUrl,r.musicRenderType=e.product[e.step].type,v({message:"生成中",duration:0}),setTimeout(()=>{e.isLoading=!1},500)});const l=async()=>{var t;e.product[e.step].state=!0,e.product[e.step].base64=await u();try{console.log(JSON.parse(JSON.stringify(e.product)),e.step)}catch(o){}if(e.step+=1,e.step!==e.product.length){r.musicRenderType=e.product[e.step].type,T(()=>{e.isLoading=!0,setTimeout(()=>{e.isLoading=!1},500)});return}_(),console.log(e.product),(t=window.parent)==null||t.postMessage({api:"webApi_renderSvg",product:JSON.stringify(e.product)},"*")},u=()=>new Promise(t=>{setTimeout(async()=>{var o;try{const s=(o=document.getElementById("osmdSvgPage1"))==null?void 0:o.cloneNode(!0);if(!s){t("");return}const p=s.width.animVal.value,m=s.height.animVal.value,a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("width",`${p*2}`),a.setAttribute("height",`${m*2}`),a.setAttribute("fill","#fff"),s.prepend(a);const g=L(s.outerHTML).toDataURL("image/png",1);t(g)}catch(s){t("")}},500)});return()=>i("div",{class:c.detail},[i("div",{id:"scrollContainer",class:[c.container,"hideCursor"]},[!e.isLoading&&i(b,{showSelection:!1,onRendered:l},null)])])}});export{V as default};