Files
2021-10-07 16:31:51 +08:00

2 lines
52 KiB
JavaScript

(this["webpackJsonpnumerical-notation-editor"]=this["webpackJsonpnumerical-notation-editor"]||[]).push([[0],{114:function(e,t,n){e.exports={headerWrapper:"Editor_headerWrapper__2rEBR",header:"Editor_header__2Qcr4",container:"Editor_container__3rhfS"}},143:function(e,t,n){e.exports={svg:"Canvas_svg__2w1z4"}},146:function(e,t,n){e.exports={selectedNotation:"Notation_selectedNotation__3wsjJ"}},228:function(e,t,n){},229:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(21),a=n.n(i),c=(n(157),n(235)),s=n(44),l=n(247),u=n(248),d=n(249),f=n(250),h=n(251),p=n(32),b=n(13),j=Object(b.f)({selectedNotationKey:null,lastSelectedNotationKey:null,shouldNotationBlurAfterClick:!0,tieSourceKey:null,helpDialogVisible:!1,configDialogVisible:!1,clipboardContent:null}),v=[],g=-1;function x(e,t){var n=new Set;function r(e){return"object"===typeof e&&null!==e&&![Promise,Map,Set,WeakMap,WeakSet].some((function(t){return e instanceof t}))}return function e(t,o){if(!r(t)||!r(o))return t===o;if(t===o)return!0;if(n.has(t)||n.has(o))return!1;n.add(t),n.add(o);var i=Object.keys(t),a=Object.keys(o);return i.length===a.length&&i.every((function(n){return e(t[n],o[n])}))}(e,t)}function m(e){var t=Math.min(Math.max(0,g+e),v.length-1);t!==g&&(g=t,Object.assign($,v[t]))}function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.apply(this,n);var o=Object(b.i)($);x(v[g],o)||(v[++g]=o,v.length=g+1,v.length>256&&v.splice(0,256-v.length))}function y(){var e,t;"function"===typeof(arguments.length<=0?void 0:arguments[0])?t=arguments.length<=0?void 0:arguments[0]:(e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1]);var n=[e,O.bind(this,t)];return void 0===e&&n.shift(),b.b.apply(this,n)}function k(e){var t=this;Object(b.h)((function(){O.call(t,e)}))}var w=b.b,C=(b.h,n(149)),S="0",N="\u2500",T="\u2502",P="(",E=")",I=[S,"1","2","3","4","5","6","7"];function A(e){return I.includes((null===e||void 0===e?void 0:e.note)||e)}function _(e){var t={type:"notation",key:"n_".concat(String(Math.random())),note:"0",octave:0,dotted:!1,underline:0,breakUnderline:!1,prefixSups:[],topDecorators:[],tieTo:null};return e&&Object.assign(t,e),t}function H(e){var t=JSON.parse(JSON.stringify(Object(b.i)(e)));return delete t.key,_(t)}var D=y((function(e){if(j.tieSourceKey){if(j.tieSourceKey===e.key)return void(j.tieSourceKey=null);var t=L(j.tieSourceKey),n=t.notation,r=t.paragraph;if(!n)return void(j.tieSourceKey=null);r.notations.includes(e)?A(e)?(n.tieTo=e.key,e.tieTo=n.key):C.b.warn("\u53ea\u5141\u8bb8\u5728\u97f3\u7b26\u4e0a\u6dfb\u52a0\u8fde\u97f3\u7ebf\uff01"):C.b.warn("\u53ea\u5141\u8bb8\u76f8\u540c\u6bb5\u843d\u7684\u97f3\u7b26\u76f8\u8fde\uff01"),j.tieSourceKey=null}}));function B(e){var t={type:"paragraph",key:"p_".concat(String(Math.random())),notations:[],alignJustify:null};return e&&Object.assign(t,e),t}function M(){return B({notations:[_({note:"0"}),_({note:"0"}),_({note:"0"}),_({note:"0"}),_({note:T})]})}var W={version:1,canvasWidth:896,canvasHeight:1024,defaultFontSize:16,defaultSubFontSize:12,title:"\u65e0\u6807\u9898",tone:"C",marginHorizontal:64,marginTop:32,gapAfterTitle:16,gapAfterHeader:32,gapBetweenParagraph:32,gapBetweenNotation:16,beat:[4,4],speed:75,authors:["\u4f5a\u540d \u4f5c\u8bcd","\u7b80\u8c31\u7f16\u8f91\u5668 \u5236\u8c31"],notations:[]};function K(){return JSON.parse(JSON.stringify(W))}function F(){var e=K();return e.paragraphs=[M()],e}function L(e){var t={};return($.paragraphs||[]).some((function(n,r){var o=(n.notations||[]).findIndex((function(t){return t.key===e}));return-1!==o&&(t.notation=n.notations[o],t.notationIndex=o,t.paragraph=n,t.paragraphIndex=r,!0)})),t}var V,z,R,Y,U,X=w((function(e){e||(e=F()),j.lastSelectedNotationKey=j.selectedNotationKey=j.tieSourceKey=null,v.length=0,g=-1,Object(b.j)((function(){for(var t=0,n=Object.keys($);t<n.length;t++){var r=n[t];Object(b.g)($,r)}Object.assign($,e)}))})),J=Object(b.f)(F()),G=o.a.createContext(J),$=J,q=n(11);function Z(e,t){return function(e){V||(V=document.createElement("canvas"),z=V.getContext("2d"),R=window.getComputedStyle(document.body).fontFamily),z.font="".concat(e||$.defaultFontSize,"px ").concat(R)}(e),z.measureText(t).width}function Q(e,t){return Y||(Y=document.createElementNS("http://www.w3.org/2000/svg","svg"),(U=document.createElementNS("http://www.w3.org/2000/svg","text")).style.visibility="hidden",Y.appendChild(U),document.body.appendChild(Y)),U.style.fontSize=e+"px",U.textContent=t,U.getBBox()}function ee(e){var t=(null===e||void 0===e?void 0:e.notations)||[];return t.some((function(e,n){return e.tieTo&&t.findIndex((function(t){return t.key===e.tieTo}))>n}))}var te=Object(b.f)({get maxContentWidth(){return Math.max($.canvasWidth-2*$.marginHorizontal,0)},get minTieHeight(){return 8},get maxTieHeight(){return 20},get maxTieBezierOffset(){return 25},get underlineStepOffsetY(){return 3},get underlineInitialOffsetY(){return this.xHeight/2-3},get octaveStepOffsetY(){return 5},get octaveInitialOffsetAbove(){return te.xHeight/2+2},get octaveInitialOffsetBelow(){return te.xHeight/2-2},get titleOffsetY(){return $.marginTop+32+$.gapAfterTitle},get headerOffsetY(){var e=2*this.xHeight,t=this.titleOffsetY,n=t+e,r=t+this.xHeight*$.authors.length;return Math.max(t,n,r)+$.gapAfterHeader},get baseFontData(){var e=Q($.defaultFontSize,"x");return{xWidth:e.width,xHeight:e.height}},get baseSubFontData(){var e=Q($.defaultSubFontSize,"x");return{xWidth:e.width,xHeight:e.height}},get xHeight(){return this.baseFontData.xHeight},get xWidth(){return this.baseFontData.xWidth},get subXHeight(){return this.baseSubFontData.xHeight},get subXWidth(){return this.baseSubFontData.xWidth}}),ne=Z.bind(null,$.defaultFontSize),re=Z.bind(null,$.defaultSubFontSize);function oe(e){var t=e.notations||[];if(0===t.length)return te.xHeight;ee(e);var n=t.map((function(e){return function(e){var t,n,r,o,i=[0],a=te.xHeight/2,c=-te.xHeight/2;i.push(a,c);var s=0|e.octave,l=e.underline>0?te.underlineInitialOffsetY+te.underlineStepOffsetY*(0|e.underline):0;i.push(l);var u=e.octave>0?-te.octaveInitialOffsetAbove:te.octaveInitialOffsetBelow+l;r=s>0?u-5*Math.abs(s):s<0?u+5*Math.abs(s):0;i.push(r),o=(null===(t=e.prefixSups)||void 0===t?void 0:t.length)?te.subXHeight-4:0,i.push(o);var d=0;e.octave>0&&(d=te.octaveInitialOffsetAbove-te.octaveStepOffsetY*e.octave);var f=d-te.subXHeight*(0|(null===(n=e.topDecorators)||void 0===n?void 0:n.length))-2;i.push(f);var h=Math.max.apply(Math,i),p=Math.min.apply(Math,i);return h-p}(e)})),r=t.map((function(e){return ce(e)})),o=n.map((function(e,t){return e-r[t]}));return 0+(Math.max.apply(Math,Object(q.a)(o))+Math.max.apply(Math,Object(q.a)(r)))}function ie(e){var t=e.notations||[];if(0===t.length)return te.xHeight/2;return ee(e),t.map((function(e){return ce(e)})).reduce((function(e,t){return Math.max(e,t)}),te.xHeight/2)+0}function ae(e){var t=e.prefixSups||[];return re(t.join(""))+2*t.length}function ce(e){var t,n=[0],r=te.xHeight/2;n.push(r);var o=0;e.octave>0&&(o=te.octaveInitialOffsetAbove+te.octaveStepOffsetY*Math.abs(e.octave)),n.push(o);var i=o+te.subXHeight*(0|(null===(t=e.topDecorators)||void 0===t?void 0:t.length))-2;return n.push(i),Math.max.apply(Math,n)}function se(e){var t=ne(e.note)+$.gapBetweenNotation;return ae(e)+t+(e.dotted?8:0)}var le=te,ue=n(236),de=n(237),fe=n(238),he=n(239),pe=n(240),be=n(241),je=n(242),ve=n(233),ge={1:0,2:2,3:4,4:5,5:7,6:9,7:11},xe={0:1,1:1,2:2,3:2,4:3,5:4,6:4,7:5,8:5,9:6,10:7,11:7},me={"\u266d":-1,"\u266f":1},Oe={1:"\u266f",3:"\u266f",6:"\u266f",8:"\u266f",10:"\u266d"},ye={C:0,D:2,E:4,F:5,G:7,A:9,B:11},ke=y((function(e){e|=0,$.paragraphs.forEach((function(t){t.notations.forEach((function(t){if(A(t)&&S!==((null===(r=t)||void 0===r?void 0:r.note)||r)){t.octave+=Math.trunc(e/12);var n=ge[t.note]+e%12+(t.prefixSups||[]).reduce((function(e,t){return e+(0|me[t])}),0);n>=12?(t.octave+=1,n-=12):n<0&&(t.octave-=1,n+=12),t.note=String(xe[n]),t.prefixSups=(t.prefixSups||[]).filter((function(e){return"\u266f"!==e&&"\u266d"!==e})),Oe[n]&&t.prefixSups.unshift(Oe[n])}var r}))}))})),we=y((function(e){var t=-(ye[e.split("").at(-1)]-ye[$.tone.split("").at(-1)]);(e.startsWith("\u266d")||$.tone.startsWith("\u266f"))&&(t-=1),(e.startsWith("\u266f")||$.tone.startsWith("\u266d"))&&(t+=1),ke(t),$.tone=e})),Ce=n(24),Se=n.n(Ce),Ne=n(41),Te=function(){return{escape:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:e,mimeType:function(t){var n=e(t).toLowerCase();return function(){var e="application/font-woff",t="image/jpeg";return{woff:e,woff2:e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:t,jpeg:t,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}()[n]||""},dataAsUrl:function(e,t){return"data:"+t+";base64,"+e},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):function(e){return new Promise((function(t){for(var n=window.atob(e.toDataURL().split(",")[1]),r=n.length,o=new Uint8Array(r),i=0;i<r;i++)o[i]=n.charCodeAt(i);t(new Blob([o],{type:"image/png"}))}))}(e)},resolveUrl:function(e,t){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var o=n.createElement("a");return n.body.appendChild(o),r.href=t,o.href=e,o.href},getAndEncode:function(e){var t=3e4;He.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,o=new XMLHttpRequest;if(o.onreadystatechange=a,o.ontimeout=c,o.responseType="blob",o.timeout=t,o.open("GET",e,!0),o.send(),He.impl.options.imagePlaceholder){var i=He.impl.options.imagePlaceholder.split(/,/);i&&i[1]&&(r=i[1])}function a(){if(4===o.readyState)if(200===o.status){var t=new FileReader;t.onloadend=function(){var e=t.result.split(/,/)[1];n(e)},t.readAsDataURL(o.response)}else r?n(r):s("cannot fetch resource: "+e+", status: "+o.status)}function c(){r?n(r):s("timeout of "+t+"ms occured while fetching resource: "+e)}function s(e){console.error(e),n("")}}))},uid:function(){var e=0;return function(){return"u"+t()+e++;function t(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}}(),delay:function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},asArray:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t},escapeXhtml:function(e){return e.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=n,r.src=e}))},width:function(e){var n=t(e,"border-left-width"),r=t(e,"border-right-width");return e.scrollWidth+n+r},height:function(e){var n=t(e,"border-top-width"),r=t(e,"border-bottom-width");return e.scrollHeight+n+r}};function e(e){var t=/\.([^\.\/]*?)$/g.exec(e);return t?t[1]:""}function t(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}}(),Pe=function(){var e=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(e,o,i){return a()?Promise.resolve(e):Promise.resolve(e).then(n).then((function(t){var n=Promise.resolve(e);return t.forEach((function(e){n=n.then((function(t){return r(t,e,o,i)}))})),n}));function a(){return!t(e)}},shouldProcess:t,impl:{readUrls:n,inline:r}};function t(t){return-1!==t.search(e)}function n(t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n[1]);return r.filter((function(e){return!Te.isDataUrl(e)}))}function r(e,t,n,r){return Promise.resolve(t).then((function(e){return n?Te.resolveUrl(e,n):e})).then(r||Te.getAndEncode).then((function(e){return Te.dataAsUrl(e,Te.mimeType(t))})).then((function(n){return e.replace(function(e){return new RegExp("(url\\(['\"]?)("+Te.escape(e)+")(['\"]?\\))","g")}(t),"$1"+n+"$3")}))}}(),Ee=function(){return{resolveAll:function(){return e(document).then((function(e){return Promise.all(e.map((function(e){return e.resolve()})))})).then((function(e){return e.join("\n")}))},impl:{readAll:e}};function e(){return Promise.resolve(Te.asArray(document.styleSheets)).then((function(e){var t=[];return e.forEach((function(e){try{Te.asArray(e.cssRules||[]).forEach(t.push.bind(t))}catch(n){console.log("Error while reading CSS rules from "+e.href,n.toString())}})),t})).then((function(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return Pe.shouldProcess(e.style.getPropertyValue("src"))}))})).then((function(t){return t.map(e)}));function e(e){return{resolve:function(){var t=(e.parentStyleSheet||{}).href;return Pe.inlineAll(e.cssText,t)},src:function(){return e.style.getPropertyValue("src")}}}}}(),Ie=function(){return{inlineAll:function t(n){return n instanceof Element?r(n).then((function(){return n instanceof HTMLImageElement?e(n).inline():Promise.all(Te.asArray(n.childNodes).map((function(e){return t(e)})))})):Promise.resolve(n);function r(e){var t=e.style.getPropertyValue("background");return t?Pe.inlineAll(t).then((function(t){e.style.setProperty("background",t,e.style.getPropertyPriority("background"))})).then((function(){return e})):Promise.resolve(e)}},impl:{newImage:e}};function e(e){return{inline:function(t){return Te.isDataUrl(e.src)?Promise.resolve():Promise.resolve(e.src).then(t||Te.getAndEncode).then((function(t){return Te.dataAsUrl(t,Te.mimeType(e.src))})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=r,e.src=t}))}))}}}}(),Ae=window.devicePixelRatio||1,_e={imagePlaceholder:void 0,cacheBust:!1},He={toSvg:De,toPng:function(e,t){return Be(e,t||{}).then((function(e){return e.toDataURL()}))},toJpeg:function(e,t){return Be(e,t=t||{}).then((function(e){return e.toDataURL("image/jpeg",t.quality||1)}))},toBlob:function(e,t){return Be(e,t||{}).then(Te.canvasToBlob)},toPixelData:function(e,t){return Be(e,t||{}).then((function(t){return t.getContext("2d").getImageData(0,0,Te.width(e)*Ae,Te.height(e)*Ae).data}))},impl:{fontFaces:Ee,images:Ie,util:Te,inliner:Pe,options:{}}};function De(e,t){return function(e){"undefined"===typeof e.imagePlaceholder?He.impl.options.imagePlaceholder=_e.imagePlaceholder:He.impl.options.imagePlaceholder=e.imagePlaceholder;"undefined"===typeof e.cacheBust?He.impl.options.cacheBust=_e.cacheBust:He.impl.options.cacheBust=e.cacheBust}(t=t||{}),Promise.resolve(e).then((function(e){return Me(e,t.filter,!0)})).then(We).then(Ke).then((function(e){t.bgcolor&&(e.style.backgroundColor=t.bgcolor);t.width&&(e.style.width=t.width+"px");t.height&&(e.style.height=t.height+"px");t.style&&Object.keys(t.style).forEach((function(n){e.style[n]=t.style[n]}));return e})).then((function(n){return function(e,t,n){return Promise.resolve(e).then((function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)})).then(Te.escapeXhtml).then((function(e){return'<foreignObject x="0" y="0" width="100%" height="100%">'+e+"</foreignObject>"})).then((function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'">'+e+"</svg>"})).then((function(e){return"data:image/svg+xml;charset=utf-8,"+e}))}(n,(t.width||Te.width(e))*Ae,t.height||Te.height(e)*Ae)}))}function Be(e,t){return De(e,t).then(Te.makeImage).then(Te.delay(100)).then((function(n){var r=function(e){var n=document.createElement("canvas"),r=t.width||Te.width(e),o=t.height||Te.height(e);if(n.width=r*Ae,n.height=o*Ae,n.style.width=r+"px",n.style.height=o+"px",n.getContext("2d").scale(Ae,Ae),t.bgcolor){var i=n.getContext("2d");i.fillStyle=t.bgcolor,i.fillRect(0,0,n.width,n.height)}return n}(e);return r.getContext("2d").drawImage(n,0,0),r}))}function Me(e,t,n){return n||!t||t(e)?Promise.resolve(e).then((function(e){return e instanceof HTMLCanvasElement?Te.makeImage(e.toDataURL()):e.cloneNode(!1)})).then((function(n){return function(e,t,n){var r=e.childNodes;return 0===r.length?Promise.resolve(t):o(t,Te.asArray(r),n).then((function(){return t}));function o(e,t,n){var r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return Me(t,n)})).then((function(t){t&&e.appendChild(t)}))})),r}}(e,n,t)})).then((function(t){return function(e,t){return t instanceof Element?Promise.resolve().then(n).then(r).then(o).then(i).then((function(){return t})):t;function n(){function n(e,t){function n(e,t){Te.asArray(e).forEach((function(n){t.setProperty(n,e.getPropertyValue(n),e.getPropertyPriority(n))}))}e.cssText?t.cssText=e.cssText:n(e,t)}n(window.getComputedStyle(e),t.style)}function r(){function n(n){var r=window.getComputedStyle(e,n),o=r.getPropertyValue("content");if(""!==o&&"none"!==o){var i=Te.uid();t.className=t.className+" "+i;var a=document.createElement("style");a.appendChild(c(i,n,r)),t.appendChild(a)}function c(e,t,n){var r="."+e+":"+t,o=n.cssText?i(n):a(n);return document.createTextNode(r+"{"+o+"}");function i(e){var t=e.getPropertyValue("content");return e.cssText+" content: "+t+";"}function a(e){return Te.asArray(e).map(t).join("; ")+";";function t(t){return t+": "+e.getPropertyValue(t)+(e.getPropertyPriority(t)?" !important":"")}}}}[":before",":after"].forEach((function(e){n(e)}))}function o(){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function i(){t instanceof SVGElement&&(t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t instanceof SVGRectElement&&["width","height"].forEach((function(e){var n=t.getAttribute(e);n&&t.style.setProperty(e,n)})))}}(e,t)})):Promise.resolve()}function We(e){return Ee.resolveAll().then((function(t){var n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}function Ke(e){return Ie.inlineAll(e).then((function(){return e}))}var Fe=He;function Le(e){return new Promise((function(t,n){var r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=function(){t(JSON.parse(r.result))}}))}function Ve(){return(Ve=Object(Ne.a)(Se.a.mark((function e(t){var n;return Se.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Le(t);case 2:if((n=e.sent).version<=1){e.next=6;break}return C.b.error("\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\uff0c\u8bf7\u4f7f\u7528\u6700\u65b0\u7248\u672c"),e.abrupt("return");case 6:X(n);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){var e=new Blob([JSON.stringify(Object(b.i)($))],{type:"application/json"}),t=document.createElement("a");t.download=($.title||"\u672a\u6807\u9898")+".json",t.href=URL.createObjectURL(e),t.click(),URL.revokeObjectURL(t.href)}var Re=n(2),Ye=ve.a.SubMenu,Ue=w((function(e){!function(e){Ve.apply(this,arguments)}(e.target.files[0])})),Xe=w((function(){j.selectedNotationKey=null,Fe.toPng(document.querySelector("#temp_svg"),{bgcolor:"white"}).then((function(e){var t=document.createElement("a");t.download=($.title||"\u672a\u6807\u9898")+".png",t.href=e,t.click()}))})),Je=y((function(e){switch(e.key){case"undo":m(-1);break;case"redo":m(1);break;case"reset-title":k((function(){$.title="\u3010\u6b4c\u66f2\u540d\u79f0\u3011"}));break;case"reset-authors":$.authors=["\u3010\u4f5c\u66f2\u8005\u3011 \u4f5c\u66f2","\u3010\u586b\u8bcd\u8005\u3011 \u586b\u8bcd","\u3010\u8bb0\u8c31\u8005\u3011 \u8bb0\u8c31"];break;case"add-paragraph":$.paragraphs.push(M())}})),Ge=y((function(e){j.shouldNotationBlurAfterClick&&j.selectedNotationKey&&(j.lastSelectedNotationKey=j.selectedNotationKey,j.selectedNotationKey=null),j.shouldNotationBlurAfterClick=!0})),$e=y((function(e){var t=e.key.toLowerCase(),n=e.shiftKey,r=e.ctrlKey;if(j.selectedNotationKey){if(j.helpDialogVisible||j.configDialogVisible)return;var o=L(j.selectedNotationKey),i=o.paragraph,a=o.notation,c=o.paragraphIndex,s=o.notationIndex;if(!a)return;switch(!0){case A(t)&&!r&&!n:a.note=t;break;case"("===t&&!r:a.note=P;break;case")"===t&&!r:a.note=E;break;case"-"===t&&!r&&!n:a.note=N;break;case"|"===t&&!r:a.note=T;break;case"u"===t&&!r&&!n:a.underline+=1;break;case"u"===t&&!r&&n:a.underline-=1,a.underline=Math.max(0,a.underline);break;case"."===t&&!r&&!n:a.dotted=!a.dotted;break;case"8"===t&&!r&&!n:a.octave+=1;break;case"*"===t&&!r:a.octave-=1;break;case"#"===t&&!r:0!==a.prefixSups.indexOf("\u266f")?("\u266d"===a.prefixSups[0]&&a.prefixSups.shift(),a.prefixSups.unshift("\u266f")):a.prefixSups.shift();break;case"b"===t&&!r&&!n:0!==a.prefixSups.indexOf("\u266d")?("\u266f"===a.prefixSups[0]&&a.prefixSups.shift(),a.prefixSups.unshift("\u266d")):a.prefixSups.shift();break;case"a"===t&&!r&&!n:j.tieSourceKey?j.tieSourceKey===a.key?j.tieSourceKey=null:D(a):j.tieSourceKey=a.key;break;case"a"===t&&!r&&n:if(a.tieTo){var l=L(a.tieTo).notation;l&&(l.tieTo=null),a.tieTo=null;break}case"!"===t&&!r:a.breakUnderline=!a.breakUnderline;break;case"~"===t&&!r:a.topDecorators.includes("~")?a.topDecorators.splice(a.topDecorators.indexOf("~"),1):a.topDecorators.push("~");break;case"enter"===t&&!r&&!n:if(i.notations[s+1])j.selectedNotationKey=i.notations[s+1].key;else{var u=_();i.notations.push(u),j.selectedNotationKey=u.key}break;case"l"===t&&!r&&!n:var d,f=i.notations[s+1]||(null===(d=$.paragraphs[c+1].notations)||void 0===d?void 0:d.at(0));f&&(j.selectedNotationKey=f.key);break;case"enter"===t&&!r&&n:i.notations[s-1]&&(j.selectedNotationKey=i.notations[s-1].key);break;case"h"===t&&!r&&!n:var h,p=i.notations[s-1]||(null===(h=$.paragraphs[c-1].notations)||void 0===h?void 0:h.at(-1));p&&(j.selectedNotationKey=p.key);break;case"enter"===t&&r&&!n:var v=_();s===i.notations.length-1&&c===$.paragraphs.length-1?($.paragraphs.push(B({notations:[v]})),j.selectedNotationKey=$.paragraphs.at(-1).notations.at(0).key):(i.notations.splice(s+1,0,v),j.selectedNotationKey=v.key);break;case"j"===t&&!r&&!n:var g,x=$.paragraphs[c+1];if(null===x||void 0===x||null===(g=x.notations)||void 0===g?void 0:g.length){var O=x.notations[s]||x.notations.at(-1);j.selectedNotationKey=O.key}break;case"k"===t&&!r&&!n:var y,k=$.paragraphs[c-1];if(null===k||void 0===k||null===(y=k.notations)||void 0===y?void 0:y.length){var w=k.notations[s]||k.notations.at(-1);j.selectedNotationKey=w.key}break;case"backspace"===t&&!r&&!n:case"delete"===t&&!r&&!n:i.notations.splice(s,1);var C=i.notations[s]||i.notations[s-1];j.selectedNotationKey=null===C||void 0===C?void 0:C.key;break;case"backspace"===t&&!r&&n:case"delete"===t&&!r&&n:var S,I;$.paragraphs.splice(c,1);var M=$.paragraphs[c]||$.paragraphs.at(-1),W=(null===M||void 0===M||null===(S=M.notations)||void 0===S?void 0:S.at(s))||(null===M||void 0===M||null===(I=M.notations)||void 0===I?void 0:I.at(-1));j.selectedNotationKey=null===W||void 0===W?void 0:W.key;break;case"="===t&&!r&&!n:"boolean"!==typeof i.alignJustify&&(i.alignJustify=!(c===$.paragraphs.length-1)),i.alignJustify=!i.alignJustify;break;case"c"===t&&r&&!n:e.preventDefault(),j.clipboardContent=a;break;case"c"===t&&r&&n:e.preventDefault(),j.clipboardContent=i;break;case"v"===t&&r&&!n:if(e.preventDefault(),j.clipboardContent)switch(j.clipboardContent.type){case"notation":i.notations.splice(s+1,0,H(j.clipboardContent));break;case"paragraph":$.paragraphs.splice(c+1,0,function(e){var t=JSON.parse(JSON.stringify(Object(b.i)(e)));return delete t.key,t.notations=e.notations.map((function(e){return H(e)})),B(t)}(j.clipboardContent));break;default:j.clipboardContent=null}}}else if(!0===["h","j","k","l"].includes(t)){var K,F,V,z,R=L(j.lastSelectedNotationKey).notation;j.selectedNotationKey=null===(K=R||(null===(F=$.paragraphs)||void 0===F||null===(V=F.at(0))||void 0===V||null===(z=V.notations)||void 0===z?void 0:z.at(0)))||void 0===K?void 0:K.key}switch(!0){case"z"===t&&r&&!n:m(-1);break;case"y"===t&&r&&!n:case"z"===t&&r&&n:m(1);break;case"s"===t&&r&&!n:e.preventDefault(),ze();break;case"o"===t&&r&&!n:e.preventDefault();var Y=document.createElement("input");Y.type="file",Y.accept=".json",Y.onchange=Ue,Y.click();break;case"?"===t&&!r:j.helpDialogVisible?j.helpDialogVisible=!1:(j.configDialogVisible=!1,j.helpDialogVisible=!0)}})),qe=Object(Re.jsxs)(ve.a,{children:[Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(ue.a,{}),onClick:function(){X()},children:"\u65b0\u5efa"},"create"),Object(Re.jsxs)(ve.a.Item,{icon:Object(Re.jsx)(de.a,{}),children:["\u6253\u5f00",Object(Re.jsx)("input",{onChange:Ue,accept:".json",type:"file",title:"",style:{opacity:0,cursor:"pointer",width:"100%",left:0,top:0,height:"100%",position:"absolute"}})]},"open"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(fe.a,{}),onClick:function(){ze()},children:"\u4fdd\u5b58"},"save"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(fe.a,{}),onClick:Xe,children:"\u5bfc\u51fa\u4e3a\u56fe\u7247"},"export")]}),Ze=Object(Re.jsxs)(ve.a,{onClick:Je,children:[Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(he.a,{}),children:"\u64a4\u9500"},"undo"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(pe.a,{}),children:"\u91cd\u505a"},"redo"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(be.a,{}),children:"\u6dfb\u52a0\u6bb5\u843d"},"add-paragraph"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(je.a,{}),children:"\u91cd\u7f6e\u6b4c\u66f2\u540d\u79f0"},"reset-title"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(je.a,{}),children:"\u91cd\u7f6e\u4f5c\u8005\u4fe1\u606f"},"reset-authors")]}),Qe=Object(Re.jsxs)(ve.a,{onClick:function(e){var t=e.key;switch(!0){case t.startsWith("convertTo"):var n=t.split("-",2)[1];we(n);break;case"convert-up"===t:ke(2);break;case"convert-down"===t:ke(-2);break;case"convert-up8"===t:ke(12);break;case"convert-down8"===t:ke(-12)}},children:[Object(Re.jsxs)(Ye,{title:"\u8f6c\u5230...",children:[Object(Re.jsx)(ve.a.Item,{children:"1 = C"},"convertTo-C"),Object(Re.jsx)(ve.a.Item,{children:"1 = D"},"convertTo-D"),Object(Re.jsx)(ve.a.Item,{children:"1 = E"},"convertTo-E"),Object(Re.jsx)(ve.a.Item,{children:"1 = F"},"convertTo-F"),Object(Re.jsx)(ve.a.Item,{children:"1 = G"},"convertTo-G"),Object(Re.jsx)(ve.a.Item,{children:"1 = A"},"convertTo-A"),Object(Re.jsx)(ve.a.Item,{children:"1 = B"},"convertTo-B"),Object(Re.jsxs)(ve.a.Item,{children:["1 = ",Object(Re.jsx)("sup",{children:"\u266d"}),"D"]},"convertTo-\u266dD"),Object(Re.jsxs)(ve.a.Item,{children:["1 = ",Object(Re.jsx)("sup",{children:"\u266d"}),"E"]},"convertTo-\u266dE"),Object(Re.jsxs)(ve.a.Item,{children:["1 = ",Object(Re.jsx)("sup",{children:"\u266d"}),"G"]},"convertTo-\u266dG"),Object(Re.jsxs)(ve.a.Item,{children:["1 = ",Object(Re.jsx)("sup",{children:"\u266d"}),"A"]},"convertTo-\u266dA"),Object(Re.jsxs)(ve.a.Item,{children:["1 = ",Object(Re.jsx)("sup",{children:"\u266d"}),"B"]},"convertTo-\u266dB")]},"convertTo"),Object(Re.jsx)(ve.a.Item,{children:"\u5347\u9ad8\u4e00\u4e2a\u97f3"},"convert-up"),Object(Re.jsx)(ve.a.Item,{children:"\u964d\u4f4e\u4e00\u4e2a\u97f3"},"convert-down"),Object(Re.jsx)(ve.a.Item,{children:"\u5347\u9ad8\u4e00\u4e2a\u516b\u5ea6"},"convert-up8"),Object(Re.jsx)(ve.a.Item,{children:"\u964d\u4f4e\u4e00\u4e2a\u516b\u5ea6"},"convert-down8")]},"tone"),et=n(1),tt=n(10),nt=n(143),rt=n.n(nt),ot=["children"];var it=Object(p.a)((function(e){var t=e.children,n=Object(tt.a)(e,ot);return Object(Re.jsx)("svg",Object(et.a)(Object(et.a)({id:"temp_svg",xmlns:" http://www.w3.org/2000/svg",className:rt.a.svg,width:$.canvasWidth,height:$.canvasHeight,onContextMenu:function(e){return e.preventDefault()}},n),{},{children:t}))})),at=n(232),ct=n(231),st=n(234),lt=["propertyName"],ut=["propertyName","label"],dt=Object(p.a)((function(e){var t=e.propertyName,n=Object(tt.a)(e,lt),r=w((function(e){var n=0|Number(e.target.value);$[t]=n}));return Object(Re.jsx)(at.a,Object(et.a)({value:$[t],onChange:r},n))}));function ft(e){var t=e.propertyName,n=e.label,r=Object(tt.a)(e,ut);return Object(Re.jsx)(ct.a.Item,Object(et.a)(Object(et.a)({label:n},r),{},{children:Object(Re.jsx)(dt,{propertyName:t})}))}var ht,pt=function(e){var t=e.visible,n=e.onVisibleChange,o=Object(r.useCallback)((function(){null===n||void 0===n||n.call(null,!1)}),[n]),i=w((function(){var e=K(),t=e.canvasWidth,n=e.canvasHeight,r=e.marginTop,o=e.marginHorizontal,i=e.gapBetweenParagraph,a=e.gapBetweenNotation;Object.assign($,{canvasWidth:t,canvasHeight:n,marginTop:r,marginHorizontal:o,gapBetweenParagraph:i,gapBetweenNotation:a})}));return Object(Re.jsx)(st.a,{style:{top:20},visible:t,title:"\u914d\u7f6e",onCancel:o,footer:[Object(Re.jsx)(s.a,{onClick:i,children:"\u91cd\u7f6e\u4e3a\u9ed8\u8ba4"},"reset"),Object(Re.jsx)(s.a,{type:"primary",onClick:o,children:"\u5173\u95ed"},"close")],children:Object(Re.jsxs)(ct.a,{labelAlign:"right",labelCol:{span:4},children:[Object(Re.jsx)(ct.a.Item,{label:"\u753b\u5e03\u5927\u5c0f",children:Object(Re.jsxs)(at.a.Group,{children:[Object(Re.jsx)(dt,{propertyName:"canvasWidth",style:{width:"45%",textAlign:"center"}}),Object(Re.jsx)(at.a,{className:"site-input-split",style:{width:"10%",borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"x",disabled:!0}),Object(Re.jsx)(dt,{propertyName:"canvasHeight",style:{width:"45%",textAlign:"center"}})]})}),Object(Re.jsx)(ft,{label:"\u9876\u90e8\u8fb9\u8ddd",propertyName:"marginTop"}),Object(Re.jsx)(ft,{label:"\u5de6\u53f3\u8fb9\u8ddd",propertyName:"marginHorizontal"}),Object(Re.jsx)(ft,{label:"\u6bb5\u95f4\u8ddd",propertyName:"gapBetweenParagraph"}),Object(Re.jsx)(ft,{label:"\u97f3\u7b26\u95f4\u8ddd",propertyName:"gapBetweenNotation"})]})})},bt=n(6),jt=n(78),vt=n.n(jt),gt=!1,xt={x:0,y:0};function mt(){return ht||((ht=document.createElement("div")).id="svg-popover-container",ht.style="\n position: absolute;\n left: 0;\n top: 0;\n ",document.body.appendChild(ht),document.addEventListener("scroll",(function(){gt=!0}))),ht}function Ot(){if(gt){var e=mt().getBoundingClientRect();xt={x:-e.x,y:-e.y},gt=!1}return xt}function yt(e){var t=e.children,n=e.renderContent,o=e.renderPopover,a=e.darkMode,c=e.globalClassName,s=e.offset,l=e.placement,u=e.style,d=e.title,f=e.trigger,h=e.visible,p=e.autoHide,b=e.showArrow,j=e.onVisibilityChange,v=Object(r.useRef)({x:0,y:0,width:0,height:0,top:0,bottom:0,left:0,right:0}),g=Object(r.useRef)(!1),x=Object(r.useRef)(),m=Object(r.useRef)(),O=Object(r.useState)(!1),y=Object(bt.a)(O,2),k=y[0],w=y[1],C=Object(r.useState)({x:0,y:0}),S=Object(bt.a)(C,2),N=S[0],T=S[1],P=Object(r.useState)(),E=Object(bt.a)(P,2)[1],I=[vt.a.popover,c].filter(Boolean),A=[vt.a.arrow],_=[vt.a.header],H=s&&s.x||0,D=s&&s.y||0,B={transform:""},M={};l=l.toLowerCase();var W=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;H+=e,D+=t},K=Object(r.useCallback)((function(e){var t;e=null!==(t=e)&&void 0!==t?t:!k;var n=void 0===h?e:h;if(n){if(!x.current)return void setTimeout(K,0);v.current=x.current.getBoundingClientRect()}w(n),j&&j(e)}),[h,k,j]),F=Object(r.useCallback)((function(e){T({x:e.pageX,y:e.pageY}),e.preventDefault(),K(!0)}),[K]);if(Object(r.useEffect)((function(){g.current=!0}),[]),Object(r.useEffect)((function(){if(!1!==p){var e=function(e){if("keydown"===e.type&&"Escape"===e.key)K(!1);else if("mouseup"===e.type){for(var t=e.target;t;t=t.parentElement){if(t===m.current)return;if(t===x.current){if("context"===f&&2!==e.button)continue;if("click"===f&&0!==e.button)continue;return}}K(!1)}};return k&&(document.addEventListener("mouseup",e),document.addEventListener("keydown",e)),function(){document.removeEventListener("mouseup",e),document.removeEventListener("keydown",e)}}}),[k,p,K,f]),void 0!==h&&h!==k&&(g.current?K():setTimeout((function(){E([])}),0)),"context"!==f){var L=v.current;switch(!0){case/^(left|right)(top|center|bottom)?$/i.test(l):B.minHeight="32px",l.startsWith("right")?B.left=L.right+"px":(B.left=L.left+"px",B.transform+=" translate(-100%, 0)"),l.endsWith("top")?(B.top=L.top+"px",B.transform+=" translate(0, 0)",M.top="16px"):l.endsWith("bottom")?(B.top=L.bottom+"px",B.transform+=" translate(0, -100%)",M.bottom="0"):(B.top=L.y+L.height/2+"px",B.transform+=" translate(0, -50%)",M.top="50%");break;case/^(top|bottom)(left|center|right)?$/i.test(l):default:l.startsWith("bottom")?B.top=L.bottom+"px":(B.top=L.y+"px",B.transform+=" translate(0, -100%)"),l.endsWith("left")?(B.left=L.left+"px",M.left="16px"):l.endsWith("right")?(B.left=L.right+"px",B.transform+=" translate(-100%, 0)",M.right="0"):(B.left=L.right-L.width/2+"px",B.transform+=" translateX(-50%)",M.left="50%")}switch(!0){case!b:break;case l.startsWith("left"):W(-8),A.push("left");break;case l.startsWith("right"):W(8),A.push("right");break;case l.startsWith("bottom"):W(0,8),A.push("bottom");break;case l.startsWith("top"):default:W(0,-8),A.push("top")}W(Ot().x,Ot().y),B.transform+=" translate(".concat(H,"px, ").concat(D,"px)")}else B.left=N.x,B.top=N.y,B.transform="translate(".concat(H,"px, ").concat(D,"px)");return a&&(I.push("dark"),A.push("dark"),_.push("dark")),B=Object.assign(B,u),Object(Re.jsxs)(Re.Fragment,{children:["[]",Object(Re.jsx)("g",{type:"noop",ref:x,onClick:"click"===f?function(){return K()}:void 0,onMouseEnter:"hover"===f?function(){return K(!0)}:void 0,onMouseLeave:"hover"===f?function(){return K(!1)}:void 0,onContextMenu:"context"===f?F:void 0,children:t}),k&&Object(i.createPortal)(Object(Re.jsx)("div",{ref:m,className:I.join(" "),style:B,children:o?"function"===typeof o?o():o:Object(Re.jsxs)(Re.Fragment,{children:[b&&Object(Re.jsx)("div",{className:A.join(" "),style:M}),d&&Object(Re.jsx)("header",{className:_.join(" "),children:d}),Object(Re.jsx)("div",{className:d?vt.a.content:null,children:"function"===typeof n?n():null!==n&&void 0!==n?n:null})]})}),mt())]})}yt.defaultProps={trigger:"click",placement:"top",showArrow:!0};var kt=o.a.memo(yt),wt=n(79),Ct=n.n(wt),St=function(e,t){var n=e.children,o=e.title,i=e.initialValue,a=e.inputType,c=e.options,l=e.overlay,u=e.onChange,d=e.popoverProps,f=Object(r.useState)(i),h=Object(bt.a)(f,2),p=h[0],b=h[1],j=Object(r.useState)(!1),v=Object(bt.a)(j,2),g=v[0],x=v[1];Object(r.useImperativeHandle)(t,(function(){return{showPopover:x.bind(null,!0),hidePopover:x.bind(null,!1)}}),[]);var m,O=Object(r.useCallback)((function(e){x(e),e||b(i)}),[i]),y=Object(r.useCallback)((function(e){b(e.target.value)}),[]),k=Object(r.useCallback)(function(){var e=Object(Ne.a)(Se.a.mark((function e(t){var n;return Se.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0===t?p:t,e.next=3,u&&u(n);case 3:!1!==e.sent&&x(!1);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[p,u]),w=Object(r.useCallback)((function(){x(!1)}),[]),C=Object(r.useCallback)((function(){b(i),x(!1)}),[i]),S=Object(r.useCallback)((function(){return Object(Re.jsxs)(Re.Fragment,{children:[Object(Re.jsx)(at.a,{autoFocus:!0,value:p,onChange:y,onPressEnter:function(){return k()}}),Object(Re.jsxs)("div",{className:Ct.a.buttonGroup,children:[Object(Re.jsx)(s.a,{type:"primary",className:Ct.a.button,onClick:function(){return k()},children:"\u786e\u5b9a"}),Object(Re.jsx)(s.a,{onClick:C,children:"\u53d6\u6d88"})]})]})}),[p,y,k,C]),N=Object(r.useCallback)((function(){return l?Object(Re.jsx)("div",{onClick:w,children:l}):Object(Re.jsx)(ve.a,{className:Ct.a.menu,children:(c||[]).filter((function(e){return!1!==e.visible})).map((function(e){return Object(Re.jsx)(ve.a.Item,{icon:e.icon,className:Ct.a.menuItem+(e.key===i?" selected":""),onClick:function(){return k(e.key)},children:e.text},e.key)}))})}),[i,c,k,w,l]);if("select"===a)m=N;else m=S;return Object(Re.jsx)(kt,Object(et.a)(Object(et.a)({trigger:"select"===a?"context":"click",title:o,renderContent:m,renderPopover:undefined,visible:g,placement:"bottom",onVisibilityChange:O},d),{},{children:n}))},Nt=o.a.forwardRef(St),Tt=["children","type","editable","offset","offsetX","offsetY"];function Pt(e){var t,n,r=e.children,o=e.type,i=e.editable,a=e.offset,c=e.offsetX,s=e.offsetY,l=Object(tt.a)(e,Tt);return c=0|(null!==(t=null===a||void 0===a?void 0:a.x)&&void 0!==t?t:c),s=0|(null!==(n=null===a||void 0===a?void 0:a.y)&&void 0!==n?n:s),Object(Re.jsx)("g",Object(et.a)(Object(et.a)({type:o,transform:"translate(".concat(c,",").concat(s,")"),style:i?{cursor:"pointer"}:null},l),{},{children:r}))}function Et(e){var t=document.createElement("span");return t.appendChild(document.createTextNode(e)),t.innerHTML.replace(/\s/g,"&nbsp;")}var It=["children","editable"];function At(e){var t=e.children,n=e.editable,r=Object(tt.a)(e,It);return"string"===typeof t?Object(Re.jsx)("text",Object(et.a)({x:"0",y:"0",style:n?{cursor:"pointer"}:null,dominantBaseline:"hanging",stroke:"none",fontWeight:"bold",fill:"currentColor",dangerouslySetInnerHTML:{__html:Et(t)}},r)):Object(Re.jsx)("text",Object(et.a)(Object(et.a)({x:"0",y:"0",style:n?{cursor:"pointer"}:null,dominantBaseline:"hanging",stroke:"none",fontWeight:"bold",fill:"currentColor"},r),{},{children:t}))}var _t=["C","D","E","F","G","A","B","\u266dC","\u266dD","\u266dE","\u266dF","\u266dG","\u266dA","\u266dB"].map((function(e){return{key:e,text:e}})),Ht=y((function(e){$.tone=e})),Dt=y((function(e){$.speed=e})),Bt=y((function(e){var t=String(e).split("/");if(2!==t.length)return C.b.error("\u8bf7\u4ee5\u3010*/*\u3011\u7684\u683c\u5f0f\u8f93\u5165\u8282\u62cd\uff01"),!1;var n=[parseInt(t[0],10),parseInt(t[1],10)],r=n[0],o=n[1];if(!(r>0&&o>0))return C.b.error("\u8bf7\u8f93\u5165\u5927\u4e8e0\u7684\u62cd\u6570\u548c\u65f6\u503c\uff01"),!1;$.beat=[r,o]}));var Mt=Object(p.a)((function(){return Object(Re.jsxs)(Re.Fragment,{children:[Object(Re.jsx)(Nt,{inputType:"select",initialValue:$.tone,options:_t,onChange:Ht,popoverProps:{trigger:"click"},children:Object(Re.jsxs)(Pt,{type:"tone",editable:!0,offsetX:$.marginHorizontal,offsetY:le.titleOffsetY,children:[Object(Re.jsx)(At,{children:"1\xa0\xa0= "}),$.tone.startsWith("\u266d")&&Object(Re.jsx)(At,{x:"27",y:"-2",fontSize:$.defaultSubFontSize,children:"\u266d"}),Object(Re.jsx)(At,{editable:!0,x:$.tone.startsWith("\u266d")?36:29,children:$.tone.at(-1)})]})}),Object(Re.jsx)(Nt,{title:"\u8282\u62cd\uff1a",inputType:"number",initialValue:$.beat.join("/"),onChange:Bt,children:Object(Re.jsxs)(Pt,{type:"beat",editable:!0,offsetX:$.marginHorizontal+64,offsetY:le.titleOffsetY,children:[Object(Re.jsx)(At,{x:"0",y:"-8",textAnchor:"middle",children:$.beat[0]}),Object(Re.jsx)(At,{x:"0",y:"12",textAnchor:"middle",children:$.beat[1]}),Object(Re.jsx)("line",{x1:"-8",y1:"8",x2:"8",y2:"8",stroke:"currentColor"})]})}),Object(Re.jsx)(Nt,{title:"\u901f\u5ea6\uff08bps\uff09\uff1a",inputType:"number",initialValue:$.speed,onChange:Dt,children:Object(Re.jsxs)(Pt,{editable:!0,type:"speed",offsetX:$.marginHorizontal,offsetY:le.titleOffsetY+22,children:[Object(Re.jsx)(At,{x:"-4",children:"\u2669"}),Object(Re.jsxs)(At,{x:"16",children:["=\xa0",$.speed]})]})})]})})),Wt=n(243),Kt=[{key:"create",text:"\u6dfb\u52a0",icon:Object(Re.jsx)(ue.a,{}),onClick:function(){$.authors.push("\u4f5c\u8005\u4fe1\u606f")}},{key:"delete",text:"\u5220\u9664",icon:Object(Re.jsx)(Wt.a,{}),onClick:function(e){$.authors.splice(e,1)}}],Ft=[{key:"create",text:"\u6dfb\u52a0\u4f5c\u8005\u4fe1\u606f",icon:Object(Re.jsx)(ue.a,{}),onClick:function(){$.authors.push("\u3010\u8bb0\u8c31\u8005\u3011 \u8bb0\u8c31")}}],Lt=y((function(e,t){var n=Kt.find((function(e){return e.key===t}));null===n||void 0===n||n.onClick(e)})),Vt=y((function(e){var t=Ft.find((function(t){return t.key===e}));null===t||void 0===t||t.onClick()})),zt=y((function(e,t){if(!t)return new Promise((function(t){st.a.confirm({title:"\u5220\u9664\u8fd9\u6761\u4f5c\u8005\u4fe1\u606f\uff1f",okText:"\u786e\u5b9a",cancelText:"\u53d6\u6d88",onOk:function(){t(!0),$.authors.splice(e,1)},onCancel:function(){t(!0)}})}));$.authors[e]=t}));var Rt=Object(p.a)((function(){return Object(Re.jsxs)(Pt,{type:"authors",offsetX:$.canvasWidth-$.marginHorizontal,offsetY:le.titleOffsetY,children:[Object(Re.jsx)(Nt,{inputType:"select",options:Ft,popoverProps:{trigger:"context"},onChange:Vt,children:Object(Re.jsx)("rect",{x:$.marginHorizontal-150,y:"-64",width:150,height:150,fill:$.authors.length?"none":"transparent"})}),$.authors.map((function(e,t){return Object(Re.jsx)(Nt,{inputType:"select",options:Kt,popoverProps:{trigger:"context"},onChange:Lt.bind(null,t),children:Object(Re.jsx)(Nt,{title:"\u4f5c\u8005\u4fe1\u606f\uff1a",initialValue:e,onChange:zt.bind(null,t),children:Object(Re.jsx)(At,{editable:!0,y:22*t,textAnchor:"end",children:e})})},t+e)}))]})})),Yt=y((function(e){$.title=e}));var Ut=Object(p.a)((function(){var e=Object(r.useRef)();return Object(Re.jsx)(Pt,{type:"title",offsetY:$.marginTop,children:Object(Re.jsx)(Nt,{ref:e,title:"\u6b4c\u66f2\u540d\u79f0\uff1a",initialValue:$.title,onChange:Yt,children:Object(Re.jsx)(At,{editable:!0,x:"50%",fontSize:"32",fill:"currentColor",stroke:"none",textAnchor:"middle",children:$.title})})})}));function Xt(){return Object(Re.jsxs)(Re.Fragment,{children:[Object(Re.jsx)(Ut,{}),Object(Re.jsx)(Mt,{}),Object(Re.jsx)(Rt,{})]})}var Jt=o.a.memo(Xt),Gt=n(52),$t=n.n(Gt);function qt(e){var t=e.kbd,n=e.desc;return Object(Re.jsxs)("li",{className:$t.a.listItem,children:[Object(Re.jsx)("kbd",{className:$t.a.kbd,children:t}),Object(Re.jsx)("span",{children:n})]})}var Zt=function(e){var t=e.visible,n=e.onVisibleChange,o=Object(r.useCallback)((function(){null===n||void 0===n||n.call(null,!1)}),[n]);return Object(Re.jsxs)(st.a,{width:"100%",height:"90%",style:{top:"4%"},visible:t,title:"\u5e2e\u52a9",onCancel:o,footer:Object(Re.jsx)(s.a,{type:"primary",onClick:o,children:"\u786e\u5b9a"},"close"),children:[Object(Re.jsx)("h2",{children:"\u5feb\u6377\u952e"}),Object(Re.jsx)("h3",{children:"\u5168\u5c40"}),Object(Re.jsxs)("ul",{className:$t.a.list,children:[Object(Re.jsx)(qt,{kbd:"\uff1f",desc:"\u663e\u793a\u6b64\u5e2e\u52a9"}),Object(Re.jsx)(qt,{kbd:"Ctrl+Z",desc:"\u64a4\u9500"}),Object(Re.jsx)(qt,{kbd:"Ctrl+Shift+Z",desc:"\u91cd\u505a"}),Object(Re.jsx)(qt,{kbd:"Ctrl+O",desc:"\u6253\u5f00\u6587\u4ef6"}),Object(Re.jsx)(qt,{kbd:"h j k l",desc:"\u79fb\u52a8\u7126\u70b9"})]}),Object(Re.jsx)("h3",{children:"\u4ec5\u9009\u4e2d\u7b26\u53f7\u65f6"}),Object(Re.jsx)("h4",{children:"\u8f93\u5165\u97f3\u7b26"}),"\u76f4\u63a5\u6309\u952e\u76d8\u4e0a\u76f8\u5e94\u7684\u952e\u5373\u53ef\u8f93\u5165\u5230\u5f53\u524d\u7b26\u53f7\u3002\u652f\u6301\u7684\u97f3\u7b26\u7b26\u53f7\u6709\uff1a",Object(Re.jsxs)("p",{children:[Object(Re.jsx)("kbd",{className:$t.a.kbd,children:"0~7"}),Object(Re.jsx)("kbd",{className:$t.a.kbd,children:"\u2500 ( )"})]}),Object(Re.jsx)("h4",{children:"\u8f93\u5165\u8f85\u52a9\u5143\u7d20"}),Object(Re.jsxs)("ul",{className:$t.a.list,children:[Object(Re.jsx)(qt,{kbd:"a",desc:"\u9009\u62e9\u8fde\u97f3\u7ebf\u8d77\u6b62\u7b26\u53f7"}),Object(Re.jsx)(qt,{kbd:"A",desc:"\u5220\u9664\u8fde\u97f3\u7ebf"}),Object(Re.jsx)(qt,{kbd:"|",desc:"\u8f93\u5165\u5c0f\u8282\u7ebf"}),Object(Re.jsx)(qt,{kbd:".",desc:"\u8f93\u5165\u9644\u70b9"}),Object(Re.jsx)(qt,{kbd:"~",desc:"\u98a4\u97f3\u7b26\u53f7"}),Object(Re.jsx)(qt,{kbd:"u / U",desc:"\u589e\u51cf\u589e\u51cf\u65f6\u7ebf"}),Object(Re.jsx)(qt,{kbd:"!",desc:"\u6253\u65ad\u589e\u51cf\u65f6\u7ebf"}),Object(Re.jsx)(qt,{kbd:"8 / *",desc:"\u516b\u5ea6\u5706\u70b9"}),Object(Re.jsx)(qt,{kbd:"# / b",desc:"\u97f3\u7b26\u5347/\u964d"})]}),Object(Re.jsx)("h4",{children:"\u64cd\u4f5c"}),Object(Re.jsxs)("ul",{className:$t.a.list,children:[Object(Re.jsx)(qt,{kbd:"Enter",desc:"\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u97f3\u7b26"}),Object(Re.jsx)(qt,{kbd:"Shift+Enter",desc:"\u79fb\u52a8\u5230\u4e0a\u4e00\u4e2a\u97f3\u7b26"}),Object(Re.jsx)(qt,{kbd:"Ctrl+Enter",desc:"\u5728\u5f53\u524d\u4f4d\u7f6e\u540e\u63d2\u5165\u97f3\u7b26"}),Object(Re.jsx)(qt,{kbd:"Delete",desc:"\u5220\u9664\u5f53\u524d\u97f3\u7b26"}),Object(Re.jsx)(qt,{kbd:"Shift+Delete",desc:"\u5220\u9664\u5f53\u524d\u6bb5\u843d"}),Object(Re.jsx)(qt,{kbd:"=",desc:"\u6bb5\u843d\u662f\u5426\u4e24\u7aef\u5bf9\u9f50"}),Object(Re.jsx)(qt,{kbd:"h j k l",desc:"Vi\u98ce\u683c\u79fb\u52a8\u7126\u70b9"}),Object(Re.jsx)(qt,{kbd:"Ctrl+C",desc:"\u590d\u5236\u5f53\u524d\u97f3\u7b26"}),Object(Re.jsx)(qt,{kbd:"Ctrl+Shift+C",desc:"\u590d\u5236\u5f53\u524d\u6bb5\u843d"}),Object(Re.jsx)(qt,{kbd:"Ctrl+V",desc:"\u7c98\u8d34"})]}),Object(Re.jsx)("h2",{children:"\u63d0\u793a"}),Object(Re.jsxs)("ul",{className:$t.a.list,children:[Object(Re.jsx)("li",{children:"\u6bb5\u843d\u4e0a\u53ef\u4ee5\u53f3\u952e\u5355\u51fb\u5f39\u51fa\u64cd\u4f5c\u83dc\u5355"}),Object(Re.jsx)("li",{children:"\u589e\u51cf\u65f6\u7ebf\u9ed8\u8ba4\u8fde\u7eed\uff0c\u53ef\u5728\u97f3\u7b26\u53f3\u952e\u83dc\u5355\u4e2d\u9009\u62e9\u6253\u65ad"})]})]})},Qt=n(244);function en(e){var t=y((function(t){switch(t.key){case"add":var n=$.paragraphs.findIndex((function(t){return t.key===e.key})),r=B({notations:[_({note:"0"}),_({note:"0"}),_({note:"0"}),_({note:"0"}),_({note:T})]});-1!==n?$.paragraphs.splice(n+1,0,r):$.paragraphs.push(r);break;case"delete":var o=$.paragraphs.findIndex((function(t){return t.key===e.key}));-1!==o&&$.paragraphs.splice(o,1)}}));return Object(Re.jsxs)(ve.a,{onClick:t,children:[Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(Qt.a,{}),children:"\u6dfb\u52a0\u6bb5\u843d"},"add"),Object(Re.jsx)(ve.a.Item,{danger:!0,icon:Object(Re.jsx)(Wt.a,{}),children:"\u5220\u9664\u6bb5\u843d"},"delete")]})}var tn=n(245),nn=n(246),rn=function(e,t){var n=e.tieTo,r=y((function(t){var r=t.key;switch(!0){case"tie"===r:if(!n)return void(j.tieSourceKey=e.key);var o=L(e.tieTo).notation;o&&(o.tieTo=null),e.tieTo=null;break;case"break-underline"===r:e.breakUnderline=!e.breakUnderline;break;case r.startsWith("separator-"):var i=r.split("-",2)[1];e.note=i}}));return Object(Re.jsxs)(ve.a,{onClick:r,style:{minWidth:"80px"},children:[A(e)&&Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(tn.a,{}),children:e.breakUnderline?"\u5728\u6b64\u5904\u5ef6\u7eed\u589e\u51cf\u65f6\u7ebf":"\u5728\u6b64\u5904\u6253\u65ad\u589e\u51cf\u65f6\u7ebf"},"break-underline"),A(e)&&Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(nn.a,{}),notation:e,children:e.tieTo?"\u5220\u9664\u8fde\u97f3\u7ebf":"\u4ece\u6b64\u5904\u6dfb\u52a0\u8fde\u97f3\u7ebf\u5230..."},"tie"),Object(Re.jsx)(ve.a.Item,{icon:Object(Re.jsx)(Wt.a,{}),children:"\u5220\u9664\u7b26\u53f7"},"delete")]})};var on=n(146),an=n.n(on);function cn(e){var t=e.offsetX,n=e.notation,r=(e.paragraph,y((function(){j.selectedNotationKey=n.key,j.shouldNotationBlurAfterClick=!1,D(n)}))),o=le.underlineStepOffsetY*(0|n.underline),i=n.octave>0?-le.octaveInitialOffsetAbove:le.octaveInitialOffsetBelow+o,a=(n.octave>0?-1:1)*le.octaveStepOffsetY,c=0;n.octave>0&&(c=a*Math.abs(n.octave));return Object(Re.jsx)(Nt,{inputType:"select",popoverProps:{trigger:"context"},overlay:rn(n),children:Object(Re.jsxs)(Pt,{editable:!0,type:"notation",offsetX:t,onClick:r,className:j.selectedNotationKey===n.key?an.a.selectedNotation:"",children:[function(){var e=n.prefixSups||[];return e.map((function(t,n){return Object(Re.jsx)(At,{dominantBaseline:"middle",textAnchor:"middle",fontSize:$.defaultSubFontSize,x:-le.xWidth-(re(e.slice(0,n).join(""))+2*n),y:-le.subXHeight/2+2,children:t},n+t)}))}(),(n.topDecorators||[]).map((function(e,t){return Object(Re.jsx)(At,{dominantBaseline:"middle",textAnchor:"middle",fontSize:$.defaultSubFontSize,y:c-(t+1)*le.subXHeight+2,children:e},t+e)})),function(){var e;return n.note===N&&(e="scale(0.8, 1)"),Object(Re.jsx)(At,{dominantBaseline:"middle",textAnchor:"middle",transform:e,children:n.note})}(),n.dotted&&Object(Re.jsx)("circle",{type:"dot",cx:le.xWidth+4,cy:"-2",r:"2",fill:"currentColor"}),function(e){var t=Math.abs(Number(e));return Number.isInteger(t)?Array(t).fill(0,0,t):[]}(n.octave).map((function(e,t){return Object(Re.jsx)("circle",{type:"octave",cx:"0",cy:i+a*t,fill:"currentColor",r:"2"},t)}))]})})}cn.defaultProps={offsetX:0,offsetY:0};var sn=Object(p.a)(cn);var ln=Object(p.a)((function(e){var t,n=e.paragraph,r=e.offsetY,o=e.alignJustify,i=n.notations||[],a=[],c=0;if(o&&(null===(t=n.notations)||void 0===t?void 0:t.length)>1){var s=function(e){var t=e.notations||[];return 0===t.length?0:t.map((function(e){return se(e)})).reduce((function(e,t){return e+t}),0)-$.gapBetweenNotation}(n);c=(le.maxContentWidth-s)/(n.notations.length-1)}var l=i.map((function(e,t){return le.xWidth/2+function(e){for(var t=0,n=0;n<e;n++){var r=i[n];a[n]=a[n]||se(r),t+=a[n]}return t+ae(i[e])}(t)+c*t})),u=function(e,t,n){return Object(Re.jsx)("line",{x1:l[t]-le.xWidth,x2:l[n]+le.xWidth,y1:e,y2:e,stroke:"currentColor"},"".concat(t,"_").concat(n,"_").concat(e))};return Object(Re.jsxs)(Pt,{type:"paragraph",offsetY:r,children:[function(){var e=oe(n);return Object(Re.jsx)(Nt,{inputType:"select",overlay:en(n),children:Object(Re.jsx)("rect",{x:-le.xWidth/2,y:-ie(n),width:le.maxContentWidth,height:e,fill:"transparent"})})}(),function(){for(var e=[],t=new Map,n=function(n){var r=i[n];if(r.tieTo){var o=i.findIndex((function(e){return e.key===r.tieTo}));if(o<=n)return"continue";for(var a=0,c=n;c<=o;++c){var s=void 0;t.has(i[c].key)?s=t.get(i[c].key):(s=-ce(i[c]),t.set(i[c].key,s)),a=Math.min(a,s)}e.push(function(e,t,n){var r=l[t],o=r+4,i=l[n],a=i-4,c=i-r,s=21917145491103032e-21*c*c*c-.0062948773732605465*c*c+.6378785891964498*c-.6843414475200537,u=e-(s=Math.max(Math.min(s,le.maxTieBezierOffset),le.minTieHeight));return Object(Re.jsx)("path",{d:"M".concat(r," ").concat(e," C").concat(o," ").concat(u," ").concat(a," ").concat(u," ").concat(i," ").concat(e),stroke:"currentColor",fill:"none"},"".concat(t,"_").concat(n,"_").concat(e))}(a,n,o))}},r=0;r<i.length;++r)n(r);return e}(),n.notations.map((function(e,t){return Object(Re.jsx)(sn,{notation:e,paragraph:n,offsetX:l[t]},e.key)})),function(){for(var e=[],t=i.map((function(e){return e.underline>0?e.underline:0})),n=le.underlineInitialOffsetY;t.some((function(e){return e>0}));){for(var r=-1,o=r,a=0;a<i.length;++a){var c=i[a];t[a]>0?(r>=0?c.breakUnderline?(e.push(u(n,r,o)),r=o=a):o=a:r=o=a,a===i.length-1&&(e.push(u(n,r,o)),r=o=-1),--t[a]):r>=0&&(e.push(u(n,r,o)),r=o=-1)}n+=le.underlineStepOffsetY}return e}()]})})),un=n(114),dn=n.n(un);var fn=Object(p.a)((function(){var e=[];function t(t){for(var n=$.paragraphs||[],r=0,o=0;o<t;o++){var i=n[o];e[o]=e[o]||oe(i)+$.gapBetweenParagraph,r+=e[o]}return r+=ie(n[t])}var n=w((function(e){j.configDialogVisible=e})),o=w((function(e){j.helpDialogVisible=e}));return Object(r.useEffect)((function(){return document.addEventListener("keydown",$e),function(){document.removeEventListener("keydown",$e)}}),[]),Object(Re.jsxs)("div",{className:dn.a.container,style:{width:$.canvasWidth+"px"},children:[Object(Re.jsx)("div",{className:dn.a.headerWrapper,children:Object(Re.jsxs)("div",{className:dn.a.header,style:{width:$.canvasWidth+"px"},children:[Object(Re.jsx)(c.a,{overlay:qe,placement:"bottomLeft",children:Object(Re.jsx)(s.a,{icon:Object(Re.jsx)(l.a,{}),type:"text",children:"\u6587\u4ef6"})}),Object(Re.jsx)(c.a,{overlay:Ze,placement:"bottomLeft",children:Object(Re.jsx)(s.a,{icon:Object(Re.jsx)(u.a,{}),type:"text",children:"\u7f16\u8f91"})}),Object(Re.jsx)(c.a,{overlay:Qe,placement:"bottomLeft",children:Object(Re.jsx)(s.a,{icon:Object(Re.jsx)(d.a,{}),type:"text",children:"\u8f6c\u8c03"})}),Object(Re.jsx)(s.a,{icon:Object(Re.jsx)(f.a,{}),type:"text",onClick:function(){n(!0)},children:"\u914d\u7f6e"}),Object(Re.jsx)(s.a,{icon:Object(Re.jsx)(h.a,{}),type:"text",onClick:function(){o(!0)},children:"\u5e2e\u52a9"})]})}),Object(Re.jsxs)(it,{onClick:Ge,children:[Object(Re.jsx)(Jt,{}),Object(Re.jsx)(Pt,{offsetX:$.marginHorizontal,offsetY:le.headerOffsetY,children:$.paragraphs.map((function(e,n){var r=e.alignJustify;return"boolean"!==typeof r&&(r=!(n===$.paragraphs.length-1)),Object(Re.jsx)(ln,{paragraph:e,offsetY:t(n),alignJustify:r},e.key)}))})]}),Object(Re.jsx)(pt,{visible:j.configDialogVisible,onVisibleChange:n}),Object(Re.jsx)(Zt,{visible:j.helpDialogVisible,onVisibleChange:o})]})}));function hn(){return(hn=Object(Ne.a)(Se.a.mark((function e(){var t;return Se.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!/(\?|&)loadExample(&|$)/.test(window.location.search)){e.next=6;break}return e.next=4,n.e(4).then(n.t.bind(null,252,3));case 4:t=e.sent,X(t.default);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var pn=function(){return Object(r.useEffect)((function(){!function(){hn.apply(this,arguments)}()}),[]),Object(Re.jsx)(G.Provider,{value:$,children:Object(Re.jsx)(fn,{})})},bn=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,253)).then((function(t){var n=t.getCLS,r=t.getFID,o=t.getFCP,i=t.getLCP,a=t.getTTFB;n(e),r(e),o(e),i(e),a(e)}))};n(228);a.a.render(Object(Re.jsx)(o.a.StrictMode,{children:Object(Re.jsx)(pn,{})}),document.getElementById("root")),bn()},52:function(e,t,n){e.exports={list:"HelpModal_list__syZn2",listItem:"HelpModal_listItem__34m_q",kbd:"HelpModal_kbd__RCRud"}},78:function(e,t,n){e.exports={popover:"PopoverOnSvg_popover__3bN4H",arrow:"PopoverOnSvg_arrow__22-aj",content:"PopoverOnSvg_content__1rAgR",header:"PopoverOnSvg_header__URzxW"}},79:function(e,t,n){e.exports={buttonGroup:"EditableContent_buttonGroup__2qXGn",button:"EditableContent_button__6qyvP",menu:"EditableContent_menu__2ah_9",menuItem:"EditableContent_menuItem__3P1Eu"}}},[[229,1,2]]]);
//# sourceMappingURL=main.afb59669.chunk.js.map